@xemahq/kernel-contracts 0.1.0 → 0.2.0
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/LICENSE +201 -0
- package/dist/agent-tool-inquiry/index.d.ts +2 -0
- package/dist/agent-tool-inquiry/index.d.ts.map +1 -0
- package/dist/agent-tool-inquiry/index.js +18 -0
- package/dist/agent-tool-inquiry/index.js.map +1 -0
- package/dist/agent-tool-inquiry/lib/agent-tool-inquiry.d.ts +43 -0
- package/dist/agent-tool-inquiry/lib/agent-tool-inquiry.d.ts.map +1 -0
- package/dist/agent-tool-inquiry/lib/agent-tool-inquiry.js +32 -0
- package/dist/agent-tool-inquiry/lib/agent-tool-inquiry.js.map +1 -0
- package/dist/agent-workspace/awp-spec.json +1 -1
- package/dist/app-runtime/index.d.ts +9 -0
- package/dist/app-runtime/index.d.ts.map +1 -0
- package/dist/app-runtime/index.js +25 -0
- package/dist/app-runtime/index.js.map +1 -0
- package/dist/app-runtime/lib/app-client.d.ts +11 -0
- package/dist/app-runtime/lib/app-client.d.ts.map +1 -0
- package/dist/app-runtime/lib/app-client.js +23 -0
- package/dist/app-runtime/lib/app-client.js.map +1 -0
- package/dist/app-runtime/lib/app-lockfile.d.ts +12 -0
- package/dist/app-runtime/lib/app-lockfile.d.ts.map +1 -0
- package/dist/app-runtime/lib/app-lockfile.js +17 -0
- package/dist/app-runtime/lib/app-lockfile.js.map +1 -0
- package/dist/app-runtime/lib/app.d.ts +26 -0
- package/dist/app-runtime/lib/app.d.ts.map +1 -0
- package/dist/app-runtime/lib/app.js +31 -0
- package/dist/app-runtime/lib/app.js.map +1 -0
- package/dist/app-runtime/lib/audience-policy.d.ts +31 -0
- package/dist/app-runtime/lib/audience-policy.d.ts.map +1 -0
- package/dist/app-runtime/lib/audience-policy.js +38 -0
- package/dist/app-runtime/lib/audience-policy.js.map +1 -0
- package/dist/app-runtime/lib/biome-install.d.ts +9 -0
- package/dist/app-runtime/lib/biome-install.d.ts.map +1 -0
- package/dist/app-runtime/lib/biome-install.js +13 -0
- package/dist/app-runtime/lib/biome-install.js.map +1 -0
- package/dist/app-runtime/lib/branding-config.d.ts +9 -0
- package/dist/app-runtime/lib/branding-config.d.ts.map +1 -0
- package/dist/app-runtime/lib/branding-config.js +24 -0
- package/dist/app-runtime/lib/branding-config.js.map +1 -0
- package/dist/app-runtime/lib/delegated-session.d.ts +15 -0
- package/dist/app-runtime/lib/delegated-session.d.ts.map +1 -0
- package/dist/app-runtime/lib/delegated-session.js +29 -0
- package/dist/app-runtime/lib/delegated-session.js.map +1 -0
- package/dist/app-runtime/lib/external-subject.d.ts +9 -0
- package/dist/app-runtime/lib/external-subject.d.ts.map +1 -0
- package/dist/app-runtime/lib/external-subject.js +19 -0
- package/dist/app-runtime/lib/external-subject.js.map +1 -0
- package/dist/connector/index.d.ts +9 -0
- package/dist/connector/index.d.ts.map +1 -0
- package/dist/connector/index.js +25 -0
- package/dist/connector/index.js.map +1 -0
- package/dist/connector/lib/adapter-kind.d.ts +8 -0
- package/dist/connector/lib/adapter-kind.d.ts.map +1 -0
- package/dist/connector/lib/adapter-kind.js +14 -0
- package/dist/connector/lib/adapter-kind.js.map +1 -0
- package/dist/connector/lib/capability-refs.d.ts +14 -0
- package/dist/connector/lib/capability-refs.d.ts.map +1 -0
- package/dist/connector/lib/capability-refs.js +15 -0
- package/dist/connector/lib/capability-refs.js.map +1 -0
- package/dist/connector/lib/capability.d.ts +18 -0
- package/dist/connector/lib/capability.d.ts.map +1 -0
- package/dist/connector/lib/capability.js +24 -0
- package/dist/connector/lib/capability.js.map +1 -0
- package/dist/connector/lib/credential-kind.d.ts +42 -0
- package/dist/connector/lib/credential-kind.d.ts.map +1 -0
- package/dist/connector/lib/credential-kind.js +26 -0
- package/dist/connector/lib/credential-kind.js.map +1 -0
- package/dist/connector/lib/envelope-schema.d.ts +6 -0
- package/dist/connector/lib/envelope-schema.d.ts.map +1 -0
- package/dist/connector/lib/envelope-schema.js +150 -0
- package/dist/connector/lib/envelope-schema.js.map +1 -0
- package/dist/connector/lib/filter-expr-schema.d.ts +4 -0
- package/dist/connector/lib/filter-expr-schema.d.ts.map +1 -0
- package/dist/connector/lib/filter-expr-schema.js +65 -0
- package/dist/connector/lib/filter-expr-schema.js.map +1 -0
- package/dist/connector/lib/filter-expr-validate.d.ts +10 -0
- package/dist/connector/lib/filter-expr-validate.d.ts.map +1 -0
- package/dist/connector/lib/filter-expr-validate.js +58 -0
- package/dist/connector/lib/filter-expr-validate.js.map +1 -0
- package/dist/connector/lib/filter-expr.d.ts +49 -0
- package/dist/connector/lib/filter-expr.d.ts.map +1 -0
- package/dist/connector/lib/filter-expr.js +135 -0
- package/dist/connector/lib/filter-expr.js.map +1 -0
- package/dist/connector/lib/onboarding-manifest.d.ts +45 -0
- package/dist/connector/lib/onboarding-manifest.d.ts.map +1 -0
- package/dist/connector/lib/onboarding-manifest.js +30 -0
- package/dist/connector/lib/onboarding-manifest.js.map +1 -0
- package/dist/document-render/index.d.ts +7 -0
- package/dist/document-render/index.d.ts.map +1 -0
- package/dist/document-render/index.js +23 -0
- package/dist/document-render/index.js.map +1 -0
- package/dist/document-render/lib/measure-layout.d.ts +44 -0
- package/dist/document-render/lib/measure-layout.d.ts.map +1 -0
- package/dist/document-render/lib/measure-layout.js +16 -0
- package/dist/document-render/lib/measure-layout.js.map +1 -0
- package/dist/document-render/lib/render-enums.d.ts +18 -0
- package/dist/document-render/lib/render-enums.d.ts.map +1 -0
- package/dist/document-render/lib/render-enums.js +24 -0
- package/dist/document-render/lib/render-enums.js.map +1 -0
- package/dist/document-render/lib/render-record.d.ts +22 -0
- package/dist/document-render/lib/render-record.d.ts.map +1 -0
- package/dist/document-render/lib/render-record.js +3 -0
- package/dist/document-render/lib/render-record.js.map +1 -0
- package/dist/document-render/lib/render-request.d.ts +24 -0
- package/dist/document-render/lib/render-request.d.ts.map +1 -0
- package/dist/document-render/lib/render-request.js +12 -0
- package/dist/document-render/lib/render-request.js.map +1 -0
- package/dist/document-render/lib/render-source.d.ts +43 -0
- package/dist/document-render/lib/render-source.d.ts.map +1 -0
- package/dist/document-render/lib/render-source.js +31 -0
- package/dist/document-render/lib/render-source.js.map +1 -0
- package/dist/document-render/lib/xema-prompt.d.ts +11 -0
- package/dist/document-render/lib/xema-prompt.d.ts.map +1 -0
- package/dist/document-render/lib/xema-prompt.js +46 -0
- package/dist/document-render/lib/xema-prompt.js.map +1 -0
- package/dist/inquiry/index.d.ts +7 -0
- package/dist/inquiry/index.d.ts.map +1 -0
- package/dist/inquiry/index.js +23 -0
- package/dist/inquiry/index.js.map +1 -0
- package/dist/inquiry/lib/enums.d.ts +36 -0
- package/dist/inquiry/lib/enums.d.ts.map +1 -0
- package/dist/inquiry/lib/enums.js +45 -0
- package/dist/inquiry/lib/enums.js.map +1 -0
- package/dist/inquiry/lib/inquiry.d.ts +332 -0
- package/dist/inquiry/lib/inquiry.d.ts.map +1 -0
- package/dist/inquiry/lib/inquiry.js +102 -0
- package/dist/inquiry/lib/inquiry.js.map +1 -0
- package/dist/inquiry/lib/kind-registry.d.ts +14 -0
- package/dist/inquiry/lib/kind-registry.d.ts.map +1 -0
- package/dist/inquiry/lib/kind-registry.js +24 -0
- package/dist/inquiry/lib/kind-registry.js.map +1 -0
- package/dist/inquiry/lib/policy.d.ts +19 -0
- package/dist/inquiry/lib/policy.d.ts.map +1 -0
- package/dist/inquiry/lib/policy.js +21 -0
- package/dist/inquiry/lib/policy.js.map +1 -0
- package/dist/inquiry/lib/recipient.d.ts +111 -0
- package/dist/inquiry/lib/recipient.d.ts.map +1 -0
- package/dist/inquiry/lib/recipient.js +64 -0
- package/dist/inquiry/lib/recipient.js.map +1 -0
- package/dist/inquiry/lib/workflow-verdict-evaluator.d.ts +15 -0
- package/dist/inquiry/lib/workflow-verdict-evaluator.d.ts.map +1 -0
- package/dist/inquiry/lib/workflow-verdict-evaluator.js +145 -0
- package/dist/inquiry/lib/workflow-verdict-evaluator.js.map +1 -0
- package/dist/org-database/index.d.ts +5 -0
- package/dist/org-database/index.d.ts.map +1 -0
- package/dist/org-database/index.js +21 -0
- package/dist/org-database/index.js.map +1 -0
- package/dist/org-database/lib/db-result-event.d.ts +24 -0
- package/dist/org-database/lib/db-result-event.d.ts.map +1 -0
- package/dist/org-database/lib/db-result-event.js +3 -0
- package/dist/org-database/lib/db-result-event.js.map +1 -0
- package/dist/org-database/lib/driver.d.ts +43 -0
- package/dist/org-database/lib/driver.d.ts.map +1 -0
- package/dist/org-database/lib/driver.js +3 -0
- package/dist/org-database/lib/driver.js.map +1 -0
- package/dist/org-database/lib/enums.d.ts +41 -0
- package/dist/org-database/lib/enums.d.ts.map +1 -0
- package/dist/org-database/lib/enums.js +51 -0
- package/dist/org-database/lib/enums.js.map +1 -0
- package/dist/org-database/lib/migration-runner.d.ts +15 -0
- package/dist/org-database/lib/migration-runner.d.ts.map +1 -0
- package/dist/org-database/lib/migration-runner.js +3 -0
- package/dist/org-database/lib/migration-runner.js.map +1 -0
- package/dist/project-kit/index.d.ts +2 -0
- package/dist/project-kit/index.d.ts.map +1 -0
- package/dist/project-kit/index.js +18 -0
- package/dist/project-kit/index.js.map +1 -0
- package/dist/project-kit/lib/project-kit.d.ts +63 -0
- package/dist/project-kit/lib/project-kit.d.ts.map +1 -0
- package/dist/project-kit/lib/project-kit.js +32 -0
- package/dist/project-kit/lib/project-kit.js.map +1 -0
- package/dist/provisioning/index.d.ts +2 -0
- package/dist/provisioning/index.d.ts.map +1 -0
- package/dist/provisioning/index.js +18 -0
- package/dist/provisioning/index.js.map +1 -0
- package/dist/provisioning/lib/provisioning.d.ts +256 -0
- package/dist/provisioning/lib/provisioning.d.ts.map +1 -0
- package/dist/provisioning/lib/provisioning.js +221 -0
- package/dist/provisioning/lib/provisioning.js.map +1 -0
- package/dist/worker-runtime/index.d.ts +6 -0
- package/dist/worker-runtime/index.d.ts.map +1 -0
- package/dist/worker-runtime/index.js +22 -0
- package/dist/worker-runtime/index.js.map +1 -0
- package/dist/worker-runtime/lib/capabilities.d.ts +22 -0
- package/dist/worker-runtime/lib/capabilities.d.ts.map +1 -0
- package/dist/worker-runtime/lib/capabilities.js +3 -0
- package/dist/worker-runtime/lib/capabilities.js.map +1 -0
- package/dist/worker-runtime/lib/enums.d.ts +10 -0
- package/dist/worker-runtime/lib/enums.d.ts.map +1 -0
- package/dist/worker-runtime/lib/enums.js +15 -0
- package/dist/worker-runtime/lib/enums.js.map +1 -0
- package/dist/worker-runtime/lib/messages.d.ts +33 -0
- package/dist/worker-runtime/lib/messages.d.ts.map +1 -0
- package/dist/worker-runtime/lib/messages.js +3 -0
- package/dist/worker-runtime/lib/messages.js.map +1 -0
- package/dist/worker-runtime/lib/runtime.d.ts +35 -0
- package/dist/worker-runtime/lib/runtime.d.ts.map +1 -0
- package/dist/worker-runtime/lib/runtime.js +3 -0
- package/dist/worker-runtime/lib/runtime.js.map +1 -0
- package/dist/worker-runtime/lib/schemas.d.ts +87 -0
- package/dist/worker-runtime/lib/schemas.d.ts.map +1 -0
- package/dist/worker-runtime/lib/schemas.js +57 -0
- package/dist/worker-runtime/lib/schemas.js.map +1 -0
- package/dist/workspace-storage/index.d.ts +4 -0
- package/dist/workspace-storage/index.d.ts.map +1 -0
- package/dist/workspace-storage/index.js +20 -0
- package/dist/workspace-storage/index.js.map +1 -0
- package/dist/workspace-storage/lib/enums.d.ts +34 -0
- package/dist/workspace-storage/lib/enums.d.ts.map +1 -0
- package/dist/workspace-storage/lib/enums.js +42 -0
- package/dist/workspace-storage/lib/enums.js.map +1 -0
- package/dist/workspace-storage/lib/schemas.d.ts +56 -0
- package/dist/workspace-storage/lib/schemas.d.ts.map +1 -0
- package/dist/workspace-storage/lib/schemas.js +59 -0
- package/dist/workspace-storage/lib/schemas.js.map +1 -0
- package/dist/workspace-storage/lib/types.d.ts +71 -0
- package/dist/workspace-storage/lib/types.d.ts.map +1 -0
- package/dist/workspace-storage/lib/types.js +3 -0
- package/dist/workspace-storage/lib/types.js.map +1 -0
- package/package.json +22 -153
- package/src/agent-composition/lib/composition-workspace.ts +1 -1
- package/src/agent-tool-inquiry/index.ts +16 -0
- package/src/agent-tool-inquiry/lib/agent-tool-inquiry.ts +82 -0
- package/src/agent-workspace/lib/workspace-spec.ts +1 -1
- package/src/app-runtime/index.ts +8 -0
- package/src/app-runtime/lib/app-client.ts +44 -0
- package/src/app-runtime/lib/app-lockfile.ts +54 -0
- package/src/app-runtime/lib/app.ts +84 -0
- package/src/app-runtime/lib/audience-policy.ts +87 -0
- package/src/app-runtime/lib/biome-install.ts +29 -0
- package/src/app-runtime/lib/branding-config.ts +54 -0
- package/src/app-runtime/lib/delegated-session.ts +69 -0
- package/src/app-runtime/lib/external-subject.ts +34 -0
- package/src/connector/index.ts +8 -0
- package/src/connector/lib/adapter-kind.ts +37 -0
- package/src/connector/lib/capability-refs.ts +29 -0
- package/src/connector/lib/capability.ts +38 -0
- package/src/connector/lib/credential-kind.ts +120 -0
- package/src/connector/lib/envelope-schema.ts +256 -0
- package/src/connector/lib/filter-expr-schema.ts +75 -0
- package/src/connector/lib/filter-expr-validate.ts +91 -0
- package/src/connector/lib/filter-expr.ts +208 -0
- package/src/connector/lib/onboarding-manifest.ts +167 -0
- package/src/document-render/index.ts +25 -0
- package/src/document-render/lib/measure-layout.ts +61 -0
- package/src/document-render/lib/render-enums.ts +49 -0
- package/src/document-render/lib/render-record.ts +38 -0
- package/src/document-render/lib/render-request.ts +16 -0
- package/src/document-render/lib/render-source.ts +44 -0
- package/src/document-render/lib/xema-prompt.ts +100 -0
- package/src/inquiry/index.ts +23 -0
- package/src/inquiry/lib/enums.ts +103 -0
- package/src/inquiry/lib/inquiry.ts +182 -0
- package/src/inquiry/lib/kind-registry.ts +57 -0
- package/src/inquiry/lib/policy.ts +27 -0
- package/src/inquiry/lib/recipient.ts +188 -0
- package/src/inquiry/lib/workflow-verdict-evaluator.ts +220 -0
- package/src/org-database/index.ts +4 -0
- package/src/org-database/lib/db-result-event.ts +59 -0
- package/src/org-database/lib/driver.ts +47 -0
- package/src/org-database/lib/enums.ts +51 -0
- package/src/org-database/lib/migration-runner.ts +17 -0
- package/src/project-kit/index.ts +17 -0
- package/src/project-kit/lib/project-kit.ts +227 -0
- package/src/provisioning/index.ts +17 -0
- package/src/provisioning/lib/provisioning.ts +499 -0
- package/src/worker-runtime/index.ts +14 -0
- package/src/worker-runtime/lib/capabilities.ts +58 -0
- package/src/worker-runtime/lib/enums.ts +33 -0
- package/src/worker-runtime/lib/messages.ts +49 -0
- package/src/worker-runtime/lib/runtime.ts +109 -0
- package/src/worker-runtime/lib/schemas.ts +72 -0
- package/src/workflow/lib/activity-outputs.ts +1 -1
- package/src/workflow/lib/compiled-run.ts +1 -1
- package/src/workflow/lib/compiled-workspace-manifest.ts +1 -1
- package/src/workflow/lib/model-ref.ts +1 -1
- package/src/workflow/lib/workspace-manifest-enums.ts +1 -1
- package/src/workspace-storage/index.ts +12 -0
- package/src/workspace-storage/lib/enums.ts +78 -0
- package/src/workspace-storage/lib/schemas.ts +75 -0
- package/src/workspace-storage/lib/types.ts +145 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xemahq/kernel-contracts",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Consolidated Xema OS kernel wire contracts — pure types + zod schemas for the
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Consolidated Xema OS kernel wire contracts — pure types + zod schemas for the 32 kernel protocol surfaces. One package, one npm scope, wildcard per-surface subpath exports. No framework/runtime deps.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/",
|
|
7
7
|
"access": "public"
|
|
@@ -10,164 +10,33 @@
|
|
|
10
10
|
"dist",
|
|
11
11
|
"src"
|
|
12
12
|
],
|
|
13
|
-
"scripts": {
|
|
14
|
-
"clean": "rm -rf dist",
|
|
15
|
-
"build": "tsc -p tsconfig.json && node scripts/emit-awp-spec.mjs",
|
|
16
|
-
"format": "prettier --write \"src/**/*.ts\"",
|
|
17
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
18
|
-
"lint": "eslint .",
|
|
19
|
-
"check:boundary": "node scripts/check-subpath-dag.mjs"
|
|
20
|
-
},
|
|
21
13
|
"devDependencies": {
|
|
22
|
-
"@eslint/js": "
|
|
23
|
-
"@types/node": "
|
|
24
|
-
"eslint": "
|
|
25
|
-
"eslint-config-prettier": "
|
|
14
|
+
"@eslint/js": "^9.39.4",
|
|
15
|
+
"@types/node": "25.2.3",
|
|
16
|
+
"eslint": "^9.39.4",
|
|
17
|
+
"eslint-config-prettier": "^10.1.8",
|
|
26
18
|
"eslint-plugin-import": "^2.31.0",
|
|
27
|
-
"prettier": "
|
|
28
|
-
"typescript": "
|
|
29
|
-
"typescript-eslint": "
|
|
19
|
+
"prettier": "3.6.2",
|
|
20
|
+
"typescript": "5.9.3",
|
|
21
|
+
"typescript-eslint": "^8.56.1"
|
|
30
22
|
},
|
|
31
23
|
"dependencies": {
|
|
32
|
-
"zod": "
|
|
24
|
+
"zod": "^4.3.6"
|
|
33
25
|
},
|
|
34
26
|
"exports": {
|
|
35
|
-
"
|
|
36
|
-
"types": "./dist
|
|
37
|
-
"xema-source": "./src
|
|
38
|
-
"default": "./dist
|
|
39
|
-
},
|
|
40
|
-
"./agent-workspace": {
|
|
41
|
-
"types": "./dist/agent-workspace/index.d.ts",
|
|
42
|
-
"xema-source": "./src/agent-workspace/index.ts",
|
|
43
|
-
"default": "./dist/agent-workspace/index.js"
|
|
44
|
-
},
|
|
45
|
-
"./biome": {
|
|
46
|
-
"types": "./dist/biome/index.d.ts",
|
|
47
|
-
"xema-source": "./src/biome/index.ts",
|
|
48
|
-
"default": "./dist/biome/index.js"
|
|
49
|
-
},
|
|
50
|
-
"./capability": {
|
|
51
|
-
"types": "./dist/capability/index.d.ts",
|
|
52
|
-
"xema-source": "./src/capability/index.ts",
|
|
53
|
-
"default": "./dist/capability/index.js"
|
|
54
|
-
},
|
|
55
|
-
"./contribution": {
|
|
56
|
-
"types": "./dist/contribution/index.d.ts",
|
|
57
|
-
"xema-source": "./src/contribution/index.ts",
|
|
58
|
-
"default": "./dist/contribution/index.js"
|
|
59
|
-
},
|
|
60
|
-
"./document-templates": {
|
|
61
|
-
"types": "./dist/document-templates/index.d.ts",
|
|
62
|
-
"xema-source": "./src/document-templates/index.ts",
|
|
63
|
-
"default": "./dist/document-templates/index.js"
|
|
64
|
-
},
|
|
65
|
-
"./document-themes": {
|
|
66
|
-
"types": "./dist/document-themes/index.d.ts",
|
|
67
|
-
"xema-source": "./src/document-themes/index.ts",
|
|
68
|
-
"default": "./dist/document-themes/index.js"
|
|
69
|
-
},
|
|
70
|
-
"./entitlement": {
|
|
71
|
-
"types": "./dist/entitlement/index.d.ts",
|
|
72
|
-
"xema-source": "./src/entitlement/index.ts",
|
|
73
|
-
"default": "./dist/entitlement/index.js"
|
|
74
|
-
},
|
|
75
|
-
"./execution-context": {
|
|
76
|
-
"types": "./dist/execution-context/index.d.ts",
|
|
77
|
-
"xema-source": "./src/execution-context/index.ts",
|
|
78
|
-
"default": "./dist/execution-context/index.js"
|
|
79
|
-
},
|
|
80
|
-
"./execution-environment": {
|
|
81
|
-
"types": "./dist/execution-environment/index.d.ts",
|
|
82
|
-
"xema-source": "./src/execution-environment/index.ts",
|
|
83
|
-
"default": "./dist/execution-environment/index.js"
|
|
84
|
-
},
|
|
85
|
-
"./kernel-state": {
|
|
86
|
-
"types": "./dist/kernel-state/index.d.ts",
|
|
87
|
-
"xema-source": "./src/kernel-state/index.ts",
|
|
88
|
-
"default": "./dist/kernel-state/index.js"
|
|
89
|
-
},
|
|
90
|
-
"./llm-gateway": {
|
|
91
|
-
"types": "./dist/llm-gateway/index.d.ts",
|
|
92
|
-
"xema-source": "./src/llm-gateway/index.ts",
|
|
93
|
-
"default": "./dist/llm-gateway/index.js"
|
|
94
|
-
},
|
|
95
|
-
"./mcp-tool": {
|
|
96
|
-
"types": "./dist/mcp-tool/index.d.ts",
|
|
97
|
-
"xema-source": "./src/mcp-tool/index.ts",
|
|
98
|
-
"default": "./dist/mcp-tool/index.js"
|
|
99
|
-
},
|
|
100
|
-
"./object": {
|
|
101
|
-
"types": "./dist/object/index.d.ts",
|
|
102
|
-
"xema-source": "./src/object/index.ts",
|
|
103
|
-
"default": "./dist/object/index.js"
|
|
104
|
-
},
|
|
105
|
-
"./policy": {
|
|
106
|
-
"types": "./dist/policy/index.d.ts",
|
|
107
|
-
"xema-source": "./src/policy/index.ts",
|
|
108
|
-
"default": "./dist/policy/index.js"
|
|
109
|
-
},
|
|
110
|
-
"./runner": {
|
|
111
|
-
"types": "./dist/runner/index.d.ts",
|
|
112
|
-
"xema-source": "./src/runner/index.ts",
|
|
113
|
-
"default": "./dist/runner/index.js"
|
|
114
|
-
},
|
|
115
|
-
"./search-source": {
|
|
116
|
-
"types": "./dist/search-source/index.d.ts",
|
|
117
|
-
"xema-source": "./src/search-source/index.ts",
|
|
118
|
-
"default": "./dist/search-source/index.js"
|
|
119
|
-
},
|
|
120
|
-
"./service-registry": {
|
|
121
|
-
"types": "./dist/service-registry/index.d.ts",
|
|
122
|
-
"xema-source": "./src/service-registry/index.ts",
|
|
123
|
-
"default": "./dist/service-registry/index.js"
|
|
124
|
-
},
|
|
125
|
-
"./skill": {
|
|
126
|
-
"types": "./dist/skill/index.d.ts",
|
|
127
|
-
"xema-source": "./src/skill/index.ts",
|
|
128
|
-
"default": "./dist/skill/index.js"
|
|
129
|
-
},
|
|
130
|
-
"./space": {
|
|
131
|
-
"types": "./dist/space/index.d.ts",
|
|
132
|
-
"xema-source": "./src/space/index.ts",
|
|
133
|
-
"default": "./dist/space/index.js"
|
|
134
|
-
},
|
|
135
|
-
"./subject": {
|
|
136
|
-
"types": "./dist/subject/index.d.ts",
|
|
137
|
-
"xema-source": "./src/subject/index.ts",
|
|
138
|
-
"default": "./dist/subject/index.js"
|
|
139
|
-
},
|
|
140
|
-
"./workflow": {
|
|
141
|
-
"types": "./dist/workflow/index.d.ts",
|
|
142
|
-
"xema-source": "./src/workflow/index.ts",
|
|
143
|
-
"default": "./dist/workflow/index.js"
|
|
27
|
+
"./*": {
|
|
28
|
+
"types": "./dist/*/index.d.ts",
|
|
29
|
+
"xema-source": "./src/*/index.ts",
|
|
30
|
+
"default": "./dist/*/index.js"
|
|
144
31
|
},
|
|
145
32
|
"./package.json": "./package.json"
|
|
146
33
|
},
|
|
147
|
-
"
|
|
148
|
-
"
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
"document-templates": ["dist/document-templates/index.d.ts"],
|
|
155
|
-
"document-themes": ["dist/document-themes/index.d.ts"],
|
|
156
|
-
"entitlement": ["dist/entitlement/index.d.ts"],
|
|
157
|
-
"execution-context": ["dist/execution-context/index.d.ts"],
|
|
158
|
-
"execution-environment": ["dist/execution-environment/index.d.ts"],
|
|
159
|
-
"kernel-state": ["dist/kernel-state/index.d.ts"],
|
|
160
|
-
"llm-gateway": ["dist/llm-gateway/index.d.ts"],
|
|
161
|
-
"mcp-tool": ["dist/mcp-tool/index.d.ts"],
|
|
162
|
-
"object": ["dist/object/index.d.ts"],
|
|
163
|
-
"policy": ["dist/policy/index.d.ts"],
|
|
164
|
-
"runner": ["dist/runner/index.d.ts"],
|
|
165
|
-
"search-source": ["dist/search-source/index.d.ts"],
|
|
166
|
-
"service-registry": ["dist/service-registry/index.d.ts"],
|
|
167
|
-
"skill": ["dist/skill/index.d.ts"],
|
|
168
|
-
"space": ["dist/space/index.d.ts"],
|
|
169
|
-
"subject": ["dist/subject/index.d.ts"],
|
|
170
|
-
"workflow": ["dist/workflow/index.d.ts"]
|
|
171
|
-
}
|
|
34
|
+
"scripts": {
|
|
35
|
+
"clean": "rm -rf dist",
|
|
36
|
+
"build": "tsc -p tsconfig.json && node scripts/emit-awp-spec.mjs",
|
|
37
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
38
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
39
|
+
"lint": "eslint .",
|
|
40
|
+
"check:boundary": "node scripts/check-subpath-dag.mjs"
|
|
172
41
|
}
|
|
173
|
-
}
|
|
42
|
+
}
|
|
@@ -127,7 +127,7 @@ export interface CompositionAgentRunConfig {
|
|
|
127
127
|
*
|
|
128
128
|
* `mounts` / `seedFiles` / `inputs` carry the manifest DSL's RAW spec
|
|
129
129
|
* fragment shapes verbatim. They are typed loosely here (`unknown`
|
|
130
|
-
* values) on purpose: the manifest DSL (`@xemahq/workspace-manifest
|
|
130
|
+
* values) on purpose: the manifest DSL (`@xemahq/dsl/workspace-manifest`)
|
|
131
131
|
* is a runtime package (Zod, js-yaml) and this kernel contract package
|
|
132
132
|
* is dependency-free; the consuming workspace pipeline re-validates the
|
|
133
133
|
* fragments with the DSL's `WorkspaceManifestSchema` when it
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
2
|
+
// @xemahq/agent-tool-inquiry-contracts — Kernel layer
|
|
3
|
+
//
|
|
4
|
+
// Abstract types for the AGENT_TOOL_INQUIRY InquiryKind: any tool inside
|
|
5
|
+
// an active agent session that needs external input ("pause this turn,
|
|
6
|
+
// ask a recipient, resume on reply") uses these contracts.
|
|
7
|
+
//
|
|
8
|
+
// `toolName` is a free-form string — the Kernel does NOT enumerate tool
|
|
9
|
+
// names. Today's only consumer is the agent runtime's native `question`
|
|
10
|
+
// tool; future custom tools register into the Platform runtime adapter
|
|
11
|
+
// without changes to this package.
|
|
12
|
+
//
|
|
13
|
+
// Pure types + Zod. Zero runtime adapter knowledge.
|
|
14
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
15
|
+
|
|
16
|
+
export * from './lib/agent-tool-inquiry';
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Identity of the agent session that initiated the tool inquiry. Used by
|
|
5
|
+
* the Platform runtime adapter to route the reply back into the right
|
|
6
|
+
* session when the inquiry resolves. Opaque from this Kernel package's
|
|
7
|
+
* perspective — the adapter knows how to interpret the fields.
|
|
8
|
+
*/
|
|
9
|
+
export const AgentSessionRefSchema = z.object({
|
|
10
|
+
sessionExecutorId: z.string().min(1),
|
|
11
|
+
allocationId: z.string().min(1),
|
|
12
|
+
/**
|
|
13
|
+
* Tool-request id supplied by the runtime adapter on the pause event.
|
|
14
|
+
* The adapter uses this to identify which tool invocation is waiting
|
|
15
|
+
* for a reply when multiple tools pause concurrently in one session.
|
|
16
|
+
*/
|
|
17
|
+
toolRequestId: z.string().min(1),
|
|
18
|
+
});
|
|
19
|
+
export type AgentSessionRef = z.infer<typeof AgentSessionRefSchema>;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Optional structured-answer constraints. When `kind === 'choice'`, the
|
|
23
|
+
* recipient picks from `choices`. When `kind === 'json'`, the reply must
|
|
24
|
+
* conform to `jsonSchema`. When omitted, the reply is free text. The
|
|
25
|
+
* adapter is responsible for translating the recipient's answer back to
|
|
26
|
+
* the tool's expected wire shape.
|
|
27
|
+
*/
|
|
28
|
+
export const AnswerSchemaSchema = z.discriminatedUnion('kind', [
|
|
29
|
+
z.object({ kind: z.literal('free_text') }),
|
|
30
|
+
z.object({
|
|
31
|
+
kind: z.literal('choice'),
|
|
32
|
+
choices: z.array(z.string().min(1)).min(1),
|
|
33
|
+
}),
|
|
34
|
+
z.object({
|
|
35
|
+
kind: z.literal('json'),
|
|
36
|
+
jsonSchema: z.record(z.string(), z.unknown()),
|
|
37
|
+
}),
|
|
38
|
+
]);
|
|
39
|
+
export type AnswerSchema = z.infer<typeof AnswerSchemaSchema>;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Prompt payload for an AGENT_TOOL_INQUIRY. The runtime-adapter-facing
|
|
43
|
+
* fields (`agentSessionRef`) are present alongside the human-facing
|
|
44
|
+
* fields (`promptText`, `answerSchema`) so the Tasks UI and the adapter
|
|
45
|
+
* read from the same row.
|
|
46
|
+
*
|
|
47
|
+
* `toolName` is free-form — `'question'` today, extensible to anything
|
|
48
|
+
* tomorrow. The Kernel does not enumerate tool names.
|
|
49
|
+
*/
|
|
50
|
+
export const AgentToolInquiryPromptSchema = z.object({
|
|
51
|
+
toolName: z.string().min(1),
|
|
52
|
+
agentSlug: z.string().min(1),
|
|
53
|
+
agentSessionRef: AgentSessionRefSchema,
|
|
54
|
+
promptText: z.string(),
|
|
55
|
+
answerSchema: AnswerSchemaSchema.optional(),
|
|
56
|
+
/**
|
|
57
|
+
* Optional context blurb the adapter / agent supplies to help the
|
|
58
|
+
* recipient understand what's being asked (e.g. the last few agent
|
|
59
|
+
* actions, the surrounding job's purpose). Plain text; UI renders as
|
|
60
|
+
* markdown.
|
|
61
|
+
*/
|
|
62
|
+
contextSummary: z.string().optional(),
|
|
63
|
+
});
|
|
64
|
+
export type AgentToolInquiryPrompt = z.infer<
|
|
65
|
+
typeof AgentToolInquiryPromptSchema
|
|
66
|
+
>;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Reply payload submitted by a recipient. The Kernel keeps the shape
|
|
70
|
+
* abstract: `replyPayload` is unknown to this package — only the runtime
|
|
71
|
+
* adapter interprets it back into a tool-specific shape.
|
|
72
|
+
*
|
|
73
|
+
* For today's `question` tool routed through the Platform runtime
|
|
74
|
+
* adapter, `replyPayload` matches the adapter's tool-reply wire shape.
|
|
75
|
+
* The adapter declares this binding internally; the Kernel does not.
|
|
76
|
+
*/
|
|
77
|
+
export const AgentToolInquiryReplySchema = z.object({
|
|
78
|
+
replyPayload: z.unknown(),
|
|
79
|
+
});
|
|
80
|
+
export type AgentToolInquiryReply = z.infer<
|
|
81
|
+
typeof AgentToolInquiryReplySchema
|
|
82
|
+
>;
|
|
@@ -154,7 +154,7 @@ export interface SlotDefinition {
|
|
|
154
154
|
* without re-resolving the composition.
|
|
155
155
|
*
|
|
156
156
|
* Replaces the equivalent `persistence` block carried by the legacy
|
|
157
|
-
* `WorkspaceManifest` (`ManifestPersistence` in `@xemahq/workspace-manifest
|
|
157
|
+
* `WorkspaceManifest` (`ManifestPersistence` in `@xemahq/dsl/workspace-manifest`).
|
|
158
158
|
*/
|
|
159
159
|
export interface WorkspacePersistenceSpec {
|
|
160
160
|
/** Workspace-relative paths. No leading `/`, no `..`. */
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './lib/biome-install';
|
|
2
|
+
export * from './lib/audience-policy';
|
|
3
|
+
export * from './lib/external-subject';
|
|
4
|
+
export * from './lib/delegated-session';
|
|
5
|
+
export * from './lib/app-client';
|
|
6
|
+
export * from './lib/app-lockfile';
|
|
7
|
+
export * from './lib/branding-config';
|
|
8
|
+
export * from './lib/app';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `AppClient` — a client credential issued to an App for minting delegated
|
|
5
|
+
* session tokens against `app-runtime-api` (plan §5.2 / §5.3). One App may
|
|
6
|
+
* have many AppClients (e.g. distinct embed targets, distinct OIDC
|
|
7
|
+
* upstreams). The `clientSecretHash` is the verifier the runtime stores;
|
|
8
|
+
* the raw secret is returned ONCE at issue time and never persisted.
|
|
9
|
+
*
|
|
10
|
+
* `redirectUris` is the OAuth-style allow-list used by upstream auth flows;
|
|
11
|
+
* each entry MUST be a non-empty URL. Unknown / empty entries are rejected
|
|
12
|
+
* at schema parse time rather than silently coerced.
|
|
13
|
+
*/
|
|
14
|
+
export interface AppClient {
|
|
15
|
+
id: string;
|
|
16
|
+
appId: string;
|
|
17
|
+
clientSecretHash?: string;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
displayName?: string;
|
|
20
|
+
redirectUris?: string[];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const AppClientSchema = z.object({
|
|
24
|
+
id: z.string().min(1, {
|
|
25
|
+
message: 'AppClient.id must be a non-empty client identifier.',
|
|
26
|
+
}),
|
|
27
|
+
appId: z.string().min(1, {
|
|
28
|
+
message: 'AppClient.appId must be a non-empty App identifier.',
|
|
29
|
+
}),
|
|
30
|
+
clientSecretHash: z.string().min(1).optional(),
|
|
31
|
+
createdAt: z.string().datetime({
|
|
32
|
+
message:
|
|
33
|
+
'AppClient.createdAt must be a strict ISO-8601 datetime string.',
|
|
34
|
+
}),
|
|
35
|
+
displayName: z.string().min(1).optional(),
|
|
36
|
+
redirectUris: z
|
|
37
|
+
.array(
|
|
38
|
+
z.string().url({
|
|
39
|
+
message:
|
|
40
|
+
'AppClient.redirectUris[] entries must be valid URLs (non-empty).',
|
|
41
|
+
}),
|
|
42
|
+
)
|
|
43
|
+
.optional(),
|
|
44
|
+
}) as z.ZodType<AppClient>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `AppLockfile` — the pinned resolution emitted at every invocation
|
|
5
|
+
* boundary that involves an App (workflow run start, interactive session
|
|
6
|
+
* start, agent sub-agent spawn, app deploy) per plan §10.4. Guarantees
|
|
7
|
+
* reproducibility without forcing users to manage versions by hand.
|
|
8
|
+
*
|
|
9
|
+
* Wire shape:
|
|
10
|
+
*
|
|
11
|
+
* ```json
|
|
12
|
+
* {
|
|
13
|
+
* "kernel": "1.0.0",
|
|
14
|
+
* "capabilities": { "kb:page.read": "1", "workflow:run.start": "1" },
|
|
15
|
+
* "biomes": { "xema.document-buddy": "1.4.2", "xema.software-dev": "1.5.0" },
|
|
16
|
+
* "agents": { "code-reviewer": "3.0.0", "presenter-coach": "1.2.0" },
|
|
17
|
+
* "workflows": { "product-development": "7.0.0" },
|
|
18
|
+
* "deliverableSpecs": { "architecture-doc": "2.1.0" },
|
|
19
|
+
* "skills": { "doc-editor": "1.0.4" }
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* - `kernel` is the resolved `@xemahq/kernel` major.minor.patch (semver).
|
|
24
|
+
* - `capabilities` maps each `CapabilityRef` (sans `@major`) to the chosen
|
|
25
|
+
* `<major>` string per plan §10.2 (capabilities version like syscalls).
|
|
26
|
+
* - The remaining maps key a logical slug → the chosen published semver of
|
|
27
|
+
* that object. Slugs are NOT typed as `XemaObjectRef` here on purpose:
|
|
28
|
+
* the lockfile is meant to round-trip as plain JSON for replay; the
|
|
29
|
+
* owning resolver is responsible for re-hydrating refs from `(scope,
|
|
30
|
+
* slug, version)` at consumption time.
|
|
31
|
+
*/
|
|
32
|
+
export interface AppLockfile {
|
|
33
|
+
kernel: string;
|
|
34
|
+
capabilities: Record<string, string>;
|
|
35
|
+
biomes: Record<string, string>;
|
|
36
|
+
agents?: Record<string, string>;
|
|
37
|
+
workflows?: Record<string, string>;
|
|
38
|
+
deliverableSpecs?: Record<string, string>;
|
|
39
|
+
skills?: Record<string, string>;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const NonEmptyStringRecordSchema = z.record(z.string().min(1), z.string().min(1));
|
|
43
|
+
|
|
44
|
+
export const AppLockfileSchema = z.object({
|
|
45
|
+
kernel: z.string().min(1, {
|
|
46
|
+
message: 'AppLockfile.kernel must be a non-empty semver string.',
|
|
47
|
+
}),
|
|
48
|
+
capabilities: NonEmptyStringRecordSchema,
|
|
49
|
+
biomes: NonEmptyStringRecordSchema,
|
|
50
|
+
agents: NonEmptyStringRecordSchema.optional(),
|
|
51
|
+
workflows: NonEmptyStringRecordSchema.optional(),
|
|
52
|
+
deliverableSpecs: NonEmptyStringRecordSchema.optional(),
|
|
53
|
+
skills: NonEmptyStringRecordSchema.optional(),
|
|
54
|
+
}) as z.ZodType<AppLockfile>;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import {
|
|
3
|
+
CapabilityRefSchema,
|
|
4
|
+
type CapabilityRef,
|
|
5
|
+
} from '../../capability';
|
|
6
|
+
import {
|
|
7
|
+
ExecutionEnvironmentRefSchema,
|
|
8
|
+
type ExecutionEnvironmentRef,
|
|
9
|
+
} from '../../execution-environment';
|
|
10
|
+
import {
|
|
11
|
+
XemaObjectRefSchema,
|
|
12
|
+
type XemaObjectRef,
|
|
13
|
+
} from '../../object';
|
|
14
|
+
import { BiomeInstallSchema, type BiomeInstall } from './biome-install';
|
|
15
|
+
import { AudiencePolicySchema, type AudiencePolicy } from './audience-policy';
|
|
16
|
+
import { BrandingConfigSchema, type BrandingConfig } from './branding-config';
|
|
17
|
+
import { AppLockfileSchema, type AppLockfile } from './app-lockfile';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Per-App tightening on top of the base `CapabilityPolicy` carried by an
|
|
21
|
+
* `ExecutionEnvironment` (plan §5.1: `App.capabilityPolicy`). An override may
|
|
22
|
+
* narrow the allowed resource set, narrow the allowed zones, or impose an
|
|
23
|
+
* App-level rate cap on a specific capability — it may never WIDEN. The
|
|
24
|
+
* intersect-only enforcement lands in `xema-capability-router` (Phase 3 /
|
|
25
|
+
* Phase 7); this contract carries the declared shape only.
|
|
26
|
+
*/
|
|
27
|
+
export interface CapabilityPolicyOverride {
|
|
28
|
+
capability: CapabilityRef;
|
|
29
|
+
allowedResources?: readonly string[];
|
|
30
|
+
allowedEnvironments?: readonly ExecutionEnvironmentRef[];
|
|
31
|
+
rateLimit?: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const CapabilityPolicyOverrideSchema = z.object({
|
|
35
|
+
capability: CapabilityRefSchema,
|
|
36
|
+
allowedResources: z.array(z.string().min(1)).readonly().optional(),
|
|
37
|
+
allowedEnvironments: z.array(ExecutionEnvironmentRefSchema).readonly().optional(),
|
|
38
|
+
rateLimit: z.number().int().positive().optional(),
|
|
39
|
+
}) as z.ZodType<CapabilityPolicyOverride>;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* `App` — the top-level `XemaObjectKind.App` envelope (plan §5.1). An
|
|
43
|
+
* `(Org, Project, [Biome@version])` tuple plus configuration, branding,
|
|
44
|
+
* capability policy, audience policy, and the lockfile pin emitted at
|
|
45
|
+
* deploy time. Multiple Apps may share the same biomes; the same biome may
|
|
46
|
+
* be installed in many Apps with different audiences and zones.
|
|
47
|
+
*
|
|
48
|
+
* Invariants enforced at parse time:
|
|
49
|
+
*
|
|
50
|
+
* - `installedBiomes` MUST be non-empty — an App with zero biomes has no
|
|
51
|
+
* capability surface, so this is a fail-fast policy bug.
|
|
52
|
+
* - `audiences` MUST be non-empty — an App with zero audiences is
|
|
53
|
+
* unreachable; declare at least one (e.g. `InternalOrg`) explicitly.
|
|
54
|
+
* - `defaultZone` and `lockfile` are REQUIRED (no implicit default environment,
|
|
55
|
+
* no "best-effort" un-pinned execution).
|
|
56
|
+
*
|
|
57
|
+
* Per-App tightening on top of a environment's `CapabilityPolicy` is carried by
|
|
58
|
+
* `capabilityPolicy` (intersect-only at the gateway, never widen).
|
|
59
|
+
*/
|
|
60
|
+
export interface App {
|
|
61
|
+
ref: XemaObjectRef;
|
|
62
|
+
installedBiomes: BiomeInstall[];
|
|
63
|
+
defaultZone: ExecutionEnvironmentRef;
|
|
64
|
+
audiences: AudiencePolicy[];
|
|
65
|
+
capabilityPolicy: CapabilityPolicyOverride[];
|
|
66
|
+
branding: BrandingConfig;
|
|
67
|
+
lockfile: AppLockfile;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export const AppSchema = z.object({
|
|
71
|
+
ref: XemaObjectRefSchema,
|
|
72
|
+
installedBiomes: z.array(BiomeInstallSchema).min(1, {
|
|
73
|
+
message:
|
|
74
|
+
'App.installedBiomes must contain at least one BiomeInstall; an App with zero biomes has no capability surface.',
|
|
75
|
+
}),
|
|
76
|
+
defaultZone: ExecutionEnvironmentRefSchema,
|
|
77
|
+
audiences: z.array(AudiencePolicySchema).min(1, {
|
|
78
|
+
message:
|
|
79
|
+
'App.audiences must contain at least one AudiencePolicy; an App with zero audiences is unreachable.',
|
|
80
|
+
}),
|
|
81
|
+
capabilityPolicy: z.array(CapabilityPolicyOverrideSchema),
|
|
82
|
+
branding: BrandingConfigSchema,
|
|
83
|
+
lockfile: AppLockfileSchema,
|
|
84
|
+
}) as z.ZodType<App>;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import {
|
|
3
|
+
ExecutionEnvironmentRefSchema,
|
|
4
|
+
type ExecutionEnvironmentRef,
|
|
5
|
+
} from '../../execution-environment';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Closed set of audience kinds an App may expose (plan §5.2):
|
|
9
|
+
*
|
|
10
|
+
* - `InternalOrg` — Xema-identity users with project membership.
|
|
11
|
+
* - `ExternalSubject` — non-Xema subjects authenticated by the app's
|
|
12
|
+
* own upstream (OIDC, magic-link, anon); Xema mints a delegated
|
|
13
|
+
* session token (`sub` = external subject, `act` = app client).
|
|
14
|
+
* - `PublicAnon` — anonymous sessions, tightly capability-constrained
|
|
15
|
+
* (e.g. read-only KB on a marketing-FAQ chatbot).
|
|
16
|
+
*
|
|
17
|
+
* Values are stable wire strings — never compare against a free-form string.
|
|
18
|
+
*/
|
|
19
|
+
export enum AudienceKind {
|
|
20
|
+
InternalOrg = 'internal-org',
|
|
21
|
+
ExternalSubject = 'external-subject',
|
|
22
|
+
PublicAnon = 'public-anon',
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const AudienceKindSchema = z.nativeEnum(AudienceKind);
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Closed set of upstream-auth types an `ExternalSubject` audience may use.
|
|
29
|
+
* `anon` is intentionally distinct from `PublicAnon` at the `AudienceKind`
|
|
30
|
+
* level: a `PublicAnon` audience MAY use the same `anon` upstream marker
|
|
31
|
+
* here for symmetry, but the policy choice is made at the audience kind.
|
|
32
|
+
*/
|
|
33
|
+
export enum AudienceUpstreamType {
|
|
34
|
+
Oidc = 'oidc',
|
|
35
|
+
MagicLink = 'magic-link',
|
|
36
|
+
Anon = 'anon',
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const AudienceUpstreamTypeSchema = z.nativeEnum(AudienceUpstreamType);
|
|
40
|
+
|
|
41
|
+
export interface AudienceUpstream {
|
|
42
|
+
type: AudienceUpstreamType;
|
|
43
|
+
metadata?: Record<string, unknown>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const AudienceUpstreamSchema = z.object({
|
|
47
|
+
type: AudienceUpstreamTypeSchema,
|
|
48
|
+
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
49
|
+
}) as z.ZodType<AudienceUpstream>;
|
|
50
|
+
|
|
51
|
+
export interface AudienceRateLimit {
|
|
52
|
+
perHourPerSubject?: number;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const AudienceRateLimitSchema = z.object({
|
|
56
|
+
perHourPerSubject: z.number().int().positive().optional(),
|
|
57
|
+
}) as z.ZodType<AudienceRateLimit>;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* `AudiencePolicy` — one row in `App.audiences[]` (plan §5.2). Declares
|
|
61
|
+
* which audience kind the app exposes, which execution zones that audience
|
|
62
|
+
* may invoke, the upstream-auth marker the app uses for non-Xema subjects,
|
|
63
|
+
* and an optional per-subject rate cap.
|
|
64
|
+
*
|
|
65
|
+
* `allowedEnvironments` is REQUIRED and non-empty: an audience with no zones is a
|
|
66
|
+
* policy bug — fail-fast at schema parse time rather than silently denying
|
|
67
|
+
* every call at the gateway.
|
|
68
|
+
*/
|
|
69
|
+
export interface AudiencePolicy {
|
|
70
|
+
kind: AudienceKind;
|
|
71
|
+
allowedEnvironments: readonly ExecutionEnvironmentRef[];
|
|
72
|
+
authUpstream?: AudienceUpstream;
|
|
73
|
+
rateLimit?: AudienceRateLimit;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export const AudiencePolicySchema = z.object({
|
|
77
|
+
kind: AudienceKindSchema,
|
|
78
|
+
allowedEnvironments: z
|
|
79
|
+
.array(ExecutionEnvironmentRefSchema)
|
|
80
|
+
.min(1, {
|
|
81
|
+
message:
|
|
82
|
+
'AudiencePolicy.allowedEnvironments must contain at least one ExecutionEnvironmentRef; an audience with zero zones is a policy bug.',
|
|
83
|
+
})
|
|
84
|
+
.readonly(),
|
|
85
|
+
authUpstream: AudienceUpstreamSchema.optional(),
|
|
86
|
+
rateLimit: AudienceRateLimitSchema.optional(),
|
|
87
|
+
}) as z.ZodType<AudiencePolicy>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { XemaObjectRefSchema, type XemaObjectRef } from '../../object';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* One entry in an App's `installedBiomes[]` (plan §5.1). Binds a biome
|
|
6
|
+
* reference to a version constraint (semver-range string, §10.3 grammar:
|
|
7
|
+
* `^1.2.0` / `~1.2.0` / `1.2.0` / `latest-compatible`) plus free-form
|
|
8
|
+
* per-install configuration the biome consumes at boot.
|
|
9
|
+
*
|
|
10
|
+
* The version constraint is intentionally typed as a non-empty `string`:
|
|
11
|
+
* the constraint grammar is a runtime concern of `app-runtime-api` /
|
|
12
|
+
* `xema-store-api` (it expands during lockfile resolution per §10.4), not a
|
|
13
|
+
* compile-time refinement. The lockfile (`AppLockfile`) carries the pinned
|
|
14
|
+
* resolution alongside.
|
|
15
|
+
*/
|
|
16
|
+
export interface BiomeInstall {
|
|
17
|
+
biomeRef: XemaObjectRef;
|
|
18
|
+
versionConstraint: string;
|
|
19
|
+
configuration?: Record<string, unknown>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const BiomeInstallSchema = z.object({
|
|
23
|
+
biomeRef: XemaObjectRefSchema,
|
|
24
|
+
versionConstraint: z.string().min(1, {
|
|
25
|
+
message:
|
|
26
|
+
'BiomeInstall.versionConstraint must be a non-empty semver-range string (e.g. `^1.2.0`, `1.2.0`, `latest-compatible`).',
|
|
27
|
+
}),
|
|
28
|
+
configuration: z.record(z.string(), z.unknown()).optional(),
|
|
29
|
+
}) as z.ZodType<BiomeInstall>;
|