archastro.platform.types.scripts

  1# Copyright (c) 2026 ArchAstro Inc. Licensed under the MIT License.
  2# This file is auto-generated by @archastro/sdk-generator. Do not edit.
  3# Content hash: 32227d023a50
  4
  5from datetime import datetime
  6from typing import Any
  7
  8from pydantic import BaseModel, ConfigDict, Field
  9
 10
 11class ScriptLanguageSpec(BaseModel):
 12    """
 13    Schema for ArchAstro script editor metadata
 14    """
 15
 16    builtins: list[dict[str, Any]] = Field(..., description="Builtin function docs")
 17    keywords: list[str] = Field(..., description="Language keywords")
 18    languageId: str = Field(..., description="Monaco language identifier")
 19    namespaces: list[dict[str, Any]] = Field(..., description="Importable namespace docs")
 20    operators: list[str] = Field(..., description="Language operators")
 21    reservedNames: list[str] | None = Field(
 22        default=None, description="Names that cannot be rebound"
 23    )
 24    snippets: list[dict[str, Any]] | None = Field(
 25        default=None, description="Editor snippet templates"
 26    )
 27    specialIdentifiers: list[dict[str, Any]] | None = Field(
 28        default=None, description="Special symbols such as JSONPath root/current"
 29    )
 30    typeDefinitions: list[dict[str, Any]] | None = Field(
 31        default=None, description="Named type definitions (event interfaces, etc.) with fields"
 32    )
 33    typeSystem: dict[str, Any] | None = Field(
 34        default=None,
 35        description="Type-system primitives, generics, annotations, inference, and runtime-check guidance",
 36    )
 37    version: int = Field(..., description="Schema version")
 38
 39
 40class ScriptRunResult(BaseModel):
 41    """
 42    Schema for the result of executing a script in the editor
 43    """
 44
 45    error: str | None = Field(
 46        default=None, description="Error message when script execution failed"
 47    )
 48    findings: list[dict[str, Any]] | None = Field(
 49        default=[],
 50        description="Structured diagnostics with position info for editor markers (severity, message, line, column, end_line, end_column)",
 51    )
 52    output: list[dict[str, Any]] | None = Field(
 53        default=[],
 54        description="Output lines from println calls, each with :line (source line number), :text, and optional :values",
 55    )
 56    result: Any | None = Field(
 57        default=None, description="The evaluated JSON-safe result (null when execution failed)"
 58    )
 59
 60
 61class ScriptTestAssertion(BaseModel):
 62    """
 63    One `test.expect(...).<matcher>` call from a ScriptTest run.
 64    Matchers never raise (the script language has no exceptions) each call
 65    emits a structured assertion entry that the test runner harvests into the
 66    per-test report. Pass/fail is captured on `:pass`; `:expected` and
 67    `:actual` carry the matcher's inputs for diff rendering.
 68    """
 69
 70    model_config = ConfigDict(populate_by_name=True)
 71
 72    actual: Any | None = Field(
 73        default=None, description="Actual value the matcher was called with any JSON-safe value"
 74    )
 75    describe: list[str] | None = Field(
 76        default=[], description="Outer-to-inner describe path when the assertion fired"
 77    )
 78    expected: Any | None = Field(
 79        default=None,
 80        description="Expected value (or arguments to the matcher) any JSON-safe value: scalar, map, or list",
 81    )
 82    it: str | None = Field(default=None, description="Name of the enclosing `test.it(...)` block")
 83    kind: str | None = Field(
 84        default=None, description='Output entry kind, always `"assertion"` for this schema'
 85    )
 86    line: int | None = Field(default=None, description="Source line of the `expect(...)` call")
 87    matcher: str | None = Field(
 88        default=None,
 89        description="Matcher name (toEqual, toBe, toBeOk, toBeError, toContain, toMatch, toHaveLength)",
 90    )
 91    pass_: bool = Field(..., alias="pass", description="True when the matcher succeeded")
 92
 93
 94class ScriptTestCase(BaseModel):
 95    """
 96    One `test.it(...)` block from a ScriptTest run.
 97    Built by the harvester from the raw output entries pairs the case's
 98    metadata with the assertions it produced and any runtime error that
 99    aborted the body. An `it` block that emits zero assertions is treated
100    as a failure (`pass: false`) so silent mistakes don't pass quietly.
101    """
102
103    model_config = ConfigDict(populate_by_name=True)
104
105    assertions: list[ScriptTestAssertion] | None = Field(
106        default=[], description="Every `test.expect(...)` matcher that ran inside this case"
107    )
108    describe: list[str] | None = Field(
109        default=[], description="Outer-to-inner describe path enclosing this case"
110    )
111    error: str | None = Field(
112        default=None,
113        description="Runtime error that aborted the body of this `it` block, when one occurred",
114    )
115    name: str = Field(..., description="The name passed to `test.it(...)`")
116    pass_: bool = Field(
117        ...,
118        alias="pass",
119        description="True when the case has at least one assertion and every assertion passed",
120    )
121
122
123class ScriptTestOutputEntry(BaseModel):
124    """
125    One println/log entry interleaved with a ScriptTest run.
126    After the test harvester filters out test-control entries (`it`,
127    `assertion`, `it_error`), only `println` and `log.<level>` calls remain
128    in the report's `output` field. Both shapes share `text`/`values`/`line`
129    (line is auto-annotated by the evaluator post-call); `level` and
130    `timestamp` are only present on `log.*` entries.
131    """
132
133    level: str | None = Field(
134        default=None,
135        description="Log level (`debug`, `info`, `warn`, `error`) present on log.* entries only",
136    )
137    line: int | None = Field(default=None, description="Source line of the println/log call")
138    text: str = Field(..., description="Joined text representation of the args")
139    timestamp: datetime | None = Field(
140        default=None, description="UTC timestamp present on log.* entries only"
141    )
142    values: list[Any] | None = Field(
143        default=[],
144        description="Original args coerced to JSON-safe values mixed scalars, maps, and lists since the call sites accept arbitrary expressions",
145    )
146
147
148class ScriptTestSuite(BaseModel):
149    """
150    One `test.describe(...)` group from a ScriptTest run.
151    Suites are derived from the unique describe paths the harvester sees, so
152    there's no synthetic "ungrouped" suite `it` blocks emitted outside any
153    `describe` show up in the top-level `tests` array on the parent report
154    instead.
155    """
156
157    describe: list[str] = Field(
158        ..., description="Outer-to-inner describe path identifying this suite"
159    )
160    name: str = Field(
161        ..., description="Human-readable suite name (`describe` path joined by ` > `)"
162    )
163    tests: list[ScriptTestCase] | None = Field(
164        default=[], description="Every `test.it(...)` case run inside this describe"
165    )
166
167
168class ScriptTestRunResult(BaseModel):
169    """
170    Schema for the result of running a ScriptTest
171    """
172
173    assertion_count: int | None = Field(
174        default=0, description="Total number of `test.expect(...)` matcher calls that ran"
175    )
176    error: str | None = Field(
177        default=None,
178        description="Top-level error message when a runtime error fired outside any `it` block (parse/tokenize errors return 422 instead)",
179    )
180    findings: list[dict[str, Any]] | None = Field(
181        default=[],
182        description="Structured diagnostics with position info for editor markers when the run errored before any tests could run",
183    )
184    output: list[ScriptTestOutputEntry] | None = Field(
185        default=[],
186        description="Non-test output entries (println, log.*) interleaved during the run",
187    )
188    passed: bool = Field(..., description="True when every test in every suite passed")
189    suites: list[ScriptTestSuite] | None = Field(
190        default=[], description="One entry per describe path"
191    )
192    tests: list[ScriptTestCase] | None = Field(
193        default=[],
194        description="Flat list of every `it` that ran, each with assertions and pass flag",
195    )
class ScriptLanguageSpec(pydantic.main.BaseModel):
12class ScriptLanguageSpec(BaseModel):
13    """
14    Schema for ArchAstro script editor metadata
15    """
16
17    builtins: list[dict[str, Any]] = Field(..., description="Builtin function docs")
18    keywords: list[str] = Field(..., description="Language keywords")
19    languageId: str = Field(..., description="Monaco language identifier")
20    namespaces: list[dict[str, Any]] = Field(..., description="Importable namespace docs")
21    operators: list[str] = Field(..., description="Language operators")
22    reservedNames: list[str] | None = Field(
23        default=None, description="Names that cannot be rebound"
24    )
25    snippets: list[dict[str, Any]] | None = Field(
26        default=None, description="Editor snippet templates"
27    )
28    specialIdentifiers: list[dict[str, Any]] | None = Field(
29        default=None, description="Special symbols such as JSONPath root/current"
30    )
31    typeDefinitions: list[dict[str, Any]] | None = Field(
32        default=None, description="Named type definitions (event interfaces, etc.) with fields"
33    )
34    typeSystem: dict[str, Any] | None = Field(
35        default=None,
36        description="Type-system primitives, generics, annotations, inference, and runtime-check guidance",
37    )
38    version: int = Field(..., description="Schema version")

