@0perator/operator 0.2.0 → 0.2.2-next.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/README.md +5 -4
- package/dist/auth/byo.js +1 -1
- package/dist/auth/commands.js +15 -5
- package/dist/auth/identity.js +1 -0
- package/dist/auth/staff.js +55 -0
- package/dist/autonomy/agent-cli.js +1 -1
- package/dist/autonomy/delegate-mode.js +2 -2
- package/dist/autonomy/delegate.js +41 -14
- package/dist/autonomy/headless.js +37 -10
- package/dist/autonomy/index.js +2 -4
- package/dist/autonomy/pr-isolation.js +92 -0
- package/dist/autonomy/pr-preflight.js +474 -0
- package/dist/autonomy/session-factory.js +13 -12
- package/dist/autonomy/subagent-model.js +17 -7
- package/dist/background/capacity.js +136 -0
- package/dist/background/evidence.js +42 -0
- package/dist/background/index.js +311 -44
- package/dist/background/lane-phase.js +60 -0
- package/dist/background/lane-summary.js +151 -0
- package/dist/background/notices.js +12 -3
- package/dist/background/synthesis.js +25 -0
- package/dist/browser/capture.js +505 -0
- package/dist/browser/engine.js +4 -3
- package/dist/browser/page-capture.js +167 -0
- package/dist/browser/png.js +116 -0
- package/dist/browser/visual-compare.js +229 -0
- package/dist/bus/beam-drop.js +55 -0
- package/dist/bus/inbox.js +157 -7
- package/dist/cli.js +316 -120
- package/dist/config/features.js +3 -3
- package/dist/config/managed.js +40 -1
- package/dist/config/persona.js +80 -29
- package/dist/config/product-hosts.js +2 -0
- package/dist/config/settings.js +289 -31
- package/dist/config/skills-index.js +37 -14
- package/dist/config/staff-prompt.js +12 -0
- package/dist/engine/agent.js +52 -41
- package/dist/engine/aurora.js +54 -13
- package/dist/engine/batch-scheduler.js +4 -13
- package/dist/engine/compaction.js +1 -1
- package/dist/engine/continuation.js +66 -32
- package/dist/engine/decision-points.js +2 -3
- package/dist/engine/fanout.js +16 -0
- package/dist/engine/identity.js +42 -0
- package/dist/engine/loop-guard.js +26 -83
- package/dist/engine/messages.js +2 -2
- package/dist/engine/moa.js +23 -1
- package/dist/engine/native-vision-node.js +72 -0
- package/dist/engine/native-vision.js +103 -0
- package/dist/engine/net-error.js +15 -0
- package/dist/engine/rolling-summary.js +142 -93
- package/dist/engine/verify-gate.js +37 -7
- package/dist/engine/waterfall.js +33 -0
- package/dist/gateway-cli.js +24 -4
- package/dist/memory/live-progress.js +4 -5
- package/dist/memory/session-index.js +3 -3
- package/dist/moa/codeact-lane.js +98 -0
- package/dist/moa/codeact-sandbox.js +409 -0
- package/dist/moa/codeact.js +140 -0
- package/dist/permissions/artifact-visibility.js +10 -0
- package/dist/permissions/index.js +2 -1
- package/dist/permissions/policy.js +9 -2
- package/dist/permissions/tier.js +13 -3
- package/dist/products/craft.js +92 -3
- package/dist/products/temple.js +20 -1
- package/dist/products/voice.js +112 -0
- package/dist/remote/grants.js +119 -0
- package/dist/remote/host.js +33 -5
- package/dist/router/free-models.js +5 -9
- package/dist/router/models.js +80 -26
- package/dist/router/provider-models.js +78 -0
- package/dist/router/router.js +15 -3
- package/dist/selfimprove/index.js +8 -6
- package/dist/selfimprove/lessons.js +23 -0
- package/dist/services/preflight.js +35 -91
- package/dist/session.js +316 -125
- package/dist/skills/catalogue.js +5 -2
- package/dist/skills/finder.js +4 -4
- package/dist/skills/install-guard.js +68 -0
- package/dist/skills/install.js +67 -0
- package/dist/toolchain/manifest.json +13 -13
- package/dist/tools/background-result.js +1 -1
- package/dist/tools/beam.js +246 -0
- package/dist/tools/classes.js +103 -0
- package/dist/tools/contract.js +1 -1
- package/dist/tools/craft.js +36 -2
- package/dist/tools/deferred.js +7 -3
- package/dist/tools/doc-text.js +1 -1
- package/dist/tools/executor.js +25 -15
- package/dist/tools/generation-gateway.js +94 -0
- package/dist/tools/registry.js +135 -158
- package/dist/tools/sandbox.js +6 -6
- package/dist/ui/App.js +17 -6
- package/dist/ui/ApprovalPrompt.js +1 -1
- package/dist/ui/BgPanel.js +15 -10
- package/dist/ui/Composer.js +44 -2
- package/dist/ui/Header.js +1 -6
- package/dist/ui/StatusRule.js +20 -8
- package/dist/ui/ToolStep.js +3 -3
- package/dist/ui/Transcript.js +41 -14
- package/dist/ui/batchLine.js +4 -4
- package/dist/ui/editdiff.js +2 -4
- package/dist/ui/format.js +4 -20
- package/dist/ui/liveTools.js +3 -3
- package/dist/ui/modelPicker.js +10 -6
- package/dist/ui/opsMode.js +20 -0
- package/dist/ui/phase.js +4 -2
- package/dist/ui/slashCommands.js +1 -0
- package/dist/ui/types.js +0 -2
- package/dist/ui/voice.js +185 -0
- package/dist/update-check.js +17 -6
- package/dist/update.js +1 -2
- package/dist/util/audio-io.js +82 -0
- package/dist/util/slash.js +2 -2
- package/dist/vision/pairs.js +239 -0
- package/package.json +1 -1
- package/dist/tools/mutating.js +0 -15
package/dist/config/features.js
CHANGED
|
@@ -71,11 +71,11 @@ export const FEATURES = {
|
|
|
71
71
|
},
|
|
72
72
|
/** craft product (products/craft.ts): the hosted, account-owned, shareable surface (page/deck/doc/board/app)
|
|
73
73
|
* on the shared product rails — the promotion of artifact_create into a first-class owned, versioned product.
|
|
74
|
-
*
|
|
75
|
-
*
|
|
74
|
+
* The library tools (craft_list/get/update/delete) are on for every seat since 2026-11-29 (registry.ts
|
|
75
|
+
* craftToolsFor); this flag now adds only craft_create, which duplicates artifact_create. SPEC: products-craft-mdoc. */
|
|
76
76
|
craft: {
|
|
77
77
|
default: false,
|
|
78
|
-
description: "
|
|
78
|
+
description: "Add craft_create (a second way to make an artifact; artifact_create is the stock one). The artifact library tools are always on",
|
|
79
79
|
},
|
|
80
80
|
};
|
|
81
81
|
/** Env var that overrides one feature: camelCase → UPPER_SNAKE, e.g. classifierGate → KODE_FEATURE_CLASSIFIER_GATE. */
|
package/dist/config/managed.js
CHANGED
|
@@ -25,6 +25,8 @@ export const LOCKDOWN = {
|
|
|
25
25
|
computer: { enabled: false },
|
|
26
26
|
mcp: false,
|
|
27
27
|
selfImprove: { flywheel: false },
|
|
28
|
+
skylark: { share: false },
|
|
29
|
+
visionPairs: { enabled: false },
|
|
28
30
|
};
|
|
29
31
|
export function systemManagedPaths(plat = process.platform, env = process.env) {
|
|
30
32
|
if (plat === "darwin")
|
|
@@ -89,7 +91,7 @@ export function validateManagedPolicy(raw) {
|
|
|
89
91
|
const policy = {};
|
|
90
92
|
if (!isObj(raw))
|
|
91
93
|
return { policy, errors: ["policy must be a JSON object"], unknown: [] };
|
|
92
|
-
const known = new Set(["permissions", "sandbox", "computer", "mcp", "selfImprove", "unrestricted", "auth", "$schema", "_comment"]);
|
|
94
|
+
const known = new Set(["permissions", "sandbox", "computer", "mcp", "selfImprove", "skylark", "visionPairs", "unrestricted", "auth", "$schema", "_comment"]);
|
|
93
95
|
const unknown = Object.keys(raw).filter((k) => !known.has(k));
|
|
94
96
|
if (raw.permissions !== undefined) {
|
|
95
97
|
if (!isObj(raw.permissions))
|
|
@@ -142,6 +144,36 @@ export function validateManagedPolicy(raw) {
|
|
|
142
144
|
else
|
|
143
145
|
errors.push("selfImprove.flywheel must be a boolean");
|
|
144
146
|
}
|
|
147
|
+
if (raw.skylark !== undefined) {
|
|
148
|
+
const ok = isObj(raw.skylark) && Object.keys(raw.skylark).length > 0 &&
|
|
149
|
+
Object.entries(raw.skylark).every(([k, v]) => (k === "enabled" || k === "share") && v === false);
|
|
150
|
+
if (ok)
|
|
151
|
+
policy.skylark = raw.skylark;
|
|
152
|
+
else
|
|
153
|
+
errors.push("skylark.enabled / skylark.share may only be set to false (a policy can turn Skylark off, never on)");
|
|
154
|
+
}
|
|
155
|
+
if (raw.visionPairs !== undefined) {
|
|
156
|
+
const vp = raw.visionPairs;
|
|
157
|
+
const list = (v, what, re) => {
|
|
158
|
+
if (v === undefined)
|
|
159
|
+
return undefined;
|
|
160
|
+
if (!Array.isArray(v) || v.length > 500 || !v.every((x) => typeof x === "string" && x.trim().length > 0 && x.length <= 200 && re.test(x.trim()))) {
|
|
161
|
+
errors.push(`visionPairs.${what} must be a list of up to 500 plain strings`);
|
|
162
|
+
return undefined;
|
|
163
|
+
}
|
|
164
|
+
return [...new Set(v.map((x) => x.trim()))];
|
|
165
|
+
};
|
|
166
|
+
if (!isObj(vp) || !Object.keys(vp).every((k) => k === "enabled" || k === "denyHosts" || k === "denyPaths"))
|
|
167
|
+
errors.push("visionPairs accepts only enabled (false), denyHosts and denyPaths");
|
|
168
|
+
else if (vp.enabled !== undefined && vp.enabled !== false)
|
|
169
|
+
errors.push("visionPairs.enabled may only be set to false");
|
|
170
|
+
else {
|
|
171
|
+
const denyHosts = list(vp.denyHosts, "denyHosts", /^[A-Za-z0-9.*-]+$/);
|
|
172
|
+
const denyPaths = list(vp.denyPaths, "denyPaths", /^[^\/\u0000]+$/);
|
|
173
|
+
if (vp.enabled === false || denyHosts || denyPaths)
|
|
174
|
+
policy.visionPairs = { ...(vp.enabled === false ? { enabled: false } : {}), ...(denyHosts ? { denyHosts } : {}), ...(denyPaths ? { denyPaths } : {}) };
|
|
175
|
+
}
|
|
176
|
+
}
|
|
145
177
|
if (raw.unrestricted !== undefined) {
|
|
146
178
|
if (typeof raw.unrestricted === "boolean")
|
|
147
179
|
policy.unrestricted = raw.unrestricted;
|
|
@@ -224,6 +256,13 @@ export function applyManagedPolicy(s, load) {
|
|
|
224
256
|
out.mcp = p.mcp;
|
|
225
257
|
if (p.selfImprove)
|
|
226
258
|
out.selfImprove = { ...s.selfImprove, flywheel: p.selfImprove.flywheel };
|
|
259
|
+
if (p.skylark)
|
|
260
|
+
out.skylark = { ...s.skylark, ...p.skylark };
|
|
261
|
+
if (p.visionPairs) {
|
|
262
|
+
const union = (a, b) => (a || b ? [...new Set([...(a ?? []), ...(b ?? [])])] : undefined);
|
|
263
|
+
const denyHosts = union(s.visionPairs?.denyHosts, p.visionPairs.denyHosts), denyPaths = union(s.visionPairs?.denyPaths, p.visionPairs.denyPaths);
|
|
264
|
+
out.visionPairs = { ...s.visionPairs, ...(p.visionPairs.enabled === false ? { enabled: false } : {}), ...(denyHosts ? { denyHosts } : {}), ...(denyPaths ? { denyPaths } : {}) };
|
|
265
|
+
}
|
|
227
266
|
if (p.unrestricted === false)
|
|
228
267
|
out.unrestricted = false;
|
|
229
268
|
return out;
|
package/dist/config/persona.js
CHANGED
|
@@ -6,12 +6,12 @@ import { readFileSync, appendFileSync, mkdirSync, existsSync, writeFileSync, ren
|
|
|
6
6
|
import { join, dirname } from "node:path";
|
|
7
7
|
import { operatorPath, globalMemoriesPath } from "./home.js";
|
|
8
8
|
import { renderHarnessContext } from "./operator-harness.js";
|
|
9
|
-
import { renderToolCatalogue, registry } from "../tools/registry.js";
|
|
9
|
+
import { renderToolCatalogue, registry, cloudAgentToolsFor, mdocToolsFor, craftToolsFor } from "../tools/registry.js";
|
|
10
10
|
import { isFeatureEnabled } from "./features.js";
|
|
11
11
|
import { renderSkillsIndex } from "./skills-index.js";
|
|
12
12
|
import { decisionPointsEnabled } from "../engine/decision-points.js";
|
|
13
13
|
import { SUBAGENT_ROLES, SUBAGENT_TOOL_DENY } from "../engine/grandmaster.js";
|
|
14
|
-
import { LESSONS_HEADING, isLessonHeading, mergeLessons, parseLessonTag, reinforcedRules, splitLessons } from "../selfimprove/lessons.js";
|
|
14
|
+
import { LESSONS_HEADING, PROMPT_LESSONS, isLessonHeading, mergeLessons, parseLessonTag, reinforcedRules, splitLessons, topLessons } from "../selfimprove/lessons.js";
|
|
15
15
|
import { redactSecrets } from "../engine/redact.js";
|
|
16
16
|
import { fitWhole, splitItems, splitSections } from "./memory-sections.js";
|
|
17
17
|
import { freshHandoff, withoutSettled } from "../memory/live-progress.js";
|
|
@@ -54,11 +54,32 @@ export function projectMemoriesPath(cwd = process.cwd()) {
|
|
|
54
54
|
return join(cwd, ".operator", "memories.md");
|
|
55
55
|
}
|
|
56
56
|
const unitSize = (u) => u.text.length + 2;
|
|
57
|
+
/** A file index entry (`- name.md: what it covers`) keeps one short line; the file itself is read on demand. */
|
|
58
|
+
export const INDEX_LINE_CHARS = 80;
|
|
59
|
+
const INDEX_ENTRY = /^- [\w./-]+\.md\b/;
|
|
60
|
+
/** A section whose every list item names a .md file is an index: each entry cut to `max` chars at a word. Pure. */
|
|
61
|
+
export function compactFileIndex(text, max = INDEX_LINE_CHARS) {
|
|
62
|
+
const lines = text.split("\n");
|
|
63
|
+
const items = lines.filter((l) => /^[-*] /.test(l));
|
|
64
|
+
if (!items.length || !items.every((l) => INDEX_ENTRY.test(l)))
|
|
65
|
+
return text;
|
|
66
|
+
const clip = (l) => {
|
|
67
|
+
if (l.length <= max)
|
|
68
|
+
return l;
|
|
69
|
+
const cut = l.slice(0, max - 1);
|
|
70
|
+
const sp = cut.lastIndexOf(" ");
|
|
71
|
+
return (sp > max / 2 ? cut.slice(0, sp) : cut).replace(/[\s,;:—-]+$/, "") + "…";
|
|
72
|
+
};
|
|
73
|
+
return lines.map((l) => (INDEX_ENTRY.test(l) ? clip(l) : l)).join("\n");
|
|
74
|
+
}
|
|
57
75
|
/** A file's units: each headed section whole, and the facts of its flat list (the text before the first heading). */
|
|
58
|
-
function fileUnits(rest) {
|
|
59
|
-
return splitSections(rest).flatMap((section) =>
|
|
60
|
-
|
|
61
|
-
|
|
76
|
+
function fileUnits(rest, indexLineChars = INDEX_LINE_CHARS) {
|
|
77
|
+
return splitSections(rest).flatMap((section) => {
|
|
78
|
+
if (!section.heading)
|
|
79
|
+
return splitItems(section.text).map((text) => ({ text, fact: true }));
|
|
80
|
+
const text = compactFileIndex(section.text, indexLineChars);
|
|
81
|
+
return [{ text, section: { ...section, text } }];
|
|
82
|
+
});
|
|
62
83
|
}
|
|
63
84
|
/** One file's sections and facts under `budget` in priority order — `ahead` first (the lessons), then the rules sections,
|
|
64
85
|
* `between` (the taught lessons), the flat facts newest first, the notes sections — rendered as the rules, the facts,
|
|
@@ -78,36 +99,38 @@ function fitFile(units, budget, ahead = [], between = []) {
|
|
|
78
99
|
return { fit, shown, droppedNames };
|
|
79
100
|
}
|
|
80
101
|
const leftOut = (names, where) => names.length ? `\n(left out for the memory budget: ${names.join(", ")} — read ${where} for them)` : "";
|
|
81
|
-
/** The memory blocks of the system prompt: the lessons of both files as one list, then the global file's sections,
|
|
82
|
-
* the project file's — each file under its own MEMORY_BUDGET, whole lessons and sections only. Pure. */
|
|
83
|
-
export function renderMemories(global, project) {
|
|
102
|
+
/** The memory blocks of the system prompt: the top lessons of both files as one list, then the global file's sections,
|
|
103
|
+
* then the project file's — each file under its own MEMORY_BUDGET, whole lessons and sections only. Pure. */
|
|
104
|
+
export function renderMemories(global, project, opts = {}) {
|
|
84
105
|
const taught = reinforcedRules(global?.text ?? "");
|
|
85
106
|
const g = splitLessons(global?.text ?? "", taught);
|
|
86
107
|
const p = project ? splitLessons(project.text, taught) : undefined;
|
|
87
|
-
const
|
|
108
|
+
const top = topLessons(mergeLessons(g.lessons, p?.lessons ?? []), opts.lessons ?? PROMPT_LESSONS);
|
|
109
|
+
const lessons = top.kept.map(redactSecrets); // a line an older build wrote unmasked
|
|
88
110
|
const auto = [...lessons.filter((l) => parseLessonTag(l)?.kind !== "taught"), ...g.other, ...(p?.other ?? [])].map((text) => ({ text }));
|
|
89
111
|
const fromReviewers = lessons.filter((l) => parseLessonTag(l)?.kind === "taught").map((text) => ({ text }));
|
|
90
112
|
const where = global?.path ?? "memories.md";
|
|
91
113
|
let out = "";
|
|
92
|
-
const gf = fitFile(fileUnits(g.rest), MEMORY_BUDGET.global, auto, fromReviewers);
|
|
114
|
+
const gf = fitFile(fileUnits(g.rest, opts.indexLineChars), MEMORY_BUDGET.global, auto, fromReviewers);
|
|
93
115
|
const keptLessons = [...auto, ...fromReviewers].filter((u) => gf.fit.kept.has(u));
|
|
94
116
|
const droppedLessons = auto.length + fromReviewers.length - keptLessons.length;
|
|
95
117
|
if (keptLessons.length) {
|
|
96
118
|
out += `\n\n${LESSONS_HEADING}\n${keptLessons.map((u) => u.text).join("\n")}` +
|
|
97
|
-
(droppedLessons ? `\n(${droppedLessons} older lesson${droppedLessons === 1 ? "" : "s"} left out for the memory budget — all of them are in ${where})` : "")
|
|
119
|
+
(droppedLessons ? `\n(${droppedLessons} older lesson${droppedLessons === 1 ? "" : "s"} left out for the memory budget — all of them are in ${where})` : "") +
|
|
120
|
+
(top.rest ? `\n(${top.rest} more lesson${top.rest === 1 ? "" : "s"} not loaded: memory_search finds them; all are in ${where})` : "");
|
|
98
121
|
}
|
|
99
122
|
if (gf.shown.length || gf.droppedNames.length) {
|
|
100
123
|
out += `\n\n## Global memory (memories.md — applies to every project)\n${gf.shown.join("\n\n")}${leftOut(gf.droppedNames, where)}`;
|
|
101
124
|
}
|
|
102
125
|
if (project && p) {
|
|
103
|
-
const pf = fitFile(fileUnits(p.rest), MEMORY_BUDGET.project);
|
|
126
|
+
const pf = fitFile(fileUnits(p.rest, opts.indexLineChars), MEMORY_BUDGET.project);
|
|
104
127
|
if (pf.shown.length || pf.droppedNames.length) {
|
|
105
128
|
out += `\n\n## Project memory (${project.name} — this repo)\n${pf.shown.join("\n\n")}${leftOut(pf.droppedNames, project.name)}`;
|
|
106
129
|
}
|
|
107
130
|
}
|
|
108
131
|
return out;
|
|
109
132
|
}
|
|
110
|
-
export function loadMemories(cwd = process.cwd()) {
|
|
133
|
+
export function loadMemories(cwd = process.cwd(), opts = {}) {
|
|
111
134
|
let global;
|
|
112
135
|
try {
|
|
113
136
|
global = { text: readFileSync(globalMemoriesPath(), "utf8"), path: globalMemoriesPath() };
|
|
@@ -124,7 +147,25 @@ export function loadMemories(cwd = process.cwd()) {
|
|
|
124
147
|
}
|
|
125
148
|
catch { /* try the next */ }
|
|
126
149
|
}
|
|
127
|
-
return renderMemories(global, project);
|
|
150
|
+
return renderMemories(global, project, opts);
|
|
151
|
+
}
|
|
152
|
+
/** What the memory budget left out of the prompt, read from the rendered block itself (so the owner and the model are
|
|
153
|
+
* told the same thing): one entry per file, e.g. `"Notes", 2 older notes — not loaded from .operator/memories.md`.
|
|
154
|
+
* The owner-facing counterpart of Claude Code's large-CLAUDE.md warning and Codex's AGENTS.md size cap. Pure. */
|
|
155
|
+
export function memoryOmissions(rendered) {
|
|
156
|
+
const out = [];
|
|
157
|
+
for (const m of rendered.matchAll(/\((\d+) older lessons? left out for the memory budget — all of them are in (.+?)\)/g)) {
|
|
158
|
+
out.push(`${m[1]} older lesson${m[1] === "1" ? "" : "s"} — not loaded from ${m[2]}`);
|
|
159
|
+
}
|
|
160
|
+
for (const m of rendered.matchAll(/\(left out for the memory budget: (.+?) — read (.+?) for them\)/g)) {
|
|
161
|
+
out.push(`${m[1]} — not loaded from ${m[2]}`);
|
|
162
|
+
}
|
|
163
|
+
return out;
|
|
164
|
+
}
|
|
165
|
+
/** The owner's one-line startup note when memory didn't fit its budget, or null. */
|
|
166
|
+
export function memoryBudgetNote(cwd = process.cwd()) {
|
|
167
|
+
const gone = memoryOmissions(loadMemories(cwd));
|
|
168
|
+
return gone.length ? `memory over budget: ${gone.join("; ")}. Move what matters into lessons or shorten the file.` : null;
|
|
128
169
|
}
|
|
129
170
|
/** Where a `/remember` note goes in a memories file: its end — or, when the file ends in the lessons section (the
|
|
130
171
|
* self-improvement loop creates it at the end, selfimprove/lessons.ts), just before that section's heading, so a note
|
|
@@ -297,7 +338,7 @@ export function basePersona(_cwd = process.cwd(), opts = {}) {
|
|
|
297
338
|
`go.mod is), in the foreground. A failing check is never ` +
|
|
298
339
|
`"expected": report it as failing, find out why, fix or re-run it properly, then call the work done. ` +
|
|
299
340
|
`A document deliverable has runnable checks too (a link check, \`docker compose config\` on an ` +
|
|
300
|
-
`embedded compose block, a script that sums the tables, a linter); a "checked <date>" stamp is written only ` +
|
|
341
|
+
`embedded compose block, a script that sums the tables, a linter); for a prose report, reading the file back is the check; a "checked <date>" stamp is written only ` +
|
|
301
342
|
`in the turn that opened that page.` +
|
|
302
343
|
`\n## How I work — the AXE self-check\nFor a bug I state the ROOT CAUSE in one line (not the symptom) and how ` +
|
|
303
344
|
`I confirmed it; I reuse the nearest existing pattern (a new pattern needs a reason); I stay scoped to what was ` +
|
|
@@ -311,16 +352,15 @@ export function basePersona(_cwd = process.cwd(), opts = {}) {
|
|
|
311
352
|
`output, downloads to inspect, intermediate files: ALWAYS here, never /tmp and never the repo root. It is ` +
|
|
312
353
|
`git-ignored and swept after a week, so nothing you keep belongs in it; name files \`<subject>-<thing>\`.` +
|
|
313
354
|
ctxLine +
|
|
314
|
-
`\n## Talking about yourself\nYou are Operator, whichever model is serving you — the model underneath can change between sessions (or mid-session with /model) and you are still Operator.
|
|
315
|
-
`
|
|
316
|
-
`
|
|
317
|
-
`
|
|
318
|
-
`
|
|
319
|
-
`the first person, briefly, and say which model is actually serving when it differs.` +
|
|
355
|
+
`\n## Talking about yourself\nYou are Operator, AXE's agent, whichever model is serving you — the model underneath can change between sessions (or mid-session with /model) and you are still Operator. Asked what you are, say you are Operator; give ` +
|
|
356
|
+
`the context window above if asked. What you may say about the model underneath is set by the "Active model" section at the end ` +
|
|
357
|
+
`of this prompt; never guess a model from files, hostnames or other text in this prompt, and do not recite hostnames, IP ` +
|
|
358
|
+
`addresses, ports, URLs or file paths of AXE's servers unless the task itself needs the address. Greeted by a model name ("hello ` +
|
|
359
|
+
`cortana"), answer simply as Operator.` +
|
|
320
360
|
`\n## Don't starve the serving model — decode is RAM-bound\nLoading a large model on this box (a multi-GB ` +
|
|
321
361
|
`MLX/FLUX/LLM checkpoint, a big \`ml.load\`) pushes it into swap and collapses your decode to ~1 token/sec: use ` +
|
|
322
362
|
`another node, process in shards, or warn the owner first. Media goes ONLY through the tools (\`image_generate\`, ` +
|
|
323
|
-
`\`video_generate\`, \`image_analyze\`, \`video_analyze\`;
|
|
363
|
+
`\`video_generate\`, \`image_analyze\`, \`video_analyze\`; all on demand) — never curl a broker or decode base64 yourself. A ` +
|
|
324
364
|
`screenshot the owner shares is snapshotted by the engine: \`image_analyze\` the path exactly as given, one call ` +
|
|
325
365
|
`per DISTINCT path. If your own output crawls, STOP and say so rather than pushing through.` +
|
|
326
366
|
// Tool-promotion sections below prime reflexive tool use; a small/weak model (lean) does better with the
|
|
@@ -334,12 +374,15 @@ export function basePersona(_cwd = process.cwd(), opts = {}) {
|
|
|
334
374
|
`owner (bash \`open <url-or-path>\`) and put the clickable link in your reply; skip that in a headless batch.` +
|
|
335
375
|
`\n## The media pipeline — what you ACTUALLY have (don't invent tools)\nThree scale-to-zero fleet workers, ` +
|
|
336
376
|
`nothing else — never offer ComfyUI, SDXL, Juggernaut/RealVis/EpicRealism, FLUX.1-dev/pro, Midjourney or a ` +
|
|
337
|
-
`cloud image API. IMAGES: \`image_generate\` (FLUX.1-schnell) — the quality lever is \`expand: true\` (the ` +
|
|
377
|
+
`cloud image API. IMAGES: \`image_generate\` (on demand; FLUX.1-schnell) — the quality lever is \`expand: true\` (the ` +
|
|
338
378
|
`prompt is rewritten richer) plus a larger \`size\`. LIKENESS: a FACE photo as \`reference\` routes to the ` +
|
|
339
379
|
`identity broker and keeps that exact person; if the result's \`axe_identity\` says \`identity_applied\` false ` +
|
|
340
380
|
`or a weak \`fidelity_note\`, SAY so — never pass a look-alike off as a match. VIDEO: \`video_generate\` ` +
|
|
341
381
|
`(on demand; LTX-Video); \`reference_image\` makes that image the FIRST FRAME. VISION: \`image_analyze\` / ` +
|
|
342
382
|
`\`video_analyze\`; a document (PDF, DOCX, XLSX, PPTX) is read as TEXT, every page.` +
|
|
383
|
+
`\n## Reproducing a web page's design (on demand)\n\`tool_call page_capture\` the reference (exact tokens, outline, screenshot ` +
|
|
384
|
+
`tiles), build from those values, then \`tool_call visual_compare\` reference vs yours and fix the top finding ` +
|
|
385
|
+
`until the mismatch is small. Never from web_fetch text alone.` +
|
|
343
386
|
`\n## Deep research — \`deep_research\` (on demand; cited, multi-source)\nFor a comparison, a state-of-the-art survey ` +
|
|
344
387
|
`or sourced background use \`deep_research\` (planned angles, inline citations); a single lookup is faster ` +
|
|
345
388
|
`with plain \`web_search\`.`)) +
|
|
@@ -537,21 +580,29 @@ export function composeSystemPrompt(o) {
|
|
|
537
580
|
// basePersona carries (decision points and sub-agents included).
|
|
538
581
|
const personaOpts = { ctxTokens: o.ctxTokens, interactive, lean, decisionPoints: o.settings.decisionPoints };
|
|
539
582
|
const identity = custom ? custom + harnessRules(cwd, personaOpts) : basePersona(cwd, personaOpts);
|
|
540
|
-
// Local-skills index (
|
|
541
|
-
// skill_list
|
|
583
|
+
// Local-skills index (names only, 4k cap) — the model must KNOW skills exist without spending a call; what each
|
|
584
|
+
// does comes from skill_list and the body from skill_fetch, on demand like the deferred tools. Skipped in lean (small-ctx) mode like
|
|
542
585
|
// the other heavy sections. Appended exactly like renderToolCatalogue, right before it.
|
|
543
586
|
const skillsIdx = lean ? "" : renderSkillsIndex();
|
|
544
587
|
// `deferredTools`: the same split the Session advertises (tools/deferred.ts) — fixed for the session, so cache-safe.
|
|
545
588
|
const deferred = isFeatureEnabled("deferredTools", o.settings);
|
|
546
589
|
return (identity +
|
|
547
590
|
loadProjectContext(cwd) +
|
|
548
|
-
(lean ? "" : loadStructuredMemories() + loadMemories(cwd)) +
|
|
591
|
+
(lean ? "" : loadStructuredMemories() + loadMemories(cwd, { lessons: o.settings.memory?.promptLessons, indexLineChars: o.settings.memory?.indexLineChars })) +
|
|
549
592
|
renderHarnessContext(cwd) +
|
|
550
593
|
(lean ? LEAN_NOTE : loadHandoff()) +
|
|
551
|
-
(skillsIdx ? `\n\n## Skills installed locally (
|
|
552
|
-
renderToolCatalogue(
|
|
594
|
+
(skillsIdx ? `\n\n## Skills installed locally (names only: skill_list says what each does, skill_fetch <name> loads one, skill_fetch <name> <file_path> reads its references/templates/scripts)\n${skillsIdx}` : "") +
|
|
595
|
+
renderToolCatalogue(sessionTools(o.settings), { lean, deferred }) +
|
|
553
596
|
(interactive ? renderEmbodimentGuide(!!o.settings.computer?.enabled, o.chauffeurReady ?? !!o.settings.mcp) : ""));
|
|
554
597
|
}
|
|
598
|
+
// The registry plus the product tools a Session merges in from the same settings (session.ts), so a flag-off
|
|
599
|
+
// catalogue names every tool the session can run (the artifact library is always on since 2026-11-29).
|
|
600
|
+
function sessionTools(settings) {
|
|
601
|
+
const tools = new Map(registry);
|
|
602
|
+
for (const t of [...cloudAgentToolsFor(settings), ...mdocToolsFor(settings), ...craftToolsFor(settings)])
|
|
603
|
+
tools.set(t.name, t);
|
|
604
|
+
return tools;
|
|
605
|
+
}
|
|
555
606
|
/** A background sub-agent's system prompt: Operator's lean behavioural core plus its ROLE — never a clone of the
|
|
556
607
|
* owner's session. No SOUL, owner memories, handoff or skills index; the repo's project context only for repo
|
|
557
608
|
* roles inside a git repo that is not the home folder (the home AGENTS.md is the owner's own project list, which
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
export const PRODUCT_API_HOST = "api.0perator.co";
|
|
7
7
|
export const LEGACY_API_HOST = "api.axe.onl";
|
|
8
8
|
export const API_HOSTS = [PRODUCT_API_HOST, LEGACY_API_HOST];
|
|
9
|
+
/** Operator Portal's name for the same edge and router (BYO_PRESETS.portal): the gateway as a provider. */
|
|
10
|
+
export const INFERENCE_API_HOST = "inference.0perator.co";
|
|
9
11
|
export const RELAY_URLS = API_HOSTS.map((h) => `wss://${h}/session/ws`);
|
|
10
12
|
/** The host part of a URL for status lines — or the raw string when it does not parse. A scheme-less
|
|
11
13
|
* KODE_RELAY_URL already fails inside RemoteHost's own error loop; a status line must never be the thing
|