primitive-admin 1.2.0-alpha.13 → 1.2.0-alpha.15
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.
- package/README.md +102 -78
- package/assets/skill/skills/primitive-platform/SKILL.md +87 -23
- package/dist/bin/primitive.js +11 -82
- package/dist/bin/primitive.js.map +1 -1
- package/dist/src/commands/admins.js +79 -17
- package/dist/src/commands/admins.js.map +1 -1
- package/dist/src/commands/agent-sessions.js +2 -0
- package/dist/src/commands/agent-sessions.js.map +1 -1
- package/dist/src/commands/analytics.js +220 -18
- package/dist/src/commands/analytics.js.map +1 -1
- package/dist/src/commands/apps-children.js +2 -0
- package/dist/src/commands/apps-children.js.map +1 -1
- package/dist/src/commands/apps.js +19 -2
- package/dist/src/commands/apps.js.map +1 -1
- package/dist/src/commands/auth.js +11 -1
- package/dist/src/commands/auth.js.map +1 -1
- package/dist/src/commands/collections.js +13 -0
- package/dist/src/commands/collections.js.map +1 -1
- package/dist/src/commands/config.d.ts +1 -1
- package/dist/src/commands/config.js +40 -9
- package/dist/src/commands/config.js.map +1 -1
- package/dist/src/commands/connections.js +2 -0
- package/dist/src/commands/connections.js.map +1 -1
- package/dist/src/commands/database-type-configs.js +5 -3
- package/dist/src/commands/database-type-configs.js.map +1 -1
- package/dist/src/commands/databases.js +6 -4
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/db3-types.js +2 -0
- package/dist/src/commands/db3-types.js.map +1 -1
- package/dist/src/commands/db3.d.ts +12 -0
- package/dist/src/commands/db3.js +345 -11
- package/dist/src/commands/db3.js.map +1 -1
- package/dist/src/commands/documents.d.ts +52 -12
- package/dist/src/commands/documents.js +120 -29
- package/dist/src/commands/documents.js.map +1 -1
- package/dist/src/commands/email-templates.js +72 -0
- package/dist/src/commands/email-templates.js.map +1 -1
- package/dist/src/commands/functions.js +47 -10
- package/dist/src/commands/functions.js.map +1 -1
- package/dist/src/commands/groups.js +18 -3
- package/dist/src/commands/groups.js.map +1 -1
- package/dist/src/commands/init.js +7 -1
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/integrations.js +80 -47
- package/dist/src/commands/integrations.js.map +1 -1
- package/dist/src/commands/metadata-category-configs.js +2 -0
- package/dist/src/commands/metadata-category-configs.js.map +1 -1
- package/dist/src/commands/metadata.js +41 -0
- package/dist/src/commands/metadata.js.map +1 -1
- package/dist/src/commands/prompts.js +73 -47
- package/dist/src/commands/prompts.js.map +1 -1
- package/dist/src/commands/rule-sets.js +2 -0
- package/dist/src/commands/rule-sets.js.map +1 -1
- package/dist/src/commands/schemas.d.ts +15 -0
- package/dist/src/commands/schemas.js +122 -0
- package/dist/src/commands/schemas.js.map +1 -0
- package/dist/src/commands/secrets.js +45 -3
- package/dist/src/commands/secrets.js.map +1 -1
- package/dist/src/commands/sessions.js +2 -0
- package/dist/src/commands/sessions.js.map +1 -1
- package/dist/src/commands/sync-schemas.d.ts +202 -0
- package/dist/src/commands/sync-schemas.js +629 -0
- package/dist/src/commands/sync-schemas.js.map +1 -0
- package/dist/src/commands/sync-user-properties.d.ts +118 -0
- package/dist/src/commands/sync-user-properties.js +276 -0
- package/dist/src/commands/sync-user-properties.js.map +1 -0
- package/dist/src/commands/sync.d.ts +243 -12
- package/dist/src/commands/sync.js +1474 -314
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/user-properties.d.ts +14 -0
- package/dist/src/commands/user-properties.js +79 -0
- package/dist/src/commands/user-properties.js.map +1 -0
- package/dist/src/commands/users.js +912 -18
- package/dist/src/commands/users.js.map +1 -1
- package/dist/src/commands/waitlist.js +39 -4
- package/dist/src/commands/waitlist.js.map +1 -1
- package/dist/src/lib/analytics-query.d.ts +58 -0
- package/dist/src/lib/analytics-query.js +134 -0
- package/dist/src/lib/analytics-query.js.map +1 -0
- package/dist/src/lib/api-client.d.ts +779 -95
- package/dist/src/lib/api-client.js +369 -166
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/block-selector.d.ts +9 -15
- package/dist/src/lib/block-selector.js +9 -20
- package/dist/src/lib/block-selector.js.map +1 -1
- package/dist/src/lib/cli-manifest.d.ts +8 -0
- package/dist/src/lib/cli-manifest.js +10 -1
- package/dist/src/lib/cli-manifest.js.map +1 -1
- package/dist/src/lib/cli-version.d.ts +14 -0
- package/dist/src/lib/cli-version.js +38 -0
- package/dist/src/lib/cli-version.js.map +1 -0
- package/dist/src/lib/codegen-shared/prettierStable.d.ts +41 -0
- package/dist/src/lib/codegen-shared/prettierStable.js +146 -24
- package/dist/src/lib/codegen-shared/prettierStable.js.map +1 -1
- package/dist/src/lib/command-status.d.ts +110 -0
- package/dist/src/lib/command-status.js +184 -0
- package/dist/src/lib/command-status.js.map +1 -0
- package/dist/src/lib/config-object-descriptor.d.ts +6 -0
- package/dist/src/lib/config-object-descriptor.js +71 -0
- package/dist/src/lib/config-object-descriptor.js.map +1 -1
- package/dist/src/lib/config-toml.d.ts +11 -2
- package/dist/src/lib/config-toml.js +25 -2
- package/dist/src/lib/config-toml.js.map +1 -1
- package/dist/src/lib/data-input.d.ts +1 -1
- package/dist/src/lib/data-input.js +1 -1
- package/dist/src/lib/db-codegen/dbTsTypes.d.ts +1 -1
- package/dist/src/lib/db-codegen/dbTsTypes.js +3 -0
- package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -1
- package/dist/src/lib/db-codegen/dbTypeIR.d.ts +11 -1
- package/dist/src/lib/db-codegen/dbTypeIR.js +11 -5
- package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -1
- package/dist/src/lib/db-type-records.d.ts +95 -0
- package/dist/src/lib/db-type-records.js +219 -0
- package/dist/src/lib/db-type-records.js.map +1 -0
- package/dist/src/lib/db3-export.d.ts +65 -9
- package/dist/src/lib/db3-export.js +159 -22
- package/dist/src/lib/db3-export.js.map +1 -1
- package/dist/src/lib/db3-index-output.d.ts +69 -3
- package/dist/src/lib/db3-index-output.js +142 -4
- package/dist/src/lib/db3-index-output.js.map +1 -1
- package/dist/src/lib/db3-type-models.d.ts +39 -7
- package/dist/src/lib/db3-type-models.js +138 -27
- package/dist/src/lib/db3-type-models.js.map +1 -1
- package/dist/src/lib/deprecation.d.ts +2 -2
- package/dist/src/lib/deprecation.js +2 -2
- package/dist/src/lib/experimental-apis.d.ts +36 -0
- package/dist/src/lib/experimental-apis.js +46 -0
- package/dist/src/lib/experimental-apis.js.map +1 -0
- package/dist/src/lib/file-attachment.d.ts +24 -0
- package/dist/src/lib/file-attachment.js +31 -0
- package/dist/src/lib/file-attachment.js.map +1 -0
- package/dist/src/lib/function-authorize-check.d.ts +1 -1
- package/dist/src/lib/function-authorize-check.js +2 -1
- package/dist/src/lib/function-authorize-check.js.map +1 -1
- package/dist/src/lib/function-authorize-view.js +4 -0
- package/dist/src/lib/function-authorize-view.js.map +1 -1
- package/dist/src/lib/function-bundle.d.ts +27 -5
- package/dist/src/lib/function-bundle.js +106 -7
- package/dist/src/lib/function-bundle.js.map +1 -1
- package/dist/src/lib/function-collect.d.ts +2 -0
- package/dist/src/lib/function-collect.js +36 -7
- package/dist/src/lib/function-collect.js.map +1 -1
- package/dist/src/lib/function-db-types.d.ts +57 -40
- package/dist/src/lib/function-db-types.js +246 -285
- package/dist/src/lib/function-db-types.js.map +1 -1
- package/dist/src/lib/function-document-types.d.ts +19 -7
- package/dist/src/lib/function-document-types.js +24 -12
- package/dist/src/lib/function-document-types.js.map +1 -1
- package/dist/src/lib/function-run.d.ts +1 -1
- package/dist/src/lib/function-run.js +1 -1
- package/dist/src/lib/function-run.js.map +1 -1
- package/dist/src/lib/function-schema-codegen.d.ts +58 -18
- package/dist/src/lib/function-schema-codegen.js +85 -74
- package/dist/src/lib/function-schema-codegen.js.map +1 -1
- package/dist/src/lib/function-schema-refs.d.ts +98 -0
- package/dist/src/lib/function-schema-refs.js +177 -0
- package/dist/src/lib/function-schema-refs.js.map +1 -0
- package/dist/src/lib/function-sync.d.ts +38 -4
- package/dist/src/lib/function-sync.js +83 -14
- package/dist/src/lib/function-sync.js.map +1 -1
- package/dist/src/lib/function-typecheck.d.ts +52 -0
- package/dist/src/lib/function-typecheck.js +171 -54
- package/dist/src/lib/function-typecheck.js.map +1 -1
- package/dist/src/lib/generated-build-flags.d.ts +13 -0
- package/dist/src/lib/generated-build-flags.js +14 -0
- package/dist/src/lib/generated-build-flags.js.map +1 -0
- package/dist/src/lib/generated-config-surfaces.d.ts +211 -11
- package/dist/src/lib/generated-config-surfaces.js +579 -69
- package/dist/src/lib/generated-config-surfaces.js.map +1 -1
- package/dist/src/lib/generated-sdk-types.d.ts +1 -1
- package/dist/src/lib/generated-sdk-types.js +1 -1
- package/dist/src/lib/generated-sdk-types.js.map +1 -1
- package/dist/src/lib/integration-test-request.d.ts +54 -0
- package/dist/src/lib/integration-test-request.js +207 -0
- package/dist/src/lib/integration-test-request.js.map +1 -0
- package/dist/src/lib/log-inspection.d.ts +3 -0
- package/dist/src/lib/log-inspection.js +1 -0
- package/dist/src/lib/log-inspection.js.map +1 -1
- package/dist/src/lib/metadata-report.d.ts +85 -0
- package/dist/src/lib/metadata-report.js +81 -0
- package/dist/src/lib/metadata-report.js.map +1 -0
- package/dist/src/lib/output.d.ts +1 -1
- package/dist/src/lib/output.js +1 -1
- package/dist/src/lib/platform-owned.js +5 -0
- package/dist/src/lib/platform-owned.js.map +1 -1
- package/dist/src/lib/primitive-declaration-names.d.ts +21 -0
- package/dist/src/lib/primitive-declaration-names.js +22 -0
- package/dist/src/lib/primitive-declaration-names.js.map +1 -0
- package/dist/src/lib/primitive-declaration.d.ts +143 -0
- package/dist/src/lib/primitive-declaration.js +658 -0
- package/dist/src/lib/primitive-declaration.js.map +1 -0
- package/dist/src/lib/prompt-schema-codegen.d.ts +36 -12
- package/dist/src/lib/prompt-schema-codegen.js +82 -98
- package/dist/src/lib/prompt-schema-codegen.js.map +1 -1
- package/dist/src/lib/prompt-schema-document.d.ts +35 -0
- package/dist/src/lib/prompt-schema-document.js +92 -0
- package/dist/src/lib/prompt-schema-document.js.map +1 -0
- package/dist/src/lib/prompt-schema-refs.d.ts +164 -0
- package/dist/src/lib/prompt-schema-refs.js +452 -0
- package/dist/src/lib/prompt-schema-refs.js.map +1 -0
- package/dist/src/lib/records-verbs.d.ts +12 -2
- package/dist/src/lib/records-verbs.js +7 -2
- package/dist/src/lib/records-verbs.js.map +1 -1
- package/dist/src/lib/register-commands.d.ts +28 -0
- package/dist/src/lib/register-commands.js +101 -0
- package/dist/src/lib/register-commands.js.map +1 -0
- package/dist/src/lib/retired-imports.d.ts +53 -0
- package/dist/src/lib/retired-imports.js +120 -0
- package/dist/src/lib/retired-imports.js.map +1 -0
- package/dist/src/lib/schema-codegen/compiledSpace.d.ts +62 -0
- package/dist/src/lib/schema-codegen/compiledSpace.js +103 -0
- package/dist/src/lib/schema-codegen/compiledSpace.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-db3-bridge.d.ts +86 -0
- package/dist/src/lib/schema-codegen/generated-db3-bridge.js +221 -0
- package/dist/src/lib/schema-codegen/generated-db3-bridge.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.d.ts +85 -0
- package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.js +86 -0
- package/dist/src/lib/schema-codegen/generated-db3-query-capabilities.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-field-grammar.d.ts +209 -0
- package/dist/src/lib/schema-codegen/generated-field-grammar.js +379 -0
- package/dist/src/lib/schema-codegen/generated-field-grammar.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-field-table.d.ts +80 -0
- package/dist/src/lib/schema-codegen/generated-field-table.js +542 -0
- package/dist/src/lib/schema-codegen/generated-field-table.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-prompt-schemas.d.ts +195 -0
- package/dist/src/lib/schema-codegen/generated-prompt-schemas.js +503 -0
- package/dist/src/lib/schema-codegen/generated-prompt-schemas.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-schema-descriptor.d.ts +129 -0
- package/dist/src/lib/schema-codegen/generated-schema-descriptor.js +154 -1
- package/dist/src/lib/schema-codegen/generated-schema-descriptor.js.map +1 -1
- package/dist/src/lib/schema-codegen/generated-schema-file.d.ts +129 -0
- package/dist/src/lib/schema-codegen/generated-schema-file.js +475 -0
- package/dist/src/lib/schema-codegen/generated-schema-file.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-schema-provenance.d.ts +115 -0
- package/dist/src/lib/schema-codegen/generated-schema-provenance.js +274 -0
- package/dist/src/lib/schema-codegen/generated-schema-provenance.js.map +1 -0
- package/dist/src/lib/schema-codegen/generated-schema-refs.d.ts +366 -0
- package/dist/src/lib/schema-codegen/generated-schema-refs.js +1789 -0
- package/dist/src/lib/schema-codegen/generated-schema-refs.js.map +1 -0
- package/dist/src/lib/schema-codegen/namedRefs.d.ts +56 -0
- package/dist/src/lib/schema-codegen/namedRefs.js +143 -0
- package/dist/src/lib/schema-codegen/namedRefs.js.map +1 -0
- package/dist/src/lib/schema-codegen/schemaChanges.d.ts +74 -0
- package/dist/src/lib/schema-codegen/schemaChanges.js +277 -0
- package/dist/src/lib/schema-codegen/schemaChanges.js.map +1 -0
- package/dist/src/lib/schema-codegen/schemaDocs.d.ts +69 -0
- package/dist/src/lib/schema-codegen/schemaDocs.js +219 -0
- package/dist/src/lib/schema-codegen/schemaDocs.js.map +1 -0
- package/dist/src/lib/schema-codegen/schemaIR.d.ts +158 -0
- package/dist/src/lib/schema-codegen/schemaIR.js +279 -0
- package/dist/src/lib/schema-codegen/schemaIR.js.map +1 -0
- package/dist/src/lib/schema-codegen/schemaToTs.d.ts +40 -13
- package/dist/src/lib/schema-codegen/schemaToTs.js +124 -160
- package/dist/src/lib/schema-codegen/schemaToTs.js.map +1 -1
- package/dist/src/lib/schema-codegen/valuesLists.d.ts +35 -0
- package/dist/src/lib/schema-codegen/valuesLists.js +128 -0
- package/dist/src/lib/schema-codegen/valuesLists.js.map +1 -0
- package/dist/src/lib/schema-family-index.d.ts +228 -0
- package/dist/src/lib/schema-family-index.js +813 -0
- package/dist/src/lib/schema-family-index.js.map +1 -0
- package/dist/src/lib/schema-pins.d.ts +82 -0
- package/dist/src/lib/schema-pins.js +198 -0
- package/dist/src/lib/schema-pins.js.map +1 -0
- package/dist/src/lib/schema-preview.d.ts +244 -0
- package/dist/src/lib/schema-preview.js +498 -0
- package/dist/src/lib/schema-preview.js.map +1 -0
- package/dist/src/lib/skill-installer.d.ts +2 -2
- package/dist/src/lib/skill-installer.js +2 -21
- package/dist/src/lib/skill-installer.js.map +1 -1
- package/dist/src/lib/step-run-table.d.ts +1 -2
- package/dist/src/lib/step-run-table.js +1 -2
- package/dist/src/lib/step-run-table.js.map +1 -1
- package/dist/src/lib/swift-codegen/agentGenerator.d.ts +2 -1
- package/dist/src/lib/swift-codegen/agentGenerator.js +24 -22
- package/dist/src/lib/swift-codegen/agentGenerator.js.map +1 -1
- package/dist/src/lib/swift-codegen/banners.d.ts +12 -0
- package/dist/src/lib/swift-codegen/banners.js +12 -0
- package/dist/src/lib/swift-codegen/banners.js.map +1 -1
- package/dist/src/lib/swift-codegen/functionGenerator.d.ts +36 -1
- package/dist/src/lib/swift-codegen/functionGenerator.js +167 -50
- package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -1
- package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +31 -7
- package/dist/src/lib/swift-codegen/schemaToSwift.js +213 -177
- package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -1
- package/dist/src/lib/swift-codegen/sharedGenerator.d.ts +45 -0
- package/dist/src/lib/swift-codegen/sharedGenerator.js +120 -0
- package/dist/src/lib/swift-codegen/sharedGenerator.js.map +1 -0
- package/dist/src/lib/swift-codegen/userPropertiesGenerator.d.ts +30 -0
- package/dist/src/lib/swift-codegen/userPropertiesGenerator.js +69 -0
- package/dist/src/lib/swift-codegen/userPropertiesGenerator.js.map +1 -0
- package/dist/src/lib/sync-resource-types.d.ts +37 -5
- package/dist/src/lib/sync-resource-types.js +53 -5
- package/dist/src/lib/sync-resource-types.js.map +1 -1
- package/dist/src/lib/sync-selectors.d.ts +7 -0
- package/dist/src/lib/sync-selectors.js +22 -2
- package/dist/src/lib/sync-selectors.js.map +1 -1
- package/dist/src/lib/test-runs.d.ts +45 -0
- package/dist/src/lib/test-runs.js +150 -0
- package/dist/src/lib/test-runs.js.map +1 -0
- package/dist/src/lib/test-users.d.ts +25 -0
- package/dist/src/lib/test-users.js +36 -0
- package/dist/src/lib/test-users.js.map +1 -0
- package/dist/src/lib/toml-database-config.d.ts +2 -1
- package/dist/src/lib/toml-database-config.js +4 -3
- package/dist/src/lib/toml-database-config.js.map +1 -1
- package/dist/src/lib/toml-scalar-edit.js +6 -4
- package/dist/src/lib/toml-scalar-edit.js.map +1 -1
- package/dist/src/lib/user-index.d.ts +80 -0
- package/dist/src/lib/user-index.js +166 -0
- package/dist/src/lib/user-index.js.map +1 -0
- package/dist/src/lib/user-properties/generated-properties-schema.d.ts +159 -0
- package/dist/src/lib/user-properties/generated-properties-schema.js +471 -0
- package/dist/src/lib/user-properties/generated-properties-schema.js.map +1 -0
- package/dist/src/lib/user-properties/user-properties-codegen.d.ts +55 -0
- package/dist/src/lib/user-properties/user-properties-codegen.js +129 -0
- package/dist/src/lib/user-properties/user-properties-codegen.js.map +1 -0
- package/dist/src/lib/user-walk.d.ts +31 -0
- package/dist/src/lib/user-walk.js +102 -0
- package/dist/src/lib/user-walk.js.map +1 -0
- package/dist/src/lib/worker-perf-format.d.ts +22 -0
- package/dist/src/lib/worker-perf-format.js +27 -0
- package/dist/src/lib/worker-perf-format.js.map +1 -0
- package/dist/src/types/index.d.ts +13 -34
- package/package.json +5 -3
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED FILE — DO NOT EDIT BY HAND.
|
|
3
|
+
*
|
|
4
|
+
* Vendored from the canonical server module
|
|
5
|
+
* `src/function-runs/prompt-schemas.ts` — the SAME interpretation the server
|
|
6
|
+
* applies to a function's schemas. The CLI cannot import server `src/`
|
|
7
|
+
* at runtime, so the CLI imports this committed copy instead.
|
|
8
|
+
*
|
|
9
|
+
* Regenerate with:
|
|
10
|
+
* node cli/scripts/gen-schema-descriptor.mjs (runs at CLI prebuild)
|
|
11
|
+
*
|
|
12
|
+
* A CI freshness guard
|
|
13
|
+
* (`cli/scripts/gen-schema-descriptor.mjs --check`, also asserted by
|
|
14
|
+
* `cli/tests/unit/schema-codegen-descriptor-drift-guard.test.ts`) fails if
|
|
15
|
+
* this committed copy does not match the source — see issue #1442 / #998.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* A prompt's schemas, compiled (#5534, project `unified-schemas` phase 3).
|
|
19
|
+
*
|
|
20
|
+
* A prompt holds schemas in three fields: `inputSchema`, `outputSchema` and
|
|
21
|
+
* the `agent` declaration, whose slots are schemas too (a client or
|
|
22
|
+
* presentation tool's `inputSchema`/`outputSchema`, an event's `schema`, the
|
|
23
|
+
* turn context's `schema`). Each per-config `outputSchema` is one more. Every
|
|
24
|
+
* one may carry `$defs`, local refs, and refs to the app's `schemas/` defs,
|
|
25
|
+
* to another prompt's schemas and to a function's, which `compileSchemaRefs`
|
|
26
|
+
* resolves against a family index. The stored fields hold the compiled,
|
|
27
|
+
* inlined schema; the authored value is kept as the prompt's source.
|
|
28
|
+
*
|
|
29
|
+
* A schema may ref its own prompt (`prompt.<own key>.output`): it resolves
|
|
30
|
+
* against the slot compiled in the same write, so the slots compile in
|
|
31
|
+
* dependency order, and a cycle among them is refused naming the chain. A
|
|
32
|
+
* field the write does not carry (a PATCH) is read as stored, and its stored
|
|
33
|
+
* source's own-key refs count toward that cycle.
|
|
34
|
+
*
|
|
35
|
+
* Refusals carry the field (`inputSchema`, `outputSchema` or `agent`; a
|
|
36
|
+
* config's is `outputSchema`) and the pointer in it, an agent slot's prefixed
|
|
37
|
+
* with the slot's pointer in the declaration, and the compiler's code with
|
|
38
|
+
* the prompt family's prefix.
|
|
39
|
+
*
|
|
40
|
+
* A ref to a db3 model (#5540) gets the row in an output slot (the prompt's,
|
|
41
|
+
* a config's and a tool's `outputSchema`) and the declared shape in every
|
|
42
|
+
* other slot, unless it names its projection.
|
|
43
|
+
*
|
|
44
|
+
* Pure, importing only the ref compiler, so the CLI vendors it beside the
|
|
45
|
+
* compiler (`cli/scripts/gen-schema-descriptor.mjs`) and both sides compile a
|
|
46
|
+
* prompt to the same bytes.
|
|
47
|
+
*/
|
|
48
|
+
import { type SchemaFamilyIndex, type SchemaFamilyPrompt, type SchemaRefResolution } from "./generated-schema-refs.js";
|
|
49
|
+
import type { SchemaProvenance } from "./generated-schema-provenance.js";
|
|
50
|
+
/** The prompt fields that hold schemas, in the order messages and payloads name them. */
|
|
51
|
+
export declare const PROMPT_SCHEMA_FIELDS: readonly ["inputSchema", "outputSchema", "agent"];
|
|
52
|
+
/** One of `PROMPT_SCHEMA_FIELDS`. */
|
|
53
|
+
export type PromptSchemaField = (typeof PROMPT_SCHEMA_FIELDS)[number];
|
|
54
|
+
/**
|
|
55
|
+
* The bytes a prompt row may spend on its compiled schema fields and the
|
|
56
|
+
* inline source and provenance together (320 KiB, the function figure),
|
|
57
|
+
* checked when a write inlined a ref. The row is one storage item, capped at
|
|
58
|
+
* 400 KB with the rest of the prompt's fields.
|
|
59
|
+
*/
|
|
60
|
+
export declare const PROMPT_SCHEMA_ROW_BUDGET_BYTES = 327680;
|
|
61
|
+
/** Past this many bytes a prompt's source or provenance is stored in R2 rather than in the row (25 KiB). */
|
|
62
|
+
export declare const PROMPT_SCHEMA_INLINE_LIMIT_BYTES: number;
|
|
63
|
+
/** The refusal code for prompt schemas that reference each other in a loop. */
|
|
64
|
+
export declare const PROMPT_SCHEMA_REF_CYCLE = "PROMPT_SCHEMA_REF_CYCLE";
|
|
65
|
+
/** The refusal code for a compiled payload that differs from the server's compile. */
|
|
66
|
+
export declare const PROMPT_SCHEMA_COMPILED_MISMATCH = "PROMPT_SCHEMA_COMPILED_MISMATCH";
|
|
67
|
+
/** Every code a prompt schema write may be refused with. */
|
|
68
|
+
export declare const PROMPT_SCHEMA_REFUSAL_CODES: readonly ["PROMPT_SCHEMA_EXPANSION_LIMIT", "PROMPT_SCHEMA_REF_SIBLING", "PROMPT_SCHEMA_REF_UNRESOLVED", "PROMPT_SCHEMA_REF_AMBIGUOUS", "PROMPT_SCHEMA_REF_TOMBSTONED", "PROMPT_SCHEMA_REF_RESERVED", "PROMPT_SCHEMA_REF_CYCLE", "PROMPT_SCHEMA_COMPILED_MISMATCH", "SCHEMA_CANONICAL_INVALID", "PROMPT_SCHEMA_NOT_TRANSLATABLE", "PROMPT_SCHEMA_UNSUPPORTED_KEYWORD"];
|
|
69
|
+
/** The compiler's code as a prompt write answers it: `FUNCTION_SCHEMA_*` becomes `PROMPT_SCHEMA_*`. */
|
|
70
|
+
export declare function promptSchemaRefusalCode(code: string): string;
|
|
71
|
+
/** Why a prompt's schemas cannot be compiled. */
|
|
72
|
+
export interface PromptSchemaRefusal {
|
|
73
|
+
/** `inputSchema`, `outputSchema` or `agent`; a config's field is `outputSchema`. */
|
|
74
|
+
field: string;
|
|
75
|
+
/** The config whose `outputSchema` is refused, when it is a config's. */
|
|
76
|
+
config?: string;
|
|
77
|
+
code: string;
|
|
78
|
+
/** JSON pointer in the field; an agent slot's is a declaration pointer (`/tools/0/inputSchema/...`). */
|
|
79
|
+
path: string;
|
|
80
|
+
chain: string[];
|
|
81
|
+
/** Starts with the field. */
|
|
82
|
+
message: string;
|
|
83
|
+
}
|
|
84
|
+
/** One schema slot of an agent declaration. */
|
|
85
|
+
export interface AgentSchemaSlot {
|
|
86
|
+
/** JSON pointer of the slot in the declaration, such as `/tools/0/inputSchema`. */
|
|
87
|
+
pointer: string;
|
|
88
|
+
schema: unknown;
|
|
89
|
+
/** The target path another schema refs it by (`tools/<name>/input`, `events/<kind>`), or null (the turn context). */
|
|
90
|
+
target: string | null;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Every schema slot of an agent declaration (a table, or one JSON string
|
|
94
|
+
* encoding one), in declaration order: each client and presentation tool's
|
|
95
|
+
* `inputSchema` and `outputSchema`, each event's `schema`, and the turn
|
|
96
|
+
* context's `schema`. A server tool declares none: its function's schemas are
|
|
97
|
+
* the tool's.
|
|
98
|
+
*/
|
|
99
|
+
export declare function agentSchemaSlots(declaration: unknown): AgentSchemaSlot[];
|
|
100
|
+
/** What a prompt write carries: a field left `undefined` is not carried (a PATCH that does not touch it). */
|
|
101
|
+
export interface PromptSchemaDocument {
|
|
102
|
+
inputSchema?: unknown;
|
|
103
|
+
outputSchema?: unknown;
|
|
104
|
+
agent?: unknown;
|
|
105
|
+
/** Per-config `outputSchema`s compiled with the prompt (a whole prompt file). */
|
|
106
|
+
configs?: ReadonlyArray<{
|
|
107
|
+
name: string;
|
|
108
|
+
outputSchema?: unknown;
|
|
109
|
+
}>;
|
|
110
|
+
}
|
|
111
|
+
/** How `compilePromptSchemas` compiles. */
|
|
112
|
+
export interface PromptSchemaCompileOptions {
|
|
113
|
+
/** The shared defs, prompts and functions refs resolve against. Without it, only local refs resolve. */
|
|
114
|
+
families?: SchemaFamilyIndex;
|
|
115
|
+
/** The prompt's own key: a ref to it resolves against this write's slots. */
|
|
116
|
+
selfKey?: string;
|
|
117
|
+
/**
|
|
118
|
+
* The stored compiled fields (and their stored provenance) a ref to the
|
|
119
|
+
* prompt's own key reads for a field the write does not carry, and the
|
|
120
|
+
* stored source, whose own-key refs the cycle check follows for those fields.
|
|
121
|
+
*/
|
|
122
|
+
stored?: {
|
|
123
|
+
inputSchema?: unknown;
|
|
124
|
+
outputSchema?: unknown;
|
|
125
|
+
agent?: unknown;
|
|
126
|
+
provenance?: Partial<Record<PromptSchemaField, SchemaProvenance>> | null;
|
|
127
|
+
source?: Partial<Record<PromptSchemaField, unknown>> | null;
|
|
128
|
+
};
|
|
129
|
+
/** As `compileSchemaRefs`'s option: false compiles without what provenance hashes. Defaults to true. */
|
|
130
|
+
provenance?: boolean;
|
|
131
|
+
}
|
|
132
|
+
/** One field as compiled. */
|
|
133
|
+
export interface PromptFieldCompile {
|
|
134
|
+
/** The value as the write carried it. */
|
|
135
|
+
authored: unknown;
|
|
136
|
+
/** What the field stores: the compiled document when the compile changed it, else the authored value itself. */
|
|
137
|
+
value: unknown;
|
|
138
|
+
changed: boolean;
|
|
139
|
+
/** What the compile resolved, at pointers in the field (an agent's are declaration pointers). */
|
|
140
|
+
resolved: SchemaRefResolution[];
|
|
141
|
+
/** One line per inert `$ref`, starting with the field. */
|
|
142
|
+
warnings: string[];
|
|
143
|
+
}
|
|
144
|
+
/** What `compilePromptSchemas` answers. */
|
|
145
|
+
export interface PromptSchemaCompile {
|
|
146
|
+
/** Each prompt-level field the write carried. */
|
|
147
|
+
fields: Partial<Record<PromptSchemaField, PromptFieldCompile>>;
|
|
148
|
+
/** Each config given, in order. */
|
|
149
|
+
configs: Array<PromptFieldCompile & {
|
|
150
|
+
name: string;
|
|
151
|
+
}>;
|
|
152
|
+
/** Every warning, field by field. */
|
|
153
|
+
warnings: string[];
|
|
154
|
+
/** The first refusal; when set, nothing else is to be stored. */
|
|
155
|
+
refusal: PromptSchemaRefusal | null;
|
|
156
|
+
/** The prompt as a ref target after this compile: what an index holds for it. */
|
|
157
|
+
self: SchemaFamilyPrompt;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Compile a prompt's schemas: the three prompt-level fields the write
|
|
161
|
+
* carries and every config given, against `options.families`. A field the
|
|
162
|
+
* compile leaves unchanged answers `changed: false` with its authored value,
|
|
163
|
+
* so a write with no ref stores what it stores today. See the module note for
|
|
164
|
+
* own-key refs and refusals.
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* compilePromptSchemas(
|
|
168
|
+
* { inputSchema: { $defs: { Sku: { type: "string" } }, properties: { sku: { $ref: "#/$defs/Sku" } } } },
|
|
169
|
+
* { selfKey: "quote" }
|
|
170
|
+
* ).fields.inputSchema?.value;
|
|
171
|
+
* // → { properties: { sku: { type: "string" } } }
|
|
172
|
+
*/
|
|
173
|
+
export declare function compilePromptSchemas(document: PromptSchemaDocument, options?: PromptSchemaCompileOptions): PromptSchemaCompile;
|
|
174
|
+
/**
|
|
175
|
+
* Compile one config's `outputSchema` against `options.families`, where the
|
|
176
|
+
* prompt's own key resolves to the prompt as the index holds it (the stored
|
|
177
|
+
* row, on a config write).
|
|
178
|
+
*/
|
|
179
|
+
export declare function compilePromptConfigSchema(outputSchema: unknown, options?: Omit<PromptSchemaCompileOptions, "stored">): {
|
|
180
|
+
compile: PromptFieldCompile | null;
|
|
181
|
+
refusal: PromptSchemaRefusal | null;
|
|
182
|
+
warnings: string[];
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* The prompt row budget (DSO-5534-006): when a write inlined a ref into any
|
|
186
|
+
* schema field, the stored texts of the fields given (a PATCH's unchanged
|
|
187
|
+
* ones included) plus the source and provenance the row keeps inline (each
|
|
188
|
+
* counted only while it stays under the 25 KiB spill threshold) must fit
|
|
189
|
+
* `budget`. Null when they fit, or when no ref was inlined. A config passes
|
|
190
|
+
* its one `outputSchema`.
|
|
191
|
+
*/
|
|
192
|
+
export declare function promptSchemaRowBudgetRefusal(texts: Partial<Record<PromptSchemaField, string | null | undefined>>, inline: {
|
|
193
|
+
source?: string | null;
|
|
194
|
+
provenance?: string | null;
|
|
195
|
+
}, resolved: Partial<Record<PromptSchemaField, readonly SchemaRefResolution[]>>, budget?: number): PromptSchemaRefusal | null;
|