@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
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
env: {
|
|
17
|
+
type: 'object',
|
|
18
|
+
properties: {
|
|
19
|
+
default: {
|
|
20
|
+
type: 'object',
|
|
21
|
+
additionalProperties: { type: 'string' },
|
|
22
|
+
description: 'Default environment variables.'
|
|
23
|
+
},
|
|
24
|
+
force: {
|
|
25
|
+
type: 'object',
|
|
26
|
+
additionalProperties: { type: 'string' },
|
|
27
|
+
description: 'Forced environment variables that override defaults.'
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
additionalProperties: true,
|
|
31
|
+
description: 'Shell environment variable configuration.'
|
|
32
|
+
},
|
|
33
|
+
createdAt: {
|
|
34
|
+
type: 'string',
|
|
35
|
+
format: 'date-time',
|
|
36
|
+
description: 'ISO 8601 timestamp of when the entity config was created.'
|
|
37
|
+
},
|
|
38
|
+
updatedAt: {
|
|
39
|
+
type: 'string',
|
|
40
|
+
format: 'date-time',
|
|
41
|
+
description: 'ISO 8601 timestamp of when the entity config was last updated.'
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
required: ['createdAt', 'updatedAt'],
|
|
45
|
+
additionalProperties: true,
|
|
46
|
+
description: 'Workspace shell configuration with environment variables.'
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
'#': {
|
|
52
|
+
capsuleName: {
|
|
53
|
+
type: CapsulePropertyTypes.Literal,
|
|
54
|
+
value: capsule['#']
|
|
55
|
+
},
|
|
56
|
+
env: {
|
|
57
|
+
type: CapsulePropertyTypes.GetterFunction,
|
|
58
|
+
value: async function (this: any): Promise<object> {
|
|
59
|
+
const shellConfig = await this.config
|
|
60
|
+
|
|
61
|
+
if (!shellConfig?.env) {
|
|
62
|
+
return {}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const defaultEnv = shellConfig.env.default || {}
|
|
66
|
+
const forceEnv = shellConfig.env.force || {}
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
...defaultEnv,
|
|
70
|
+
...forceEnv
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}, {
|
|
77
|
+
extendsCapsule: '@stream44.studio/t44/caps/WorkspaceEntityConfig',
|
|
78
|
+
importMeta: import.meta,
|
|
79
|
+
importStack: makeImportStack(),
|
|
80
|
+
capsuleName: capsule['#'],
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
capsule['#'] = '@stream44.studio/t44/structs/WorkspaceShellConfig'
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
createdAt: {
|
|
17
|
+
type: 'string',
|
|
18
|
+
format: 'date-time',
|
|
19
|
+
description: 'ISO 8601 timestamp when the project publishing fact was created'
|
|
20
|
+
},
|
|
21
|
+
updatedAt: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
format: 'date-time',
|
|
24
|
+
description: 'ISO 8601 timestamp when the project publishing fact was last updated'
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
additionalProperties: true
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
'#': {
|
|
33
|
+
capsuleName: {
|
|
34
|
+
type: CapsulePropertyTypes.Literal,
|
|
35
|
+
value: capsule['#']
|
|
36
|
+
},
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}, {
|
|
40
|
+
extendsCapsule: '@stream44.studio/t44/caps/WorkspaceEntityFact',
|
|
41
|
+
importMeta: import.meta,
|
|
42
|
+
importStack: makeImportStack(),
|
|
43
|
+
capsuleName: capsule['#'],
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
capsule['#'] = '@stream44.studio/t44/structs/patterns/git-scm.com/ProjectPublishingFact'
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2021",
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"lib": [
|
|
6
|
+
"ES2021",
|
|
7
|
+
"DOM"
|
|
8
|
+
],
|
|
9
|
+
"types": [
|
|
10
|
+
"bun",
|
|
11
|
+
"node"
|
|
12
|
+
],
|
|
13
|
+
"moduleResolution": "bundler",
|
|
14
|
+
"strict": true,
|
|
15
|
+
"esModuleInterop": true,
|
|
16
|
+
"skipLibCheck": true,
|
|
17
|
+
"forceConsistentCasingInFileNames": true,
|
|
18
|
+
"resolveJsonModule": true,
|
|
19
|
+
"allowSyntheticDefaultImports": true,
|
|
20
|
+
"baseUrl": ".",
|
|
21
|
+
"paths": {
|
|
22
|
+
"@stream44.studio/t44/*": [
|
|
23
|
+
"./*"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"include": [
|
|
28
|
+
"**/*.ts"
|
|
29
|
+
],
|
|
30
|
+
"exclude": [
|
|
31
|
+
"node_modules"
|
|
32
|
+
]
|
|
33
|
+
}
|
package/workspace-rt.ts
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/// <reference types="bun" />
|
|
3
|
+
/// <reference types="node" />
|
|
4
|
+
|
|
5
|
+
const startTime = Date.now()
|
|
6
|
+
|
|
7
|
+
import { join, resolve } 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 findWorkspaceRoot(): Promise<string> {
|
|
15
|
+
const isInitCommand = process.argv.includes('init')
|
|
16
|
+
if (isInitCommand) {
|
|
17
|
+
const { mkdir, writeFile } = await import('fs/promises')
|
|
18
|
+
const workspaceDir = join(process.cwd(), '.workspace')
|
|
19
|
+
const workspaceConfigPath = join(workspaceDir, 'workspace.yaml')
|
|
20
|
+
|
|
21
|
+
await mkdir(workspaceDir, { recursive: true })
|
|
22
|
+
const workspaceYaml = `extends:\n - '@stream44.studio/t44/workspace.yaml'\n`
|
|
23
|
+
await writeFile(workspaceConfigPath, workspaceYaml)
|
|
24
|
+
|
|
25
|
+
return process.cwd()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
let currentDir = resolve(process.cwd())
|
|
29
|
+
|
|
30
|
+
while (true) {
|
|
31
|
+
const workspaceConfigPath = join(currentDir, '.workspace', 'workspace.yaml')
|
|
32
|
+
try {
|
|
33
|
+
await access(workspaceConfigPath)
|
|
34
|
+
return currentDir
|
|
35
|
+
} catch {
|
|
36
|
+
// File doesn't exist, continue traversing
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const parentDir = resolve(currentDir, '..')
|
|
40
|
+
if (parentDir === currentDir) {
|
|
41
|
+
throw new Error(
|
|
42
|
+
`Could not find workspace root. Please run this command from within a workspace directory ` +
|
|
43
|
+
`(a directory containing .workspace/workspace.yaml).`
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
currentDir = parentDir
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export async function run(encapsulateHandler: any, runHandler: any, options?: { importMeta?: { dir: string } }) {
|
|
51
|
+
|
|
52
|
+
const timing = process.argv.includes('--trace') ? TimingObserver({ startTime }) : undefined
|
|
53
|
+
|
|
54
|
+
timing?.recordMajor('INIT SPINE')
|
|
55
|
+
|
|
56
|
+
const eventsByKey = new Map<string, any>()
|
|
57
|
+
|
|
58
|
+
const workspaceRootDir = await findWorkspaceRoot()
|
|
59
|
+
|
|
60
|
+
const { encapsulate, freeze, CapsulePropertyTypes, makeImportStack, hoistSnapshot } = await CapsuleSpineFactory({
|
|
61
|
+
spineFilesystemRoot: workspaceRootDir,
|
|
62
|
+
capsuleModuleProjectionRoot: (import.meta as any).dir,
|
|
63
|
+
enableCallerStackInference: true,
|
|
64
|
+
spineContracts: {
|
|
65
|
+
['#' + CapsuleSpineContract['#']]: CapsuleSpineContract
|
|
66
|
+
},
|
|
67
|
+
timing,
|
|
68
|
+
onMembraneEvent: timing ? (event: any) => {
|
|
69
|
+
const instanceId = event.target?.spineContractCapsuleInstanceId
|
|
70
|
+
const eventIndex = event.eventIndex
|
|
71
|
+
|
|
72
|
+
// Store event by composite key (instance ID + event index)
|
|
73
|
+
const key = `${eventIndex}`
|
|
74
|
+
eventsByKey.set(key, event)
|
|
75
|
+
|
|
76
|
+
let capsuleRef = event.target?.capsuleSourceLineRef
|
|
77
|
+
let prop = event.target?.prop
|
|
78
|
+
let callerLocation = event.caller ? `${event.caller.filepath}:${event.caller.line}` : 'unknown'
|
|
79
|
+
const eventType = event.event
|
|
80
|
+
|
|
81
|
+
// For call-result events, look up the original call event to get all info
|
|
82
|
+
if (eventType === 'call-result') {
|
|
83
|
+
const callKey = `${event.callEventIndex}`
|
|
84
|
+
const callEvent = eventsByKey.get(callKey)
|
|
85
|
+
if (callEvent) {
|
|
86
|
+
capsuleRef = callEvent.target?.capsuleSourceLineRef || capsuleRef
|
|
87
|
+
prop = callEvent.target?.prop || prop
|
|
88
|
+
if (callEvent.caller) {
|
|
89
|
+
callerLocation = `${callEvent.caller.filepath}:${callEvent.caller.line}`
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
console.error(
|
|
95
|
+
chalk.gray(`[${eventIndex}]`),
|
|
96
|
+
chalk.cyan(eventType.padEnd(12)),
|
|
97
|
+
chalk.yellow(capsuleRef),
|
|
98
|
+
chalk.magenta(`.${prop}`),
|
|
99
|
+
chalk.dim(`from ${callerLocation}`)
|
|
100
|
+
)
|
|
101
|
+
} : undefined
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
timing?.recordMajor('ENCAPSULATE')
|
|
105
|
+
|
|
106
|
+
const exportedApi = await encapsulateHandler({
|
|
107
|
+
encapsulate,
|
|
108
|
+
CapsulePropertyTypes,
|
|
109
|
+
makeImportStack
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
timing?.recordMajor('FREEZE')
|
|
113
|
+
|
|
114
|
+
const snapshot = await freeze()
|
|
115
|
+
|
|
116
|
+
timing?.recordMajor('HOIST SNAPSHOT')
|
|
117
|
+
|
|
118
|
+
const { run } = await hoistSnapshot({
|
|
119
|
+
snapshot
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
timing?.recordMajor('RUN')
|
|
123
|
+
|
|
124
|
+
const result = await run({
|
|
125
|
+
overrides: {
|
|
126
|
+
['@stream44.studio/t44/caps/WorkspaceConfig']: {
|
|
127
|
+
'#': {
|
|
128
|
+
workspaceRootDir
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
['@stream44.studio/t44/caps/ProjectTest']: {
|
|
132
|
+
'#': {
|
|
133
|
+
testRootDir: options?.importMeta?.dir
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
['@stream44.studio/t44-ipfs.tech/caps/IpfsWorkbench']: {
|
|
137
|
+
'#': {
|
|
138
|
+
cacheDir: join(workspaceRootDir, '.~o/workspace.foundation', '@t44.sh~t44-ipfs.tech~caps~IpfsWorkbench', 'daemons')
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}, async (opts) => {
|
|
143
|
+
return runHandler({
|
|
144
|
+
...opts,
|
|
145
|
+
...(exportedApi || {})
|
|
146
|
+
})
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
timing?.recordMajor('DONE')
|
|
150
|
+
|
|
151
|
+
return result
|
|
152
|
+
}
|
package/workspace.yaml
ADDED