Schema for ArchAstro script editor metadata

builtins: list[dict[str, typing.Any]] = PydanticUndefined

Builtin function docs

keywords: list[str] = PydanticUndefined

Language keywords

languageId: str = PydanticUndefined

Monaco language identifier

namespaces: list[dict[str, typing.Any]] = PydanticUndefined

Importable namespace docs

operators: list[str] = PydanticUndefined

Language operators

reservedNames: list[str] | None = None

Names that cannot be rebound

snippets: list[dict[str, typing.Any]] | None = None

Editor snippet templates

specialIdentifiers: list[dict[str, typing.Any]] | None = None

Special symbols such as JSONPath root/current

typeDefinitions: list[dict[str, typing.Any]] | None = None

Named type definitions (event interfaces, etc.) with fields

typeSystem: dict[str, typing.Any] | None = None

Type-system primitives, generics, annotations, inference, and runtime-check guidance

version: int = PydanticUndefined

Schema version

class ScriptRunResult(pydantic.main.BaseModel):
41class ScriptRunResult(BaseModel):
42    """
43    Schema for the result of executing a script in the editor
44    """
45
46    error: str | None = Field(
47        default=None, description="Error message when script execution failed"
48    )
49    findings: list[dict[str, Any]] | None = Field(
50        default=[],
51        description="Structured diagnostics with position info for editor markers (severity, message, line, column, end_line, end_column)",
52    )
53    output: list[dict[str, Any]] | None = Field(
54        default=[],
55        description="Output lines from println calls, each with :line (source line number), :text, and optional :values",
56    )
57    result: Any | None = Field(
58        default=None, description="The evaluated JSON-safe result (null when execution failed)"
59    )

