primitive-admin 1.2.0-alpha.3 → 1.2.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/assets/skill/skills/primitive-platform/SKILL.md +17 -0
  2. package/dist/src/commands/agent-sessions.js +4 -0
  3. package/dist/src/commands/agent-sessions.js.map +1 -1
  4. package/dist/src/commands/auth.js +7 -4
  5. package/dist/src/commands/auth.js.map +1 -1
  6. package/dist/src/commands/connections.js +11 -12
  7. package/dist/src/commands/connections.js.map +1 -1
  8. package/dist/src/commands/database-type-configs.js +2 -76
  9. package/dist/src/commands/database-type-configs.js.map +1 -1
  10. package/dist/src/commands/database-types.js +313 -13
  11. package/dist/src/commands/database-types.js.map +1 -1
  12. package/dist/src/commands/databases.d.ts +9 -0
  13. package/dist/src/commands/databases.js +78 -403
  14. package/dist/src/commands/databases.js.map +1 -1
  15. package/dist/src/commands/documents.d.ts +32 -2
  16. package/dist/src/commands/documents.js +344 -711
  17. package/dist/src/commands/documents.js.map +1 -1
  18. package/dist/src/commands/functions.js +2 -2
  19. package/dist/src/commands/functions.js.map +1 -1
  20. package/dist/src/commands/llm.js +6 -9
  21. package/dist/src/commands/llm.js.map +1 -1
  22. package/dist/src/commands/prompts.d.ts +7 -0
  23. package/dist/src/commands/prompts.js +44 -0
  24. package/dist/src/commands/prompts.js.map +1 -1
  25. package/dist/src/commands/settings.d.ts +9 -12
  26. package/dist/src/commands/settings.js +79 -31
  27. package/dist/src/commands/settings.js.map +1 -1
  28. package/dist/src/commands/sync.d.ts +43 -110
  29. package/dist/src/commands/sync.js +356 -1251
  30. package/dist/src/commands/sync.js.map +1 -1
  31. package/dist/src/lib/aggregate-output.d.ts +25 -0
  32. package/dist/src/lib/aggregate-output.js +53 -0
  33. package/dist/src/lib/aggregate-output.js.map +1 -0
  34. package/dist/src/lib/api-client.d.ts +48 -204
  35. package/dist/src/lib/api-client.js +57 -321
  36. package/dist/src/lib/api-client.js.map +1 -1
  37. package/dist/src/lib/codegen-shared/generatedFiles.d.ts +6 -7
  38. package/dist/src/lib/codegen-shared/generatedFiles.js +2 -2
  39. package/dist/src/lib/codegen-shared/generatedFiles.js.map +1 -1
  40. package/dist/src/lib/codegen-shared/prettierStable.d.ts +1 -1
  41. package/dist/src/lib/codegen-shared/prettierStable.js +1 -1
  42. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.d.ts +2 -2
  43. package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js +2 -2
  44. package/dist/src/lib/config-object-descriptor.js +15 -10
  45. package/dist/src/lib/config-object-descriptor.js.map +1 -1
  46. package/dist/src/lib/config-surface.d.ts +2 -1
  47. package/dist/src/lib/config-surface.js +4 -1
  48. package/dist/src/lib/config-surface.js.map +1 -1
  49. package/dist/src/lib/connections-list.d.ts +10 -0
  50. package/dist/src/lib/connections-list.js +18 -0
  51. package/dist/src/lib/connections-list.js.map +1 -0
  52. package/dist/src/lib/csv.d.ts +8 -9
  53. package/dist/src/lib/csv.js +3 -4
  54. package/dist/src/lib/csv.js.map +1 -1
  55. package/dist/src/lib/db-codegen/dbGenerator.js +5 -16
  56. package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -1
  57. package/dist/src/lib/db-codegen/dbNaming.d.ts +5 -13
  58. package/dist/src/lib/db-codegen/dbNaming.js +5 -17
  59. package/dist/src/lib/db-codegen/dbNaming.js.map +1 -1
  60. package/dist/src/lib/db-codegen/dbTemplates.d.ts +7 -56
  61. package/dist/src/lib/db-codegen/dbTemplates.js +25 -125
  62. package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -1
  63. package/dist/src/lib/db-codegen/dbTsTypes.d.ts +2 -2
  64. package/dist/src/lib/db-codegen/dbTsTypes.js +2 -2
  65. package/dist/src/lib/db-codegen/dbTypeIR.d.ts +60 -2
  66. package/dist/src/lib/db-codegen/dbTypeIR.js +12 -1
  67. package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -1
  68. package/dist/src/lib/document-export-record-log.d.ts +57 -0
  69. package/dist/src/lib/document-export-record-log.js +215 -0
  70. package/dist/src/lib/document-export-record-log.js.map +1 -0
  71. package/dist/src/lib/document-ingest-artifact.d.ts +13 -2
  72. package/dist/src/lib/document-ingest-artifact.js +7 -3
  73. package/dist/src/lib/document-ingest-artifact.js.map +1 -1
  74. package/dist/src/lib/document-ingest-rows.d.ts +16 -0
  75. package/dist/src/lib/document-ingest-rows.js +17 -0
  76. package/dist/src/lib/document-ingest-rows.js.map +1 -1
  77. package/dist/src/lib/document-ingest.d.ts +22 -0
  78. package/dist/src/lib/document-ingest.js +33 -0
  79. package/dist/src/lib/document-ingest.js.map +1 -1
  80. package/dist/src/lib/function-sync.d.ts +3 -16
  81. package/dist/src/lib/function-sync.js +14 -18
  82. package/dist/src/lib/function-sync.js.map +1 -1
  83. package/dist/src/lib/function-triggers.d.ts +3 -15
  84. package/dist/src/lib/function-triggers.js +10 -72
  85. package/dist/src/lib/function-triggers.js.map +1 -1
  86. package/dist/src/lib/generated-allowlist.js +0 -20
  87. package/dist/src/lib/generated-allowlist.js.map +1 -1
  88. package/dist/src/lib/generated-config-surfaces.d.ts +212 -49
  89. package/dist/src/lib/generated-config-surfaces.js +759 -184
  90. package/dist/src/lib/generated-config-surfaces.js.map +1 -1
  91. package/dist/src/lib/generated-sdk-types.d.ts +1 -1
  92. package/dist/src/lib/generated-sdk-types.js +1 -1
  93. package/dist/src/lib/generated-sdk-types.js.map +1 -1
  94. package/dist/src/lib/login-scope-lines.d.ts +15 -0
  95. package/dist/src/lib/login-scope-lines.js +22 -0
  96. package/dist/src/lib/login-scope-lines.js.map +1 -0
  97. package/dist/src/lib/paginate.d.ts +0 -5
  98. package/dist/src/lib/paginate.js +0 -5
  99. package/dist/src/lib/paginate.js.map +1 -1
  100. package/dist/src/lib/prompt-schema-codegen.js +5 -2
  101. package/dist/src/lib/prompt-schema-codegen.js.map +1 -1
  102. package/dist/src/lib/refresh-admin-credentials.d.ts +7 -0
  103. package/dist/src/lib/refresh-admin-credentials.js +16 -4
  104. package/dist/src/lib/refresh-admin-credentials.js.map +1 -1
  105. package/dist/src/lib/root-import-decision.d.ts +15 -14
  106. package/dist/src/lib/root-import-decision.js +44 -51
  107. package/dist/src/lib/root-import-decision.js.map +1 -1
  108. package/dist/src/lib/snapshot-build-rows.d.ts +21 -0
  109. package/dist/src/lib/snapshot-build-rows.js +22 -0
  110. package/dist/src/lib/snapshot-build-rows.js.map +1 -1
  111. package/dist/src/lib/snapshot-build.js +8 -3
  112. package/dist/src/lib/snapshot-build.js.map +1 -1
  113. package/dist/src/lib/swift-codegen/banners.d.ts +34 -7
  114. package/dist/src/lib/swift-codegen/banners.js +37 -7
  115. package/dist/src/lib/swift-codegen/banners.js.map +1 -1
  116. package/dist/src/lib/swift-codegen/dbGenerator.d.ts +4 -3
  117. package/dist/src/lib/swift-codegen/dbGenerator.js +14 -117
  118. package/dist/src/lib/swift-codegen/dbGenerator.js.map +1 -1
  119. package/dist/src/lib/swift-codegen/functionGenerator.d.ts +3 -3
  120. package/dist/src/lib/swift-codegen/functionGenerator.js +22 -17
  121. package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -1
  122. package/dist/src/lib/swift-codegen/generator.d.ts +5 -5
  123. package/dist/src/lib/swift-codegen/generator.js +35 -40
  124. package/dist/src/lib/swift-codegen/generator.js.map +1 -1
  125. package/dist/src/lib/toml-database-config.d.ts +14 -75
  126. package/dist/src/lib/toml-database-config.js +14 -305
  127. package/dist/src/lib/toml-database-config.js.map +1 -1
  128. package/dist/src/lib/workflow-codegen/generator.d.ts +7 -7
  129. package/dist/src/lib/workflow-codegen/generator.js +16 -23
  130. package/dist/src/lib/workflow-codegen/generator.js.map +1 -1
  131. package/dist/src/lib/workflow-codegen/invokerIR.d.ts +6 -12
  132. package/dist/src/lib/workflow-codegen/invokerIR.js +4 -5
  133. package/dist/src/lib/workflow-codegen/invokerIR.js.map +1 -1
  134. package/dist/src/lib/workflow-toml-validator.d.ts +2 -0
  135. package/dist/src/lib/workflow-toml-validator.js +28 -1
  136. package/dist/src/lib/workflow-toml-validator.js.map +1 -1
  137. package/package.json +3 -5
  138. package/dist/src/lib/generated-workflow-model-fields.d.ts +0 -20
  139. package/dist/src/lib/generated-workflow-model-fields.js +0 -53
  140. package/dist/src/lib/generated-workflow-model-fields.js.map +0 -1
  141. package/dist/src/lib/workflow-field-descriptor.d.ts +0 -91
  142. package/dist/src/lib/workflow-field-descriptor.js +0 -153
  143. package/dist/src/lib/workflow-field-descriptor.js.map +0 -1
