larkin 0.4.1 → 0.4.5
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 +76 -33
- package/artifacts/release/THIRD_PARTY_NOTICES.txt +218 -228
- package/assets/readme/larkin-github-cover.png +0 -0
- package/assets/readme/larkin-hero.svg +111 -0
- package/dist/agent/agent-state-store.cjs +193 -1
- package/dist/agent/agent-state-store.mjs +191 -0
- package/dist/app/agent-config.mjs +73 -6
- package/dist/app/agent-readiness.cjs +22 -2
- package/dist/app/agent-readiness.mjs +20 -2
- package/dist/app/binary-entry.mjs +6 -0
- package/dist/app/cli.mjs +7 -1
- package/dist/app/local-control.mjs +108 -2
- package/dist/app/run.mjs +8 -0
- package/dist/app/runtime-process.mjs +17 -1
- package/dist/app/session-cli.mjs +55 -20
- package/dist/dashboard/dashboard-view-model.mjs +12 -3
- package/dist/feishu/host-shell.cjs +104 -9
- package/dist/feishu/host-shell.mjs +105 -10
- package/dist/platform/config.cjs +406 -33
- package/dist/platform/config.mjs +405 -33
- package/dist/platform/process-boundary-trace.cjs +108 -0
- package/dist/platform/process-boundary-trace.mjs +102 -0
- package/dist/runtime/pi-artifact-provenance.cjs +147 -0
- package/dist/runtime/pi-artifact-provenance.mjs +139 -0
- package/dist/runtime/pi-compaction-recovery.cjs +703 -0
- package/dist/runtime/pi-compaction-recovery.mjs +679 -0
- package/dist/runtime/pi-model-catalog.cjs +2 -2
- package/dist/runtime/pi-model-catalog.mjs +2 -2
- package/dist/runtime/pi-profile-migration.cjs +556 -0
- package/dist/runtime/pi-profile-migration.mjs +515 -0
- package/dist/runtime/pi-provider-config.cjs +3 -3
- package/dist/runtime/pi-provider-config.mjs +3 -3
- package/dist/runtime/pi-rpc-client.cjs +39 -22
- package/dist/runtime/pi-rpc-client.mjs +39 -22
- package/dist/runtime/provider-error-classifier.cjs +39 -0
- package/dist/runtime/provider-error-classifier.mjs +34 -0
- package/dist/runtime/runtime-adapters.mjs +176 -27
- package/dist/runtime/runtime-host.cjs +630 -19
- package/dist/runtime/runtime-host.mjs +628 -18
- package/dist/runtime/runtime-readiness.cjs +6 -4
- package/dist/runtime/runtime-readiness.mjs +6 -4
- package/package.json +3 -3
|
@@ -45,6 +45,7 @@ const node_fs_1 = __importDefault(require("node:fs"));
|
|
|
45
45
|
const node_path_1 = __importDefault(require("node:path"));
|
|
46
46
|
const node_child_process_1 = require("node:child_process");
|
|
47
47
|
const pi_provider_config_js_1 = require("./pi-provider-config.cjs");
|
|
48
|
+
const process_boundary_trace_js_1 = require("../platform/process-boundary-trace.cjs");
|
|
48
49
|
function safeProviderLabel(value) {
|
|
49
50
|
const provider = typeof value === "string" ? value.trim() : "";
|
|
50
51
|
return /^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$/.test(provider) ? provider : null;
|
|
@@ -122,8 +123,8 @@ function selectedCommand(options) {
|
|
|
122
123
|
return options.env?.LARKIN_CODEX_COMMAND || process.env.LARKIN_CODEX_COMMAND || "codex";
|
|
123
124
|
return options.env?.LARKIN_CLAUDE_COMMAND || process.env.LARKIN_CLAUDE_COMMAND || "claude";
|
|
124
125
|
}
|
|
125
|
-
function executableVersion(executable, env) {
|
|
126
|
-
const result = (0, node_child_process_1.spawnSync)(executable, ["--version"], { env, encoding: "utf8", timeout: 5_000, maxBuffer: 64 * 1024 });
|
|
126
|
+
function executableVersion(executable, env, commandArgs = []) {
|
|
127
|
+
const result = (0, node_child_process_1.spawnSync)(executable, [...commandArgs, "--version"], { env, encoding: "utf8", timeout: 5_000, maxBuffer: 64 * 1024 });
|
|
127
128
|
if (result.status !== 0)
|
|
128
129
|
return undefined;
|
|
129
130
|
return String(result.stdout || result.stderr || "").replace(/[\r\n]+/g, " ").trim().slice(0, 120) || undefined;
|
|
@@ -139,6 +140,7 @@ async function probeNativeRuntimeReadiness(options) {
|
|
|
139
140
|
return { runtime: "pi", state: "ready", executable: process.execPath, version: `official-pi ${pi_provider_config_js_1.BUNDLED_PI_VERSION} (bundled)` };
|
|
140
141
|
}
|
|
141
142
|
catch (error) {
|
|
143
|
+
(0, process_boundary_trace_js_1.traceProcessBoundary)(env, "readiness:builtin-pi-failure", { configDir: env.LARKIN_CONFIG_DIR, agentId: options.agentId, targetDir: options.agentId && env.LARKIN_CONFIG_DIR ? (0, pi_provider_config_js_1.piAgentDirectory)(env.LARKIN_CONFIG_DIR, options.agentId) : undefined, error });
|
|
142
144
|
return { runtime: "pi", state: "unauthenticated", reason: error instanceof Error ? error.message : String(error),
|
|
143
145
|
nextAction: "重新运行 larkin setup,选择内置 Pi 并配置有效 API Key。" };
|
|
144
146
|
}
|
|
@@ -153,11 +155,11 @@ async function probeNativeRuntimeReadiness(options) {
|
|
|
153
155
|
? "Install Pi and ensure `pi` is on PATH, or set LARKIN_PI_COMMAND."
|
|
154
156
|
: `Install ${options.runtime} and ensure it is on PATH.`,
|
|
155
157
|
};
|
|
156
|
-
const version = executableVersion(executable, env);
|
|
158
|
+
const version = executableVersion(executable, env, options.commandArgs);
|
|
157
159
|
try {
|
|
158
160
|
if (options.runtime === "pi") {
|
|
159
161
|
const { discoverPiModelCatalog } = await Promise.resolve().then(() => __importStar(require("./pi-model-catalog.cjs")));
|
|
160
|
-
await discoverPiModelCatalog({ cwd: options.cwd, command: executable, env });
|
|
162
|
+
await discoverPiModelCatalog({ cwd: options.cwd, command: executable, commandArgs: options.commandArgs, env });
|
|
161
163
|
}
|
|
162
164
|
else if (options.runtime === "codex") {
|
|
163
165
|
const { discoverCodexModelCatalog } = await Promise.resolve().then(() => __importStar(require("./codex-model-catalog.cjs")));
|
|
@@ -2,6 +2,7 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { spawnSync } from "node:child_process";
|
|
4
4
|
import { assertBuiltinPiAgentDirectory, BUNDLED_PI_VERSION, piAgentDirectory } from "./pi-provider-config.mjs";
|
|
5
|
+
import { traceProcessBoundary } from "../platform/process-boundary-trace.mjs";
|
|
5
6
|
function safeProviderLabel(value) {
|
|
6
7
|
const provider = typeof value === "string" ? value.trim() : "";
|
|
7
8
|
return /^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$/.test(provider) ? provider : null;
|
|
@@ -78,8 +79,8 @@ function selectedCommand(options) {
|
|
|
78
79
|
return options.env?.LARKIN_CODEX_COMMAND || process.env.LARKIN_CODEX_COMMAND || "codex";
|
|
79
80
|
return options.env?.LARKIN_CLAUDE_COMMAND || process.env.LARKIN_CLAUDE_COMMAND || "claude";
|
|
80
81
|
}
|
|
81
|
-
function executableVersion(executable, env) {
|
|
82
|
-
const result = spawnSync(executable, ["--version"], { env, encoding: "utf8", timeout: 5_000, maxBuffer: 64 * 1024 });
|
|
82
|
+
function executableVersion(executable, env, commandArgs = []) {
|
|
83
|
+
const result = spawnSync(executable, [...commandArgs, "--version"], { env, encoding: "utf8", timeout: 5_000, maxBuffer: 64 * 1024 });
|
|
83
84
|
if (result.status !== 0)
|
|
84
85
|
return undefined;
|
|
85
86
|
return String(result.stdout || result.stderr || "").replace(/[\r\n]+/g, " ").trim().slice(0, 120) || undefined;
|
|
@@ -95,6 +96,7 @@ export async function probeNativeRuntimeReadiness(options) {
|
|
|
95
96
|
return { runtime: "pi", state: "ready", executable: process.execPath, version: `official-pi ${BUNDLED_PI_VERSION} (bundled)` };
|
|
96
97
|
}
|
|
97
98
|
catch (error) {
|
|
99
|
+
traceProcessBoundary(env, "readiness:builtin-pi-failure", { configDir: env.LARKIN_CONFIG_DIR, agentId: options.agentId, targetDir: options.agentId && env.LARKIN_CONFIG_DIR ? piAgentDirectory(env.LARKIN_CONFIG_DIR, options.agentId) : undefined, error });
|
|
98
100
|
return { runtime: "pi", state: "unauthenticated", reason: error instanceof Error ? error.message : String(error),
|
|
99
101
|
nextAction: "重新运行 larkin setup,选择内置 Pi 并配置有效 API Key。" };
|
|
100
102
|
}
|
|
@@ -109,11 +111,11 @@ export async function probeNativeRuntimeReadiness(options) {
|
|
|
109
111
|
? "Install Pi and ensure `pi` is on PATH, or set LARKIN_PI_COMMAND."
|
|
110
112
|
: `Install ${options.runtime} and ensure it is on PATH.`,
|
|
111
113
|
};
|
|
112
|
-
const version = executableVersion(executable, env);
|
|
114
|
+
const version = executableVersion(executable, env, options.commandArgs);
|
|
113
115
|
try {
|
|
114
116
|
if (options.runtime === "pi") {
|
|
115
117
|
const { discoverPiModelCatalog } = await import("./pi-model-catalog.mjs");
|
|
116
|
-
await discoverPiModelCatalog({ cwd: options.cwd, command: executable, env });
|
|
118
|
+
await discoverPiModelCatalog({ cwd: options.cwd, command: executable, commandArgs: options.commandArgs, env });
|
|
117
119
|
}
|
|
118
120
|
else if (options.runtime === "codex") {
|
|
119
121
|
const { discoverCodexModelCatalog } = await import("./codex-model-catalog.mjs");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "larkin",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"larkinPackageRole": "npm-published",
|
|
6
6
|
"files": [
|
|
@@ -84,14 +84,14 @@
|
|
|
84
84
|
"test:live:agent-cli-routing-codex": "bun run build && LARKIN_RUN_AGENT_CLI_ROUTING_CODEX_LIVE=1 bun test --max-concurrency 1 test/live/agent-cli-routing-codex-live.test.mjs"
|
|
85
85
|
},
|
|
86
86
|
"dependencies": {
|
|
87
|
-
"@earendil-works/pi-coding-agent": "0.
|
|
88
|
-
"@tintinweb/pi-subagents": "0.14.3",
|
|
87
|
+
"@earendil-works/pi-coding-agent": "0.84.2",
|
|
89
88
|
"@larksuite/channel": "^0.4.0",
|
|
90
89
|
"@opentelemetry/api": "^1.9.1",
|
|
91
90
|
"@opentelemetry/resources": "^2.10.0",
|
|
92
91
|
"@opentelemetry/sdk-trace-base": "^2.10.0",
|
|
93
92
|
"@opentelemetry/sdk-trace-node": "^2.10.0",
|
|
94
93
|
"@radix-ui/react-dialog": "^1.1.21",
|
|
94
|
+
"@tintinweb/pi-subagents": "0.14.3",
|
|
95
95
|
"lucide-react": "^1.26.0",
|
|
96
96
|
"proper-lockfile": "4.1.2",
|
|
97
97
|
"qrcode-terminal": "^0.12.0",
|