spawnfile 0.1.11 → 0.1.13

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.
Files changed (220) hide show
  1. package/README.md +21 -3
  2. package/dist/auth/runtimeCredentials.js +18 -2
  3. package/dist/cli/devCommands.d.ts +3 -0
  4. package/dist/cli/devCommands.js +115 -0
  5. package/dist/cli/lifecycleCommands.js +103 -1
  6. package/dist/cli/modelCommands.js +3 -0
  7. package/dist/cli/resolveCommandInput.d.ts +19 -0
  8. package/dist/cli/resolveCommandInput.js +25 -0
  9. package/dist/cli/runCli.d.ts +10 -1
  10. package/dist/cli/runCli.js +41 -13
  11. package/dist/cli/runtimeCommands.js +1 -0
  12. package/dist/cli/statusCommand.d.ts +43 -0
  13. package/dist/cli/statusCommand.js +428 -0
  14. package/dist/cli/surfaceCommands.js +4 -0
  15. package/dist/compiler/agentSurfaces.js +2 -4
  16. package/dist/compiler/buildProject.d.ts +9 -1
  17. package/dist/compiler/buildProject.js +44 -5
  18. package/dist/compiler/compileProject.d.ts +2 -0
  19. package/dist/compiler/compileProject.js +22 -11
  20. package/dist/compiler/containerArtifacts.d.ts +1 -0
  21. package/dist/compiler/containerArtifacts.js +208 -32
  22. package/dist/compiler/containerArtifactsPlans.js +7 -4
  23. package/dist/compiler/containerArtifactsRender.d.ts +7 -1
  24. package/dist/compiler/containerArtifactsRender.js +31 -69
  25. package/dist/compiler/containerArtifactsTypes.d.ts +9 -0
  26. package/dist/compiler/containerEntrypointRender.js +22 -32
  27. package/dist/compiler/containerPackageRender.d.ts +15 -0
  28. package/dist/compiler/containerPackageRender.js +63 -0
  29. package/dist/compiler/containerTargetResources.js +3 -1
  30. package/dist/compiler/index.d.ts +1 -0
  31. package/dist/compiler/index.js +1 -0
  32. package/dist/compiler/moltnetArtifacts.js +21 -1
  33. package/dist/compiler/moltnetBinaries.d.ts +4 -1
  34. package/dist/compiler/moltnetBinaries.js +24 -3
  35. package/dist/compiler/moltnetClientConfig.d.ts +1 -1
  36. package/dist/compiler/moltnetClientConfig.js +14 -16
  37. package/dist/compiler/moltnetNodeConfig.js +2 -4
  38. package/dist/compiler/moltnetResolution.js +1 -1
  39. package/dist/compiler/moltnetRoomMemberships.js +1 -2
  40. package/dist/compiler/moltnetRuntimeConfig.d.ts +1 -1
  41. package/dist/compiler/moltnetRuntimeConfig.js +9 -10
  42. package/dist/compiler/networkBinding.d.ts +14 -0
  43. package/dist/compiler/networkBinding.js +34 -0
  44. package/dist/compiler/publishProject.d.ts +13 -0
  45. package/dist/compiler/publishProject.js +72 -0
  46. package/dist/compiler/runProject.d.ts +26 -12
  47. package/dist/compiler/runProject.js +109 -126
  48. package/dist/compiler/runProjectAuth.d.ts +5 -0
  49. package/dist/compiler/runProjectAuth.js +98 -0
  50. package/dist/compiler/runProjectDocker.d.ts +19 -0
  51. package/dist/compiler/runProjectDocker.js +202 -0
  52. package/dist/compiler/types.d.ts +1 -2
  53. package/dist/compiler/upProject.d.ts +6 -0
  54. package/dist/compiler/upProject.js +43 -8
  55. package/dist/compiler/view/buildOrganizationView.js +4 -1
  56. package/dist/compiler/view/declarations.d.ts +4 -0
  57. package/dist/compiler/view/declarations.js +104 -0
  58. package/dist/compiler/view/renderNetworks.js +1 -2
  59. package/dist/compiler/view/renderTree.js +6 -2
  60. package/dist/compiler/view/types.d.ts +64 -1
  61. package/dist/deployment/dockerInspect.d.ts +29 -0
  62. package/dist/deployment/dockerInspect.js +130 -0
  63. package/dist/deployment/dockerLabels.d.ts +16 -0
  64. package/dist/deployment/dockerLabels.js +32 -0
  65. package/dist/deployment/dockerLogs.d.ts +24 -0
  66. package/dist/deployment/dockerLogs.js +96 -0
  67. package/dist/deployment/dockerManager.d.ts +59 -0
  68. package/dist/deployment/dockerManager.js +76 -0
  69. package/dist/deployment/dockerProbeGateway.d.ts +16 -0
  70. package/dist/deployment/dockerProbeGateway.js +48 -0
  71. package/dist/deployment/dockerRecover.d.ts +17 -0
  72. package/dist/deployment/dockerRecover.js +129 -0
  73. package/dist/deployment/homeStore.d.ts +19 -0
  74. package/dist/deployment/homeStore.js +130 -0
  75. package/dist/deployment/index.d.ts +10 -0
  76. package/dist/deployment/index.js +10 -0
  77. package/dist/deployment/names.d.ts +3 -0
  78. package/dist/deployment/names.js +12 -0
  79. package/dist/deployment/record.d.ts +76 -0
  80. package/dist/deployment/record.js +174 -0
  81. package/dist/deployment/target.d.ts +35 -0
  82. package/dist/deployment/target.js +96 -0
  83. package/dist/dev/activity.d.ts +14 -0
  84. package/dist/dev/activity.js +48 -0
  85. package/dist/dev/docker.d.ts +16 -0
  86. package/dist/dev/docker.js +71 -0
  87. package/dist/dev/index.d.ts +2 -0
  88. package/dist/dev/index.js +2 -0
  89. package/dist/dev/project.d.ts +35 -0
  90. package/dist/dev/project.js +164 -0
  91. package/dist/distribution/buildDistributionReport.d.ts +22 -0
  92. package/dist/distribution/buildDistributionReport.js +51 -0
  93. package/dist/distribution/consumeImage.d.ts +29 -0
  94. package/dist/distribution/consumeImage.js +254 -0
  95. package/dist/distribution/consumeImageSupport.d.ts +18 -0
  96. package/dist/distribution/consumeImageSupport.js +63 -0
  97. package/dist/distribution/distributionReportSchema.d.ts +84 -0
  98. package/dist/distribution/distributionReportSchema.js +107 -0
  99. package/dist/distribution/dockerRunner.d.ts +5 -0
  100. package/dist/distribution/dockerRunner.js +21 -0
  101. package/dist/distribution/extractImage.d.ts +25 -0
  102. package/dist/distribution/extractImage.js +96 -0
  103. package/dist/distribution/fingerprint.d.ts +2 -0
  104. package/dist/distribution/fingerprint.js +14 -0
  105. package/dist/distribution/imageRef.d.ts +9 -0
  106. package/dist/distribution/imageRef.js +65 -0
  107. package/dist/distribution/imageRuntimeAuth.d.ts +19 -0
  108. package/dist/distribution/imageRuntimeAuth.js +71 -0
  109. package/dist/distribution/index.d.ts +24 -0
  110. package/dist/distribution/index.js +16 -0
  111. package/dist/distribution/preflight.d.ts +11 -0
  112. package/dist/distribution/preflight.js +65 -0
  113. package/dist/distribution/projectImageView.d.ts +8 -0
  114. package/dist/distribution/projectImageView.js +83 -0
  115. package/dist/distribution/projectName.d.ts +1 -0
  116. package/dist/distribution/projectName.js +12 -0
  117. package/dist/distribution/renderImageInterface.d.ts +30 -0
  118. package/dist/distribution/renderImageInterface.js +86 -0
  119. package/dist/distribution/tarReader.d.ts +10 -0
  120. package/dist/distribution/tarReader.js +69 -0
  121. package/dist/distribution/types.d.ts +80 -0
  122. package/dist/distribution/types.js +4 -0
  123. package/dist/distribution/verifyDistributionReport.d.ts +12 -0
  124. package/dist/distribution/verifyDistributionReport.js +29 -0
  125. package/dist/filesystem/paths.d.ts +6 -0
  126. package/dist/filesystem/paths.js +11 -0
  127. package/dist/manifest/loadManifest.js +22 -2
  128. package/dist/manifest/renderSpawnfile.js +2 -4
  129. package/dist/manifest/schemas.d.ts +17 -41
  130. package/dist/manifest/surfaceSchemas.d.ts +19 -47
  131. package/dist/manifest/surfaceSchemas.js +3 -6
  132. package/dist/report/createReport.d.ts +7 -1
  133. package/dist/report/createReport.js +28 -1
  134. package/dist/report/types.d.ts +43 -0
  135. package/dist/runtime/common.d.ts +2 -0
  136. package/dist/runtime/common.js +1 -1
  137. package/dist/runtime/container.d.ts +1 -0
  138. package/dist/runtime/container.js +82 -15
  139. package/dist/runtime/index.d.ts +1 -0
  140. package/dist/runtime/index.js +1 -0
  141. package/dist/runtime/install.d.ts +1 -11
  142. package/dist/runtime/install.js +27 -30
  143. package/dist/runtime/openclaw/adapter.js +9 -1
  144. package/dist/runtime/openclaw/configAuth.d.ts +15 -0
  145. package/dist/runtime/openclaw/configAuth.js +46 -0
  146. package/dist/runtime/openclaw/runAuth.d.ts +6 -0
  147. package/dist/runtime/openclaw/runAuth.js +7 -55
  148. package/dist/runtime/openclaw/statusProbes.d.ts +2 -0
  149. package/dist/runtime/openclaw/statusProbes.js +31 -0
  150. package/dist/runtime/pi/adapter.d.ts +4 -0
  151. package/dist/runtime/pi/adapter.js +198 -0
  152. package/dist/runtime/pi/appActivitySource.d.ts +1 -0
  153. package/dist/runtime/pi/appActivitySource.js +87 -0
  154. package/dist/runtime/pi/appCoreSource.d.ts +1 -0
  155. package/dist/runtime/pi/appCoreSource.js +354 -0
  156. package/dist/runtime/pi/appPreludeSource.d.ts +1 -0
  157. package/dist/runtime/pi/appPreludeSource.js +103 -0
  158. package/dist/runtime/pi/appSource.d.ts +1 -0
  159. package/dist/runtime/pi/appSource.js +8 -0
  160. package/dist/runtime/pi/appTemplate.d.ts +28 -0
  161. package/dist/runtime/pi/appTemplate.js +144 -0
  162. package/dist/runtime/pi/runAuth.d.ts +2 -0
  163. package/dist/runtime/pi/runAuth.js +68 -0
  164. package/dist/runtime/picoclaw/adapter.js +10 -0
  165. package/dist/runtime/picoclaw/runAuth.d.ts +7 -0
  166. package/dist/runtime/picoclaw/runAuth.js +8 -68
  167. package/dist/runtime/picoclaw/statusProbes.d.ts +2 -0
  168. package/dist/runtime/picoclaw/statusProbes.js +100 -0
  169. package/dist/runtime/registry.d.ts +0 -5
  170. package/dist/runtime/registry.js +5 -12
  171. package/dist/runtime/statusProbes.d.ts +16 -0
  172. package/dist/runtime/statusProbes.js +41 -0
  173. package/dist/runtime/types.d.ts +53 -1
  174. package/dist/shared/errors.d.ts +6 -0
  175. package/dist/shared/errors.js +9 -0
  176. package/dist/status/buildStatus.d.ts +13 -0
  177. package/dist/status/buildStatus.js +266 -0
  178. package/dist/status/compileReport.d.ts +96 -0
  179. package/dist/status/compileReport.js +230 -0
  180. package/dist/status/compiledContainerObservations.d.ts +5 -0
  181. package/dist/status/compiledContainerObservations.js +63 -0
  182. package/dist/status/deploymentLogs.d.ts +12 -0
  183. package/dist/status/deploymentLogs.js +45 -0
  184. package/dist/status/deployments.d.ts +14 -0
  185. package/dist/status/deployments.js +121 -0
  186. package/dist/status/imageStatusReport.d.ts +10 -0
  187. package/dist/status/imageStatusReport.js +73 -0
  188. package/dist/status/index.d.ts +14 -0
  189. package/dist/status/index.js +14 -0
  190. package/dist/status/moltnetProbes.d.ts +21 -0
  191. package/dist/status/moltnetProbes.js +240 -0
  192. package/dist/status/registryDrift.d.ts +28 -0
  193. package/dist/status/registryDrift.js +119 -0
  194. package/dist/status/renderStatus.d.ts +2 -0
  195. package/dist/status/renderStatus.js +230 -0
  196. package/dist/status/runtimeProbes.d.ts +13 -0
  197. package/dist/status/runtimeProbes.js +111 -0
  198. package/dist/status/selectionSubjects.d.ts +8 -0
  199. package/dist/status/selectionSubjects.js +77 -0
  200. package/dist/status/selectors.d.ts +14 -0
  201. package/dist/status/selectors.js +90 -0
  202. package/dist/status/traversal.d.ts +6 -0
  203. package/dist/status/traversal.js +15 -0
  204. package/dist/status/types.d.ts +113 -0
  205. package/dist/status/types.js +1 -0
  206. package/package.json +9 -2
  207. package/runtimes.yaml +44 -21
  208. package/dist/runtime/tinyclaw/adapter.d.ts +0 -2
  209. package/dist/runtime/tinyclaw/adapter.js +0 -284
  210. package/dist/runtime/tinyclaw/runAuth.d.ts +0 -2
  211. package/dist/runtime/tinyclaw/runAuth.js +0 -49
  212. package/dist/runtime/tinyclaw/scaffold-assets/AGENTS.md +0 -160
  213. package/dist/runtime/tinyclaw/scaffold-assets/CLAUDE.md +0 -5
  214. package/dist/runtime/tinyclaw/scaffold-assets/SOUL.md +0 -177
  215. package/dist/runtime/tinyclaw/scaffold.d.ts +0 -2
  216. package/dist/runtime/tinyclaw/scaffold.js +0 -24
  217. package/dist/runtime/tinyclaw/schedules.d.ts +0 -9
  218. package/dist/runtime/tinyclaw/schedules.js +0 -62
  219. package/dist/runtime/tinyclaw/surfaces.d.ts +0 -8
  220. package/dist/runtime/tinyclaw/surfaces.js +0 -94
