spawnfile 0.1.11 → 0.1.12

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 (182) hide show
  1. package/README.md +13 -2
  2. package/dist/cli/lifecycleCommands.js +101 -1
  3. package/dist/cli/modelCommands.js +3 -0
  4. package/dist/cli/resolveCommandInput.d.ts +19 -0
  5. package/dist/cli/resolveCommandInput.js +25 -0
  6. package/dist/cli/runCli.d.ts +4 -1
  7. package/dist/cli/runCli.js +37 -13
  8. package/dist/cli/runtimeCommands.js +1 -0
  9. package/dist/cli/statusCommand.d.ts +42 -0
  10. package/dist/cli/statusCommand.js +394 -0
  11. package/dist/cli/surfaceCommands.js +4 -0
  12. package/dist/compiler/agentSurfaces.js +2 -4
  13. package/dist/compiler/compileProject.js +19 -10
  14. package/dist/compiler/containerArtifacts.d.ts +1 -0
  15. package/dist/compiler/containerArtifacts.js +208 -32
  16. package/dist/compiler/containerArtifactsPlans.js +7 -4
  17. package/dist/compiler/containerArtifactsRender.d.ts +7 -1
  18. package/dist/compiler/containerArtifactsRender.js +6 -0
  19. package/dist/compiler/containerArtifactsTypes.d.ts +9 -0
  20. package/dist/compiler/containerEntrypointRender.js +18 -31
  21. package/dist/compiler/index.d.ts +1 -0
  22. package/dist/compiler/index.js +1 -0
  23. package/dist/compiler/moltnetArtifacts.js +5 -0
  24. package/dist/compiler/moltnetClientConfig.d.ts +1 -1
  25. package/dist/compiler/moltnetClientConfig.js +3 -16
  26. package/dist/compiler/moltnetNodeConfig.js +2 -4
  27. package/dist/compiler/moltnetResolution.js +1 -1
  28. package/dist/compiler/moltnetRoomMemberships.js +1 -2
  29. package/dist/compiler/moltnetRuntimeConfig.d.ts +1 -1
  30. package/dist/compiler/moltnetRuntimeConfig.js +1 -13
  31. package/dist/compiler/networkBinding.d.ts +14 -0
  32. package/dist/compiler/networkBinding.js +34 -0
  33. package/dist/compiler/publishProject.d.ts +13 -0
  34. package/dist/compiler/publishProject.js +72 -0
  35. package/dist/compiler/runProject.d.ts +26 -12
  36. package/dist/compiler/runProject.js +102 -125
  37. package/dist/compiler/runProjectAuth.d.ts +5 -0
  38. package/dist/compiler/runProjectAuth.js +98 -0
  39. package/dist/compiler/runProjectDocker.d.ts +19 -0
  40. package/dist/compiler/runProjectDocker.js +57 -0
  41. package/dist/compiler/types.d.ts +1 -2
  42. package/dist/compiler/upProject.d.ts +6 -0
  43. package/dist/compiler/upProject.js +42 -8
  44. package/dist/compiler/view/buildOrganizationView.js +4 -1
  45. package/dist/compiler/view/declarations.d.ts +4 -0
  46. package/dist/compiler/view/declarations.js +104 -0
  47. package/dist/compiler/view/renderNetworks.js +1 -2
  48. package/dist/compiler/view/renderTree.js +6 -2
  49. package/dist/compiler/view/types.d.ts +64 -1
  50. package/dist/deployment/dockerInspect.d.ts +29 -0
  51. package/dist/deployment/dockerInspect.js +130 -0
  52. package/dist/deployment/dockerLabels.d.ts +16 -0
  53. package/dist/deployment/dockerLabels.js +32 -0
  54. package/dist/deployment/dockerLogs.d.ts +24 -0
  55. package/dist/deployment/dockerLogs.js +96 -0
  56. package/dist/deployment/dockerManager.d.ts +59 -0
  57. package/dist/deployment/dockerManager.js +76 -0
  58. package/dist/deployment/dockerProbeGateway.d.ts +16 -0
  59. package/dist/deployment/dockerProbeGateway.js +48 -0
  60. package/dist/deployment/homeStore.d.ts +19 -0
  61. package/dist/deployment/homeStore.js +130 -0
  62. package/dist/deployment/index.d.ts +9 -0
  63. package/dist/deployment/index.js +9 -0
  64. package/dist/deployment/names.d.ts +3 -0
  65. package/dist/deployment/names.js +12 -0
  66. package/dist/deployment/record.d.ts +76 -0
  67. package/dist/deployment/record.js +174 -0
  68. package/dist/deployment/target.d.ts +35 -0
  69. package/dist/deployment/target.js +96 -0
  70. package/dist/distribution/buildDistributionReport.d.ts +22 -0
  71. package/dist/distribution/buildDistributionReport.js +51 -0
  72. package/dist/distribution/consumeImage.d.ts +29 -0
  73. package/dist/distribution/consumeImage.js +254 -0
  74. package/dist/distribution/consumeImageSupport.d.ts +18 -0
  75. package/dist/distribution/consumeImageSupport.js +63 -0
  76. package/dist/distribution/distributionReportSchema.d.ts +84 -0
  77. package/dist/distribution/distributionReportSchema.js +107 -0
  78. package/dist/distribution/dockerRunner.d.ts +5 -0
  79. package/dist/distribution/dockerRunner.js +21 -0
  80. package/dist/distribution/extractImage.d.ts +25 -0
  81. package/dist/distribution/extractImage.js +96 -0
  82. package/dist/distribution/fingerprint.d.ts +2 -0
  83. package/dist/distribution/fingerprint.js +14 -0
  84. package/dist/distribution/imageRef.d.ts +9 -0
  85. package/dist/distribution/imageRef.js +65 -0
  86. package/dist/distribution/imageRuntimeAuth.d.ts +19 -0
  87. package/dist/distribution/imageRuntimeAuth.js +71 -0
  88. package/dist/distribution/index.d.ts +24 -0
  89. package/dist/distribution/index.js +16 -0
  90. package/dist/distribution/preflight.d.ts +11 -0
  91. package/dist/distribution/preflight.js +65 -0
  92. package/dist/distribution/projectImageView.d.ts +8 -0
  93. package/dist/distribution/projectImageView.js +83 -0
  94. package/dist/distribution/projectName.d.ts +1 -0
  95. package/dist/distribution/projectName.js +12 -0
  96. package/dist/distribution/renderImageInterface.d.ts +30 -0
  97. package/dist/distribution/renderImageInterface.js +86 -0
  98. package/dist/distribution/tarReader.d.ts +10 -0
  99. package/dist/distribution/tarReader.js +69 -0
  100. package/dist/distribution/types.d.ts +80 -0
  101. package/dist/distribution/types.js +4 -0
  102. package/dist/distribution/verifyDistributionReport.d.ts +12 -0
  103. package/dist/distribution/verifyDistributionReport.js +29 -0
  104. package/dist/filesystem/paths.d.ts +6 -0
  105. package/dist/filesystem/paths.js +11 -0
  106. package/dist/manifest/loadManifest.js +22 -2
  107. package/dist/manifest/renderSpawnfile.js +2 -4
  108. package/dist/manifest/schemas.d.ts +17 -41
  109. package/dist/manifest/surfaceSchemas.d.ts +19 -47
  110. package/dist/manifest/surfaceSchemas.js +3 -6
  111. package/dist/report/createReport.d.ts +7 -1
  112. package/dist/report/createReport.js +28 -1
  113. package/dist/report/types.d.ts +43 -0
  114. package/dist/runtime/container.js +0 -16
  115. package/dist/runtime/index.d.ts +1 -0
  116. package/dist/runtime/index.js +1 -0
  117. package/dist/runtime/install.d.ts +0 -10
  118. package/dist/runtime/install.js +0 -45
  119. package/dist/runtime/openclaw/adapter.js +9 -1
  120. package/dist/runtime/openclaw/configAuth.d.ts +15 -0
  121. package/dist/runtime/openclaw/configAuth.js +46 -0
  122. package/dist/runtime/openclaw/runAuth.d.ts +6 -0
  123. package/dist/runtime/openclaw/runAuth.js +7 -55
  124. package/dist/runtime/openclaw/statusProbes.d.ts +2 -0
  125. package/dist/runtime/openclaw/statusProbes.js +31 -0
  126. package/dist/runtime/picoclaw/adapter.js +10 -0
  127. package/dist/runtime/picoclaw/runAuth.d.ts +7 -0
  128. package/dist/runtime/picoclaw/runAuth.js +8 -68
  129. package/dist/runtime/picoclaw/statusProbes.d.ts +2 -0
  130. package/dist/runtime/picoclaw/statusProbes.js +100 -0
  131. package/dist/runtime/registry.d.ts +0 -5
  132. package/dist/runtime/registry.js +2 -12
  133. package/dist/runtime/statusProbes.d.ts +16 -0
  134. package/dist/runtime/statusProbes.js +41 -0
  135. package/dist/runtime/types.d.ts +52 -1
  136. package/dist/shared/errors.d.ts +6 -0
  137. package/dist/shared/errors.js +9 -0
  138. package/dist/status/buildStatus.d.ts +13 -0
  139. package/dist/status/buildStatus.js +266 -0
  140. package/dist/status/compileReport.d.ts +96 -0
  141. package/dist/status/compileReport.js +230 -0
  142. package/dist/status/compiledContainerObservations.d.ts +5 -0
  143. package/dist/status/compiledContainerObservations.js +63 -0
  144. package/dist/status/deploymentLogs.d.ts +12 -0
  145. package/dist/status/deploymentLogs.js +45 -0
  146. package/dist/status/deployments.d.ts +14 -0
  147. package/dist/status/deployments.js +128 -0
  148. package/dist/status/imageStatusReport.d.ts +10 -0
  149. package/dist/status/imageStatusReport.js +73 -0
  150. package/dist/status/index.d.ts +14 -0
  151. package/dist/status/index.js +14 -0
  152. package/dist/status/moltnetProbes.d.ts +21 -0
  153. package/dist/status/moltnetProbes.js +240 -0
  154. package/dist/status/registryDrift.d.ts +28 -0
  155. package/dist/status/registryDrift.js +119 -0
  156. package/dist/status/renderStatus.d.ts +2 -0
  157. package/dist/status/renderStatus.js +230 -0
  158. package/dist/status/runtimeProbes.d.ts +13 -0
  159. package/dist/status/runtimeProbes.js +111 -0
  160. package/dist/status/selectionSubjects.d.ts +8 -0
  161. package/dist/status/selectionSubjects.js +77 -0
  162. package/dist/status/selectors.d.ts +14 -0
  163. package/dist/status/selectors.js +90 -0
  164. package/dist/status/traversal.d.ts +6 -0
  165. package/dist/status/traversal.js +15 -0
  166. package/dist/status/types.d.ts +113 -0
  167. package/dist/status/types.js +1 -0
  168. package/package.json +4 -2
  169. package/runtimes.yaml +22 -15
  170. package/dist/runtime/tinyclaw/adapter.d.ts +0 -2
  171. package/dist/runtime/tinyclaw/adapter.js +0 -284
  172. package/dist/runtime/tinyclaw/runAuth.d.ts +0 -2
  173. package/dist/runtime/tinyclaw/runAuth.js +0 -49
  174. package/dist/runtime/tinyclaw/scaffold-assets/AGENTS.md +0 -160
  175. package/dist/runtime/tinyclaw/scaffold-assets/CLAUDE.md +0 -5
  176. package/dist/runtime/tinyclaw/scaffold-assets/SOUL.md +0 -177
  177. package/dist/runtime/tinyclaw/scaffold.d.ts +0 -2
  178. package/dist/runtime/tinyclaw/scaffold.js +0 -24
  179. package/dist/runtime/tinyclaw/schedules.d.ts +0 -9
  180. package/dist/runtime/tinyclaw/schedules.js +0 -62
  181. package/dist/runtime/tinyclaw/surfaces.d.ts +0 -8
  182. 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.12",
