@0perator/operator 0.1.285 → 0.1.321
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 +24 -2
- package/dist/acp/agent.js +2 -1
- package/dist/acp/config-options.js +3 -1
- package/dist/acp/tool-map.js +2 -1
- package/dist/auth/commands.js +69 -13
- package/dist/autonomy/agent-cli.js +308 -0
- package/dist/autonomy/cloud-agent.js +439 -0
- package/dist/autonomy/cron-lifecycle.js +78 -0
- package/dist/autonomy/cron-lock.js +121 -0
- package/dist/autonomy/cron.js +217 -44
- package/dist/autonomy/delegate.js +34 -5
- package/dist/autonomy/incidents.js +135 -0
- package/dist/autonomy/index.js +22 -0
- package/dist/autonomy/profile.js +1 -1
- package/dist/autonomy/session-factory.js +25 -16
- package/dist/background/index.js +40 -0
- package/dist/browser/cdp.js +1 -1
- package/dist/bus/inbox.js +20 -0
- package/dist/classifier/config.js +47 -0
- package/dist/classifier/modes.js +41 -0
- package/dist/classifier/types.js +1 -0
- package/dist/cli.js +645 -93
- package/dist/config/features.js +69 -0
- package/dist/config/persona.js +143 -107
- package/dist/config/scaffold.js +15 -0
- package/dist/config/settings.js +107 -12
- package/dist/consolidation/sleep.js +73 -11
- package/dist/engine/agent.js +279 -20
- package/dist/engine/anthropic-chat.js +343 -0
- package/dist/engine/aurora.js +109 -16
- package/dist/engine/batch-scheduler.js +41 -9
- package/dist/engine/classifier.js +85 -0
- package/dist/engine/compaction.js +25 -6
- package/dist/engine/fast-start.js +25 -0
- package/dist/engine/loop-guard.js +448 -0
- package/dist/engine/net-error.js +24 -0
- package/dist/engine/repetition-guard.js +180 -0
- package/dist/engine/router-adapter.js +1 -0
- package/dist/engine/selfheal.js +8 -0
- package/dist/engine/toolcalls.js +51 -1
- package/dist/engine/verify-gate.js +2 -0
- package/dist/flywheel/processor.js +78 -31
- package/dist/flywheel/srft.js +13 -0
- package/dist/hooks/index.js +196 -0
- package/dist/idle/activity.js +20 -0
- package/dist/idle/index.js +5 -0
- package/dist/idle/monitor.js +71 -0
- package/dist/idle/policy.js +66 -0
- package/dist/idle/proc.js +22 -0
- package/dist/idle/reaper.js +69 -0
- package/dist/idle/session-record.js +59 -0
- package/dist/index.js +1 -1
- package/dist/mcp/config.js +93 -15
- package/dist/mcp/index.js +9 -2
- package/dist/memory/index.js +0 -0
- package/dist/memory/providers.js +210 -0
- package/dist/memory/session-catalog.js +422 -0
- package/dist/memory/session-providers.js +121 -0
- package/dist/memory/session-sources.js +335 -0
- package/dist/memory/skylark.js +131 -0
- package/dist/models/bench.js +103 -0
- package/dist/models/registry.js +144 -0
- package/dist/models/switch.js +69 -0
- package/dist/observability/blackbox.js +37 -0
- package/dist/permissions/index.js +22 -7
- package/dist/permissions/policy.js +31 -6
- package/dist/permissions/tier.js +1 -1
- package/dist/remote/host.js +20 -2
- package/dist/remote/safe-commands.js +38 -0
- package/dist/router/discovery.js +127 -0
- package/dist/router/models.js +107 -16
- package/dist/router/portal.js +100 -0
- package/dist/router/router.js +1 -1
- package/dist/services/preflight.js +108 -8
- package/dist/services/store-sync.js +111 -0
- package/dist/session-teardown.js +10 -1
- package/dist/session.js +338 -46
- package/dist/skills/catalogue.js +1 -1
- package/dist/tools/chauffeur-native.js +155 -0
- package/dist/tools/chauffeur.js +26 -3
- package/dist/tools/download.js +229 -0
- package/dist/tools/executor.js +19 -9
- package/dist/tools/find-files.js +483 -0
- package/dist/tools/git-pr.js +94 -0
- package/dist/tools/incident-tools.js +82 -0
- package/dist/tools/memory.js +12 -2
- package/dist/tools/monitoring-tools.js +312 -0
- package/dist/tools/paths.js +154 -0
- package/dist/tools/registry.js +582 -95
- package/dist/tools/semantic-compress.js +124 -0
- package/dist/tools/shell-context.js +1 -0
- package/dist/tools/shell-jobs.js +163 -0
- package/dist/tools/shell-session.js +174 -6
- package/dist/tools/tool-output-spill.js +1 -1
- package/dist/tools/wave-tools.js +609 -0
- package/dist/tools/wave2-tools.js +411 -0
- package/dist/ui/App.js +15 -4
- package/dist/ui/BgPanel.js +30 -6
- package/dist/ui/Composer.js +15 -2
- package/dist/ui/QuestionPrompt.js +32 -12
- package/dist/ui/SessionPicker.js +86 -0
- package/dist/ui/StatusRule.js +5 -5
- package/dist/ui/ToolStep.js +17 -1
- package/dist/ui/Transcript.js +17 -1
- package/dist/ui/index.js +1 -1
- package/dist/ui/liveTools.js +21 -3
- package/dist/ui/slashCommands.js +2 -0
- package/dist/util/mentions.js +1 -1
- package/dist/util/screenshots.js +74 -8
- package/dist/util/slash.js +2 -2
- package/dist/vault/store.js +1 -1
- package/mcp/README.md +88 -0
- package/mcp/ocr-macos.swift +45 -0
- package/mcp/powertools-media.mjs +464 -0
- package/mcp/powertools-toolbox.mjs +1114 -0
- package/mcp/powertools.md +210 -0
- package/mcp/powertools.mjs +861 -0
- package/package.json +9 -2
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { ModelRegistry } from "./registry.js";
|
|
2
|
+
import { switchModel } from "./switch.js";
|
|
3
|
+
import { operatorPath } from "../config/home.js";
|
|
4
|
+
const nodeImport = (m) => import(m);
|
|
5
|
+
const STANDARD_TASKS = [
|
|
6
|
+
{ id: "code-fizzbuzz", name: "FizzBuzz", category: "code-edit", prompt: "Write a JavaScript function fizzbuzz(n) returning an array from 1..n: multiples of 3='Fizz', 5='Buzz', both='FizzBuzz', else string number. ONLY the function.", expectedPattern: /function\s+fizzbuzz|const\s+fizzbuzz/, maxTokens: 512, timeoutMs: 30000 },
|
|
7
|
+
{ id: "code-sort", name: "Merge sort", category: "code-edit", prompt: "Write TypeScript mergeSort(arr: number[]): number[] implementing merge sort. ONLY the function.", expectedPattern: /function\s+mergeSort|const\s+mergeSort/, maxTokens: 1024, timeoutMs: 45000 },
|
|
8
|
+
{ id: "reasoning-math", name: "Math reasoning", category: "reasoning", prompt: "Apples cost $2, oranges $3. I buy 5 apples and some oranges for exactly $25. How many oranges? Step by step, final answer as single number on last line.", expectedPattern: /5/, maxTokens: 512, timeoutMs: 30000 },
|
|
9
|
+
{ id: "tool-json", name: "JSON output", category: "tool-use", prompt: "Generate valid JSON: {name: string, age: number, skills: string[]} for Alice, 35, knows TypeScript/Rust/Python. ONLY JSON.", expectedPattern: /"name"\s*:\s*"Alice"/, maxTokens: 256, timeoutMs: 20000 },
|
|
10
|
+
{ id: "multi-step-plan", name: "Deploy plan", category: "multi-step", prompt: "List 10 numbered shell commands to deploy a Node.js app: SSH, install Node, clone, deps, build, systemd, enable, start, check. ONLY commands.", expectedPattern: /ssh|systemctl|npm|git clone/, maxTokens: 1024, timeoutMs: 45000 },
|
|
11
|
+
{ id: "memory-extract", name: "Fact extraction", category: "memory", prompt: "Extract 3 key facts as JSON string array from: 'Rust released 2015 by Mozilla. Memory safety without GC. LLVM backend. Most loved on StackOverflow.'", expectedPattern: /\[.*".*Rust.*".*\]/s, maxTokens: 512, timeoutMs: 30000 },
|
|
12
|
+
{ id: "file-grep", name: "Grep command", category: "file-search", prompt: "What ripgrep command finds all TypeScript files exporting a default class? Give ONLY the rg command.", expectedPattern: /rg|grep/, maxTokens: 256, timeoutMs: 20000 },
|
|
13
|
+
{ id: "code-debug", name: "Bug finding", category: "code-edit", prompt: "Find the bug: function sum(arr) { let t=0; for(let i=0;i<=arr.length;i++) t+=arr[i]; return t; } One sentence.", expectedPattern: /<=|off.by.one|undefined|NaN/i, maxTokens: 256, timeoutMs: 20000 },
|
|
14
|
+
];
|
|
15
|
+
export class ModelBench {
|
|
16
|
+
registry;
|
|
17
|
+
baseUrl;
|
|
18
|
+
reportDir;
|
|
19
|
+
constructor(opts) {
|
|
20
|
+
this.registry = new ModelRegistry(opts?.homeDir);
|
|
21
|
+
this.baseUrl = opts?.baseUrl ?? "http://localhost:8097/v1";
|
|
22
|
+
this.reportDir = opts?.reportDir ?? (opts?.homeDir ? `${opts.homeDir}/bench` : operatorPath("bench"));
|
|
23
|
+
}
|
|
24
|
+
async complete(prompt, maxTokens, timeoutMs) {
|
|
25
|
+
const start = Date.now();
|
|
26
|
+
const controller = new AbortController();
|
|
27
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
28
|
+
try {
|
|
29
|
+
const resp = await fetch(this.baseUrl + "/chat/completions", {
|
|
30
|
+
method: "POST",
|
|
31
|
+
headers: { "Content-Type": "application/json" },
|
|
32
|
+
body: JSON.stringify({ model: "default", messages: [{ role: "user", content: prompt }], max_tokens: maxTokens, temperature: 0 }),
|
|
33
|
+
signal: controller.signal,
|
|
34
|
+
});
|
|
35
|
+
clearTimeout(timer);
|
|
36
|
+
if (!resp.ok)
|
|
37
|
+
throw new Error("API " + resp.status);
|
|
38
|
+
const data = await resp.json();
|
|
39
|
+
const text = data.choices?.[0]?.message?.content ?? "";
|
|
40
|
+
const tokens = data.usage?.completion_tokens ?? text.split(/\s+/).length;
|
|
41
|
+
return { text, tokens, latencyMs: Date.now() - start };
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
clearTimeout(timer);
|
|
45
|
+
throw e;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async runTask(task, model) {
|
|
49
|
+
try {
|
|
50
|
+
const { text, tokens, latencyMs } = await this.complete(task.prompt, task.maxTokens, task.timeoutMs);
|
|
51
|
+
const matched = task.expectedPattern ? task.expectedPattern.test(text) : true;
|
|
52
|
+
return { taskId: task.id, model, success: true, latencyMs, tokensGenerated: tokens, tokensPerSecond: tokens / (latencyMs / 1000), matchedExpected: matched, raw: text.slice(0, 500) };
|
|
53
|
+
}
|
|
54
|
+
catch (e) {
|
|
55
|
+
return { taskId: task.id, model, success: false, latencyMs: 0, tokensGenerated: 0, tokensPerSecond: 0, matchedExpected: false, error: e?.message ?? String(e) };
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async runSuite(model, tasks) {
|
|
59
|
+
const suite = tasks ?? STANDARD_TASKS;
|
|
60
|
+
const results = [];
|
|
61
|
+
for (const task of suite)
|
|
62
|
+
results.push(await this.runTask(task, model));
|
|
63
|
+
const passed = results.filter(r => r.success && r.matchedExpected);
|
|
64
|
+
const successful = results.filter(r => r.success);
|
|
65
|
+
const avgLat = successful.length ? successful.reduce((a, r) => a + r.latencyMs, 0) / successful.length : 0;
|
|
66
|
+
const avgTps = successful.length ? successful.reduce((a, r) => a + r.tokensPerSecond, 0) / successful.length : 0;
|
|
67
|
+
return {
|
|
68
|
+
model, provider: this.baseUrl, timestamp: new Date().toISOString(), tasks: results,
|
|
69
|
+
summary: { totalTasks: suite.length, passed: passed.length, failed: suite.length - passed.length, avgLatencyMs: Math.round(avgLat), avgTokensPerSecond: Math.round(avgTps * 10) / 10, successRate: Math.round((passed.length / suite.length) * 1000) / 10, score: Math.round((passed.length / suite.length) * 100) },
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
async saveReport(report) {
|
|
73
|
+
const { writeFileSync, mkdirSync } = await nodeImport("node:fs");
|
|
74
|
+
mkdirSync(this.reportDir, { recursive: true });
|
|
75
|
+
const slug = report.model.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
76
|
+
const ts = report.timestamp.replace(/[:.]/g, "-").slice(0, 19);
|
|
77
|
+
const path = this.reportDir + "/" + slug + "_" + ts + ".json";
|
|
78
|
+
writeFileSync(path, JSON.stringify(report, null, 2), { mode: 0o600 });
|
|
79
|
+
return path;
|
|
80
|
+
}
|
|
81
|
+
async compareModels(reports) {
|
|
82
|
+
const sorted = [...reports].sort((a, b) => b.summary.score - a.summary.score);
|
|
83
|
+
const lines = ["# Model Comparison", "", "| Rank | Model | Score | Pass | Fail | Avg Latency | Avg TPS |", "|------|-------|-------|------|------|-------------|---------|"];
|
|
84
|
+
sorted.forEach((r, i) => lines.push("| " + (i + 1) + " | " + r.model + " | " + r.summary.score + "/100 | " + r.summary.passed + " | " + r.summary.failed + " | " + r.summary.avgLatencyMs + "ms | " + r.summary.avgTokensPerSecond + " |"));
|
|
85
|
+
return lines.join("\n");
|
|
86
|
+
}
|
|
87
|
+
async runRotation(models, opts) {
|
|
88
|
+
const reports = [];
|
|
89
|
+
for (const model of models) {
|
|
90
|
+
const sw = await switchModel(model.id, model, { ...opts, restartServer: true });
|
|
91
|
+
if (sw.error) {
|
|
92
|
+
reports.push({ model: model.id, provider: model.provider, timestamp: new Date().toISOString(), tasks: [], summary: { totalTasks: 0, passed: 0, failed: 0, avgLatencyMs: 0, avgTokensPerSecond: 0, successRate: 0, score: 0 } });
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
this.baseUrl = "http://localhost:" + model.port + "/v1";
|
|
96
|
+
const report = await this.runSuite(model.id, opts?.tasks);
|
|
97
|
+
await this.saveReport(report);
|
|
98
|
+
reports.push(report);
|
|
99
|
+
}
|
|
100
|
+
return reports;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
export { STANDARD_TASKS };
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { get_operator_home } from "../config/home.js";
|
|
2
|
+
const nodeImport = (m) => import(m);
|
|
3
|
+
const MODELS_DEV_URL = "https://models.dev/api.json";
|
|
4
|
+
const CACHE_TTL = 4 * 3600_000;
|
|
5
|
+
export class ModelRegistry {
|
|
6
|
+
cacheFile;
|
|
7
|
+
localFile;
|
|
8
|
+
cache = null;
|
|
9
|
+
cacheTime = 0;
|
|
10
|
+
constructor(homeDir) {
|
|
11
|
+
const home = homeDir ?? get_operator_home();
|
|
12
|
+
this.cacheFile = `${home}/models_dev_cache.json`;
|
|
13
|
+
this.localFile = `${home}/local_models.json`;
|
|
14
|
+
}
|
|
15
|
+
async fetchModelsDevRegistry() {
|
|
16
|
+
if (this.cache && Date.now() - this.cacheTime < CACHE_TTL)
|
|
17
|
+
return this.cache;
|
|
18
|
+
try {
|
|
19
|
+
const { readFileSync, existsSync } = await nodeImport("node:fs");
|
|
20
|
+
if (existsSync(this.cacheFile)) {
|
|
21
|
+
const raw = readFileSync(this.cacheFile, "utf8");
|
|
22
|
+
const parsed = JSON.parse(raw);
|
|
23
|
+
if (parsed._fetchedAt && Date.now() - parsed._fetchedAt < CACHE_TTL) {
|
|
24
|
+
this.cache = parsed;
|
|
25
|
+
this.cacheTime = parsed._fetchedAt;
|
|
26
|
+
return parsed;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
catch { }
|
|
31
|
+
try {
|
|
32
|
+
const resp = await fetch(MODELS_DEV_URL);
|
|
33
|
+
if (!resp.ok)
|
|
34
|
+
throw new Error(`models.dev ${resp.status}`);
|
|
35
|
+
const data = await resp.json();
|
|
36
|
+
data._fetchedAt = Date.now();
|
|
37
|
+
this.cache = data;
|
|
38
|
+
this.cacheTime = Date.now();
|
|
39
|
+
const { writeFileSync, mkdirSync } = await nodeImport("node:fs");
|
|
40
|
+
const { dirname } = await nodeImport("node:path");
|
|
41
|
+
mkdirSync(dirname(this.cacheFile), { recursive: true });
|
|
42
|
+
writeFileSync(this.cacheFile, JSON.stringify(data), "utf8");
|
|
43
|
+
return data;
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return this.cache ?? {};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async getModelInfo(modelId) {
|
|
50
|
+
const reg = await this.fetchModelsDevRegistry();
|
|
51
|
+
const providers = reg.providers ?? reg.data ?? {};
|
|
52
|
+
for (const [pid, prov] of Object.entries(providers)) {
|
|
53
|
+
const models = prov?.models ?? {};
|
|
54
|
+
for (const [mid, info] of Object.entries(models)) {
|
|
55
|
+
if (mid === modelId || info?.name === modelId) {
|
|
56
|
+
return {
|
|
57
|
+
id: mid, name: info.name ?? mid, family: info.family ?? "",
|
|
58
|
+
providerId: pid, reasoning: !!info.reasoning, toolCall: !!info.tool_call,
|
|
59
|
+
vision: !!info.attachment || (info.input_modalities ?? []).includes("image"),
|
|
60
|
+
structuredOutput: !!info.structured_output, openWeights: !!info.open_weights,
|
|
61
|
+
contextWindow: info.context_window ?? 0, maxOutput: info.max_output ?? 0,
|
|
62
|
+
costInput: info.cost_input ?? 0, costOutput: info.cost_output ?? 0,
|
|
63
|
+
knowledgeCutoff: info.knowledge_cutoff ?? "", releaseDate: info.release_date ?? "",
|
|
64
|
+
status: info.status ?? "",
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
async listLocalModels() {
|
|
72
|
+
try {
|
|
73
|
+
const { readFileSync, existsSync } = await nodeImport("node:fs");
|
|
74
|
+
if (!existsSync(this.localFile))
|
|
75
|
+
return [];
|
|
76
|
+
return JSON.parse(readFileSync(this.localFile, "utf8"));
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
return [];
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
async addLocalModel(model) {
|
|
83
|
+
const models = await this.listLocalModels();
|
|
84
|
+
const idx = models.findIndex(m => m.id === model.id);
|
|
85
|
+
if (idx >= 0)
|
|
86
|
+
models[idx] = model;
|
|
87
|
+
else
|
|
88
|
+
models.push(model);
|
|
89
|
+
const { writeFileSync, mkdirSync } = await nodeImport("node:fs");
|
|
90
|
+
const { dirname } = await nodeImport("node:path");
|
|
91
|
+
mkdirSync(dirname(this.localFile), { recursive: true });
|
|
92
|
+
writeFileSync(this.localFile, JSON.stringify(models, null, 2), "utf8");
|
|
93
|
+
}
|
|
94
|
+
async removeLocalModel(id) {
|
|
95
|
+
const models = await this.listLocalModels();
|
|
96
|
+
const filtered = models.filter(m => m.id !== id);
|
|
97
|
+
if (filtered.length === models.length)
|
|
98
|
+
return false;
|
|
99
|
+
const { writeFileSync } = await nodeImport("node:fs");
|
|
100
|
+
writeFileSync(this.localFile, JSON.stringify(filtered, null, 2), "utf8");
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
async discoverOllamaModels(host = "localhost", port = 11434) {
|
|
104
|
+
try {
|
|
105
|
+
const resp = await fetch(`http://${host}:${port}/api/tags`);
|
|
106
|
+
if (!resp.ok)
|
|
107
|
+
return [];
|
|
108
|
+
const data = await resp.json();
|
|
109
|
+
return (data.models ?? []).map((m) => ({
|
|
110
|
+
id: m.name ?? m.model, path: "", quant: m.details?.quantization_level ?? "",
|
|
111
|
+
paramCount: m.details?.parameter_size ?? "", contextWindow: 0,
|
|
112
|
+
provider: "ollama", port, added: m.modified_at ?? new Date().toISOString(),
|
|
113
|
+
capabilities: {
|
|
114
|
+
supportsTools: true, supportsVision: (m.details?.families ?? []).includes("clip"),
|
|
115
|
+
supportsReasoning: false, contextWindow: 0, maxOutputTokens: 0,
|
|
116
|
+
modelFamily: m.details?.family ?? "",
|
|
117
|
+
},
|
|
118
|
+
}));
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
return [];
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
async discoverLlamaServerModels(port = 8097) {
|
|
125
|
+
try {
|
|
126
|
+
const resp = await fetch(`http://localhost:${port}/v1/models`);
|
|
127
|
+
if (!resp.ok)
|
|
128
|
+
return [];
|
|
129
|
+
const data = await resp.json();
|
|
130
|
+
return (data.data ?? []).map((m) => ({
|
|
131
|
+
id: m.id ?? m.model, path: m.id ?? "", quant: "unknown",
|
|
132
|
+
paramCount: "", contextWindow: 0,
|
|
133
|
+
provider: "llama-server", port, added: new Date().toISOString(),
|
|
134
|
+
capabilities: {
|
|
135
|
+
supportsTools: true, supportsVision: false, supportsReasoning: false,
|
|
136
|
+
contextWindow: 0, maxOutputTokens: 0, modelFamily: "",
|
|
137
|
+
},
|
|
138
|
+
}));
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
return [];
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
const nodeImport = (m) => import(m);
|
|
2
|
+
const DEFAULT_CONFIG_PATH = () => process.env.KODE_CONFIG ?? `${process.env.HOME ?? ""}/.0perator/config.yaml`;
|
|
3
|
+
export async function switchModel(modelId, model, opts = {}) {
|
|
4
|
+
const configPath = opts.configPath ?? DEFAULT_CONFIG_PATH();
|
|
5
|
+
const { readFileSync, writeFileSync } = await nodeImport("node:fs");
|
|
6
|
+
let raw;
|
|
7
|
+
try {
|
|
8
|
+
raw = readFileSync(configPath, "utf8");
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
raw = "";
|
|
12
|
+
}
|
|
13
|
+
const prevMatch = raw.match(/default:\s*(.+)/);
|
|
14
|
+
const previous = prevMatch?.[1]?.trim() ?? "unknown";
|
|
15
|
+
const updated = raw
|
|
16
|
+
.replace(/default:\s*.+/, `default: ${modelId}`)
|
|
17
|
+
.replace(/base_url:\s*.+/, `base_url: http://localhost:${model.port}/v1`);
|
|
18
|
+
writeFileSync(configPath, updated, "utf8");
|
|
19
|
+
let restarted = false;
|
|
20
|
+
if (opts.restartServer && model.provider === "llama-server" && model.path) {
|
|
21
|
+
try {
|
|
22
|
+
const { execSync } = await nodeImport("node:child_process");
|
|
23
|
+
execSync("pkill -f llama-server || true", { timeout: 5000 });
|
|
24
|
+
await new Promise(r => setTimeout(r, 1000));
|
|
25
|
+
const bin = opts.llamaServerBin ?? "/opt/homebrew/bin/llama-server";
|
|
26
|
+
const args = [
|
|
27
|
+
"--model", model.path, "--host", "0.0.0.0", "--port", String(model.port),
|
|
28
|
+
"--ctx-size", String(model.capabilities.contextWindow || 32768),
|
|
29
|
+
"--n-gpu-layers", "999", "--flash-attn", "on", "--jinja",
|
|
30
|
+
"--parallel", "2", "--cont-batching",
|
|
31
|
+
...(opts.serverArgs ?? []),
|
|
32
|
+
];
|
|
33
|
+
execSync(`nohup ${bin} ${args.join(" ")} > /tmp/llama-bench.log 2>&1 &`, { timeout: 5000 });
|
|
34
|
+
restarted = true;
|
|
35
|
+
let healthy = false;
|
|
36
|
+
for (let i = 0; i < 30; i++) {
|
|
37
|
+
await new Promise(r => setTimeout(r, 2000));
|
|
38
|
+
try {
|
|
39
|
+
const resp = await fetch(`http://localhost:${model.port}/health`);
|
|
40
|
+
if (resp.ok) {
|
|
41
|
+
healthy = true;
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
catch { }
|
|
46
|
+
}
|
|
47
|
+
if (!healthy)
|
|
48
|
+
return { previous, current: modelId, provider: model.provider, port: model.port, restarted, error: "server did not become healthy within 60s" };
|
|
49
|
+
}
|
|
50
|
+
catch (e) {
|
|
51
|
+
return { previous, current: modelId, provider: model.provider, port: model.port, restarted: false, error: e?.message ?? String(e) };
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return { previous, current: modelId, provider: model.provider, port: model.port, restarted };
|
|
55
|
+
}
|
|
56
|
+
export async function currentModel(configPath) {
|
|
57
|
+
const path = configPath ?? DEFAULT_CONFIG_PATH();
|
|
58
|
+
try {
|
|
59
|
+
const { readFileSync } = await nodeImport("node:fs");
|
|
60
|
+
const raw = readFileSync(path, "utf8");
|
|
61
|
+
const model = raw.match(/default:\s*(.+)/)?.[1]?.trim() ?? "unknown";
|
|
62
|
+
const baseUrl = raw.match(/base_url:\s*(.+)/)?.[1]?.trim() ?? "";
|
|
63
|
+
const provider = raw.match(/provider:\s*(.+)/)?.[1]?.trim() ?? "unknown";
|
|
64
|
+
return { model, baseUrl, provider };
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return { model: "unknown", baseUrl: "", provider: "unknown" };
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Truncation black-box — the CONTENT-BEARING sibling of telemetry.jsonl (which is metrics-only by policy
|
|
2
|
+
// and must stay that way). When a tool call's arguments arrive unparseable, the engine fires
|
|
3
|
+
// AgentOpts.onTruncationEvidence with the raw fragment; this module is where a node host lands it:
|
|
4
|
+
// a local-only, append-only, 0600 JSONL under the operator home. Motivation (2026-10-19): the live
|
|
5
|
+
// "arguments were CUT OFF at 4% ctx" incident could not be root-caused because every synthetic repro was
|
|
6
|
+
// clean and nothing recorded what the stream actually carried — the next occurrence hands us the raw args
|
|
7
|
+
// tail, the round's REAL finish_reason, and the budget that was in force, instead of a screenshot.
|
|
8
|
+
// Best-effort like telemetry: never throws, never blocks a turn. Disable with telemetry.enabled=false
|
|
9
|
+
// (one owner switch for both local sinks) or KODE_BLACKBOX=0.
|
|
10
|
+
import { appendFileSync, mkdirSync, renameSync, statSync } from "node:fs";
|
|
11
|
+
import { dirname } from "node:path";
|
|
12
|
+
import { operatorPath } from "../config/home.js";
|
|
13
|
+
const DEFAULT_FILE = process.env.KODE_BLACKBOX_FILE ?? operatorPath("blackbox", "truncations.jsonl");
|
|
14
|
+
const ARGS_CAP = 8192; // raw-fragment cap per record — enough to see where/how the JSON died
|
|
15
|
+
const ROTATE_BYTES = 2 * 1024 * 1024; // rotate to .1 past ~2MB so a truncation storm can't eat the disk
|
|
16
|
+
/** Append one evidence record. Sync on purpose: records are rare (a truncation is an incident), tiny, and
|
|
17
|
+
* a crash right after the event must not lose the one line that explains it. */
|
|
18
|
+
export function recordTruncation(e, file = DEFAULT_FILE) {
|
|
19
|
+
if (process.env.KODE_BLACKBOX === "0")
|
|
20
|
+
return;
|
|
21
|
+
try {
|
|
22
|
+
mkdirSync(dirname(file), { recursive: true, mode: 0o700 });
|
|
23
|
+
try {
|
|
24
|
+
if (statSync(file).size > ROTATE_BYTES)
|
|
25
|
+
renameSync(file, file + ".1"); // one generation kept
|
|
26
|
+
}
|
|
27
|
+
catch { /* no file yet */ }
|
|
28
|
+
const args = e.args.length > ARGS_CAP
|
|
29
|
+
? e.args.slice(0, 512) + `\n…[${e.args.length - ARGS_CAP} chars elided]…\n` + e.args.slice(-(ARGS_CAP - 512))
|
|
30
|
+
: e.args;
|
|
31
|
+
const line = { ts: new Date().toISOString(), ...e, args, argsLen: e.args.length };
|
|
32
|
+
appendFileSync(file, JSON.stringify(line) + "\n", { encoding: "utf8", mode: 0o600 });
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
/* best-effort — diagnostics must never degrade the diagnosed thing */
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -4,10 +4,15 @@ import { centralRecording } from "../telemetry/ingest.js";
|
|
|
4
4
|
import { runBatch, defaultClassify, defaultKeys, cancelledResult } from "../engine/batch-scheduler.js";
|
|
5
5
|
import { registrySafeTools } from "./tier.js";
|
|
6
6
|
export { PermissionPolicy } from "./policy.js";
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
const NO_RETRY = "Do not retry this call or an equivalent; choose another approach or ask the user.";
|
|
8
|
+
const DENIED = (name, why) => `Permission denied: "${name}" was denied ` +
|
|
9
|
+
(why === "policy" ? "BY POLICY (the operator permission policy refuses it)."
|
|
10
|
+
: why === "user" ? "BY THE USER (the approval prompt was declined)."
|
|
11
|
+
: "BY POLICY (it needs approval and no approver is available to give it).") +
|
|
12
|
+
` ${NO_RETRY}`;
|
|
13
|
+
const TIER_DENIED = (name, tier) => `Permission denied: "${name}" was denied BY POLICY: it is not available on the "${tier}" tier. ` +
|
|
14
|
+
`This seat has a narrowed toolset; a full-access (admin) seat is required for this tool. ${NO_RETRY}`;
|
|
15
|
+
const REPEAT_DENIED = (first) => `${first} (Repeat of an already-denied call; it was not executed or re-prompted.)`;
|
|
11
16
|
export function withPermissions(inner, policy, opts = {}) {
|
|
12
17
|
if (policy.inert && !centralRecording())
|
|
13
18
|
return inner; // bypass + admin tier + no rules, signed out → nothing to enforce or log; skip entirely
|
|
@@ -18,6 +23,9 @@ export function withPermissions(inner, policy, opts = {}) {
|
|
|
18
23
|
const sinkNow = () => (recording() ? (lazySink ??= new EventSink()) : undefined);
|
|
19
24
|
const actor = opts.actor ?? { tier: policy.currentTier(), surface: "cli" };
|
|
20
25
|
const session = opts.session ?? "";
|
|
26
|
+
// Identical (tool+args) calls already denied in this wrapper's lifetime -> the message returned then. A repeat is
|
|
27
|
+
// refused outright: no execution, no second approval prompt.
|
|
28
|
+
const denied = new Map();
|
|
21
29
|
const tool = (t, argHash) => {
|
|
22
30
|
const connectorId = connectorOf(t.name);
|
|
23
31
|
sinkNow()?.emit({ kind: "tool", session, actor, tool: { ...t, ...(argHash ? { argHash } : {}), ...(connectorId ? { connectorId } : {}) } });
|
|
@@ -28,6 +36,13 @@ export function withPermissions(inner, policy, opts = {}) {
|
|
|
28
36
|
async function gate(name, args, exec, batch, signal) {
|
|
29
37
|
const digest = digestArgs(name, args);
|
|
30
38
|
const argHash = recording() ? argHashOf(args, digest) : undefined; // hashed BEFORE the tool runs: the args as issued
|
|
39
|
+
const denyKey = `${name}\0${argHashOf(args, digest)}`;
|
|
40
|
+
const prior = denied.get(denyKey);
|
|
41
|
+
if (prior) {
|
|
42
|
+
tool({ name, args: digest, decision: "deny", outcome: "denied", approved: false, ...batch }, argHash);
|
|
43
|
+
return REPEAT_DENIED(prior);
|
|
44
|
+
}
|
|
45
|
+
const refuse = (msg) => { denied.set(denyKey, msg); return msg; };
|
|
31
46
|
const decision = policy.decide(name, args);
|
|
32
47
|
const t0 = performance.now();
|
|
33
48
|
if (decision === "deny") {
|
|
@@ -35,10 +50,10 @@ export function withPermissions(inner, policy, opts = {}) {
|
|
|
35
50
|
if (!policy.allowsTool(name)) {
|
|
36
51
|
sinkNow()?.emit({ kind: "control", session, actor, control: { event: "tool_denied_by_tier", detail: `${name} @ ${actor.tier}` } });
|
|
37
52
|
tool({ name, args: digest, decision, outcome: "denied", approved: false, ...batch }, argHash);
|
|
38
|
-
return TIER_DENIED(name, actor.tier);
|
|
53
|
+
return refuse(TIER_DENIED(name, actor.tier));
|
|
39
54
|
}
|
|
40
55
|
tool({ name, args: digest, decision, outcome: "denied", approved: false, ...batch }, argHash);
|
|
41
|
-
return DENIED(name);
|
|
56
|
+
return refuse(DENIED(name, "policy"));
|
|
42
57
|
}
|
|
43
58
|
let approved;
|
|
44
59
|
if (decision === "ask") {
|
|
@@ -50,7 +65,7 @@ export function withPermissions(inner, policy, opts = {}) {
|
|
|
50
65
|
approved = opts.approve ? await opts.approve(name, args) : false; // no approver ⇒ fail-safe deny
|
|
51
66
|
if (!approved) {
|
|
52
67
|
tool({ name, args: digest, decision, outcome: "denied", approved: false, ...batch }, argHash);
|
|
53
|
-
return DENIED(name);
|
|
68
|
+
return refuse(DENIED(name, opts.approve ? "user" : "no-approver"));
|
|
54
69
|
}
|
|
55
70
|
}
|
|
56
71
|
// An esc during the (human) approval wait: the approval may land AFTER the interrupt, and an approved edit
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Operator permission policy — SPEC §11 (agent safety). Decides, per tool call, whether it may run,
|
|
2
|
-
// must be approved, or is refused.
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
2
|
+
// must be approved, or is refused. The CLASS stays inert when constructed without a mode ("bypass":
|
|
3
|
+
// zero gates, zero overhead — programmatic/embedded callers opt in explicitly), but the SHIPPED
|
|
4
|
+
// settings default is "gated" (2026-10-23): mutating tools ask the user to Allow/Deny on spawn,
|
|
5
|
+
// Claude Code-style; shift+tab/Autonomous or settings flip it back. "audit" allows-but-records.
|
|
6
6
|
import { registrySafeTools, tierAllows } from "./tier.js";
|
|
7
7
|
import { signatureLine } from "./signature.js";
|
|
8
8
|
// Read-only tools (registry `safe: true`) — never gated unless a rule says otherwise. DERIVED from the
|
|
@@ -25,16 +25,35 @@ function looksDangerous(_name, args) {
|
|
|
25
25
|
const blob = `${cmd} ${gitArgs}`;
|
|
26
26
|
return blob.trim().length > 0 && DANGEROUS.some((re) => re.test(blob));
|
|
27
27
|
}
|
|
28
|
+
function globMatch(pattern, text) {
|
|
29
|
+
const re = new RegExp("^" + pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*").replace(/\?/g, ".") + "$", "i");
|
|
30
|
+
return re.test(text);
|
|
31
|
+
}
|
|
32
|
+
function matchesAllowlist(allow, name, args) {
|
|
33
|
+
const serialized = typeof args.command === "string" ? args.command
|
|
34
|
+
: typeof args.path === "string" ? args.path
|
|
35
|
+
: Array.isArray(args.args) ? args.args.join(" ")
|
|
36
|
+
: JSON.stringify(args);
|
|
37
|
+
return allow.some((p) => {
|
|
38
|
+
if (!globMatch(p.tool, name))
|
|
39
|
+
return false;
|
|
40
|
+
if (!p.args)
|
|
41
|
+
return true;
|
|
42
|
+
return globMatch(p.args, serialized);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
28
45
|
export class PermissionPolicy {
|
|
29
46
|
mode;
|
|
30
47
|
rules;
|
|
31
48
|
safe;
|
|
32
49
|
tier;
|
|
50
|
+
allow;
|
|
33
51
|
constructor(cfg = {}) {
|
|
34
52
|
this.mode = cfg.mode ?? "bypass";
|
|
35
53
|
this.rules = cfg.rules ?? {};
|
|
36
54
|
this.safe = new Set(cfg.safeTools ?? DEFAULT_SAFE);
|
|
37
55
|
this.tier = cfg.tier ?? "admin";
|
|
56
|
+
this.allow = cfg.allow ?? [];
|
|
38
57
|
}
|
|
39
58
|
/** True when the policy can never block, prompt, or log — lets the wrapper skip itself entirely (no
|
|
40
59
|
* overhead). Requires the full-access owner tier: a narrowed tier is always enforced, even in bypass. */
|
|
@@ -64,7 +83,7 @@ export class PermissionPolicy {
|
|
|
64
83
|
}
|
|
65
84
|
/** The decision for one tool call. Precedence: tier ceiling (a denied tool can't be granted by any
|
|
66
85
|
* rule) → human-signature line (money/prod/destructive always ask, beating a rule/mode) → per-tool
|
|
67
|
-
* rule → mode. */
|
|
86
|
+
* rule → allowlist pattern match → mode. */
|
|
68
87
|
decide(name, args) {
|
|
69
88
|
if (!this.allowsTool(name))
|
|
70
89
|
return "deny"; // tier ceiling — absolute, above rules and mode
|
|
@@ -75,11 +94,17 @@ export class PermissionPolicy {
|
|
|
75
94
|
return rule; // explicit override within the tier
|
|
76
95
|
if (this.mode === "bypass" || this.mode === "audit")
|
|
77
96
|
return "allow"; // audit records but never blocks
|
|
78
|
-
// "gated": read-only tools run;
|
|
97
|
+
// "gated": read-only tools run; allowlisted patterns auto-allow (but dangerous shapes still ask);
|
|
98
|
+
// everything else asks.
|
|
79
99
|
if (this.safe.has(name))
|
|
80
100
|
return "allow";
|
|
81
101
|
if (looksDangerous(name, args))
|
|
82
102
|
return "ask";
|
|
103
|
+
if (this.allow.length && matchesAllowlist(this.allow, name, args))
|
|
104
|
+
return "allow";
|
|
83
105
|
return "ask"; // any mutating tool
|
|
84
106
|
}
|
|
107
|
+
addAllowPattern(pattern) {
|
|
108
|
+
this.allow.push(pattern);
|
|
109
|
+
}
|
|
85
110
|
}
|
package/dist/permissions/tier.js
CHANGED
|
@@ -27,7 +27,7 @@ const ENTERPRISE_MUTATING = [
|
|
|
27
27
|
const ENTERPRISE_ALLOW = new Set([...SAFE_TOOLS, ...ENTERPRISE_MUTATING]);
|
|
28
28
|
// Readonly seat: inspection only = the registry-safe tools minus READONLY_SAFE_EXCLUDED. Every member is
|
|
29
29
|
// registry `safe: true`, so no workspace-mutating tool can be in it — widening it means marking a tool safe
|
|
30
|
-
// in the registry, which
|
|
30
|
+
// in the registry, which a dedicated permissions test holds to account.
|
|
31
31
|
const READONLY_ALLOW = new Set(SAFE_TOOLS.filter((n) => !READONLY_SAFE_EXCLUDED.includes(n)));
|
|
32
32
|
export const TIERS = ["admin", "enterprise", "readonly"];
|
|
33
33
|
export function isTier(v) {
|
package/dist/remote/host.js
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import { frameKey as deriveFrameKey, pairingId as derivePairingId, encryptFrame, decryptFrame } from "./pairing.js";
|
|
2
|
+
import { redactSecrets } from "../engine/redact.js";
|
|
3
|
+
/** Redact known secret shapes in tool-approval args before they hit the relay / followers. */
|
|
4
|
+
export function redactApprovalArgs(args) {
|
|
5
|
+
try {
|
|
6
|
+
return JSON.parse(redactSecrets(JSON.stringify(args ?? {})));
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
return {};
|
|
10
|
+
}
|
|
11
|
+
}
|
|
2
12
|
const V = 1;
|
|
3
13
|
// RC v2 (engine contract 1.7.0, wire v:1). The host advertises these on hello so the relay/followers can
|
|
4
14
|
// version-gate; everything is additive, so an old relay simply ignores the extra fields.
|
|
@@ -400,7 +410,13 @@ export class RemoteHost {
|
|
|
400
410
|
this.state("transcript", { entry: e });
|
|
401
411
|
}
|
|
402
412
|
toolStep(step) { this.state("tool_step", { step: this.pickTool(step) }); }
|
|
403
|
-
pickTool(step) {
|
|
413
|
+
pickTool(step) {
|
|
414
|
+
const scrubbed = step.args
|
|
415
|
+
? { ...step, args: redactApprovalArgs(step.args) }
|
|
416
|
+
: step;
|
|
417
|
+
this.upsertTool(scrubbed);
|
|
418
|
+
return scrubbed;
|
|
419
|
+
}
|
|
404
420
|
setActivity(state, label) { this.activity = state; this.state("activity", { state, ...(label ? { label } : {}) }); }
|
|
405
421
|
setStatus(ctxPct, route, tokens) {
|
|
406
422
|
this.ctxPct = ctxPct;
|
|
@@ -409,7 +425,9 @@ export class RemoteHost {
|
|
|
409
425
|
this.tokens = tokens;
|
|
410
426
|
this.state("status", { ctxPct, route, ...(this.tokens != null ? { tokens: this.tokens } : {}) });
|
|
411
427
|
}
|
|
412
|
-
approvalRequest(id, tool, args) {
|
|
428
|
+
approvalRequest(id, tool, args) {
|
|
429
|
+
this.state("approval_request", { id, tool, args: redactApprovalArgs(args) });
|
|
430
|
+
}
|
|
413
431
|
/** Mirrors an ask_user clarification to followers — a DISTINCT frame type from approval_request
|
|
414
432
|
* (not folded into it), matching the web/mobile follower's contract. A local answer and a
|
|
415
433
|
* follower's ask_user_response race first-wins in the host (settleQuestion in cli.tsx); local
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Remote-control follower slash allowlist. Kept OUT of cli.tsx so tests can assert the security
|
|
2
|
+
// boundary without importing the Ink entry. Local `/help` / Composer menu use ui/slashCommands.ts
|
|
3
|
+
// (broader). A follower may ONLY drive names in this list — everything else is refused in onCommand.
|
|
4
|
+
//
|
|
5
|
+
// Deliberately EXCLUDES (in addition to exit/login/remote):
|
|
6
|
+
// mode — `/mode auto` flips host policy to bypass (ungated tool/MCP execution)
|
|
7
|
+
// mcp — `/mcp on` enables the full fleet MCP surface for the host session
|
|
8
|
+
// bg — spawns background agents with host privileges
|
|
9
|
+
// Those remain local-owner-only. A follower already has `prompt` (runs under current host mode);
|
|
10
|
+
// they must not escalate the host's permission/MCP posture.
|
|
11
|
+
//
|
|
12
|
+
// Preference: prefer `/pair` (QR e2e) over long-lived token RC when sharing a session — paired
|
|
13
|
+
// frames encrypt DATA payloads; token mode trusts the relay path. Escalation cmds stay host-local
|
|
14
|
+
// either way (this allowlist is the hard gate).
|
|
15
|
+
export const REMOTE_SAFE_COMMANDS = [
|
|
16
|
+
{ name: "help", description: "list available commands" },
|
|
17
|
+
{ name: "model", description: "pick a model: operator-1m · operator-128k · moa (mixture-of-agents)", args: "[id]" },
|
|
18
|
+
{ name: "route", description: "pin routing to an endpoint, or auto (by size)", args: "[endpoint|auto]" },
|
|
19
|
+
{ name: "endpoints", description: "show the Operator endpoint + live health" },
|
|
20
|
+
{ name: "services", description: "ensure/inspect the service lever (Operator+autopilot+searxng); stop searxng", args: "[stop]" },
|
|
21
|
+
{ name: "audit", description: "recent tool + control-plane events from the audit trail", args: "[n]" },
|
|
22
|
+
{ name: "dashboard", description: "launch the live swarm console" },
|
|
23
|
+
{ name: "plan", description: "toggle plan mode (read-only research + propose a plan)" },
|
|
24
|
+
{ name: "think", description: "toggle extended reasoning" },
|
|
25
|
+
{ name: "ultrathink", description: "toggle deep, exhaustive reasoning" },
|
|
26
|
+
{ name: "compact", description: "force-compact the conversation now" },
|
|
27
|
+
{ name: "remember", description: "store a note to recall in future sessions", args: "<note>" },
|
|
28
|
+
{ name: "memory", description: "show remembered notes", args: "[query]" },
|
|
29
|
+
{ name: "skill", description: "activate a skill as a system-prompt directive, or /skill off", args: "<name|off>" },
|
|
30
|
+
{ name: "whoami", description: "show signed-in identity" },
|
|
31
|
+
{ name: "agents", description: "detailed sub-agent status, or a per-agent deep view + controls", args: "[id] [msg <text>|stop]" },
|
|
32
|
+
{ name: "monitor", description: "toggle live event stream (tool decisions, turns, control)" },
|
|
33
|
+
{ name: "new", description: "start a fresh conversation" },
|
|
34
|
+
{ name: "clear", description: "clear the screen (keeps the conversation)" },
|
|
35
|
+
];
|
|
36
|
+
export const REMOTE_SAFE_COMMAND_NAMES = new Set(REMOTE_SAFE_COMMANDS.map((c) => c.name));
|
|
37
|
+
/** Escalation commands that stay owner-local (must never appear in REMOTE_SAFE_COMMAND_NAMES). */
|
|
38
|
+
export const REMOTE_ESCALATION_COMMANDS = ["mode", "mcp", "bg"];
|