@0perator/operator 0.0.6
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 +73 -0
- package/dist/auth/client.js +94 -0
- package/dist/auth/commands.js +99 -0
- package/dist/auth/store.js +99 -0
- package/dist/background/index.js +64 -0
- package/dist/cli.js +407 -0
- package/dist/config/settings.js +85 -0
- package/dist/engine/agent.js +232 -0
- package/dist/engine/aurora.js +213 -0
- package/dist/engine/compaction.js +111 -0
- package/dist/engine/contract.js +8 -0
- package/dist/engine/messages.js +85 -0
- package/dist/engine/router-adapter.js +29 -0
- package/dist/engine/selfheal.js +46 -0
- package/dist/engine/toolcalls.js +164 -0
- package/dist/index.browser.js +22 -0
- package/dist/index.js +23 -0
- package/dist/mcp/client.js +95 -0
- package/dist/mcp/config.js +73 -0
- package/dist/mcp/index.js +101 -0
- package/dist/mcp/stdio.js +149 -0
- package/dist/memory/index.js +0 -0
- package/dist/observability/index.js +60 -0
- package/dist/permissions/audit.js +50 -0
- package/dist/permissions/index.js +48 -0
- package/dist/permissions/policy.js +54 -0
- package/dist/router/router.js +94 -0
- package/dist/session.js +265 -0
- package/dist/tools/executor.js +0 -0
- package/dist/tools/registry.js +380 -0
- package/dist/tools/sandbox.js +90 -0
- package/dist/ui/ActivitySpinner.js +48 -0
- package/dist/ui/App.js +16 -0
- package/dist/ui/AuthScreen.js +17 -0
- package/dist/ui/BgPanel.js +24 -0
- package/dist/ui/Composer.js +119 -0
- package/dist/ui/Header.js +22 -0
- package/dist/ui/StatusRule.js +11 -0
- package/dist/ui/ThinkingSpinner.js +61 -0
- package/dist/ui/ToolStep.js +32 -0
- package/dist/ui/Transcript.js +22 -0
- package/dist/ui/format.js +6 -0
- package/dist/ui/index.js +9 -0
- package/dist/ui/types.js +3 -0
- package/dist/ui/useInputHistory.js +97 -0
- package/dist/update.js +57 -0
- package/package.json +47 -0
package/dist/update.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// `operator update` — self-update, mirroring `claude update`. Two install shapes:
|
|
2
|
+
// • npm-global → the published package on the registry; update = reinstall @latest.
|
|
3
|
+
// • source/dev → a git checkout linked via `npm link`; update = pull + rebuild.
|
|
4
|
+
// We detect the shape from where THIS module resolves: a checkout still has a .git above it;
|
|
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";
|
|
8
|
+
import { dirname, join, resolve } from "node:path";
|
|
9
|
+
import { fileURLToPath } from "node:url";
|
|
10
|
+
const PKG = "@0perator/operator"; // published (private) scope/name — keep in sync with package.json
|
|
11
|
+
// Walk up from the running file looking for a .git dir (source checkout) before we hit a
|
|
12
|
+
// node_modules boundary (global install). Returns the repo root, or null for a packaged install.
|
|
13
|
+
function findRepoRoot() {
|
|
14
|
+
let dir = dirname(fileURLToPath(import.meta.url));
|
|
15
|
+
for (let i = 0; i < 12 && dir !== "/" && dir; i++) {
|
|
16
|
+
if (dir.split("/").includes("node_modules"))
|
|
17
|
+
return null; // packaged: stop before repo heuristics
|
|
18
|
+
if (existsSync(join(dir, ".git")))
|
|
19
|
+
return dir;
|
|
20
|
+
const parent = resolve(dir, "..");
|
|
21
|
+
if (parent === dir)
|
|
22
|
+
break;
|
|
23
|
+
dir = parent;
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
function run(cmd, args, cwd) {
|
|
28
|
+
const r = spawnSync(cmd, args, { stdio: "inherit", cwd });
|
|
29
|
+
return r.status ?? 1;
|
|
30
|
+
}
|
|
31
|
+
export async function runUpdate() {
|
|
32
|
+
const repo = findRepoRoot();
|
|
33
|
+
if (repo) {
|
|
34
|
+
// kode-tsi lives in a subdir of the kode repo; build happens where package.json is.
|
|
35
|
+
const pkgDir = existsSync(join(repo, "kode-tsi", "package.json")) ? join(repo, "kode-tsi") : repo;
|
|
36
|
+
process.stderr.write(`operator update: source checkout at ${repo} — pulling + rebuilding\n`);
|
|
37
|
+
let code = run("git", ["-C", repo, "pull", "--ff-only"]);
|
|
38
|
+
if (code !== 0) {
|
|
39
|
+
process.stderr.write("operator update: `git pull` failed (uncommitted changes or diverged?)\n");
|
|
40
|
+
return code;
|
|
41
|
+
}
|
|
42
|
+
code = run("npm", ["install", "--silent"], pkgDir);
|
|
43
|
+
if (code !== 0)
|
|
44
|
+
return code;
|
|
45
|
+
code = run("npm", ["run", "build"], pkgDir);
|
|
46
|
+
if (code === 0)
|
|
47
|
+
process.stderr.write("operator update: done (rebuilt from source).\n");
|
|
48
|
+
return code;
|
|
49
|
+
}
|
|
50
|
+
process.stderr.write(`operator update: reinstalling ${PKG}@latest from the registry\n`);
|
|
51
|
+
const code = run("npm", ["install", "-g", `${PKG}@latest`]);
|
|
52
|
+
if (code === 0)
|
|
53
|
+
process.stderr.write("operator update: done.\n");
|
|
54
|
+
else
|
|
55
|
+
process.stderr.write(`operator update: failed. If ${PKG} is private, run \`npm login\` for the 0perator org first.\n`);
|
|
56
|
+
return code;
|
|
57
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@0perator/operator",
|
|
3
|
+
"version": "0.0.6",
|
|
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
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"operator": "dist/cli.js",
|
|
8
|
+
"kode-tsi": "dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=20"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"dev": "tsx src/cli.tsx",
|
|
19
|
+
"build": "tsc -p tsconfig.json",
|
|
20
|
+
"start": "node dist/cli.js",
|
|
21
|
+
"test": "tsx test/run.mts",
|
|
22
|
+
"test:watch": "tsx watch test/run.mts",
|
|
23
|
+
"prepublishOnly": "npm run build && npm test"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"ink": "^5.0.1",
|
|
27
|
+
"react": "^18.3.1"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/node": "^22.20.3",
|
|
31
|
+
"@types/react": "^18.3.3",
|
|
32
|
+
"ink-testing-library": "^3.0.0",
|
|
33
|
+
"tsx": "^4.19.1",
|
|
34
|
+
"typescript": "^5.6.2"
|
|
35
|
+
},
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "git+https://github.com/memjar/kode.git",
|
|
39
|
+
"directory": "kode-tsi"
|
|
40
|
+
},
|
|
41
|
+
"license": "UNLICENSED",
|
|
42
|
+
"private": false,
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "restricted",
|
|
45
|
+
"registry": "https://registry.npmjs.org/"
|
|
46
|
+
}
|
|
47
|
+
}
|