@@ -31,7 +31,7 @@
31
31
  * server; the CLI vendors them at build time into
32
32
  * `cli/src/lib/generated-config-surfaces.ts`
33
33
  * (`cli/scripts/gen-config-surfaces.mjs`), the same server→CLI vendoring
34
- * `gen-operation-def-descriptor.mjs` (#1544) already uses, so the published CLI
34
+ * `gen-workflow-schema-descriptor.mjs` (#1442) already uses, so the published CLI
35
35
  * still imports no server code at runtime.
36
36
  *
37
37
  * ── Scope: declarative classification and coverage ONLY ──────────────────
@@ -1101,6 +1101,19 @@ export interface RetiredConfigKey {
1101
1101
  request: string;
1102
1102
  }
1103
1103
  export declare const RETIRED_CONFIG_KEYS: Record<string, Record<string, RetiredConfigKey>>;
1104
+ /**
1105
+ * Top-level TOML tables a configuration object's FILE retired — keyed by the
1106
+ * surface's label, then by the table key. Only the TOML half exists: these were
1107
+ * sub-trees applied through their own endpoints, never request keys of the
1108
+ * object itself, so no request body can carry one.
1109
+ *
1110
+ * Without an entry here a retired table would be answered as an unrecognized
1111
+ * one ("check the spelling, or upgrade the CLI"), which is backwards for a
1112
+ * table removed on purpose.
1113
+ */
1114
+ export declare const RETIRED_DOCUMENT_KEYS: Record<string, Record<string, RetiredTomlSpelling>>;
1115
+ /** The retired-table guidance for `key` on the surface labelled `label`, or null. */
1116
+ export declare function retiredDocumentKey(label: string, key: string): RetiredTomlSpelling | null;
1104
1117
  /** The retired-key entry for `key` under `prefix`, or null when it is simply unknown. */
1105
1118
  export declare function retiredConfigKey(prefix: string, key: string): RetiredConfigKey | null;
1106
1119
  /**
@@ -1492,7 +1505,8 @@ export interface ParsedManifest {
1492
1505
  export declare function parseFunctionManifest(value: unknown): ParsedManifest;
1493
1506
  /**
1494
1507
  * The runtime keys a `functions/<key>.toml` no longer decides anything with —
1495
- * #3482, project `server-functions` phase 4.
1508
+ * #3482 retired them, and #3188 (project `server-functions` phase 5) refuses
1509
+ * them.
1496
1510
  *
1497
1511
  * The sponsor settled it on 2026-09-15 (the intent, "Mode vocabulary?",
1498
1512
  * amended again): the config says NOTHING about how a function runs. A
@@ -1501,58 +1515,70 @@ export declare function parseFunctionManifest(value: unknown): ParsedManifest;
1501
1515
  * and a function that must not run under one runtime tests for it in code with
1502
1516
  * `assertRuntime`.
1503
1517
  *
1504
- * ── Why these keys are accepted, not refused ──────────────────────────────
1518
+ * ── Accepted through phase 4, refused from phase 5 ────────────────────────
1505
1519
  *
1506
- * Every tree pushed since #3454 that declares a cron trigger carries
1507
- * `mode = …` ON THE ENTRY, because `cron-trigger-mode-required` demanded it;
1508
- * plenty carry a top-level `mode` or the older `durable`. Removing the keys
1509
- * from the accepted set outright would refuse those trees with an unknown-key
1510
- * error one day after the platform insisted on them, which is the opposite of
1511
- * principle 5 inside a non-breaking phase.
1520
+ * Every tree pushed since #3454 that declares a cron trigger carried
1521
+ * `mode = …` ON THE ENTRY, because `cron-trigger-mode-required` demanded it,
1522
+ * so #3482 accepted the keys and warned rather than refusing them one day
1523
+ * after the platform insisted on them. Phase 5 is the declared breaking phase
1524
+ * that ends the grace: `mode`, `durable` and a cron entry's `mode` are refused
1525
+ * with one sentence per key, naming the key, saying the caller picks the
1526
+ * runtime, and saying to delete the line. `config pull` still strips them
1527
+ * (`stripRetiredFunctionKeys` in the CLI reads this scanner), so a tree pulled
1528
+ * from a version pushed before the retirement pushes again unchanged.
1512
1529
  *
1513
- * So through phase 4 they are ACCEPTED and IGNORED, with one warning per key
1514
- * naming it and the line to delete; from phase 5 (#3188) they are refused with
1515
- * the rest of the retirement matrix. The value is not validated — there is
1516
- * nothing left to validate it against, and refusing a bad value for a key
1517
- * nobody reads would be a refusal about spelling alone.
1530
+ * One rule id, one handler: `refusedFunctionKeys` is declared `preflight` on
1531
+ * the `function` surface and the CLI's push preflight runs it before the first
1532
+ * request. The value is not validated — the key's PRESENCE is the refusal.
1518
1533
  *
1519
- * Pure: no models, no tenant context, no `env` (see `types.ts` §Purity). Both
1520
- * the CLI preflight (vendored by `cli/scripts/gen-config-surfaces.mjs`) and the
1521
- * admin config-version route read this one scanner, so the warning an author
1522
- * sees from `config push` is the sentence the API answers with.
1534
+ * Pure: no models, no tenant context, no `env` (see `types.ts` §Purity). The
1535
+ * CLI preflight reaches this module through the vendored copy
1536
+ * (`cli/scripts/gen-config-surfaces.mjs`), so the sentence an author reads from
1537
+ * `config push` is the one this module writes.
1523
1538
  */
1524
1539
  /** The two `[function]` keys that no longer say anything (#3482). */
1525
1540
  export declare const RETIRED_FUNCTION_RUNTIME_KEYS: readonly ["mode", "durable"];
1526
1541
  export type RetiredFunctionRuntimeKey = (typeof RETIRED_FUNCTION_RUNTIME_KEYS)[number];
1527
- /** One ignored key met in a `[function]` table. */
1528
- export interface IgnoredFunctionKey {
1542
+ /**
1543
+ * The rule ids this module owns, declared on the `function` surface (#3374's
1544
+ * anchor). One id covers the three spellings: they are one rule — the config
1545
+ * does not choose the runtime — met in three places.
1546
+ */
1547
+ export declare const RETIRED_RUNTIME_KEY_RULE_IDS: readonly ["retired-runtime-key"];
1548
+ type RetiredRuntimeKeyRuleId = (typeof RETIRED_RUNTIME_KEY_RULE_IDS)[number];
1549
+ /** One retired key met in a `[function]` table. */
1550
+ export interface RetiredFunctionKey extends RuleRefusal<RetiredRuntimeKeyRuleId> {
1529
1551
  /**
1530
1552
  * Where it was: `mode`, `durable`, or `triggers.cron.<name>.mode`. Never
1531
1553
  * rendered on its own — a reader that wants to branch reads this, and every
1532
1554
  * printer reads `message`.
1533
1555
  */
1534
1556
  path: string;
1535
- /** The sentence the author is owed, with no file prefix (the caller adds it). */
1536
- message: string;
1537
1557
  }
1538
1558
  /**
1539
- * Every retired runtime key a `[function]` table still carries.
1540
- *
1541
- * Reads the table the way the author wrote it: the two top-level keys, and a
1542
- * `mode` on each `[[function.triggers.cron]]` entry. A cron entry's sentence
1543
- * says the extra thing its author needs to hear — that the schedule no longer
1544
- * chooses, because every fire starts a task run (#3334's runner branch is
1545
- * gone).
1559
+ * The pre-phase-5 name of a met key, kept for the CLI's pull strip, which only
1560
+ * needs `path`. Every key met is refused now.
1561
+ */
1562
+ export type IgnoredFunctionKey = RetiredFunctionKey;
1563
+ /**
1564
+ * Every retired runtime key the table carries, each as the refusal the author
1565
+ * reads. A cron entry's sentence says the extra thing its author needs to hear
1566
+ * — that the schedule no longer chooses, because every fire starts a task run.
1567
+ */
1568
+ export declare function refusedFunctionKeys(functionTable: unknown): RetiredFunctionKey[];
1569
+ /**
1570
+ * The same refusals, rendered for one file — the shape `config push` and
1571
+ * `config diff` print.
1546
1572
  *
1547
- * Order is the order an author reads their file in: the top-level keys first,
1548
- * then the cron entries in declaration order.
1573
+ * `label` is what the reader can act on: `functions/<key>.toml` from the CLI,
1574
+ * and the function's key from the API, which has no file to name.
1549
1575
  */
1550
- export declare function ignoredFunctionKeys(functionTable: unknown): IgnoredFunctionKey[];
1576
+ export declare function refusedFunctionKeyMessages(label: string, functionTable: unknown): string[];
1551
1577
  /**
1552
1578
  * The database types a `[function]` table's retired trigger block names —
1553
1579
  * #3483.
1554
1580
  *
1555
- * Beside `ignoredFunctionKeys` because it answers the same question about the
1581
+ * Beside `refusedFunctionKeys` because it answers the same question about the
1556
1582
  * same table, for the same reader: `config pull` writes a version's AUTHORED
1557
1583
  * bytes, and a version pushed before the removal carries the block. Without
1558
1584
  * this the pulled tree would be refused on its next push — a tree an author
@@ -1584,14 +1610,6 @@ export declare function retiredDatabaseTriggerTypes(functionTable: unknown): str
1584
1610
  * of them would call a block and the other would not cannot exist.
1585
1611
  */
1586
1612
  export declare function hasRetiredDatabaseTriggerBlock(functionTable: unknown): boolean;
1587
- /**
1588
- * The same scan, rendered for one file — the shape `config push` and
1589
- * `config diff` print and the admin route answers with.
1590
- *
1591
- * `label` is what the reader can act on: `functions/<key>.toml` from the CLI,
1592
- * and the function's key from the API, which has no file to name.
1593
- */
1594
- export declare function ignoredFunctionKeyWarnings(label: string, functionTable: unknown): string[];
1595
1613
  /**
1596
1614
  * The trigger blocks a function declares, derived from its authored TOML
1597
1615
  * (#3181, project `server-functions`, criterion 4).
@@ -1963,7 +1981,7 @@ export declare function validateSigningSecretDeclaration(input: {
1963
1981
  * `preflight`.
1964
1982
  */
1965
1983
  /** The rule ids this module owns — the union type below anchors them (#3373). */
1966
- export declare const WORKFLOW_RULE_IDS: readonly ["system-access-rule"];
1984
+ export declare const WORKFLOW_RULE_IDS: readonly ["system-access-rule", "retired-database-step-kind"];
1967
1985
  type WorkflowRuleId = (typeof WORKFLOW_RULE_IDS)[number];
1968
1986
  /** A violation of one of this module's rules, for a site to render. */
1969
1987
  export interface WorkflowRuleViolation extends RuleRefusal<WorkflowRuleId> {
@@ -1981,6 +1999,31 @@ export declare function checkWorkflowSystemAccessRule(input: {
1981
1999
  runAs?: unknown;
1982
2000
  accessRule?: unknown;
1983
2001
  }): WorkflowRuleViolation | null;
2002
+ /**
2003
+ * The DSL step kinds that executed a registered database operation (#3189,
2004
+ * phase 6 of project `server-functions`, matrix row M8).
2005
+ *
2006
+ * Every `database.*` runner except `database.syncIndexes` called
2007
+ * `DatabaseOperationsController.execute`, so retiring database operations
2008
+ * retires these fourteen kinds with them: the seven base kinds and their seven
2009
+ * `*ForUser` twins. `database.syncIndexes` (which calls the records index
2010
+ * route), `database.create` and `database.delete` (resource lifecycle) are not
2011
+ * here and keep running until the engine retires.
2012
+ */
2013
+ export declare const RETIRED_DATABASE_STEP_KINDS: readonly ["database.query", "database.mutate", "database.count", "database.aggregate", "database.pipeline", "database.applyToQuery", "database.batch", "database.queryForUser", "database.mutateForUser", "database.countForUser", "database.aggregateForUser", "database.pipelineForUser", "database.applyToQueryForUser", "database.batchForUser"];
2014
+ /**
2015
+ * Every step in a definition — or the one step a run has reached — whose kind
2016
+ * is a retired database kind, with the sentence naming the replacement.
2017
+ *
2018
+ * Walks the top-level `steps` and a `collect` step's nested `step`, the one
2019
+ * place a step definition nests another. Push (the CLI preflight), save, the
2020
+ * activation lint and the engine all ask this one question, so a definition is
2021
+ * refused by the same words wherever it is caught, and a run that reaches such
2022
+ * a step fails with them.
2023
+ */
2024
+ export declare function checkWorkflowRetiredStepKinds(input: {
2025
+ steps?: unknown;
2026
+ }): WorkflowRuleViolation[];
1984
2027
  export declare const WORKFLOW_SURFACE: ConfigObjectSurface;
1985
2028
  /**
1986
2029
  * Cron-expression and timezone VALIDITY — the half of `src/cron-parser.ts`
@@ -2495,7 +2538,7 @@ export declare function resolvePromptStrictOutput(input: PromptStrictOutputInput
2495
2538
  * Pure and dependency-free, like every module under `src/config-surface/`.
2496
2539
  */
2497
2540
  /** The stable codes every agent agentRefusal this project adds carries. */
2498
- export declare const AGENT_ERROR_CODES: readonly ["AGENT_DECLARATION_INVALID", "AGENT_TOOL_FUNCTION_MISSING", "AGENT_TOOL_FUNCTION_SCHEMA_MISSING", "AGENT_OUTPUT_SCHEMA_NOT_ALLOWED", "AGENT_CONFIG_KEY_NOT_ALLOWED", "AGENT_NOT_RUNNABLE", "AGENT_TEST_CASE_NOT_SUPPORTED", "AGENT_SCHEMA_NOT_TRANSLATABLE", "AGENT_MODEL_UNKNOWN", "AGENT_MODEL_CAPABILITY_MISSING", "AGENT_MODEL_CAPABILITIES_UNAVAILABLE", "AGENT_ROUND_NOT_AGENT", "AGENT_ROUND_INPUT_INVALID", "AGENT_TOOL_UNKNOWN", "AGENT_TOOL_ARGUMENTS_INVALID", "AGENT_ROUND_TRUNCATED", "AGENT_ROUND_EMPTY"];
2541
+ export declare const AGENT_ERROR_CODES: readonly ["AGENT_DECLARATION_INVALID", "AGENT_TOOL_FUNCTION_MISSING", "AGENT_TOOL_FUNCTION_SCHEMA_MISSING", "AGENT_OUTPUT_SCHEMA_NOT_ALLOWED", "AGENT_CONFIG_KEY_NOT_ALLOWED", "AGENT_NOT_RUNNABLE", "AGENT_TEST_CASE_NOT_SUPPORTED", "AGENT_SCHEMA_NOT_TRANSLATABLE", "AGENT_MODEL_UNKNOWN", "AGENT_MODEL_CAPABILITY_MISSING", "AGENT_MODEL_CAPABILITIES_UNAVAILABLE", "AGENT_ROUND_NOT_AGENT", "AGENT_ROUND_INPUT_INVALID", "AGENT_TOOL_UNKNOWN", "AGENT_TOOL_ARGUMENTS_INVALID", "AGENT_ROUND_TRUNCATED", "AGENT_ROUND_EMPTY", "AGENT_TEST_CASE_INVALID"];
2499
2542
  export type AgentErrorCode = (typeof AGENT_ERROR_CODES)[number];
2500
2543
  /** One agentRefusal: the code a client branches on, and the sentence a person reads. */
2501
2544
  export interface AgentRefusal {
@@ -2544,6 +2587,12 @@ export interface AgentToolDeclaration {
2544
2587
  approval?: boolean;
2545
2588
  statusText?: string;
2546
2589
  historyScope?: AgentToolHistoryScope;
2590
+ /**
2591
+ * A call to this tool ends the turn: once every call of its response is
2592
+ * final, the turn settles with no further model round. A client tool with
2593
+ * it is never answered — the platform records its result.
2594
+ */
2595
+ endsTurn?: boolean;
2547
2596
  }
2548
2597
  /** One `[[prompt.agent.events]]` entry. */
2549
2598
  export interface AgentEventDeclaration {
@@ -2571,7 +2620,18 @@ export interface AgentDeclaration {
2571
2620
  export type NormalizedAgentTool = AgentToolDeclaration & {
2572
2621
  approval: boolean;
2573
2622
  historyScope: AgentToolHistoryScope;
2623
+ endsTurn: boolean;
2624
+ };
2625
+ /**
2626
+ * The result the platform records for a call to a client tool with
2627
+ * `endsTurn = true`: the call is final when its response is committed, and
2628
+ * later rounds read this as its tool result.
2629
+ */
2630
+ export declare const AGENT_TERMINAL_CALL_OUTPUT: {
2631
+ delivered: true;
2574
2632
  };
2633
+ /** The schema of `AGENT_TERMINAL_CALL_OUTPUT`: a terminal client tool's output type. */
2634
+ export declare const AGENT_TERMINAL_CALL_OUTPUT_SCHEMA: AgentSchema;
2575
2635
  /** The declaration with every default applied — what readers consume. */
2576
2636
  export interface NormalizedAgentDeclaration {
2577
2637
  answeredBy: AgentAnsweredBy;
@@ -2675,16 +2735,16 @@ export declare function agentNotRunnableRefusal(promptKey?: string): AgentRefusa
2675
2735
  */
2676
2736
  export declare function agentRoundNotAgentRefusal(promptKey: string): AgentRefusal;
2677
2737
  /**
2678
- * The refusal of a prompt test case that involves an agent (§D1: prompt test
2679
- * cases are refused for the kind in v1; multi-turn tests are deferred).
2680
- * `subject` is a case written ON the agent, `evaluator` a case that names the
2681
- * agent as its judge.
2738
+ * The refusal of a prompt test case that names an agent as its judge (§D1: an
2739
+ * evaluator runs single-shot, which an agent never does). A case written ON an
2740
+ * agent is a single-round test since #4262 (`agent-test-case.ts`), so
2741
+ * `evaluator` is the one role left.
2682
2742
  */
2683
- export declare function agentTestCaseRefusal(promptKey: string, role: "subject" | "evaluator"): AgentRefusal;
2743
+ export declare function agentTestCaseRefusal(promptKey: string, _role?: "evaluator"): AgentRefusal;
2684
2744
  /**
2685
2745
  * The declaration with every default applied: `answeredBy = "initiator"`, the
2686
2746
  * platform maximums for the limits, and per tool `invoke = "request"` (server
2687
- * tools), `approval = false` and `historyScope = "session"`.
2747
+ * tools), `approval = false`, `historyScope = "session"` and `endsTurn = false`.
2688
2748
  *
2689
2749
  * The ONLY accessor for defaults — the stored value never carries them
2690
2750
  * (DSO-3798-001). Takes a value `resolveAgentDeclaration` accepted (or `null`)
@@ -2812,6 +2872,109 @@ export interface AgentSchemaTranslationInput {
2812
2872
  * A declaration with no tools and no events reads no function schema at all.
2813
2873
  */
2814
2874
  export declare function agentSchemaTranslationRefusals(input: AgentSchemaTranslationInput): AgentRefusal[];
2875
+ /**
2876
+ * What an agent test case may say — issue #4262 (single-round prompt tests
2877
+ * from a seeded history; design-docs/agents.md §D1).
2878
+ *
2879
+ * A test case on an agent prompt carries one `[test.agent]` block: a seeded
2880
+ * `history` (JSON text), the round's turn `context`, `timezone` and `locale`,
2881
+ * and two assertions on the round's calls (`expectedToolCall`,
2882
+ * `expectedNoToolCall`). On the wire and in storage those are six flat
2883
+ * `BlockTestCase` fields, `agentHistory` … `agentExpectedNoToolCall`.
2884
+ *
2885
+ * This module is the whole FILE-DECIDABLE rule for them: the history's shape,
2886
+ * its turns, its call and result pairing, where its events sit, the
2887
+ * assertions' shapes, and — when the caller passes the agent's declaration —
2888
+ * that the event kinds and the asserted tool are declared. The admin test-case
2889
+ * routes call it, and so does the CLI's push preflight through the vendored
2890
+ * artifact, so a refusal at push and a refusal at the route cannot disagree.
2891
+ * What needs app state or a schema validator (the input, context and event
2892
+ * schemas, the send route's zone and tag rules) is `agent-test-round.ts`'s.
2893
+ *
2894
+ * Every refusal carries `AGENT_TEST_CASE_INVALID` and the caller gets every
2895
+ * offending item at once, as the declaration resolver does.
2896
+ *
2897
+ * Pure and dependency-free apart from the agent declaration's types, like
2898
+ * every module under `src/config-surface/`.
2899
+ */
2900
+ /** The six wire and stored fields, in the order the surface declares them. */
2901
+ export declare const AGENT_TEST_CASE_FIELDS: readonly ["agentHistory", "agentContext", "agentTimezone", "agentLocale", "agentExpectedToolCall", "agentExpectedNoToolCall"];
2902
+ export type AgentTestCaseField = (typeof AGENT_TEST_CASE_FIELDS)[number];
2903
+ /** One call of a seeded assistant entry. */
2904
+ export interface AgentTestCall {
2905
+ callId: string;
2906
+ name: string;
2907
+ arguments: unknown;
2908
+ }
2909
+ /** One entry of a seeded history, oldest first. */
2910
+ export type AgentTestHistoryEntry = {
2911
+ role: "user";
2912
+ text: string;
2913
+ } | {
2914
+ role: "assistant";
2915
+ text?: string;
2916
+ reasoning?: string;
2917
+ calls?: AgentTestCall[];
2918
+ } | {
2919
+ role: "tool";
2920
+ callId: string;
2921
+ output: unknown;
2922
+ } | {
2923
+ role: "tool";
2924
+ callId: string;
2925
+ error: {
2926
+ code: string;
2927
+ message: string;
2928
+ };
2929
+ } | {
2930
+ role: "event";
2931
+ kind: string;
2932
+ refersTo?: string;
2933
+ data: unknown;
2934
+ };
2935
+ /** The `[test.agent]` block, read. */
2936
+ export interface AgentTestCase {
2937
+ history: AgentTestHistoryEntry[];
2938
+ context: Record<string, unknown> | null;
2939
+ timezone: string | null;
2940
+ locale: string | null;
2941
+ expectedToolCall: {
2942
+ name: string;
2943
+ arguments?: unknown;
2944
+ } | null;
2945
+ /** `false` when unset: no assertion. */
2946
+ expectedNoToolCall: boolean;
2947
+ }
2948
+ export interface AgentTestCaseInput {
2949
+ /**
2950
+ * The prompt's kind; unset means `chat`. The admin routes pass a block type
2951
+ * (`workflow`, `script`, `integration`) for a case that is not a prompt's.
2952
+ */
2953
+ kind?: unknown;
2954
+ /**
2955
+ * The agent's `[prompt.agent]` (a table, one JSON string, or `null` for an
2956
+ * agent that declares none). Omitted means "not known here": the declared
2957
+ * names are not checked (the CLI preflight reads the sidecar alone).
2958
+ */
2959
+ declaration?: unknown;
2960
+ /** The case's fields, in wire spelling (`agentHistory`, …, `expectedJsonSubset`). */
2961
+ fields: Record<string, unknown>;
2962
+ }
2963
+ export type AgentTestCaseResolution = {
2964
+ ok: true;
2965
+ testCase: AgentTestCase | null;
2966
+ } | {
2967
+ ok: false;
2968
+ refusals: AgentRefusal[];
2969
+ };
2970
+ /**
2971
+ * The one rule: is this case's agent block something a round can be built
2972
+ * from? `{ ok: true, testCase }` carries it read (`null` on a case whose
2973
+ * prompt is not an agent). On a chat or decisions case, every agent key
2974
+ * holding a non-null value is refused by name; an explicit `null` is unset on
2975
+ * any case, which is how a full-state update clears one.
2976
+ */
2977
+ export declare function resolveAgentTestCase(input: AgentTestCaseInput): AgentTestCaseResolution;
2815
2978
  export declare const PROMPT_SURFACE: ConfigObjectSurface;
2816
2979
  export declare const INTEGRATION_SURFACE: ConfigObjectSurface;
2817
2980
  export declare const WEBHOOK_SURFACE: ConfigObjectSurface;