@@ -0,0 +1,6 @@
1
+ import type { OrganizationView, OrganizationViewTreeNode } from "../compiler/index.js";
2
+ export declare const flattenOrganizationNodes: (view: OrganizationView) => OrganizationViewTreeNode[];
3
+ export declare const countNodesByKind: (nodes: OrganizationViewTreeNode[]) => {
4
+ agents: number;
5
+ teams: number;
6
+ };
@@ -0,0 +1,15 @@
1
+ export const flattenOrganizationNodes = (view) => {
2
+ const nodes = [];
3
+ const visit = (node) => {
4
+ nodes.push(node);
5
+ for (const child of node.children) {
6
+ visit(child.node);
7
+ }
8
+ };
9
+ visit(view.root);
10
+ return nodes;
11
+ };
12
+ export const countNodesByKind = (nodes) => ({
13
+ agents: nodes.filter((node) => node.kind === "agent").length,
14
+ teams: nodes.filter((node) => node.kind === "team").length
15
+ });
@@ -0,0 +1,113 @@
1
+ import type { OrganizationView } from "../compiler/index.js";
2
+ export type StatusSeverity = "error" | "ok" | "unknown" | "warn";
3
+ export type StatusExitCode = 0 | 1 | 2;
4
+ export type StatusOutputMode = "json" | "pretty" | "quiet";
5
+ export type StatusSelectorKind = "agent" | "network" | "runtime" | "team";
6
+ export interface StatusObservation {
7
+ details?: Record<string, unknown>;
8
+ key: string;
9
+ label: string;
10
+ message: string;
11
+ severity: StatusSeverity;
12
+ source: "compile_report" | "declared" | "deployment" | "input" | "network" | "runtime";
13
+ subject: string;
14
+ }
15
+ export interface StatusObservationCounts {
16
+ error: number;
17
+ ok: number;
18
+ unknown: number;
19
+ warn: number;
20
+ }
21
+ export interface StatusSelection {
22
+ kind: StatusSelectorKind;
23
+ label: string;
24
+ subjectKeys: string[];
25
+ value: string;
26
+ }
27
+ export interface StatusInputFailure {
28
+ exitCode: 2;
29
+ message: string;
30
+ }
31
+ export interface StatusCompileReportInfo {
32
+ compileFingerprint: string | null;
33
+ generatedAt: string | null;
34
+ outputDirectory: string | null;
35
+ path: string;
36
+ present: boolean;
37
+ root: string | null;
38
+ }
39
+ export interface StaticStatusSummary {
40
+ agents: number;
41
+ deployments: number;
42
+ networks: number;
43
+ runtimes: number;
44
+ teams: number;
45
+ }
46
+ export interface StatusDeploymentUnitLive {
47
+ checked: boolean;
48
+ containerId: string | null;
49
+ drift: string[];
50
+ exists: boolean | null;
51
+ exitCode: number | null;
52
+ finishedAt: string | null;
53
+ imageId: string | null;
54
+ message: string;
55
+ restartCount: number | null;
56
+ running: boolean | null;
57
+ severity: StatusSeverity;
58
+ startedAt: string | null;
59
+ status: string | null;
60
+ }
61
+ export interface StatusDeploymentUnitSummary {
62
+ containerId: string | null;
63
+ containerName: string | null;
64
+ contains: Array<{
65
+ id: string;
66
+ kind: string;
67
+ }>;
68
+ id: string;
69
+ imageId: string | null;
70
+ imageTag: string;
71
+ kind: "container";
72
+ live: StatusDeploymentUnitLive | null;
73
+ runtimeInstances: string[];
74
+ }
75
+ export interface StatusDeploymentSummary {
76
+ authProfile: string | null;
77
+ compileFingerprint: string;
78
+ createdAt: string;
79
+ manager: string;
80
+ name: string;
81
+ recordPath: string;
82
+ target: string;
83
+ units: StatusDeploymentUnitSummary[];
84
+ }
85
+ export interface StatusLiveRequest {
86
+ context: string | null;
87
+ deploymentName: string | null;
88
+ logs: boolean;
89
+ recover: boolean;
90
+ requested: boolean;
91
+ }
92
+ export interface StaticStatus {
93
+ compile: StatusCompileReportInfo;
94
+ deployments: StatusDeploymentSummary[];
95
+ inputPath: string;
96
+ live: StatusLiveRequest;
97
+ observations: StatusObservation[];
98
+ outputDirectory: string;
99
+ projectRoot: string | null;
100
+ selection: StatusSelection | null;
101
+ summary: StaticStatusSummary;
102
+ view: OrganizationView;
103
+ version: "spawnfile.status.v1";
104
+ }
105
+ export interface StatusCommandResult {
106
+ error?: string;
107
+ exitCode: StatusExitCode;
108
+ output?: string;
109
+ status?: StaticStatus;
110
+ }
111
+ export interface StatusRenderOptions {
112
+ mode: StatusOutputMode;
113
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spawnfile",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "Canonical source compiler for autonomous agents and teams.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -25,13 +25,20 @@
25
25
  "release:patch": "npm version patch && npm publish",
26
26
  "release:minor": "npm version minor && npm publish",
27
27
  "release:major": "npm version major && npm publish",
28
+ "runtime:images": "npm run runtime:openclaw-image && npm run runtime:picoclaw-image",
29
+ "runtime:openclaw-image": "docker build -f runtime-images/openclaw/Dockerfile -t noopolis/spawnfile-runtime-openclaw:2026.6.8-local runtime-images/openclaw",
30
+ "runtime:pi-base": "./scripts/build-pi-runtime-base.sh",
31
+ "runtime:picoclaw-image": "docker build -f runtime-images/picoclaw/Dockerfile -t noopolis/spawnfile-runtime-picoclaw:0.2.9-local runtime-images/picoclaw",
28
32
  "runtimes": "./scripts/runtimes.sh",
29
33
  "runtimes:sync": "./scripts/runtimes.sh && ./scripts/blueprints.sh",
30
34
  "test:e2e:docker-auth": "tsx src/e2e/cli.ts",
31
35
  "test:e2e:moltnet-team-chat": "tsx src/e2e/cli.ts moltnet-team-chat",
32
36
  "test:e2e:operational-smoke": "tsx src/e2e/cli.ts operational-smoke",
33
37
  "test": "vitest run",
34
- "typecheck": "tsc --project tsconfig.json --noEmit"
38
+ "typecheck": "tsc --project tsconfig.json --noEmit",
39
+ "test:e2e:distribution-image": "tsx src/e2e/cli.ts distribution-image",
40
+ "test:e2e:distribution-roundtrip": "tsx src/e2e/cli.ts distribution-roundtrip",
41
+ "test:e2e:pi-harness-org": "tsx src/e2e/cli.ts pi-harness-org"
35
42
  },
