spawnfile 0.1.10 → 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.
- package/README.md +13 -2
- package/dist/cli/lifecycleCommands.js +101 -1
- package/dist/cli/modelCommands.js +3 -0
- package/dist/cli/resolveCommandInput.d.ts +19 -0
- package/dist/cli/resolveCommandInput.js +25 -0
- package/dist/cli/runCli.d.ts +4 -1
- package/dist/cli/runCli.js +37 -13
- package/dist/cli/runtimeCommands.js +1 -0
- package/dist/cli/statusCommand.d.ts +42 -0
- package/dist/cli/statusCommand.js +394 -0
- package/dist/cli/surfaceCommands.js +4 -0
- package/dist/compiler/agentSurfaces.js +2 -4
- package/dist/compiler/buildCompilePlanTeams.js +3 -1
- package/dist/compiler/compileProject.js +19 -10
- package/dist/compiler/compileProjectSupport.d.ts +1 -0
- package/dist/compiler/compileProjectSupport.js +1 -1
- package/dist/compiler/containerArtifacts.d.ts +1 -0
- package/dist/compiler/containerArtifacts.js +208 -32
- package/dist/compiler/containerArtifactsPlans.js +7 -4
- package/dist/compiler/containerArtifactsRender.d.ts +7 -1
- package/dist/compiler/containerArtifactsRender.js +6 -0
- package/dist/compiler/containerArtifactsTypes.d.ts +9 -0
- package/dist/compiler/containerEntrypointRender.js +18 -31
- package/dist/compiler/index.d.ts +1 -0
- package/dist/compiler/index.js +1 -0
- package/dist/compiler/moltnetArtifacts.d.ts +2 -0
- package/dist/compiler/moltnetArtifacts.js +58 -99
- package/dist/compiler/moltnetClientConfig.d.ts +2 -2
- package/dist/compiler/moltnetClientConfig.js +16 -23
- package/dist/compiler/moltnetConfigLowering.d.ts +3 -0
- package/dist/compiler/moltnetConfigLowering.js +13 -2
- package/dist/compiler/moltnetNodeConfig.d.ts +27 -0
- package/dist/compiler/moltnetNodeConfig.js +68 -0
- package/dist/compiler/moltnetResolution.js +1 -1
- package/dist/compiler/moltnetRoomMemberships.js +1 -2
- package/dist/compiler/moltnetRoomPolicyCompatibility.d.ts +4 -0
- package/dist/compiler/moltnetRoomPolicyCompatibility.js +28 -0
- package/dist/compiler/moltnetRuntimeConfig.d.ts +1 -1
- package/dist/compiler/moltnetRuntimeConfig.js +1 -13
- package/dist/compiler/networkBinding.d.ts +14 -0
- package/dist/compiler/networkBinding.js +34 -0
- package/dist/compiler/publishProject.d.ts +13 -0
- package/dist/compiler/publishProject.js +72 -0
- package/dist/compiler/runProject.d.ts +26 -12
- package/dist/compiler/runProject.js +102 -125
- package/dist/compiler/runProjectAuth.d.ts +5 -0
- package/dist/compiler/runProjectAuth.js +98 -0
- package/dist/compiler/runProjectDocker.d.ts +19 -0
- package/dist/compiler/runProjectDocker.js +57 -0
- package/dist/compiler/types.d.ts +3 -2
- package/dist/compiler/upProject.d.ts +6 -0
- package/dist/compiler/upProject.js +42 -8
- package/dist/compiler/view/buildOrganizationView.js +27 -3
- package/dist/compiler/view/declarations.d.ts +4 -0
- package/dist/compiler/view/declarations.js +104 -0
- package/dist/compiler/view/renderNetworks.js +12 -3
- package/dist/compiler/view/renderTree.js +16 -3
- package/dist/compiler/view/types.d.ts +77 -1
- package/dist/deployment/dockerInspect.d.ts +29 -0
- package/dist/deployment/dockerInspect.js +130 -0
- package/dist/deployment/dockerLabels.d.ts +16 -0
- package/dist/deployment/dockerLabels.js +32 -0
- package/dist/deployment/dockerLogs.d.ts +24 -0
- package/dist/deployment/dockerLogs.js +96 -0
- package/dist/deployment/dockerManager.d.ts +59 -0
- package/dist/deployment/dockerManager.js +76 -0
- package/dist/deployment/dockerProbeGateway.d.ts +16 -0
- package/dist/deployment/dockerProbeGateway.js +48 -0
- package/dist/deployment/homeStore.d.ts +19 -0
- package/dist/deployment/homeStore.js +130 -0
- package/dist/deployment/index.d.ts +9 -0
- package/dist/deployment/index.js +9 -0
- package/dist/deployment/names.d.ts +3 -0
- package/dist/deployment/names.js +12 -0
- package/dist/deployment/record.d.ts +76 -0
- package/dist/deployment/record.js +174 -0
- package/dist/deployment/target.d.ts +35 -0
- package/dist/deployment/target.js +96 -0
- package/dist/distribution/buildDistributionReport.d.ts +22 -0
- package/dist/distribution/buildDistributionReport.js +51 -0
- package/dist/distribution/consumeImage.d.ts +29 -0
- package/dist/distribution/consumeImage.js +254 -0
- package/dist/distribution/consumeImageSupport.d.ts +18 -0
- package/dist/distribution/consumeImageSupport.js +63 -0
- package/dist/distribution/distributionReportSchema.d.ts +84 -0
- package/dist/distribution/distributionReportSchema.js +107 -0
- package/dist/distribution/dockerRunner.d.ts +5 -0
- package/dist/distribution/dockerRunner.js +21 -0
- package/dist/distribution/extractImage.d.ts +25 -0
- package/dist/distribution/extractImage.js +96 -0
- package/dist/distribution/fingerprint.d.ts +2 -0
- package/dist/distribution/fingerprint.js +14 -0
- package/dist/distribution/imageRef.d.ts +9 -0
- package/dist/distribution/imageRef.js +65 -0
- package/dist/distribution/imageRuntimeAuth.d.ts +19 -0
- package/dist/distribution/imageRuntimeAuth.js +71 -0
- package/dist/distribution/index.d.ts +24 -0
- package/dist/distribution/index.js +16 -0
- package/dist/distribution/preflight.d.ts +11 -0
- package/dist/distribution/preflight.js +65 -0
- package/dist/distribution/projectImageView.d.ts +8 -0
- package/dist/distribution/projectImageView.js +83 -0
- package/dist/distribution/projectName.d.ts +1 -0
- package/dist/distribution/projectName.js +12 -0
- package/dist/distribution/renderImageInterface.d.ts +30 -0
- package/dist/distribution/renderImageInterface.js +86 -0
- package/dist/distribution/tarReader.d.ts +10 -0
- package/dist/distribution/tarReader.js +69 -0
- package/dist/distribution/types.d.ts +80 -0
- package/dist/distribution/types.js +4 -0
- package/dist/distribution/verifyDistributionReport.d.ts +12 -0
- package/dist/distribution/verifyDistributionReport.js +29 -0
- package/dist/filesystem/paths.d.ts +6 -0
- package/dist/filesystem/paths.js +11 -0
- package/dist/manifest/loadManifest.js +22 -2
- package/dist/manifest/renderSpawnfile.js +2 -4
- package/dist/manifest/renderSpawnfileNetworks.js +5 -0
- package/dist/manifest/schemas.d.ts +71 -41
- package/dist/manifest/surfaceSchemas.d.ts +19 -47
- package/dist/manifest/surfaceSchemas.js +3 -6
- package/dist/manifest/teamNetworkAccessSchemas.d.ts +15 -0
- package/dist/manifest/teamNetworkAccessSchemas.js +8 -0
- package/dist/manifest/teamNetworkConsoleSchemas.d.ts +7 -0
- package/dist/manifest/teamNetworkConsoleSchemas.js +19 -0
- package/dist/manifest/teamNetworkSchemas.d.ts +60 -0
- package/dist/manifest/teamNetworkSchemas.js +20 -7
- package/dist/report/createReport.d.ts +7 -1
- package/dist/report/createReport.js +28 -1
- package/dist/report/types.d.ts +43 -0
- package/dist/runtime/container.js +0 -16
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/install.d.ts +0 -10
- package/dist/runtime/install.js +0 -45
- package/dist/runtime/openclaw/adapter.js +9 -1
- package/dist/runtime/openclaw/configAuth.d.ts +15 -0
- package/dist/runtime/openclaw/configAuth.js +46 -0
- package/dist/runtime/openclaw/runAuth.d.ts +6 -0
- package/dist/runtime/openclaw/runAuth.js +7 -55
- package/dist/runtime/openclaw/statusProbes.d.ts +2 -0
- package/dist/runtime/openclaw/statusProbes.js +31 -0
- package/dist/runtime/picoclaw/adapter.js +10 -0
- package/dist/runtime/picoclaw/runAuth.d.ts +7 -0
- package/dist/runtime/picoclaw/runAuth.js +8 -68
- package/dist/runtime/picoclaw/statusProbes.d.ts +2 -0
- package/dist/runtime/picoclaw/statusProbes.js +100 -0
- package/dist/runtime/registry.d.ts +0 -5
- package/dist/runtime/registry.js +2 -12
- package/dist/runtime/statusProbes.d.ts +16 -0
- package/dist/runtime/statusProbes.js +41 -0
- package/dist/runtime/types.d.ts +52 -1
- package/dist/shared/errors.d.ts +6 -0
- package/dist/shared/errors.js +9 -0
- package/dist/status/buildStatus.d.ts +13 -0
- package/dist/status/buildStatus.js +266 -0
- package/dist/status/compileReport.d.ts +96 -0
- package/dist/status/compileReport.js +230 -0
- package/dist/status/compiledContainerObservations.d.ts +5 -0
- package/dist/status/compiledContainerObservations.js +63 -0
- package/dist/status/deploymentLogs.d.ts +12 -0
- package/dist/status/deploymentLogs.js +45 -0
- package/dist/status/deployments.d.ts +14 -0
- package/dist/status/deployments.js +128 -0
- package/dist/status/imageStatusReport.d.ts +10 -0
- package/dist/status/imageStatusReport.js +73 -0
- package/dist/status/index.d.ts +14 -0
- package/dist/status/index.js +14 -0
- package/dist/status/moltnetProbes.d.ts +21 -0
- package/dist/status/moltnetProbes.js +240 -0
- package/dist/status/registryDrift.d.ts +28 -0
- package/dist/status/registryDrift.js +119 -0
- package/dist/status/renderStatus.d.ts +2 -0
- package/dist/status/renderStatus.js +230 -0
- package/dist/status/runtimeProbes.d.ts +13 -0
- package/dist/status/runtimeProbes.js +111 -0
- package/dist/status/selectionSubjects.d.ts +8 -0
- package/dist/status/selectionSubjects.js +77 -0
- package/dist/status/selectors.d.ts +14 -0
- package/dist/status/selectors.js +90 -0
- package/dist/status/traversal.d.ts +6 -0
- package/dist/status/traversal.js +15 -0
- package/dist/status/types.d.ts +113 -0
- package/dist/status/types.js +1 -0
- package/package.json +4 -2
- package/runtimes.yaml +22 -15
- package/dist/runtime/tinyclaw/adapter.d.ts +0 -2
- package/dist/runtime/tinyclaw/adapter.js +0 -284
- package/dist/runtime/tinyclaw/runAuth.d.ts +0 -2
- package/dist/runtime/tinyclaw/runAuth.js +0 -49
- package/dist/runtime/tinyclaw/scaffold-assets/AGENTS.md +0 -160
- package/dist/runtime/tinyclaw/scaffold-assets/CLAUDE.md +0 -5
- package/dist/runtime/tinyclaw/scaffold-assets/SOUL.md +0 -177
- package/dist/runtime/tinyclaw/scaffold.d.ts +0 -2
- package/dist/runtime/tinyclaw/scaffold.js +0 -24
- package/dist/runtime/tinyclaw/schedules.d.ts +0 -9
- package/dist/runtime/tinyclaw/schedules.js +0 -62
- package/dist/runtime/tinyclaw/surfaces.d.ts +0 -8
- package/dist/runtime/tinyclaw/surfaces.js +0 -94
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { createDockerProbeGateway } from "../deployment/index.js";
|
|
2
|
+
import { getRuntimeAdapter } from "../runtime/index.js";
|
|
3
|
+
const createObservation = (input) => ({
|
|
4
|
+
...input,
|
|
5
|
+
label: `${input.severity.toUpperCase()} ${input.key}`,
|
|
6
|
+
source: "runtime"
|
|
7
|
+
});
|
|
8
|
+
const instanceSubject = (instanceId) => `runtime-instance:${instanceId}`;
|
|
9
|
+
const fromProbeObservation = (instance, probe) => createObservation({
|
|
10
|
+
...(probe.details ? { details: probe.details } : {}),
|
|
11
|
+
key: probe.key,
|
|
12
|
+
message: probe.message,
|
|
13
|
+
severity: probe.severity,
|
|
14
|
+
subject: instanceSubject(instance.id)
|
|
15
|
+
});
|
|
16
|
+
const toRuntimeInstanceReport = (instance) => ({
|
|
17
|
+
config_path: instance.configPath ?? "",
|
|
18
|
+
home_path: instance.homePath,
|
|
19
|
+
id: instance.id,
|
|
20
|
+
internal_port: instance.internalPort,
|
|
21
|
+
model_auth_methods: {},
|
|
22
|
+
model_secrets_required: [],
|
|
23
|
+
node_ids: instance.nodeIds,
|
|
24
|
+
published_port: instance.publishedPort,
|
|
25
|
+
runtime: instance.runtime,
|
|
26
|
+
workspace_path: instance.workspacePath ?? undefined
|
|
27
|
+
});
|
|
28
|
+
const skippedSeverity = (running) => running === false ? "error" : "unknown";
|
|
29
|
+
export const collectRuntimeProbeObservations = async (options) => {
|
|
30
|
+
if (options.loadedReport.kind !== "loaded") {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
const observations = [];
|
|
34
|
+
const instances = new Map(options.loadedReport.report.runtimeInstances.map((instance) => [instance.id, instance]));
|
|
35
|
+
for (const deployment of options.deployments) {
|
|
36
|
+
const deploymentInspections = options.inspections.get(deployment.name);
|
|
37
|
+
for (const unit of deployment.units) {
|
|
38
|
+
const inspection = deploymentInspections?.get(unit.id);
|
|
39
|
+
for (const instanceId of unit.runtime_instances) {
|
|
40
|
+
const instance = instances.get(instanceId);
|
|
41
|
+
if (!instance) {
|
|
42
|
+
observations.push(createObservation({
|
|
43
|
+
key: "runtime.instance",
|
|
44
|
+
message: `${instanceId} is referenced by deployment ${deployment.name}/${unit.id} but missing from the compile report`,
|
|
45
|
+
severity: "warn",
|
|
46
|
+
subject: instanceSubject(instanceId)
|
|
47
|
+
}));
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
if (inspection?.running !== true) {
|
|
51
|
+
observations.push(createObservation({
|
|
52
|
+
key: "runtime.probe",
|
|
53
|
+
message: `${instance.id} runtime probe skipped because deployment unit ${unit.id} is not running`,
|
|
54
|
+
severity: skippedSeverity(inspection?.running),
|
|
55
|
+
subject: instanceSubject(instance.id)
|
|
56
|
+
}));
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
let adapter;
|
|
60
|
+
try {
|
|
61
|
+
adapter = getRuntimeAdapter(instance.runtime);
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
observations.push(createObservation({
|
|
65
|
+
key: "runtime.adapter",
|
|
66
|
+
message: error instanceof Error ? error.message : String(error),
|
|
67
|
+
severity: "unknown",
|
|
68
|
+
subject: instanceSubject(instance.id)
|
|
69
|
+
}));
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
if (!adapter.statusProbes || adapter.statusProbes.length === 0) {
|
|
73
|
+
observations.push(createObservation({
|
|
74
|
+
key: "runtime.probe",
|
|
75
|
+
message: `${instance.runtime} has no status probes`,
|
|
76
|
+
severity: "unknown",
|
|
77
|
+
subject: instanceSubject(instance.id)
|
|
78
|
+
}));
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const manager = createDockerProbeGateway(deployment, unit, {
|
|
82
|
+
dockerCommand: options.dockerCommand,
|
|
83
|
+
execFile: options.execFile,
|
|
84
|
+
inspection,
|
|
85
|
+
timeoutMs: options.timeoutMs
|
|
86
|
+
});
|
|
87
|
+
for (const probe of adapter.statusProbes) {
|
|
88
|
+
try {
|
|
89
|
+
const probeObservations = await probe.run({
|
|
90
|
+
deployment,
|
|
91
|
+
instance: toRuntimeInstanceReport(instance),
|
|
92
|
+
manager,
|
|
93
|
+
timeoutMs: options.timeoutMs ?? 10_000,
|
|
94
|
+
unit
|
|
95
|
+
});
|
|
96
|
+
observations.push(...probeObservations.map((entry) => fromProbeObservation(instance, entry)));
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
observations.push(createObservation({
|
|
100
|
+
key: `runtime.${probe.id}`,
|
|
101
|
+
message: `${probe.label} probe failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
102
|
+
severity: "unknown",
|
|
103
|
+
subject: instanceSubject(instance.id)
|
|
104
|
+
}));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return observations;
|
|
111
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { OrganizationView } from "../compiler/index.js";
|
|
2
|
+
import type { LoadedCompileReport } from "./compileReport.js";
|
|
3
|
+
import type { StatusDeploymentSummary, StatusSelection } from "./types.js";
|
|
4
|
+
export declare const expandStatusSelectionSubjects: (selection: StatusSelection | null, input: {
|
|
5
|
+
deployments: StatusDeploymentSummary[];
|
|
6
|
+
loadedReport: LoadedCompileReport;
|
|
7
|
+
view: OrganizationView;
|
|
8
|
+
}) => StatusSelection | null;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
const addRuntimeInstancesForNodes = (subjects, loadedReport, nodeIds) => {
|
|
2
|
+
if (loadedReport.kind !== "loaded") {
|
|
3
|
+
return;
|
|
4
|
+
}
|
|
5
|
+
for (const instance of loadedReport.report.runtimeInstances) {
|
|
6
|
+
if (instance.nodeIds.some((nodeId) => nodeIds.has(nodeId))) {
|
|
7
|
+
subjects.add(`runtime-instance:${instance.id}`);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
const addRuntimeInstancesForRuntime = (subjects, loadedReport, runtimeName) => {
|
|
12
|
+
if (loadedReport.kind !== "loaded") {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
for (const instance of loadedReport.report.runtimeInstances) {
|
|
16
|
+
if (instance.runtime === runtimeName) {
|
|
17
|
+
subjects.add(`runtime-instance:${instance.id}`);
|
|
18
|
+
instance.nodeIds.forEach((nodeId) => subjects.add(nodeId));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const addDeploymentSubjects = (subjects, deployments) => {
|
|
23
|
+
for (const deployment of deployments) {
|
|
24
|
+
let deploymentMatches = false;
|
|
25
|
+
for (const unit of deployment.units) {
|
|
26
|
+
const unitMatches = unit.contains.some((entry) => subjects.has(entry.id))
|
|
27
|
+
|| unit.runtimeInstances.some((instanceId) => subjects.has(`runtime-instance:${instanceId}`));
|
|
28
|
+
if (!unitMatches) {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
deploymentMatches = true;
|
|
32
|
+
subjects.add(`deployment-unit:${deployment.name}:${unit.id}`);
|
|
33
|
+
unit.runtimeInstances.forEach((instanceId) => subjects.add(`runtime-instance:${instanceId}`));
|
|
34
|
+
unit.contains.forEach((entry) => subjects.add(entry.id));
|
|
35
|
+
}
|
|
36
|
+
if (deploymentMatches) {
|
|
37
|
+
subjects.add(`deployment:${deployment.name}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const addNetworkSubjects = (subjects, view, loadedReport, networkId) => {
|
|
42
|
+
const addRoom = (roomId, members) => {
|
|
43
|
+
subjects.add(`room:${networkId}:${roomId}`);
|
|
44
|
+
members.forEach((member) => subjects.add(`agent:${member}`));
|
|
45
|
+
};
|
|
46
|
+
const declaredNetwork = view.networks.find((network) => network.id === networkId);
|
|
47
|
+
declaredNetwork?.rooms.forEach((room) => addRoom(room.id, room.declaredMembers));
|
|
48
|
+
if (loadedReport.kind !== "loaded") {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
for (const server of loadedReport.report.moltnetServers ?? []) {
|
|
52
|
+
if (server.networkId === networkId) {
|
|
53
|
+
server.rooms.forEach((room) => addRoom(room.id, room.members));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
export const expandStatusSelectionSubjects = (selection, input) => {
|
|
58
|
+
if (!selection) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
const subjects = new Set(selection.subjectKeys);
|
|
62
|
+
const nodeIds = new Set(selection.subjectKeys.filter((subject) => subject.startsWith("agent:") || subject.startsWith("team:")));
|
|
63
|
+
if (nodeIds.size > 0) {
|
|
64
|
+
addRuntimeInstancesForNodes(subjects, input.loadedReport, nodeIds);
|
|
65
|
+
}
|
|
66
|
+
if (selection.kind === "runtime") {
|
|
67
|
+
addRuntimeInstancesForRuntime(subjects, input.loadedReport, selection.value);
|
|
68
|
+
}
|
|
69
|
+
if (selection.kind === "network") {
|
|
70
|
+
addNetworkSubjects(subjects, input.view, input.loadedReport, selection.value);
|
|
71
|
+
}
|
|
72
|
+
addDeploymentSubjects(subjects, input.deployments);
|
|
73
|
+
return {
|
|
74
|
+
...selection,
|
|
75
|
+
subjectKeys: [...subjects]
|
|
76
|
+
};
|
|
77
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { OrganizationView } from "../compiler/index.js";
|
|
2
|
+
import type { StatusInputFailure, StatusSelection, StatusSelectorKind } from "./types.js";
|
|
3
|
+
export interface StatusSelectorInput {
|
|
4
|
+
kind: StatusSelectorKind;
|
|
5
|
+
value: string;
|
|
6
|
+
}
|
|
7
|
+
export type StatusSelectorResult = {
|
|
8
|
+
kind: "failure";
|
|
9
|
+
failure: StatusInputFailure;
|
|
10
|
+
} | {
|
|
11
|
+
kind: "selected";
|
|
12
|
+
selection: StatusSelection;
|
|
13
|
+
};
|
|
14
|
+
export declare const resolveStatusSelector: (view: OrganizationView, selector: StatusSelectorInput | null) => StatusSelectorResult | null;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { flattenOrganizationNodes } from "./traversal.js";
|
|
2
|
+
const failure = (message) => ({
|
|
3
|
+
failure: { exitCode: 2, message },
|
|
4
|
+
kind: "failure"
|
|
5
|
+
});
|
|
6
|
+
const validValuesMessage = (label, values) => values.length > 0 ? `${label}: ${values.join(", ")}` : `${label}: none`;
|
|
7
|
+
const selectNode = (nodes, kind, value) => {
|
|
8
|
+
const candidates = nodes.filter((node) => node.kind === kind);
|
|
9
|
+
const exactId = candidates.filter((node) => node.id === value);
|
|
10
|
+
if (exactId.length === 1) {
|
|
11
|
+
const [node] = exactId;
|
|
12
|
+
return {
|
|
13
|
+
kind: "selected",
|
|
14
|
+
selection: { kind, label: node.displayName, subjectKeys: [node.id], value }
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
const named = candidates.filter((node) => node.name === value || node.slug === value);
|
|
18
|
+
if (named.length === 1) {
|
|
19
|
+
const [node] = named;
|
|
20
|
+
return {
|
|
21
|
+
kind: "selected",
|
|
22
|
+
selection: { kind, label: node.displayName, subjectKeys: [node.id], value }
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
if (named.length > 1 || exactId.length > 1) {
|
|
26
|
+
const matches = [...exactId, ...named].map((node) => node.id).sort();
|
|
27
|
+
return failure(`Ambiguous ${kind} selector "${value}". Candidates: ${matches.join(", ")}`);
|
|
28
|
+
}
|
|
29
|
+
return failure(`Unknown ${kind} selector "${value}". ${validValuesMessage(`Valid ${kind} ids`, candidates.map((node) => node.id).sort())}`);
|
|
30
|
+
};
|
|
31
|
+
const selectNetwork = (view, value) => {
|
|
32
|
+
const exactId = view.networks.filter((network) => network.id === value);
|
|
33
|
+
if (exactId.length === 1) {
|
|
34
|
+
const [network] = exactId;
|
|
35
|
+
return {
|
|
36
|
+
kind: "selected",
|
|
37
|
+
selection: {
|
|
38
|
+
kind: "network",
|
|
39
|
+
label: network.name,
|
|
40
|
+
subjectKeys: [`network:${network.id}`],
|
|
41
|
+
value
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
const named = view.networks.filter((network) => network.name === value);
|
|
46
|
+
if (named.length === 1) {
|
|
47
|
+
const [network] = named;
|
|
48
|
+
return {
|
|
49
|
+
kind: "selected",
|
|
50
|
+
selection: {
|
|
51
|
+
kind: "network",
|
|
52
|
+
label: network.name,
|
|
53
|
+
subjectKeys: [`network:${network.id}`],
|
|
54
|
+
value
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
if (named.length > 1 || exactId.length > 1) {
|
|
59
|
+
const matches = [...exactId, ...named].map((network) => network.id).sort();
|
|
60
|
+
return failure(`Ambiguous network selector "${value}". Candidates: ${matches.join(", ")}`);
|
|
61
|
+
}
|
|
62
|
+
return failure(`Unknown network selector "${value}". ${validValuesMessage("Valid network ids", view.networks.map((network) => network.id).sort())}`);
|
|
63
|
+
};
|
|
64
|
+
const selectRuntime = (view, value) => {
|
|
65
|
+
const runtime = view.runtimes.find((entry) => entry.name === value);
|
|
66
|
+
if (!runtime) {
|
|
67
|
+
return failure(`Unknown runtime selector "${value}". ${validValuesMessage("Valid runtime names", view.runtimes.map((entry) => entry.name).sort())}`);
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
kind: "selected",
|
|
71
|
+
selection: {
|
|
72
|
+
kind: "runtime",
|
|
73
|
+
label: runtime.name,
|
|
74
|
+
subjectKeys: [`runtime:${runtime.name}`, ...runtime.nodeIds],
|
|
75
|
+
value
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
export const resolveStatusSelector = (view, selector) => {
|
|
80
|
+
if (!selector) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
if (selector.kind === "network") {
|
|
84
|
+
return selectNetwork(view, selector.value);
|
|
85
|
+
}
|
|
86
|
+
if (selector.kind === "runtime") {
|
|
87
|
+
return selectRuntime(view, selector.value);
|
|
88
|
+
}
|
|
89
|
+
return selectNode(flattenOrganizationNodes(view), selector.kind, selector.value);
|
|
90
|
+
};
|
|
@@ -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.
|
|
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.
|
|
19
|
+
ref: v2026.6.5
|
|
20
20
|
default_branch: main
|
|
21
21
|
install:
|
|
22
22
|
kind: npm
|
|
23
23
|
package: openclaw
|
|
24
|
-
version: 2026.
|
|
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.
|
|
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.
|
|
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
|
-
|
|
42
|
-
remote: git@github.com:
|
|
43
|
-
ref:
|
|
41
|
+
hermes-agent:
|
|
42
|
+
remote: git@github.com:NousResearch/hermes-agent.git
|
|
43
|
+
ref: v2026.6.5
|
|
44
44
|
default_branch: main
|
|
45
|
-
|
|
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.
|
|
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
|
|
67
|
+
ref: v0.7.5
|
|
61
68
|
default_branch: master
|
|
62
69
|
status: exploratory
|