@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
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
2
|
+
// Project Kit — attachable, installable units for interactive sessions.
|
|
3
|
+
//
|
|
4
|
+
// A "project kit" is a named, typed, reusable unit that, when attached to a
|
|
5
|
+
// project, gets INSTALLED INTO that project's repo/workspace when an
|
|
6
|
+
// interactive session starts. Unlike a workspace mount (platform-side,
|
|
7
|
+
// ephemeral), a kit is a DURABLE mutation the project carries forward on its
|
|
8
|
+
// own — e.g. an npm dependency that lands in `package.json` + lockfile and is
|
|
9
|
+
// committed, so cloning the repo later and running `npm install` reproduces it.
|
|
10
|
+
//
|
|
11
|
+
// Pure types + enums, zero domain knowledge and zero runtime deps. The catalog
|
|
12
|
+
// lives in `llm-registry-api`; the per-session binding rides `customConfig`;
|
|
13
|
+
// the npm-specific install is the agent-session-api `provision` phase's job
|
|
14
|
+
// (a guard-gated EQUIP step synthesized per kit). This contract only knows
|
|
15
|
+
// the closed shape of a kit, not how any one session type applies it.
|
|
16
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* HOW a project kit is installed into the target project. Closed,
|
|
20
|
+
* platform-owned set.
|
|
21
|
+
*
|
|
22
|
+
* `NpmDependency` installs a package (registry or git source) — the produced
|
|
23
|
+
* file mutation is a `dependencies` entry in `package.json` + lockfile.
|
|
24
|
+
*
|
|
25
|
+
* `ShadcnRegistry` is a codegen-style install: the shadcn CLI copies component
|
|
26
|
+
* SOURCE FILES into the project (typically `src/components/ui/<name>.tsx`)
|
|
27
|
+
* plus a `components.json` config and small `lib/utils.ts` helper. Resulting
|
|
28
|
+
* components ARE the project's own code — they are not imported from a library.
|
|
29
|
+
* Distinct from `NpmDependency` because the install mechanism (`npx shadcn
|
|
30
|
+
* init` + `add`), the produced file shape, and the agent's mental model are
|
|
31
|
+
* fundamentally different. The two are mutually exclusive per project.
|
|
32
|
+
*
|
|
33
|
+
* `FileTree` and `CodeSnippet` remain reserved — adding either is a deliberate
|
|
34
|
+
* platform change (a new applicator interpretation in the consuming session
|
|
35
|
+
* type), not a biome extension. The enum stays the single seam.
|
|
36
|
+
*/
|
|
37
|
+
export enum ProjectKitKind {
|
|
38
|
+
/** An npm package added to a project's `package.json` (registry or git source). */
|
|
39
|
+
NpmDependency = 'npm-dependency',
|
|
40
|
+
/** A shadcn-style codegen kit: CLI copies component source files into the repo. */
|
|
41
|
+
ShadcnRegistry = 'shadcn-registry',
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* WHAT a kit is, from the code-producing agent's point of view. Drives
|
|
46
|
+
* whether the agent receives an enrichment skill.
|
|
47
|
+
*
|
|
48
|
+
* `ComponentLibrary` is a "known concept" — the agent should build WITH it,
|
|
49
|
+
* so the kit carries an `enrichmentSkillSlug`. `GenericDependency` is a plain
|
|
50
|
+
* library the agent simply sees in `package.json`; no extra instruction.
|
|
51
|
+
*/
|
|
52
|
+
export enum ProjectKitPurpose {
|
|
53
|
+
ComponentLibrary = 'component-library',
|
|
54
|
+
GenericDependency = 'generic-dependency',
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Where a kit's payload comes from. The semantics depend on the kit kind:
|
|
59
|
+
*
|
|
60
|
+
* - For `NpmDependency` kits: `NpmRegistry` resolves a `package@versionRange`
|
|
61
|
+
* against an npm registry; `Git` resolves `git+<url>#<ref>` directly.
|
|
62
|
+
* - For `ShadcnRegistry` kits: `ShadcnRegistry` carries the shadcn-CLI config
|
|
63
|
+
* (style, baseColor, components list, optional custom registry URLs).
|
|
64
|
+
*
|
|
65
|
+
* Cross-kind sources are rejected by the resolver — e.g. an `NpmDependency`
|
|
66
|
+
* kit cannot carry a `ShadcnRegistry` source, and vice versa. This is enforced
|
|
67
|
+
* at parse time, not at install time, so the failure is loud.
|
|
68
|
+
*/
|
|
69
|
+
export enum ProjectKitSourceKind {
|
|
70
|
+
/** Resolved from an npm registry (the public registry, or a scoped private one). */
|
|
71
|
+
NpmRegistry = 'npm-registry',
|
|
72
|
+
/** Resolved directly from a git repository (`npm install git+https://…#ref`). */
|
|
73
|
+
Git = 'git',
|
|
74
|
+
/** A shadcn-CLI config: registry URL, baseline component list, style + theme. */
|
|
75
|
+
ShadcnRegistry = 'shadcn-registry',
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Tier of visibility for a kit and the registry namespace it pulls from. Carried on
|
|
80
|
+
* every `ResolvedProjectKit` so the install path can enforce tenant isolation
|
|
81
|
+
* at the wire layer (System / System-shareable / Org tiers in our hosted npm
|
|
82
|
+
* + container registries) and the FE can render the right badge.
|
|
83
|
+
*
|
|
84
|
+
* Precedence:
|
|
85
|
+
* `System` — only the platform writes AND reads (kernel-internal kits).
|
|
86
|
+
* Never selectable by org users; rejected by the catalog
|
|
87
|
+
* endpoint unless the caller has the platform role.
|
|
88
|
+
* `SystemShareable` — only the platform writes; ANY org reads. Curated kits
|
|
89
|
+
* shipped by Xema (`xema-component-library`, future
|
|
90
|
+
* `@xema/shadcn-presets`). Anonymous-read on our registries.
|
|
91
|
+
* `Org` — the org owns push + pull. Custom kits that point at a
|
|
92
|
+
* private package or git repo bound to the caller's org.
|
|
93
|
+
* Cross-org reads structurally impossible (JWT `x_org_id`
|
|
94
|
+
* scope at the registry layer).
|
|
95
|
+
* `External` — registries the platform does not host. ACLs are
|
|
96
|
+
* whatever the external system enforces (npmjs public,
|
|
97
|
+
* GH Packages private, etc.). Token resolution rides
|
|
98
|
+
* the existing wallet model.
|
|
99
|
+
*
|
|
100
|
+
* The order in the enum reflects "most platform-restricted" → "least platform-
|
|
101
|
+
* controlled" — useful for sorting in the catalog UI.
|
|
102
|
+
*/
|
|
103
|
+
export enum RegistryVisibilityTier {
|
|
104
|
+
System = 'system',
|
|
105
|
+
SystemShareable = 'system-shareable',
|
|
106
|
+
Org = 'org',
|
|
107
|
+
External = 'external',
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Auth for a private kit source. The token itself is NEVER stored on the kit
|
|
112
|
+
* — it lives in a wallet. At session start the bootstrap resolves `walletName`
|
|
113
|
+
* and injects that wallet's entries as worker env vars; `tokenEnvVar` names
|
|
114
|
+
* the entry holding the registry/git token. The scaffolder references
|
|
115
|
+
* `${tokenEnvVar}` from `.npmrc` / git config so npm interpolates the token at
|
|
116
|
+
* install time and the raw token is never written into the committed repo.
|
|
117
|
+
*/
|
|
118
|
+
export interface ProjectKitAuth {
|
|
119
|
+
/** Name of the wallet (project- or org-scoped) that holds the token. */
|
|
120
|
+
readonly walletName: string;
|
|
121
|
+
/** Env-var key, within the resolved wallet, that holds the auth token. */
|
|
122
|
+
readonly tokenEnvVar: string;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* A package resolved from an npm registry. For the public registry, only
|
|
127
|
+
* `package` + `versionRange` are set. For a scoped private registry,
|
|
128
|
+
* `registryUrl` + `scope` declare the registry and `auth` points at the wallet
|
|
129
|
+
* entry holding the token — referenced from `.npmrc` via `${ENV}`
|
|
130
|
+
* interpolation, never written raw into the committed repo.
|
|
131
|
+
*/
|
|
132
|
+
export interface NpmRegistryKitSource {
|
|
133
|
+
readonly kind: ProjectKitSourceKind.NpmRegistry;
|
|
134
|
+
/** Package name, e.g. `@acme/widgets` or `lodash`. */
|
|
135
|
+
readonly package: string;
|
|
136
|
+
/** Semver range stored into `package.json`, e.g. `^1.2.0`. */
|
|
137
|
+
readonly versionRange: string;
|
|
138
|
+
/** Registry URL for a scoped/private package. Omit for the public registry. */
|
|
139
|
+
readonly registryUrl?: string;
|
|
140
|
+
/** npm scope (`@acme`) the `registryUrl` serves. Required when `registryUrl` is set. */
|
|
141
|
+
readonly scope?: string;
|
|
142
|
+
/** Wallet-backed auth for a private registry. Omit for public registries. */
|
|
143
|
+
readonly auth?: ProjectKitAuth;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* A package resolved directly from a git repository. `package.json` records
|
|
148
|
+
* `git+<gitUrl>#<ref>`. For a private repo, `auth` points at the wallet entry
|
|
149
|
+
* holding the git token; the workspace rewrites the clone URL with it via git
|
|
150
|
+
* `insteadOf` so the committed `package.json` URL stays clean.
|
|
151
|
+
*/
|
|
152
|
+
export interface GitKitSource {
|
|
153
|
+
readonly kind: ProjectKitSourceKind.Git;
|
|
154
|
+
/** HTTPS git URL, e.g. `https://gitea.example.com/xema/component-library.git`. */
|
|
155
|
+
readonly gitUrl: string;
|
|
156
|
+
/** Tag / branch / commit to pin. Strongly recommended. */
|
|
157
|
+
readonly ref?: string;
|
|
158
|
+
/**
|
|
159
|
+
* The `package.json` `name` the repo publishes — i.e. the key the kit
|
|
160
|
+
* lands under in the consuming repo's `dependencies`. An npm-registry
|
|
161
|
+
* source carries this implicitly as `package`; a git source does not,
|
|
162
|
+
* so it is declared here. When set, the deterministic provisioning
|
|
163
|
+
* `EQUIP` step can guard on `MARKER_ABSENT` (`/dependencies/<packageName>`)
|
|
164
|
+
* and cleanly skip an already-installed kit. When omitted, the EQUIP
|
|
165
|
+
* step falls back to an unconditional (still idempotent) `npm install`.
|
|
166
|
+
*/
|
|
167
|
+
readonly packageName?: string;
|
|
168
|
+
/** Wallet-backed auth for a private repository. Omit for public repos. */
|
|
169
|
+
readonly auth?: ProjectKitAuth;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/** Discriminated union of every `NpmDependency` kit source. */
|
|
173
|
+
export type ProjectKitSource = NpmRegistryKitSource | GitKitSource;
|
|
174
|
+
|
|
175
|
+
/** Discriminator for how a per-session kit binding was chosen. */
|
|
176
|
+
export enum ProjectKitBindingKind {
|
|
177
|
+
/** A first-party kit picked from the seeded catalog (referenced by slug). */
|
|
178
|
+
Catalog = 'catalog',
|
|
179
|
+
/** A kit the user supplied ad-hoc (an npm name or git URL pasted at create time). */
|
|
180
|
+
Custom = 'custom',
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/** A binding that references a catalog kit by slug. */
|
|
184
|
+
export interface CatalogProjectKitBinding {
|
|
185
|
+
readonly binding: ProjectKitBindingKind.Catalog;
|
|
186
|
+
readonly slug: string;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** A binding that carries its own inline kit spec (user-provided). */
|
|
190
|
+
export interface CustomProjectKitBinding {
|
|
191
|
+
readonly binding: ProjectKitBindingKind.Custom;
|
|
192
|
+
readonly kitKind: ProjectKitKind;
|
|
193
|
+
/** Defaults to `GenericDependency` when the user does not classify it. */
|
|
194
|
+
readonly purpose?: ProjectKitPurpose;
|
|
195
|
+
readonly source: ProjectKitSource;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* A kit attached to a single interactive session. Persisted on the owning
|
|
200
|
+
* session-domain row (e.g. `WebappStudio.projectKits`) and threaded verbatim
|
|
201
|
+
* through `customConfig.projectKits` to the session.
|
|
202
|
+
*/
|
|
203
|
+
export type ProjectKitBinding =
|
|
204
|
+
| CatalogProjectKitBinding
|
|
205
|
+
| CustomProjectKitBinding;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* A kit binding after the session bootstrap has resolved every catalog
|
|
209
|
+
* reference against the kit catalog. The deterministic `provision` phase
|
|
210
|
+
* synthesizes one guard-gated EQUIP step per resolved kit.
|
|
211
|
+
*
|
|
212
|
+
* `compatibleTargets` is an opaque list of tech-stack tags — the consuming
|
|
213
|
+
* session type interprets them (webapp-studio matches them against its
|
|
214
|
+
* `appTarget.kind` values). This contract does not know what the tags mean.
|
|
215
|
+
*/
|
|
216
|
+
export interface ResolvedProjectKit {
|
|
217
|
+
/** Stable identifier — the catalog slug, or a derived id for custom bindings. */
|
|
218
|
+
readonly id: string;
|
|
219
|
+
readonly kitKind: ProjectKitKind;
|
|
220
|
+
readonly purpose: ProjectKitPurpose;
|
|
221
|
+
readonly source: ProjectKitSource;
|
|
222
|
+
/** Skill slug the bootstrap mounts so the agent knows how to use the kit. */
|
|
223
|
+
readonly enrichmentSkillSlug?: string;
|
|
224
|
+
/** Opaque tech-stack tags the consuming session type matches against. */
|
|
225
|
+
readonly compatibleTargets: readonly string[];
|
|
226
|
+
}
|
|
227
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
2
|
+
// @xemahq/provisioning-contracts — Workspace Provisioning wire contracts.
|
|
3
|
+
//
|
|
4
|
+
// Pure types + Zod schemas for the `provision` lifecycle phase (Epic A): the
|
|
5
|
+
// deterministic, guard-gated `SCAFFOLD` / `EQUIP` steps that prepare a
|
|
6
|
+
// session's repo content. agent-session-api's `provisioning-plan-resolver`
|
|
7
|
+
// RESOLVES a plan from biome manifests; workspace-proxy's
|
|
8
|
+
// `provisioning-plan` handler EXECUTES it. Both validate against the schemas
|
|
9
|
+
// here, so the wire shape has exactly one source of truth.
|
|
10
|
+
//
|
|
11
|
+
// A FOCUSED leaf package on purpose (same rationale as
|
|
12
|
+
// `@xemahq/project-kit-contracts`): kept un-nested so any service exposing
|
|
13
|
+
// these enums via `@ApiProperty({ enum })` resolves a clean top-level
|
|
14
|
+
// specifier. Zero runtime deps beyond `zod`.
|
|
15
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
16
|
+
|
|
17
|
+
export * from './lib/provisioning';
|