@0perator/operator 0.0.7 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/client.js +17 -0
- package/dist/auth/commands.js +124 -27
- package/dist/background/index.js +59 -18
- package/dist/cli.js +125 -14
- package/dist/config/settings.js +4 -1
- package/dist/engine/agent.js +24 -6
- package/dist/engine/aurora.js +20 -4
- package/dist/engine/grandmaster.js +172 -0
- package/dist/memory/index.js +0 -0
- package/dist/session.js +1 -0
- package/dist/tools/computer.js +279 -0
- package/dist/tools/registry.js +215 -11
- package/dist/tools/sandbox.js +118 -13
- package/dist/ui/App.js +3 -2
- package/dist/ui/ApprovalPrompt.js +45 -0
- package/dist/ui/BgPanel.js +12 -1
- package/dist/ui/Composer.js +11 -2
- package/dist/ui/Markdown.js +76 -0
- package/dist/ui/StatusRule.js +2 -0
- package/dist/ui/Transcript.js +8 -3
- package/dist/update.js +16 -4
- package/package.json +1 -1
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from "ink";
|
|
3
|
+
// Split one line into styled inline spans: **bold**, `code`, *italic* / _italic_. Longest markers first.
|
|
4
|
+
function renderInline(text, kp) {
|
|
5
|
+
const nodes = [];
|
|
6
|
+
const re = /(\*\*[^*]+\*\*|`[^`]+`|\*[^*\s][^*]*\*|_[^_\s][^_]*_)/g;
|
|
7
|
+
let last = 0;
|
|
8
|
+
let m;
|
|
9
|
+
let i = 0;
|
|
10
|
+
while ((m = re.exec(text)) !== null) {
|
|
11
|
+
if (m.index > last)
|
|
12
|
+
nodes.push(_jsx(Text, { children: text.slice(last, m.index) }, `${kp}t${i++}`));
|
|
13
|
+
const tok = m[0];
|
|
14
|
+
if (tok.startsWith("**"))
|
|
15
|
+
nodes.push(_jsx(Text, { bold: true, children: tok.slice(2, -2) }, `${kp}b${i++}`));
|
|
16
|
+
else if (tok.startsWith("`"))
|
|
17
|
+
nodes.push(_jsx(Text, { color: "cyan", children: tok.slice(1, -1) }, `${kp}c${i++}`));
|
|
18
|
+
else
|
|
19
|
+
nodes.push(_jsx(Text, { italic: true, children: tok.slice(1, -1) }, `${kp}i${i++}`));
|
|
20
|
+
last = m.index + tok.length;
|
|
21
|
+
}
|
|
22
|
+
if (last < text.length)
|
|
23
|
+
nodes.push(_jsx(Text, { children: text.slice(last) }, `${kp}t${i++}`));
|
|
24
|
+
return nodes.length ? nodes : [_jsx(Text, { children: text }, `${kp}e`)];
|
|
25
|
+
}
|
|
26
|
+
export function Markdown({ content }) {
|
|
27
|
+
const lines = content.split("\n");
|
|
28
|
+
const blocks = [];
|
|
29
|
+
let inFence = false;
|
|
30
|
+
let fence = [];
|
|
31
|
+
let k = 0;
|
|
32
|
+
const flushFence = () => {
|
|
33
|
+
// Fenced code: verbatim, tinted, indented — no inline parsing inside.
|
|
34
|
+
blocks.push(_jsx(Box, { flexDirection: "column", paddingLeft: 1, children: fence.map((l, idx) => (_jsx(Text, { color: "cyan", dimColor: true, children: l.length ? l : " " }, idx))) }, `f${k++}`));
|
|
35
|
+
fence = [];
|
|
36
|
+
};
|
|
37
|
+
for (const line of lines) {
|
|
38
|
+
if (/^\s*```/.test(line)) {
|
|
39
|
+
if (inFence) {
|
|
40
|
+
flushFence();
|
|
41
|
+
inFence = false;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
inFence = true;
|
|
45
|
+
}
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
if (inFence) {
|
|
49
|
+
fence.push(line);
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
const h = /^(#{1,6})\s+(.*)$/.exec(line);
|
|
53
|
+
if (h) {
|
|
54
|
+
blocks.push(_jsx(Text, { bold: true, children: renderInline(h[2], `h${k}`) }, `h${k++}`));
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const b = /^(\s*)[-*+]\s+(.*)$/.exec(line);
|
|
58
|
+
if (b) {
|
|
59
|
+
blocks.push(_jsxs(Text, { children: [b[1], _jsx(Text, { color: "cyan", children: "\u2022 " }), renderInline(b[2], `b${k}`)] }, `b${k++}`));
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
const n = /^(\s*)(\d+)\.\s+(.*)$/.exec(line);
|
|
63
|
+
if (n) {
|
|
64
|
+
blocks.push(_jsxs(Text, { children: [n[1], _jsxs(Text, { bold: true, children: [n[2], "."] }), " ", renderInline(n[3], `n${k}`)] }, `n${k++}`));
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
if (line.trim() === "") {
|
|
68
|
+
blocks.push(_jsx(Text, { children: " " }, `s${k++}`));
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
blocks.push(_jsx(Text, { children: renderInline(line, `p${k}`) }, `p${k++}`));
|
|
72
|
+
}
|
|
73
|
+
if (inFence && fence.length)
|
|
74
|
+
flushFence();
|
|
75
|
+
return _jsx(Box, { flexDirection: "column", children: blocks });
|
|
76
|
+
}
|
package/dist/ui/StatusRule.js
CHANGED
|
@@ -5,5 +5,7 @@ export function StatusRule({ route, ctxPct, version, build, user }) {
|
|
|
5
5
|
const tag = ` ${who}${route} · ${Math.round(ctxPct)}% · Operator v${version}${build ? ` ·${build}` : ""} `;
|
|
6
6
|
const cols = process.stdout.columns ?? 80;
|
|
7
7
|
const fill = Math.max(1, cols - tag.length - 1);
|
|
8
|
+
// Top rule of the input box: a dim line with the status text on the right. The composer sits BELOW
|
|
9
|
+
// this and ABOVE the InputRule, so the input is bounded between the two lines.
|
|
8
10
|
return (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: "─".repeat(fill) }), _jsx(Text, { dimColor: true, children: tag + "─" })] }));
|
|
9
11
|
}
|
package/dist/ui/Transcript.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Static, Text } from "ink";
|
|
3
3
|
import { ToolStep } from "./ToolStep.js";
|
|
4
|
+
import { Markdown } from "./Markdown.js";
|
|
4
5
|
function entryKey(entry) {
|
|
5
6
|
return entry.kind === "message" ? entry.message.id : entry.step.id;
|
|
6
7
|
}
|
|
7
|
-
function renderEntry(entry) {
|
|
8
|
+
function renderEntry(entry, live = false) {
|
|
8
9
|
if (entry.kind === "message") {
|
|
9
10
|
const { message } = entry;
|
|
10
11
|
if (message.role === "user") {
|
|
@@ -13,10 +14,14 @@ function renderEntry(entry) {
|
|
|
13
14
|
if (message.role === "system") {
|
|
14
15
|
return _jsx(Text, { dimColor: true, children: message.content }); // slash-command output / status notes
|
|
15
16
|
}
|
|
16
|
-
|
|
17
|
+
// Thought process first, dimmed and lower-opacity; the real answer follows at full weight, so the
|
|
18
|
+
// reasoning reads as recessive scaffolding and the answer stands out (per the requested look).
|
|
19
|
+
// Settled answers render as markdown (bold/code/lists/headers formatted, not raw `**`/backticks);
|
|
20
|
+
// the LIVE stream stays plain text so a half-open ``` fence can't swallow the text while it types.
|
|
21
|
+
return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [message.reasoning ? _jsx(Text, { dimColor: true, children: message.reasoning }) : null, message.content ? (live ? _jsx(Text, { children: message.content }) : _jsx(Markdown, { content: message.content })) : null] }));
|
|
17
22
|
}
|
|
18
23
|
return _jsx(ToolStep, { step: entry.step });
|
|
19
24
|
}
|
|
20
25
|
export function Transcript({ entries, live }) {
|
|
21
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Static, { items: entries, children: (entry) => _jsx(Box, { children: renderEntry(entry) }, entryKey(entry)) }), live ? _jsx(Box, { children: renderEntry(live) }) : null] }));
|
|
26
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Static, { items: entries, children: (entry) => _jsx(Box, { children: renderEntry(entry) }, entryKey(entry)) }), live ? _jsx(Box, { children: renderEntry(live, true) }) : null] }));
|
|
22
27
|
}
|
package/dist/update.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
// • source/dev → a git checkout linked via `npm link`; update = pull + rebuild.
|
|
4
4
|
// We detect the shape from where THIS module resolves: a checkout still has a .git above it;
|
|
5
5
|
// a global install lives under a node_modules tree with no repo around it.
|
|
6
|
-
import { spawnSync } from "node:child_process";
|
|
7
|
-
import { existsSync } from "node:fs";
|
|
6
|
+
import { spawnSync, execSync } from "node:child_process";
|
|
7
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
8
8
|
import { dirname, join, resolve } from "node:path";
|
|
9
9
|
import { fileURLToPath } from "node:url";
|
|
10
10
|
const PKG = "@0perator/operator"; // published (private) scope/name — keep in sync with package.json
|
|
@@ -43,8 +43,20 @@ export async function runUpdate() {
|
|
|
43
43
|
if (code !== 0)
|
|
44
44
|
return code;
|
|
45
45
|
code = run("npm", ["run", "build"], pkgDir);
|
|
46
|
-
if (code === 0)
|
|
47
|
-
|
|
46
|
+
if (code === 0) {
|
|
47
|
+
let ver = "?", sha = "";
|
|
48
|
+
try {
|
|
49
|
+
ver = JSON.parse(readFileSync(join(pkgDir, "package.json"), "utf8")).version;
|
|
50
|
+
}
|
|
51
|
+
catch { /* best-effort */ }
|
|
52
|
+
try {
|
|
53
|
+
sha = execSync(`git -C '${repo}' rev-parse --short HEAD`).toString().trim();
|
|
54
|
+
}
|
|
55
|
+
catch { /* best-effort */ }
|
|
56
|
+
process.stderr.write(`\noperator update: ✓ updated to v${ver}${sha ? ` (${sha})` : ""} and rebuilt.\n` +
|
|
57
|
+
`RESTART to run it — type /exit and relaunch \`operator\`, or open a new terminal. Your CURRENT ` +
|
|
58
|
+
`session keeps the old version until you restart (that is why a re-run can behave the same).\n`);
|
|
59
|
+
}
|
|
48
60
|
return code;
|
|
49
61
|
}
|
|
50
62
|
process.stderr.write(`operator update: reinstalling ${PKG}@latest from the registry\n`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0perator/operator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"description": "Operator (KODE) — TypeScript + Ink terminal coding agent. Full-frame render, single-engine core shared across CLI/web/mobile; runs against a local Aurora model.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|