@inhuman.tools/harness-scheme 0.0.0-stage → 0.1.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.
- package/LICENSE.md +7 -0
- package/dist/bound-tools.d.ts +6 -0
- package/dist/bound-tools.d.ts.map +1 -0
- package/dist/bound-tools.js +88 -0
- package/dist/bound-tools.js.map +1 -0
- package/dist/catalog-description.d.ts +5 -0
- package/dist/catalog-description.d.ts.map +1 -0
- package/dist/catalog-description.js +150 -0
- package/dist/catalog-description.js.map +1 -0
- package/dist/connection-models.d.ts +20 -0
- package/dist/connection-models.d.ts.map +1 -0
- package/dist/connection-models.js +31 -0
- package/dist/connection-models.js.map +1 -0
- package/dist/env.d.ts +109 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +923 -0
- package/dist/env.js.map +1 -0
- package/dist/file-path.d.ts +2 -0
- package/dist/file-path.d.ts.map +1 -0
- package/dist/file-path.js +2 -0
- package/dist/file-path.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/interpret.d.ts +13 -0
- package/dist/interpret.d.ts.map +1 -0
- package/dist/interpret.js +26 -0
- package/dist/interpret.js.map +1 -0
- package/dist/keywords.d.ts +17 -0
- package/dist/keywords.d.ts.map +1 -0
- package/dist/keywords.js +76 -0
- package/dist/keywords.js.map +1 -0
- package/dist/limits.d.ts +11 -0
- package/dist/limits.d.ts.map +1 -0
- package/dist/limits.js +4 -0
- package/dist/limits.js.map +1 -0
- package/dist/program-source.d.ts +2 -0
- package/dist/program-source.d.ts.map +1 -0
- package/dist/program-source.js +2 -0
- package/dist/program-source.js.map +1 -0
- package/dist/replay.d.ts +9 -0
- package/dist/replay.d.ts.map +1 -0
- package/dist/replay.js +38 -0
- package/dist/replay.js.map +1 -0
- package/package.json +80 -3
- package/src/bound-tools.ts +108 -0
- package/src/catalog-description.ts +150 -0
- package/src/connection-models.ts +39 -0
- package/src/env.ts +1185 -0
- package/src/file-path.ts +1 -0
- package/src/index.ts +17 -0
- package/src/interpret.ts +26 -0
- package/src/keywords.ts +84 -0
- package/src/limits.ts +13 -0
- package/src/program-source.ts +1 -0
- package/src/replay.ts +46 -0
- package/README.md +0 -3
package/LICENSE.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2026 Merkle Bonsai
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { BoundTool } from "@inhuman.tools/substrate/bound-tool";
|
|
2
|
+
import type { KernelToolCatalog } from "@inhuman.tools/turn/catalog";
|
|
3
|
+
export declare function boundToolsOf(catalog: KernelToolCatalog, desk?: {
|
|
4
|
+
readonly readonly?: boolean;
|
|
5
|
+
}): ReadonlyMap<string, BoundTool>;
|
|
6
|
+
//# sourceMappingURL=bound-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bound-tools.d.ts","sourceRoot":"","sources":["../src/bound-tools.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAErE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAErE,wBAAgB,YAAY,CAC1B,OAAO,EAAE,iBAAiB,EAC1B,IAAI,CAAC,EAAE;IAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GACrC,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,CAuFhC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Teaching projection of the catalog, and the invoke allowlist when `readonly`.
|
|
3
|
+
* Connection rows carry slug+tool; pack rows carry pluginName + wire name.
|
|
4
|
+
* scheme_repl is not a nested symbol.
|
|
5
|
+
*/
|
|
6
|
+
import { AGENT_ASK, AGENT_MESSAGE, AGENT_NOTIFY, AGENT_SEND, AGENT_VOID, UPDATE_METADATA_TOOL_NAME, } from "@inhuman.tools/harness-model";
|
|
7
|
+
import { orderedFields } from "@inhuman.tools/substrate/tool-schema";
|
|
8
|
+
export function boundToolsOf(catalog, desk) {
|
|
9
|
+
const tools = new Map();
|
|
10
|
+
for (const entry of catalog.catalogEntries()) {
|
|
11
|
+
if (entry.representation === "tool")
|
|
12
|
+
continue;
|
|
13
|
+
if (desk?.readonly === true &&
|
|
14
|
+
(entry.wireName === "write_file" ||
|
|
15
|
+
entry.wireName === "edit_file" ||
|
|
16
|
+
(entry.source.kind === "connection" && entry.class === "write"))) {
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
const schema = entry.parameters.type !== undefined && entry.parameters.type !== "object"
|
|
20
|
+
? undefined
|
|
21
|
+
: entry.parameters;
|
|
22
|
+
const slug = entry.source.kind === "connection" ? entry.source.connectionKey : entry.source.pluginName;
|
|
23
|
+
const tool = entry.source.kind === "connection" ? entry.source.serverToolName : entry.wireName;
|
|
24
|
+
tools.set(entry.wireName, {
|
|
25
|
+
qualifiedName: entry.wireName,
|
|
26
|
+
slug,
|
|
27
|
+
tool,
|
|
28
|
+
schema,
|
|
29
|
+
signature: () => {
|
|
30
|
+
const fields = orderedFields(schema);
|
|
31
|
+
const params = fields.map((field) => {
|
|
32
|
+
const type = field.prop.type;
|
|
33
|
+
return {
|
|
34
|
+
name: field.name,
|
|
35
|
+
optional: field.optional,
|
|
36
|
+
typeToken: typeof type === "string" ? type : Array.isArray(type) && typeof type[0] === "string" ? type[0] : "any",
|
|
37
|
+
schema: field.prop,
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
let signatureText;
|
|
41
|
+
if (entry.source.kind === "connection") {
|
|
42
|
+
signatureText = `(mcp/call '${slug} '${tool} args)`;
|
|
43
|
+
}
|
|
44
|
+
else
|
|
45
|
+
switch (entry.wireName) {
|
|
46
|
+
case AGENT_VOID: {
|
|
47
|
+
signatureText = "(agent/void request-id)";
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
case AGENT_NOTIFY: {
|
|
51
|
+
signatureText = "(agent/notify request-id message)";
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
case AGENT_MESSAGE: {
|
|
55
|
+
signatureText = "(agent/message target message)";
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
case AGENT_SEND: {
|
|
59
|
+
signatureText = "(bot/send spec message) | (agent/call spec message :model)";
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
case AGENT_ASK: {
|
|
63
|
+
signatureText =
|
|
64
|
+
"(bot/ask spec message :readonly) | (bot/ask message [schema] :readonly) | (agent/ask spec message [schema] :readonly :model)";
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
case UPDATE_METADATA_TOOL_NAME: {
|
|
68
|
+
signatureText = "(update_metadata current_turn_title [current_turn_description])";
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
default: {
|
|
72
|
+
const required = fields.filter((field) => !field.optional).map((field) => field.name);
|
|
73
|
+
const optional = fields.filter((field) => field.optional).map((field) => field.name);
|
|
74
|
+
// glob / fff_search take a trailing dict (optional positional).
|
|
75
|
+
// Closed toolkit verbs take `:name` kwargs after the positionals.
|
|
76
|
+
const dictOpts = entry.wireName === "glob" || entry.wireName === "fff_search";
|
|
77
|
+
const kw = dictOpts ? (optional.length > 0 ? ["…opts"] : []) : optional.map((name) => `:${name}`);
|
|
78
|
+
const tail = [...required, ...kw].join(" ");
|
|
79
|
+
signatureText = tail === "" ? `(${entry.wireName})` : `(${entry.wireName} ${tail})`;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return { params, signatureText };
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return tools;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=bound-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bound-tools.js","sourceRoot":"","sources":["../src/bound-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,SAAS,EACT,aAAa,EACb,YAAY,EACZ,UAAU,EACV,UAAU,EACV,yBAAyB,GAC1B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,aAAa,EAAuB,MAAM,sCAAsC,CAAC;AAG1F,MAAM,UAAU,YAAY,CAC1B,OAA0B,EAC1B,IAAsC;IAEtC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAqB,CAAC;IAC3C,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC;QAC7C,IAAI,KAAK,CAAC,cAAc,KAAK,MAAM;YAAE,SAAS;QAC9C,IACE,IAAI,EAAE,QAAQ,KAAK,IAAI;YACvB,CAAC,KAAK,CAAC,QAAQ,KAAK,YAAY;gBAC9B,KAAK,CAAC,QAAQ,KAAK,WAAW;gBAC9B,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,YAAY,IAAI,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C,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;4BACrF,gEAAgE;4BAChE,kEAAkE;4BAClE,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,KAAK,MAAM,IAAI,KAAK,CAAC,QAAQ,KAAK,YAAY,CAAC;4BAC9E,MAAM,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;4BAClG,MAAM,IAAI,GAAG,CAAC,GAAG,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;4BAC5C,aAAa,GAAG,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,QAAQ,IAAI,IAAI,GAAG,CAAC;wBACtF,CAAC;oBACH,CAAC;gBACH,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;YACnC,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type KernelToolCatalog } from "@inhuman.tools/turn/catalog";
|
|
2
|
+
import type { SchemeReplFaces } from "./connection-models.js";
|
|
3
|
+
export { SCHEME_REPL_DISPLAY_NOTE } from "@inhuman.tools/scheme-program";
|
|
4
|
+
export declare function schemeReplDescription(catalog: KernelToolCatalog, faces?: SchemeReplFaces): string;
|
|
5
|
+
//# sourceMappingURL=catalog-description.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog-description.d.ts","sourceRoot":"","sources":["../src/catalog-description.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAsB,KAAK,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAIzF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAgB9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,iBAAiB,EAAE,KAAK,CAAC,EAAE,eAAe,GAAG,MAAM,CA+GjG"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Live `scheme_repl` tools[] description.
|
|
3
|
+
*
|
|
4
|
+
* Manifold law (arrival-manifold `buildCatalog`): world beat + derived slug
|
|
5
|
+
* inventory + one signature line per bound tool. A cold model that never
|
|
6
|
+
* calls cannot be taught by a door. Inventory names only bound slugs —
|
|
7
|
+
* never capability kinds ("files", "repositories").
|
|
8
|
+
*
|
|
9
|
+
* Not the manifold renderer: kwargs `(server/tool :k v)` and "this is the
|
|
10
|
+
* only tool" are the MCP-proxy world. Signatures come from `boundToolsOf`
|
|
11
|
+
* (positional toolkit, pack symbols, `mcp/call`, `agent/*`).
|
|
12
|
+
*
|
|
13
|
+
* Completion faces: <12 live ids enumerate (prefix on the first only).
|
|
14
|
+
* 12+ list operator recency, then "and N more".
|
|
15
|
+
*/
|
|
16
|
+
import { SCHEME_REPL_NAMING } from "@inhuman.tools/harness-model";
|
|
17
|
+
import dedent from "dedent";
|
|
18
|
+
import { boundToolsOf } from "./bound-tools.js";
|
|
19
|
+
const HOST_SLUGS = new Set(["toolkit", "shell", "named-agents", "web-search"]);
|
|
20
|
+
const MODEL_INVENTORY_ENUMERATE_MAX = 12;
|
|
21
|
+
function namedAgentInventory(recipes) {
|
|
22
|
+
const rows = recipes.filter((recipe) => recipe.spec.description.trim() !== "");
|
|
23
|
+
if (rows.length === 0)
|
|
24
|
+
return "";
|
|
25
|
+
const width = Math.max(...rows.map((recipe) => recipe.spec.name.length));
|
|
26
|
+
return dedent `
|
|
27
|
+
Bots — (bot/ask spec message) reuses the worker for this session; (agent/ask spec message) creates a disposable worker for that request. A schema is legal on (agent/ask spec message schema …) and on omitted-spec (bot/ask message schema), not on a standing named bot/ask.
|
|
28
|
+
${rows.map((recipe) => `${recipe.spec.name.padEnd(width)} ${recipe.spec.description.trim()}`).join("\n")}
|
|
29
|
+
(bot/ask message [schema]) omits spec for an anonymous worker this session reuses. agent/ask requires spec.
|
|
30
|
+
`;
|
|
31
|
+
}
|
|
32
|
+
export { SCHEME_REPL_DISPLAY_NOTE } from "@inhuman.tools/scheme-program";
|
|
33
|
+
export function schemeReplDescription(catalog, faces) {
|
|
34
|
+
const tools = boundToolsOf(catalog);
|
|
35
|
+
const seen = new Set();
|
|
36
|
+
const slugs = [];
|
|
37
|
+
for (const tool of tools.values()) {
|
|
38
|
+
const slug = tool.slug.trim();
|
|
39
|
+
if (slug === "" || HOST_SLUGS.has(slug) || seen.has(slug))
|
|
40
|
+
continue;
|
|
41
|
+
seen.add(slug);
|
|
42
|
+
slugs.push(slug);
|
|
43
|
+
}
|
|
44
|
+
let models = "";
|
|
45
|
+
if (faces != null && faces.connections.length > 0) {
|
|
46
|
+
const usage = faces.modelsUsage;
|
|
47
|
+
const ordered = [...faces.connections].sort((a, b) => {
|
|
48
|
+
const aLarge = a.models.length >= MODEL_INVENTORY_ENUMERATE_MAX;
|
|
49
|
+
const bLarge = b.models.length >= MODEL_INVENTORY_ENUMERATE_MAX;
|
|
50
|
+
if (aLarge !== bLarge)
|
|
51
|
+
return aLarge ? 1 : -1;
|
|
52
|
+
return a.id.localeCompare(b.id);
|
|
53
|
+
});
|
|
54
|
+
const lines = ordered.map((face) => {
|
|
55
|
+
if (face.models.length === 0)
|
|
56
|
+
return face.id;
|
|
57
|
+
if (face.models.length < MODEL_INVENTORY_ENUMERATE_MAX) {
|
|
58
|
+
return `${face.id} — ${face.models.map((id, index) => (index === 0 ? `${face.id}/${id}` : `/${id}`)).join(", ")}`;
|
|
59
|
+
}
|
|
60
|
+
const live = new Set(face.models);
|
|
61
|
+
const prefix = `${face.id}/`;
|
|
62
|
+
const recent = Object.entries(usage)
|
|
63
|
+
.flatMap(([key, at]) => {
|
|
64
|
+
if (!key.startsWith(prefix))
|
|
65
|
+
return [];
|
|
66
|
+
const model = key.slice(prefix.length);
|
|
67
|
+
if (model === "" || !live.has(model))
|
|
68
|
+
return [];
|
|
69
|
+
return [{ model, at: Number(at) }];
|
|
70
|
+
})
|
|
71
|
+
.sort((a, b) => b.at - a.at || a.model.localeCompare(b.model))
|
|
72
|
+
.map((row) => row.model)
|
|
73
|
+
.slice(0, MODEL_INVENTORY_ENUMERATE_MAX);
|
|
74
|
+
const more = face.models.length - recent.length;
|
|
75
|
+
const refs = recent.map((id) => `${face.id}/${id}`).join(", ");
|
|
76
|
+
if (refs === "")
|
|
77
|
+
return `${face.id} — ${face.id} and ${more} more`;
|
|
78
|
+
if (more <= 0)
|
|
79
|
+
return `${face.id} — ${refs}`;
|
|
80
|
+
return `${face.id} — ${refs}, and ${more} more`;
|
|
81
|
+
});
|
|
82
|
+
const firstLarge = ordered.find((face) => face.models.length >= MODEL_INVENTORY_ENUMERATE_MAX);
|
|
83
|
+
models = [
|
|
84
|
+
"Available models:",
|
|
85
|
+
...lines,
|
|
86
|
+
...(firstLarge == null
|
|
87
|
+
? []
|
|
88
|
+
: [
|
|
89
|
+
`to get the list with names of all models available for a specific connection, use (connection/models '${firstLarge.id})`,
|
|
90
|
+
]),
|
|
91
|
+
].join("\n");
|
|
92
|
+
}
|
|
93
|
+
return dedent `
|
|
94
|
+
Evaluate a sandboxed Scheme program once in \`${SCHEME_REPL_NAMING.argName}\`.
|
|
95
|
+
Multiple top-level forms run in one fresh scope (defines do not persist across calls).
|
|
96
|
+
Do not wrap them in (begin …), (list …), or [] — those wrappers are spliced and each statement is returned as its own result.
|
|
97
|
+
Scheme evaluation is synchronous except when waiting for tool calls.
|
|
98
|
+
No inner-call or time limit unless maxInternalCalls or timeoutMs is set.
|
|
99
|
+
Use scheme_watch only for requested recurring monitoring, not for ordinary agent calls or background work.
|
|
100
|
+
Autonomous host JSON tools cannot be called from Scheme.
|
|
101
|
+
${slugs.length === 0
|
|
102
|
+
? undefined
|
|
103
|
+
: dedent `
|
|
104
|
+
The functions below span: ${slugs.join(", ")}.
|
|
105
|
+
A task that mentions resources you have not seen in this conversation may be reachable through them — explore with these functions before asking the user.
|
|
106
|
+
`}
|
|
107
|
+
Toolkit functions take positional arguments: (read_file path), (list_dir path), (grep pattern), (glob pattern), (fff_search query), (write_file path contents), (edit_file path old new), (shell command), (web_search query), (web_extract url).
|
|
108
|
+
Closed toolkit optionals are Arrival kwargs after the positionals: (read_file path :offset 2 :limit 10), (list_dir path :depth 2), (grep pattern :path "src" :glob "*.ts"), (write_file path contents :overwriteExisting #t), (edit_file path old new :replace_all #t), (shell command :cwd "bin" :timeoutMs 5000), (web_search query :numResults 5), (web_extract url :charLimit 4000).
|
|
109
|
+
glob / fff_search take an optional trailing dict instead: (glob pattern {cwd: "src"}).
|
|
110
|
+
MCP: (mcp/call connection tool :k v …) or a final dict — unknown keys must survive.
|
|
111
|
+
Replacing an existing file needs (write_file path contents :overwriteExisting #t).
|
|
112
|
+
(require path) and (load path) are the same: they read a workspace file through the program loader, not read_file.
|
|
113
|
+
.scm spills defines into this run.
|
|
114
|
+
.json / .yaml return data.
|
|
115
|
+
.prompt returns a callable.
|
|
116
|
+
Relative paths jail at the project root.
|
|
117
|
+
Pack tools bind as their own symbols with the same positional/opts shape; the live catalog lists them.
|
|
118
|
+
(update_metadata title [description]) records this turn's session-list label. A keyword tail or one dict carries the same fields.
|
|
119
|
+
Bots: (bot/send spec message) waits until the standing bot responds or finishes without a response; the latter returns no value.
|
|
120
|
+
(bot/ask spec message :readonly) waits for a standing bot's response. (bot/ask message [schema] :readonly) omits spec for an anonymous worker this session reuses. A schema is legal on (agent/ask spec message schema …) and on omitted-spec (bot/ask message schema), not on a standing named bot/ask.
|
|
121
|
+
:readonly removes write_file, edit_file, and write-class MCP tools, but leaves shell available; it is not a guarantee against all mutations.
|
|
122
|
+
(agent/call spec message :model) and (agent/ask spec message [schema] :readonly :model) create a new disposable worker for each call. Spec is required; keywords follow the message, not a trailing dict. Schema is positional after the message.
|
|
123
|
+
:model is "connection/model" and pins that worker's completion wire.
|
|
124
|
+
(connection/models connection) lists live model ids on that connection.
|
|
125
|
+
(agent/message target message) delivers without waiting for a response.
|
|
126
|
+
Finish a worker request with the agent__respond JSON tool, not (agent/respond); (agent/void id) still voids a send.
|
|
127
|
+
Ask requires a response and rejects void.
|
|
128
|
+
(agent/notify id message) sends an update without completing the request.
|
|
129
|
+
Response schemas are Arrival s/* tags: (s/enum …), (s/string), (s/object (s/field …)), and the rest of that vocabulary.
|
|
130
|
+
(self/notify message) sends an update without completing execution.
|
|
131
|
+
Updates from a background program arrive as notifications in the conversation; when running inside a worker request, updates are attached to that request.
|
|
132
|
+
Results are values — nest and compose in one program instead of round-tripping.
|
|
133
|
+
Errors explain the expected form.
|
|
134
|
+
In a single execution, later top-level forms still run after an error.
|
|
135
|
+
Independent inner calls inside \`map\` run together; send/ask calls that reuse the same worker run sequentially on that worker.
|
|
136
|
+
${namedAgentInventory(catalog.allRecipes())}
|
|
137
|
+
${models}
|
|
138
|
+
Examples:${"" /*examples are needed to both show model that it's real scheme, and not quazi-language, and to explain on the symbol usage patterns*/}
|
|
139
|
+
(map (lambda (path) (agent/ask 'quick-search (string-append "who imports " path))) (glob "src/**/*.ts"))
|
|
140
|
+
(bot/send 'reviewer "review the diff at HEAD")
|
|
141
|
+
(bot/ask "ok?" (dict :answer (s/enum "yes" "no")))
|
|
142
|
+
(agent/ask 'explore "how does auth start" :readonly #t :model "openai/chatgpt-5.6-luna")
|
|
143
|
+
(mcp/call 'mail 'search :q "inbox")
|
|
144
|
+
(mcp/call 'mail 'search (dict :q "inbox"))
|
|
145
|
+
(write_file "notes.md" "# notes" :overwriteExisting #t)
|
|
146
|
+
(require "skill-to-program/skill-to-program.scm")
|
|
147
|
+
|
|
148
|
+
${[...tools.values()].map((tool) => tool.signature().signatureText).join("\n")}`;
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=catalog-description.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog-description.js","sourceRoot":"","sources":["../src/catalog-description.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGhD,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC,CAAC;AAC/E,MAAM,6BAA6B,GAAG,EAAE,CAAC;AAEzC,SAAS,mBAAmB,CAAC,OAAiC;IAC5D,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAC/E,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACjC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IACzE,OAAO,MAAM,CAAA;;MAET,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;GAE1G,CAA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A;kDACmC,kBAAkB,CAAC,OAAO;;;;;;;IAQxE,KAAK,CAAC,MAAM,KAAK,CAAC;QAChB,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,MAAM,CAAA;sCACwB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;;SAGpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA8BE,mBAAmB,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;IACzC,MAAM;aACG,EAAE,CAAC,qIAAqI;;;;;;;;;;IAUjJ,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AACnF,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Live model ids on a connection, and `connection/model` parse.
|
|
3
|
+
* One-shot `:model` and scheme_repl faces use the same ref.
|
|
4
|
+
*/
|
|
5
|
+
import type { ConnectionSpec } from "@inhuman.tools/plexus-expectations";
|
|
6
|
+
export type CompletionFace = {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly models: readonly string[];
|
|
9
|
+
};
|
|
10
|
+
export type SchemeReplFaces = {
|
|
11
|
+
readonly connections: readonly CompletionFace[];
|
|
12
|
+
readonly modelsUsage: Readonly<Record<string, number>>;
|
|
13
|
+
};
|
|
14
|
+
export declare function liveModelsOf(spec: ConnectionSpec): string[];
|
|
15
|
+
export declare function parseModelRef(raw: string): {
|
|
16
|
+
readonly connection: string;
|
|
17
|
+
readonly model: string;
|
|
18
|
+
} | undefined;
|
|
19
|
+
export declare function oneShotModelError(ref: string, connections: Record<string, ConnectionSpec | undefined>): string;
|
|
20
|
+
//# sourceMappingURL=connection-models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection-models.d.ts","sourceRoot":"","sources":["../src/connection-models.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEzE,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,WAAW,EAAE,SAAS,cAAc,EAAE,CAAC;IAChD,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACxD,CAAC;AAEF,wBAAgB,YAAY,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,EAAE,CAI3D;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAK9G;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,GAAG,SAAS,CAAC,GAAG,MAAM,CAQ9G"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Live model ids on a connection, and `connection/model` parse.
|
|
3
|
+
* One-shot `:model` and scheme_repl faces use the same ref.
|
|
4
|
+
*/
|
|
5
|
+
export function liveModelsOf(spec) {
|
|
6
|
+
const raw = spec.live.models;
|
|
7
|
+
if (!Array.isArray(raw))
|
|
8
|
+
return [];
|
|
9
|
+
return raw.map((row) => String(row).trim()).filter((id) => id !== "");
|
|
10
|
+
}
|
|
11
|
+
export function parseModelRef(raw) {
|
|
12
|
+
const trimmed = raw.trim();
|
|
13
|
+
const slash = trimmed.indexOf("/");
|
|
14
|
+
if (slash <= 0 || slash === trimmed.length - 1)
|
|
15
|
+
return undefined;
|
|
16
|
+
return { connection: trimmed.slice(0, slash), model: trimmed.slice(slash + 1) };
|
|
17
|
+
}
|
|
18
|
+
export function oneShotModelError(ref, connections) {
|
|
19
|
+
const parsed = parseModelRef(ref);
|
|
20
|
+
if (parsed == null)
|
|
21
|
+
return 'model must be "connection/model"';
|
|
22
|
+
const spec = connections[parsed.connection];
|
|
23
|
+
if (spec == null)
|
|
24
|
+
return `unknown connection ${parsed.connection}`;
|
|
25
|
+
if (!spec.driver.abilityClaim.includes("completion"))
|
|
26
|
+
return `${parsed.connection} is not a completion connection`;
|
|
27
|
+
if (!liveModelsOf(spec).includes(parsed.model))
|
|
28
|
+
return `unknown model ${parsed.model} on ${parsed.connection}`;
|
|
29
|
+
return "";
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=connection-models.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection-models.js","sourceRoot":"","sources":["../src/connection-models.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH,MAAM,UAAU,YAAY,CAAC,IAAoB;IAC/C,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;IAC7B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QAAE,OAAO,EAAE,CAAC;IACnC,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAC3B,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACnC,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,KAAK,OAAO,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IACjE,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC;AAClF,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,GAAW,EAAE,WAAuD;IACpG,MAAM,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,MAAM,IAAI,IAAI;QAAE,OAAO,kCAAkC,CAAC;IAC9D,MAAM,IAAI,GAAG,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAC5C,IAAI,IAAI,IAAI,IAAI;QAAE,OAAO,sBAAsB,MAAM,CAAC,UAAU,EAAE,CAAC;IACnE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,YAAY,CAAC;QAAE,OAAO,GAAG,MAAM,CAAC,UAAU,iCAAiC,CAAC;IACnH,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC;QAAE,OAAO,iBAAiB,MAAM,CAAC,KAAK,OAAO,MAAM,CAAC,UAAU,EAAE,CAAC;IAC/G,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
package/dist/env.d.ts
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scheme-repl verbs. Module singleton: job, host, rig, and tools are
|
|
3
|
+
* configuration, read when a verb runs.
|
|
4
|
+
*
|
|
5
|
+
* Calls look synchronous; Arrival's trampoline fans out independent host
|
|
6
|
+
* promises. Background is an outer tool arg, not a verb — the ProgrammaticJob
|
|
7
|
+
* is foreground or background as a whole.
|
|
8
|
+
*
|
|
9
|
+
* Config is the stable bag (writable, host, tools, loader, prompt, keyOf). The
|
|
10
|
+
* interpreter adds job and rig at arm and mutates the rig in place. The
|
|
11
|
+
* vocabulary memo keys on capability identity plus that object, so a watch
|
|
12
|
+
* tick does not re-bake.
|
|
13
|
+
*
|
|
14
|
+
* Toolkit we own: required positionals, optional trailing dict. Ask schemas are
|
|
15
|
+
* Arrival s/* tagged lists (`schemaCapability`); this pack does not mint a
|
|
16
|
+
* second type wire. Pack-tool *names* are not known at `define()`, so they bind
|
|
17
|
+
* as their own symbols on a per-catalog overlay onto the same `call` substrate.
|
|
18
|
+
* `mcp/call` is catalog lookup onto that same `call`. Connection and tool
|
|
19
|
+
* are positionals; the last argument stays Arrival `inputRest` as `sz.dynamic`
|
|
20
|
+
* so a trailing dict and `:k v` pairs both land — a record kwargs shape
|
|
21
|
+
* would drop unknown MCP keys. Closed toolkit verbs (list_dir, grep, write/edit,
|
|
22
|
+
* shell, web_search, web_extract) keep their positionals and take a `sz.dynamic`
|
|
23
|
+
* rest through `keywordsOf`. A record `inputRest` is keywords only and drops
|
|
24
|
+
* the positional input. `read_file` stays native and peels its own rest.
|
|
25
|
+
* bot/send, and bot/ask when it names a spec, construct
|
|
26
|
+
* BotCallJob. agent/call, agent/ask, and an omitted-spec bot/ask construct
|
|
27
|
+
* AgentCallJob. The job name stays agent__send or agent__ask; the class owns
|
|
28
|
+
* the worker, so these verbs do not mint oneShot. The verb `registerJob`s the
|
|
29
|
+
* job it constructed. Pack bot-call tools, worker replies, and ordinary host
|
|
30
|
+
* tools still admit, then `registerJob` the leaf. A `.prompt` on this program
|
|
31
|
+
* constructs an AgentCallJob the same way. Spec/message/[schema]
|
|
32
|
+
* stay positional; `:readonly` and `:model` are Arrival kwargs on `inputRest`.
|
|
33
|
+
* `:model` is `"connection/model"` and pins that disposable worker.
|
|
34
|
+
* `connection/models` lists a wire's live ids.
|
|
35
|
+
* Comms are the same call onto agent__* wires. `agent/respond` is a
|
|
36
|
+
* notImplemented door — settle with the `agent__respond` JSON tool.
|
|
37
|
+
* `self/notify` is an origin atom on this bag (or the enclosing Call); it does
|
|
38
|
+
* not settle. Bag-home atoms recall only when the bag is background; a sitter
|
|
39
|
+
* writes the enclosing Call.
|
|
40
|
+
*/
|
|
41
|
+
import { EnvCapability } from "@here.build/arrival";
|
|
42
|
+
import { type Loader } from "@here.build/arrival-modules";
|
|
43
|
+
import { type PromptComplete } from "@inhuman.tools/env-capability-module-prompt";
|
|
44
|
+
import { type AgentCallNotification, ApprovableJob, ProgrammaticJob, type SessionRoot, ToolCallJob } from "@inhuman.tools/harness-model";
|
|
45
|
+
import { type ProgramHost, type ProgramRuntime } from "@inhuman.tools/scheme-program";
|
|
46
|
+
import type { BoundTool } from "@inhuman.tools/substrate/bound-tool";
|
|
47
|
+
import { DoorSession } from "@inhuman.tools/substrate/doors";
|
|
48
|
+
import type { ToolCall } from "@inhuman.tools/tool-call-normalize";
|
|
49
|
+
import type { KernelToolCatalog } from "@inhuman.tools/turn/catalog";
|
|
50
|
+
import { z } from "zod";
|
|
51
|
+
export type SchemeReplHost = {
|
|
52
|
+
/** Absent on a replay host, which binds `replayTools` and never admits. */
|
|
53
|
+
readonly catalog?: KernelToolCatalog;
|
|
54
|
+
readonly root: string;
|
|
55
|
+
/** Match recorded children. Missing is an error, and nothing is minted. */
|
|
56
|
+
readonly replayOnly?: boolean;
|
|
57
|
+
/** Pack names recorded on the job. Replaces the daemon catalog. */
|
|
58
|
+
readonly replayTools?: ReadonlyMap<string, BoundTool>;
|
|
59
|
+
/** Disk `require`. Replay leaves this unset and reads `job.modules`. */
|
|
60
|
+
readonly loadSource?: (root: string, job: ProgrammaticJob) => Loader;
|
|
61
|
+
readonly signal?: AbortSignal;
|
|
62
|
+
readonly sessionId?: string;
|
|
63
|
+
readonly session?: SessionRoot;
|
|
64
|
+
readonly doors: DoorSession;
|
|
65
|
+
readonly admit: (call: ToolCall) => ToolCallJob | ProgrammaticJob;
|
|
66
|
+
readonly abort?: (leaf: ApprovableJob, reason?: unknown) => void;
|
|
67
|
+
/** Origin atom. Default writes `job.notifications`. Orchestrator may XOR onto an enclosing Call. */
|
|
68
|
+
readonly notify?: (note: AgentCallNotification) => void;
|
|
69
|
+
/** Watch key. Omit → pack provenance from the per-tick tap. */
|
|
70
|
+
readonly keyOf?: (value: unknown) => string | undefined;
|
|
71
|
+
/** Ask desk. Bound-tools allowlist drops write/edit; shell stays. */
|
|
72
|
+
readonly readonly?: boolean;
|
|
73
|
+
/** Live model ids for `(connection/models)`. Missing name throws. */
|
|
74
|
+
readonly connectionModels?: (connection: string) => readonly string[];
|
|
75
|
+
/** Wraps each run so the daemon owns its trace; see `ProgramHost.observe`. */
|
|
76
|
+
readonly observe?: ProgramHost["observe"];
|
|
77
|
+
/** Unattended eval. Honors `source` / `sourcePath` on the bag. */
|
|
78
|
+
readonly evalProgram?: boolean;
|
|
79
|
+
/** Override jail root. Default is `dirname(sourcePath)`. */
|
|
80
|
+
readonly moduleRoot?: string;
|
|
81
|
+
readonly complete?: PromptComplete;
|
|
82
|
+
readonly connectionId?: string;
|
|
83
|
+
readonly completionModel?: string;
|
|
84
|
+
};
|
|
85
|
+
/** Per-tick. Verbs read it when they run; it is not baked into the capability. */
|
|
86
|
+
type ReplRig = {
|
|
87
|
+
signal: AbortSignal;
|
|
88
|
+
origin: number;
|
|
89
|
+
replayAt: number;
|
|
90
|
+
/** toolCalls length at the start of the current top-level statement. */
|
|
91
|
+
formAt: number;
|
|
92
|
+
maxInternalCalls: number | undefined;
|
|
93
|
+
failureCode: string | undefined;
|
|
94
|
+
};
|
|
95
|
+
export type ReplRuntime = ProgramRuntime;
|
|
96
|
+
export declare const schemeReplCapability: EnvCapability<{
|
|
97
|
+
writable: z.ZodOptional<z.ZodBoolean>;
|
|
98
|
+
job: z.ZodOptional<z.ZodCustom<ProgrammaticJob, ProgrammaticJob>>;
|
|
99
|
+
host: z.ZodOptional<z.ZodCustom<SchemeReplHost, SchemeReplHost>>;
|
|
100
|
+
rig: z.ZodOptional<z.ZodCustom<ReplRig, ReplRig>>;
|
|
101
|
+
tools: z.ZodOptional<z.ZodCustom<ReadonlyMap<string, BoundTool>, ReadonlyMap<string, BoundTool>>>;
|
|
102
|
+
}, Record<string, never>>;
|
|
103
|
+
/** Identity is the host object, so a park remint still compares SchemeReplHost identity. */
|
|
104
|
+
export declare function programHostOf(host: SchemeReplHost): ProgramHost;
|
|
105
|
+
export declare function replRuntimeOf(job: ProgrammaticJob, host: SchemeReplHost): ReplRuntime;
|
|
106
|
+
/** R7RS `load` is a host door. Last-write-wins over it; expands to `require`. */
|
|
107
|
+
export declare const schemeLoadAliasCapability: EnvCapability<Record<string, never>, Record<string, never>>;
|
|
108
|
+
export {};
|
|
109
|
+
//# sourceMappingURL=env.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,OAAO,EAEL,aAAa,EAKd,MAAM,qBAAqB,CAAC;AAI7B,OAAO,EAAE,KAAK,MAAM,EAA2B,MAAM,6BAA6B,CAAC;AAGnF,OAAO,EAA2B,KAAK,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAC3G,OAAO,EAOL,KAAK,qBAAqB,EAC1B,aAAa,EAQb,eAAe,EAKf,KAAK,WAAW,EAEhB,WAAW,EAIZ,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAML,KAAK,WAAW,EAChB,KAAK,cAAc,EACpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,WAAW,EAA2C,MAAM,gCAAgC,CAAC;AACtG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAGrE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAYxB,MAAM,MAAM,cAAc,GAAG;IAC3B,2EAA2E;IA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