@zeroroot-ai/zerocool-claude 0.4.0 → 0.5.1
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/dist/cli.d.ts +13 -0
- package/dist/cli.js +38 -0
- package/dist/session.d.ts +2 -1
- package/dist/session.js +4 -0
- package/package.json +2 -2
package/dist/cli.d.ts
CHANGED
|
@@ -73,3 +73,16 @@ export interface LoginPrompt {
|
|
|
73
73
|
export declare function startLogin(opts?: CliOptions & {
|
|
74
74
|
gibsonURL?: string;
|
|
75
75
|
}): Promise<LoginPrompt>;
|
|
76
|
+
/**
|
|
77
|
+
* The person originates the session mission. A component may originate a
|
|
78
|
+
* mission only from inside one it was dispatched to (gibson ADR-0063), and an
|
|
79
|
+
* interactive session has no parent mission, so the definition goes through
|
|
80
|
+
* the CLI's login session: `gibson mission submit` validates it, registers it
|
|
81
|
+
* and runs it, then prints the mission id. The daemon dispatches the one AGENT
|
|
82
|
+
* node to this component, which must already be checked in.
|
|
83
|
+
*/
|
|
84
|
+
export declare function submitMission(definition: unknown, targetId: string, opts?: CliOptions & {
|
|
85
|
+
gibsonURL?: string;
|
|
86
|
+
tenant?: string;
|
|
87
|
+
dir?: string;
|
|
88
|
+
}): Promise<string>;
|
package/dist/cli.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { spawn as nodeSpawn } from "node:child_process";
|
|
2
|
+
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
2
5
|
export async function runGibson(args, opts = {}) {
|
|
3
6
|
const spawn = opts.spawn ?? nodeSpawn;
|
|
4
7
|
const child = spawn(opts.bin ?? opts.env?.GIBSON_CLI ?? "gibson", args, { env: opts.env ?? process.env });
|
|
@@ -140,3 +143,38 @@ export async function startLogin(opts = {}) {
|
|
|
140
143
|
});
|
|
141
144
|
});
|
|
142
145
|
}
|
|
146
|
+
const UUID = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/g;
|
|
147
|
+
/**
|
|
148
|
+
* The person originates the session mission. A component may originate a
|
|
149
|
+
* mission only from inside one it was dispatched to (gibson ADR-0063), and an
|
|
150
|
+
* interactive session has no parent mission, so the definition goes through
|
|
151
|
+
* the CLI's login session: `gibson mission submit` validates it, registers it
|
|
152
|
+
* and runs it, then prints the mission id. The daemon dispatches the one AGENT
|
|
153
|
+
* node to this component, which must already be checked in.
|
|
154
|
+
*/
|
|
155
|
+
export async function submitMission(definition, targetId, opts = {}) {
|
|
156
|
+
const dir = await mkdtemp(join(opts.dir ?? tmpdir(), "zerocool-claude-mission-"));
|
|
157
|
+
const file = join(dir, "session.json");
|
|
158
|
+
try {
|
|
159
|
+
await writeFile(file, JSON.stringify(definition), { mode: 0o600 });
|
|
160
|
+
const args = ["mission", "submit", file, "--format", "json", "--target", targetId];
|
|
161
|
+
if (opts.gibsonURL)
|
|
162
|
+
args.push("--gibson-url", opts.gibsonURL);
|
|
163
|
+
if (opts.tenant)
|
|
164
|
+
args.push("--tenant", opts.tenant);
|
|
165
|
+
const r = await runGibson(args, { ...opts, timeoutMs: opts.timeoutMs ?? 120_000 });
|
|
166
|
+
if (r.code !== 0) {
|
|
167
|
+
if (needsLogin(r))
|
|
168
|
+
throw new Error("the gibson CLI has no session; run gibson_login first");
|
|
169
|
+
throw new Error(`gibson mission submit failed (exit ${r.code}): ${(r.stderr || r.stdout).trim().slice(0, 400)}`);
|
|
170
|
+
}
|
|
171
|
+
const ids = r.stdout.match(UUID) ?? [];
|
|
172
|
+
const missionId = ids[ids.length - 1];
|
|
173
|
+
if (!missionId)
|
|
174
|
+
throw new Error(`gibson mission submit printed no mission id: ${r.stdout.trim().slice(0, 400)}`);
|
|
175
|
+
return missionId;
|
|
176
|
+
}
|
|
177
|
+
finally {
|
|
178
|
+
await rm(dir, { recursive: true, force: true });
|
|
179
|
+
}
|
|
180
|
+
}
|
package/dist/session.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { connectGibson, startLiveMission, type GibsonSession, type KnowledgeSource, type LiveMission } from "@zeroroot-ai/sdk";
|
|
1
|
+
import { connectGibson, startLiveMission, type GibsonSession, type KnowledgeSource, type LiveMission, type MissionOriginator } from "@zeroroot-ai/sdk";
|
|
2
2
|
import type { Settings } from "./config.js";
|
|
3
3
|
import { type Mode } from "./mode.js";
|
|
4
4
|
export { DEFAULT_AGENT_NAME } from "./config.js";
|
|
@@ -23,6 +23,7 @@ export interface OpenGibsonOptions {
|
|
|
23
23
|
/** Test seams. */
|
|
24
24
|
connect?: typeof connectGibson;
|
|
25
25
|
start?: typeof startLiveMission;
|
|
26
|
+
originate?: MissionOriginator;
|
|
26
27
|
hostKeyExists?: (path: string) => boolean;
|
|
27
28
|
trust?: (path: string) => Promise<void>;
|
|
28
29
|
}
|
package/dist/session.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
2
|
import { componentKnowledge, connectGibson, readSandboxDispatch, sandboxHarness, SANDBOX_ENV, startLiveMission, taskKnowledge, } from "@zeroroot-ai/sdk";
|
|
3
|
+
import { submitMission } from "./cli.js";
|
|
3
4
|
import { decideMode } from "./mode.js";
|
|
4
5
|
import { trustCA } from "./tls.js";
|
|
5
6
|
export { DEFAULT_AGENT_NAME } from "./config.js";
|
|
@@ -73,6 +74,9 @@ export async function openGibson(opts) {
|
|
|
73
74
|
live = await (opts.start ?? startLiveMission)(session, {
|
|
74
75
|
agentName,
|
|
75
76
|
targetId: settings.targetId,
|
|
77
|
+
// The person originates the session mission through the CLI login
|
|
78
|
+
// session; the component only claims its dispatch (gibson ADR-0063).
|
|
79
|
+
originate: opts.originate ?? ((definition, targetId) => submitMission(definition, targetId)),
|
|
76
80
|
harness: { insecure: settings.callbackInsecure },
|
|
77
81
|
});
|
|
78
82
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeroroot-ai/zerocool-claude",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Claude Code plugin: Gibson platform integration (zerocool). The session is a live mission. Memory, knowledge, findings, tools, delegation. The model stays on your Claude subscription.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
29
|
-
"@zeroroot-ai/sdk": "^0.
|
|
29
|
+
"@zeroroot-ai/sdk": "^0.9.0",
|
|
30
30
|
"zod": "^4.4.3"
|
|
31
31
|
},
|
|
32
32
|
"bin": {
|