@kb-labs/infra-worker-contracts 0.5.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 ADDED
@@ -0,0 +1,4 @@
1
+ This project is licensed under the same terms as the KB Labs Plugin Template root project.
2
+
3
+ See the root LICENSE file at the repository root for full details.
4
+
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # @kb-labs/infra-worker-contracts
2
+
3
+ Shared types/contracts for infra worker plugin integration.
4
+
5
+ Use this package when orchestrator and infra worker need a stable typed payload/result contract.
6
+
7
+ ## Build
8
+
9
+ ```bash
10
+ pnpm --filter @kb-labs/infra-worker-contracts build
11
+ ```
@@ -0,0 +1,84 @@
1
+ declare const pluginContractsManifest: {
2
+ readonly schema: "kb.plugin.contracts/1";
3
+ readonly pluginId: "@kb-labs/infra-worker";
4
+ readonly contractsVersion: "1.0.0";
5
+ readonly artifacts: {
6
+ readonly 'infra.prepare.result': {
7
+ readonly id: "infra.prepare.result";
8
+ readonly kind: "json";
9
+ readonly description: "Result payload for infra preparation command.";
10
+ readonly pathPattern: "artifacts/infra/prepare/result.json";
11
+ readonly mediaType: "application/json";
12
+ readonly schemaRef: "@kb-labs/infra-worker-contracts/schema#PrepareInfraOutput";
13
+ readonly example: {
14
+ readonly summary: "Infra prepare output";
15
+ readonly payload: {
16
+ readonly workspaceId: "ws_123";
17
+ readonly environmentId: "env_456";
18
+ readonly snapshotId: "snap_789";
19
+ };
20
+ };
21
+ };
22
+ };
23
+ readonly commands: {
24
+ readonly 'infra-worker:prepare': {
25
+ readonly id: "infra-worker:prepare";
26
+ readonly description: "Materialize workspace and optionally provision environment/snapshot.";
27
+ readonly input: {
28
+ readonly ref: "@kb-labs/infra-worker-contracts/schema#PrepareInfraInput";
29
+ readonly format: "zod";
30
+ };
31
+ readonly output: {
32
+ readonly ref: "@kb-labs/infra-worker-contracts/schema#PrepareInfraOutput";
33
+ readonly format: "zod";
34
+ };
35
+ readonly produces: ["infra.prepare.result"];
36
+ readonly examples: ["kb infra-worker prepare --sourceRef repo://main --basePath /workspace/main"];
37
+ };
38
+ readonly 'infra-worker:capture-snapshot': {
39
+ readonly id: "infra-worker:capture-snapshot";
40
+ readonly description: "Capture snapshot for workspace/environment.";
41
+ readonly input: {
42
+ readonly ref: "@kb-labs/infra-worker-contracts/schema#CaptureSnapshotInput";
43
+ readonly format: "zod";
44
+ };
45
+ readonly output: {
46
+ readonly ref: "@kb-labs/infra-worker-contracts/schema#CaptureSnapshotOutput";
47
+ readonly format: "zod";
48
+ };
49
+ readonly produces: [];
50
+ readonly examples: ["kb infra-worker capture-snapshot --workspaceId ws_123 --namespace runs/main"];
51
+ };
52
+ readonly 'infra-worker:restore-snapshot': {
53
+ readonly id: "infra-worker:restore-snapshot";
54
+ readonly description: "Restore snapshot to workspace/environment.";
55
+ readonly input: {
56
+ readonly ref: "@kb-labs/infra-worker-contracts/schema#RestoreSnapshotInput";
57
+ readonly format: "zod";
58
+ };
59
+ readonly output: {
60
+ readonly ref: "@kb-labs/infra-worker-contracts/schema#RestoreSnapshotOutput";
61
+ readonly format: "zod";
62
+ };
63
+ readonly produces: [];
64
+ readonly examples: ["kb infra-worker restore-snapshot --snapshotId snap_789 --workspaceId ws_123"];
65
+ };
66
+ };
67
+ readonly workflows: {};
68
+ readonly api: {
69
+ readonly rest: {
70
+ readonly basePath: "/v1/plugins/infra-worker";
71
+ readonly routes: {};
72
+ };
73
+ };
74
+ };
75
+ type PluginArtifactIds = keyof typeof pluginContractsManifest.artifacts;
76
+ type PluginCommandIds = keyof typeof pluginContractsManifest.commands;
77
+ type PluginWorkflowIds = keyof typeof pluginContractsManifest.workflows;
78
+ type PluginRouteIds = typeof pluginContractsManifest.api extends {
79
+ rest: {
80
+ routes: infer R;
81
+ };
82
+ } ? R extends Record<string, any> ? keyof R : never : never;
83
+
84
+ export { type PluginArtifactIds, type PluginCommandIds, type PluginRouteIds, type PluginWorkflowIds, pluginContractsManifest };
@@ -0,0 +1,83 @@
1
+ // src/version.ts
2
+ var contractsSchemaId = "kb.plugin.contracts/1";
3
+ var contractsVersion = "1.0.0";
4
+
5
+ // src/contract.ts
6
+ var pluginContractsManifest = {
7
+ schema: contractsSchemaId,
8
+ pluginId: "@kb-labs/infra-worker",
9
+ contractsVersion,
10
+ artifacts: {
11
+ "infra.prepare.result": {
12
+ id: "infra.prepare.result",
13
+ kind: "json",
14
+ description: "Result payload for infra preparation command.",
15
+ pathPattern: "artifacts/infra/prepare/result.json",
16
+ mediaType: "application/json",
17
+ schemaRef: "@kb-labs/infra-worker-contracts/schema#PrepareInfraOutput",
18
+ example: {
19
+ summary: "Infra prepare output",
20
+ payload: {
21
+ workspaceId: "ws_123",
22
+ environmentId: "env_456",
23
+ snapshotId: "snap_789"
24
+ }
25
+ }
26
+ }
27
+ },
28
+ commands: {
29
+ "infra-worker:prepare": {
30
+ id: "infra-worker:prepare",
31
+ description: "Materialize workspace and optionally provision environment/snapshot.",
32
+ input: {
33
+ ref: "@kb-labs/infra-worker-contracts/schema#PrepareInfraInput",
34
+ format: "zod"
35
+ },
36
+ output: {
37
+ ref: "@kb-labs/infra-worker-contracts/schema#PrepareInfraOutput",
38
+ format: "zod"
39
+ },
40
+ produces: ["infra.prepare.result"],
41
+ examples: ["kb infra-worker prepare --sourceRef repo://main --basePath /workspace/main"]
42
+ },
43
+ "infra-worker:capture-snapshot": {
44
+ id: "infra-worker:capture-snapshot",
45
+ description: "Capture snapshot for workspace/environment.",
46
+ input: {
47
+ ref: "@kb-labs/infra-worker-contracts/schema#CaptureSnapshotInput",
48
+ format: "zod"
49
+ },
50
+ output: {
51
+ ref: "@kb-labs/infra-worker-contracts/schema#CaptureSnapshotOutput",
52
+ format: "zod"
53
+ },
54
+ produces: [],
55
+ examples: ["kb infra-worker capture-snapshot --workspaceId ws_123 --namespace runs/main"]
56
+ },
57
+ "infra-worker:restore-snapshot": {
58
+ id: "infra-worker:restore-snapshot",
59
+ description: "Restore snapshot to workspace/environment.",
60
+ input: {
61
+ ref: "@kb-labs/infra-worker-contracts/schema#RestoreSnapshotInput",
62
+ format: "zod"
63
+ },
64
+ output: {
65
+ ref: "@kb-labs/infra-worker-contracts/schema#RestoreSnapshotOutput",
66
+ format: "zod"
67
+ },
68
+ produces: [],
69
+ examples: ["kb infra-worker restore-snapshot --snapshotId snap_789 --workspaceId ws_123"]
70
+ }
71
+ },
72
+ workflows: {},
73
+ api: {
74
+ rest: {
75
+ basePath: "/v1/plugins/infra-worker",
76
+ routes: {}
77
+ }
78
+ }
79
+ };
80
+
81
+ export { pluginContractsManifest };
82
+ //# sourceMappingURL=contract.js.map
83
+ //# sourceMappingURL=contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/version.ts","../src/contract.ts"],"names":[],"mappings":";AAAO,IAAM,iBAAA,GAAoB,uBAAA;AAI1B,IAAM,gBAAA,GAAmB,OAAA;;;ACDzB,IAAM,uBAAA,GAA0B;AAAA,EACrC,MAAA,EAAQ,iBAAA;AAAA,EACR,QAAA,EAAU,uBAAA;AAAA,EACV,gBAAA;AAAA,EACA,SAAA,EAAW;AAAA,IACT,sBAAA,EAAwB;AAAA,MACtB,EAAA,EAAI,sBAAA;AAAA,MACJ,IAAA,EAAM,MAAA;AAAA,MACN,WAAA,EAAa,+CAAA;AAAA,MACb,WAAA,EAAa,qCAAA;AAAA,MACb,SAAA,EAAW,kBAAA;AAAA,MACX,SAAA,EAAW,2DAAA;AAAA,MACX,OAAA,EAAS;AAAA,QACP,OAAA,EAAS,sBAAA;AAAA,QACT,OAAA,EAAS;AAAA,UACP,WAAA,EAAa,QAAA;AAAA,UACb,aAAA,EAAe,SAAA;AAAA,UACf,UAAA,EAAY;AAAA;AACd;AACF;AACF,GACF;AAAA,EACA,QAAA,EAAU;AAAA,IACR,sBAAA,EAAwB;AAAA,MACtB,EAAA,EAAI,sBAAA;AAAA,MACJ,WAAA,EAAa,sEAAA;AAAA,MACb,KAAA,EAAO;AAAA,QACL,GAAA,EAAK,0DAAA;AAAA,QACL,MAAA,EAAQ;AAAA,OACV;AAAA,MACA,MAAA,EAAQ;AAAA,QACN,GAAA,EAAK,2DAAA;AAAA,QACL,MAAA,EAAQ;AAAA,OACV;AAAA,MACA,QAAA,EAAU,CAAC,sBAAsB,CAAA;AAAA,MACjC,QAAA,EAAU,CAAC,4EAA4E;AAAA,KACzF;AAAA,IACA,+BAAA,EAAiC;AAAA,MAC/B,EAAA,EAAI,+BAAA;AAAA,MACJ,WAAA,EAAa,6CAAA;AAAA,MACb,KAAA,EAAO;AAAA,QACL,GAAA,EAAK,6DAAA;AAAA,QACL,MAAA,EAAQ;AAAA,OACV;AAAA,MACA,MAAA,EAAQ;AAAA,QACN,GAAA,EAAK,8DAAA;AAAA,QACL,MAAA,EAAQ;AAAA,OACV;AAAA,MACA,UAAU,EAAC;AAAA,MACX,QAAA,EAAU,CAAC,6EAA6E;AAAA,KAC1F;AAAA,IACA,+BAAA,EAAiC;AAAA,MAC/B,EAAA,EAAI,+BAAA;AAAA,MACJ,WAAA,EAAa,4CAAA;AAAA,MACb,KAAA,EAAO;AAAA,QACL,GAAA,EAAK,6DAAA;AAAA,QACL,MAAA,EAAQ;AAAA,OACV;AAAA,MACA,MAAA,EAAQ;AAAA,QACN,GAAA,EAAK,8DAAA;AAAA,QACL,MAAA,EAAQ;AAAA,OACV;AAAA,MACA,UAAU,EAAC;AAAA,MACX,QAAA,EAAU,CAAC,6EAA6E;AAAA;AAC1F,GACF;AAAA,EACA,WAAW,EAAC;AAAA,EACZ,GAAA,EAAK;AAAA,IACH,IAAA,EAAM;AAAA,MACJ,QAAA,EAAU,0BAAA;AAAA,MACV,QAAQ;AAAC;AACX;AAEJ","file":"contract.js","sourcesContent":["export const contractsSchemaId = 'kb.plugin.contracts/1' as const;\n\nexport type ContractsSchemaId = typeof contractsSchemaId;\n\nexport const contractsVersion = '1.0.0' as const;\n\n","import type { PluginContracts } from './types';\nimport { contractsSchemaId, contractsVersion } from './version';\n\nexport const pluginContractsManifest = {\n schema: contractsSchemaId,\n pluginId: '@kb-labs/infra-worker',\n contractsVersion,\n artifacts: {\n 'infra.prepare.result': {\n id: 'infra.prepare.result',\n kind: 'json',\n description: 'Result payload for infra preparation command.',\n pathPattern: 'artifacts/infra/prepare/result.json',\n mediaType: 'application/json',\n schemaRef: '@kb-labs/infra-worker-contracts/schema#PrepareInfraOutput',\n example: {\n summary: 'Infra prepare output',\n payload: {\n workspaceId: 'ws_123',\n environmentId: 'env_456',\n snapshotId: 'snap_789',\n },\n },\n }\n },\n commands: {\n 'infra-worker:prepare': {\n id: 'infra-worker:prepare',\n description: 'Materialize workspace and optionally provision environment/snapshot.',\n input: {\n ref: '@kb-labs/infra-worker-contracts/schema#PrepareInfraInput',\n format: 'zod'\n },\n output: {\n ref: '@kb-labs/infra-worker-contracts/schema#PrepareInfraOutput',\n format: 'zod'\n },\n produces: ['infra.prepare.result'],\n examples: ['kb infra-worker prepare --sourceRef repo://main --basePath /workspace/main']\n },\n 'infra-worker:capture-snapshot': {\n id: 'infra-worker:capture-snapshot',\n description: 'Capture snapshot for workspace/environment.',\n input: {\n ref: '@kb-labs/infra-worker-contracts/schema#CaptureSnapshotInput',\n format: 'zod'\n },\n output: {\n ref: '@kb-labs/infra-worker-contracts/schema#CaptureSnapshotOutput',\n format: 'zod'\n },\n produces: [],\n examples: ['kb infra-worker capture-snapshot --workspaceId ws_123 --namespace runs/main']\n },\n 'infra-worker:restore-snapshot': {\n id: 'infra-worker:restore-snapshot',\n description: 'Restore snapshot to workspace/environment.',\n input: {\n ref: '@kb-labs/infra-worker-contracts/schema#RestoreSnapshotInput',\n format: 'zod'\n },\n output: {\n ref: '@kb-labs/infra-worker-contracts/schema#RestoreSnapshotOutput',\n format: 'zod'\n },\n produces: [],\n examples: ['kb infra-worker restore-snapshot --snapshotId snap_789 --workspaceId ws_123']\n }\n },\n workflows: {},\n api: {\n rest: {\n basePath: '/v1/plugins/infra-worker',\n routes: {},\n },\n },\n} as const satisfies PluginContracts;\n\nexport type PluginArtifactIds = keyof typeof pluginContractsManifest.artifacts;\nexport type PluginCommandIds = keyof typeof pluginContractsManifest.commands;\nexport type PluginWorkflowIds = keyof typeof pluginContractsManifest.workflows;\nexport type PluginRouteIds = typeof pluginContractsManifest.api extends { rest: { routes: infer R } }\n ? R extends Record<string, any>\n ? keyof R\n : never\n : never;\n"]}