Skip to content

AIGetCapabilities

GET ai/chat/capabilities

Lists the capabilities — server-side behavior profiles of the chat — available to the current session. Today there is one: stscript.assistant, the assistant of the script editor.

Call it once per session. Offer the mode only when enabled is true, and send runtimeId and referenceVersion of the returned runtime with every AIChatSendMessage of that mode. When the editor ships another compiler build, its requests are rejected with AI_STSCRIPT_RUNTIME_UNSUPPORTED instead of being checked by a different version.

Access Control

Allowed: client, manager, admin.

Request

GET request
GET https://{broker_domain}/ai/chat/capabilities?accountLogin=7777864
Authorization: <JWT_TOKEN>
{
  "command": "AIGetCapabilities",
  "extID": "1",
  "data": { "accountLogin": 7777864 }
}
const { capabilities } = await platform.AIGetCapabilities({ accountLogin });

Parameters

Parameter Type Description
accountLogin int Account context. Required for a client session of an account owner

Response Data

{
  "protocol": 1,
  "delivery": {
    "schema": 1,
    "modes": ["poll"],
    "partial": true,
    "longPoll": { "maxWaitMs": 4000, "minIntervalMs": 750 }
  },
  "capabilities": [{
    "id": "stscript.assistant",
    "enabled": true,
    "protocolVersion": 1,
    "operations": ["auto", "generate", "explain", "analyze", "fix", "modify"],
    "runtimes": [{
      "runtimeId": "stscript-dsl-sha256:43dc4e50bac043b0c3c0ab7d4bdd059e8a59f6b81384f45b15c3905ca275c8a5",
      "referenceVersion": "reference-b985050748ed89d9",
      "kinds": ["indicator", "robot"],
      "checks": ["parse", "validate", "compile"]
    }],
    "limits": {
      "maxSourceUtf16Units": 64000,
      "maxArtifactsPerRun": 1,
      "maxRepairAttempts": 2,
      "runTimeoutMs": 180000,
      "maxDiagnostics": 100
    },
    "conversations": { "scriptBinding": true },
    "referenceImport": {
      "schema": 1,
      "enabled": true,
      "providers": ["tradingview"],
      "inputModes": ["editor"],
      "sourceFileGeneration": false,
      "checks": [],
      "maxUrls": 3,
      "maxRepairAttempts": 4,
      "runTimeoutMs": 600000
    }
  }]
}
Field Description
delivery How any chat — general or StScript — can follow an answer without the platform WebSocket: modes: ["poll"] allows delivery: "poll" in AIChatSendMessage; partial — AIChatGetRun returns the text written so far; longPoll.maxWaitMs — the longest waitMs (kept under the platform's 5-second call limit); longPoll.minIntervalMs — the shortest gap between two responses with new text
enabled false when the capability is switched off by configuration or for the brand, when no agent of this audience supports it, or when the reference is not verified for the deployed compiler
protocolVersion protocol of the capability's fields; not the version of the language
runtimes compiler builds the server can check against. Empty when the capability is not ready
checks what the server check performs. execute is absent: code is never run in this release
limits the limits to enforce in the interface before sending
conversations scriptBinding: true — conversations are bound to a saved script on the server (scriptId in create, list and update), see Conversations of a script
referenceImport reading a TradingView publication by link, see Reproduce an indicator by link. inputModes: ["editor"] — only in the editor chat, sourceFileGeneration: false — no .sts file artifact yet, checks: [] — no execution or rendering on fixtures yet; the result is the usual checked proposal. runTimeoutMs — a request with a link may run this long (reading, porting a long script, repairs): wait for the run at least this long instead of the general limits.runTimeoutMs

The values in the example are real formats, not real versions: always take them from the response.

Errors

Code Error Description
400 AI_INVALID_DATA A client session of an account owner did not pass accountLogin
403 AI_ACCESS_DENIED The session type may not use the assistant