@zeroroot-ai/zerocool-claude 0.5.1 → 0.6.0

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.
@@ -1,96 +0,0 @@
1
- import { formatKnowledgeForPrompt, isSeamUnavailable, remember, WorldEntityKind } from "@zeroroot-ai/sdk";
2
- import { z } from "zod";
3
- import { failure, text } from "./result.js";
4
- /**
5
- * Memory and knowledge (gibson#1593, decisions 9 and 10).
6
- *
7
- * `remember` is `Observe(MemoryObservation)`: the memory lands in the tenant
8
- * World as a Timeline event and the projector writes the graph node. It exists
9
- * only in the live posture, because the World is written under a mission.
10
- *
11
- * `recall` reads the graph. In the live posture it reads as the task, in the
12
- * component posture as the component. The model decides when a lookup is worth
13
- * a round trip, and the query it writes beats anything derived from the prompt.
14
- */
15
- export function registerMemoryTools(server, g) {
16
- if (g.knowledge) {
17
- const knowledge = g.knowledge;
18
- server.registerTool("recall", {
19
- description: "Search this tenant's Gibson knowledge graph for memories, prior findings, targets and " +
20
- "security facts recorded by earlier sessions and runs. Use it before you start on an " +
21
- "unfamiliar area, or to check whether something was already recorded.",
22
- inputSchema: {
23
- query: z.string().describe("What to look for, in natural language."),
24
- limit: z.number().int().min(1).max(50).optional().describe("Maximum hits. Defaults to 10."),
25
- node_types: z
26
- .array(z.string())
27
- .optional()
28
- .describe('Restrict to node types, e.g. ["Observation"] for memories or ["Finding"].'),
29
- },
30
- }, async (args) => {
31
- let hits;
32
- try {
33
- hits = await knowledge.query({
34
- text: args.query,
35
- topK: args.limit ?? 10,
36
- ...(args.node_types ? { nodeTypes: args.node_types } : {}),
37
- });
38
- }
39
- catch (e) {
40
- if (isSeamUnavailable(e)) {
41
- return text("recall unavailable", "The Gibson knowledge graph is not available on this daemon (gibson#1186). Continue without prior context.");
42
- }
43
- return failure("recall failed", e.message);
44
- }
45
- if (hits.length === 0)
46
- return text("no matches", `Nothing in the tenant graph matches "${args.query}".`);
47
- return text(`${hits.length} match${hits.length === 1 ? "" : "es"}`, formatKnowledgeForPrompt(hits));
48
- });
49
- }
50
- if (g.live) {
51
- const harness = g.live.harness;
52
- server.registerTool("remember", {
53
- description: "Keep a fact for later sessions, in this tenant's Gibson knowledge graph. Use it for a " +
54
- "convention, a decision, a layout fact or a gotcha you would want back next time. Not for " +
55
- "progress notes. A security finding goes to submit_finding instead.",
56
- inputSchema: {
57
- text: z.string().describe("The fact, in one or two sentences."),
58
- kind: z.string().optional().describe('A short category: "convention", "decision", "layout", "gotcha".'),
59
- tags: z.array(z.string()).optional().describe("Lower-case labels that help recall."),
60
- source_ref: z.string().optional().describe("Where it came from: a path, a URL, or a work id."),
61
- },
62
- }, async (args) => {
63
- try {
64
- await remember(harness, { text: args.text, kind: args.kind, tags: args.tags, sourceRef: args.source_ref });
65
- }
66
- catch (e) {
67
- return failure("remember failed", e.message);
68
- }
69
- return text("remembered", `Recorded in the tenant graph under mission ${g.live.missionId}.`);
70
- });
71
- server.registerTool("world_view", {
72
- description: "Read this mission's slice of the tenant World: the hosts, domains, credentials, accounts " +
73
- "and findings the platform knows about the target. Pass handles from a previous call in " +
74
- "focus to zoom into entities.",
75
- inputSchema: {
76
- focus: z.array(z.string()).optional().describe("Entity handles from an earlier world_view call."),
77
- },
78
- }, async (args) => {
79
- try {
80
- const res = await harness.client.worldView({ context: harness.context, focus: args.focus ?? [] });
81
- if (res.error)
82
- return failure("world_view refused", res.error.message);
83
- if (res.entities.length === 0)
84
- return text("empty slice", "The World holds nothing for this target yet.");
85
- const lines = res.entities.map((e) => {
86
- const attrs = Object.entries(e.attributes).map(([k, v]) => `${k}=${v}`).join(", ");
87
- return `- [${e.handle}] ${WorldEntityKind[e.kind] ?? e.kind} ${e.label}${attrs ? ` (${attrs})` : ""}`;
88
- });
89
- return text(`${res.entities.length} entit${res.entities.length === 1 ? "y" : "ies"}${res.truncated ? " (truncated)" : ""}`, lines.join("\n"));
90
- }
91
- catch (e) {
92
- return failure("world_view failed", e.message);
93
- }
94
- });
95
- }
96
- }
@@ -1,5 +0,0 @@
1
- import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
2
- /** One text block. MCP has no title/metadata split, so the title leads the text. */
3
- export declare function text(title: string, body: string, isError?: boolean): CallToolResult;
4
- /** Error text for a failure the model can act on. */
5
- export declare function failure(title: string, body: string): CallToolResult;
@@ -1,8 +0,0 @@
1
- /** One text block. MCP has no title/metadata split, so the title leads the text. */
2
- export function text(title, body, isError = false) {
3
- return { content: [{ type: "text", text: title ? `${title}\n\n${body}` : body }], ...(isError ? { isError } : {}) };
4
- }
5
- /** Error text for a failure the model can act on. */
6
- export function failure(title, body) {
7
- return text(title, body, true);
8
- }
@@ -1,5 +0,0 @@
1
- import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- import type { Gibson } from "../session.js";
3
- /** One tool that says what posture this session runs in and why. */
4
- export declare function registerStatusTool(server: McpServer, current: () => Gibson): void;
5
- export declare function describeGibson(g: Gibson): string;
@@ -1,21 +0,0 @@
1
- import { text } from "./result.js";
2
- /** One tool that says what posture this session runs in and why. */
3
- export function registerStatusTool(server, current) {
4
- server.registerTool("gibson_status", { description: "Show how this session is connected to Gibson: standalone, component, or a live mission, and what is missing if anything.", inputSchema: {} }, async () => text("", describeGibson(current())));
5
- }
6
- export function describeGibson(g) {
7
- const lines = [`posture: ${g.mode}`, `agent: ${g.agentName}`];
8
- if (g.session)
9
- lines.push(`component_scope: ${g.session.componentScope}`, `instance: ${g.session.instance.current()}`);
10
- if (g.live) {
11
- const exp = g.live.harness.expiresAt();
12
- lines.push(`mission: ${g.live.missionId}`, `work: ${g.live.workId}`, `grant expires: ${exp ? new Date(exp).toISOString() : "unknown"}`);
13
- }
14
- if (g.settings.platformURL)
15
- lines.push(`platform: ${g.settings.platformURL}`);
16
- if (g.settings.targetId)
17
- lines.push(`target: ${g.settings.targetId}`);
18
- if (g.reason)
19
- lines.push(`note: ${g.reason}`);
20
- return lines.join("\n");
21
- }