@linzumi/cli 0.0.108-beta → 0.0.110-beta
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 +1 -1
- package/dist/index.js +216 -37
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -20078,7 +20078,7 @@ var linzumiCliVersion, linzumiCliVersionText;
|
|
|
20078
20078
|
var init_version = __esm({
|
|
20079
20079
|
"src/version.ts"() {
|
|
20080
20080
|
"use strict";
|
|
20081
|
-
linzumiCliVersion = "0.0.
|
|
20081
|
+
linzumiCliVersion = "0.0.110-beta";
|
|
20082
20082
|
linzumiCliVersionText = `linzumi ${linzumiCliVersion}`;
|
|
20083
20083
|
}
|
|
20084
20084
|
});
|
|
@@ -23182,24 +23182,52 @@ import { mkdtempSync as mkdtempSync3, readFileSync as readFileSync16, rmSync as
|
|
|
23182
23182
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
23183
23183
|
import { join as join20 } from "node:path";
|
|
23184
23184
|
async function suggestSignupTasksWithCodex(args) {
|
|
23185
|
-
const
|
|
23185
|
+
const model = resolveTaskSuggestionModel(args.model, args.modelProvider);
|
|
23186
|
+
const startedAt = Date.now();
|
|
23186
23187
|
let previousResponse;
|
|
23187
|
-
|
|
23188
|
-
|
|
23189
|
-
|
|
23190
|
-
|
|
23191
|
-
|
|
23192
|
-
|
|
23193
|
-
}
|
|
23188
|
+
let lastFailure;
|
|
23189
|
+
for (let attempt = 0; attempt <= MAX_SCHEMA_REPAIR_ATTEMPTS; attempt += 1) {
|
|
23190
|
+
const elapsed = Date.now() - startedAt;
|
|
23191
|
+
const remaining = SUGGESTION_TIMEOUT_MS - elapsed;
|
|
23192
|
+
if (remaining <= 0) {
|
|
23193
|
+
break;
|
|
23194
|
+
}
|
|
23195
|
+
let response;
|
|
23196
|
+
try {
|
|
23197
|
+
response = await runCodexTaskSuggestion({
|
|
23198
|
+
projectPath: args.projectPath,
|
|
23199
|
+
codexBin: args.codexBin,
|
|
23200
|
+
model,
|
|
23201
|
+
modelProvider: args.modelProvider,
|
|
23202
|
+
previousResponse,
|
|
23203
|
+
timeoutMs: remaining
|
|
23204
|
+
});
|
|
23205
|
+
} catch (error) {
|
|
23206
|
+
throw error instanceof Error ? error : new Error(String(error));
|
|
23207
|
+
}
|
|
23194
23208
|
const tasks = parseTaskSuggestionResponse(response);
|
|
23195
23209
|
if (tasks !== void 0) {
|
|
23196
23210
|
return tasks;
|
|
23197
23211
|
}
|
|
23198
23212
|
previousResponse = response;
|
|
23213
|
+
lastFailure = new Error(
|
|
23214
|
+
"Codex returned a response that did not match the task suggestion schema"
|
|
23215
|
+
);
|
|
23199
23216
|
}
|
|
23200
|
-
throw new Error(
|
|
23201
|
-
|
|
23202
|
-
|
|
23217
|
+
throw lastFailure ?? new Error("Codex did not return valid task suggestions in the time budget");
|
|
23218
|
+
}
|
|
23219
|
+
function resolveTaskSuggestionModel(explicitModel, modelProvider) {
|
|
23220
|
+
const envModel = process.env.LINZUMI_SIGNUP_TASK_MODEL;
|
|
23221
|
+
if (explicitModel !== void 0 && explicitModel !== "") {
|
|
23222
|
+
return explicitModel;
|
|
23223
|
+
}
|
|
23224
|
+
if (envModel !== void 0 && envModel !== "") {
|
|
23225
|
+
return envModel;
|
|
23226
|
+
}
|
|
23227
|
+
if (modelProvider !== void 0) {
|
|
23228
|
+
return DEFAULT_WAFER_SUGGESTION_MODEL;
|
|
23229
|
+
}
|
|
23230
|
+
return DEFAULT_CODEX_AUTH_SUGGESTION_MODEL;
|
|
23203
23231
|
}
|
|
23204
23232
|
async function runCodexTaskSuggestion(args) {
|
|
23205
23233
|
const tempRoot = mkdtempSync3(join20(tmpdir2(), "linzumi-signup-codex-tasks-"));
|
|
@@ -23217,10 +23245,12 @@ async function runCodexTaskSuggestion(args) {
|
|
|
23217
23245
|
codexTaskSuggestionProcess({
|
|
23218
23246
|
command: args.codexBin,
|
|
23219
23247
|
model: args.model,
|
|
23248
|
+
modelProvider: args.modelProvider,
|
|
23220
23249
|
projectPath: args.projectPath,
|
|
23221
23250
|
schemaPath,
|
|
23222
23251
|
outputPath,
|
|
23223
|
-
prompt
|
|
23252
|
+
prompt,
|
|
23253
|
+
timeoutMs: args.timeoutMs
|
|
23224
23254
|
})
|
|
23225
23255
|
);
|
|
23226
23256
|
return readFileSync16(outputPath, "utf8");
|
|
@@ -23236,9 +23266,19 @@ function codexTaskSuggestionProcess(args) {
|
|
|
23236
23266
|
"--model",
|
|
23237
23267
|
args.model,
|
|
23238
23268
|
"-c",
|
|
23239
|
-
|
|
23269
|
+
// RELIABILITY: minimal reasoning effort keeps the agentic turn fast and
|
|
23270
|
+
// far less flaky while still producing repo-specific tasks (it still
|
|
23271
|
+
// inspects the real repo below). The latency/flake budget was the main
|
|
23272
|
+
// driver of runner_task_suggestion_failed.
|
|
23273
|
+
'model_reasoning_effort="minimal"',
|
|
23240
23274
|
"-c",
|
|
23241
23275
|
'approval_policy="never"',
|
|
23276
|
+
// Wafer routing: render the `-c model_providers.linzumi.*` config args
|
|
23277
|
+
// plus `-c model_provider=linzumi`, identical to the main per-thread codex
|
|
23278
|
+
// app-server start (codexModelProviderConfigArgs). Secrets stay in env via
|
|
23279
|
+
// env_key/env_http_headers, never argv. Omitted for native-codex-auth
|
|
23280
|
+
// users, who keep their own provider.
|
|
23281
|
+
...args.modelProvider === void 0 ? [] : codexModelProviderConfigArgs(args.modelProvider.config),
|
|
23242
23282
|
"--sandbox",
|
|
23243
23283
|
"read-only",
|
|
23244
23284
|
"--skip-git-repo-check",
|
|
@@ -23254,7 +23294,8 @@ function codexTaskSuggestionProcess(args) {
|
|
|
23254
23294
|
],
|
|
23255
23295
|
cwd: args.projectPath,
|
|
23256
23296
|
stdin: args.prompt,
|
|
23257
|
-
|
|
23297
|
+
...args.modelProvider === void 0 ? {} : { env: args.modelProvider.env },
|
|
23298
|
+
timeoutMs: args.timeoutMs ?? SUGGESTION_TIMEOUT_MS
|
|
23258
23299
|
};
|
|
23259
23300
|
}
|
|
23260
23301
|
function taskSuggestionPrompt(previousResponse) {
|
|
@@ -23272,16 +23313,13 @@ function taskSuggestionPrompt(previousResponse) {
|
|
|
23272
23313
|
"Task:",
|
|
23273
23314
|
"Inspect this repository read-only and suggest exactly 5 useful quick starter tasks for Codex agents.",
|
|
23274
23315
|
"",
|
|
23275
|
-
"
|
|
23276
|
-
"-
|
|
23277
|
-
"-
|
|
23278
|
-
"-
|
|
23279
|
-
"- Be mindful of GitHub rate limits, CPU usage, and network usage; prefer one or two small calls and do not paginate or crawl exhaustively.",
|
|
23280
|
-
"- If a GitHub call returns unauthorized, forbidden, or not found for this repository, stop GitHub lookups for this repository.",
|
|
23281
|
-
"- Use pull request and issue titles, states, labels, and recent activity to infer what the repo is about, what the user has been working on, and likely next tasks.",
|
|
23316
|
+
"How to inspect (be fast - aim to answer within a single short pass):",
|
|
23317
|
+
"- Read the repo locally: top-level files, README, package manifests, and a shallow look at the main source directories are enough to infer what the project is.",
|
|
23318
|
+
"- Base the suggestions on the ACTUAL repository contents you observe, not on generic templates.",
|
|
23319
|
+
"- Do NOT crawl GitHub. Skip `gh` entirely; local files are sufficient and far faster.",
|
|
23282
23320
|
"",
|
|
23283
23321
|
"Constraints:",
|
|
23284
|
-
"- Prefer tasks that are small, concrete, and
|
|
23322
|
+
"- Prefer tasks that are small, concrete, and specific to THIS repository (reference real files, modules, or features you saw).",
|
|
23285
23323
|
"- Do not modify files.",
|
|
23286
23324
|
"- Do not include markdown fences or prose outside the JSON response.",
|
|
23287
23325
|
"- Keep each task title under 120 characters.",
|
|
@@ -23347,6 +23385,9 @@ function runProcess2(args) {
|
|
|
23347
23385
|
return new Promise((resolveProcess, rejectProcess) => {
|
|
23348
23386
|
const child = spawn7(args.command, [...args.args], {
|
|
23349
23387
|
cwd: args.cwd,
|
|
23388
|
+
// Inherit the runner env (codex auth, PATH, etc.) and layer the wafer
|
|
23389
|
+
// proxy credential (LINZUMI_LLM_PROXY_TOKEN) on top when wafer-routed.
|
|
23390
|
+
...args.env === void 0 ? {} : { env: { ...process.env, ...args.env } },
|
|
23350
23391
|
stdio: ["pipe", "ignore", "pipe"]
|
|
23351
23392
|
});
|
|
23352
23393
|
let stderr = "";
|
|
@@ -23387,9 +23428,15 @@ function runProcess2(args) {
|
|
|
23387
23428
|
child.stdin?.end(args.stdin);
|
|
23388
23429
|
});
|
|
23389
23430
|
}
|
|
23431
|
+
var DEFAULT_CODEX_AUTH_SUGGESTION_MODEL, DEFAULT_WAFER_SUGGESTION_MODEL, SUGGESTION_TIMEOUT_MS, MAX_SCHEMA_REPAIR_ATTEMPTS;
|
|
23390
23432
|
var init_signupTaskSuggestions = __esm({
|
|
23391
23433
|
"src/signupTaskSuggestions.ts"() {
|
|
23392
23434
|
"use strict";
|
|
23435
|
+
init_codexAppServer();
|
|
23436
|
+
DEFAULT_CODEX_AUTH_SUGGESTION_MODEL = "gpt-5.4-mini";
|
|
23437
|
+
DEFAULT_WAFER_SUGGESTION_MODEL = "GLM-5.2";
|
|
23438
|
+
SUGGESTION_TIMEOUT_MS = 15e4;
|
|
23439
|
+
MAX_SCHEMA_REPAIR_ATTEMPTS = 1;
|
|
23393
23440
|
}
|
|
23394
23441
|
});
|
|
23395
23442
|
|
|
@@ -25064,6 +25111,7 @@ async function openLocalCodexRunner(options, log2, cleanup, close, runnerDrainHo
|
|
|
25064
25111
|
const latestResumeReconcileByThread = /* @__PURE__ */ new Map();
|
|
25065
25112
|
let acceptingInbound = true;
|
|
25066
25113
|
const inboundQueueWorkspace = () => runnerWorkspaceSlug(options) ?? "default";
|
|
25114
|
+
const resolveRunnerBoundChannel = () => options.channelSession?.channelSlug ?? threadSessionRegistry.list()[0]?.channel;
|
|
25067
25115
|
const durableInboundQueueFor = (channel, kandanThreadId) => {
|
|
25068
25116
|
const workspace = inboundQueueWorkspace();
|
|
25069
25117
|
const cacheKey = `${workspace}:${channel}:${kandanThreadId}`;
|
|
@@ -26845,7 +26893,25 @@ async function openLocalCodexRunner(options, log2, cleanup, close, runnerDrainHo
|
|
|
26845
26893
|
}
|
|
26846
26894
|
const record = threadSessionRegistry.list().find((entry) => entry.kandanThreadId === kandanThreadId);
|
|
26847
26895
|
if (record === void 0) {
|
|
26848
|
-
|
|
26896
|
+
const boundChannel = resolveRunnerBoundChannel();
|
|
26897
|
+
if (boundChannel === void 0 || !acceptingInbound) {
|
|
26898
|
+
return "ignored";
|
|
26899
|
+
}
|
|
26900
|
+
const queue2 = durableInboundQueueFor(boundChannel, kandanThreadId);
|
|
26901
|
+
const enqueued = queue2.enqueue(
|
|
26902
|
+
event.seq,
|
|
26903
|
+
event.localRunnerEventType === void 0 ? "live" : "replay",
|
|
26904
|
+
serializeKandanChatEventForQueue(event),
|
|
26905
|
+
Date.now()
|
|
26906
|
+
);
|
|
26907
|
+
log2("runner.spawn_on_miss_enqueued_without_local_record", {
|
|
26908
|
+
kandanThreadId,
|
|
26909
|
+
channel: boundChannel,
|
|
26910
|
+
seq: event.seq,
|
|
26911
|
+
enqueued: enqueued.accepted
|
|
26912
|
+
});
|
|
26913
|
+
await publishUnroutedDurableEnqueueState(boundChannel, event);
|
|
26914
|
+
return "spawned";
|
|
26849
26915
|
}
|
|
26850
26916
|
const queueChannel = record.channel;
|
|
26851
26917
|
const watermarkKey = threadSourceSeqWatermarkKey(
|
|
@@ -26971,12 +27037,53 @@ async function openLocalCodexRunner(options, log2, cleanup, close, runnerDrainHo
|
|
|
26971
27037
|
}
|
|
26972
27038
|
});
|
|
26973
27039
|
};
|
|
27040
|
+
const drainThreadQueueAfterSpawn = async (kandanThreadId, spawnResponse) => {
|
|
27041
|
+
if (spawnResponse !== void 0 && spawnResponse.ok === false) {
|
|
27042
|
+
return;
|
|
27043
|
+
}
|
|
27044
|
+
if (!acceptingInbound) {
|
|
27045
|
+
return;
|
|
27046
|
+
}
|
|
27047
|
+
const record = threadSessionRegistry.list().find((entry) => entry.kandanThreadId === kandanThreadId);
|
|
27048
|
+
if (record === void 0) {
|
|
27049
|
+
return;
|
|
27050
|
+
}
|
|
27051
|
+
const queue = durableInboundQueueFor(record.channel, kandanThreadId);
|
|
27052
|
+
if (queue.entries().length === 0) {
|
|
27053
|
+
return;
|
|
27054
|
+
}
|
|
27055
|
+
log2("runner.inbound_drain_after_spawn", {
|
|
27056
|
+
kandanThreadId,
|
|
27057
|
+
channel: record.channel,
|
|
27058
|
+
pending: queue.entries().length
|
|
27059
|
+
});
|
|
27060
|
+
await drainOwnedThreadQueue(
|
|
27061
|
+
record,
|
|
27062
|
+
latestResumeReconcileByThread.get(kandanThreadId) ?? []
|
|
27063
|
+
).catch((error) => {
|
|
27064
|
+
log2("runner.inbound_drain_after_spawn_failed", {
|
|
27065
|
+
kandanThreadId,
|
|
27066
|
+
message: error instanceof Error ? error.message : String(error)
|
|
27067
|
+
});
|
|
27068
|
+
});
|
|
27069
|
+
};
|
|
27070
|
+
const startThreadRunnerProcessFromServerControl = async (control, cwd) => {
|
|
27071
|
+
const response = await startThreadRunnerProcess(control, cwd);
|
|
27072
|
+
const kandanThreadId = optionalThreadControlField(control, "threadId");
|
|
27073
|
+
if (kandanThreadId !== void 0) {
|
|
27074
|
+
await drainThreadQueueAfterSpawn(kandanThreadId, response);
|
|
27075
|
+
}
|
|
27076
|
+
return response;
|
|
27077
|
+
};
|
|
26974
27078
|
const consumeResumeReconcile = (reconcileValue) => {
|
|
26975
27079
|
const byThread = /* @__PURE__ */ new Map();
|
|
26976
27080
|
const entries = parseResumeReconcileEntries(reconcileValue);
|
|
26977
27081
|
for (const entry of entries) {
|
|
26978
27082
|
if (entry.leaseEpoch !== void 0) {
|
|
26979
|
-
const adopted = leaseEpochRegistry.adopt(
|
|
27083
|
+
const adopted = leaseEpochRegistry.adopt(
|
|
27084
|
+
entry.threadId,
|
|
27085
|
+
entry.leaseEpoch
|
|
27086
|
+
);
|
|
26980
27087
|
if (adopted) {
|
|
26981
27088
|
log2("runner.resume_reconcile_lease_adopted", {
|
|
26982
27089
|
kandanThreadId: entry.threadId,
|
|
@@ -27228,6 +27335,29 @@ async function openLocalCodexRunner(options, log2, cleanup, close, runnerDrainHo
|
|
|
27228
27335
|
});
|
|
27229
27336
|
}
|
|
27230
27337
|
};
|
|
27338
|
+
const publishUnroutedDurableEnqueueState = async (channel, event) => {
|
|
27339
|
+
if (event.threadId === void 0) {
|
|
27340
|
+
return;
|
|
27341
|
+
}
|
|
27342
|
+
const payload = {
|
|
27343
|
+
workspace: inboundQueueWorkspace(),
|
|
27344
|
+
channel,
|
|
27345
|
+
thread_id: event.threadId,
|
|
27346
|
+
instance_id: instanceId,
|
|
27347
|
+
seq: event.seq,
|
|
27348
|
+
status: "queued",
|
|
27349
|
+
reason: "queued for durable resume"
|
|
27350
|
+
};
|
|
27351
|
+
try {
|
|
27352
|
+
await kandan.push(topic, "message_state", payload);
|
|
27353
|
+
} catch (error) {
|
|
27354
|
+
log2("runner.spawn_on_miss_state_push_failed", {
|
|
27355
|
+
thread_id: event.threadId,
|
|
27356
|
+
status: "queued",
|
|
27357
|
+
message: error instanceof Error ? error.message : String(error)
|
|
27358
|
+
});
|
|
27359
|
+
}
|
|
27360
|
+
};
|
|
27231
27361
|
const deadLetterPublisherFor = (record) => {
|
|
27232
27362
|
return async ({ sourceSeq, reason, attempts, alreadyPublished }) => {
|
|
27233
27363
|
log2("runner.inbound_dead_lettered", {
|
|
@@ -27738,7 +27868,7 @@ async function openLocalCodexRunner(options, log2, cleanup, close, runnerDrainHo
|
|
|
27738
27868
|
control,
|
|
27739
27869
|
log2,
|
|
27740
27870
|
attachThreadSession,
|
|
27741
|
-
shouldUseThreadProcesses(options) ?
|
|
27871
|
+
shouldUseThreadProcesses(options) ? startThreadRunnerProcessFromServerControl : void 0,
|
|
27742
27872
|
(id) => leaseEpochRegistry.current(id),
|
|
27743
27873
|
commitLiveWorkerAcceptedSourceSeq,
|
|
27744
27874
|
captureLiveFollowUpEvent,
|
|
@@ -27816,10 +27946,7 @@ function appliedSourceSeqStorePath(runnerId) {
|
|
|
27816
27946
|
const sanitized = runnerId.replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^[-.]+|[-.]+$/g, "").slice(0, 80);
|
|
27817
27947
|
const digest = createHash7("sha256").update(runnerId).digest("hex").slice(0, 8);
|
|
27818
27948
|
const stem = sanitized === "" ? "runner" : sanitized;
|
|
27819
|
-
return join22(
|
|
27820
|
-
controlCursorsDir(),
|
|
27821
|
-
`${stem}.${digest}.source-seq.json`
|
|
27822
|
-
);
|
|
27949
|
+
return join22(controlCursorsDir(), `${stem}.${digest}.source-seq.json`);
|
|
27823
27950
|
}
|
|
27824
27951
|
function startTurnWatermarkKey(topic, threadId) {
|
|
27825
27952
|
return `${topic} ${threadId}`;
|
|
@@ -31326,7 +31453,8 @@ ${developerPrompt}`,
|
|
|
31326
31453
|
metadata: {
|
|
31327
31454
|
local_codex_runner: {
|
|
31328
31455
|
event_type: "codex_start_instructions",
|
|
31329
|
-
codex_thread_id: codexThreadId
|
|
31456
|
+
codex_thread_id: codexThreadId,
|
|
31457
|
+
instructions_body: developerPrompt
|
|
31330
31458
|
}
|
|
31331
31459
|
}
|
|
31332
31460
|
},
|
|
@@ -33405,6 +33533,26 @@ function projectPathExists(projectPath) {
|
|
|
33405
33533
|
throw error;
|
|
33406
33534
|
}
|
|
33407
33535
|
}
|
|
33536
|
+
function resolveSuggestTasksModelProvider(control) {
|
|
33537
|
+
if (stringValue(control.modelProvider)?.trim() !== "wafer") {
|
|
33538
|
+
return void 0;
|
|
33539
|
+
}
|
|
33540
|
+
const llmProxy = objectValue(control.llmProxy);
|
|
33541
|
+
const baseUrl = stringValue(llmProxy?.baseUrl)?.trim();
|
|
33542
|
+
const token = stringValue(llmProxy?.token)?.trim();
|
|
33543
|
+
if (baseUrl === void 0 || baseUrl === "" || token === void 0 || token === "") {
|
|
33544
|
+
return void 0;
|
|
33545
|
+
}
|
|
33546
|
+
const runtime = {
|
|
33547
|
+
provider: "wafer",
|
|
33548
|
+
llmProxyBaseUrl: baseUrl,
|
|
33549
|
+
llmProxyToken: token
|
|
33550
|
+
};
|
|
33551
|
+
return {
|
|
33552
|
+
config: linzumiCodexModelProviderConfig(runtime),
|
|
33553
|
+
env: codexModelProviderAppServerEnv(runtime)
|
|
33554
|
+
};
|
|
33555
|
+
}
|
|
33408
33556
|
async function suggestRunnerTasks(control, options, allowedCwds) {
|
|
33409
33557
|
const requestId = stringValue(control.requestId) ?? null;
|
|
33410
33558
|
const cwd = resolveAllowedCwd(control.cwd, allowedCwds);
|
|
@@ -33417,10 +33565,14 @@ async function suggestRunnerTasks(control, options, allowedCwds) {
|
|
|
33417
33565
|
error: cwd.reason
|
|
33418
33566
|
};
|
|
33419
33567
|
}
|
|
33568
|
+
const modelProvider = resolveSuggestTasksModelProvider(control);
|
|
33569
|
+
const model = stringValue(control.model)?.trim();
|
|
33420
33570
|
try {
|
|
33421
33571
|
const tasks = await suggestSignupTasksWithCodex({
|
|
33422
33572
|
projectPath: cwd.cwd,
|
|
33423
|
-
codexBin: options.codexBin
|
|
33573
|
+
codexBin: options.codexBin,
|
|
33574
|
+
...model === void 0 || model === "" ? {} : { model },
|
|
33575
|
+
...modelProvider === void 0 ? {} : { modelProvider }
|
|
33424
33576
|
});
|
|
33425
33577
|
return {
|
|
33426
33578
|
instanceId: options.runnerId,
|
|
@@ -70921,22 +71073,49 @@ async function resolveMcpAuth(args) {
|
|
|
70921
71073
|
mode: "personal-agent-delegation"
|
|
70922
71074
|
};
|
|
70923
71075
|
}
|
|
70924
|
-
const
|
|
71076
|
+
const accessToken = await resolveMcpLocalRunnerToken({
|
|
71077
|
+
kandanUrl: args.kandanUrl,
|
|
71078
|
+
explicitToken: args.explicitToken,
|
|
71079
|
+
authFilePath: args.authFilePath,
|
|
71080
|
+
workspaceSlug: args.workspaceSlug,
|
|
71081
|
+
channelSlug: args.channelSlug
|
|
71082
|
+
});
|
|
71083
|
+
return { accessToken, mode: "local-runner" };
|
|
71084
|
+
}
|
|
71085
|
+
async function resolveMcpLocalRunnerToken(args, deps = {
|
|
71086
|
+
readCachedToken: readCachedLocalRunnerToken,
|
|
71087
|
+
validateTokenOutcome: validateLocalRunnerTokenOutcome,
|
|
71088
|
+
resolveToken: resolveLocalRunnerToken
|
|
71089
|
+
}) {
|
|
71090
|
+
const token = args.explicitToken ?? deps.readCachedToken(args.kandanUrl, args.authFilePath)?.accessToken;
|
|
70925
71091
|
if (token === void 0) {
|
|
70926
71092
|
throw new Error(
|
|
70927
71093
|
"missing Linzumi MCP token; run linzumi auth or pass --token"
|
|
70928
71094
|
);
|
|
70929
71095
|
}
|
|
70930
|
-
const
|
|
71096
|
+
const outcome = await deps.validateTokenOutcome({
|
|
70931
71097
|
kandanUrl: args.kandanUrl,
|
|
70932
71098
|
accessToken: token,
|
|
70933
71099
|
workspaceSlug: args.workspaceSlug,
|
|
70934
71100
|
channelSlug: args.channelSlug
|
|
70935
71101
|
});
|
|
70936
|
-
if (
|
|
70937
|
-
|
|
71102
|
+
if (outcome === "usable") {
|
|
71103
|
+
return token;
|
|
71104
|
+
}
|
|
71105
|
+
const _recoverable = outcome;
|
|
71106
|
+
void _recoverable;
|
|
71107
|
+
try {
|
|
71108
|
+
return await deps.resolveToken({
|
|
71109
|
+
kandanUrl: args.kandanUrl,
|
|
71110
|
+
workspaceSlug: args.workspaceSlug,
|
|
71111
|
+
channelSlug: args.channelSlug,
|
|
71112
|
+
authFilePath: args.authFilePath
|
|
71113
|
+
});
|
|
71114
|
+
} catch (error) {
|
|
71115
|
+
throw new Error(
|
|
71116
|
+
`Linzumi MCP token was rejected by the server and re-mint failed: ${error instanceof Error ? error.message : String(error)}`
|
|
71117
|
+
);
|
|
70938
71118
|
}
|
|
70939
|
-
return { accessToken: token, mode: "local-runner" };
|
|
70940
71119
|
}
|
|
70941
71120
|
function mcpJsonResult(value) {
|
|
70942
71121
|
return {
|
package/package.json
CHANGED