orion-super-agent-dev 0.1.24 → 0.1.26
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/out/brains/darwin-arm64/orion-brain +0 -0
- package/out/brains/darwin-x64/orion-brain +0 -0
- package/out/brains/linux-arm64/orion-brain +0 -0
- package/out/brains/linux-x64/orion-brain +0 -0
- package/out/brains/win32-x64/orion-brain.exe +0 -0
- package/out/main.js +951 -502
- package/package.json +1 -1
package/out/main.js
CHANGED
|
@@ -2230,7 +2230,7 @@ var require_react_jsx_runtime_development = __commonJS({
|
|
|
2230
2230
|
if (process.env.NODE_ENV !== "production") {
|
|
2231
2231
|
(function() {
|
|
2232
2232
|
"use strict";
|
|
2233
|
-
var
|
|
2233
|
+
var React33 = require_react();
|
|
2234
2234
|
var REACT_ELEMENT_TYPE = Symbol.for("react.element");
|
|
2235
2235
|
var REACT_PORTAL_TYPE = Symbol.for("react.portal");
|
|
2236
2236
|
var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
|
|
@@ -2256,7 +2256,7 @@ var require_react_jsx_runtime_development = __commonJS({
|
|
|
2256
2256
|
}
|
|
2257
2257
|
return null;
|
|
2258
2258
|
}
|
|
2259
|
-
var ReactSharedInternals =
|
|
2259
|
+
var ReactSharedInternals = React33.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
2260
2260
|
function error(format2) {
|
|
2261
2261
|
{
|
|
2262
2262
|
{
|
|
@@ -9963,9 +9963,9 @@ var require_react_reconciler_development = __commonJS({
|
|
|
9963
9963
|
module2.exports = function $$$reconciler($$$hostConfig) {
|
|
9964
9964
|
var exports3 = {};
|
|
9965
9965
|
"use strict";
|
|
9966
|
-
var
|
|
9966
|
+
var React33 = require_react();
|
|
9967
9967
|
var Scheduler = require_scheduler();
|
|
9968
|
-
var ReactSharedInternals =
|
|
9968
|
+
var ReactSharedInternals = React33.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
9969
9969
|
var suppressWarning = false;
|
|
9970
9970
|
function setSuppressWarning(newSuppressWarning) {
|
|
9971
9971
|
{
|
|
@@ -25969,9 +25969,9 @@ var require_semver = __commonJS({
|
|
|
25969
25969
|
} else {
|
|
25970
25970
|
this.prerelease = m2[4].split(".").map(function(id) {
|
|
25971
25971
|
if (/^[0-9]+$/.test(id)) {
|
|
25972
|
-
var
|
|
25973
|
-
if (
|
|
25974
|
-
return
|
|
25972
|
+
var num2 = +id;
|
|
25973
|
+
if (num2 >= 0 && num2 < MAX_SAFE_INTEGER) {
|
|
25974
|
+
return num2;
|
|
25975
25975
|
}
|
|
25976
25976
|
}
|
|
25977
25977
|
return id;
|
|
@@ -29222,14 +29222,12 @@ var require_duetEntry = __commonJS({
|
|
|
29222
29222
|
{
|
|
29223
29223
|
value: "executor",
|
|
29224
29224
|
label: "Executor decides",
|
|
29225
|
-
description: "Your
|
|
29225
|
+
description: "Your executor routes. No planner call, no download."
|
|
29226
29226
|
}
|
|
29227
29227
|
];
|
|
29228
|
-
function effectiveDuetEntry(setting, routerState
|
|
29228
|
+
function effectiveDuetEntry(setting, routerState) {
|
|
29229
29229
|
if (setting === "router" && routerState !== "ready")
|
|
29230
29230
|
return { entry: "planner", downgraded: true };
|
|
29231
|
-
if (setting === "executor" && executorState !== "ready")
|
|
29232
|
-
return { entry: "planner", downgraded: true };
|
|
29233
29231
|
return { entry: setting, downgraded: false };
|
|
29234
29232
|
}
|
|
29235
29233
|
function duetEntryLabel2(entry) {
|
|
@@ -29368,20 +29366,18 @@ var require_duetExecutorGateStatus = __commonJS({
|
|
|
29368
29366
|
"use strict";
|
|
29369
29367
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
29370
29368
|
exports2.executorGateStatusLine = executorGateStatusLine2;
|
|
29371
|
-
exports2.
|
|
29369
|
+
exports2.executorGateFallbackNote = executorGateFallbackNote;
|
|
29372
29370
|
exports2.executorGateOptionAvailability = executorGateOptionAvailability;
|
|
29373
29371
|
function unavailableWhy(reason, problem) {
|
|
29374
29372
|
switch (reason) {
|
|
29375
29373
|
case "not_resolved":
|
|
29376
29374
|
return "its endpoint is not configured";
|
|
29377
|
-
case "not_loopback":
|
|
29378
|
-
return "it is not on this machine";
|
|
29379
29375
|
case "unreachable":
|
|
29380
29376
|
return "it is not answering";
|
|
29381
29377
|
case "no_completions":
|
|
29382
29378
|
return "it has no /v1/completions route";
|
|
29383
29379
|
case "thinking":
|
|
29384
|
-
return "
|
|
29380
|
+
return "its completions route answers thinking text, not a plain token";
|
|
29385
29381
|
case "unparseable":
|
|
29386
29382
|
return "it did not answer E or P";
|
|
29387
29383
|
case "error":
|
|
@@ -29395,30 +29391,30 @@ var require_duetExecutorGateStatus = __commonJS({
|
|
|
29395
29391
|
case "miscalibrated":
|
|
29396
29392
|
return `Executor gate: ${status.target.model} on '${status.target.name}' misrouted ${status.calibration.failed.length} of ${status.calibration.total} probe scenarios (${status.mode}, threshold ${status.threshold}) \u2014 tune executorGate.threshold on that endpoint.`;
|
|
29397
29393
|
case "platform":
|
|
29398
|
-
return "Executor gate:
|
|
29394
|
+
return "Executor gate: the Duet executor is a platform model \u2014 this entry routes on Duet's rules.";
|
|
29399
29395
|
case "unavailable":
|
|
29400
|
-
return `Executor gate: not
|
|
29396
|
+
return `Executor gate: not asking \u2014 ${unavailableWhy(status.reason, status.problem)}.`;
|
|
29401
29397
|
}
|
|
29402
29398
|
}
|
|
29403
|
-
function
|
|
29399
|
+
function executorGateFallbackNote(status) {
|
|
29404
29400
|
const why = status.state === "platform" ? "the Duet executor is a platform model" : status.state === "unavailable" ? unavailableWhy(status.reason, status.problem) : "it could not run";
|
|
29405
|
-
return `Executor decides
|
|
29401
|
+
return `Executor decides could not ask your executor (${why}) \u2014 this turn routed on Duet's rules instead.`;
|
|
29406
29402
|
}
|
|
29407
29403
|
function executorGateOptionAvailability(status) {
|
|
29408
29404
|
if (status === null || status.state === "ready")
|
|
29409
29405
|
return { disabled: false, note: null };
|
|
29410
29406
|
switch (status.state) {
|
|
29411
29407
|
case "platform":
|
|
29412
|
-
return { disabled:
|
|
29408
|
+
return { disabled: false, note: "The executor is a platform model \u2014 routes on Duet's rules." };
|
|
29413
29409
|
case "miscalibrated":
|
|
29414
29410
|
return {
|
|
29415
|
-
disabled:
|
|
29416
|
-
note: `The
|
|
29411
|
+
disabled: false,
|
|
29412
|
+
note: `The gate misrouted ${status.calibration.failed.length} of ${status.calibration.total} probe scenarios \u2014 tune executorGate.threshold on that endpoint.`
|
|
29417
29413
|
};
|
|
29418
29414
|
case "unavailable":
|
|
29419
29415
|
return {
|
|
29420
|
-
disabled:
|
|
29421
|
-
note: `
|
|
29416
|
+
disabled: false,
|
|
29417
|
+
note: `The executor cannot be asked right now (${unavailableWhy(status.reason, status.problem)}) \u2014 routes on Duet's rules.`
|
|
29422
29418
|
};
|
|
29423
29419
|
}
|
|
29424
29420
|
}
|
|
@@ -29604,11 +29600,11 @@ var require_duetRouterModel = __commonJS({
|
|
|
29604
29600
|
const dim = r2.dim;
|
|
29605
29601
|
if (typeof dim !== "number" || !Number.isInteger(dim) || dim <= 0)
|
|
29606
29602
|
return null;
|
|
29607
|
-
const
|
|
29608
|
-
const temperature =
|
|
29609
|
-
const threshold =
|
|
29610
|
-
const headChars =
|
|
29611
|
-
const maxTokens =
|
|
29603
|
+
const num2 = (v2) => typeof v2 === "number" && Number.isFinite(v2) ? v2 : null;
|
|
29604
|
+
const temperature = num2(r2.temperature);
|
|
29605
|
+
const threshold = num2(r2.threshold);
|
|
29606
|
+
const headChars = num2(r2.head_chars);
|
|
29607
|
+
const maxTokens = num2(r2.max_tokens);
|
|
29612
29608
|
if (temperature === null || temperature <= 0)
|
|
29613
29609
|
return null;
|
|
29614
29610
|
if (threshold === null || threshold < 0 || threshold > 1)
|
|
@@ -29635,10 +29631,10 @@ var require_duetRouterModel = __commonJS({
|
|
|
29635
29631
|
if (weight.length === 0 || bias.length !== weight.length)
|
|
29636
29632
|
return null;
|
|
29637
29633
|
for (const row of weight) {
|
|
29638
|
-
if (!Array.isArray(row) || row.length !== dim || row.some((x2) =>
|
|
29634
|
+
if (!Array.isArray(row) || row.length !== dim || row.some((x2) => num2(x2) === null))
|
|
29639
29635
|
return null;
|
|
29640
29636
|
}
|
|
29641
|
-
if (bias.some((x2) =>
|
|
29637
|
+
if (bias.some((x2) => num2(x2) === null))
|
|
29642
29638
|
return null;
|
|
29643
29639
|
return { weight, bias };
|
|
29644
29640
|
};
|
|
@@ -29899,9 +29895,9 @@ var require_duetRouterModel = __commonJS({
|
|
|
29899
29895
|
if (setting === "executor") {
|
|
29900
29896
|
if (opts.executorGate !== void 0)
|
|
29901
29897
|
return opts.executorGate.prepareTurn(text, ctx);
|
|
29902
|
-
const note = executorNoted ? null : (0, duetExecutorGateStatus_js_1.
|
|
29898
|
+
const note = executorNoted ? null : (0, duetExecutorGateStatus_js_1.executorGateFallbackNote)({ state: "unavailable", reason: "error", problem: "this host has no executor gate" });
|
|
29903
29899
|
executorNoted = true;
|
|
29904
|
-
return {
|
|
29900
|
+
return { entry: "executor", verdict: null, note };
|
|
29905
29901
|
}
|
|
29906
29902
|
if (setting !== "router")
|
|
29907
29903
|
return { entry: setting, verdict: null, note: null };
|
|
@@ -33479,6 +33475,8 @@ var require_segmentDriver = __commonJS({
|
|
|
33479
33475
|
body2.workspace_root = routing.workspaceRoot;
|
|
33480
33476
|
if (routing.clientType !== void 0)
|
|
33481
33477
|
body2.client_type = routing.clientType;
|
|
33478
|
+
if (routing.clientVersion !== void 0)
|
|
33479
|
+
body2.client_version = routing.clientVersion;
|
|
33482
33480
|
if (routing.mode !== void 0)
|
|
33483
33481
|
body2.mode = routing.mode;
|
|
33484
33482
|
if (routing.reasoning !== void 0)
|
|
@@ -34772,7 +34770,10 @@ var require_frames = __commonJS({
|
|
|
34772
34770
|
if (typeof frame.id !== "string") {
|
|
34773
34771
|
throw new FrameDecodeError("malformed renew_bearer frame");
|
|
34774
34772
|
}
|
|
34775
|
-
|
|
34773
|
+
const decoded = { type: "renew_bearer", id: frame.id };
|
|
34774
|
+
if (typeof frame.refused === "string")
|
|
34775
|
+
decoded.refused = frame.refused;
|
|
34776
|
+
return decoded;
|
|
34776
34777
|
}
|
|
34777
34778
|
case "rpc_result": {
|
|
34778
34779
|
if (typeof frame.id !== "string" || !("result" in frame)) {
|
|
@@ -37267,7 +37268,6 @@ var require_duetExecutorGate = __commonJS({
|
|
|
37267
37268
|
var duetMode_js_1 = require_duetMode();
|
|
37268
37269
|
var duetPlan_js_1 = require_duetPlan();
|
|
37269
37270
|
var duetRoutingAdvisor_js_1 = require_duetRoutingAdvisor();
|
|
37270
|
-
var duetEntry_js_1 = require_duetEntry();
|
|
37271
37271
|
var duetExecutorGateStatus_js_1 = require_duetExecutorGateStatus();
|
|
37272
37272
|
exports2.EXECUTOR_GATE_SOURCE = "executor_gate";
|
|
37273
37273
|
exports2.EXECUTOR_GATE_PROMPT_VERSION = "1";
|
|
@@ -37292,9 +37292,6 @@ var require_duetExecutorGate = __commonJS({
|
|
|
37292
37292
|
if (routing === void 0) {
|
|
37293
37293
|
return { state: "unavailable", reason: "not_resolved", problem: "the executor's endpoint is not configured", name: name2 };
|
|
37294
37294
|
}
|
|
37295
|
-
if (!(0, customProviders_js_1.isLoopbackEndpoint)(routing.baseUrl)) {
|
|
37296
|
-
return { state: "unavailable", reason: "not_loopback", problem: "the executor is not on this machine", name: name2 };
|
|
37297
|
-
}
|
|
37298
37295
|
if (!deps2.alive(workspaceRoot)) {
|
|
37299
37296
|
return { state: "unavailable", reason: "unreachable", problem: "the executor is not answering", name: name2 };
|
|
37300
37297
|
}
|
|
@@ -37323,9 +37320,6 @@ var require_duetExecutorGate = __commonJS({
|
|
|
37323
37320
|
if (entry === null) {
|
|
37324
37321
|
return { state: "unavailable", reason: "not_resolved", problem: "the executor's endpoint is not configured", name: name2 };
|
|
37325
37322
|
}
|
|
37326
|
-
if (!(0, customProviders_js_1.isLoopbackEndpoint)(entry.baseUrl)) {
|
|
37327
|
-
return { state: "unavailable", reason: "not_loopback", problem: "the executor is not on this machine", name: name2 };
|
|
37328
|
-
}
|
|
37329
37323
|
const apiKey = await (0, customProviders_js_1.resolveApiKey)(entry);
|
|
37330
37324
|
if (!await (0, customProviders_js_1.endpointIsReachable)(entry.baseUrl, apiKey, opts.fetchImpl)) {
|
|
37331
37325
|
return { state: "unavailable", reason: "unreachable", problem: "the executor is not answering", name: name2 };
|
|
@@ -37629,10 +37623,10 @@ var require_duetExecutorGate = __commonJS({
|
|
|
37629
37623
|
const ttl = opts.statusTtlMs ?? exports2.EXECUTOR_GATE_STATUS_TTL_MS;
|
|
37630
37624
|
let cached = null;
|
|
37631
37625
|
let noted = false;
|
|
37632
|
-
const
|
|
37633
|
-
const note = noted ? null : (0, duetExecutorGateStatus_js_1.
|
|
37626
|
+
const fallback = (why) => {
|
|
37627
|
+
const note = noted ? null : (0, duetExecutorGateStatus_js_1.executorGateFallbackNote)(why);
|
|
37634
37628
|
noted = true;
|
|
37635
|
-
return {
|
|
37629
|
+
return { entry: "executor", verdict: null, note };
|
|
37636
37630
|
};
|
|
37637
37631
|
return {
|
|
37638
37632
|
async status(o = {}) {
|
|
@@ -37656,20 +37650,20 @@ var require_duetExecutorGate = __commonJS({
|
|
|
37656
37650
|
const resolved = resolveExecutorGateTarget(ctx.workspaceRoot, opts.resolveDeps);
|
|
37657
37651
|
if (resolved.state !== "ready") {
|
|
37658
37652
|
opts.onError?.("resolve", resolved.state === "platform" ? "platform executor" : resolved.problem);
|
|
37659
|
-
return
|
|
37653
|
+
return fallback(resolved);
|
|
37660
37654
|
}
|
|
37661
37655
|
const { target } = resolved;
|
|
37662
37656
|
const prompt = renderExecutorGatePrompt(executorGateStateFrom(ctx.record, text));
|
|
37663
37657
|
const asked = await askExecutorGate(target, prompt, { fetchImpl: opts.fetchImpl, timeoutMs: opts.timeoutMs });
|
|
37664
37658
|
if (!asked.ok) {
|
|
37665
37659
|
opts.onError?.("ask", asked.problem);
|
|
37666
|
-
return
|
|
37660
|
+
return fallback({ state: "unavailable", reason: asked.reason, problem: asked.problem });
|
|
37667
37661
|
}
|
|
37668
37662
|
const decision = decideExecutorGate(asked.answer, target.threshold);
|
|
37669
37663
|
if (decision === null) {
|
|
37670
37664
|
const said = asked.answer.raw.trim();
|
|
37671
37665
|
opts.onError?.("ask", `undecidable answer "${said}"`);
|
|
37672
|
-
return
|
|
37666
|
+
return fallback({ state: "unavailable", reason: "unparseable", problem: `the executor answered "${said}"` });
|
|
37673
37667
|
}
|
|
37674
37668
|
noted = false;
|
|
37675
37669
|
const verdict = {
|
|
@@ -39005,6 +38999,58 @@ var require_agentStore = __commonJS({
|
|
|
39005
38999
|
}
|
|
39006
39000
|
});
|
|
39007
39001
|
|
|
39002
|
+
// ../packages/orion-client-core/dist/goalClaim.js
|
|
39003
|
+
var require_goalClaim = __commonJS({
|
|
39004
|
+
"../packages/orion-client-core/dist/goalClaim.js"(exports2) {
|
|
39005
|
+
"use strict";
|
|
39006
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
39007
|
+
exports2.GOAL_REPORT_TOOL = exports2.GOAL_CAPABILITY = void 0;
|
|
39008
|
+
exports2.readGoalReportInput = readGoalReportInput;
|
|
39009
|
+
exports2.goalClaimFromWire = goalClaimFromWire3;
|
|
39010
|
+
exports2.goalReportToolResult = goalReportToolResult3;
|
|
39011
|
+
exports2.GOAL_CAPABILITY = "goal";
|
|
39012
|
+
exports2.GOAL_REPORT_TOOL = "goal_report";
|
|
39013
|
+
function readGoalReportInput(input) {
|
|
39014
|
+
if (!input || typeof input !== "object")
|
|
39015
|
+
return null;
|
|
39016
|
+
const r2 = input;
|
|
39017
|
+
if (typeof r2.done !== "boolean")
|
|
39018
|
+
return null;
|
|
39019
|
+
const note = r2.done ? r2.verified : r2.outstanding;
|
|
39020
|
+
return { done: r2.done, note: typeof note === "string" ? note.trim() : "" };
|
|
39021
|
+
}
|
|
39022
|
+
function goalClaimFromWire3(messages) {
|
|
39023
|
+
if (!Array.isArray(messages))
|
|
39024
|
+
return null;
|
|
39025
|
+
let claim = null;
|
|
39026
|
+
for (const message of messages) {
|
|
39027
|
+
const m2 = message;
|
|
39028
|
+
if (!m2 || m2.role !== "assistant" || !Array.isArray(m2.content))
|
|
39029
|
+
continue;
|
|
39030
|
+
for (const block of m2.content) {
|
|
39031
|
+
const b2 = block;
|
|
39032
|
+
if (!b2 || b2.type !== "tool_use" || b2.name !== exports2.GOAL_REPORT_TOOL)
|
|
39033
|
+
continue;
|
|
39034
|
+
const parsed = readGoalReportInput(b2.input);
|
|
39035
|
+
if (parsed !== null)
|
|
39036
|
+
claim = parsed;
|
|
39037
|
+
}
|
|
39038
|
+
}
|
|
39039
|
+
return claim;
|
|
39040
|
+
}
|
|
39041
|
+
function goalReportToolResult3(params) {
|
|
39042
|
+
const claim = readGoalReportInput(params);
|
|
39043
|
+
if (claim === null) {
|
|
39044
|
+
return "goal_report needs `done` as a boolean: false while ANY part of the goal remains (say what in `outstanding`), true only when every part is verified complete (name what you ran in `verified`).";
|
|
39045
|
+
}
|
|
39046
|
+
if (claim.done) {
|
|
39047
|
+
return "Completion claim recorded. An independent check now reviews the evidence of what you actually did \u2014 the goal ends only if it confirms; otherwise you will be told what is still outstanding. End your turn now.";
|
|
39048
|
+
}
|
|
39049
|
+
return "Status recorded \u2014 the goal continues. If you can take the next step now, keep working; otherwise end your turn and you will be continued.";
|
|
39050
|
+
}
|
|
39051
|
+
}
|
|
39052
|
+
});
|
|
39053
|
+
|
|
39008
39054
|
// ../packages/orion-client-core/dist/goalMarker.js
|
|
39009
39055
|
var require_goalMarker = __commonJS({
|
|
39010
39056
|
"../packages/orion-client-core/dist/goalMarker.js"(exports2) {
|
|
@@ -39426,7 +39472,8 @@ var require_goalEvaluate = __commonJS({
|
|
|
39426
39472
|
const params = { goal: args2.goal, evidence };
|
|
39427
39473
|
if (args2.sessionId)
|
|
39428
39474
|
params.session_id = args2.sessionId;
|
|
39429
|
-
const
|
|
39475
|
+
const sessionFallback = args2.sessionModel && !args2.sessionProvider?.startsWith("custom") ? { model: args2.sessionModel, provider: args2.sessionProvider ?? "" } : void 0;
|
|
39476
|
+
const chosen = await configuredEvaluatorModel(args2) ?? sessionFallback;
|
|
39430
39477
|
if (chosen) {
|
|
39431
39478
|
params.model = chosen.model;
|
|
39432
39479
|
if (chosen.provider)
|
|
@@ -39443,15 +39490,18 @@ var require_goalRunner = __commonJS({
|
|
|
39443
39490
|
"../packages/orion-client-core/dist/goalRunner.js"(exports2) {
|
|
39444
39491
|
"use strict";
|
|
39445
39492
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
39446
|
-
exports2.GoalRunner = exports2.GOAL_CONTINUE_DISPLAY = exports2.GOAL_REASON_PROMPT_MAX_CHARS = exports2.GOAL_REASON_MAX_CHARS = exports2.GOAL_MAX_EVALUATOR_FAILURES = exports2.DEFAULT_GOAL_MAX_WALL_MS = exports2.DEFAULT_GOAL_MAX_TURNS = exports2.GOAL_INSTRUCTION = void 0;
|
|
39493
|
+
exports2.GoalRunner = exports2.GOAL_CONTINUE_DISPLAY = exports2.GOAL_REASON_PROMPT_MAX_CHARS = exports2.GOAL_REASON_MAX_CHARS = exports2.GOAL_UNCLAIMED_CHECK_INTERVAL = exports2.GOAL_MAX_EVALUATOR_FAILURES = exports2.DEFAULT_GOAL_MAX_WALL_MS = exports2.DEFAULT_GOAL_MAX_TURNS = exports2.GOAL_INSTRUCTION = void 0;
|
|
39447
39494
|
exports2.buildGoalPrompt = buildGoalPrompt;
|
|
39448
39495
|
exports2.buildContinuationPrompt = buildContinuationPrompt;
|
|
39449
39496
|
exports2.finalAssistantTextFromWire = finalAssistantTextFromWire2;
|
|
39450
39497
|
exports2.describeGoalEnd = describeGoalEnd;
|
|
39451
|
-
exports2.goalReasonLine =
|
|
39498
|
+
exports2.goalReasonLine = goalReasonLine3;
|
|
39452
39499
|
exports2.goalEndRow = goalEndRow2;
|
|
39453
39500
|
exports2.goalNotMetRow = goalNotMetRow2;
|
|
39454
39501
|
exports2.goalStartDisplay = goalStartDisplay2;
|
|
39502
|
+
exports2.goalFromStartDisplay = goalFromStartDisplay;
|
|
39503
|
+
exports2.goalSetRow = goalSetRow2;
|
|
39504
|
+
exports2.goalRoundReason = goalRoundReason2;
|
|
39455
39505
|
exports2.GOAL_INSTRUCTION = [
|
|
39456
39506
|
"",
|
|
39457
39507
|
"---",
|
|
@@ -39460,11 +39510,14 @@ var require_goalRunner = __commonJS({
|
|
|
39460
39510
|
"Do not end your turn with a plan, an intention, or a promise about work you have not done \u2014",
|
|
39461
39511
|
"if the next step is clear, take it now instead of describing it.",
|
|
39462
39512
|
"",
|
|
39463
|
-
"
|
|
39464
|
-
"
|
|
39465
|
-
|
|
39466
|
-
"
|
|
39467
|
-
"
|
|
39513
|
+
"End every turn by calling the goal_report tool \u2014 a status line in prose is not a report.",
|
|
39514
|
+
"While ANY part of the goal remains, report done: false and say in `outstanding` exactly what",
|
|
39515
|
+
'is missing. Be ruthlessly honest \u2014 an honest "not done" costs nothing and keeps you going.',
|
|
39516
|
+
"Report done: true only when you have VERIFIED every part \u2014 ran the tests, executed the",
|
|
39517
|
+
"command, saw the output \u2014 and name in `verified` what you ran and what it showed.",
|
|
39518
|
+
"Your report is a claim, not a verdict: an independent check reviews the evidence of what you",
|
|
39519
|
+
"actually did before the goal can end, and an unverified claim is simply sent back. Reading",
|
|
39520
|
+
"code is not verifying it; reporting a failure honestly is always better than glossing it."
|
|
39468
39521
|
].join("\n");
|
|
39469
39522
|
function buildGoalPrompt(goal) {
|
|
39470
39523
|
return `# Goal
|
|
@@ -39472,7 +39525,7 @@ ${goal}
|
|
|
39472
39525
|
${exports2.GOAL_INSTRUCTION}`;
|
|
39473
39526
|
}
|
|
39474
39527
|
function buildContinuationPrompt(goal, reason) {
|
|
39475
|
-
const line = reason ?
|
|
39528
|
+
const line = reason ? goalReasonLine3(reason, exports2.GOAL_REASON_PROMPT_MAX_CHARS) : "";
|
|
39476
39529
|
const outstanding = line === "" ? "" : `
|
|
39477
39530
|
|
|
39478
39531
|
## What the completion check reported
|
|
@@ -39505,6 +39558,7 @@ ${exports2.GOAL_INSTRUCTION}`;
|
|
|
39505
39558
|
exports2.DEFAULT_GOAL_MAX_TURNS = 0;
|
|
39506
39559
|
exports2.DEFAULT_GOAL_MAX_WALL_MS = 0;
|
|
39507
39560
|
exports2.GOAL_MAX_EVALUATOR_FAILURES = 3;
|
|
39561
|
+
exports2.GOAL_UNCLAIMED_CHECK_INTERVAL = 5;
|
|
39508
39562
|
function describeGoalEnd(reason) {
|
|
39509
39563
|
switch (reason) {
|
|
39510
39564
|
case "done":
|
|
@@ -39525,7 +39579,7 @@ ${exports2.GOAL_INSTRUCTION}`;
|
|
|
39525
39579
|
}
|
|
39526
39580
|
exports2.GOAL_REASON_MAX_CHARS = 140;
|
|
39527
39581
|
exports2.GOAL_REASON_PROMPT_MAX_CHARS = 500;
|
|
39528
|
-
function
|
|
39582
|
+
function goalReasonLine3(reason, max = exports2.GOAL_REASON_MAX_CHARS) {
|
|
39529
39583
|
const flat = reason.replace(/\s+/g, " ").trim();
|
|
39530
39584
|
if (flat.length <= max)
|
|
39531
39585
|
return flat;
|
|
@@ -39552,7 +39606,7 @@ ${exports2.GOAL_INSTRUCTION}`;
|
|
|
39552
39606
|
}
|
|
39553
39607
|
}
|
|
39554
39608
|
function goalNotMetRow2(reason) {
|
|
39555
|
-
const line =
|
|
39609
|
+
const line = goalReasonLine3(reason);
|
|
39556
39610
|
return {
|
|
39557
39611
|
glyph: "\u25CE",
|
|
39558
39612
|
text: line === "" ? "Not met yet" : `Not met yet \u2014 ${line}`,
|
|
@@ -39564,10 +39618,29 @@ ${exports2.GOAL_INSTRUCTION}`;
|
|
|
39564
39618
|
function goalStartDisplay2(goal) {
|
|
39565
39619
|
return `/goal ${goal}`;
|
|
39566
39620
|
}
|
|
39621
|
+
function goalFromStartDisplay(display) {
|
|
39622
|
+
return (display.startsWith("/goal ") ? display.slice("/goal ".length) : display).trim();
|
|
39623
|
+
}
|
|
39624
|
+
function goalSetRow2(goal) {
|
|
39625
|
+
const line = goal.replace(/\s+/g, " ").trim();
|
|
39626
|
+
return {
|
|
39627
|
+
glyph: "\u25CE",
|
|
39628
|
+
text: line === "" ? "Goal set" : `Goal set: ${line}`,
|
|
39629
|
+
done: false,
|
|
39630
|
+
progress: true
|
|
39631
|
+
};
|
|
39632
|
+
}
|
|
39633
|
+
function goalRoundReason2(round) {
|
|
39634
|
+
if (round.ruling)
|
|
39635
|
+
return round.ruling.evaluated ? round.ruling.reason : "";
|
|
39636
|
+
if (round.claim && !round.claim.done)
|
|
39637
|
+
return round.claim.note;
|
|
39638
|
+
return "";
|
|
39639
|
+
}
|
|
39567
39640
|
function readOutcome(outcome) {
|
|
39568
39641
|
if (typeof outcome === "string")
|
|
39569
|
-
return { text: outcome, evidence: outcome };
|
|
39570
|
-
return { text: outcome.text ?? "", evidence: outcome.evidence ?? "" };
|
|
39642
|
+
return { text: outcome, evidence: outcome, claim: null };
|
|
39643
|
+
return { text: outcome.text ?? "", evidence: outcome.evidence ?? "", claim: outcome.claim ?? null };
|
|
39571
39644
|
}
|
|
39572
39645
|
var GoalRunner3 = class {
|
|
39573
39646
|
deps;
|
|
@@ -39580,10 +39653,17 @@ ${exports2.GOAL_INSTRUCTION}`;
|
|
|
39580
39653
|
/** Wall-clock anchor for the envelope, from the injected clock. */
|
|
39581
39654
|
startedAt = 0;
|
|
39582
39655
|
/** Consecutive evaluator calls that produced no verdict. Any real ruling —
|
|
39583
|
-
* including "not yet" — resets it.
|
|
39656
|
+
* including "not yet" — resets it. Untouched on rounds that run no check:
|
|
39657
|
+
* they say nothing about the evaluator either way. */
|
|
39584
39658
|
evaluatorFailures = 0;
|
|
39585
39659
|
/** The evaluator's last account of what is outstanding. */
|
|
39586
39660
|
lastReason = "";
|
|
39661
|
+
/** Consecutive rounds settled without a check. At
|
|
39662
|
+
* [`GOAL_UNCLAIMED_CHECK_INTERVAL`] the backstop runs one; reset on every
|
|
39663
|
+
* check run, claimed or backstop. */
|
|
39664
|
+
uncheckedRounds = 0;
|
|
39665
|
+
/** The agent's own last `goal_report`. */
|
|
39666
|
+
lastClaim = null;
|
|
39587
39667
|
constructor(deps2) {
|
|
39588
39668
|
this.deps = deps2;
|
|
39589
39669
|
}
|
|
@@ -39593,7 +39673,8 @@ ${exports2.GOAL_INSTRUCTION}`;
|
|
|
39593
39673
|
goal: this.goal,
|
|
39594
39674
|
endReason: this.endReason,
|
|
39595
39675
|
turns: this.turns,
|
|
39596
|
-
lastReason: this.lastReason === "" ? null : this.lastReason
|
|
39676
|
+
lastReason: this.lastReason === "" ? null : this.lastReason,
|
|
39677
|
+
lastClaim: this.lastClaim
|
|
39597
39678
|
};
|
|
39598
39679
|
}
|
|
39599
39680
|
/** The user's stop (Esc, `/goal stop`, banner button). The in-flight turn is
|
|
@@ -39613,6 +39694,8 @@ ${exports2.GOAL_INSTRUCTION}`;
|
|
|
39613
39694
|
this.turns = 0;
|
|
39614
39695
|
this.evaluatorFailures = 0;
|
|
39615
39696
|
this.lastReason = "";
|
|
39697
|
+
this.uncheckedRounds = 0;
|
|
39698
|
+
this.lastClaim = null;
|
|
39616
39699
|
this.emit();
|
|
39617
39700
|
this.startedAt = (this.deps.now ?? Date.now)();
|
|
39618
39701
|
let prompt = buildGoalPrompt(goal);
|
|
@@ -39626,30 +39709,40 @@ ${exports2.GOAL_INSTRUCTION}`;
|
|
|
39626
39709
|
this.turns += 1;
|
|
39627
39710
|
if (this.stopRequested)
|
|
39628
39711
|
return this.finish("stopped");
|
|
39629
|
-
const { text, evidence } = readOutcome(outcome);
|
|
39630
|
-
|
|
39712
|
+
const { text, evidence, claim } = readOutcome(outcome);
|
|
39713
|
+
this.lastClaim = claim;
|
|
39714
|
+
this.uncheckedRounds += 1;
|
|
39715
|
+
const check2 = claim?.done === true ? "claimed" : this.uncheckedRounds >= exports2.GOAL_UNCLAIMED_CHECK_INTERVAL || this.envelopeVerdict(this.turns) !== null ? "backstop" : "none";
|
|
39716
|
+
let ruling = null;
|
|
39717
|
+
if (check2 !== "none") {
|
|
39718
|
+
this.uncheckedRounds = 0;
|
|
39719
|
+
ruling = await this.rule(goal, evidence, text);
|
|
39720
|
+
}
|
|
39631
39721
|
if (this.stopRequested)
|
|
39632
39722
|
return this.finish("stopped");
|
|
39633
|
-
if (ruling
|
|
39634
|
-
|
|
39635
|
-
|
|
39636
|
-
|
|
39637
|
-
|
|
39638
|
-
|
|
39639
|
-
|
|
39640
|
-
|
|
39641
|
-
|
|
39642
|
-
|
|
39643
|
-
|
|
39644
|
-
|
|
39645
|
-
|
|
39723
|
+
if (ruling) {
|
|
39724
|
+
if (ruling.evaluated && ruling.ok) {
|
|
39725
|
+
this.lastReason = ruling.reason;
|
|
39726
|
+
return this.finish("done");
|
|
39727
|
+
}
|
|
39728
|
+
if (ruling.evaluated && !ruling.achievable) {
|
|
39729
|
+
this.lastReason = ruling.reason;
|
|
39730
|
+
return this.finish("not_achievable");
|
|
39731
|
+
}
|
|
39732
|
+
if (ruling.evaluated) {
|
|
39733
|
+
this.evaluatorFailures = 0;
|
|
39734
|
+
this.lastReason = ruling.reason;
|
|
39735
|
+
} else if ((this.evaluatorFailures += 1) >= exports2.GOAL_MAX_EVALUATOR_FAILURES) {
|
|
39736
|
+
this.lastReason = ruling.reason;
|
|
39737
|
+
return this.finish("evaluator_failed");
|
|
39738
|
+
}
|
|
39646
39739
|
}
|
|
39647
39740
|
const ceiling = this.envelopeVerdict(this.turns);
|
|
39648
39741
|
if (ceiling !== null)
|
|
39649
39742
|
return this.finish(ceiling);
|
|
39650
|
-
this.
|
|
39743
|
+
this.deps.onRound?.({ turns: this.turns, check: check2, ruling, claim });
|
|
39651
39744
|
this.emit();
|
|
39652
|
-
prompt = buildContinuationPrompt(goal, ruling
|
|
39745
|
+
prompt = buildContinuationPrompt(goal, ruling?.evaluated ? ruling.reason : void 0);
|
|
39653
39746
|
}
|
|
39654
39747
|
}
|
|
39655
39748
|
/** One completion ruling, with the evaluator's own failures absorbed. A judge
|
|
@@ -39937,29 +40030,29 @@ var require_agentDefs = __commonJS({
|
|
|
39937
40030
|
return false;
|
|
39938
40031
|
}
|
|
39939
40032
|
function defFromMeta(meta, fallbackName, system) {
|
|
39940
|
-
const name2 =
|
|
40033
|
+
const name2 = str2(meta.name) || fallbackName;
|
|
39941
40034
|
if (!name2.trim())
|
|
39942
40035
|
return null;
|
|
39943
40036
|
return {
|
|
39944
40037
|
name: name2.trim(),
|
|
39945
|
-
description: collapse(
|
|
40038
|
+
description: collapse(str2(meta.description) || str2(meta.when_to_use) || ""),
|
|
39946
40039
|
system,
|
|
39947
40040
|
toolsAllow: list(meta.tools_allow ?? meta.tools),
|
|
39948
40041
|
toolsDeny: list(meta.tools_deny ?? meta.deny),
|
|
39949
|
-
model:
|
|
39950
|
-
permissionMode:
|
|
39951
|
-
maxIterations:
|
|
39952
|
-
effort:
|
|
40042
|
+
model: str2(meta.model_preference) || str2(meta.model) || void 0,
|
|
40043
|
+
permissionMode: str2(meta.permission_mode) || void 0,
|
|
40044
|
+
maxIterations: num2(meta.max_iterations),
|
|
40045
|
+
effort: str2(meta.thinking) || str2(meta.effort) || void 0,
|
|
39953
40046
|
background: bool(meta.background),
|
|
39954
40047
|
oneShot: bool(meta.one_shot),
|
|
39955
|
-
color:
|
|
39956
|
-
isolation:
|
|
40048
|
+
color: str2(meta.color) || void 0,
|
|
40049
|
+
isolation: str2(meta.isolation) || void 0
|
|
39957
40050
|
};
|
|
39958
40051
|
}
|
|
39959
|
-
function
|
|
40052
|
+
function str2(v2) {
|
|
39960
40053
|
return typeof v2 === "string" ? v2 : typeof v2 === "number" || typeof v2 === "boolean" ? String(v2) : "";
|
|
39961
40054
|
}
|
|
39962
|
-
function
|
|
40055
|
+
function num2(v2) {
|
|
39963
40056
|
if (typeof v2 === "number" && Number.isFinite(v2))
|
|
39964
40057
|
return Math.trunc(v2);
|
|
39965
40058
|
if (typeof v2 === "string" && /^\d+$/.test(v2.trim()))
|
|
@@ -39975,7 +40068,7 @@ var require_agentDefs = __commonJS({
|
|
|
39975
40068
|
}
|
|
39976
40069
|
function list(v2) {
|
|
39977
40070
|
if (Array.isArray(v2)) {
|
|
39978
|
-
const items = v2.map(
|
|
40071
|
+
const items = v2.map(str2).map((s) => s.trim()).filter(Boolean);
|
|
39979
40072
|
return items.length > 0 ? items : void 0;
|
|
39980
40073
|
}
|
|
39981
40074
|
if (typeof v2 === "string") {
|
|
@@ -40372,7 +40465,7 @@ var require_agentManager = __commonJS({
|
|
|
40372
40465
|
if (isolation === "worktree") {
|
|
40373
40466
|
worktree = await this.createWorktree(parentSessionId, agentId);
|
|
40374
40467
|
}
|
|
40375
|
-
const model =
|
|
40468
|
+
const model = str2(params.model) || resolveModelPreference(def.model, routing.model) || routing.model;
|
|
40376
40469
|
const readOnly = routing.mode === "plan" || routing.mode === "ask" || routing.mode === "duet";
|
|
40377
40470
|
const sessionId = await this.transport.startSession({
|
|
40378
40471
|
provider: routing.provider,
|
|
@@ -40387,8 +40480,8 @@ var require_agentManager = __commonJS({
|
|
|
40387
40480
|
sessionId,
|
|
40388
40481
|
type,
|
|
40389
40482
|
brief,
|
|
40390
|
-
name:
|
|
40391
|
-
team:
|
|
40483
|
+
name: str2(params.name) || void 0,
|
|
40484
|
+
team: str2(params.team) || void 0,
|
|
40392
40485
|
status: "running",
|
|
40393
40486
|
outputTokens: 0,
|
|
40394
40487
|
inputTokens: 0,
|
|
@@ -40451,9 +40544,9 @@ var require_agentManager = __commonJS({
|
|
|
40451
40544
|
* report to disk); a running child answers with a status line, plus its
|
|
40452
40545
|
* output-so-far under `detail: true`. */
|
|
40453
40546
|
async check(parentSessionId, params) {
|
|
40454
|
-
const entry = this.resolve(parentSessionId,
|
|
40547
|
+
const entry = this.resolve(parentSessionId, str2(params.agent_id));
|
|
40455
40548
|
if (!entry)
|
|
40456
|
-
return this.unknownAgent(parentSessionId,
|
|
40549
|
+
return this.unknownAgent(parentSessionId, str2(params.agent_id));
|
|
40457
40550
|
if (entry.status !== "running" && entry.reportText)
|
|
40458
40551
|
return entry.reportText;
|
|
40459
40552
|
const progress = entry.progress ? `
|
|
@@ -40482,7 +40575,7 @@ ${(0, agentNarration_2.lastChars)(entry.partialText.trim(), 4e3)}`;
|
|
|
40482
40575
|
if (targets.length === 0) {
|
|
40483
40576
|
return "(no matching sub-agents to await \u2014 check agent ids, or spawn first)";
|
|
40484
40577
|
}
|
|
40485
|
-
const timeoutS = clamp3(
|
|
40578
|
+
const timeoutS = clamp3(num2(params.timeout_s) ?? exports2.AWAIT_DEFAULT_TIMEOUT_S, 1, exports2.AWAIT_MAX_TIMEOUT_S);
|
|
40486
40579
|
const hooks = this.parents.get(parentSessionId);
|
|
40487
40580
|
const running = targets.filter((t) => t.status === "running");
|
|
40488
40581
|
if (running.length > 0) {
|
|
@@ -40522,8 +40615,8 @@ ${(0, agentNarration_2.lastChars)(entry.partialText.trim(), 4e3)}`;
|
|
|
40522
40615
|
* Identified by `_agent_id`, which the manager stamps on every child tool call. A call
|
|
40523
40616
|
* without one is a call from something that is not a child, and there is nothing to record. */
|
|
40524
40617
|
async progress(params) {
|
|
40525
|
-
const note =
|
|
40526
|
-
const agentId =
|
|
40618
|
+
const note = str2(params.note).trim();
|
|
40619
|
+
const agentId = str2(params._agent_id).trim();
|
|
40527
40620
|
if (!note)
|
|
40528
40621
|
return "(no note \u2014 pass a short line describing what you are doing)";
|
|
40529
40622
|
const entry = agentId ? this.entries.get(agentId) : void 0;
|
|
@@ -40535,9 +40628,9 @@ ${(0, agentNarration_2.lastChars)(entry.partialText.trim(), 4e3)}`;
|
|
|
40535
40628
|
}
|
|
40536
40629
|
/** `agent_stop` — cancel a running child; it still reports partial results. */
|
|
40537
40630
|
async stop(parentSessionId, params) {
|
|
40538
|
-
const entry = this.resolve(parentSessionId,
|
|
40631
|
+
const entry = this.resolve(parentSessionId, str2(params.agent_id));
|
|
40539
40632
|
if (!entry)
|
|
40540
|
-
return this.unknownAgent(parentSessionId,
|
|
40633
|
+
return this.unknownAgent(parentSessionId, str2(params.agent_id));
|
|
40541
40634
|
if (entry.status !== "running") {
|
|
40542
40635
|
return `Sub-agent ${entry.agentId} is already ${entry.status}.`;
|
|
40543
40636
|
}
|
|
@@ -40568,9 +40661,9 @@ ${(0, agentNarration_2.lastChars)(entry.partialText.trim(), 4e3)}`;
|
|
|
40568
40661
|
return this.entries.get(entry.agentId) ?? entry;
|
|
40569
40662
|
}
|
|
40570
40663
|
async message(parentSessionId, params) {
|
|
40571
|
-
const entry = this.resolve(parentSessionId,
|
|
40664
|
+
const entry = this.resolve(parentSessionId, str2(params.agent_id));
|
|
40572
40665
|
if (!entry)
|
|
40573
|
-
return this.unknownAgent(parentSessionId,
|
|
40666
|
+
return this.unknownAgent(parentSessionId, str2(params.agent_id));
|
|
40574
40667
|
const text = String(params.message ?? "").trim();
|
|
40575
40668
|
if (!text)
|
|
40576
40669
|
throw new Error("agent_message requires a non-empty 'message'");
|
|
@@ -41007,10 +41100,10 @@ Worktree kept (it has changes): ${wt.path} on branch ${wt.branch}. Apply or disc
|
|
|
41007
41100
|
function fallbackDef(type) {
|
|
41008
41101
|
return { name: type, description: "", system: "", background: false, oneShot: false };
|
|
41009
41102
|
}
|
|
41010
|
-
function
|
|
41103
|
+
function str2(v2) {
|
|
41011
41104
|
return typeof v2 === "string" ? v2.trim() : "";
|
|
41012
41105
|
}
|
|
41013
|
-
function
|
|
41106
|
+
function num2(v2) {
|
|
41014
41107
|
return typeof v2 === "number" && Number.isFinite(v2) ? v2 : void 0;
|
|
41015
41108
|
}
|
|
41016
41109
|
function clamp3(v2, lo, hi) {
|
|
@@ -41516,7 +41609,7 @@ var require_agentAuth = __commonJS({
|
|
|
41516
41609
|
"../packages/orion-client-core/dist/auth/agentAuth.js"(exports2) {
|
|
41517
41610
|
"use strict";
|
|
41518
41611
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
41519
|
-
exports2.USAGE_TOPUP_COVERING_LABEL = exports2.NO_USAGE_LIMIT_LABEL = exports2.AgentSession = exports2.TOKEN_REQUEST_TIMEOUT_MS = exports2.AgentAuthError = void 0;
|
|
41612
|
+
exports2.USAGE_TOPUP_COVERING_LABEL = exports2.NO_USAGE_LIMIT_LABEL = exports2.AgentSession = exports2.BRAIN_RENEW_DEADLINE_MS = exports2.RENEW_BUDGET_MS = exports2.SECRET_READ_TIMEOUT_MS = exports2.TOKEN_REQUEST_TIMEOUT_MS = exports2.AgentAuthError = void 0;
|
|
41520
41613
|
exports2.isAgentSessionKey = isAgentSessionKey;
|
|
41521
41614
|
exports2.pkcePair = pkcePair;
|
|
41522
41615
|
exports2.buildConnectUrl = buildConnectUrl;
|
|
@@ -41597,6 +41690,16 @@ var require_agentAuth = __commonJS({
|
|
|
41597
41690
|
const value = jwtClaim(token, claim);
|
|
41598
41691
|
return typeof value === "string" && value ? value : null;
|
|
41599
41692
|
}
|
|
41693
|
+
function remainingValidityMs(token) {
|
|
41694
|
+
const exp = jwtClaim(token, "exp");
|
|
41695
|
+
return typeof exp === "number" && Number.isFinite(exp) ? exp * 1e3 - Date.now() : 0;
|
|
41696
|
+
}
|
|
41697
|
+
function sleep(ms) {
|
|
41698
|
+
return new Promise((resolve5) => {
|
|
41699
|
+
const timer = setTimeout(resolve5, ms);
|
|
41700
|
+
timer.unref?.();
|
|
41701
|
+
});
|
|
41702
|
+
}
|
|
41600
41703
|
async function pkcePair() {
|
|
41601
41704
|
const raw = new Uint8Array(48);
|
|
41602
41705
|
globalThis.crypto.getRandomValues(raw);
|
|
@@ -41684,16 +41787,54 @@ var require_agentAuth = __commonJS({
|
|
|
41684
41787
|
}
|
|
41685
41788
|
var FRESH_TOKEN_BUFFER_MS = 6e4;
|
|
41686
41789
|
var EARLY_REFRESH_MS = 10 * 6e4;
|
|
41790
|
+
exports2.SECRET_READ_TIMEOUT_MS = 5e3;
|
|
41791
|
+
exports2.RENEW_BUDGET_MS = 55e3;
|
|
41792
|
+
exports2.BRAIN_RENEW_DEADLINE_MS = 9e4;
|
|
41793
|
+
var RENEWED_TOKEN_MIN_REMAINING_MS = 5 * 6e4;
|
|
41794
|
+
var READ_TIMED_OUT = Symbol("orion.secret-read-timed-out");
|
|
41687
41795
|
var AgentSession = class {
|
|
41688
41796
|
store;
|
|
41689
41797
|
apiBaseUrl;
|
|
41690
41798
|
options;
|
|
41691
41799
|
inflightRefresh = null;
|
|
41800
|
+
/** The last token set THIS process saved — a write-through mirror of {@link save}, never
|
|
41801
|
+
* of sibling processes' writes (those live only in the shared store). Lets a renewal
|
|
41802
|
+
* answer with our own recent mint when the store read itself is wedged. NEVER used to
|
|
41803
|
+
* START a refresh: a cached refresh token may be rotated-away by a sibling, and replaying
|
|
41804
|
+
* one late revokes the whole token family server-side. */
|
|
41805
|
+
lastSaved = null;
|
|
41692
41806
|
constructor(store, apiBaseUrl, options = {}) {
|
|
41693
41807
|
this.store = store;
|
|
41694
41808
|
this.apiBaseUrl = apiBaseUrl;
|
|
41695
41809
|
this.options = options;
|
|
41696
41810
|
}
|
|
41811
|
+
/** Breadcrumb line (see {@link AgentSessionOptions.trace}); a throwing sink is the host's
|
|
41812
|
+
* bug and must never break the auth path. */
|
|
41813
|
+
trace(line) {
|
|
41814
|
+
try {
|
|
41815
|
+
this.options.trace?.(line);
|
|
41816
|
+
} catch {
|
|
41817
|
+
}
|
|
41818
|
+
}
|
|
41819
|
+
/** One bounded store read. {@link READ_TIMED_OUT} = the store did not answer (timed out
|
|
41820
|
+
* or threw) — an UNREACHABLE store, distinct from `null` = the key is definitively
|
|
41821
|
+
* absent. The renewal path branches on that difference: absent means signed out (fail
|
|
41822
|
+
* closed now); unreachable means retry and degrade, never a declared sign-out. */
|
|
41823
|
+
async boundedRead(key) {
|
|
41824
|
+
const timeoutMs = this.options.secretReadTimeoutMs ?? exports2.SECRET_READ_TIMEOUT_MS;
|
|
41825
|
+
let timer;
|
|
41826
|
+
const timeout = new Promise((resolve5) => {
|
|
41827
|
+
timer = setTimeout(() => resolve5(READ_TIMED_OUT), timeoutMs);
|
|
41828
|
+
timer.unref?.();
|
|
41829
|
+
});
|
|
41830
|
+
try {
|
|
41831
|
+
const read = Promise.resolve(this.store.get(key)).then((value) => value || null, () => READ_TIMED_OUT);
|
|
41832
|
+
return await Promise.race([read, timeout]);
|
|
41833
|
+
} finally {
|
|
41834
|
+
if (timer !== void 0)
|
|
41835
|
+
clearTimeout(timer);
|
|
41836
|
+
}
|
|
41837
|
+
}
|
|
41697
41838
|
async currentAccessToken() {
|
|
41698
41839
|
return await this.store.get(ACCESS_KEY) || null;
|
|
41699
41840
|
}
|
|
@@ -41713,9 +41854,7 @@ var require_agentAuth = __commonJS({
|
|
|
41713
41854
|
const token = await this.currentAccessToken();
|
|
41714
41855
|
if (!token)
|
|
41715
41856
|
return null;
|
|
41716
|
-
const
|
|
41717
|
-
const expiresAtMs = typeof exp === "number" && Number.isFinite(exp) ? exp * 1e3 : 0;
|
|
41718
|
-
const remainingMs = expiresAtMs - Date.now();
|
|
41857
|
+
const remainingMs = remainingValidityMs(token);
|
|
41719
41858
|
if (remainingMs > EARLY_REFRESH_MS)
|
|
41720
41859
|
return token;
|
|
41721
41860
|
if (remainingMs > FRESH_TOKEN_BUFFER_MS) {
|
|
@@ -41725,6 +41864,64 @@ var require_agentAuth = __commonJS({
|
|
|
41725
41864
|
await this.refresh();
|
|
41726
41865
|
return this.currentAccessToken();
|
|
41727
41866
|
}
|
|
41867
|
+
/** The FAIL-CLOSED renewal answer for the local brain's `renew_bearer` request — invoked
|
|
41868
|
+
* only after the gateway REFUSED a bearer (401), which makes the server's verdict the
|
|
41869
|
+
* ground truth this method never argues with. Its contract:
|
|
41870
|
+
* - it never answers with `refused` (the token just declared dead) nor with a near-dead
|
|
41871
|
+
* token — a mint is forced instead;
|
|
41872
|
+
* - a DIFFERENT stored token with comfortable validity (a sibling process already
|
|
41873
|
+
* renewed through the shared store) is the answer immediately, no mint;
|
|
41874
|
+
* - otherwise it mints, retrying transient failures with backoff under `renewBudgetMs`,
|
|
41875
|
+
* re-reading the store between tries — a sibling's mint landing while ours failed
|
|
41876
|
+
* (the rotation race's other half, reply-lost rotations included) is a heal;
|
|
41877
|
+
* - a wedged store degrades to this process's own last save for the ACCESS token
|
|
41878
|
+
* (never for starting a refresh — rotation safety, see {@link refresh});
|
|
41879
|
+
* - `null` means the account genuinely cannot produce a fresh token (signed out,
|
|
41880
|
+
* family revoked, or the budget lapsed with everything unreachable) — the brain then
|
|
41881
|
+
* surfaces the honest auth error.
|
|
41882
|
+
*
|
|
41883
|
+
* {@link currentFreshAccessToken} stays the PROACTIVE read with its deliberate fail-OPEN
|
|
41884
|
+
* degradation ("the stored token stands"); this is the REACTIVE one, and the two must
|
|
41885
|
+
* not be merged: the fail-open answer is exactly what let the 2026-08-24/25 stage turns
|
|
41886
|
+
* die — it handed the refused token straight back, and the one heal was spent. */
|
|
41887
|
+
async renewedAccessToken(refused) {
|
|
41888
|
+
const budget = this.options.renewBudgetMs ?? exports2.RENEW_BUDGET_MS;
|
|
41889
|
+
const backoffBase = this.options.renewBackoffBaseMs ?? 500;
|
|
41890
|
+
const deadline = Date.now() + budget;
|
|
41891
|
+
const answerable = (token2, minted) => typeof token2 === "string" && token2 !== "" && token2 !== refused && // A mint vouches for freshness by EVENT (it just happened server-side), sidestepping
|
|
41892
|
+
// the local clock entirely — a fast client clock must not veto a genuinely new token.
|
|
41893
|
+
(minted || remainingValidityMs(token2) > RENEWED_TOKEN_MIN_REMAINING_MS);
|
|
41894
|
+
const storedAccess = async () => {
|
|
41895
|
+
const read = await this.boundedRead(ACCESS_KEY);
|
|
41896
|
+
if (read !== READ_TIMED_OUT)
|
|
41897
|
+
return { token: read, wedged: false };
|
|
41898
|
+
return { token: this.lastSaved?.accessToken ?? null, wedged: true };
|
|
41899
|
+
};
|
|
41900
|
+
let { token, wedged } = await storedAccess();
|
|
41901
|
+
if (answerable(token, false)) {
|
|
41902
|
+
this.trace(wedged ? "renew: answered from the process cache (store unreachable), no mint" : "renew: answered from the store (sibling renewal), no mint");
|
|
41903
|
+
return token;
|
|
41904
|
+
}
|
|
41905
|
+
for (let attempt = 0; ; attempt += 1) {
|
|
41906
|
+
const minted = await this.refresh();
|
|
41907
|
+
({ token, wedged } = await storedAccess());
|
|
41908
|
+
if (answerable(token, minted)) {
|
|
41909
|
+
this.trace(minted ? `renew: minted and answered (attempt ${attempt + 1})` : "renew: a sibling's mint landed \u2014 answered");
|
|
41910
|
+
return token;
|
|
41911
|
+
}
|
|
41912
|
+
const refreshToken = await this.boundedRead(REFRESH_KEY);
|
|
41913
|
+
if (refreshToken === null) {
|
|
41914
|
+
this.trace("renew: no session (signed out / revoked) \u2014 fail-closed");
|
|
41915
|
+
return null;
|
|
41916
|
+
}
|
|
41917
|
+
const wait = Math.min(Math.min(8e3, backoffBase * 2 ** attempt), deadline - Date.now());
|
|
41918
|
+
if (wait <= 0)
|
|
41919
|
+
break;
|
|
41920
|
+
await sleep(wait);
|
|
41921
|
+
}
|
|
41922
|
+
this.trace(`renew: budget (${budget}ms) exhausted \u2014 fail-closed`);
|
|
41923
|
+
return null;
|
|
41924
|
+
}
|
|
41728
41925
|
/** The plan the user is on (free/pro/…), for display + upgrade CTAs. */
|
|
41729
41926
|
async tier() {
|
|
41730
41927
|
return await this.store.get(TIER_KEY) || null;
|
|
@@ -41861,6 +42058,7 @@ var require_agentAuth = __commonJS({
|
|
|
41861
42058
|
return Boolean(await this.store.get(REFRESH_KEY));
|
|
41862
42059
|
}
|
|
41863
42060
|
async save(tokens) {
|
|
42061
|
+
this.lastSaved = tokens;
|
|
41864
42062
|
await this.store.store(ACCESS_KEY, tokens.accessToken);
|
|
41865
42063
|
await this.store.store(REFRESH_KEY, tokens.refreshToken);
|
|
41866
42064
|
await this.store.store(TIER_KEY, tokens.tier);
|
|
@@ -41881,20 +42079,47 @@ var require_agentAuth = __commonJS({
|
|
|
41881
42079
|
return inflight;
|
|
41882
42080
|
}
|
|
41883
42081
|
async doRefresh() {
|
|
41884
|
-
const
|
|
42082
|
+
const started = Date.now();
|
|
42083
|
+
const refreshToken = await this.boundedRead(REFRESH_KEY);
|
|
42084
|
+
if (refreshToken === READ_TIMED_OUT) {
|
|
42085
|
+
this.trace(`refresh: store read unanswered after ${Date.now() - started}ms \u2014 transient`);
|
|
42086
|
+
return false;
|
|
42087
|
+
}
|
|
41885
42088
|
if (!refreshToken)
|
|
41886
42089
|
return false;
|
|
41887
42090
|
try {
|
|
41888
|
-
|
|
42091
|
+
const minted = await refreshTokens({
|
|
41889
42092
|
apiBaseUrl: this.apiBaseUrl(),
|
|
41890
42093
|
refreshToken,
|
|
41891
42094
|
requestTimeoutMs: this.options.requestTimeoutMs
|
|
41892
|
-
})
|
|
42095
|
+
});
|
|
42096
|
+
if (!minted.accessToken) {
|
|
42097
|
+
this.trace("refresh: malformed 200 (empty access token) \u2014 transient");
|
|
42098
|
+
return false;
|
|
42099
|
+
}
|
|
42100
|
+
const tokens = minted.refreshToken ? minted : { ...minted, refreshToken };
|
|
42101
|
+
const written = await Promise.race([
|
|
42102
|
+
this.save(tokens).then(() => true, () => false),
|
|
42103
|
+
sleep(3 * (this.options.secretReadTimeoutMs ?? exports2.SECRET_READ_TIMEOUT_MS)).then(() => false)
|
|
42104
|
+
]);
|
|
42105
|
+
this.trace(written ? `refresh: minted in ${Date.now() - started}ms` : `refresh: minted in ${Date.now() - started}ms, store write still pending \u2014 tokens live in the process cache`);
|
|
41893
42106
|
return true;
|
|
41894
42107
|
} catch (err2) {
|
|
41895
42108
|
if (err2 instanceof AgentAuthError && isDefinitiveAuthRejection(err2)) {
|
|
42109
|
+
const current2 = await this.boundedRead(REFRESH_KEY);
|
|
42110
|
+
if (current2 === READ_TIMED_OUT) {
|
|
42111
|
+
this.trace("refresh: rejected, but the store is unreachable \u2014 clear deferred");
|
|
42112
|
+
return false;
|
|
42113
|
+
}
|
|
42114
|
+
if (current2 && current2 !== refreshToken) {
|
|
42115
|
+
this.trace("refresh: rejection was a rotation-race replay \u2014 sibling's session adopted");
|
|
42116
|
+
return true;
|
|
42117
|
+
}
|
|
42118
|
+
this.trace("refresh: definitively rejected \u2014 session cleared");
|
|
41896
42119
|
await this.clear();
|
|
42120
|
+
return false;
|
|
41897
42121
|
}
|
|
42122
|
+
this.trace(`refresh: transient failure (${err2 instanceof AgentAuthError ? err2.status : "malformed reply"})`);
|
|
41898
42123
|
return false;
|
|
41899
42124
|
}
|
|
41900
42125
|
}
|
|
@@ -41906,6 +42131,7 @@ var require_agentAuth = __commonJS({
|
|
|
41906
42131
|
await this.clear();
|
|
41907
42132
|
}
|
|
41908
42133
|
async clear() {
|
|
42134
|
+
this.lastSaved = null;
|
|
41909
42135
|
await this.store.delete(ACCESS_KEY);
|
|
41910
42136
|
await this.store.delete(REFRESH_KEY);
|
|
41911
42137
|
await this.store.delete(TIER_KEY);
|
|
@@ -42189,8 +42415,8 @@ var require_browserLogin = __commonJS({
|
|
|
42189
42415
|
} catch {
|
|
42190
42416
|
}
|
|
42191
42417
|
}
|
|
42192
|
-
function createAgentSession3(secrets, config) {
|
|
42193
|
-
return new agentAuth_1.AgentSession(secrets, () => config.accountsApiUrl);
|
|
42418
|
+
function createAgentSession3(secrets, config, options = {}) {
|
|
42419
|
+
return new agentAuth_1.AgentSession(secrets, () => config.accountsApiUrl, options);
|
|
42194
42420
|
}
|
|
42195
42421
|
async function signInViaBrowser3(session, config, deps2 = {}) {
|
|
42196
42422
|
if (await session.isSignedIn())
|
|
@@ -42626,7 +42852,7 @@ var require_normalize = __commonJS({
|
|
|
42626
42852
|
"use strict";
|
|
42627
42853
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
42628
42854
|
exports2.normalizePlan = normalizePlan;
|
|
42629
|
-
function
|
|
42855
|
+
function str2(v2) {
|
|
42630
42856
|
return typeof v2 === "string" ? v2 : void 0;
|
|
42631
42857
|
}
|
|
42632
42858
|
function pick(obj, ...keys) {
|
|
@@ -42639,12 +42865,12 @@ var require_normalize = __commonJS({
|
|
|
42639
42865
|
function normalizeFile(raw) {
|
|
42640
42866
|
const f = raw ?? {};
|
|
42641
42867
|
const out2 = {
|
|
42642
|
-
relPath:
|
|
42868
|
+
relPath: str2(pick(f, "relPath", "rel_path")) ?? ""
|
|
42643
42869
|
};
|
|
42644
|
-
const content =
|
|
42870
|
+
const content = str2(f.content);
|
|
42645
42871
|
if (content !== void 0)
|
|
42646
42872
|
out2.content = content;
|
|
42647
|
-
const fromPath =
|
|
42873
|
+
const fromPath = str2(pick(f, "fromPath", "from_path"));
|
|
42648
42874
|
if (fromPath !== void 0)
|
|
42649
42875
|
out2.fromPath = fromPath;
|
|
42650
42876
|
if (typeof f.mode === "number")
|
|
@@ -42654,21 +42880,21 @@ var require_normalize = __commonJS({
|
|
|
42654
42880
|
function normalizeItem(raw) {
|
|
42655
42881
|
const i2 = raw ?? {};
|
|
42656
42882
|
const item = {
|
|
42657
|
-
category:
|
|
42658
|
-
name:
|
|
42659
|
-
scope:
|
|
42660
|
-
onCollision:
|
|
42661
|
-
source:
|
|
42883
|
+
category: str2(i2.category) ?? "",
|
|
42884
|
+
name: str2(i2.name) ?? "",
|
|
42885
|
+
scope: str2(i2.scope) ?? "global",
|
|
42886
|
+
onCollision: str2(pick(i2, "onCollision", "on_collision", "collision")) ?? "skip",
|
|
42887
|
+
source: str2(i2.source) ?? "unknown"
|
|
42662
42888
|
};
|
|
42663
42889
|
if (Array.isArray(i2.files))
|
|
42664
42890
|
item.files = i2.files.map(normalizeFile);
|
|
42665
42891
|
if (i2.server !== void 0 && typeof i2.server === "object" && i2.server !== null) {
|
|
42666
42892
|
item.server = i2.server;
|
|
42667
42893
|
}
|
|
42668
|
-
const rulesTarget =
|
|
42894
|
+
const rulesTarget = str2(pick(i2, "rulesTarget", "rules_target"));
|
|
42669
42895
|
if (rulesTarget !== void 0)
|
|
42670
42896
|
item.rulesTarget = rulesTarget;
|
|
42671
|
-
const content =
|
|
42897
|
+
const content = str2(i2.content);
|
|
42672
42898
|
if (content !== void 0)
|
|
42673
42899
|
item.content = content;
|
|
42674
42900
|
if (i2.memory !== void 0 && typeof i2.memory === "object" && i2.memory !== null) {
|
|
@@ -42680,7 +42906,7 @@ var require_normalize = __commonJS({
|
|
|
42680
42906
|
const p = raw ?? {};
|
|
42681
42907
|
const rootsRaw = pick(p, "sourceRoots", "source_roots");
|
|
42682
42908
|
return {
|
|
42683
|
-
summary:
|
|
42909
|
+
summary: str2(p.summary) ?? "",
|
|
42684
42910
|
sourceRoots: Array.isArray(rootsRaw) ? rootsRaw.map(String) : [],
|
|
42685
42911
|
items: Array.isArray(p.items) ? p.items.map(normalizeItem) : []
|
|
42686
42912
|
};
|
|
@@ -43168,8 +43394,8 @@ var require_manifest = __commonJS({
|
|
|
43168
43394
|
let id = manifestId;
|
|
43169
43395
|
if (id === void 0) {
|
|
43170
43396
|
for (const candidate of ids) {
|
|
43171
|
-
const
|
|
43172
|
-
if (
|
|
43397
|
+
const rec2 = await readManifest(path14.join(importHistoryDir(home), candidate));
|
|
43398
|
+
if (rec2 && !rec2.undoneAt) {
|
|
43173
43399
|
id = candidate;
|
|
43174
43400
|
break;
|
|
43175
43401
|
}
|
|
@@ -64497,26 +64723,26 @@ exit $__orion_rc`;
|
|
|
64497
64723
|
const proc = (0, child_process_1.spawn)(bgInv.file, bgInv.args, { ...processHardening_1.HIDDEN_WINDOW_SPAWN_OPTIONS, cwd: root2 });
|
|
64498
64724
|
(0, processHardening_1.trackChild)(proc);
|
|
64499
64725
|
const handle2 = `bg-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
64500
|
-
const
|
|
64501
|
-
this.background.set(handle2,
|
|
64726
|
+
const rec2 = { proc, command, output: "" };
|
|
64727
|
+
this.background.set(handle2, rec2);
|
|
64502
64728
|
proc.stdout?.on("data", (c3) => {
|
|
64503
|
-
|
|
64729
|
+
rec2.output += c3.toString();
|
|
64504
64730
|
});
|
|
64505
64731
|
proc.stderr?.on("data", (c3) => {
|
|
64506
|
-
|
|
64732
|
+
rec2.output += c3.toString();
|
|
64507
64733
|
});
|
|
64508
64734
|
return handle2;
|
|
64509
64735
|
}
|
|
64510
64736
|
/** `bash_check` */
|
|
64511
64737
|
async toolBashCheck(req, params, sessionId, context) {
|
|
64512
|
-
const
|
|
64513
|
-
if (!
|
|
64738
|
+
const rec2 = this.background.get(String(params.handle));
|
|
64739
|
+
if (!rec2)
|
|
64514
64740
|
throw new Error("unknown background handle");
|
|
64515
|
-
const exitCode =
|
|
64741
|
+
const exitCode = rec2.proc.exitCode;
|
|
64516
64742
|
const outputTail = (0, terminalOutputCompression_1.compressTerminalOutputWithMetrics)({
|
|
64517
64743
|
toolName: req.name,
|
|
64518
|
-
command:
|
|
64519
|
-
output:
|
|
64744
|
+
command: rec2.command,
|
|
64745
|
+
output: rec2.output.slice(-4e3),
|
|
64520
64746
|
tokenSaving: context.tokenSaving,
|
|
64521
64747
|
exitCode,
|
|
64522
64748
|
complete: exitCode !== null
|
|
@@ -64532,10 +64758,10 @@ exit $__orion_rc`;
|
|
|
64532
64758
|
}
|
|
64533
64759
|
/** `bash_stop` */
|
|
64534
64760
|
async toolBashStop(req, params, sessionId, context) {
|
|
64535
|
-
const
|
|
64536
|
-
if (!
|
|
64761
|
+
const rec2 = this.background.get(String(params.handle));
|
|
64762
|
+
if (!rec2)
|
|
64537
64763
|
throw new Error("unknown background handle");
|
|
64538
|
-
await (0, processHardening_1.terminateChildTree)(
|
|
64764
|
+
await (0, processHardening_1.terminateChildTree)(rec2.proc);
|
|
64539
64765
|
this.background.delete(String(params.handle));
|
|
64540
64766
|
return "stopped";
|
|
64541
64767
|
}
|
|
@@ -69291,7 +69517,7 @@ var require_loopDecl = __commonJS({
|
|
|
69291
69517
|
return { decl: null, problems: ["the file must contain a JSON object"] };
|
|
69292
69518
|
}
|
|
69293
69519
|
meta = parsed;
|
|
69294
|
-
body2 =
|
|
69520
|
+
body2 = str2(meta.prompt);
|
|
69295
69521
|
} catch (error) {
|
|
69296
69522
|
return { decl: null, problems: [`invalid JSON (${errorText(error)})`] };
|
|
69297
69523
|
}
|
|
@@ -69303,19 +69529,19 @@ var require_loopDecl = __commonJS({
|
|
|
69303
69529
|
return { decl: null, problems: ["no frontmatter block (--- \u2026 ---) was found"] };
|
|
69304
69530
|
}
|
|
69305
69531
|
}
|
|
69306
|
-
const name2 = (
|
|
69532
|
+
const name2 = (str2(meta.name) || stem).trim();
|
|
69307
69533
|
if (!name2)
|
|
69308
69534
|
problems.push("a loop needs a name");
|
|
69309
|
-
const persona =
|
|
69535
|
+
const persona = str2(meta.persona).trim();
|
|
69310
69536
|
if (!persona)
|
|
69311
69537
|
problems.push("`persona` is required (which sub-agent type runs this loop)");
|
|
69312
|
-
const trigger =
|
|
69538
|
+
const trigger = str2(meta.trigger).trim();
|
|
69313
69539
|
if (!trigger)
|
|
69314
69540
|
problems.push("`trigger` is required (a 5-field cron expression)");
|
|
69315
69541
|
else if (!(0, cronExpression_js_1.parseCronExpression)(trigger)) {
|
|
69316
69542
|
problems.push(`\`trigger\` is not a valid 5-field cron expression: '${trigger}'`);
|
|
69317
69543
|
}
|
|
69318
|
-
const skill =
|
|
69544
|
+
const skill = str2(meta.skill).trim();
|
|
69319
69545
|
if (skill && body2) {
|
|
69320
69546
|
problems.push("declare either `skill` or a prompt body, not both");
|
|
69321
69547
|
}
|
|
@@ -69346,7 +69572,7 @@ var require_loopDecl = __commonJS({
|
|
|
69346
69572
|
};
|
|
69347
69573
|
}
|
|
69348
69574
|
function parseEnvelope(meta, problems) {
|
|
69349
|
-
const rawMode =
|
|
69575
|
+
const rawMode = str2(meta.envelope_mode).trim().toLowerCase();
|
|
69350
69576
|
let mode = DEFAULT_ENVELOPE.mode;
|
|
69351
69577
|
if (rawMode) {
|
|
69352
69578
|
if (rawMode === "full_access") {
|
|
@@ -69452,7 +69678,7 @@ var require_loopDecl = __commonJS({
|
|
|
69452
69678
|
issues.push({ path: filePath, problem });
|
|
69453
69679
|
}
|
|
69454
69680
|
}
|
|
69455
|
-
function
|
|
69681
|
+
function str2(v2) {
|
|
69456
69682
|
return typeof v2 === "string" ? v2 : typeof v2 === "number" || typeof v2 === "boolean" ? String(v2) : "";
|
|
69457
69683
|
}
|
|
69458
69684
|
function bool(v2) {
|
|
@@ -69464,7 +69690,7 @@ var require_loopDecl = __commonJS({
|
|
|
69464
69690
|
}
|
|
69465
69691
|
function list(v2) {
|
|
69466
69692
|
if (Array.isArray(v2)) {
|
|
69467
|
-
const items = v2.map(
|
|
69693
|
+
const items = v2.map(str2).map((s) => s.trim()).filter(Boolean);
|
|
69468
69694
|
return items.length > 0 ? items : void 0;
|
|
69469
69695
|
}
|
|
69470
69696
|
if (typeof v2 === "string" && v2.trim()) {
|
|
@@ -69476,7 +69702,7 @@ var require_loopDecl = __commonJS({
|
|
|
69476
69702
|
function clampNumber(raw, fallback, max, field2, problems) {
|
|
69477
69703
|
if (raw === void 0 || raw === "")
|
|
69478
69704
|
return fallback;
|
|
69479
|
-
const value = typeof raw === "number" ? raw : Number(
|
|
69705
|
+
const value = typeof raw === "number" ? raw : Number(str2(raw));
|
|
69480
69706
|
if (!Number.isFinite(value) || value <= 0) {
|
|
69481
69707
|
problems.push(`\`${field2}\` must be a positive number`);
|
|
69482
69708
|
return fallback;
|
|
@@ -70548,7 +70774,7 @@ var require_connection = __commonJS({
|
|
|
70548
70774
|
return;
|
|
70549
70775
|
}
|
|
70550
70776
|
case "renew_bearer": {
|
|
70551
|
-
void this.answerRenew(frame.id);
|
|
70777
|
+
void this.answerRenew(frame.id, frame.refused);
|
|
70552
70778
|
return;
|
|
70553
70779
|
}
|
|
70554
70780
|
case "rpc_result": {
|
|
@@ -70566,15 +70792,19 @@ var require_connection = __commonJS({
|
|
|
70566
70792
|
return;
|
|
70567
70793
|
}
|
|
70568
70794
|
}
|
|
70569
|
-
/** Run (or join) the ONE in-flight
|
|
70570
|
-
*
|
|
70571
|
-
*
|
|
70572
|
-
|
|
70795
|
+
/** Run (or join) the ONE in-flight renewal and answer the renew request with its result.
|
|
70796
|
+
* Joiners share the in-flight answer even when their `refused` differs (a turn's main
|
|
70797
|
+
* call and its interim passes usually 401 on the SAME bearer; when they don't, a shared
|
|
70798
|
+
* answer the gateway still refuses just triggers that call's second renew round, which
|
|
70799
|
+
* runs fresh with ITS refused token — self-correcting, never a loop). A throwing or
|
|
70800
|
+
* absent auth layer answers "no bearer" — a failed renewal at the brain, never a
|
|
70801
|
+
* connection fault. */
|
|
70802
|
+
async answerRenew(id, refused) {
|
|
70573
70803
|
let bearer = null;
|
|
70574
70804
|
if (this.renewBearer) {
|
|
70575
70805
|
this.renewInFlight ??= (async () => {
|
|
70576
70806
|
try {
|
|
70577
|
-
return await this.renewBearer();
|
|
70807
|
+
return await this.renewBearer(refused);
|
|
70578
70808
|
} catch {
|
|
70579
70809
|
return null;
|
|
70580
70810
|
} finally {
|
|
@@ -71400,6 +71630,7 @@ var require_dist = __commonJS({
|
|
|
71400
71630
|
__exportStar(require_duetRoutingAdvisor(), exports2);
|
|
71401
71631
|
__exportStar(require_cron(), exports2);
|
|
71402
71632
|
__exportStar(require_agentStore(), exports2);
|
|
71633
|
+
__exportStar(require_goalClaim(), exports2);
|
|
71403
71634
|
__exportStar(require_goalMarker(), exports2);
|
|
71404
71635
|
__exportStar(require_goalEvidence(), exports2);
|
|
71405
71636
|
__exportStar(require_goalEvaluate(), exports2);
|
|
@@ -72248,13 +72479,13 @@ var require_feedbackPolicy = __commonJS({
|
|
|
72248
72479
|
return emptyFeedbackPolicyState(now2, seedFallback);
|
|
72249
72480
|
}
|
|
72250
72481
|
const r2 = raw;
|
|
72251
|
-
const
|
|
72482
|
+
const num2 = (value, fallback) => typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : fallback;
|
|
72252
72483
|
const outcome = r2.lastOutcome === "submitted" || r2.lastOutcome === "dismissed" ? r2.lastOutcome : "";
|
|
72253
72484
|
return {
|
|
72254
|
-
firstSeenAt:
|
|
72255
|
-
lastShownAt:
|
|
72485
|
+
firstSeenAt: num2(r2.firstSeenAt, now2) || now2,
|
|
72486
|
+
lastShownAt: num2(r2.lastShownAt, 0),
|
|
72256
72487
|
lastOutcome: outcome,
|
|
72257
|
-
dismissStreak: Math.min(exports2.FEEDBACK_STOP_AFTER_DISMISSALS, Math.trunc(
|
|
72488
|
+
dismissStreak: Math.min(exports2.FEEDBACK_STOP_AFTER_DISMISSALS, Math.trunc(num2(r2.dismissStreak, 0))),
|
|
72258
72489
|
stopped: r2.stopped === true,
|
|
72259
72490
|
seed: typeof r2.seed === "number" && Number.isFinite(r2.seed) ? r2.seed : Number.isFinite(seedFallback) ? seedFallback : 0
|
|
72260
72491
|
};
|
|
@@ -72384,7 +72615,8 @@ var require_toolVisibility = __commonJS({
|
|
|
72384
72615
|
exports2.SILENT_TOOLS = /* @__PURE__ */ new Set([
|
|
72385
72616
|
"ask_user",
|
|
72386
72617
|
"exit_plan_mode",
|
|
72387
|
-
"await_agents"
|
|
72618
|
+
"await_agents",
|
|
72619
|
+
"goal_report"
|
|
72388
72620
|
]);
|
|
72389
72621
|
function isSilentTool3(name2) {
|
|
72390
72622
|
return typeof name2 === "string" && exports2.SILENT_TOOLS.has(name2);
|
|
@@ -76536,13 +76768,13 @@ function getGraphemeSegmenter() {
|
|
|
76536
76768
|
|
|
76537
76769
|
// src/vendor/ink/stringWidth.ts
|
|
76538
76770
|
var EMOJI_REGEX = (0, import_emoji_regex.default)();
|
|
76539
|
-
function stringWidthJavaScript(
|
|
76540
|
-
if (typeof
|
|
76771
|
+
function stringWidthJavaScript(str2) {
|
|
76772
|
+
if (typeof str2 !== "string" || str2.length === 0) {
|
|
76541
76773
|
return 0;
|
|
76542
76774
|
}
|
|
76543
76775
|
let isPureAscii = true;
|
|
76544
|
-
for (let i2 = 0; i2 <
|
|
76545
|
-
const code =
|
|
76776
|
+
for (let i2 = 0; i2 < str2.length; i2++) {
|
|
76777
|
+
const code = str2.charCodeAt(i2);
|
|
76546
76778
|
if (code >= 127 || code === 27) {
|
|
76547
76779
|
isPureAscii = false;
|
|
76548
76780
|
break;
|
|
@@ -76550,23 +76782,23 @@ function stringWidthJavaScript(str) {
|
|
|
76550
76782
|
}
|
|
76551
76783
|
if (isPureAscii) {
|
|
76552
76784
|
let width2 = 0;
|
|
76553
|
-
for (let i2 = 0; i2 <
|
|
76554
|
-
const code =
|
|
76785
|
+
for (let i2 = 0; i2 < str2.length; i2++) {
|
|
76786
|
+
const code = str2.charCodeAt(i2);
|
|
76555
76787
|
if (code > 31) {
|
|
76556
76788
|
width2++;
|
|
76557
76789
|
}
|
|
76558
76790
|
}
|
|
76559
76791
|
return width2;
|
|
76560
76792
|
}
|
|
76561
|
-
if (
|
|
76562
|
-
|
|
76563
|
-
if (
|
|
76793
|
+
if (str2.includes("\x1B")) {
|
|
76794
|
+
str2 = (0, import_strip_ansi.default)(str2);
|
|
76795
|
+
if (str2.length === 0) {
|
|
76564
76796
|
return 0;
|
|
76565
76797
|
}
|
|
76566
76798
|
}
|
|
76567
|
-
if (!needsSegmentation(
|
|
76799
|
+
if (!needsSegmentation(str2)) {
|
|
76568
76800
|
let width2 = 0;
|
|
76569
|
-
for (const char of
|
|
76801
|
+
for (const char of str2) {
|
|
76570
76802
|
const codePoint = char.codePointAt(0);
|
|
76571
76803
|
if (!isZeroWidth(codePoint)) {
|
|
76572
76804
|
width2 += eastAsianWidth(codePoint, { ambiguousAsWide: false });
|
|
@@ -76575,7 +76807,7 @@ function stringWidthJavaScript(str) {
|
|
|
76575
76807
|
return width2;
|
|
76576
76808
|
}
|
|
76577
76809
|
let width = 0;
|
|
76578
|
-
for (const { segment: grapheme } of getGraphemeSegmenter().segment(
|
|
76810
|
+
for (const { segment: grapheme } of getGraphemeSegmenter().segment(str2)) {
|
|
76579
76811
|
EMOJI_REGEX.lastIndex = 0;
|
|
76580
76812
|
if (EMOJI_REGEX.test(grapheme)) {
|
|
76581
76813
|
width += getEmojiWidth(grapheme);
|
|
@@ -76591,8 +76823,8 @@ function stringWidthJavaScript(str) {
|
|
|
76591
76823
|
}
|
|
76592
76824
|
return width;
|
|
76593
76825
|
}
|
|
76594
|
-
function needsSegmentation(
|
|
76595
|
-
for (const char of
|
|
76826
|
+
function needsSegmentation(str2) {
|
|
76827
|
+
for (const char of str2) {
|
|
76596
76828
|
const cp = char.codePointAt(0);
|
|
76597
76829
|
if (cp >= 127744 && cp <= 129791) return true;
|
|
76598
76830
|
if (cp >= 9728 && cp <= 10175) return true;
|
|
@@ -76656,7 +76888,7 @@ function isZeroWidth(codePoint) {
|
|
|
76656
76888
|
}
|
|
76657
76889
|
var bunStringWidth = typeof Bun !== "undefined" && typeof Bun.stringWidth === "function" ? Bun.stringWidth : null;
|
|
76658
76890
|
var BUN_STRING_WIDTH_OPTS = { ambiguousIsNarrow: true };
|
|
76659
|
-
var stringWidth = bunStringWidth ? (
|
|
76891
|
+
var stringWidth = bunStringWidth ? (str2) => bunStringWidth(str2, BUN_STRING_WIDTH_OPTS) : stringWidthJavaScript;
|
|
76660
76892
|
|
|
76661
76893
|
// src/vendor/ink/line-width-cache.ts
|
|
76662
76894
|
var cache = /* @__PURE__ */ new Map();
|
|
@@ -77531,9 +77763,9 @@ function isFullwidthCodePoint(codePoint) {
|
|
|
77531
77763
|
}
|
|
77532
77764
|
|
|
77533
77765
|
// ../node_modules/@alcalzone/ansi-tokenize/build/tokenize.js
|
|
77534
|
-
function findNumberIndex(
|
|
77535
|
-
for (let index = 0; index <
|
|
77536
|
-
const charCode =
|
|
77766
|
+
function findNumberIndex(str2) {
|
|
77767
|
+
for (let index = 0; index < str2.length; index++) {
|
|
77768
|
+
const charCode = str2.charCodeAt(index);
|
|
77537
77769
|
if (charCode >= 48 && charCode <= 57) {
|
|
77538
77770
|
return index;
|
|
77539
77771
|
}
|
|
@@ -77563,14 +77795,14 @@ function parseAnsiCode(string, offset) {
|
|
|
77563
77795
|
return string.slice(0, endIndex + 1);
|
|
77564
77796
|
}
|
|
77565
77797
|
}
|
|
77566
|
-
function tokenize2(
|
|
77798
|
+
function tokenize2(str2, endChar = Number.POSITIVE_INFINITY) {
|
|
77567
77799
|
const ret = [];
|
|
77568
77800
|
let index = 0;
|
|
77569
77801
|
let visible = 0;
|
|
77570
|
-
while (index <
|
|
77571
|
-
const codePoint =
|
|
77802
|
+
while (index < str2.length) {
|
|
77803
|
+
const codePoint = str2.codePointAt(index);
|
|
77572
77804
|
if (ESCAPES.has(codePoint)) {
|
|
77573
|
-
const code = parseLinkCode(
|
|
77805
|
+
const code = parseLinkCode(str2, index) || parseAnsiCode(str2, index);
|
|
77574
77806
|
if (code) {
|
|
77575
77807
|
ret.push({
|
|
77576
77808
|
type: "ansi",
|
|
@@ -77604,8 +77836,8 @@ function isEndCode(code) {
|
|
|
77604
77836
|
function filterStartCodes(codes) {
|
|
77605
77837
|
return codes.filter((c3) => !isEndCode(c3));
|
|
77606
77838
|
}
|
|
77607
|
-
function sliceAnsi(
|
|
77608
|
-
const tokens = tokenize2(
|
|
77839
|
+
function sliceAnsi(str2, start2, end) {
|
|
77840
|
+
const tokens = tokenize2(str2);
|
|
77609
77841
|
let activeCodes = [];
|
|
77610
77842
|
let position = 0;
|
|
77611
77843
|
let result = "";
|
|
@@ -80061,16 +80293,16 @@ var UNDERLINE_STYLES = [
|
|
|
80061
80293
|
"dotted",
|
|
80062
80294
|
"dashed"
|
|
80063
80295
|
];
|
|
80064
|
-
function parseParams(
|
|
80065
|
-
if (
|
|
80296
|
+
function parseParams(str2) {
|
|
80297
|
+
if (str2 === "") return [{ value: 0, subparams: [], colon: false }];
|
|
80066
80298
|
const result = [];
|
|
80067
80299
|
let current2 = { value: null, subparams: [], colon: false };
|
|
80068
|
-
let
|
|
80300
|
+
let num2 = "";
|
|
80069
80301
|
let inSub = false;
|
|
80070
|
-
for (let i2 = 0; i2 <=
|
|
80071
|
-
const c3 =
|
|
80302
|
+
for (let i2 = 0; i2 <= str2.length; i2++) {
|
|
80303
|
+
const c3 = str2[i2];
|
|
80072
80304
|
if (c3 === ";" || c3 === void 0) {
|
|
80073
|
-
const n =
|
|
80305
|
+
const n = num2 === "" ? null : parseInt(num2, 10);
|
|
80074
80306
|
if (inSub) {
|
|
80075
80307
|
if (n !== null) current2.subparams.push(n);
|
|
80076
80308
|
} else {
|
|
@@ -80078,10 +80310,10 @@ function parseParams(str) {
|
|
|
80078
80310
|
}
|
|
80079
80311
|
result.push(current2);
|
|
80080
80312
|
current2 = { value: null, subparams: [], colon: false };
|
|
80081
|
-
|
|
80313
|
+
num2 = "";
|
|
80082
80314
|
inSub = false;
|
|
80083
80315
|
} else if (c3 === ":") {
|
|
80084
|
-
const n =
|
|
80316
|
+
const n = num2 === "" ? null : parseInt(num2, 10);
|
|
80085
80317
|
if (!inSub) {
|
|
80086
80318
|
current2.value = n;
|
|
80087
80319
|
current2.colon = true;
|
|
@@ -80089,9 +80321,9 @@ function parseParams(str) {
|
|
|
80089
80321
|
} else {
|
|
80090
80322
|
if (n !== null) current2.subparams.push(n);
|
|
80091
80323
|
}
|
|
80092
|
-
|
|
80324
|
+
num2 = "";
|
|
80093
80325
|
} else if (c3 >= "0" && c3 <= "9") {
|
|
80094
|
-
|
|
80326
|
+
num2 += c3;
|
|
80095
80327
|
}
|
|
80096
80328
|
}
|
|
80097
80329
|
return result;
|
|
@@ -80301,9 +80533,9 @@ function isEmoji(codePoint) {
|
|
|
80301
80533
|
function isEastAsianWide(codePoint) {
|
|
80302
80534
|
return codePoint >= 4352 && codePoint <= 4447 || codePoint >= 11904 && codePoint <= 40959 || codePoint >= 44032 && codePoint <= 55203 || codePoint >= 63744 && codePoint <= 64255 || codePoint >= 65040 && codePoint <= 65055 || codePoint >= 65072 && codePoint <= 65135 || codePoint >= 65280 && codePoint <= 65376 || codePoint >= 65504 && codePoint <= 65510 || codePoint >= 131072 && codePoint <= 196605 || codePoint >= 196608 && codePoint <= 262141;
|
|
80303
80535
|
}
|
|
80304
|
-
function hasMultipleCodepoints(
|
|
80536
|
+
function hasMultipleCodepoints(str2) {
|
|
80305
80537
|
let count = 0;
|
|
80306
|
-
for (const _2 of
|
|
80538
|
+
for (const _2 of str2) {
|
|
80307
80539
|
count++;
|
|
80308
80540
|
if (count > 1) return true;
|
|
80309
80541
|
}
|
|
@@ -80316,8 +80548,8 @@ function graphemeWidth(grapheme) {
|
|
|
80316
80548
|
if (isEmoji(codePoint) || isEastAsianWide(codePoint)) return 2;
|
|
80317
80549
|
return 1;
|
|
80318
80550
|
}
|
|
80319
|
-
function* segmentGraphemes(
|
|
80320
|
-
for (const { segment } of getGraphemeSegmenter().segment(
|
|
80551
|
+
function* segmentGraphemes(str2) {
|
|
80552
|
+
for (const { segment } of getGraphemeSegmenter().segment(str2)) {
|
|
80321
80553
|
yield { value: segment, width: graphemeWidth(segment) };
|
|
80322
80554
|
}
|
|
80323
80555
|
}
|
|
@@ -81474,69 +81706,69 @@ var CHALK_BOOSTED_FOR_XTERMJS = boostChalkLevelForXtermJs();
|
|
|
81474
81706
|
var CHALK_CLAMPED_FOR_TMUX = clampChalkLevelForTmux();
|
|
81475
81707
|
var RGB_REGEX = /^rgb\(\s?(\d+),\s?(\d+),\s?(\d+)\s?\)$/;
|
|
81476
81708
|
var ANSI_REGEX = /^ansi256\(\s?(\d+)\s?\)$/;
|
|
81477
|
-
var colorize = (
|
|
81709
|
+
var colorize = (str2, color, type) => {
|
|
81478
81710
|
if (!color) {
|
|
81479
|
-
return
|
|
81711
|
+
return str2;
|
|
81480
81712
|
}
|
|
81481
81713
|
if (color.startsWith("ansi:")) {
|
|
81482
81714
|
const value = color.substring("ansi:".length);
|
|
81483
81715
|
switch (value) {
|
|
81484
81716
|
case "black":
|
|
81485
|
-
return type === "foreground" ? import_chalk.default.black(
|
|
81717
|
+
return type === "foreground" ? import_chalk.default.black(str2) : import_chalk.default.bgBlack(str2);
|
|
81486
81718
|
case "red":
|
|
81487
|
-
return type === "foreground" ? import_chalk.default.red(
|
|
81719
|
+
return type === "foreground" ? import_chalk.default.red(str2) : import_chalk.default.bgRed(str2);
|
|
81488
81720
|
case "green":
|
|
81489
|
-
return type === "foreground" ? import_chalk.default.green(
|
|
81721
|
+
return type === "foreground" ? import_chalk.default.green(str2) : import_chalk.default.bgGreen(str2);
|
|
81490
81722
|
case "yellow":
|
|
81491
|
-
return type === "foreground" ? import_chalk.default.yellow(
|
|
81723
|
+
return type === "foreground" ? import_chalk.default.yellow(str2) : import_chalk.default.bgYellow(str2);
|
|
81492
81724
|
case "blue":
|
|
81493
|
-
return type === "foreground" ? import_chalk.default.blue(
|
|
81725
|
+
return type === "foreground" ? import_chalk.default.blue(str2) : import_chalk.default.bgBlue(str2);
|
|
81494
81726
|
case "magenta":
|
|
81495
|
-
return type === "foreground" ? import_chalk.default.magenta(
|
|
81727
|
+
return type === "foreground" ? import_chalk.default.magenta(str2) : import_chalk.default.bgMagenta(str2);
|
|
81496
81728
|
case "cyan":
|
|
81497
|
-
return type === "foreground" ? import_chalk.default.cyan(
|
|
81729
|
+
return type === "foreground" ? import_chalk.default.cyan(str2) : import_chalk.default.bgCyan(str2);
|
|
81498
81730
|
case "white":
|
|
81499
|
-
return type === "foreground" ? import_chalk.default.white(
|
|
81731
|
+
return type === "foreground" ? import_chalk.default.white(str2) : import_chalk.default.bgWhite(str2);
|
|
81500
81732
|
case "blackBright":
|
|
81501
|
-
return type === "foreground" ? import_chalk.default.blackBright(
|
|
81733
|
+
return type === "foreground" ? import_chalk.default.blackBright(str2) : import_chalk.default.bgBlackBright(str2);
|
|
81502
81734
|
case "redBright":
|
|
81503
|
-
return type === "foreground" ? import_chalk.default.redBright(
|
|
81735
|
+
return type === "foreground" ? import_chalk.default.redBright(str2) : import_chalk.default.bgRedBright(str2);
|
|
81504
81736
|
case "greenBright":
|
|
81505
|
-
return type === "foreground" ? import_chalk.default.greenBright(
|
|
81737
|
+
return type === "foreground" ? import_chalk.default.greenBright(str2) : import_chalk.default.bgGreenBright(str2);
|
|
81506
81738
|
case "yellowBright":
|
|
81507
|
-
return type === "foreground" ? import_chalk.default.yellowBright(
|
|
81739
|
+
return type === "foreground" ? import_chalk.default.yellowBright(str2) : import_chalk.default.bgYellowBright(str2);
|
|
81508
81740
|
case "blueBright":
|
|
81509
|
-
return type === "foreground" ? import_chalk.default.blueBright(
|
|
81741
|
+
return type === "foreground" ? import_chalk.default.blueBright(str2) : import_chalk.default.bgBlueBright(str2);
|
|
81510
81742
|
case "magentaBright":
|
|
81511
|
-
return type === "foreground" ? import_chalk.default.magentaBright(
|
|
81743
|
+
return type === "foreground" ? import_chalk.default.magentaBright(str2) : import_chalk.default.bgMagentaBright(str2);
|
|
81512
81744
|
case "cyanBright":
|
|
81513
|
-
return type === "foreground" ? import_chalk.default.cyanBright(
|
|
81745
|
+
return type === "foreground" ? import_chalk.default.cyanBright(str2) : import_chalk.default.bgCyanBright(str2);
|
|
81514
81746
|
case "whiteBright":
|
|
81515
|
-
return type === "foreground" ? import_chalk.default.whiteBright(
|
|
81747
|
+
return type === "foreground" ? import_chalk.default.whiteBright(str2) : import_chalk.default.bgWhiteBright(str2);
|
|
81516
81748
|
}
|
|
81517
81749
|
}
|
|
81518
81750
|
if (color.startsWith("#")) {
|
|
81519
|
-
return type === "foreground" ? import_chalk.default.hex(color)(
|
|
81751
|
+
return type === "foreground" ? import_chalk.default.hex(color)(str2) : import_chalk.default.bgHex(color)(str2);
|
|
81520
81752
|
}
|
|
81521
81753
|
if (color.startsWith("ansi256")) {
|
|
81522
81754
|
const matches = ANSI_REGEX.exec(color);
|
|
81523
81755
|
if (!matches) {
|
|
81524
|
-
return
|
|
81756
|
+
return str2;
|
|
81525
81757
|
}
|
|
81526
81758
|
const value = Number(matches[1]);
|
|
81527
|
-
return type === "foreground" ? import_chalk.default.ansi256(value)(
|
|
81759
|
+
return type === "foreground" ? import_chalk.default.ansi256(value)(str2) : import_chalk.default.bgAnsi256(value)(str2);
|
|
81528
81760
|
}
|
|
81529
81761
|
if (color.startsWith("rgb")) {
|
|
81530
81762
|
const matches = RGB_REGEX.exec(color);
|
|
81531
81763
|
if (!matches) {
|
|
81532
|
-
return
|
|
81764
|
+
return str2;
|
|
81533
81765
|
}
|
|
81534
81766
|
const firstValue = Number(matches[1]);
|
|
81535
81767
|
const secondValue = Number(matches[2]);
|
|
81536
81768
|
const thirdValue = Number(matches[3]);
|
|
81537
|
-
return type === "foreground" ? import_chalk.default.rgb(firstValue, secondValue, thirdValue)(
|
|
81769
|
+
return type === "foreground" ? import_chalk.default.rgb(firstValue, secondValue, thirdValue)(str2) : import_chalk.default.bgRgb(firstValue, secondValue, thirdValue)(str2);
|
|
81538
81770
|
}
|
|
81539
|
-
return
|
|
81771
|
+
return str2;
|
|
81540
81772
|
};
|
|
81541
81773
|
function applyTextStyles(text, styles3) {
|
|
81542
81774
|
let result = text;
|
|
@@ -82340,12 +82572,12 @@ var StylePool = class {
|
|
|
82340
82572
|
transition(fromId, toId) {
|
|
82341
82573
|
if (fromId === toId) return "";
|
|
82342
82574
|
const key = fromId * 1048576 + toId;
|
|
82343
|
-
let
|
|
82344
|
-
if (
|
|
82345
|
-
|
|
82346
|
-
this.transitionCache.set(key,
|
|
82575
|
+
let str2 = this.transitionCache.get(key);
|
|
82576
|
+
if (str2 === void 0) {
|
|
82577
|
+
str2 = ansiCodesToString(diffAnsiCodes(this.get(fromId), this.get(toId)));
|
|
82578
|
+
this.transitionCache.set(key, str2);
|
|
82347
82579
|
}
|
|
82348
|
-
return
|
|
82580
|
+
return str2;
|
|
82349
82581
|
}
|
|
82350
82582
|
/**
|
|
82351
82583
|
* Intern a style that is `base + inverse`. Cached by base ID so
|
|
@@ -84830,9 +85062,9 @@ function transitionHyperlink(diff3, current2, target) {
|
|
|
84830
85062
|
return current2;
|
|
84831
85063
|
}
|
|
84832
85064
|
function transitionStyle(diff3, stylePool, currentId, targetId) {
|
|
84833
|
-
const
|
|
84834
|
-
if (
|
|
84835
|
-
diff3.push({ type: "styleStr", str });
|
|
85065
|
+
const str2 = stylePool.transition(currentId, targetId);
|
|
85066
|
+
if (str2.length > 0) {
|
|
85067
|
+
diff3.push({ type: "styleStr", str: str2 });
|
|
84836
85068
|
}
|
|
84837
85069
|
return targetId;
|
|
84838
85070
|
}
|
|
@@ -88422,8 +88654,19 @@ var darkTheme = {
|
|
|
88422
88654
|
contextCometFragment: "#7c5cbf",
|
|
88423
88655
|
contextCometDust: "#4a3d66",
|
|
88424
88656
|
border: "#808080",
|
|
88425
|
-
|
|
88426
|
-
|
|
88657
|
+
// Diff layers (see the Theme interface): near-black bands a step apart, loud
|
|
88658
|
+
// color reserved for the +/- decorations, bright off-white plain text. The
|
|
88659
|
+
// hues are Orion's own family — EMERALD for additions (cooler than a leaf
|
|
88660
|
+
// green; the decoration green IS the app's semantic green, autoAccept, so
|
|
88661
|
+
// the diff and the posture/success chrome speak one color) and ROSE for
|
|
88662
|
+
// removals (sits naturally beside the violet brand).
|
|
88663
|
+
diffAdd: "#3fb950",
|
|
88664
|
+
diffRemove: "#e5484d",
|
|
88665
|
+
diffAddBg: "#022711",
|
|
88666
|
+
diffRemoveBg: "#330210",
|
|
88667
|
+
diffAddWordBg: "#044921",
|
|
88668
|
+
diffRemoveWordBg: "#4d0416",
|
|
88669
|
+
diffText: "#f8f8f2",
|
|
88427
88670
|
diffContext: "#808080",
|
|
88428
88671
|
gutter: "#808080",
|
|
88429
88672
|
synKeyword: "#569cd6",
|
|
@@ -88433,11 +88676,6 @@ var darkTheme = {
|
|
|
88433
88676
|
synType: "#4ec9b0",
|
|
88434
88677
|
synComment: "#6a9955",
|
|
88435
88678
|
synControl: "#c586c0",
|
|
88436
|
-
// Per-line diff BASE bands (muted). The brighter diffAdd/diffRemove ride on top
|
|
88437
|
-
// as word-level change highlights, so a small edit shows a two-tone line instead
|
|
88438
|
-
// of one flat wash.
|
|
88439
|
-
diffAddBg: "#225c2b",
|
|
88440
|
-
diffRemoveBg: "#7a2936",
|
|
88441
88679
|
autoAccept: "#3fb950",
|
|
88442
88680
|
planMode: "#38bdf8",
|
|
88443
88681
|
duetMode: "#a78bfa",
|
|
@@ -88478,8 +88716,17 @@ var lightTheme = {
|
|
|
88478
88716
|
contextCometFragment: "#8b6fd4",
|
|
88479
88717
|
contextCometDust: "#b9a9dd",
|
|
88480
88718
|
border: "#808080",
|
|
88481
|
-
|
|
88482
|
-
|
|
88719
|
+
// Diff layers (see the Theme interface), mirrored for a light terminal: the
|
|
88720
|
+
// bands are the palest wash, the word step is deeper, decorations deeper
|
|
88721
|
+
// still. Same Orion family as dark — emerald additions (decoration green =
|
|
88722
|
+
// autoAccept, the app's semantic green) and rose removals.
|
|
88723
|
+
diffAdd: "#15803d",
|
|
88724
|
+
diffRemove: "#cf2240",
|
|
88725
|
+
diffAddBg: "#d9fbe8",
|
|
88726
|
+
diffRemoveBg: "#ffdce4",
|
|
88727
|
+
diffAddWordBg: "#aff5cd",
|
|
88728
|
+
diffRemoveWordBg: "#ffc2cf",
|
|
88729
|
+
diffText: "#333333",
|
|
88483
88730
|
diffContext: "#808080",
|
|
88484
88731
|
gutter: "#808080",
|
|
88485
88732
|
synKeyword: "#0000ff",
|
|
@@ -88489,8 +88736,6 @@ var lightTheme = {
|
|
|
88489
88736
|
synType: "#267f99",
|
|
88490
88737
|
synComment: "#008000",
|
|
88491
88738
|
synControl: "#af00db",
|
|
88492
|
-
diffAddBg: "#a6f3b0",
|
|
88493
|
-
diffRemoveBg: "#ffc9d0",
|
|
88494
88739
|
autoAccept: "#15803d",
|
|
88495
88740
|
planMode: "#267f99",
|
|
88496
88741
|
duetMode: "#7c3aed",
|
|
@@ -88734,6 +88979,11 @@ async function transportBearer(session, store, fallback) {
|
|
|
88734
88979
|
if (!token) await syncAccountGate(session, store);
|
|
88735
88980
|
return token ?? fallback ?? null;
|
|
88736
88981
|
}
|
|
88982
|
+
async function renewedTransportBearer(session, store, refused, fallback) {
|
|
88983
|
+
const token = await session.renewedAccessToken(refused);
|
|
88984
|
+
if (!token) await syncAccountGate(session, store);
|
|
88985
|
+
return token ?? fallback ?? null;
|
|
88986
|
+
}
|
|
88737
88987
|
var SIGN_IN_FIRST_MESSAGE = "Sign in first with /signin to start chatting.";
|
|
88738
88988
|
function isAuthDeadError(e) {
|
|
88739
88989
|
return /\bhttp 401\b/.test(e instanceof Error ? e.message : String(e));
|
|
@@ -89586,6 +89836,40 @@ function projectMessages(messages) {
|
|
|
89586
89836
|
}
|
|
89587
89837
|
return groupToolRuns(out2);
|
|
89588
89838
|
}
|
|
89839
|
+
var str = (v2) => typeof v2 === "string";
|
|
89840
|
+
var num = (v2) => typeof v2 === "number" && Number.isFinite(v2);
|
|
89841
|
+
var rec = (v2) => !!v2 && typeof v2 === "object" && !Array.isArray(v2);
|
|
89842
|
+
var REVIVE_CHECKS = {
|
|
89843
|
+
user: (x2) => str(x2.text),
|
|
89844
|
+
command: (x2) => str(x2.name) && str(x2.args),
|
|
89845
|
+
assistant: (x2) => str(x2.text),
|
|
89846
|
+
thinking: (x2) => str(x2.text) && (x2.durationMs === void 0 || num(x2.durationMs)),
|
|
89847
|
+
tool: (x2) => str(x2.name) && str(x2.args) && (x2.status === "ok" || x2.status === "error"),
|
|
89848
|
+
toolgroup: (x2) => Array.isArray(x2.tools) && x2.tools.length > 0 && x2.tools.every((t) => isRevivableItem(t) && t.kind === "tool"),
|
|
89849
|
+
diff: (x2) => str(x2.path) && (x2.diff === null || str(x2.diff)) && num(x2.insertions) && num(x2.deletions) && typeof x2.deleted === "boolean" && // Optional decorations, validated when present: DiffCard maps/joins these
|
|
89850
|
+
// unconditionally once they exist, so a malformed shape would throw.
|
|
89851
|
+
(x2.affectedFiles === void 0 || Array.isArray(x2.affectedFiles) && x2.affectedFiles.every(str)) && (x2.trust === void 0 || rec(x2.trust) && Array.isArray(x2.trust.findings)),
|
|
89852
|
+
terminal: (x2) => str(x2.command) && str(x2.output) && (x2.exitCode === null || num(x2.exitCode)),
|
|
89853
|
+
note: (x2) => str(x2.text) && (x2.stats === void 0 || rec(x2.stats) && num(x2.stats.insertions) && num(x2.stats.deletions)),
|
|
89854
|
+
goalEnd: (x2) => rec(x2.row),
|
|
89855
|
+
subagents: (x2) => Array.isArray(x2.agents) && x2.agents.every(rec),
|
|
89856
|
+
websearch: (x2) => str(x2.query) && Array.isArray(x2.results) && x2.results.every(str),
|
|
89857
|
+
inputguard: (x2) => rec(x2.card),
|
|
89858
|
+
compaction: (x2) => rec(x2.card),
|
|
89859
|
+
quota: (x2) => rec(x2.refusal),
|
|
89860
|
+
context: (x2) => str(x2.modelLabel) && str(x2.modelId) && num(x2.tokens) && num(x2.window) && rec(x2.breakdown),
|
|
89861
|
+
info: (x2) => str(x2.title) && Array.isArray(x2.rows) && x2.rows.every((r2) => Array.isArray(r2) || rec(r2))
|
|
89862
|
+
};
|
|
89863
|
+
function isRevivableItem(v2) {
|
|
89864
|
+
if (!rec(v2) || !str(v2.id)) return false;
|
|
89865
|
+
const check2 = REVIVE_CHECKS[v2.kind];
|
|
89866
|
+
return check2 !== void 0 && check2(v2);
|
|
89867
|
+
}
|
|
89868
|
+
function reviveTranscript(raw) {
|
|
89869
|
+
if (!Array.isArray(raw)) return null;
|
|
89870
|
+
const items = raw.filter(isRevivableItem);
|
|
89871
|
+
return items.length > 0 ? items : null;
|
|
89872
|
+
}
|
|
89589
89873
|
|
|
89590
89874
|
// src/state/transcriptStore.ts
|
|
89591
89875
|
var import_client_core12 = __toESM(require_dist(), 1);
|
|
@@ -89721,11 +90005,6 @@ function appendLiveCode(s, id, delta) {
|
|
|
89721
90005
|
if (!live.liveCode || live.liveCode.id !== id) return s;
|
|
89722
90006
|
return { ...s, live: { ...live, liveCode: { ...live.liveCode, code: live.liveCode.code + delta } } };
|
|
89723
90007
|
}
|
|
89724
|
-
function endLiveCode(s, id) {
|
|
89725
|
-
const live = s.live;
|
|
89726
|
-
if (!live?.liveCode || live.liveCode.id !== id) return s;
|
|
89727
|
-
return { ...s, live: { ...live, liveCode: null } };
|
|
89728
|
-
}
|
|
89729
90008
|
function startTool(s, name2, input) {
|
|
89730
90009
|
const flushed = flushLive(s);
|
|
89731
90010
|
const live = flushed.live ?? emptyLive();
|
|
@@ -89754,7 +90033,11 @@ function settleToolEnd(s, id, success, detail) {
|
|
|
89754
90033
|
}
|
|
89755
90034
|
const rest = { ...s.live.pendingWrites };
|
|
89756
90035
|
delete rest[id];
|
|
89757
|
-
const nextLive = {
|
|
90036
|
+
const nextLive = {
|
|
90037
|
+
...s.live,
|
|
90038
|
+
pendingWrites: rest,
|
|
90039
|
+
liveCode: s.live.liveCode && s.live.liveCode.id === id ? null : s.live.liveCode
|
|
90040
|
+
};
|
|
89758
90041
|
if (success) {
|
|
89759
90042
|
return { ...s, live: nextLive };
|
|
89760
90043
|
}
|
|
@@ -89809,7 +90092,10 @@ function fileModified(s, d2) {
|
|
|
89809
90092
|
affectedFiles: d2.affectedFiles,
|
|
89810
90093
|
trust: d2.trust
|
|
89811
90094
|
};
|
|
89812
|
-
|
|
90095
|
+
const block = f.live?.liveCode;
|
|
90096
|
+
const settlesBlock = !!block && (d2.toolId ? block.id === d2.toolId : block.path === d2.path);
|
|
90097
|
+
const live = settlesBlock && f.live ? { ...f.live, liveCode: null } : f.live;
|
|
90098
|
+
return { ...f, live, settled: [...f.settled, item] };
|
|
89813
90099
|
}
|
|
89814
90100
|
function applyTurnComplete(s, data) {
|
|
89815
90101
|
const flushed = flushLive(s);
|
|
@@ -89840,9 +90126,9 @@ function applyTurnInterrupted(s, prompt, partialReply = "") {
|
|
|
89840
90126
|
live: null
|
|
89841
90127
|
};
|
|
89842
90128
|
}
|
|
89843
|
-
function hydrate(sessionId, messages, clientState) {
|
|
90129
|
+
function hydrate(sessionId, messages, clientState, transcript) {
|
|
89844
90130
|
const msgs = Array.isArray(messages) ? messages : [];
|
|
89845
|
-
const settled = projectMessages(msgs);
|
|
90131
|
+
const settled = reviveTranscript(transcript) ?? projectMessages(msgs);
|
|
89846
90132
|
return {
|
|
89847
90133
|
sessionId,
|
|
89848
90134
|
messages: msgs,
|
|
@@ -90855,7 +91141,7 @@ function remoteView(r2) {
|
|
|
90855
91141
|
footer: "Switch with /remote on|off \xB7 hide or show this session with /remote hide|show."
|
|
90856
91142
|
};
|
|
90857
91143
|
}
|
|
90858
|
-
function goalView(running, goal, turns = 0, lastReason = null) {
|
|
91144
|
+
function goalView(running, goal, turns = 0, lastReason = null, lastClaim = null) {
|
|
90859
91145
|
if (!running) {
|
|
90860
91146
|
return {
|
|
90861
91147
|
title: "Goal",
|
|
@@ -90864,7 +91150,12 @@ function goalView(running, goal, turns = 0, lastReason = null) {
|
|
|
90864
91150
|
};
|
|
90865
91151
|
}
|
|
90866
91152
|
const rows = [statusRow("info", "Running", goal), statusRow("info", "Turns", String(turns))];
|
|
90867
|
-
if (
|
|
91153
|
+
if (lastClaim) {
|
|
91154
|
+
const claim = lastClaim.done ? "done" : "not done";
|
|
91155
|
+
const note = (0, import_client_core15.goalReasonLine)(lastClaim.note);
|
|
91156
|
+
rows.push(statusRow("info", "Agent reports", note ? `${claim} \u2014 ${note}` : claim));
|
|
91157
|
+
}
|
|
91158
|
+
if (lastReason) rows.push(statusRow("pending", "Last check", (0, import_client_core15.goalReasonLine)(lastReason)));
|
|
90868
91159
|
return {
|
|
90869
91160
|
title: "Goal",
|
|
90870
91161
|
tone: "info",
|
|
@@ -92091,12 +92382,12 @@ ${(0, import_client_core20.duetRoutingSummaryLine)(await (0, import_client_core2
|
|
|
92091
92382
|
if (availability.disabled) {
|
|
92092
92383
|
ctx.print(`${(0, import_client_core20.duetEntryLabel)(entry)}: ${availability.note ?? "unavailable"}`, "warning");
|
|
92093
92384
|
if (entry === "router" && routerStatus !== null) ctx.print((0, import_client_core20.duetRouterStatusLine)(routerStatus), "info");
|
|
92094
|
-
if (entry === "executor" && executorStatus !== null) ctx.print((0, import_client_core20.executorGateStatusLine)(executorStatus), "info");
|
|
92095
92385
|
return;
|
|
92096
92386
|
}
|
|
92097
92387
|
await (0, import_client_core20.setDuetEntry)(entry);
|
|
92098
92388
|
const option = import_client_core20.DUET_ENTRY_OPTIONS.find((o) => o.value === entry);
|
|
92099
92389
|
ctx.print(`${import_client_core20.DUET_ENTRY_INFO.label}: ${(0, import_client_core20.duetEntryLabel)(entry)} \u2014 ${option?.description ?? ""}`, "success");
|
|
92390
|
+
if (entry === "executor" && executorStatus !== null) ctx.print((0, import_client_core20.executorGateStatusLine)(executorStatus), "info");
|
|
92100
92391
|
};
|
|
92101
92392
|
if (typed !== null) {
|
|
92102
92393
|
await save(typed);
|
|
@@ -92117,7 +92408,9 @@ ${(0, import_client_core20.duetRoutingSummaryLine)(await (0, import_client_core2
|
|
|
92117
92408
|
return {
|
|
92118
92409
|
label: option.label,
|
|
92119
92410
|
value: option.value,
|
|
92120
|
-
//
|
|
92411
|
+
// The row's note — what this pick means on THIS machine (a refusal reason for
|
|
92412
|
+
// the router, the rules-floor explainer for the executor) — beats the generic
|
|
92413
|
+
// description.
|
|
92121
92414
|
hint: availability.note ?? (option.value === active ? "(active)" : option.description),
|
|
92122
92415
|
accent: option.value === active
|
|
92123
92416
|
};
|
|
@@ -93802,7 +94095,7 @@ Answer with /loops answer <text>, or /loops deny.`,
|
|
|
93802
94095
|
kind: "local",
|
|
93803
94096
|
name: "goal",
|
|
93804
94097
|
aliases: ["goals"],
|
|
93805
|
-
description: "Work continuously until the goal is complete \u2014
|
|
94098
|
+
description: "Work continuously until the goal is complete \u2014 an independent check confirms it's done",
|
|
93806
94099
|
argumentHint: "<what to accomplish | status | stop>",
|
|
93807
94100
|
// Starting a goal starts a TURN — typed mid-turn it defers to the queue
|
|
93808
94101
|
// (runs when the turn ends) rather than racing the live stream. The verb
|
|
@@ -93822,7 +94115,7 @@ Answer with /loops answer <text>, or /loops deny.`,
|
|
|
93822
94115
|
}
|
|
93823
94116
|
if (arg === "" || lower === "status") {
|
|
93824
94117
|
const st2 = ctx.goals.status();
|
|
93825
|
-
return ctx.printInfo(goalView(st2.running, st2.goal, st2.turns ?? 0, st2.lastReason ?? null));
|
|
94118
|
+
return ctx.printInfo(goalView(st2.running, st2.goal, st2.turns ?? 0, st2.lastReason ?? null, st2.lastClaim ?? null));
|
|
93826
94119
|
}
|
|
93827
94120
|
if (ctx.goals.status().running) {
|
|
93828
94121
|
return ctx.print("A goal is already running \u2014 /goal stop first, or steer it by typing normally.", "warning");
|
|
@@ -94120,13 +94413,13 @@ function writeAtomic(file, data) {
|
|
|
94120
94413
|
fs11.renameSync(tmp, file);
|
|
94121
94414
|
}
|
|
94122
94415
|
var saveFailureWarned = false;
|
|
94123
|
-
function saveSession(
|
|
94416
|
+
function saveSession(rec2) {
|
|
94124
94417
|
try {
|
|
94125
94418
|
ensureDirs();
|
|
94126
|
-
writeAtomic(sessionFile(
|
|
94419
|
+
writeAtomic(sessionFile(rec2.sessionId), `${JSON.stringify(rec2, null, 2)}
|
|
94127
94420
|
`);
|
|
94128
|
-
const idx = loadIndex().filter((e) => e.sessionId !==
|
|
94129
|
-
idx.unshift({ sessionId:
|
|
94421
|
+
const idx = loadIndex().filter((e) => e.sessionId !== rec2.sessionId);
|
|
94422
|
+
idx.unshift({ sessionId: rec2.sessionId, title: rec2.title, updatedAt: rec2.updatedAt });
|
|
94130
94423
|
writeAtomic(indexFile(), `${JSON.stringify(idx.slice(0, 100), null, 2)}
|
|
94131
94424
|
`);
|
|
94132
94425
|
return true;
|
|
@@ -94148,9 +94441,9 @@ function loadSession(sessionId) {
|
|
|
94148
94441
|
}
|
|
94149
94442
|
}
|
|
94150
94443
|
function renameSession(sessionId, title) {
|
|
94151
|
-
const
|
|
94152
|
-
if (!
|
|
94153
|
-
return saveSession({ ...
|
|
94444
|
+
const rec2 = loadSession(sessionId);
|
|
94445
|
+
if (!rec2) return false;
|
|
94446
|
+
return saveSession({ ...rec2, title, updatedAt: Date.now() });
|
|
94154
94447
|
}
|
|
94155
94448
|
var pendingModelTitles = /* @__PURE__ */ new Map();
|
|
94156
94449
|
function applyModelSessionTitle(sessionId, title) {
|
|
@@ -94408,6 +94701,9 @@ function renderLane(transcript, app, ev) {
|
|
|
94408
94701
|
transcript.setState(
|
|
94409
94702
|
(s) => fileModified(s, {
|
|
94410
94703
|
path: String(d2.path ?? ""),
|
|
94704
|
+
// The causing call — pairs the diff card with the frozen live code
|
|
94705
|
+
// block it settles (rewind-emitted events legitimately omit it).
|
|
94706
|
+
toolId: typeof d2.tool_id === "string" ? d2.tool_id : void 0,
|
|
94411
94707
|
diff: typeof d2.diff === "string" ? d2.diff : null,
|
|
94412
94708
|
insertions: typeof d2.insertions === "number" ? d2.insertions : 0,
|
|
94413
94709
|
deletions: typeof d2.deletions === "number" ? d2.deletions : 0,
|
|
@@ -94618,11 +94914,8 @@ function renderLane(transcript, app, ev) {
|
|
|
94618
94914
|
}
|
|
94619
94915
|
break;
|
|
94620
94916
|
}
|
|
94621
|
-
case "tool_input_end":
|
|
94622
|
-
const id = typeof d2.tool_id === "string" ? d2.tool_id : "";
|
|
94623
|
-
if (id) transcript.setState((s) => endLiveCode(s, id));
|
|
94917
|
+
case "tool_input_end":
|
|
94624
94918
|
break;
|
|
94625
|
-
}
|
|
94626
94919
|
case "tool_progress": {
|
|
94627
94920
|
const kind = typeof d2.kind === "string" ? d2.kind : "working";
|
|
94628
94921
|
app.setState((s) => ({ ...s, statusText: `${kind}\u2026` }));
|
|
@@ -94752,7 +95045,7 @@ function makeGoalRunTurn(deps2) {
|
|
|
94752
95045
|
}
|
|
94753
95046
|
switch (outcome.kind) {
|
|
94754
95047
|
case "complete":
|
|
94755
|
-
return { text: outcome.finalText, evidence: outcome.evidence };
|
|
95048
|
+
return { text: outcome.finalText, evidence: outcome.evidence, claim: outcome.claim };
|
|
94756
95049
|
case "cancelled":
|
|
94757
95050
|
return "";
|
|
94758
95051
|
case "error":
|
|
@@ -95197,7 +95490,7 @@ var WorkPlanApprovalBridge = class {
|
|
|
95197
95490
|
var import_client_ui_core20 = __toESM(require_dist2(), 1);
|
|
95198
95491
|
|
|
95199
95492
|
// src/components/layout/Transcript.tsx
|
|
95200
|
-
var
|
|
95493
|
+
var import_react28 = __toESM(require_react(), 1);
|
|
95201
95494
|
|
|
95202
95495
|
// src/components/messages/MessageView.tsx
|
|
95203
95496
|
var import_react23 = __toESM(require_react(), 1);
|
|
@@ -111212,7 +111505,27 @@ function expandTabs2(s) {
|
|
|
111212
111505
|
}
|
|
111213
111506
|
return out2;
|
|
111214
111507
|
}
|
|
111215
|
-
function
|
|
111508
|
+
function diffLineStyle(theme, kind) {
|
|
111509
|
+
switch (kind) {
|
|
111510
|
+
case "add":
|
|
111511
|
+
return {
|
|
111512
|
+
bg: theme.diffAddBg,
|
|
111513
|
+
wordBg: theme.diffAddWordBg,
|
|
111514
|
+
accent: theme.diffAdd,
|
|
111515
|
+
text: theme.diffText
|
|
111516
|
+
};
|
|
111517
|
+
case "del":
|
|
111518
|
+
return {
|
|
111519
|
+
bg: theme.diffRemoveBg,
|
|
111520
|
+
wordBg: theme.diffRemoveWordBg,
|
|
111521
|
+
accent: theme.diffRemove,
|
|
111522
|
+
text: theme.diffText
|
|
111523
|
+
};
|
|
111524
|
+
case "context":
|
|
111525
|
+
return { accent: theme.gutter, text: theme.diffText };
|
|
111526
|
+
}
|
|
111527
|
+
}
|
|
111528
|
+
function wordRuns(shown, lang, changed, baseBg, brightBg, syntax, plainFg, theme) {
|
|
111216
111529
|
let text;
|
|
111217
111530
|
let fgs;
|
|
111218
111531
|
if (syntax) {
|
|
@@ -111220,12 +111533,12 @@ function wordRuns(shown, lang, changed, baseBg, brightBg, syntax, theme) {
|
|
|
111220
111533
|
text = spans.map((s) => s.text).join("");
|
|
111221
111534
|
fgs = [];
|
|
111222
111535
|
for (const sp of spans) {
|
|
111223
|
-
const fg = synColor(theme, sp.kind);
|
|
111536
|
+
const fg = synColor(theme, sp.kind) ?? plainFg;
|
|
111224
111537
|
for (let c3 = 0; c3 < sp.text.length; c3++) fgs.push(fg);
|
|
111225
111538
|
}
|
|
111226
111539
|
} else {
|
|
111227
111540
|
text = shown;
|
|
111228
|
-
fgs = new Array(shown.length).fill(
|
|
111541
|
+
fgs = new Array(shown.length).fill(plainFg);
|
|
111229
111542
|
}
|
|
111230
111543
|
const bgAt = (k) => changed[k] ? brightBg : baseBg;
|
|
111231
111544
|
const runs = [];
|
|
@@ -111261,10 +111574,12 @@ function StructuredDiff({
|
|
|
111261
111574
|
}
|
|
111262
111575
|
const isAdd = l3.type === "add";
|
|
111263
111576
|
const isDel = l3.type === "del";
|
|
111264
|
-
const bg
|
|
111265
|
-
|
|
111577
|
+
const { bg, wordBg, accent, text } = diffLineStyle(
|
|
111578
|
+
theme,
|
|
111579
|
+
isAdd ? "add" : isDel ? "del" : "context"
|
|
111580
|
+
);
|
|
111266
111581
|
const marker = isAdd ? "+" : isDel ? "-" : " ";
|
|
111267
|
-
const
|
|
111582
|
+
const num2 = isDel ? l3.oldNo : l3.newNo;
|
|
111268
111583
|
const raw = expandTabs2(l3.text ?? "");
|
|
111269
111584
|
const shown = (raw.length > textWidth ? raw.slice(0, textWidth) : raw) || " ";
|
|
111270
111585
|
const pad = bg ? " ".repeat(Math.max(0, textWidth - shown.length)) : "";
|
|
@@ -111279,10 +111594,10 @@ function StructuredDiff({
|
|
|
111279
111594
|
while (changed.length < shown.length) changed.push(false);
|
|
111280
111595
|
}
|
|
111281
111596
|
}
|
|
111282
|
-
const body2 = changed ? wordRuns(shown, lang, changed, bg,
|
|
111597
|
+
const body2 = changed ? wordRuns(shown, lang, changed, bg, wordBg, isAdd, text, theme) : isDel ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Text2, { color: text, children: shown }) : (highlightCode(shown, lang)[0] ?? []).map((sp, k) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Text2, { color: synColor(theme, sp.kind) ?? text, children: sp.text }, k));
|
|
111283
111598
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Text2, { backgroundColor: bg, children: [
|
|
111284
111599
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Text2, { color: accent, children: [
|
|
111285
|
-
gutter(
|
|
111600
|
+
gutter(num2),
|
|
111286
111601
|
" "
|
|
111287
111602
|
] }),
|
|
111288
111603
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Text2, { color: accent, children: [
|
|
@@ -111787,7 +112102,7 @@ function OrionRing() {
|
|
|
111787
112102
|
|
|
111788
112103
|
// src/services/version.ts
|
|
111789
112104
|
function tuiVersion() {
|
|
111790
|
-
return "0.1.
|
|
112105
|
+
return "0.1.26".length > 0 ? "0.1.26" : null;
|
|
111791
112106
|
}
|
|
111792
112107
|
|
|
111793
112108
|
// src/components/layout/WelcomeCard.tsx
|
|
@@ -111826,18 +112141,48 @@ var import_client_ui_core9 = __toESM(require_dist2(), 1);
|
|
|
111826
112141
|
var import_client_core29 = __toESM(require_dist(), 1);
|
|
111827
112142
|
|
|
111828
112143
|
// src/components/messages/Thinking.tsx
|
|
112144
|
+
var import_react24 = __toESM(require_react(), 1);
|
|
111829
112145
|
var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1);
|
|
111830
|
-
var
|
|
111831
|
-
|
|
111832
|
-
|
|
111833
|
-
|
|
111834
|
-
|
|
112146
|
+
var LIVE_ROWS = 12;
|
|
112147
|
+
function wrapPlain(line, width) {
|
|
112148
|
+
const rows = [];
|
|
112149
|
+
let row = null;
|
|
112150
|
+
for (const word of line.split(" ")) {
|
|
112151
|
+
let w2 = word;
|
|
112152
|
+
while (w2.length > width) {
|
|
112153
|
+
if (row !== null) {
|
|
112154
|
+
rows.push(row);
|
|
112155
|
+
row = null;
|
|
112156
|
+
}
|
|
112157
|
+
rows.push(w2.slice(0, width));
|
|
112158
|
+
w2 = w2.slice(width);
|
|
112159
|
+
}
|
|
112160
|
+
if (w2 === "" && word !== "") continue;
|
|
112161
|
+
if (row === null) row = w2;
|
|
112162
|
+
else if (row.length + 1 + w2.length <= width) row += ` ${w2}`;
|
|
112163
|
+
else {
|
|
112164
|
+
rows.push(row);
|
|
112165
|
+
row = w2;
|
|
112166
|
+
}
|
|
112167
|
+
}
|
|
112168
|
+
if (row !== null) rows.push(row);
|
|
112169
|
+
return rows.length ? rows : [""];
|
|
112170
|
+
}
|
|
112171
|
+
function thinkingTailRows(text, width) {
|
|
112172
|
+
const w2 = Math.max(1, Math.floor(width));
|
|
112173
|
+
const tail = text.split("\n").slice(-LIVE_ROWS).join("\n").trimEnd();
|
|
112174
|
+
if (!tail) return [];
|
|
112175
|
+
const rows = [];
|
|
112176
|
+
for (const line of tail.split("\n")) rows.push(...wrapPlain(line, w2));
|
|
112177
|
+
return rows.slice(-LIVE_ROWS);
|
|
111835
112178
|
}
|
|
111836
112179
|
function Thinking({
|
|
111837
112180
|
text,
|
|
111838
112181
|
spinner = ""
|
|
111839
112182
|
}) {
|
|
111840
112183
|
const { columns } = useTerminalSize();
|
|
112184
|
+
const width = Math.max(20, columns - 4);
|
|
112185
|
+
const rows = import_react24.default.useMemo(() => thinkingTailRows(text, width), [text, width]);
|
|
111841
112186
|
if (!text.trim()) return null;
|
|
111842
112187
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Box2, { flexDirection: "column", marginTop: 1, children: [
|
|
111843
112188
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Box2, { flexDirection: "row", children: [
|
|
@@ -111845,7 +112190,7 @@ function Thinking({
|
|
|
111845
112190
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ThemedText, { dim: true, italic: true, children: "Thinking" }),
|
|
111846
112191
|
spinner ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ThemedText, { colorKey: "spinner", children: ` ${spinner}` }) : null
|
|
111847
112192
|
] }),
|
|
111848
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Box2, { paddingLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Box2, { width:
|
|
112193
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Box2, { paddingLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Box2, { width, flexDirection: "column", children: rows.map((row, i2) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ThemedText, { dim: true, italic: true, wrap: "truncate-end", children: row.length ? row : " " }, i2)) }) })
|
|
111849
112194
|
] });
|
|
111850
112195
|
}
|
|
111851
112196
|
|
|
@@ -111923,21 +112268,21 @@ function LiveCode({
|
|
|
111923
112268
|
}
|
|
111924
112269
|
|
|
111925
112270
|
// src/hooks/useStore.ts
|
|
111926
|
-
var
|
|
112271
|
+
var import_react25 = __toESM(require_react(), 1);
|
|
111927
112272
|
function useStoreSelector(store, selector) {
|
|
111928
|
-
return (0,
|
|
112273
|
+
return (0, import_react25.useSyncExternalStore)(
|
|
111929
112274
|
store.subscribe,
|
|
111930
112275
|
() => selector(store.getState())
|
|
111931
112276
|
);
|
|
111932
112277
|
}
|
|
111933
112278
|
|
|
111934
112279
|
// src/hooks/useTranscriptEviction.ts
|
|
111935
|
-
var
|
|
112280
|
+
var import_react27 = __toESM(require_react(), 1);
|
|
111936
112281
|
|
|
111937
112282
|
// src/vendor/ink/hooks/use-committed-rows.ts
|
|
111938
|
-
var
|
|
112283
|
+
var import_react26 = __toESM(require_react(), 1);
|
|
111939
112284
|
function useCommittedRows() {
|
|
111940
|
-
return (0,
|
|
112285
|
+
return (0, import_react26.useContext)(CommittedRowsContext);
|
|
111941
112286
|
}
|
|
111942
112287
|
|
|
111943
112288
|
// src/hooks/useTranscriptEviction.ts
|
|
@@ -111963,14 +112308,14 @@ function useTranscriptEviction({
|
|
|
111963
112308
|
getItemsContainer
|
|
111964
112309
|
}) {
|
|
111965
112310
|
const api = useCommittedRows();
|
|
111966
|
-
const forkSize = (0,
|
|
112311
|
+
const forkSize = (0, import_react27.useContext)(TerminalSizeContext);
|
|
111967
112312
|
const fallbackSize = useTerminalSize();
|
|
111968
112313
|
const rows = forkSize?.rows ?? fallbackSize.rows;
|
|
111969
112314
|
const evictedCount = useStoreSelector(transcriptStore, (s) => s.evictedCount);
|
|
111970
112315
|
const committedCount = useStoreSelector(transcriptStore, (s) => s.committedCount);
|
|
111971
|
-
const apiRef = (0,
|
|
112316
|
+
const apiRef = (0, import_react27.useRef)(api);
|
|
111972
112317
|
apiRef.current = api;
|
|
111973
|
-
(0,
|
|
112318
|
+
(0, import_react27.useLayoutEffect)(() => {
|
|
111974
112319
|
const snap = (s) => ({
|
|
111975
112320
|
sessionId: s.sessionId,
|
|
111976
112321
|
settledLength: s.settled.length,
|
|
@@ -111985,7 +112330,7 @@ function useTranscriptEviction({
|
|
|
111985
112330
|
prev = s;
|
|
111986
112331
|
});
|
|
111987
112332
|
}, [transcriptStore]);
|
|
111988
|
-
(0,
|
|
112333
|
+
(0, import_react27.useEffect)(() => {
|
|
111989
112334
|
if (!enabled || !api || items.length <= 1) return;
|
|
111990
112335
|
const container = getItemsContainer();
|
|
111991
112336
|
if (!container) return;
|
|
@@ -112033,15 +112378,15 @@ function Transcript({
|
|
|
112033
112378
|
const subAgents = useStoreSelector(appStore, (s) => s.subAgents);
|
|
112034
112379
|
const subagentsAwaiting = useStoreSelector(appStore, (s) => s.subagentsAwaiting);
|
|
112035
112380
|
const { columns } = useTerminalSize();
|
|
112036
|
-
const items =
|
|
112381
|
+
const items = import_react28.default.useMemo(
|
|
112037
112382
|
() => groupToolRuns(evictedCount > 0 ? settled.slice(evictedCount) : settled),
|
|
112038
112383
|
[settled, evictedCount]
|
|
112039
112384
|
);
|
|
112040
|
-
const itemsContainerRef =
|
|
112041
|
-
const setItemsContainer =
|
|
112385
|
+
const itemsContainerRef = import_react28.default.useRef(null);
|
|
112386
|
+
const setItemsContainer = import_react28.default.useCallback((el) => {
|
|
112042
112387
|
itemsContainerRef.current = el;
|
|
112043
112388
|
}, []);
|
|
112044
|
-
const getItemsContainer =
|
|
112389
|
+
const getItemsContainer = import_react28.default.useCallback(() => itemsContainerRef.current, []);
|
|
112045
112390
|
useTranscriptEviction({ enabled: evictionEnabled, transcriptStore, items, getItemsContainer });
|
|
112046
112391
|
const running = live?.runningTool ?? null;
|
|
112047
112392
|
const foldTail = running && !verbose ? trailingToolRun(items) : null;
|
|
@@ -112075,10 +112420,10 @@ function Transcript({
|
|
|
112075
112420
|
}
|
|
112076
112421
|
|
|
112077
112422
|
// src/components/layout/ReplFooter.tsx
|
|
112078
|
-
var
|
|
112423
|
+
var import_react47 = __toESM(require_react(), 1);
|
|
112079
112424
|
|
|
112080
112425
|
// src/components/tools/PlanCard.tsx
|
|
112081
|
-
var
|
|
112426
|
+
var import_react29 = __toESM(require_react(), 1);
|
|
112082
112427
|
var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1);
|
|
112083
112428
|
function planStepView(index, currentStep) {
|
|
112084
112429
|
const done2 = index + 1 < currentStep;
|
|
@@ -112103,8 +112448,8 @@ function PlanCard({ plan }) {
|
|
|
112103
112448
|
const total = plan.steps.length;
|
|
112104
112449
|
const allDone = total > 0 && plan.current_step > total;
|
|
112105
112450
|
const planKey = `${plan.current_step}|${plan.steps.join("\0")}`;
|
|
112106
|
-
const [hiddenKey, setHiddenKey] =
|
|
112107
|
-
|
|
112451
|
+
const [hiddenKey, setHiddenKey] = import_react29.default.useState(null);
|
|
112452
|
+
import_react29.default.useEffect(() => {
|
|
112108
112453
|
if (!allDone) return;
|
|
112109
112454
|
const t = setTimeout(() => setHiddenKey(planKey), DONE_HOLD_MS);
|
|
112110
112455
|
return () => clearTimeout(t);
|
|
@@ -112138,7 +112483,7 @@ function PlanCard({ plan }) {
|
|
|
112138
112483
|
}
|
|
112139
112484
|
|
|
112140
112485
|
// src/components/tools/SubAgentCard.tsx
|
|
112141
|
-
var
|
|
112486
|
+
var import_react30 = __toESM(require_react(), 1);
|
|
112142
112487
|
var import_client_core30 = __toESM(require_dist(), 1);
|
|
112143
112488
|
var import_client_ui_core10 = __toESM(require_dist2(), 1);
|
|
112144
112489
|
var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -112158,8 +112503,8 @@ function SubAgentList({
|
|
|
112158
112503
|
}) {
|
|
112159
112504
|
const running = agents.filter((a) => a.phase !== "finished");
|
|
112160
112505
|
const visible = !awaiting && running.length > 0;
|
|
112161
|
-
const [now2, setNow] =
|
|
112162
|
-
|
|
112506
|
+
const [now2, setNow] = import_react30.default.useState(() => Date.now());
|
|
112507
|
+
import_react30.default.useEffect(() => {
|
|
112163
112508
|
if (!visible) return void 0;
|
|
112164
112509
|
const timer = setInterval(() => setNow(Date.now()), 1e3);
|
|
112165
112510
|
return () => clearInterval(timer);
|
|
@@ -112175,7 +112520,7 @@ function SubAgentList({
|
|
|
112175
112520
|
}
|
|
112176
112521
|
|
|
112177
112522
|
// src/components/input/PromptInput.tsx
|
|
112178
|
-
var
|
|
112523
|
+
var import_react32 = __toESM(require_react(), 1);
|
|
112179
112524
|
|
|
112180
112525
|
// src/components/input/slashSegments.ts
|
|
112181
112526
|
function segmentSlice(text, offset, ranges) {
|
|
@@ -112952,7 +113297,7 @@ function vimKeypress(st2, buffer, input, key) {
|
|
|
112952
113297
|
}
|
|
112953
113298
|
|
|
112954
113299
|
// src/voice/useHoldToTalk.ts
|
|
112955
|
-
var
|
|
113300
|
+
var import_react31 = __toESM(require_react(), 1);
|
|
112956
113301
|
var REPEAT_GAP_MS = 120;
|
|
112957
113302
|
var WARMUP_THRESHOLD = 2;
|
|
112958
113303
|
var HOLD_THRESHOLD = 5;
|
|
@@ -113110,9 +113455,9 @@ function spliceTranscript(value, cursor, text) {
|
|
|
113110
113455
|
return { value: before + inserted + after, cursor: cursor + lead.length + text.length };
|
|
113111
113456
|
}
|
|
113112
113457
|
function useHoldToTalk(opts) {
|
|
113113
|
-
const optsRef = (0,
|
|
113458
|
+
const optsRef = (0, import_react31.useRef)(opts);
|
|
113114
113459
|
optsRef.current = opts;
|
|
113115
|
-
const machineRef = (0,
|
|
113460
|
+
const machineRef = (0, import_react31.useRef)(null);
|
|
113116
113461
|
if (!machineRef.current) {
|
|
113117
113462
|
machineRef.current = createHoldToTalk(
|
|
113118
113463
|
{
|
|
@@ -113192,37 +113537,37 @@ function PromptInput({
|
|
|
113192
113537
|
mode,
|
|
113193
113538
|
permissionMode
|
|
113194
113539
|
}) {
|
|
113195
|
-
const [value, setValue2] = (0,
|
|
113196
|
-
const [cursor, setCursor] = (0,
|
|
113197
|
-
const [history, setHistory] = (0,
|
|
113540
|
+
const [value, setValue2] = (0, import_react32.useState)("");
|
|
113541
|
+
const [cursor, setCursor] = (0, import_react32.useState)(0);
|
|
113542
|
+
const [history, setHistory] = (0, import_react32.useState)(
|
|
113198
113543
|
() => (initialHistory ?? []).slice(0, HISTORY_LIMIT)
|
|
113199
113544
|
);
|
|
113200
|
-
const [vimState, setVimState] = (0,
|
|
113201
|
-
const [menuIdx, setMenuIdx] = (0,
|
|
113202
|
-
const [menuDismissed, setMenuDismissed] = (0,
|
|
113203
|
-
const [search, setSearch] = (0,
|
|
113204
|
-
const [escArmed, setEscArmed] = (0,
|
|
113205
|
-
const [exitArmed, setExitArmed] = (0,
|
|
113206
|
-
const [postureFlash, setPostureFlash] = (0,
|
|
113207
|
-
const chordRef = (0,
|
|
113208
|
-
const escAtRef = (0,
|
|
113209
|
-
const exitAtRef = (0,
|
|
113210
|
-
const valueRef = (0,
|
|
113545
|
+
const [vimState, setVimState] = (0, import_react32.useState)(() => initialVimState("insert"));
|
|
113546
|
+
const [menuIdx, setMenuIdx] = (0, import_react32.useState)(0);
|
|
113547
|
+
const [menuDismissed, setMenuDismissed] = (0, import_react32.useState)(false);
|
|
113548
|
+
const [search, setSearch] = (0, import_react32.useState)(null);
|
|
113549
|
+
const [escArmed, setEscArmed] = (0, import_react32.useState)(false);
|
|
113550
|
+
const [exitArmed, setExitArmed] = (0, import_react32.useState)(null);
|
|
113551
|
+
const [postureFlash, setPostureFlash] = (0, import_react32.useState)(false);
|
|
113552
|
+
const chordRef = (0, import_react32.useRef)(emptyChord());
|
|
113553
|
+
const escAtRef = (0, import_react32.useRef)(0);
|
|
113554
|
+
const exitAtRef = (0, import_react32.useRef)(0);
|
|
113555
|
+
const valueRef = (0, import_react32.useRef)(value);
|
|
113211
113556
|
valueRef.current = value;
|
|
113212
|
-
const cursorRef = (0,
|
|
113557
|
+
const cursorRef = (0, import_react32.useRef)(cursor);
|
|
113213
113558
|
cursorRef.current = cursor;
|
|
113214
|
-
const pasteLedger = (0,
|
|
113215
|
-
const recall = (0,
|
|
113216
|
-
const wheelRef = (0,
|
|
113217
|
-
const flashTimer = (0,
|
|
113218
|
-
const firstPosture = (0,
|
|
113559
|
+
const pasteLedger = (0, import_react32.useRef)({ nextId: 1, texts: /* @__PURE__ */ new Map() });
|
|
113560
|
+
const recall = (0, import_react32.useRef)(NOT_RECALLING);
|
|
113561
|
+
const wheelRef = (0, import_react32.useRef)(createWheelAccel());
|
|
113562
|
+
const flashTimer = (0, import_react32.useRef)(null);
|
|
113563
|
+
const firstPosture = (0, import_react32.useRef)(true);
|
|
113219
113564
|
const theme = useTheme();
|
|
113220
113565
|
const { rows } = useTerminalSize();
|
|
113221
|
-
const [voiceState, setVoiceState] = (0,
|
|
113222
|
-
const [voiceProgress, setVoiceProgress] = (0,
|
|
113223
|
-
const [voiceError, setVoiceError] = (0,
|
|
113224
|
-
const [voiceBlink, setVoiceBlink] = (0,
|
|
113225
|
-
(0,
|
|
113566
|
+
const [voiceState, setVoiceState] = (0, import_react32.useState)("idle");
|
|
113567
|
+
const [voiceProgress, setVoiceProgress] = (0, import_react32.useState)(null);
|
|
113568
|
+
const [voiceError, setVoiceError] = (0, import_react32.useState)(null);
|
|
113569
|
+
const [voiceBlink, setVoiceBlink] = (0, import_react32.useState)(false);
|
|
113570
|
+
(0, import_react32.useEffect)(() => {
|
|
113226
113571
|
if (voiceState !== "recording") return;
|
|
113227
113572
|
const t = setInterval(() => setVoiceBlink((b2) => !b2), 600);
|
|
113228
113573
|
return () => {
|
|
@@ -113230,7 +113575,7 @@ function PromptInput({
|
|
|
113230
113575
|
setVoiceBlink(false);
|
|
113231
113576
|
};
|
|
113232
113577
|
}, [voiceState]);
|
|
113233
|
-
const micRef = (0,
|
|
113578
|
+
const micRef = (0, import_react32.useRef)(null);
|
|
113234
113579
|
const holdToTalk = useHoldToTalk({
|
|
113235
113580
|
getBuffer: () => ({ value: valueRef.current, cursor: cursorRef.current }),
|
|
113236
113581
|
applyBuffer: (v2, c3) => {
|
|
@@ -113266,11 +113611,11 @@ function PromptInput({
|
|
|
113266
113611
|
}
|
|
113267
113612
|
}
|
|
113268
113613
|
});
|
|
113269
|
-
(0,
|
|
113270
|
-
(0,
|
|
113614
|
+
(0, import_react32.useEffect)(() => () => holdToTalk.dispose(), []);
|
|
113615
|
+
(0, import_react32.useEffect)(() => {
|
|
113271
113616
|
if (vim) setVimState(initialVimState("insert"));
|
|
113272
113617
|
}, [vim]);
|
|
113273
|
-
(0,
|
|
113618
|
+
(0, import_react32.useEffect)(() => {
|
|
113274
113619
|
if (firstPosture.current) {
|
|
113275
113620
|
firstPosture.current = false;
|
|
113276
113621
|
return;
|
|
@@ -113282,7 +113627,7 @@ function PromptInput({
|
|
|
113282
113627
|
if (flashTimer.current) clearTimeout(flashTimer.current);
|
|
113283
113628
|
};
|
|
113284
113629
|
}, [mode, permissionMode]);
|
|
113285
|
-
const pickedMentions = (0,
|
|
113630
|
+
const pickedMentions = (0, import_react32.useRef)(/* @__PURE__ */ new Set());
|
|
113286
113631
|
const suggestionsFor = (v2) => v2.startsWith("/") && !v2.includes(" ") ? getCompletions?.(v2) ?? [] : [];
|
|
113287
113632
|
const suggestions = suggestionsFor(value);
|
|
113288
113633
|
const mPfx = mentionPrefix(value, cursor);
|
|
@@ -113290,18 +113635,18 @@ function PromptInput({
|
|
|
113290
113635
|
const menuFiles = fileSuggestions.length > 0;
|
|
113291
113636
|
const menuLen = menuFiles ? fileSuggestions.length : suggestions.length;
|
|
113292
113637
|
const menuOpen = !menuDismissed && menuLen > 0 && (!vim || vimState.mode === "insert");
|
|
113293
|
-
const notifyMenuRef = (0,
|
|
113638
|
+
const notifyMenuRef = (0, import_react32.useRef)(onMenuOpenChange);
|
|
113294
113639
|
notifyMenuRef.current = onMenuOpenChange;
|
|
113295
|
-
(0,
|
|
113640
|
+
(0, import_react32.useEffect)(() => {
|
|
113296
113641
|
notifyMenuRef.current?.(menuOpen);
|
|
113297
113642
|
}, [menuOpen]);
|
|
113298
|
-
(0,
|
|
113299
|
-
(0,
|
|
113643
|
+
(0, import_react32.useEffect)(() => () => notifyMenuRef.current?.(false), []);
|
|
113644
|
+
(0, import_react32.useEffect)(() => {
|
|
113300
113645
|
for (const path14 of pickedMentions.current) {
|
|
113301
113646
|
if (!value.includes(`${import_client_core32.FILE_MENTION_LEADER}${path14}`)) pickedMentions.current.delete(path14);
|
|
113302
113647
|
}
|
|
113303
113648
|
}, [value]);
|
|
113304
|
-
(0,
|
|
113649
|
+
(0, import_react32.useEffect)(() => {
|
|
113305
113650
|
setMenuIdx(0);
|
|
113306
113651
|
setMenuDismissed(false);
|
|
113307
113652
|
setEscArmed(false);
|
|
@@ -113753,7 +114098,7 @@ function PromptInput({
|
|
|
113753
114098
|
}
|
|
113754
114099
|
|
|
113755
114100
|
// src/hooks/useIndexBadge.ts
|
|
113756
|
-
var
|
|
114101
|
+
var import_react33 = __toESM(require_react(), 1);
|
|
113757
114102
|
var READY_BADGE_LINGER_MS = 3e3;
|
|
113758
114103
|
function shouldShowIndexBadge(mode, phase, lingerElapsed) {
|
|
113759
114104
|
if (mode !== "on") return true;
|
|
@@ -113761,8 +114106,8 @@ function shouldShowIndexBadge(mode, phase, lingerElapsed) {
|
|
|
113761
114106
|
return !lingerElapsed;
|
|
113762
114107
|
}
|
|
113763
114108
|
function useIndexBadgeVisible(mode, phase, lingerMs = READY_BADGE_LINGER_MS) {
|
|
113764
|
-
const [lingerElapsed, setLingerElapsed] = (0,
|
|
113765
|
-
(0,
|
|
114109
|
+
const [lingerElapsed, setLingerElapsed] = (0, import_react33.useState)(false);
|
|
114110
|
+
(0, import_react33.useEffect)(() => {
|
|
113766
114111
|
setLingerElapsed(false);
|
|
113767
114112
|
if (phase !== "ready") return;
|
|
113768
114113
|
const timer = setTimeout(() => setLingerElapsed(true), lingerMs);
|
|
@@ -113925,7 +114270,7 @@ function StatusBar({
|
|
|
113925
114270
|
}
|
|
113926
114271
|
|
|
113927
114272
|
// src/components/dialogs/AskUserPrompt.tsx
|
|
113928
|
-
var
|
|
114273
|
+
var import_react34 = __toESM(require_react(), 1);
|
|
113929
114274
|
var import_client_ui_core11 = __toESM(require_dist2(), 1);
|
|
113930
114275
|
|
|
113931
114276
|
// src/components/dialogs/LineEditor.tsx
|
|
@@ -113977,15 +114322,15 @@ function AskUserPrompt({
|
|
|
113977
114322
|
guardMs = 250
|
|
113978
114323
|
}) {
|
|
113979
114324
|
const { requestId, sessionId } = pending;
|
|
113980
|
-
const card = (0,
|
|
114325
|
+
const card = (0, import_react34.useMemo)(() => (0, import_client_ui_core11.buildAskCard)(pending.request), [pending.request]);
|
|
113981
114326
|
const questions = card.questions;
|
|
113982
|
-
const [selections, setSelections] = (0,
|
|
114327
|
+
const [selections, setSelections] = (0, import_react34.useState)(
|
|
113983
114328
|
() => questions.map(() => import_client_ui_core11.EMPTY_SELECTION)
|
|
113984
114329
|
);
|
|
113985
|
-
const [index, setIndex] = (0,
|
|
113986
|
-
const [cursor, setCursor] = (0,
|
|
113987
|
-
const [draft, setDraft] = (0,
|
|
113988
|
-
const guard = (0,
|
|
114330
|
+
const [index, setIndex] = (0, import_react34.useState)(0);
|
|
114331
|
+
const [cursor, setCursor] = (0, import_react34.useState)(0);
|
|
114332
|
+
const [draft, setDraft] = (0, import_react34.useState)(null);
|
|
114333
|
+
const guard = (0, import_react34.useRef)({ id: requestId, at: Date.now() });
|
|
113989
114334
|
if (guard.current.id !== requestId) {
|
|
113990
114335
|
guard.current = { id: requestId, at: Date.now() };
|
|
113991
114336
|
}
|
|
@@ -114131,7 +114476,7 @@ function writtenInPreview(selection) {
|
|
|
114131
114476
|
}
|
|
114132
114477
|
|
|
114133
114478
|
// src/components/dialogs/FeedbackPrompt.tsx
|
|
114134
|
-
var
|
|
114479
|
+
var import_react35 = __toESM(require_react(), 1);
|
|
114135
114480
|
var import_client_ui_core12 = __toESM(require_dist2(), 1);
|
|
114136
114481
|
var import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1);
|
|
114137
114482
|
function FeedbackPrompt({
|
|
@@ -114141,10 +114486,10 @@ function FeedbackPrompt({
|
|
|
114141
114486
|
guardMs = 250
|
|
114142
114487
|
}) {
|
|
114143
114488
|
const { requestId } = pending;
|
|
114144
|
-
const [score, setScore] = (0,
|
|
114145
|
-
const [why, setWhy] = (0,
|
|
114489
|
+
const [score, setScore] = (0, import_react35.useState)(0);
|
|
114490
|
+
const [why, setWhy] = (0, import_react35.useState)(null);
|
|
114146
114491
|
const theme = useTheme();
|
|
114147
|
-
const guard = (0,
|
|
114492
|
+
const guard = (0, import_react35.useRef)({ id: requestId, at: Date.now() });
|
|
114148
114493
|
if (guard.current.id !== requestId) {
|
|
114149
114494
|
guard.current = { id: requestId, at: Date.now() };
|
|
114150
114495
|
}
|
|
@@ -114193,13 +114538,13 @@ function FeedbackPrompt({
|
|
|
114193
114538
|
}
|
|
114194
114539
|
|
|
114195
114540
|
// src/components/dialogs/PermissionPrompt.tsx
|
|
114196
|
-
var
|
|
114541
|
+
var import_react37 = __toESM(require_react(), 1);
|
|
114197
114542
|
var import_client_ui_core13 = __toESM(require_dist2(), 1);
|
|
114198
114543
|
var import_client_ui_core14 = __toESM(require_dist2(), 1);
|
|
114199
114544
|
var import_client_core34 = __toESM(require_dist(), 1);
|
|
114200
114545
|
|
|
114201
114546
|
// src/components/dialogs/SelectList.tsx
|
|
114202
|
-
var
|
|
114547
|
+
var import_react36 = __toESM(require_react(), 1);
|
|
114203
114548
|
var import_jsx_runtime54 = __toESM(require_jsx_runtime(), 1);
|
|
114204
114549
|
function SelectList({
|
|
114205
114550
|
title,
|
|
@@ -114211,17 +114556,17 @@ function SelectList({
|
|
|
114211
114556
|
maxVisible
|
|
114212
114557
|
}) {
|
|
114213
114558
|
const { rows } = useTerminalSize();
|
|
114214
|
-
const [query, setQuery] = (0,
|
|
114215
|
-
const view = (0,
|
|
114559
|
+
const [query, setQuery] = (0, import_react36.useState)("");
|
|
114560
|
+
const view = (0, import_react36.useMemo)(() => {
|
|
114216
114561
|
if (!filterable) return options;
|
|
114217
114562
|
const q2 = query.trim().toLowerCase();
|
|
114218
114563
|
if (!q2) return options;
|
|
114219
114564
|
return options.filter((o) => !o.separator && o.label.toLowerCase().includes(q2));
|
|
114220
114565
|
}, [options, query, filterable]);
|
|
114221
114566
|
const selectable = view.flatMap((o, i2) => o.separator ? [] : [i2]);
|
|
114222
|
-
const [idx, setIdx] = (0,
|
|
114567
|
+
const [idx, setIdx] = (0, import_react36.useState)(selectable[0] ?? 0);
|
|
114223
114568
|
const safeIdx = selectable.includes(idx) ? idx : selectable[0] ?? 0;
|
|
114224
|
-
(0,
|
|
114569
|
+
(0, import_react36.useEffect)(() => {
|
|
114225
114570
|
if (filterable) setIdx(selectable[0] ?? 0);
|
|
114226
114571
|
}, [query, filterable]);
|
|
114227
114572
|
const move = (dir) => {
|
|
@@ -114322,12 +114667,12 @@ function PermissionPrompt({
|
|
|
114322
114667
|
guardMs = 250
|
|
114323
114668
|
}) {
|
|
114324
114669
|
const { data, sessionId } = pending;
|
|
114325
|
-
const model = (0,
|
|
114670
|
+
const model = (0, import_react37.useMemo)(
|
|
114326
114671
|
() => (0, import_client_ui_core13.buildPermissionCard)(data, { agentLabel: pending.agentLabel ?? null }),
|
|
114327
114672
|
[data, pending.agentLabel]
|
|
114328
114673
|
);
|
|
114329
|
-
const [stage, setStage] = (0,
|
|
114330
|
-
const guard = (0,
|
|
114674
|
+
const [stage, setStage] = (0, import_react37.useState)({ kind: "choose" });
|
|
114675
|
+
const guard = (0, import_react37.useRef)({ id: data.request_id, at: Date.now() });
|
|
114331
114676
|
if (guard.current.id !== data.request_id) {
|
|
114332
114677
|
guard.current = { id: data.request_id, at: Date.now() };
|
|
114333
114678
|
if (stage.kind !== "choose") setStage({ kind: "choose" });
|
|
@@ -114502,7 +114847,7 @@ function PermissionPrompt({
|
|
|
114502
114847
|
}
|
|
114503
114848
|
|
|
114504
114849
|
// src/components/dialogs/EndpointsPanel.tsx
|
|
114505
|
-
var
|
|
114850
|
+
var import_react38 = __toESM(require_react(), 1);
|
|
114506
114851
|
var import_jsx_runtime56 = __toESM(require_jsx_runtime(), 1);
|
|
114507
114852
|
function maskedKeyState(e) {
|
|
114508
114853
|
if (e.apiKey) return `key \u2022\u2022\u2022\u2022${e.apiKey.slice(-4)}`;
|
|
@@ -114532,20 +114877,20 @@ function EndpointsPanel({
|
|
|
114532
114877
|
deps: deps2,
|
|
114533
114878
|
onClose
|
|
114534
114879
|
}) {
|
|
114535
|
-
const [overlay, setOverlay] = (0,
|
|
114536
|
-
const [name2, setName] = (0,
|
|
114537
|
-
const [url, setUrl] = (0,
|
|
114538
|
-
const [wire, setWire] = (0,
|
|
114539
|
-
const [key, setKey] = (0,
|
|
114540
|
-
const [selected, setSelected] = (0,
|
|
114541
|
-
const [discovered, setDiscovered] = (0,
|
|
114542
|
-
const [modelConfig, setModelConfig] = (0,
|
|
114543
|
-
const [editing, setEditing] = (0,
|
|
114544
|
-
const [configDraft, setConfigDraft] = (0,
|
|
114545
|
-
const [savedPins, setSavedPins] = (0,
|
|
114546
|
-
const [savedConfig, setSavedConfig] = (0,
|
|
114547
|
-
const [fetching, setFetching] = (0,
|
|
114548
|
-
const [note, setNote] = (0,
|
|
114880
|
+
const [overlay, setOverlay] = (0, import_react38.useState)(null);
|
|
114881
|
+
const [name2, setName] = (0, import_react38.useState)("");
|
|
114882
|
+
const [url, setUrl] = (0, import_react38.useState)("");
|
|
114883
|
+
const [wire, setWire] = (0, import_react38.useState)("openai");
|
|
114884
|
+
const [key, setKey] = (0, import_react38.useState)("");
|
|
114885
|
+
const [selected, setSelected] = (0, import_react38.useState)(/* @__PURE__ */ new Set());
|
|
114886
|
+
const [discovered, setDiscovered] = (0, import_react38.useState)(null);
|
|
114887
|
+
const [modelConfig, setModelConfig] = (0, import_react38.useState)({});
|
|
114888
|
+
const [editing, setEditing] = (0, import_react38.useState)(null);
|
|
114889
|
+
const [configDraft, setConfigDraft] = (0, import_react38.useState)("");
|
|
114890
|
+
const [savedPins, setSavedPins] = (0, import_react38.useState)(/* @__PURE__ */ new Set());
|
|
114891
|
+
const [savedConfig, setSavedConfig] = (0, import_react38.useState)({});
|
|
114892
|
+
const [fetching, setFetching] = (0, import_react38.useState)(false);
|
|
114893
|
+
const [note, setNote] = (0, import_react38.useState)(null);
|
|
114549
114894
|
const slots = [
|
|
114550
114895
|
...deps2.entries.map((_2, index) => ({ kind: "entry", index })),
|
|
114551
114896
|
{ kind: "field", field: "name" },
|
|
@@ -114555,9 +114900,9 @@ function EndpointsPanel({
|
|
|
114555
114900
|
{ kind: "action", action: "fetch" },
|
|
114556
114901
|
{ kind: "action", action: "save" }
|
|
114557
114902
|
];
|
|
114558
|
-
const [at, setAt] = (0,
|
|
114903
|
+
const [at, setAt] = (0, import_react38.useState)(deps2.entries.length);
|
|
114559
114904
|
const slot = slots[Math.min(at, slots.length - 1)];
|
|
114560
|
-
const [verifiedFor, setVerifiedFor] = (0,
|
|
114905
|
+
const [verifiedFor, setVerifiedFor] = (0, import_react38.useState)(null);
|
|
114561
114906
|
const fingerprint = `${url.trim()}\0${key}`;
|
|
114562
114907
|
const verified = verifiedFor === fingerprint;
|
|
114563
114908
|
const resetForm = () => {
|
|
@@ -115044,7 +115389,7 @@ function EndpointsPanel({
|
|
|
115044
115389
|
}
|
|
115045
115390
|
|
|
115046
115391
|
// src/components/dialogs/PermissionRulesPanel.tsx
|
|
115047
|
-
var
|
|
115392
|
+
var import_react39 = __toESM(require_react(), 1);
|
|
115048
115393
|
var import_client_core35 = __toESM(require_dist(), 1);
|
|
115049
115394
|
var import_client_ui_core15 = __toESM(require_dist2(), 1);
|
|
115050
115395
|
var import_jsx_runtime57 = __toESM(require_jsx_runtime(), 1);
|
|
@@ -115054,7 +115399,7 @@ function PermissionRulesPanel({
|
|
|
115054
115399
|
add,
|
|
115055
115400
|
onClose
|
|
115056
115401
|
}) {
|
|
115057
|
-
const [stage, setStage] = (0,
|
|
115402
|
+
const [stage, setStage] = (0, import_react39.useState)({ kind: "list" });
|
|
115058
115403
|
use_input_default((input, key) => {
|
|
115059
115404
|
if (stage.kind !== "list") {
|
|
115060
115405
|
if (stage.kind === "add-rule") {
|
|
@@ -115154,7 +115499,7 @@ function PermissionRulesPanel({
|
|
|
115154
115499
|
}
|
|
115155
115500
|
|
|
115156
115501
|
// src/components/dialogs/PlanApprovalPrompt.tsx
|
|
115157
|
-
var
|
|
115502
|
+
var import_react40 = __toESM(require_react(), 1);
|
|
115158
115503
|
var import_jsx_runtime58 = __toESM(require_jsx_runtime(), 1);
|
|
115159
115504
|
function PlanApprovalPrompt({
|
|
115160
115505
|
pending,
|
|
@@ -115163,7 +115508,7 @@ function PlanApprovalPrompt({
|
|
|
115163
115508
|
guardMs = 250
|
|
115164
115509
|
}) {
|
|
115165
115510
|
const { requestId, sessionId } = pending;
|
|
115166
|
-
const guard = (0,
|
|
115511
|
+
const guard = (0, import_react40.useRef)({ id: requestId, at: Date.now() });
|
|
115167
115512
|
if (guard.current.id !== requestId) guard.current = { id: requestId, at: Date.now() };
|
|
115168
115513
|
use_input_default((input, key) => {
|
|
115169
115514
|
if (key.ctrl && input === "c") {
|
|
@@ -115197,7 +115542,7 @@ function PlanApprovalPrompt({
|
|
|
115197
115542
|
}
|
|
115198
115543
|
|
|
115199
115544
|
// src/components/dialogs/WorkPlanApprovalPrompt.tsx
|
|
115200
|
-
var
|
|
115545
|
+
var import_react41 = __toESM(require_react(), 1);
|
|
115201
115546
|
var import_client_core36 = __toESM(require_dist(), 1);
|
|
115202
115547
|
var import_jsx_runtime59 = __toESM(require_jsx_runtime(), 1);
|
|
115203
115548
|
function WorkPlanApprovalPrompt({
|
|
@@ -115207,7 +115552,7 @@ function WorkPlanApprovalPrompt({
|
|
|
115207
115552
|
guardMs = 250
|
|
115208
115553
|
}) {
|
|
115209
115554
|
const { requestId, plan } = pending;
|
|
115210
|
-
const guard = (0,
|
|
115555
|
+
const guard = (0, import_react41.useRef)({ id: requestId, at: Date.now() });
|
|
115211
115556
|
if (guard.current.id !== requestId) guard.current = { id: requestId, at: Date.now() };
|
|
115212
115557
|
use_input_default((input, key) => {
|
|
115213
115558
|
if (key.ctrl && input === "c") {
|
|
@@ -115276,7 +115621,7 @@ function ConfirmDialog({ dialog }) {
|
|
|
115276
115621
|
}
|
|
115277
115622
|
|
|
115278
115623
|
// src/components/dialogs/HooksBrowser.tsx
|
|
115279
|
-
var
|
|
115624
|
+
var import_react42 = __toESM(require_react(), 1);
|
|
115280
115625
|
var import_jsx_runtime63 = __toESM(require_jsx_runtime(), 1);
|
|
115281
115626
|
function matcherLabel(m2) {
|
|
115282
115627
|
if (!m2 || typeof m2 !== "object") return "(any)";
|
|
@@ -115344,9 +115689,9 @@ function HooksBrowser({
|
|
|
115344
115689
|
hooks,
|
|
115345
115690
|
onClose
|
|
115346
115691
|
}) {
|
|
115347
|
-
const [event, setEvent] = (0,
|
|
115348
|
-
const [matcher, setMatcher] = (0,
|
|
115349
|
-
const [hookIdx, setHookIdx] = (0,
|
|
115692
|
+
const [event, setEvent] = (0, import_react42.useState)(null);
|
|
115693
|
+
const [matcher, setMatcher] = (0, import_react42.useState)(null);
|
|
115694
|
+
const [hookIdx, setHookIdx] = (0, import_react42.useState)(null);
|
|
115350
115695
|
if (event === null) {
|
|
115351
115696
|
const events = [...new Set(hooks.map((h) => h.event ?? "(unknown)"))].sort();
|
|
115352
115697
|
const options = events.map((e) => {
|
|
@@ -115399,7 +115744,7 @@ function HooksBrowser({
|
|
|
115399
115744
|
}
|
|
115400
115745
|
|
|
115401
115746
|
// src/components/dialogs/PluginManager.tsx
|
|
115402
|
-
var
|
|
115747
|
+
var import_react43 = __toESM(require_react(), 1);
|
|
115403
115748
|
var import_client_core37 = __toESM(require_dist(), 1);
|
|
115404
115749
|
var import_jsx_runtime64 = __toESM(require_jsx_runtime(), 1);
|
|
115405
115750
|
function pluginId(p) {
|
|
@@ -115418,8 +115763,8 @@ function PluginManager({
|
|
|
115418
115763
|
install,
|
|
115419
115764
|
onClose
|
|
115420
115765
|
}) {
|
|
115421
|
-
const [view, setView] = (0,
|
|
115422
|
-
const [busy, setBusy] = (0,
|
|
115766
|
+
const [view, setView] = (0, import_react43.useState)({ at: "list" });
|
|
115767
|
+
const [busy, setBusy] = (0, import_react43.useState)(false);
|
|
115423
115768
|
const finish = (work) => {
|
|
115424
115769
|
setBusy(true);
|
|
115425
115770
|
void work.finally(() => {
|
|
@@ -115572,7 +115917,7 @@ Install "${view.id}" from "${view.catalog}" (${scope} scope)?`,
|
|
|
115572
115917
|
}
|
|
115573
115918
|
|
|
115574
115919
|
// src/components/dialogs/RewindPicker.tsx
|
|
115575
|
-
var
|
|
115920
|
+
var import_react44 = __toESM(require_react(), 1);
|
|
115576
115921
|
var import_jsx_runtime65 = __toESM(require_jsx_runtime(), 1);
|
|
115577
115922
|
function statLabel(t) {
|
|
115578
115923
|
if (!t.files) return "no code changes";
|
|
@@ -115587,8 +115932,8 @@ function RewindPicker({
|
|
|
115587
115932
|
apply: apply2,
|
|
115588
115933
|
onClose
|
|
115589
115934
|
}) {
|
|
115590
|
-
const [picked, setPicked] = (0,
|
|
115591
|
-
const [busy, setBusy] = (0,
|
|
115935
|
+
const [picked, setPicked] = (0, import_react44.useState)(null);
|
|
115936
|
+
const [busy, setBusy] = (0, import_react44.useState)(false);
|
|
115592
115937
|
if (busy) {
|
|
115593
115938
|
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Box2, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(ThemedText, { dim: true, children: "Working\u2026" }) });
|
|
115594
115939
|
}
|
|
@@ -115626,7 +115971,7 @@ function RewindPicker({
|
|
|
115626
115971
|
}
|
|
115627
115972
|
|
|
115628
115973
|
// src/components/dialogs/McpManager.tsx
|
|
115629
|
-
var
|
|
115974
|
+
var import_react45 = __toESM(require_react(), 1);
|
|
115630
115975
|
var import_jsx_runtime66 = __toESM(require_jsx_runtime(), 1);
|
|
115631
115976
|
function statusLabel(s) {
|
|
115632
115977
|
return s.status === "needs_auth" ? "needs auth" : s.status ?? "?";
|
|
@@ -115644,8 +115989,8 @@ function McpManager({
|
|
|
115644
115989
|
act,
|
|
115645
115990
|
onClose
|
|
115646
115991
|
}) {
|
|
115647
|
-
const [view, setView] = (0,
|
|
115648
|
-
const [busy, setBusy] = (0,
|
|
115992
|
+
const [view, setView] = (0, import_react45.useState)({ at: "list" });
|
|
115993
|
+
const [busy, setBusy] = (0, import_react45.useState)(false);
|
|
115649
115994
|
const finish = (work, backTo = { at: "list" }) => {
|
|
115650
115995
|
setBusy(true);
|
|
115651
115996
|
void work.finally(() => {
|
|
@@ -116093,7 +116438,7 @@ function UsageMetricsPanel({
|
|
|
116093
116438
|
}
|
|
116094
116439
|
|
|
116095
116440
|
// src/components/status/WorkingStatus.tsx
|
|
116096
|
-
var
|
|
116441
|
+
var import_react46 = __toESM(require_react(), 1);
|
|
116097
116442
|
var import_jsx_runtime69 = __toESM(require_jsx_runtime(), 1);
|
|
116098
116443
|
var FRAME_MS = 50;
|
|
116099
116444
|
function WorkingStatus({
|
|
@@ -116101,14 +116446,14 @@ function WorkingStatus({
|
|
|
116101
116446
|
label,
|
|
116102
116447
|
now: now2 = Date.now
|
|
116103
116448
|
}) {
|
|
116104
|
-
const startRef = (0,
|
|
116105
|
-
const wordsRef = (0,
|
|
116106
|
-
const wordIdxRef = (0,
|
|
116107
|
-
const wordStartRef = (0,
|
|
116108
|
-
const dwellRef = (0,
|
|
116109
|
-
const [, forceFrame] = (0,
|
|
116449
|
+
const startRef = (0, import_react46.useRef)(now2());
|
|
116450
|
+
const wordsRef = (0, import_react46.useRef)(shuffleWords(LOADING_WORDS));
|
|
116451
|
+
const wordIdxRef = (0, import_react46.useRef)(0);
|
|
116452
|
+
const wordStartRef = (0, import_react46.useRef)(startRef.current);
|
|
116453
|
+
const dwellRef = (0, import_react46.useRef)(nextCycleMs());
|
|
116454
|
+
const [, forceFrame] = (0, import_react46.useState)(0);
|
|
116110
116455
|
const tokens = useStoreSelector(store, (s) => s.turnOutputTokens);
|
|
116111
|
-
(0,
|
|
116456
|
+
(0, import_react46.useEffect)(() => {
|
|
116112
116457
|
const timer = setInterval(() => {
|
|
116113
116458
|
const n2 = now2();
|
|
116114
116459
|
if (!label && n2 - startRef.current < META_REVEAL_AFTER_MS && n2 - wordStartRef.current >= dwellRef.current) {
|
|
@@ -116260,11 +116605,11 @@ function ReplFooter({
|
|
|
116260
116605
|
(s) => s.pendingPermissions.length > 0 || !!s.pendingPlanApproval || !!s.pendingAskUser || !!s.pendingWorkPlan
|
|
116261
116606
|
);
|
|
116262
116607
|
const closePanel = () => appStore.setState((s) => ({ ...s, activePanel: null }));
|
|
116263
|
-
const onQueuePop =
|
|
116608
|
+
const onQueuePop = import_react47.default.useCallback(
|
|
116264
116609
|
(draft) => popEditableQueue(appStore, draft),
|
|
116265
116610
|
[appStore]
|
|
116266
116611
|
);
|
|
116267
|
-
const [menuOpen, setMenuOpen] =
|
|
116612
|
+
const [menuOpen, setMenuOpen] = import_react47.default.useState(false);
|
|
116268
116613
|
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
116269
116614
|
streaming && !parked && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(WorkingStatus, { store: appStore }),
|
|
116270
116615
|
plan && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(PlanCard, { plan }),
|
|
@@ -116380,7 +116725,7 @@ function ReplFooter({
|
|
|
116380
116725
|
}
|
|
116381
116726
|
|
|
116382
116727
|
// src/components/layout/FullscreenLayout.tsx
|
|
116383
|
-
var
|
|
116728
|
+
var import_react48 = __toESM(require_react(), 1);
|
|
116384
116729
|
var import_jsx_runtime73 = __toESM(require_jsx_runtime(), 1);
|
|
116385
116730
|
function FullscreenLayout({
|
|
116386
116731
|
appStore,
|
|
@@ -116402,7 +116747,7 @@ function FullscreenLayout({
|
|
|
116402
116747
|
onCycleMode
|
|
116403
116748
|
}) {
|
|
116404
116749
|
const { columns, rows } = useTerminalSize();
|
|
116405
|
-
const scrollRef = (0,
|
|
116750
|
+
const scrollRef = (0, import_react48.useRef)(null);
|
|
116406
116751
|
const onScroll = (delta) => {
|
|
116407
116752
|
const sb = scrollRef.current;
|
|
116408
116753
|
if (!sb) return;
|
|
@@ -116437,7 +116782,7 @@ function FullscreenLayout({
|
|
|
116437
116782
|
}
|
|
116438
116783
|
|
|
116439
116784
|
// src/components/dialogs/AgentsDashboard.tsx
|
|
116440
|
-
var
|
|
116785
|
+
var import_react49 = __toESM(require_react(), 1);
|
|
116441
116786
|
var import_client_core40 = __toESM(require_dist(), 1);
|
|
116442
116787
|
var import_client_ui_core17 = __toESM(require_dist2(), 1);
|
|
116443
116788
|
var import_strip_ansi4 = __toESM(require_strip_ansi(), 1);
|
|
@@ -116484,51 +116829,51 @@ function AgentsDashboard({
|
|
|
116484
116829
|
onClose
|
|
116485
116830
|
}) {
|
|
116486
116831
|
const { rows } = useTerminalSize();
|
|
116487
|
-
const [screen, setScreen] = (0,
|
|
116488
|
-
const [cursor, setCursor] = (0,
|
|
116489
|
-
const [busy, setBusy] = (0,
|
|
116490
|
-
const [error, setError] = (0,
|
|
116491
|
-
const [liveJob, setLiveJob] = (0,
|
|
116492
|
-
const [events, setEvents] = (0,
|
|
116493
|
-
const [pollError, setPollError] = (0,
|
|
116494
|
-
const [diff3, setDiff] = (0,
|
|
116495
|
-
const diffFetchedFor = (0,
|
|
116496
|
-
const [liveItems, setLiveItems] = (0,
|
|
116497
|
-
const [liveTerm, setLiveTerm] = (0,
|
|
116498
|
-
const [liveFrames, setLiveFrames] = (0,
|
|
116499
|
-
const liveIdRef = (0,
|
|
116500
|
-
const [messaging, setMessaging] = (0,
|
|
116501
|
-
const [messageText, setMessageText] = (0,
|
|
116502
|
-
const [messageNote, setMessageNote] = (0,
|
|
116503
|
-
const [tokenStatus, setTokenStatus] = (0,
|
|
116504
|
-
const [tokenBusy, setTokenBusy] = (0,
|
|
116505
|
-
const [tokenNote, setTokenNote] = (0,
|
|
116506
|
-
const [tokenInput, setTokenInput] = (0,
|
|
116507
|
-
const [tokenDraft, setTokenDraft] = (0,
|
|
116508
|
-
const [jiraStatus, setJiraStatus] = (0,
|
|
116509
|
-
const [jiraBusy, setJiraBusy] = (0,
|
|
116510
|
-
const [jiraNote, setJiraNote] = (0,
|
|
116511
|
-
const [jiraInput, setJiraInput] = (0,
|
|
116512
|
-
const [form, setForm] = (0,
|
|
116513
|
-
const [field2, setField] = (0,
|
|
116832
|
+
const [screen, setScreen] = (0, import_react49.useState)({ kind: "list" });
|
|
116833
|
+
const [cursor, setCursor] = (0, import_react49.useState)(0);
|
|
116834
|
+
const [busy, setBusy] = (0, import_react49.useState)(false);
|
|
116835
|
+
const [error, setError] = (0, import_react49.useState)(null);
|
|
116836
|
+
const [liveJob, setLiveJob] = (0, import_react49.useState)(null);
|
|
116837
|
+
const [events, setEvents] = (0, import_react49.useState)([]);
|
|
116838
|
+
const [pollError, setPollError] = (0, import_react49.useState)(null);
|
|
116839
|
+
const [diff3, setDiff] = (0, import_react49.useState)(null);
|
|
116840
|
+
const diffFetchedFor = (0, import_react49.useRef)(null);
|
|
116841
|
+
const [liveItems, setLiveItems] = (0, import_react49.useState)([]);
|
|
116842
|
+
const [liveTerm, setLiveTerm] = (0, import_react49.useState)("");
|
|
116843
|
+
const [liveFrames, setLiveFrames] = (0, import_react49.useState)(0);
|
|
116844
|
+
const liveIdRef = (0, import_react49.useRef)(0);
|
|
116845
|
+
const [messaging, setMessaging] = (0, import_react49.useState)(false);
|
|
116846
|
+
const [messageText, setMessageText] = (0, import_react49.useState)("");
|
|
116847
|
+
const [messageNote, setMessageNote] = (0, import_react49.useState)(null);
|
|
116848
|
+
const [tokenStatus, setTokenStatus] = (0, import_react49.useState)(null);
|
|
116849
|
+
const [tokenBusy, setTokenBusy] = (0, import_react49.useState)(false);
|
|
116850
|
+
const [tokenNote, setTokenNote] = (0, import_react49.useState)(null);
|
|
116851
|
+
const [tokenInput, setTokenInput] = (0, import_react49.useState)(false);
|
|
116852
|
+
const [tokenDraft, setTokenDraft] = (0, import_react49.useState)("");
|
|
116853
|
+
const [jiraStatus, setJiraStatus] = (0, import_react49.useState)(null);
|
|
116854
|
+
const [jiraBusy, setJiraBusy] = (0, import_react49.useState)(false);
|
|
116855
|
+
const [jiraNote, setJiraNote] = (0, import_react49.useState)(null);
|
|
116856
|
+
const [jiraInput, setJiraInput] = (0, import_react49.useState)(null);
|
|
116857
|
+
const [form, setForm] = (0, import_react49.useState)(EMPTY_FORM);
|
|
116858
|
+
const [field2, setField] = (0, import_react49.useState)(0);
|
|
116514
116859
|
const jobs = panel.jobs;
|
|
116515
116860
|
const safeCursor = Math.min(cursor, Math.max(0, jobs.length - 1));
|
|
116516
116861
|
const detailId = screen.kind === "detail" ? screen.id : null;
|
|
116517
116862
|
const detailJob = detailId ? liveJob ?? jobs.find((j2) => j2.id === detailId) ?? null : null;
|
|
116518
|
-
const panelRef = (0,
|
|
116863
|
+
const panelRef = (0, import_react49.useRef)(panel);
|
|
116519
116864
|
panelRef.current = panel;
|
|
116520
|
-
const screenRef = (0,
|
|
116865
|
+
const screenRef = (0, import_react49.useRef)(screen);
|
|
116521
116866
|
screenRef.current = screen;
|
|
116522
|
-
const oauthAlive = (0,
|
|
116523
|
-
const oauthTimer = (0,
|
|
116524
|
-
(0,
|
|
116867
|
+
const oauthAlive = (0, import_react49.useRef)(true);
|
|
116868
|
+
const oauthTimer = (0, import_react49.useRef)(null);
|
|
116869
|
+
(0, import_react49.useEffect)(
|
|
116525
116870
|
() => () => {
|
|
116526
116871
|
oauthAlive.current = false;
|
|
116527
116872
|
if (oauthTimer.current) clearTimeout(oauthTimer.current);
|
|
116528
116873
|
},
|
|
116529
116874
|
[]
|
|
116530
116875
|
);
|
|
116531
|
-
(0,
|
|
116876
|
+
(0, import_react49.useEffect)(() => {
|
|
116532
116877
|
if (!detailId) return;
|
|
116533
116878
|
let cancelled = false;
|
|
116534
116879
|
let timer = null;
|
|
@@ -116570,7 +116915,7 @@ function AgentsDashboard({
|
|
|
116570
116915
|
};
|
|
116571
116916
|
}, [detailId]);
|
|
116572
116917
|
const branchName = detailJob?.branch_name ?? null;
|
|
116573
|
-
(0,
|
|
116918
|
+
(0, import_react49.useEffect)(() => {
|
|
116574
116919
|
if (!detailId || !branchName) return;
|
|
116575
116920
|
const key = `${detailId}:${branchName}`;
|
|
116576
116921
|
if (diffFetchedFor.current === key) return;
|
|
@@ -116588,7 +116933,7 @@ function AgentsDashboard({
|
|
|
116588
116933
|
};
|
|
116589
116934
|
}, [detailId, branchName]);
|
|
116590
116935
|
const liveSessionId = detailJob && !(0, import_client_core40.isTerminal)(detailJob.status) && detailJob.session_id ? detailJob.session_id : null;
|
|
116591
|
-
(0,
|
|
116936
|
+
(0, import_react49.useEffect)(() => {
|
|
116592
116937
|
if (!liveSessionId) return;
|
|
116593
116938
|
liveIdRef.current = 0;
|
|
116594
116939
|
setLiveItems([]);
|
|
@@ -116609,7 +116954,7 @@ function AgentsDashboard({
|
|
|
116609
116954
|
});
|
|
116610
116955
|
return () => sub.dispose();
|
|
116611
116956
|
}, [liveSessionId]);
|
|
116612
|
-
(0,
|
|
116957
|
+
(0, import_react49.useEffect)(() => {
|
|
116613
116958
|
let cancelled = false;
|
|
116614
116959
|
void (async () => {
|
|
116615
116960
|
try {
|
|
@@ -117265,14 +117610,14 @@ function LaunchFormView({ form, field: field2 }) {
|
|
|
117265
117610
|
}
|
|
117266
117611
|
|
|
117267
117612
|
// src/components/layout/TerminalTitle.tsx
|
|
117268
|
-
var
|
|
117613
|
+
var import_react51 = __toESM(require_react(), 1);
|
|
117269
117614
|
|
|
117270
117615
|
// src/vendor/ink/hooks/use-terminal-title.ts
|
|
117271
|
-
var
|
|
117616
|
+
var import_react50 = __toESM(require_react(), 1);
|
|
117272
117617
|
var import_strip_ansi5 = __toESM(require_strip_ansi(), 1);
|
|
117273
117618
|
function useTerminalTitle(title) {
|
|
117274
|
-
const writeRaw = (0,
|
|
117275
|
-
(0,
|
|
117619
|
+
const writeRaw = (0, import_react50.useContext)(TerminalWriteContext);
|
|
117620
|
+
(0, import_react50.useEffect)(() => {
|
|
117276
117621
|
if (title === null || !writeRaw) return;
|
|
117277
117622
|
const clean = (0, import_strip_ansi5.default)(title);
|
|
117278
117623
|
if (process.platform === "win32") {
|
|
@@ -117298,8 +117643,8 @@ function composeTerminalTitle(sessionTitle, streaming, frame) {
|
|
|
117298
117643
|
function TerminalTitle({ appStore }) {
|
|
117299
117644
|
const sessionTitle = useStoreSelector(appStore, (s) => s.sessionTitle);
|
|
117300
117645
|
const streaming = useStoreSelector(appStore, (s) => s.status === "streaming");
|
|
117301
|
-
const [frame, setFrame] = (0,
|
|
117302
|
-
(0,
|
|
117646
|
+
const [frame, setFrame] = (0, import_react51.useState)(0);
|
|
117647
|
+
(0, import_react51.useEffect)(() => {
|
|
117303
117648
|
if (!streaming) return;
|
|
117304
117649
|
const id = setInterval(
|
|
117305
117650
|
() => setFrame((f) => (f + 1) % TITLE_ANIMATION_FRAMES.length),
|
|
@@ -117398,11 +117743,11 @@ function Root({
|
|
|
117398
117743
|
}
|
|
117399
117744
|
|
|
117400
117745
|
// src/components/layout/SignInScreen.tsx
|
|
117401
|
-
var
|
|
117746
|
+
var import_react53 = __toESM(require_react(), 1);
|
|
117402
117747
|
var import_client_core41 = __toESM(require_dist(), 1);
|
|
117403
117748
|
|
|
117404
117749
|
// src/components/layout/splash/Splash.tsx
|
|
117405
|
-
var
|
|
117750
|
+
var import_react52 = __toESM(require_react(), 1);
|
|
117406
117751
|
|
|
117407
117752
|
// src/components/layout/splash/halfblock.ts
|
|
117408
117753
|
var BLOCK = [" ", "\u2580", "\u2584", "\u2588"];
|
|
@@ -117721,7 +118066,7 @@ var TONE = {
|
|
|
117721
118066
|
function Splash({ columns, rows, frame, copy }) {
|
|
117722
118067
|
const theme = useTheme();
|
|
117723
118068
|
const height = splashHeight(rows);
|
|
117724
|
-
const shell2 =
|
|
118069
|
+
const shell2 = import_react52.default.useMemo(() => orbShell(), []);
|
|
117725
118070
|
const grid = splashFrame({ width: columns, rows: height, frame, shell: shell2, copy });
|
|
117726
118071
|
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Box2, { flexDirection: "column", children: grid.map((spans, y2) => /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Text2, { wrap: "truncate", children: spans.length === 0 ? " " : spans.map((span, i2) => renderSpan(span, i2, theme)) }, y2)) });
|
|
117727
118072
|
}
|
|
@@ -117767,15 +118112,15 @@ function SignInScreen({
|
|
|
117767
118112
|
onSignedIn
|
|
117768
118113
|
}) {
|
|
117769
118114
|
const { exit } = use_app_default();
|
|
117770
|
-
const [phase, setPhase] =
|
|
117771
|
-
const [url, setUrl] =
|
|
117772
|
-
const [error, setError] =
|
|
117773
|
-
const [frame, setFrame] =
|
|
118115
|
+
const [phase, setPhase] = import_react53.default.useState("idle");
|
|
118116
|
+
const [url, setUrl] = import_react53.default.useState(null);
|
|
118117
|
+
const [error, setError] = import_react53.default.useState(null);
|
|
118118
|
+
const [frame, setFrame] = import_react53.default.useState(0);
|
|
117774
118119
|
const { columns, rows } = useTerminalSize();
|
|
117775
|
-
const caps =
|
|
118120
|
+
const caps = import_react53.default.useMemo(() => detectTerminal2(), []);
|
|
117776
118121
|
const copy = splashCopy(phase, error, url, columns);
|
|
117777
118122
|
const useSplash = !splashDisabled() && caps.unicode && splashFits(columns, rows, copy.length);
|
|
117778
|
-
|
|
118123
|
+
import_react53.default.useEffect(() => {
|
|
117779
118124
|
if (!useSplash || phase !== "idle") return;
|
|
117780
118125
|
const t = setInterval(() => setFrame((f) => f + 1), TICK_MS);
|
|
117781
118126
|
return () => clearInterval(t);
|
|
@@ -117893,6 +118238,68 @@ function SignInCard({
|
|
|
117893
118238
|
] });
|
|
117894
118239
|
}
|
|
117895
118240
|
|
|
118241
|
+
// src/services/sessionAutosave.ts
|
|
118242
|
+
var DISPLAY_SAVE_INTERVAL_MS = 1e3;
|
|
118243
|
+
function createSessionAutosave(deps2) {
|
|
118244
|
+
const save = deps2.save ?? saveSession;
|
|
118245
|
+
const intervalMs = deps2.intervalMs ?? DISPLAY_SAVE_INTERVAL_MS;
|
|
118246
|
+
let pending = null;
|
|
118247
|
+
let timer = null;
|
|
118248
|
+
const persistable = (s) => !!s.sessionId && s.messages.length > 0;
|
|
118249
|
+
const write = (s, opts) => {
|
|
118250
|
+
if (!s.sessionId) return;
|
|
118251
|
+
try {
|
|
118252
|
+
const title = resolveTitle(s.sessionId, s.messages);
|
|
118253
|
+
if (opts.title) deps2.onTitle?.(title);
|
|
118254
|
+
save({
|
|
118255
|
+
sessionId: s.sessionId,
|
|
118256
|
+
title,
|
|
118257
|
+
updatedAt: Date.now(),
|
|
118258
|
+
messages: s.messages,
|
|
118259
|
+
clientState: s.clientState,
|
|
118260
|
+
transcript: s.settled,
|
|
118261
|
+
config: deps2.buildConfig()
|
|
118262
|
+
});
|
|
118263
|
+
} catch {
|
|
118264
|
+
}
|
|
118265
|
+
};
|
|
118266
|
+
const cancel = () => {
|
|
118267
|
+
if (timer !== null) {
|
|
118268
|
+
clearTimeout(timer);
|
|
118269
|
+
timer = null;
|
|
118270
|
+
}
|
|
118271
|
+
pending = null;
|
|
118272
|
+
};
|
|
118273
|
+
const fire = () => {
|
|
118274
|
+
timer = null;
|
|
118275
|
+
const s = pending;
|
|
118276
|
+
pending = null;
|
|
118277
|
+
if (s) write(s, { title: false });
|
|
118278
|
+
};
|
|
118279
|
+
return {
|
|
118280
|
+
onChange: (next, prev) => {
|
|
118281
|
+
if (next.messages !== prev.messages) {
|
|
118282
|
+
if (!persistable(next)) return;
|
|
118283
|
+
cancel();
|
|
118284
|
+
write(next, { title: true });
|
|
118285
|
+
} else if (next.settled !== prev.settled) {
|
|
118286
|
+
if (!persistable(next)) return;
|
|
118287
|
+
pending = next;
|
|
118288
|
+
if (timer === null) {
|
|
118289
|
+
timer = setTimeout(fire, intervalMs);
|
|
118290
|
+
timer.unref?.();
|
|
118291
|
+
}
|
|
118292
|
+
}
|
|
118293
|
+
},
|
|
118294
|
+
flush: () => {
|
|
118295
|
+
const s = pending;
|
|
118296
|
+
cancel();
|
|
118297
|
+
if (s) write(s, { title: false });
|
|
118298
|
+
},
|
|
118299
|
+
dispose: cancel
|
|
118300
|
+
};
|
|
118301
|
+
}
|
|
118302
|
+
|
|
117896
118303
|
// src/services/presenceHost.ts
|
|
117897
118304
|
var import_client_core42 = __toESM(require_dist(), 1);
|
|
117898
118305
|
function startTuiPresence(opts) {
|
|
@@ -118539,7 +118946,9 @@ async function runHeadless(flags2) {
|
|
|
118539
118946
|
const config = loadConfig();
|
|
118540
118947
|
if (flags2.workspace) config.workspaceRoot = flags2.workspace;
|
|
118541
118948
|
const secrets = createSecretStore();
|
|
118542
|
-
const session = (0, import_client_core46.createAgentSession)(secrets, config
|
|
118949
|
+
const session = (0, import_client_core46.createAgentSession)(secrets, config, {
|
|
118950
|
+
trace: (line) => console.error(`[orion-auth] ${line}`)
|
|
118951
|
+
});
|
|
118543
118952
|
const signedIn = await session.isSignedIn();
|
|
118544
118953
|
if (!signedIn && !process.env.ORION_AUTH_TOKEN) {
|
|
118545
118954
|
throw new Error(
|
|
@@ -118580,8 +118989,10 @@ async function runHeadless(flags2) {
|
|
|
118580
118989
|
}),
|
|
118581
118990
|
gatewayUrl: () => config.apiUrl,
|
|
118582
118991
|
clientVersion: tuiVersion() ?? "0.0.0-dev",
|
|
118583
|
-
// Mid-segment token-expiry heal —
|
|
118584
|
-
|
|
118992
|
+
// Mid-segment token-expiry heal — the FAIL-CLOSED renewal, not the fail-open
|
|
118993
|
+
// freshness read the transport authToken below uses (that degradation hands the
|
|
118994
|
+
// refused token back and burns the heal).
|
|
118995
|
+
renewBearer: async (refused) => await session.renewedAccessToken(refused) ?? process.env.ORION_AUTH_TOKEN ?? null,
|
|
118585
118996
|
log: brainLog
|
|
118586
118997
|
});
|
|
118587
118998
|
const turnTransport = (0, import_client_core46.createTurnTransport)({
|
|
@@ -118624,6 +119035,7 @@ async function runHeadless(flags2) {
|
|
|
118624
119035
|
() => permissionStore.rules()
|
|
118625
119036
|
);
|
|
118626
119037
|
executor.enableFileHistorySpill();
|
|
119038
|
+
executor.registerHostTool(import_client_core46.GOAL_REPORT_TOOL, async (params) => (0, import_client_core46.goalReportToolResult)(params));
|
|
118627
119039
|
const boundary = createBoundaryHandlers({
|
|
118628
119040
|
bridge,
|
|
118629
119041
|
executor,
|
|
@@ -118655,6 +119067,9 @@ async function runHeadless(flags2) {
|
|
|
118655
119067
|
permissionMode: a.permissionMode,
|
|
118656
119068
|
workspaceRoot: config.workspaceRoot,
|
|
118657
119069
|
clientType: "tui",
|
|
119070
|
+
// Omitted (not placeholdered) in an unstamped dev/test run — see the interactive
|
|
119071
|
+
// path in main.tsx for why the two absences must stay distinguishable.
|
|
119072
|
+
clientVersion: tuiVersion() ?? void 0,
|
|
118658
119073
|
mode: a.mode,
|
|
118659
119074
|
reasoning: a.reasoning,
|
|
118660
119075
|
tokenSaving: a.tokenSaving,
|
|
@@ -118682,7 +119097,8 @@ async function runHeadless(flags2) {
|
|
|
118682
119097
|
getMessages: () => snapshot,
|
|
118683
119098
|
getClientState: () => clientState,
|
|
118684
119099
|
routing: routing(),
|
|
118685
|
-
|
|
119100
|
+
// Every headless turn is a goal round — the claim tool is always on.
|
|
119101
|
+
clientCapabilities: [import_client_core46.GOAL_CAPABILITY],
|
|
118686
119102
|
drainQueuedInput: () => [],
|
|
118687
119103
|
getOrionResources: () => (0, import_client_core46.buildOrionSnapshot)(config.workspaceRoot, void 0, sessionId),
|
|
118688
119104
|
getFileHistoryManifest: () => executor.fileHistoryManifest(sessionId)
|
|
@@ -118698,7 +119114,11 @@ async function runHeadless(flags2) {
|
|
|
118698
119114
|
throw new Error(typeof data.error === "string" ? data.error : "turn failed");
|
|
118699
119115
|
}
|
|
118700
119116
|
if (Array.isArray(data.messages)) messages = data.messages;
|
|
118701
|
-
return {
|
|
119117
|
+
return {
|
|
119118
|
+
text: extractFinalAssistantText(data),
|
|
119119
|
+
evidence: (0, import_client_core46.goalEvidenceFromWire)(data.messages),
|
|
119120
|
+
claim: (0, import_client_core46.goalClaimFromWire)(data.messages)
|
|
119121
|
+
};
|
|
118702
119122
|
};
|
|
118703
119123
|
const { endReason, turns } = await runGoalLoop({
|
|
118704
119124
|
goal: flags2.goal,
|
|
@@ -118711,7 +119131,12 @@ async function runHeadless(flags2) {
|
|
|
118711
119131
|
evidence,
|
|
118712
119132
|
sessionId,
|
|
118713
119133
|
// Lets the check read the user's `goalEvaluate` model choice.
|
|
118714
|
-
workspaceRoot: config.workspaceRoot ?? null
|
|
119134
|
+
workspaceRoot: config.workspaceRoot ?? null,
|
|
119135
|
+
// The run's own model — the fallback when no evaluator model is
|
|
119136
|
+
// configured, so the check never lands on the gateway's deployment
|
|
119137
|
+
// default (see the interactive TUI's identical wiring).
|
|
119138
|
+
sessionModel: routing().model,
|
|
119139
|
+
sessionProvider: routing().provider
|
|
118715
119140
|
});
|
|
118716
119141
|
if (ruling.evaluated && !ruling.ok && ruling.achievable) {
|
|
118717
119142
|
process.stderr.write(`[headless] not met yet \u2014 ${(0, import_client_core46.goalReasonLine)(ruling.reason)}
|
|
@@ -118934,27 +119359,20 @@ async function main() {
|
|
|
118934
119359
|
const setSessionTitle = (title) => {
|
|
118935
119360
|
appStore.setState((s) => s.sessionTitle === title ? s : { ...s, sessionTitle: title });
|
|
118936
119361
|
};
|
|
118937
|
-
const
|
|
118938
|
-
|
|
118939
|
-
|
|
118940
|
-
|
|
118941
|
-
|
|
118942
|
-
|
|
118943
|
-
sessionId: next.sessionId,
|
|
118944
|
-
title,
|
|
118945
|
-
updatedAt: Date.now(),
|
|
118946
|
-
messages: next.messages,
|
|
118947
|
-
clientState: next.clientState,
|
|
118948
|
-
// The LIVE routing config (not a frozen startup snapshot), so a
|
|
118949
|
-
// mid-session /model or /persona change is what a later resume reuses.
|
|
118950
|
-
config: sessionRoutingFromApp(appStore.getState())
|
|
118951
|
-
});
|
|
118952
|
-
} catch {
|
|
118953
|
-
}
|
|
118954
|
-
}
|
|
119362
|
+
const autosave = createSessionAutosave({
|
|
119363
|
+
// The LIVE routing config (not a frozen startup snapshot), so a
|
|
119364
|
+
// mid-session /model or /persona change is what a later resume reuses.
|
|
119365
|
+
buildConfig: () => sessionRoutingFromApp(appStore.getState()),
|
|
119366
|
+
onTitle: setSessionTitle
|
|
119367
|
+
// keep the terminal-tab title in step with the save
|
|
118955
119368
|
});
|
|
119369
|
+
const transcriptStore = createTranscriptStore(autosave.onChange);
|
|
118956
119370
|
const secrets = createSecretStore();
|
|
118957
|
-
const session = (0, import_client_core49.createAgentSession)(secrets, config
|
|
119371
|
+
const session = (0, import_client_core49.createAgentSession)(secrets, config, {
|
|
119372
|
+
// Renewal/refresh breadcrumbs (step outcomes + timings, never tokens) — the evidence
|
|
119373
|
+
// the 2026-08-22 refresh-wedge investigation lacked.
|
|
119374
|
+
trace: (line) => console.error(`[orion-auth] ${line}`)
|
|
119375
|
+
});
|
|
118958
119376
|
const outcomes = new import_client_core49.OutcomeReporter({
|
|
118959
119377
|
apiBaseUrl: () => config.accountsApiUrl,
|
|
118960
119378
|
accessToken: () => session.currentAccessToken()
|
|
@@ -119027,10 +119445,10 @@ async function main() {
|
|
|
119027
119445
|
}),
|
|
119028
119446
|
gatewayUrl: () => config.apiUrl,
|
|
119029
119447
|
clientVersion: tuiVersion() ?? "0.0.0-dev",
|
|
119030
|
-
// Mid-segment token-expiry heal: the
|
|
119031
|
-
//
|
|
119032
|
-
//
|
|
119033
|
-
renewBearer: () =>
|
|
119448
|
+
// Mid-segment token-expiry heal: the FAIL-CLOSED renewal seam, NOT the fail-open
|
|
119449
|
+
// per-segment authToken read — the refused token rides in so the answer is decided
|
|
119450
|
+
// on token identity, never local clocks; an emptied store re-gates the chat.
|
|
119451
|
+
renewBearer: (refused) => renewedTransportBearer(session, appStore, refused, process.env.ORION_AUTH_TOKEN),
|
|
119034
119452
|
log: brainLog
|
|
119035
119453
|
});
|
|
119036
119454
|
return brainInstance;
|
|
@@ -119141,7 +119559,9 @@ async function main() {
|
|
|
119141
119559
|
if (resumeId) {
|
|
119142
119560
|
const saved = loadSession(resumeId);
|
|
119143
119561
|
if (saved) {
|
|
119144
|
-
transcriptStore.setState(
|
|
119562
|
+
transcriptStore.setState(
|
|
119563
|
+
() => hydrate(saved.sessionId, saved.messages, saved.clientState, saved.transcript)
|
|
119564
|
+
);
|
|
119145
119565
|
appStore.setState((s) => ({ ...s, ...resumedRouting(s, saved.config) }));
|
|
119146
119566
|
setSessionTitle(saved.title ?? "");
|
|
119147
119567
|
}
|
|
@@ -119312,7 +119732,9 @@ async function main() {
|
|
|
119312
119732
|
await bridge.closeSession(sessionId).catch(() => void 0);
|
|
119313
119733
|
let restoredRouting = sessionRoutingFromApp(appStore.getState());
|
|
119314
119734
|
if (saved) {
|
|
119315
|
-
transcriptStore.setState(
|
|
119735
|
+
transcriptStore.setState(
|
|
119736
|
+
() => hydrate(saved.sessionId, saved.messages, saved.clientState, saved.transcript)
|
|
119737
|
+
);
|
|
119316
119738
|
const restored = resumedRouting(appStore.getState(), saved.config);
|
|
119317
119739
|
appStore.setState((s) => ({ ...s, ...restored }));
|
|
119318
119740
|
restoredRouting = { ...saved.config, ...restored };
|
|
@@ -119476,6 +119898,7 @@ async function main() {
|
|
|
119476
119898
|
let app = null;
|
|
119477
119899
|
let stopSignInWatch = null;
|
|
119478
119900
|
const exit = () => {
|
|
119901
|
+
autosave.flush();
|
|
119479
119902
|
stopSignInWatch?.();
|
|
119480
119903
|
presence.dispose();
|
|
119481
119904
|
void rc?.dispose();
|
|
@@ -119769,6 +120192,11 @@ async function main() {
|
|
|
119769
120192
|
workspaceRoot: config.workspaceRoot,
|
|
119770
120193
|
clientType: "tui",
|
|
119771
120194
|
// usage-telemetry surface tag
|
|
120195
|
+
// …and the build behind that tag. `tuiVersion()` is null in an unstamped dev/test run,
|
|
120196
|
+
// which becomes `undefined` here so the key is OMITTED rather than sent as a placeholder:
|
|
120197
|
+
// "not reported" and "reported but unreadable" are different states downstream, and a dev
|
|
120198
|
+
// build is the former.
|
|
120199
|
+
clientVersion: tuiVersion() ?? void 0,
|
|
119772
120200
|
// mode/reasoning/context_window ride the body too (rule 1) so a cold pod keeps
|
|
119773
120201
|
// plan/ask read-only + the right model settings — not a per-pod set_* RPC.
|
|
119774
120202
|
mode: a.mode,
|
|
@@ -119936,7 +120364,10 @@ async function main() {
|
|
|
119936
120364
|
import_client_core49.DUET_REPLAN_CAPABILITY,
|
|
119937
120365
|
// …and runs the planner's `hand_off` (leg marker, phase line, journal), so
|
|
119938
120366
|
// planner entry may offer it (further leg-gated backend-side).
|
|
119939
|
-
import_client_core49.DUET_HANDOFF_CAPABILITY
|
|
120367
|
+
import_client_core49.DUET_HANDOFF_CAPABILITY,
|
|
120368
|
+
// `goal` lights up the goal_report claim tool, and only while a goal is
|
|
120369
|
+
// actually driving this conversation — an ordinary chat never sees it.
|
|
120370
|
+
...goalRunner !== null ? [import_client_core49.GOAL_CAPABILITY] : []
|
|
119940
120371
|
],
|
|
119941
120372
|
extraBody: {
|
|
119942
120373
|
...appStore.getState().subagentsEnabled ? agentManager.parentExtraBody() : {},
|
|
@@ -120012,7 +120443,8 @@ async function main() {
|
|
|
120012
120443
|
endSettle = {
|
|
120013
120444
|
kind: "complete",
|
|
120014
120445
|
finalText: (0, import_client_core49.finalAssistantTextFromWire)(data.messages),
|
|
120015
|
-
evidence: (0, import_client_core49.goalEvidenceFromWire)(data.messages)
|
|
120446
|
+
evidence: (0, import_client_core49.goalEvidenceFromWire)(data.messages),
|
|
120447
|
+
claim: (0, import_client_core49.goalClaimFromWire)(data.messages)
|
|
120016
120448
|
};
|
|
120017
120449
|
(0, import_client_core48.recordTurnMetrics)({
|
|
120018
120450
|
app: "tui",
|
|
@@ -120193,6 +120625,7 @@ async function main() {
|
|
|
120193
120625
|
);
|
|
120194
120626
|
return (0, import_client_core49.duetHandoffResult)();
|
|
120195
120627
|
});
|
|
120628
|
+
executor.registerHostTool(import_client_core49.GOAL_REPORT_TOOL, async (params) => (0, import_client_core49.goalReportToolResult)(params));
|
|
120196
120629
|
const loopService = new LoopService({
|
|
120197
120630
|
workspaceRoot: config.workspaceRoot,
|
|
120198
120631
|
schedulePath: loopSchedulePathFor((0, import_client_core49.runsRootFor)("loops", config.workspaceRoot)),
|
|
@@ -120266,12 +120699,27 @@ async function main() {
|
|
|
120266
120699
|
// stranger's routing.
|
|
120267
120700
|
sessionId: goalSessionId ?? void 0,
|
|
120268
120701
|
// Lets the check read the user's `goalEvaluate` model choice.
|
|
120269
|
-
workspaceRoot: currentRouting().workspaceRoot ?? null
|
|
120702
|
+
workspaceRoot: currentRouting().workspaceRoot ?? null,
|
|
120703
|
+
// The session's model as THIS CLIENT knows it — the fallback when no
|
|
120704
|
+
// evaluator model is configured. The gateway's own session record can
|
|
120705
|
+
// still hold the deployment default for a local-brain session (routing
|
|
120706
|
+
// rides segment bodies), and a check on that default is a check on a
|
|
120707
|
+
// model this session never used.
|
|
120708
|
+
sessionModel: currentRouting().model,
|
|
120709
|
+
sessionProvider: currentRouting().provider
|
|
120270
120710
|
});
|
|
120271
|
-
if (ruling.evaluated && !ruling.ok && ruling.achievable) {
|
|
120272
|
-
transcriptStore.setState((s) => appendGoalNoteFor(s, goalSessionId, (0, import_client_core49.goalNotMetRow)(ruling.reason)));
|
|
120273
|
-
}
|
|
120274
120711
|
return ruling;
|
|
120712
|
+
},
|
|
120713
|
+
// A round that did NOT meet the goal says so — in the judge's words when a
|
|
120714
|
+
// check ran, in the agent's own honest not-done report when none did
|
|
120715
|
+
// (goalRoundReason is the one mapping, shared by every client). Without it
|
|
120716
|
+
// a long goal is a wall of identical continuation lines and a stuck one is
|
|
120717
|
+
// indistinguishable from a working one.
|
|
120718
|
+
onRound: (round) => {
|
|
120719
|
+
const reason = (0, import_client_core49.goalRoundReason)(round);
|
|
120720
|
+
if (reason !== "") {
|
|
120721
|
+
transcriptStore.setState((s) => appendGoalNoteFor(s, goalSessionId, (0, import_client_core49.goalNotMetRow)(reason)));
|
|
120722
|
+
}
|
|
120275
120723
|
}
|
|
120276
120724
|
});
|
|
120277
120725
|
goalRunner = runner;
|
|
@@ -120287,6 +120735,7 @@ async function main() {
|
|
|
120287
120735
|
runCommand: routeInput
|
|
120288
120736
|
});
|
|
120289
120737
|
});
|
|
120738
|
+
transcriptStore.setState((s) => appendGoalNoteFor(s, goalSessionId, (0, import_client_core49.goalSetRow)(goal)));
|
|
120290
120739
|
};
|
|
120291
120740
|
const enqueueSteer = (text) => {
|
|
120292
120741
|
appStore.setState((s) => ({ ...s, queuedMessages: [...s.queuedMessages, queuedSteer(text)] }));
|