@archastro/sdk
    Preparing search index...
    Index

    Constructors

    Methods

    • Retrieve script language metadata Returns the full language specification for the ArchAstro scripting engine, including keywords, operators, built-in functions, namespaces, code snippets, and type system information. Use this response to power editor features such as syntax highlighting, autocompletion, hover documentation, and snippet insertion. The specification is static for a given platform version; you do not need to poll it on every session. Requires an authenticated viewer. No additional app scope is needed.

      Returns Promise<ScriptLanguageSpec>

      The script language specification for the current platform version.

    • Retrieve the script-authoring LLM prompt Returns the plain-text system prompt used by script-authoring assistants. The prompt is rendered from the current language specification so builtins, namespaces, snippets, and type-system guidance stay synchronized with the running platform.

      Returns Promise<{ content: ArrayBuffer; mimeType: string }>

      Plain-text system prompt for script-authoring assistants.

    • Execute a workflow script Executes the provided script source and returns the result value together with any print output captured during the run. Use this endpoint to evaluate scripts interactively during development, or to drive automation from external tooling. The script runs with the authenticated viewer's identity by default. Pass run_as_user to impersonate a specific user, or run_as_agent to run as a specific agent. These two params are mutually exclusive — supplying both returns a 422 error. Runtime environment variables defined for the app are automatically injected into the script's variables.env scope. When the script raises a runtime error, the response still returns HTTP 200 with error, findings, and any partial output; the error is also recorded in the app's activity feed.

      Parameters

      • input: {
            run_as_agent?: string;
            run_as_user?: string;
            scope?: Record<string, unknown>;
            script?: string;
        }

        Request body.

        • Optionalrun_as_agent?: string

          Agent ID (agt_...) to impersonate during execution. When set, the script's system.viewer is replaced with a viewer for this agent. Mutually exclusive with run_as_user. null by default.

        • Optionalrun_as_user?: string

          User ID (usr_...) to impersonate during execution. When set, the script's system.viewer is replaced with a viewer for this user. Mutually exclusive with run_as_agent. null by default.

        • Optionalscope?: Record<string, unknown>

          Initial scope injected into the script execution context. Use this to supply variables, system, or other top-level scope keys.

        • Optionalscript?: string

          The script source to execute. Defaults to an empty string.

      Returns Promise<ScriptRunResult>

      The script execution result, including the return value, captured output, and any runtime error or diagnostic findings.

    • List runtime environment variables for scripts Returns metadata for all runtime environment variables available to scripts running within the specified app. The response lists each variable's name and description but does not include resolved values. Use this to surface the available env.* identifiers in script editor autocompletion or to inspect which variables are configured for an app before running a script. Requires an authenticated viewer scoped to the specified app.

      Returns Promise<RuntimeEnvVarList>

      Paginated list of runtime environment variable metadata for the app.

    • Run a script test suite Executes a Jest-style script test source (describe / it / expect) and returns a structured assertion report. Use this endpoint to run unit tests against script logic during development or in CI pipelines. Imports of the form import("script:<lookup_key>") inside the test script resolve against the scripts map supplied in the request body first, then fall back to deployed scripts in the caller's app. This lets you test local changes to scripts before deploying them. Runtime environment variables defined for the app are automatically injected into variables.env within the execution scope. When a mid-run runtime error occurs (after some tests have already executed), the endpoint returns HTTP 200 with passed: false, the partial per-test breakdown, and a top-level error and findings describing the crash. When the test source itself cannot be parsed, the endpoint returns HTTP 422 with the syntax error message.

      Parameters

      • input: {
            scope?: Record<string, unknown>;
            script?: string;
            scripts?: Record<string, unknown>;
        }

        Request body.

        • Optionalscope?: Record<string, unknown>

          Optional overrides for the execution scope. Accepts variables, system, or other top-level scope keys.

        • Optionalscript?: string

          The test script source to execute. Should contain describe / it / expect blocks.

        • Optionalscripts?: Record<string, unknown>

          Optional map of local script sources keyed by lookup key (e.g. "my_script"). Used to resolve import("script:<lookup_key>") calls before falling back to deployed scripts in the caller's app.

      Returns Promise<ScriptTestRunResult>

      The assertion report for the test run, including per-suite and per-test results, assertion counts, captured output, and any runtime error or diagnostic findings.

    • Validate a workflow script Parses and statically analyzes the provided script source, returning a list of diagnostic findings (errors and warnings) without executing the script. Use this endpoint to power real-time syntax and type checking in script editors. The response always returns HTTP 200. Check the findings array in the returned validation result for any errors or warnings. An empty findings list means the script passed all static checks. Requires an authenticated viewer. No additional app scope is needed.

      Parameters

      • input: { script?: string }

        Request body.

        • Optionalscript?: string

          The script source to validate. Defaults to an empty string.

      Returns Promise<ExpressionValidation>

      Static analysis result containing a list of diagnostic findings for the script.