Schema for the result of executing a script in the editor

error: str | None = None

Error message when script execution failed

findings: list[dict[str, typing.Any]] | None = []

Structured diagnostics with position info for editor markers (severity, message, line, column, end_line, end_column)

output: list[dict[str, typing.Any]] | None = []

Output lines from println calls, each with :line (source line number), :text, and optional :values

result: typing.Any | None = None

The evaluated JSON-safe result (null when execution failed)

class ScriptTestAssertion(pydantic.main.BaseModel):
62class ScriptTestAssertion(BaseModel):
63    """
64    One `test.expect(...).<matcher>` call from a ScriptTest run.
65    Matchers never raise (the script language has no exceptions) each call
66    emits a structured assertion entry that the test runner harvests into the
67    per-test report. Pass/fail is captured on `:pass`; `:expected` and
68    `:actual` carry the matcher's inputs for diff rendering.
69    """
70
71    model_config = ConfigDict(populate_by_name=True)
72
73    actual: Any | None = Field(
74        default=None, description="Actual value the matcher was called with any JSON-safe value"
75    )
76    describe: list[str] | None = Field(
77        default=[], description="Outer-to-inner describe path when the assertion fired"
78    )
79    expected: Any | None = Field(
80        default=None,
81        description="Expected value (or arguments to the matcher) any JSON-safe value: scalar, map, or list",
82    )
83    it: str | None = Field(default=None, description="Name of the enclosing `test.it(...)` block")
84    kind: str | None = Field(
85        default=None, description='Output entry kind, always `"assertion"` for this schema'
86    )
87    line: int | None = Field(default=None, description="Source line of the `expect(...)` call")
88    matcher: str | None = Field(
89        default=None,
90        description="Matcher name (toEqual, toBe, toBeOk, toBeError, toContain, toMatch, toHaveLength)",
91    )
92    pass_: bool = Field(..., alias="pass", description="True when the matcher succeeded")

