@stream44.studio/t44 0.4.0-rc.24
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/.dco-signatures +9 -0
- package/.github/workflows/dco.yaml +12 -0
- package/.github/workflows/gordian-open-integrity.yaml +13 -0
- package/.github/workflows/test.yaml +31 -0
- package/.o/GordianOpenIntegrity-CurrentLifehash.svg +1026 -0
- package/.o/GordianOpenIntegrity-InceptionLifehash.svg +1026 -0
- package/.o/GordianOpenIntegrity.yaml +21 -0
- package/.o/assets/Hero-Terminal44-v0.jpeg +0 -0
- package/.o/stream44.studio/assets/Icon-v1.svg +1170 -0
- package/.repo-identifier +1 -0
- package/DCO.md +34 -0
- package/LICENSE.txt +186 -0
- package/README.md +189 -0
- package/bin/activate +36 -0
- package/bin/activate.ts +30 -0
- package/bin/postinstall.sh +19 -0
- package/bin/shell +27 -0
- package/bin/t44 +27 -0
- package/caps/ConfigSchemaStruct.ts +55 -0
- package/caps/Home.ts +57 -0
- package/caps/HomeRegistry.ts +319 -0
- package/caps/HomeRegistryFile.ts +144 -0
- package/caps/JsonSchemas.ts +220 -0
- package/caps/OpenApiSchema.ts +67 -0
- package/caps/PackageDescriptor.ts +88 -0
- package/caps/ProjectCatalogs.ts +153 -0
- package/caps/ProjectDeployment.ts +426 -0
- package/caps/ProjectDevelopment.ts +257 -0
- package/caps/ProjectPublishing.ts +654 -0
- package/caps/ProjectPulling.ts +234 -0
- package/caps/ProjectRack.ts +155 -0
- package/caps/ProjectRepository.ts +332 -0
- package/caps/ProjectTest.ts +251 -0
- package/caps/ProjectTestLib.ts +257 -0
- package/caps/RootKey.ts +219 -0
- package/caps/SigningKey.ts +243 -0
- package/caps/TaskWorkflow.ts +192 -0
- package/caps/WorkspaceCli.ts +448 -0
- package/caps/WorkspaceConfig.ts +268 -0
- package/caps/WorkspaceConfig.yaml +87 -0
- package/caps/WorkspaceConfigFile.ts +902 -0
- package/caps/WorkspaceConnection.ts +329 -0
- package/caps/WorkspaceEntityConfig.ts +78 -0
- package/caps/WorkspaceEntityConfig.v0.ts +77 -0
- package/caps/WorkspaceEntityFact.ts +218 -0
- package/caps/WorkspaceInfo.ts +619 -0
- package/caps/WorkspaceInit.ts +30 -0
- package/caps/WorkspaceKey.ts +338 -0
- package/caps/WorkspaceModel.ts +373 -0
- package/caps/WorkspaceProjects.ts +636 -0
- package/caps/WorkspacePrompt.ts +430 -0
- package/caps/WorkspaceShell.sh +39 -0
- package/caps/WorkspaceShell.ts +104 -0
- package/caps/WorkspaceShell.yaml +64 -0
- package/caps/WorkspaceShellCli.ts +109 -0
- package/caps/patterns/README.md +2 -0
- package/caps/patterns/git-scm.com/ProjectPublishing.ts +507 -0
- package/caps/patterns/semver.org/ProjectPublishing.ts +458 -0
- package/docs/Overview.drawio +248 -0
- package/docs/Overview.svg +4 -0
- package/examples/01-Lifecycle/main.test.ts +223 -0
- package/lib/crypto.ts +53 -0
- package/lib/key.ts +381 -0
- package/lib/schema-console-renderer.ts +181 -0
- package/lib/schema-resolver.ts +349 -0
- package/lib/ucan.ts +137 -0
- package/package.json +91 -0
- package/standalone-rt.test.ts +150 -0
- package/standalone-rt.ts +140 -0
- package/structs/HomeRegistry.ts +55 -0
- package/structs/HomeRegistryConfig.ts +60 -0
- package/structs/ProjectCatalogsConfig.ts +53 -0
- package/structs/ProjectDeploymentConfig.ts +56 -0
- package/structs/ProjectDeploymentFact.ts +106 -0
- package/structs/ProjectPublishingConfig.ts +78 -0
- package/structs/ProjectPublishingFact.ts +68 -0
- package/structs/ProjectPullingConfig.ts +52 -0
- package/structs/ProjectRack.ts +51 -0
- package/structs/ProjectRackConfig.ts +56 -0
- package/structs/RepositoryOriginDescriptor.ts +51 -0
- package/structs/RootKeyConfig.ts +64 -0
- package/structs/SigningKeyConfig.ts +64 -0
- package/structs/Workspace.ts +56 -0
- package/structs/WorkspaceCatalogs.ts +56 -0
- package/structs/WorkspaceCliConfig.ts +53 -0
- package/structs/WorkspaceConfig.ts +64 -0
- package/structs/WorkspaceConfigFile.ts +50 -0
- package/structs/WorkspaceConfigFileMeta.ts +70 -0
- package/structs/WorkspaceKey.ts +55 -0
- package/structs/WorkspaceKeyConfig.ts +56 -0
- package/structs/WorkspaceMappingsConfig.ts +56 -0
- package/structs/WorkspaceProject.ts +104 -0
- package/structs/WorkspaceProjectsConfig.ts +67 -0
- package/structs/WorkspaceShellConfig.ts +83 -0
- package/structs/patterns/README.md +2 -0
- package/structs/patterns/git-scm.com/ProjectPublishingFact.ts +46 -0
- package/tsconfig.json +33 -0
- package/workspace-rt.ts +152 -0
- package/workspace.yaml +3 -0
package/package.json
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stream44.studio/t44",
|
|
3
|
+
"version": "0.4.0-rc.24",
|
|
4
|
+
"license": "LGPL",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/Stream44/t44.git"
|
|
8
|
+
},
|
|
9
|
+
"type": "module",
|
|
10
|
+
"bin": {
|
|
11
|
+
"t44": "./bin/t44"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"test": "bun test"
|
|
15
|
+
},
|
|
16
|
+
"exports": {
|
|
17
|
+
"./workspace-rt": "./workspace-rt.ts",
|
|
18
|
+
"./standalone-rt": "./standalone-rt.ts",
|
|
19
|
+
"./caps/Home": "./caps/Home.ts",
|
|
20
|
+
"./caps/HomeRegistry": "./caps/HomeRegistry.ts",
|
|
21
|
+
"./caps/OpenApiSchema": "./caps/OpenApiSchema.ts",
|
|
22
|
+
"./caps/JsonSchemas": "./caps/JsonSchemas.ts",
|
|
23
|
+
"./caps/ProjectDeployment": "./caps/ProjectDeployment.ts",
|
|
24
|
+
"./caps/ProjectDevelopment": "./caps/ProjectDevelopment.ts",
|
|
25
|
+
"./caps/ProjectPublishing": "./caps/ProjectPublishing.ts",
|
|
26
|
+
"./caps/ProjectRack": "./caps/ProjectRack.ts",
|
|
27
|
+
"./caps/WorkspaceCli": "./caps/WorkspaceCli.ts",
|
|
28
|
+
"./caps/WorkspaceConfig": "./caps/WorkspaceConfig.ts",
|
|
29
|
+
"./caps/WorkspaceConnection": "./caps/WorkspaceConnection.ts",
|
|
30
|
+
"./caps/WorkspaceEntityConfig": "./caps/WorkspaceEntityConfig.ts",
|
|
31
|
+
"./caps/WorkspaceEntityFact": "./caps/WorkspaceEntityFact.ts",
|
|
32
|
+
"./caps/WorkspaceInfo": "./caps/WorkspaceInfo.ts",
|
|
33
|
+
"./caps/WorkspaceInit": "./caps/WorkspaceInit.ts",
|
|
34
|
+
"./caps/RootKey": "./caps/RootKey.ts",
|
|
35
|
+
"./caps/WorkspaceKey": "./caps/WorkspaceKey.ts",
|
|
36
|
+
"./caps/WorkspaceProjects": "./caps/WorkspaceProjects.ts",
|
|
37
|
+
"./caps/WorkspacePrompt": "./caps/WorkspacePrompt.ts",
|
|
38
|
+
"./caps/WorkspaceShell": "./caps/WorkspaceShell.ts",
|
|
39
|
+
"./caps/WorkspaceShellCli": "./caps/WorkspaceShellCli.ts",
|
|
40
|
+
"./caps/TaskWorkflow": "./caps/TaskWorkflow.ts",
|
|
41
|
+
"./caps/ProjectTest": "./caps/ProjectTest.ts",
|
|
42
|
+
"./caps/ProjectTestLib": "./caps/ProjectTestLib.ts",
|
|
43
|
+
"./caps/patterns/git-scm.com/ProjectPublishing": "./caps/patterns/git-scm.com/ProjectPublishing.ts",
|
|
44
|
+
"./caps/patterns/semver.org/ProjectPublishing": "./caps/patterns/semver.org/ProjectPublishing.ts",
|
|
45
|
+
"./structs/HomeRegistryConfig": "./structs/HomeRegistryConfig.ts",
|
|
46
|
+
"./structs/RootKeyConfig": "./structs/RootKeyConfig.ts",
|
|
47
|
+
"./structs/ProjectDeploymentConfig": "./structs/ProjectDeploymentConfig.ts",
|
|
48
|
+
"./structs/ProjectDeploymentFact": "./structs/ProjectDeploymentFact.ts",
|
|
49
|
+
"./structs/ProjectPublishingFact": "./structs/ProjectPublishingFact.ts",
|
|
50
|
+
"./structs/ProjectRackConfig": "./structs/ProjectRackConfig.ts",
|
|
51
|
+
"./structs/WorkspaceCliConfig": "./structs/WorkspaceCliConfig.ts",
|
|
52
|
+
"./structs/WorkspaceConfig": "./structs/WorkspaceConfig.ts",
|
|
53
|
+
"./structs/WorkspaceKeyConfig": "./structs/WorkspaceKeyConfig.ts",
|
|
54
|
+
"./structs/WorkspaceMappingsConfig": "./structs/WorkspaceMappingsConfig.ts",
|
|
55
|
+
"./structs/WorkspaceProjectsConfig": "./structs/WorkspaceProjectsConfig.ts",
|
|
56
|
+
"./structs/WorkspacePublishingConfig": "./structs/WorkspacePublishingConfig.ts",
|
|
57
|
+
"./structs/WorkspaceShellConfig": "./structs/WorkspaceShellConfig.ts",
|
|
58
|
+
"./structs/patterns/git-scm.com/ProjectPublishingFact": "./structs/patterns/git-scm.com/ProjectPublishingFact.ts"
|
|
59
|
+
},
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"ajv": "^8.17.1",
|
|
62
|
+
"ajv-formats": "^3.0.1",
|
|
63
|
+
"js-yaml": "^4.1.0",
|
|
64
|
+
"commander": "^14.0.0",
|
|
65
|
+
"chalk": "^5.6.2",
|
|
66
|
+
"dotenv": "^17.2.3",
|
|
67
|
+
"fast-glob": "^3.3.3",
|
|
68
|
+
"inquirer": "^12.4.0",
|
|
69
|
+
"axios": "^1.13.4",
|
|
70
|
+
"@ucanto/principal": "^9.0.3",
|
|
71
|
+
"@ucanto/server": "^11.0.3",
|
|
72
|
+
"json-schema-ref-resolver": "^3.0.0",
|
|
73
|
+
"@stream44.studio/encapsulate": "^0.4.0-rc.23",
|
|
74
|
+
"turbo": "^2.7.5"
|
|
75
|
+
},
|
|
76
|
+
"optionalDependencies": {
|
|
77
|
+
"@stream44.studio/t44-bunny.net": "^0.1.0-rc.4",
|
|
78
|
+
"@stream44.studio/t44-vercel.com": "^0.1.0-rc.4",
|
|
79
|
+
"@stream44.studio/t44-github.com": "^0.1.0-rc.4",
|
|
80
|
+
"@stream44.studio/t44-dynadot.com": "^0.1.0-rc.4",
|
|
81
|
+
"@stream44.studio/t44-npmjs.com": "^0.1.0-rc.4"
|
|
82
|
+
},
|
|
83
|
+
"devDependencies": {
|
|
84
|
+
"@types/bun": "^1.3.4",
|
|
85
|
+
"@types/node": "^25.0.3",
|
|
86
|
+
"@types/js-yaml": "^4.0.9",
|
|
87
|
+
"bun-types": "^1.3.4"
|
|
88
|
+
},
|
|
89
|
+
"workspaces": [],
|
|
90
|
+
"private": false
|
|
91
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
#!/usr/bin/env bun test --timeout 30000
|
|
2
|
+
|
|
3
|
+
import * as bunTest from 'bun:test'
|
|
4
|
+
import { describe, it, expect } from 'bun:test'
|
|
5
|
+
import { run } from './standalone-rt'
|
|
6
|
+
|
|
7
|
+
// Top-level run() — shared across all tests (e.g. for workbenchDir)
|
|
8
|
+
const { test: { workbenchDir } } = await run(async ({ encapsulate, CapsulePropertyTypes, makeImportStack }: any) => {
|
|
9
|
+
const spine = await encapsulate({
|
|
10
|
+
'#@stream44.studio/encapsulate/spine-contracts/CapsuleSpineContract.v0': {
|
|
11
|
+
'#@stream44.studio/encapsulate/structs/Capsule': {},
|
|
12
|
+
'#': {
|
|
13
|
+
test: {
|
|
14
|
+
type: CapsulePropertyTypes.Mapping,
|
|
15
|
+
value: '@stream44.studio/t44/caps/ProjectTest',
|
|
16
|
+
options: { '#': { bunTest, env: {} } }
|
|
17
|
+
},
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}, { importMeta: import.meta, importStack: makeImportStack(), capsuleName: '@stream44.studio/t44/standalone-rt.test' })
|
|
21
|
+
return { spine }
|
|
22
|
+
}, async ({ spine, apis }: any) => {
|
|
23
|
+
return apis[spine.capsuleSourceLineRef]
|
|
24
|
+
}, { importMeta: import.meta })
|
|
25
|
+
|
|
26
|
+
describe('standalone-rt multiple run() calls', () => {
|
|
27
|
+
|
|
28
|
+
it('should support a second run() call with static options', async () => {
|
|
29
|
+
const result = await run(async ({ encapsulate, CapsulePropertyTypes, makeImportStack }: any) => {
|
|
30
|
+
const spine = await encapsulate({
|
|
31
|
+
'#@stream44.studio/encapsulate/spine-contracts/CapsuleSpineContract.v0': {
|
|
32
|
+
'#@stream44.studio/encapsulate/structs/Capsule': {},
|
|
33
|
+
'#': {
|
|
34
|
+
greeting: {
|
|
35
|
+
type: CapsulePropertyTypes.Literal,
|
|
36
|
+
value: 'hello-from-run-1',
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}, { importMeta: import.meta, importStack: makeImportStack(), capsuleName: '@stream44.studio/t44/standalone-rt.test.run1' })
|
|
41
|
+
return { spine }
|
|
42
|
+
}, async ({ spine, apis }: any) => {
|
|
43
|
+
return apis[spine.capsuleSourceLineRef].greeting
|
|
44
|
+
}, { importMeta: import.meta, runFromSnapshot: false })
|
|
45
|
+
|
|
46
|
+
expect(result).toBe('hello-from-run-1');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('should support a third run() call with different options', async () => {
|
|
50
|
+
const result = await run(async ({ encapsulate, CapsulePropertyTypes, makeImportStack }: any) => {
|
|
51
|
+
const spine = await encapsulate({
|
|
52
|
+
'#@stream44.studio/encapsulate/spine-contracts/CapsuleSpineContract.v0': {
|
|
53
|
+
'#@stream44.studio/encapsulate/structs/Capsule': {},
|
|
54
|
+
'#': {
|
|
55
|
+
greeting: {
|
|
56
|
+
type: CapsulePropertyTypes.Literal,
|
|
57
|
+
value: 'hello-from-run-2',
|
|
58
|
+
},
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}, { importMeta: import.meta, importStack: makeImportStack(), capsuleName: '@stream44.studio/t44/standalone-rt.test.run2' })
|
|
62
|
+
return { spine }
|
|
63
|
+
}, async ({ spine, apis }: any) => {
|
|
64
|
+
return apis[spine.capsuleSourceLineRef].greeting
|
|
65
|
+
}, { importMeta: import.meta, runFromSnapshot: false })
|
|
66
|
+
|
|
67
|
+
expect(result).toBe('hello-from-run-2');
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('should support run() with closure variables in options', async () => {
|
|
71
|
+
const dynamicValue = `dynamic-${Date.now()}`;
|
|
72
|
+
|
|
73
|
+
const result = await run(async ({ encapsulate, CapsulePropertyTypes, makeImportStack }: any) => {
|
|
74
|
+
const spine = await encapsulate({
|
|
75
|
+
'#@stream44.studio/encapsulate/spine-contracts/CapsuleSpineContract.v0': {
|
|
76
|
+
'#@stream44.studio/encapsulate/structs/Capsule': {},
|
|
77
|
+
'#': {
|
|
78
|
+
value: {
|
|
79
|
+
type: CapsulePropertyTypes.Literal,
|
|
80
|
+
value: dynamicValue,
|
|
81
|
+
},
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}, { importMeta: import.meta, importStack: makeImportStack(), capsuleName: '@stream44.studio/t44/standalone-rt.test.closure' })
|
|
85
|
+
return { spine }
|
|
86
|
+
}, async ({ spine, apis }: any) => {
|
|
87
|
+
return apis[spine.capsuleSourceLineRef].value
|
|
88
|
+
}, { importMeta: import.meta, runFromSnapshot: false })
|
|
89
|
+
|
|
90
|
+
expect(result).toBe(dynamicValue);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('should support run() with two capsules in the same spine', async () => {
|
|
94
|
+
const result = await run(async ({ encapsulate, CapsulePropertyTypes, makeImportStack }: any) => {
|
|
95
|
+
const spineA = await encapsulate({
|
|
96
|
+
'#@stream44.studio/encapsulate/spine-contracts/CapsuleSpineContract.v0': {
|
|
97
|
+
'#@stream44.studio/encapsulate/structs/Capsule': {},
|
|
98
|
+
'#': {
|
|
99
|
+
name: { type: CapsulePropertyTypes.Literal, value: 'capsule-a' },
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}, { importMeta: import.meta, importStack: makeImportStack(), capsuleName: '@stream44.studio/t44/standalone-rt.test.multi-a' })
|
|
103
|
+
|
|
104
|
+
const spineB = await encapsulate({
|
|
105
|
+
'#@stream44.studio/encapsulate/spine-contracts/CapsuleSpineContract.v0': {
|
|
106
|
+
'#@stream44.studio/encapsulate/structs/Capsule': {},
|
|
107
|
+
'#': {
|
|
108
|
+
name: { type: CapsulePropertyTypes.Literal, value: 'capsule-b' },
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}, { importMeta: import.meta, importStack: makeImportStack(), capsuleName: '@stream44.studio/t44/standalone-rt.test.multi-b' })
|
|
112
|
+
|
|
113
|
+
return { spineA, spineB }
|
|
114
|
+
}, async ({ spineA, spineB, apis }: any) => {
|
|
115
|
+
return {
|
|
116
|
+
a: apis[spineA.capsuleSourceLineRef].name,
|
|
117
|
+
b: apis[spineB.capsuleSourceLineRef].name,
|
|
118
|
+
}
|
|
119
|
+
}, { importMeta: import.meta, runFromSnapshot: false })
|
|
120
|
+
|
|
121
|
+
expect(result.a).toBe('capsule-a');
|
|
122
|
+
expect(result.b).toBe('capsule-b');
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it('should support run() with runFromSnapshot: true', async () => {
|
|
126
|
+
const result = await run(async ({ encapsulate, CapsulePropertyTypes, makeImportStack }: any) => {
|
|
127
|
+
const spine = await encapsulate({
|
|
128
|
+
'#@stream44.studio/encapsulate/spine-contracts/CapsuleSpineContract.v0': {
|
|
129
|
+
'#@stream44.studio/encapsulate/structs/Capsule': {},
|
|
130
|
+
'#': {
|
|
131
|
+
greeting: {
|
|
132
|
+
type: CapsulePropertyTypes.Literal,
|
|
133
|
+
value: 'hello-from-snapshot',
|
|
134
|
+
},
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}, { importMeta: import.meta, importStack: makeImportStack(), capsuleName: '@stream44.studio/t44/standalone-rt.test.snapshot' })
|
|
138
|
+
return { spine }
|
|
139
|
+
}, async ({ spine, apis }: any) => {
|
|
140
|
+
return apis[spine.capsuleSourceLineRef].greeting
|
|
141
|
+
}, { importMeta: import.meta, runFromSnapshot: true })
|
|
142
|
+
|
|
143
|
+
expect(result).toBe('hello-from-snapshot');
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
it('workbenchDir from top-level run() should still be available', () => {
|
|
147
|
+
expect(workbenchDir).toBeDefined();
|
|
148
|
+
expect(typeof workbenchDir).toBe('string');
|
|
149
|
+
});
|
|
150
|
+
});
|
package/standalone-rt.ts
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/// <reference types="bun" />
|
|
3
|
+
/// <reference types="node" />
|
|
4
|
+
|
|
5
|
+
const startTime = Date.now()
|
|
6
|
+
|
|
7
|
+
import { resolve, join } from 'path'
|
|
8
|
+
import { access } from 'fs/promises'
|
|
9
|
+
import chalk from 'chalk'
|
|
10
|
+
import { CapsuleSpineFactory } from "@stream44.studio/encapsulate/spine-factories/CapsuleSpineFactory.v0"
|
|
11
|
+
import { CapsuleSpineContract } from "@stream44.studio/encapsulate/spine-contracts/CapsuleSpineContract.v0/Membrane.v0"
|
|
12
|
+
import { TimingObserver } from "@stream44.studio/encapsulate/spine-factories/TimingObserver"
|
|
13
|
+
|
|
14
|
+
async function findPackageRoot(startDir: string): Promise<string> {
|
|
15
|
+
let dir = resolve(startDir)
|
|
16
|
+
while (true) {
|
|
17
|
+
try {
|
|
18
|
+
await access(join(dir, 'package.json'))
|
|
19
|
+
return dir
|
|
20
|
+
} catch { }
|
|
21
|
+
const parent = resolve(dir, '..')
|
|
22
|
+
if (parent === dir) return resolve(startDir)
|
|
23
|
+
dir = parent
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export async function run(encapsulateHandler: any, runHandler: any, options?: { importMeta?: { dir: string }, runFromSnapshot?: boolean }) {
|
|
28
|
+
|
|
29
|
+
const timing = process.argv.includes('--trace') ? TimingObserver({ startTime }) : undefined
|
|
30
|
+
|
|
31
|
+
timing?.recordMajor('INIT SPINE')
|
|
32
|
+
|
|
33
|
+
const eventsByKey = new Map<string, any>()
|
|
34
|
+
|
|
35
|
+
const spineFilesystemRoot = options?.importMeta?.dir
|
|
36
|
+
? await findPackageRoot(options.importMeta.dir)
|
|
37
|
+
: process.cwd()
|
|
38
|
+
|
|
39
|
+
const { encapsulate, freeze, CapsulePropertyTypes, makeImportStack, hoistSnapshot, run: spineRun } = await CapsuleSpineFactory({
|
|
40
|
+
spineFilesystemRoot,
|
|
41
|
+
capsuleModuleProjectionRoot: options?.importMeta?.dir!,
|
|
42
|
+
enableCallerStackInference: true,
|
|
43
|
+
spineContracts: {
|
|
44
|
+
['#' + CapsuleSpineContract['#']]: CapsuleSpineContract
|
|
45
|
+
},
|
|
46
|
+
timing,
|
|
47
|
+
onMembraneEvent: timing ? (event: any) => {
|
|
48
|
+
const instanceId = event.target?.spineContractCapsuleInstanceId
|
|
49
|
+
const eventIndex = event.eventIndex
|
|
50
|
+
|
|
51
|
+
// Store event by composite key (instance ID + event index)
|
|
52
|
+
const key = `${eventIndex}`
|
|
53
|
+
eventsByKey.set(key, event)
|
|
54
|
+
|
|
55
|
+
let capsuleRef = event.target?.capsuleSourceLineRef
|
|
56
|
+
let prop = event.target?.prop
|
|
57
|
+
let callerLocation = event.caller ? `${event.caller.filepath}:${event.caller.line}` : 'unknown'
|
|
58
|
+
const eventType = event.event
|
|
59
|
+
|
|
60
|
+
// For call-result events, look up the original call event to get all info
|
|
61
|
+
if (eventType === 'call-result') {
|
|
62
|
+
const callKey = `${event.callEventIndex}`
|
|
63
|
+
const callEvent = eventsByKey.get(callKey)
|
|
64
|
+
if (callEvent) {
|
|
65
|
+
capsuleRef = callEvent.target?.capsuleSourceLineRef || capsuleRef
|
|
66
|
+
prop = callEvent.target?.prop || prop
|
|
67
|
+
if (callEvent.caller) {
|
|
68
|
+
callerLocation = `${callEvent.caller.filepath}:${callEvent.caller.line}`
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
console.error(
|
|
74
|
+
chalk.gray(`[${eventIndex}]`),
|
|
75
|
+
chalk.cyan(eventType.padEnd(12)),
|
|
76
|
+
chalk.yellow(capsuleRef),
|
|
77
|
+
chalk.magenta(`.${prop}`),
|
|
78
|
+
chalk.dim(`from ${callerLocation}`)
|
|
79
|
+
)
|
|
80
|
+
} : undefined
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
timing?.recordMajor('ENCAPSULATE')
|
|
84
|
+
|
|
85
|
+
const exportedApi = await encapsulateHandler({
|
|
86
|
+
encapsulate,
|
|
87
|
+
CapsulePropertyTypes,
|
|
88
|
+
makeImportStack
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
let run
|
|
92
|
+
|
|
93
|
+
if (options?.runFromSnapshot === false) {
|
|
94
|
+
|
|
95
|
+
run = spineRun
|
|
96
|
+
|
|
97
|
+
timing?.recordMajor('RUN (in-memory)')
|
|
98
|
+
} else {
|
|
99
|
+
|
|
100
|
+
timing?.recordMajor('FREEZE')
|
|
101
|
+
|
|
102
|
+
const snapshot = await freeze()
|
|
103
|
+
|
|
104
|
+
timing?.recordMajor('HOIST SNAPSHOT')
|
|
105
|
+
|
|
106
|
+
const spine = await hoistSnapshot({
|
|
107
|
+
snapshot
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
run = spine.run
|
|
111
|
+
|
|
112
|
+
timing?.recordMajor('RUN (snapshot)')
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const result = await run({
|
|
116
|
+
overrides: {
|
|
117
|
+
['@stream44.studio/t44/caps/ProjectTest']: {
|
|
118
|
+
'#': {
|
|
119
|
+
testRootDir: options?.importMeta?.dir,
|
|
120
|
+
verbose: !!process.env.VERBOSE,
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
['@stream44.studio/t44-ipfs.tech/caps/IpfsWorkbench']: {
|
|
124
|
+
'#': {
|
|
125
|
+
cacheDir: join(spineFilesystemRoot, '.~o/workspace.foundation', '@t44.sh~t44-ipfs.tech~caps~IpfsWorkbench', 'daemons')
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}, async (opts) => {
|
|
130
|
+
return runHandler({
|
|
131
|
+
...opts,
|
|
132
|
+
...(exportedApi || {}),
|
|
133
|
+
spineFilesystemRoot
|
|
134
|
+
})
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
timing?.recordMajor('DONE')
|
|
138
|
+
|
|
139
|
+
return result
|
|
140
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
|
|
2
|
+
export async function capsule({
|
|
3
|
+
encapsulate,
|
|
4
|
+
CapsulePropertyTypes,
|
|
5
|
+
makeImportStack
|
|
6
|
+
}: any) {
|
|
7
|
+
return encapsulate({
|
|
8
|
+
'#@stream44.studio/encapsulate/spine-contracts/CapsuleSpineContract.v0': {
|
|
9
|
+
'#@stream44.studio/t44/caps/ConfigSchemaStruct': {
|
|
10
|
+
as: 'schema',
|
|
11
|
+
options: {
|
|
12
|
+
'#': {
|
|
13
|
+
schema: {
|
|
14
|
+
type: 'object',
|
|
15
|
+
properties: {
|
|
16
|
+
did: {
|
|
17
|
+
type: 'string',
|
|
18
|
+
description: 'The DID (Decentralized Identifier) of the home registry.'
|
|
19
|
+
},
|
|
20
|
+
privateKey: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
description: 'The private key associated with the home registry DID.'
|
|
23
|
+
},
|
|
24
|
+
createdAt: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
format: 'date-time',
|
|
27
|
+
description: 'ISO 8601 timestamp of when the registry was created.'
|
|
28
|
+
},
|
|
29
|
+
rootDir: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
description: 'Absolute path to the home registry root directory.'
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
required: ['did', 'privateKey', 'createdAt', 'rootDir'],
|
|
35
|
+
additionalProperties: false,
|
|
36
|
+
description: 'Home registry identity containing the root DID and private key.'
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
'#': {
|
|
42
|
+
capsuleName: {
|
|
43
|
+
type: CapsulePropertyTypes.Literal,
|
|
44
|
+
value: capsule['#']
|
|
45
|
+
},
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}, {
|
|
49
|
+
extendsCapsule: '@stream44.studio/t44/caps/HomeRegistryFile',
|
|
50
|
+
importMeta: import.meta,
|
|
51
|
+
importStack: makeImportStack(),
|
|
52
|
+
capsuleName: capsule['#'],
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
capsule['#'] = '@stream44.studio/t44/structs/HomeRegistry'
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
|
|
2
|
+
export async function capsule({
|
|
3
|
+
encapsulate,
|
|
4
|
+
CapsulePropertyTypes,
|
|
5
|
+
makeImportStack
|
|
6
|
+
}: any) {
|
|
7
|
+
return encapsulate({
|
|
8
|
+
'#@stream44.studio/encapsulate/spine-contracts/CapsuleSpineContract.v0': {
|
|
9
|
+
'#@stream44.studio/t44/caps/ConfigSchemaStruct': {
|
|
10
|
+
as: 'schema',
|
|
11
|
+
options: {
|
|
12
|
+
'#': {
|
|
13
|
+
schema: {
|
|
14
|
+
type: 'object',
|
|
15
|
+
properties: {
|
|
16
|
+
homeDir: {
|
|
17
|
+
type: 'string',
|
|
18
|
+
description: 'Absolute path to the home directory (parent of registry, .ssh, etc).'
|
|
19
|
+
},
|
|
20
|
+
rootDir: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
description: 'Absolute path to the home registry root directory.'
|
|
23
|
+
},
|
|
24
|
+
identifier: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
description: 'DID (Decentralized Identifier) of the home registry.'
|
|
27
|
+
},
|
|
28
|
+
createdAt: {
|
|
29
|
+
type: 'string',
|
|
30
|
+
format: 'date-time',
|
|
31
|
+
description: 'ISO 8601 timestamp of when the entity config was created.'
|
|
32
|
+
},
|
|
33
|
+
updatedAt: {
|
|
34
|
+
type: 'string',
|
|
35
|
+
format: 'date-time',
|
|
36
|
+
description: 'ISO 8601 timestamp of when the entity config was last updated.'
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
required: ['createdAt', 'updatedAt'],
|
|
40
|
+
additionalProperties: false,
|
|
41
|
+
description: 'Home registry configuration with identity and location.'
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
'#': {
|
|
47
|
+
capsuleName: {
|
|
48
|
+
type: CapsulePropertyTypes.Literal,
|
|
49
|
+
value: capsule['#']
|
|
50
|
+
},
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}, {
|
|
54
|
+
extendsCapsule: '@stream44.studio/t44/caps/WorkspaceEntityConfig',
|
|
55
|
+
importMeta: import.meta,
|
|
56
|
+
importStack: makeImportStack(),
|
|
57
|
+
capsuleName: capsule['#'],
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
capsule['#'] = '@stream44.studio/t44/structs/HomeRegistryConfig'
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
|
|
2
|
+
export async function capsule({
|
|
3
|
+
encapsulate,
|
|
4
|
+
CapsulePropertyTypes,
|
|
5
|
+
makeImportStack
|
|
6
|
+
}: any) {
|
|
7
|
+
return encapsulate({
|
|
8
|
+
'#@stream44.studio/encapsulate/spine-contracts/CapsuleSpineContract.v0': {
|
|
9
|
+
'#@stream44.studio/t44/caps/ConfigSchemaStruct': {
|
|
10
|
+
as: 'schema',
|
|
11
|
+
options: {
|
|
12
|
+
'#': {
|
|
13
|
+
schema: {
|
|
14
|
+
type: 'object',
|
|
15
|
+
properties: {
|
|
16
|
+
catalogs: {
|
|
17
|
+
type: 'object',
|
|
18
|
+
additionalProperties: true,
|
|
19
|
+
description: 'Map of catalog names to their configurations.'
|
|
20
|
+
},
|
|
21
|
+
createdAt: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
format: 'date-time',
|
|
24
|
+
description: 'ISO 8601 timestamp of when the entity config was created.'
|
|
25
|
+
},
|
|
26
|
+
updatedAt: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
format: 'date-time',
|
|
29
|
+
description: 'ISO 8601 timestamp of when the entity config was last updated.'
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
required: ['createdAt', 'updatedAt'],
|
|
33
|
+
additionalProperties: false,
|
|
34
|
+
description: 'Project catalogs configuration.'
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
'#': {
|
|
40
|
+
capsuleName: {
|
|
41
|
+
type: CapsulePropertyTypes.Literal,
|
|
42
|
+
value: capsule['#']
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}, {
|
|
47
|
+
extendsCapsule: '@stream44.studio/t44/caps/WorkspaceEntityConfig',
|
|
48
|
+
importMeta: import.meta,
|
|
49
|
+
importStack: makeImportStack(),
|
|
50
|
+
capsuleName: capsule['#'],
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
capsule['#'] = '@stream44.studio/t44/structs/ProjectCatalogsConfig'
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
|
|
2
|
+
export async function capsule({
|
|
3
|
+
encapsulate,
|
|
4
|
+
CapsulePropertyTypes,
|
|
5
|
+
makeImportStack
|
|
6
|
+
}: any) {
|
|
7
|
+
return encapsulate({
|
|
8
|
+
'#@stream44.studio/encapsulate/spine-contracts/CapsuleSpineContract.v0': {
|
|
9
|
+
'#@stream44.studio/t44/caps/ConfigSchemaStruct': {
|
|
10
|
+
as: 'schema',
|
|
11
|
+
options: {
|
|
12
|
+
'#': {
|
|
13
|
+
schema: {
|
|
14
|
+
type: 'object',
|
|
15
|
+
properties: {
|
|
16
|
+
deployments: {
|
|
17
|
+
type: 'object',
|
|
18
|
+
additionalProperties: {
|
|
19
|
+
type: 'object',
|
|
20
|
+
additionalProperties: true
|
|
21
|
+
},
|
|
22
|
+
description: 'Map of deployment names to their configurations.'
|
|
23
|
+
},
|
|
24
|
+
createdAt: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
format: 'date-time',
|
|
27
|
+
description: 'ISO 8601 timestamp of when the entity config was created.'
|
|
28
|
+
},
|
|
29
|
+
updatedAt: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
format: 'date-time',
|
|
32
|
+
description: 'ISO 8601 timestamp of when the entity config was last updated.'
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
required: ['createdAt', 'updatedAt'],
|
|
36
|
+
additionalProperties: false,
|
|
37
|
+
description: 'Project deployment configurations for deployment providers.'
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
'#': {
|
|
43
|
+
capsuleName: {
|
|
44
|
+
type: CapsulePropertyTypes.Literal,
|
|
45
|
+
value: capsule['#']
|
|
46
|
+
},
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}, {
|
|
50
|
+
extendsCapsule: '@stream44.studio/t44/caps/WorkspaceEntityConfig',
|
|
51
|
+
importMeta: import.meta,
|
|
52
|
+
importStack: makeImportStack(),
|
|
53
|
+
capsuleName: capsule['#'],
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
capsule['#'] = '@stream44.studio/t44/structs/ProjectDeploymentConfig'
|