36
43
  "dependencies": {
37
44
  "commander": "^14.0.1",
package/runtimes.yaml CHANGED
@@ -14,49 +14,72 @@
14
14
  # pinned refs.
15
15
 
16
16
  runtimes:
17
+ daimon:
18
+ remote: git@github.com:noopolis/daimon.git
19
+ ref: v0.1.0
20
+ default_branch: main
21
+ install:
22
+ kind: container_image
23
+ image: noopolis/spawnfile-runtime-daimon
24
+ tag: 0.1.0
25
+ status: active
26
+
17
27
  openclaw:
18
28
  remote: git@github.com:openclaw/openclaw.git
19
- ref: v2026.3.13-1
29
+ ref: v2026.6.8
20
30
  default_branch: main
21
31
  install:
22
- kind: npm
23
- package: openclaw
24
- version: 2026.3.13
32
+ kind: container_image
33
+ image: noopolis/spawnfile-runtime-openclaw
34
+ tag: 2026.6.8
25
35
  status: active
26
36
 
27
37
  picoclaw:
28
38
  remote: git@github.com:sipeed/picoclaw.git
29
- ref: v0.2.5
39
+ ref: v0.2.9
30
40
  default_branch: main
31
41
  install:
32
- kind: github_release_archive
33
- repository: sipeed/picoclaw
34
- tag: v0.2.5
35
- binary: picoclaw
36
- assets:
37
- linux_amd64: picoclaw_Linux_x86_64.tar.gz
38
- linux_arm64: picoclaw_Linux_arm64.tar.gz
42
+ kind: container_image
43
+ image: noopolis/spawnfile-runtime-picoclaw
44
+ tag: 0.2.9
39
45
  status: active
40
46
 
41
- tinyclaw:
42
- remote: git@github.com:TinyAGI/tinyclaw.git
43
- ref: v0.0.20
47
+ pi:
48
+ remote: git@github.com:earendil-works/pi.git
49
+ ref: v0.79.9
44
50
  default_branch: main
45
51
  install:
46
- kind: github_release_bundle
47
- repository: TinyAGI/tinyagi
48
- tag: v0.0.20
49
- asset: tinyagi-bundle.tar.gz
52
+ kind: npm
53
+ package: "@earendil-works/pi-coding-agent"
54
+ version: 0.79.9
50
55
  status: active
51
56
 
57
+ hermes-agent:
58
+ remote: git@github.com:NousResearch/hermes-agent.git
59
+ ref: v2026.6.5
60
+ default_branch: main
61
+ status: exploratory
62
+
52
63
  nullclaw:
53
64
  remote: git@github.com:nullclaw/nullclaw.git
54
- ref: v2026.3.17
65
+ ref: v2026.5.29
66
+ default_branch: main
67
+ status: exploratory
68
+
69
+ opencode:
70
+ remote: git@github.com:anomalyco/opencode.git
71
+ ref: v1.16.2
72
+ default_branch: dev
73
+ status: exploratory
74
+
75
+ openfang:
76
+ remote: git@github.com:RightNow-AI/openfang.git
77
+ ref: v0.6.9
55
78
  default_branch: main
56
79
  status: exploratory
57
80
 
58
81
  zeroclaw:
59
82
  remote: git@github.com:zeroclaw-labs/zeroclaw.git
60
- ref: v0.5.0
83
+ ref: v0.7.5
61
84
  default_branch: master
62
85
  status: exploratory
@@ -1,2 +0,0 @@
1
- import type { RuntimeAdapter } from "../types.js";
2
- export declare const tinyClawAdapter: RuntimeAdapter;
@@ -1,284 +0,0 @@
1
- import { listEffectiveExecutionModelTargets } from "../../compiler/modelEnv.js";
2
- import { SpawnfileError } from "../../shared/index.js";
3
- import { createCapability, createAgentCapabilities, createDocumentFiles, createSkillFiles } from "../common.js";
4
- import { prepareTinyClawRuntimeAuth } from "./runAuth.js";
5
- import { createTinyClawAgentScaffold } from "./scaffold.js";
6
- import { assertSupportedTinyClawSurfaces, buildTinyClawChannels, resolveTinyClawSurfaceTokenBindings } from "./surfaces.js";
7
- import { createScheduleDiagnostics, createTinyClawSchedulesFile, scheduleOutcomeFor } from "./schedules.js";
8
- const WORKSPACE_PLACEHOLDER = "<workspace-path>";
9
- const SUPPORTED_TINYCLAW_OPENAI_MODEL_PREFIXES = ["gpt-5"];
10
- const TINYCLAW_START_SCRIPT = `
11
- set -euo pipefail
12
- PIDS=()
13
- node <runtime-root>/packages/main/dist/index.js &
14
- PIDS+=("$!")
15
- sleep 1
16
- while IFS= read -r channel; do
17
- case "$channel" in
18
- discord)
19
- node <runtime-root>/packages/channels/dist/discord.js &
20
- PIDS+=("$!")
21
- ;;
22
- telegram)
23
- node <runtime-root>/packages/channels/dist/telegram.js &
24
- PIDS+=("$!")
25
- ;;
26
- whatsapp)
27
- node <runtime-root>/packages/channels/dist/whatsapp.js &
28
- PIDS+=("$!")
29
- ;;
30
- esac
31
- done < <(python3 - <<'PY'
32
- import json
33
- import os
34
-
35
- settings_path = os.path.join(os.environ["TINYAGI_HOME"], "settings.json")
36
- try:
37
- with open(settings_path, encoding="utf-8") as handle:
38
- settings = json.load(handle)
39
- except FileNotFoundError:
40
- raise SystemExit(0)
41
-
42
- for channel in settings.get("channels", {}).get("enabled", []):
43
- print(channel)
44
- PY
45
- )
46
- terminate_children() {
47
- for pid in "\${PIDS[@]:-}"; do
48
- kill "$pid" 2>/dev/null || true
49
- done
50
- }
51
- trap terminate_children INT TERM EXIT
52
- status=0
53
- for pid in "\${PIDS[@]}"; do
54
- if ! wait "$pid"; then
55
- status=1
56
- fi
57
- done
58
- exit "$status"
59
- `.trim();
60
- const isSupportedTinyClawOpenAiModel = (modelName) => SUPPORTED_TINYCLAW_OPENAI_MODEL_PREFIXES.some((prefix) => modelName.startsWith(prefix));
61
- const buildTinyClawSettings = (node) => {
62
- const [primary] = listEffectiveExecutionModelTargets(node.execution);
63
- const agentEntry = {
64
- name: node.name,
65
- provider: primary?.provider ?? "anthropic",
66
- model: primary?.name ?? "opus",
67
- working_directory: `${WORKSPACE_PLACEHOLDER}/${node.name}`
68
- };
69
- const channels = buildTinyClawChannels(node.surfaces);
70
- const config = {
71
- workspace: {
72
- path: WORKSPACE_PLACEHOLDER,
73
- name: "workspace"
74
- },
75
- channels: {
76
- enabled: channels.enabled,
77
- ...channels.config
78
- },
79
- agents: {
80
- [node.name]: agentEntry
81
- },
82
- models: {
83
- provider: primary?.provider ?? "anthropic"
84
- },
85
- monitoring: {
86
- heartbeat_interval: 3600
87
- }
88
- };
89
- return `${JSON.stringify(config, null, 2)}\n`;
90
- };
91
- const parseJsonFile = (input, filePath) => {
92
- const file = input.emittedFiles.find((entry) => entry.path === filePath);
93
- if (!file) {
94
- throw new Error(`TinyClaw target ${input.id} is missing ${filePath}`);
95
- }
96
- return JSON.parse(file.content);
97
- };
98
- const mergeTinyClawTargets = async (inputs) => {
99
- const agentInputs = inputs.filter((input) => input.kind === "agent");
100
- if (agentInputs.length === 0) {
101
- return [];
102
- }
103
- const mergedAgents = {};
104
- const mergedTeams = {};
105
- const enabledChannels = new Set();
106
- let hasDiscordChannel = false;
107
- let hasWhatsappChannel = false;
108
- let hasTelegramChannel = false;
109
- const workspaceFiles = agentInputs.flatMap((input) => input.emittedFiles.filter((file) => file.path !== "settings.json"));
110
- const schedulesFile = createTinyClawSchedulesFile(agentInputs);
111
- let mergedBase = null;
112
- for (const input of agentInputs) {
113
- const settings = parseJsonFile(input, "settings.json");
114
- const channels = settings.channels ?? {};
115
- mergedBase ??= settings;
116
- Object.assign(mergedAgents, settings.agents ?? {});
117
- for (const channel of (channels.enabled ?? []).filter(Boolean)) {
118
- enabledChannels.add(channel);
119
- }
120
- if (channels.discord) {
121
- hasDiscordChannel = true;
122
- }
123
- if (channels.telegram) {
124
- hasTelegramChannel = true;
125
- }
126
- if (channels.whatsapp) {
127
- hasWhatsappChannel = true;
128
- }
129
- }
130
- for (const input of inputs.filter((entry) => entry.kind === "team")) {
131
- if (!input.emittedFiles.some((file) => file.path === "tinyclaw-team.json")) {
132
- continue;
133
- }
134
- const teamConfig = parseJsonFile(input, "tinyclaw-team.json");
135
- Object.assign(mergedTeams, teamConfig.teams ?? {});
136
- }
137
- const mergedSettings = {
138
- ...(mergedBase ?? {}),
139
- agents: mergedAgents,
140
- ...(Object.keys(mergedTeams).length > 0 ? { teams: mergedTeams } : {}),
141
- channels: {
142
- ...((mergedBase?.channels ?? {})),
143
- ...(hasDiscordChannel ? { discord: {} } : {}),
144
- ...(hasTelegramChannel ? { telegram: {} } : {}),
145
- ...(hasWhatsappChannel ? { whatsapp: {} } : {}),
146
- enabled: [...enabledChannels].sort()
147
- },
148
- workspace: {
149
- ...((mergedBase?.workspace ?? {})),
150
- name: mergedBase?.workspace?.name ?? "workspace",
151
- path: WORKSPACE_PLACEHOLDER
152
- }
153
- };
154
- return [
155
- {
156
- files: [
157
- ...workspaceFiles,
158
- ...(schedulesFile ? [schedulesFile] : []),
159
- {
160
- content: `${JSON.stringify(mergedSettings, null, 2)}\n`,
161
- path: "settings.json"
162
- }
163
- ],
164
- configEnvBindings: resolveTinyClawSurfaceTokenBindings(agentInputs),
165
- id: "tinyclaw-runtime",
166
- sourceIds: agentInputs.map((input) => input.id)
167
- }
168
- ];
169
- };
170
- export const tinyClawAdapter = {
171
- assertSupportedModelTarget(target) {
172
- if (target.endpoint) {
173
- throw new SpawnfileError("validation_error", "TinyClaw custom or local endpoints are not supported in Spawnfile v0.1");
174
- }
175
- if (target.provider === "anthropic") {
176
- if (target.auth.method === "claude-code" || target.auth.method === "api_key") {
177
- return;
178
- }
179
- }
180
- else if (target.provider === "openai") {
181
- if (!isSupportedTinyClawOpenAiModel(target.name)) {
182
- throw new SpawnfileError("validation_error", `TinyClaw OpenAI models must use the runtime's Codex/GPT-5 path; received ${target.name}`);
183
- }
184
- if (target.auth.method === "codex" || target.auth.method === "api_key") {
185
- return;
186
- }
187
- }
188
- else if (target.provider === "opencode" && target.auth.method === "none") {
189
- return;
190
- }
191
- throw new SpawnfileError("validation_error", `TinyClaw does not support model auth method ${target.auth.method} for provider ${target.provider}`);
192
- },
193
- assertSupportedSurfaces(surfaces) {
194
- assertSupportedTinyClawSurfaces(surfaces);
195
- },
196
- container: {
197
- configFileName: "settings.json",
198
- configEnvBindings: [
199
- {
200
- envName: "ANTHROPIC_API_KEY",
201
- jsonPath: "models.anthropic.api_key"
202
- },
203
- {
204
- envName: "OPENAI_API_KEY",
205
- jsonPath: "models.openai.api_key"
206
- }
207
- ],
208
- homeEnv: "TINYAGI_HOME",
209
- globalNpmPackages: ["@anthropic-ai/claude-code", "@openai/codex"],
210
- instancePaths: {
211
- configPathTemplate: "<instance-root>/tinyagi/<config-file>",
212
- homePathTemplate: "<instance-root>/tinyagi",
213
- sourceWorkspacePathTemplate: "<instance-root>/workspace/<agent-name>",
214
- workspacePathTemplate: "<instance-root>/workspace"
215
- },
216
- port: 3777,
217
- portEnv: "TINYAGI_API_PORT",
218
- standaloneBaseImage: "node:22-bookworm-slim",
219
- startCommand: ["bash", "-lc", TINYCLAW_START_SCRIPT],
220
- systemDeps: ["bash", "ca-certificates", "curl", "g++", "make", "python3", "tar"]
221
- },
222
- systemInstructionSurface: {
223
- placement: "append_pointer",
224
- resolvePath({ node }) {
225
- return `workspace/${node.name}/AGENTS.md`;
226
- }
227
- },
228
- async compileAgent(node) {
229
- const scheduleOutcome = scheduleOutcomeFor(node);
230
- return {
231
- capabilities: createAgentCapabilities(node, {
232
- mcpOutcome: node.mcpServers.length > 0 ? "degraded" : "supported",
233
- scheduleMessage: scheduleOutcome.message,
234
- scheduleOutcome: scheduleOutcome.outcome
235
- }),
236
- diagnostics: createScheduleDiagnostics(node),
237
- files: [
238
- ...createDocumentFiles(`workspace/${node.name}`, node.docs),
239
- ...createSkillFiles(`workspace/${node.name}/.agents/skills`, node.skills),
240
- ...createSkillFiles(`workspace/${node.name}/.claude/skills`, node.skills),
241
- {
242
- content: buildTinyClawSettings(node),
243
- path: "settings.json"
244
- }
245
- ]
246
- };
247
- },
248
- async createContainerTargets(inputs) {
249
- return mergeTinyClawTargets(inputs);
250
- },
251
- async compileTeam(node) {
252
- const agentIds = node.members
253
- .filter((member) => member.kind === "agent")
254
- .map((member) => member.id);
255
- const leadAgent = node.lead
256
- ? node.members.find((member) => member.id === node.lead && member.kind === "agent")
257
- : null;
258
- const teamConfig = {
259
- name: node.name,
260
- agents: agentIds,
261
- ...(leadAgent ? { leader_agent: leadAgent.id } : {})
262
- };
263
- return {
264
- capabilities: [
265
- createCapability("team.members", "supported"),
266
- createCapability("team.mode", node.mode === "hierarchical" ? "supported" : "degraded", "TinyClaw only supports leader-led teams"),
267
- createCapability("team.lead", leadAgent ? "supported" : "degraded", leadAgent ? "" : "TinyClaw requires a concrete leader_agent"),
268
- createCapability("team.external", "degraded", "TinyClaw does not enforce external boundary"),
269
- createCapability("team.shared", "supported"),
270
- createCapability("team.nested", "degraded", "TinyClaw nested teams flatten in v0.1")
271
- ],
272
- diagnostics: [],
273
- files: [
274
- {
275
- content: `${JSON.stringify({ teams: { [node.name]: teamConfig } }, null, 2)}\n`,
276
- path: "tinyclaw-team.json"
277
- }
278
- ]
279
- };
280
- },
281
- name: "tinyclaw",
282
- prepareRuntimeAuth: prepareTinyClawRuntimeAuth,
283
- scaffoldAgentProject: createTinyClawAgentScaffold
284
- };
@@ -1,2 +0,0 @@
1
- import type { RuntimeAuthPreparationInput, RuntimeAuthPreparationResult } from "../types.js";
2
- export declare const prepareTinyClawRuntimeAuth: (input: RuntimeAuthPreparationInput) => Promise<RuntimeAuthPreparationResult>;
@@ -1,49 +0,0 @@
1
- import path from "node:path";
2
- import { loadImportedClaudeCodeCredential, loadImportedCodexCredential } from "../../auth/index.js";
3
- import { ensureDirectory, readUtf8File, writeUtf8File } from "../../filesystem/index.js";
4
- const resolveRootfsSourcePath = (outputDirectory, containerPath) => path.join(outputDirectory, "container", "rootfs", ...path.posix.relative("/", containerPath).split("/"));
5
- const createMountArgs = (hostPath, containerPath) => [
6
- "-v",
7
- `${hostPath}:${containerPath}`
8
- ];
9
- const writeRuntimeAuthFile = async (input, relativePath, content) => {
10
- const hostPath = path.join(input.tempRoot, "runtime-auth", "tinyclaw", input.instance.id, ...relativePath.split("/"));
11
- await ensureDirectory(path.dirname(hostPath));
12
- await writeUtf8File(hostPath, content);
13
- return hostPath;
14
- };
15
- const writePatchedSettings = async (input, config) => {
16
- return writeRuntimeAuthFile(input, "settings.json", `${JSON.stringify(config, null, 2)}\n`);
17
- };
18
- export const prepareTinyClawRuntimeAuth = async (input) => {
19
- const coveredModelSecrets = [];
20
- const claudeCode = input.authProfile.imports["claude-code"]
21
- ? await loadImportedClaudeCodeCredential(input.authProfile.imports["claude-code"].path)
22
- : null;
23
- const codex = input.authProfile.imports.codex
24
- ? await loadImportedCodexCredential(input.authProfile.imports.codex.path)
25
- : null;
26
- if (input.instance.model_auth_methods.anthropic === "claude-code" &&
27
- claudeCode) {
28
- coveredModelSecrets.push("ANTHROPIC_API_KEY");
29
- }
30
- if (input.instance.model_auth_methods.openai === "codex" &&
31
- codex) {
32
- coveredModelSecrets.push("OPENAI_API_KEY");
33
- }
34
- const sourceConfig = JSON.parse(await readUtf8File(resolveRootfsSourcePath(input.outputDirectory, input.instance.config_path)));
35
- const patchedConfigPath = await writePatchedSettings(input, sourceConfig);
36
- const mountArgs = createMountArgs(patchedConfigPath, input.instance.config_path);
37
- if (input.instance.home_path && input.instance.model_auth_methods.anthropic === "claude-code" && claudeCode) {
38
- const mountedClaudePath = await writeRuntimeAuthFile(input, ".claude/.credentials.json", await readUtf8File(path.join(input.authProfile.imports["claude-code"].path, ".credentials.json")));
39
- mountArgs.push(...createMountArgs(mountedClaudePath, path.posix.join(input.instance.home_path, ".claude", ".credentials.json")));
40
- }
41
- if (input.instance.home_path && input.instance.model_auth_methods.openai === "codex" && codex) {
42
- const mountedAuthPath = await writeRuntimeAuthFile(input, ".codex/auth.json", await readUtf8File(path.join(input.authProfile.imports.codex.path, "auth.json")));
43
- mountArgs.push(...createMountArgs(mountedAuthPath, path.posix.join(input.instance.home_path, ".codex", "auth.json")));
44
- }
45
- return {
46
- coveredModelSecrets,
47
- mountArgs
48
- };
49
- };