One test.expect(...).<matcher> call from a ScriptTest run. Matchers never raise (the script language has no exceptions) each call emits a structured assertion entry that the test runner harvests into the per-test report. Pass/fail is captured on :pass; :expected and :actual carry the matcher's inputs for diff rendering.

actual: typing.Any | None = None

Actual value the matcher was called with any JSON-safe value

describe: list[str] | None = []

Outer-to-inner describe path when the assertion fired

expected: typing.Any | None = None

Expected value (or arguments to the matcher) any JSON-safe value: scalar, map, or list

it: str | None = None

Name of the enclosing test.it(...) block

kind: str | None = None

Output entry kind, always "assertion" for this schema

line: int | None = None

Source line of the expect(...) call

matcher: str | None = None

Matcher name (toEqual, toBe, toBeOk, toBeError, toContain, toMatch, toHaveLength)

pass_: bool = PydanticUndefined

True when the matcher succeeded

class ScriptTestCase(pydantic.main.BaseModel):
 95class ScriptTestCase(BaseModel):
 96    """
 97    One `test.it(...)` block from a ScriptTest run.
 98    Built by the harvester from the raw output entries pairs the case's
 99    metadata with the assertions it produced and any runtime error that
100    aborted the body. An `it` block that emits zero assertions is treated
101    as a failure (`pass: false`) so silent mistakes don't pass quietly.
102    """
103
104    model_config = ConfigDict(populate_by_name=True)
105
106    assertions: list[ScriptTestAssertion] | None = Field(
107        default=[], description="Every `test.expect(...)` matcher that ran inside this case"
108    )
109    describe: list[str] | None = Field(
110        default=[], description="Outer-to-inner describe path enclosing this case"
111    )
112    error: str | None = Field(
113        default=None,
114        description="Runtime error that aborted the body of this `it` block, when one occurred",
115    )
116    name: str = Field(..., description="The name passed to `test.it(...)`")
117    pass_: bool = Field(
118        ...,
119        alias="pass",
120        description="True when the case has at least one assertion and every assertion passed",
121    )

One test.it(...) block from a ScriptTest run. Built by the harvester from the raw output entries pairs the case's metadata with the assertions it produced and any runtime error that aborted the body. An it block that emits zero assertions is treated as a failure (pass: false) so silent mistakes don't pass quietly.

assertions: list[ScriptTestAssertion] | None = []

Every test.expect(...) matcher that ran inside this case

describe: list[str] | None = []

Outer-to-inner describe path enclosing this case

error: str | None = None

Runtime error that aborted the body of this it block, when one occurred

name: str = PydanticUndefined

The name passed to test.it(...)

pass_: bool = PydanticUndefined

True when the case has at least one assertion and every assertion passed

class ScriptTestOutputEntry(pydantic.main.BaseModel):
124class ScriptTestOutputEntry(BaseModel):
125    """
126    One println/log entry interleaved with a ScriptTest run.
127    After the test harvester filters out test-control entries (`it`,
128    `assertion`, `it_error`), only `println` and `log.<level>` calls remain
129    in the report's `output` field. Both shapes share `text`/`values`/`line`
130    (line is auto-annotated by the evaluator post-call); `level` and
131    `timestamp` are only present on `log.*` entries.
132    """
133
134    level: str | None = Field(
135        default=None,
136        description="Log level (`debug`, `info`, `warn`, `error`) present on log.* entries only",
137    )
138    line: int | None = Field(default=None, description="Source line of the println/log call")
139    text: str = Field(..., description="Joined text representation of the args")
140    timestamp: datetime | None = Field(
141        default=None, description="UTC timestamp present on log.* entries only"
142    )
143    values: list[Any] | None = Field(
144        default=[],
145        description="Original args coerced to JSON-safe values mixed scalars, maps, and lists since the call sites accept arbitrary expressions",
146    )