4
4
  "description": "Canonical source compiler for autonomous agents and teams.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -31,7 +31,9 @@
31
31
  "test:e2e:moltnet-team-chat": "tsx src/e2e/cli.ts moltnet-team-chat",
32
32
  "test:e2e:operational-smoke": "tsx src/e2e/cli.ts operational-smoke",
33
33
  "test": "vitest run",
34
- "typecheck": "tsc --project tsconfig.json --noEmit"
34
+ "typecheck": "tsc --project tsconfig.json --noEmit",
35
+ "test:e2e:distribution-image": "tsx src/e2e/cli.ts distribution-image",
36
+ "test:e2e:distribution-roundtrip": "tsx src/e2e/cli.ts distribution-roundtrip"
35
37
  },
36
38
  "dependencies": {
37
39
  "commander": "^14.0.1",
package/runtimes.yaml CHANGED
@@ -16,47 +16,54 @@
16
16
  runtimes:
17
17
  openclaw:
18
18
  remote: git@github.com:openclaw/openclaw.git
19
- ref: v2026.3.13-1
19
+ ref: v2026.6.5
20
20
  default_branch: main
21
21
  install:
22
22
  kind: npm
23
23
  package: openclaw
24
- version: 2026.3.13
24
+ version: 2026.6.5
25
25
  status: active
26
26
 
27
27
  picoclaw:
28
28
  remote: git@github.com:sipeed/picoclaw.git
29
- ref: v0.2.5
29
+ ref: v0.2.9
30
30
  default_branch: main
31
31
  install:
32
32
  kind: github_release_archive
33
33
  repository: sipeed/picoclaw
34
- tag: v0.2.5
34
+ tag: v0.2.9
35
35
  binary: picoclaw
36
36
  assets:
37
37
  linux_amd64: picoclaw_Linux_x86_64.tar.gz
38
38
  linux_arm64: picoclaw_Linux_arm64.tar.gz
39
39
  status: active
40
40
 
41
- tinyclaw:
42
- remote: git@github.com:TinyAGI/tinyclaw.git
43
- ref: v0.0.20
41
+ hermes-agent:
42
+ remote: git@github.com:NousResearch/hermes-agent.git
43
+ ref: v2026.6.5
44
44
  default_branch: main
45
- install:
46
- kind: github_release_bundle
47
- repository: TinyAGI/tinyagi
48
- tag: v0.0.20
49
- asset: tinyagi-bundle.tar.gz
50
- status: active
45
+ status: exploratory
51
46
 
52
47
  nullclaw:
53
48
  remote: git@github.com:nullclaw/nullclaw.git
54
- ref: v2026.3.17
49
+ ref: v2026.5.29
50
+ default_branch: main
51
+ status: exploratory
52
+
53
+ opencode:
54
+ remote: git@github.com:anomalyco/opencode.git
55
+ ref: v1.16.2
56
+ default_branch: dev
57
+ status: exploratory
58
+
59
+ openfang:
60
+ remote: git@github.com:RightNow-AI/openfang.git
61
+ ref: v0.6.9
55
62
  default_branch: main
56
63
  status: exploratory
57
64
 
58
65
  zeroclaw:
59
66
  remote: git@github.com:zeroclaw-labs/zeroclaw.git
60
- ref: v0.5.0
67
+ ref: v0.7.5
61
68
  default_branch: master
62
69
  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
- };