One println/log entry interleaved with a ScriptTest run. After the test harvester filters out test-control entries (it, assertion, it_error), only println and log.<level> calls remain in the report's output field. Both shapes share text/values/line (line is auto-annotated by the evaluator post-call); level and timestamp are only present on log.* entries.

level: str | None = None

Log level (debug, info, warn, error) present on log.* entries only

line: int | None = None

Source line of the println/log call

text: str = PydanticUndefined

Joined text representation of the args

timestamp: datetime.datetime | None = None

UTC timestamp present on log.* entries only

values: list[typing.Any] | None = []

Original args coerced to JSON-safe values mixed scalars, maps, and lists since the call sites accept arbitrary expressions

class ScriptTestSuite(pydantic.main.BaseModel):
149class ScriptTestSuite(BaseModel):
150    """
151    One `test.describe(...)` group from a ScriptTest run.
152    Suites are derived from the unique describe paths the harvester sees, so
153    there's no synthetic "ungrouped" suite `it` blocks emitted outside any
154    `describe` show up in the top-level `tests` array on the parent report
155    instead.
156    """
157
158    describe: list[str] = Field(
159        ..., description="Outer-to-inner describe path identifying this suite"
160    )
161    name: str = Field(
162        ..., description="Human-readable suite name (`describe` path joined by ` > `)"
163    )
164    tests: list[ScriptTestCase] | None = Field(
165        default=[], description="Every `test.it(...)` case run inside this describe"
166    )

One test.describe(...) group from a ScriptTest run. Suites are derived from the unique describe paths the harvester sees, so there's no synthetic "ungrouped" suite it blocks emitted outside any describe show up in the top-level tests array on the parent report instead.

describe: list[str] = PydanticUndefined

Outer-to-inner describe path identifying this suite

name: str = PydanticUndefined

Human-readable suite name (describe path joined by >)

tests: list[ScriptTestCase] | None = []

Every test.it(...) case run inside this describe

class ScriptTestRunResult(pydantic.main.BaseModel):
169class ScriptTestRunResult(BaseModel):
170    """
171    Schema for the result of running a ScriptTest
172    """
173
174    assertion_count: int | None = Field(
175        default=0, description="Total number of `test.expect(...)` matcher calls that ran"
176    )
177    error: str | None = Field(
178        default=None,
179        description="Top-level error message when a runtime error fired outside any `it` block (parse/tokenize errors return 422 instead)",
180    )
181    findings: list[dict[str, Any]] | None = Field(
182        default=[],
183        description="Structured diagnostics with position info for editor markers when the run errored before any tests could run",
184    )
185    output: list[ScriptTestOutputEntry] | None = Field(
186        default=[],
187        description="Non-test output entries (println, log.*) interleaved during the run",
188    )
189    passed: bool = Field(..., description="True when every test in every suite passed")
190    suites: list[ScriptTestSuite] | None = Field(
191        default=[], description="One entry per describe path"
192    )
193    tests: list[ScriptTestCase] | None = Field(
194        default=[],
195        description="Flat list of every `it` that ran, each with assertions and pass flag",
196    )

Schema for the result of running a ScriptTest

assertion_count: int | None = 0

Total number of test.expect(...) matcher calls that ran

error: str | None = None

Top-level error message when a runtime error fired outside any it block (parse/tokenize errors return 422 instead)

findings: list[dict[str, typing.Any]] | None = []

Structured diagnostics with position info for editor markers when the run errored before any tests could run

output: list[ScriptTestOutputEntry] | None = []

Non-test output entries (println, log.*) interleaved during the run

passed: bool = PydanticUndefined

True when every test in every suite passed

suites: list[ScriptTestSuite] | None = []

One entry per describe path

tests: list[ScriptTestCase] | None = []

Flat list of every it that ran, each with assertions and pass flag