@staff0rd/assist 0.1205.1 → 0.1206.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.build-files +81 -81
- package/dist/{addActivity-C7CQU77O.js → addActivity-T47YPQ32.js} +2 -2
- package/dist/{addPhase-XIZBVLKI.js → addPhase-A7UMGEDT.js} +3 -3
- package/dist/{advise-Y3AWGNRW.js → advise-5YPOLIPO.js} +3 -3
- package/dist/{askCheck-MBWUKVDX.js → askCheck-SQUEDT2W.js} +7 -7
- package/dist/{askDesign-2OGGVOTR.js → askDesign-MW7OGKZ7.js} +1 -1
- package/dist/{branch-5BMQG22A.js → branch-2GOCZVH7.js} +3 -3
- package/dist/built-version +1 -1
- package/dist/{chunk-Q46O2NY4.js → chunk-23KDKNHF.js} +1 -1
- package/dist/{chunk-LMJ6SN7O.js → chunk-2OZEMAE7.js} +2 -2
- package/dist/{chunk-VANA6DOS.js → chunk-43VSTJFO.js} +1 -1
- package/dist/{chunk-EWMLE2BH.js → chunk-4AWEQ3D2.js} +1 -1
- package/dist/{chunk-B3UDYQVE.js → chunk-4EA6QL6S.js} +1 -1
- package/dist/{chunk-Q7Z2WK7K.js → chunk-4LL3UC6H.js} +1 -1
- package/dist/{chunk-LSELJBYW.js → chunk-5SZHW4TK.js} +6 -6
- package/dist/{chunk-HFIKQCUQ.js → chunk-5U2HISQ5.js} +1 -1
- package/dist/{chunk-XUS642CO.js → chunk-6HHIDGAV.js} +1 -1
- package/dist/{chunk-W3OYAV5A.js → chunk-7IQSU5AM.js} +1 -1
- package/dist/{chunk-LCHO6Y6J.js → chunk-7T5DGKEB.js} +1 -1
- package/dist/{chunk-JVJVXNZE.js → chunk-AF5X4SNA.js} +5 -5
- package/dist/{chunk-VXRF3XZY.js → chunk-BI6JSWLX.js} +1 -1
- package/dist/{chunk-HXCP3QNZ.js → chunk-BJXVMMAQ.js} +4 -3
- package/dist/{chunk-6372ROCN.js → chunk-C57RCE2A.js} +1 -1
- package/dist/{chunk-WMASQXAY.js → chunk-DWAPTABB.js} +1 -1
- package/dist/{chunk-DRWCRBYW.js → chunk-FFLNNXLN.js} +2 -2
- package/dist/{chunk-ISWATEG7.js → chunk-FV6TS4X6.js} +1 -1
- package/dist/{chunk-TYTFLRU3.js → chunk-HHEBWLP2.js} +1 -1
- package/dist/{chunk-SAWRIZKP.js → chunk-K2OYVIGQ.js} +1 -1
- package/dist/{chunk-QC7AMI2B.js → chunk-L2YH4DJG.js} +3 -3
- package/dist/{chunk-C2EXUOAJ.js → chunk-M2QV4QAJ.js} +2 -2
- package/dist/{chunk-L5YYTG6U.js → chunk-MQ6U2CPS.js} +1 -1
- package/dist/{chunk-CRVWU2AZ.js → chunk-QRRBQ42Z.js} +1 -1
- package/dist/{chunk-ENMUADPA.js → chunk-SXISDHRK.js} +1 -1
- package/dist/{chunk-Y2XFGQ6N.js → chunk-UDCE7IDL.js} +1 -1
- package/dist/{chunk-4R3UNIRM.js → chunk-UNCGDNLU.js} +1 -1
- package/dist/{chunk-DLTBIPYE.js → chunk-UXMYCP7N.js} +1 -1
- package/dist/{chunk-HSTR2OOZ.js → chunk-VABPZCAT.js} +1 -1
- package/dist/{chunk-MNN7QCJK.js → chunk-VRY7SPWV.js} +1 -1
- package/dist/{chunk-ZHCUJKMW.js → chunk-WOZ7QRTJ.js} +1 -1
- package/dist/{chunk-335SBSOO.js → chunk-WP3JQGEF.js} +2 -2
- package/dist/{chunk-OAWQQXXJ.js → chunk-X77FNPAE.js} +1 -1
- package/dist/{chunk-XPMD3FVL.js → chunk-XPBVVIGF.js} +1 -1
- package/dist/{chunk-RK6SQ3LG.js → chunk-XXOJFNEL.js} +3 -3
- package/dist/{chunk-Y54ZGQFJ.js → chunk-YELDTSFL.js} +193 -21
- package/dist/{chunk-RUBYT3RB.js → chunk-Z6QEZXWN.js} +7 -7
- package/dist/{chunk-VGGATBZX.js → chunk-ZCNOOZ3S.js} +2 -2
- package/dist/{cliHook-ZJXLCZHK.js → cliHook-B44ITJK5.js} +6 -6
- package/dist/{cliHookCheck-YH3XDEK4.js → cliHookCheck-PPGLKQKC.js} +2 -2
- package/dist/{codexHook-QEHTWREP.js → codexHook-WGWAA2TH.js} +8 -8
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/{commit-EISKJT6B.js → commit-6ZNP2CQQ.js} +4 -4
- package/dist/{doctorNodes-TGTS7BMN.js → doctorNodes-GRAN5QBD.js} +3 -3
- package/dist/{done-IXD5E52K.js → done-WNMATSRF.js} +4 -4
- package/dist/{editHook-DA75RROQ.js → editHook-A6NY77YJ.js} +6 -6
- package/dist/{fixConflict-4LWMD7JI.js → fixConflict-XGVQFKWQ.js} +4 -4
- package/dist/index.js +50 -50
- package/dist/{launchMode-7JYECT64.js → launchMode-UVHEJ5FW.js} +14 -14
- package/dist/{list-EKL2KRSR.js → list-X4AOTUYL.js} +5 -5
- package/dist/{migrate-4NLGUKDN.js → migrate-AGMNYDQA.js} +3 -3
- package/dist/{next-FD7FY4DO.js → next-ZHLGLVO2.js} +13 -13
- package/dist/{phaseDone-47FHVZMJ.js → phaseDone-SL2HT4MH.js} +5 -5
- package/dist/{piHook-QA64V47N.js → piHook-DKUK3F77.js} +6 -6
- package/dist/{propose-N2VLT5CX.js → propose-BJFTOUBJ.js} +4 -4
- package/dist/{refine-LBB7FSXO.js → refine-3OCKRXT5.js} +15 -15
- package/dist/{restartNode-LQC33YYU.js → restartNode-FZNR4MZL.js} +5 -5
- package/dist/{review-MGY7E5RJ.js → review-23P4DUOG.js} +4 -4
- package/dist/{reviewPrComments-3J4RK73O.js → reviewPrComments-GIHW7HMR.js} +4 -4
- package/dist/{rewindPhase-5PNIOK6O.js → rewindPhase-74B5F6BO.js} +8 -8
- package/dist/{run-Y3EFHKBH.js → run-6YFS7T36.js} +11 -11
- package/dist/{run-R2BVMRHJ.js → run-XAQWPODF.js} +11 -11
- package/dist/{runDaemon-FDBXVVAC.js → runDaemon-5LNE72RG.js} +2944 -3004
- package/dist/{runParallelPhase-GYVHPFDR.js → runParallelPhase-F5HPFO57.js} +76 -32
- package/dist/{runRefine-ER3SA3A3.js → runRefine-OWW464AB.js} +15 -15
- package/dist/{scan-6ZB5QDCR.js → scan-UEMC5H6N.js} +2 -2
- package/dist/{schemaConfirm-FHHRQADX.js → schemaConfirm-F3VLHLM2.js} +2 -2
- package/dist/{schemaLock-HCK5ZN5K.js → schemaLock-M3KTPSP7.js} +2 -2
- package/dist/{schemaUnlock-2PFO2FOR.js → schemaUnlock-522W46NT.js} +2 -2
- package/dist/{search-FD4ASTTK.js → search-3ZQTT2JK.js} +5 -5
- package/dist/{show-UG3HAYTY.js → show-HBSCXQX4.js} +3 -3
- package/dist/{show-KAZ5DQQ5.js → show-KLFMWVER.js} +3 -3
- package/dist/{signExtension-NEHXMI3S.js → signExtension-4VZHIZEN.js} +1 -1
- package/dist/{updateNode-F7RAJWGM.js → updateNode-Z4UC5C7T.js} +5 -5
- package/dist/{updatePlan-BXHTV2F2.js → updatePlan-CRBWRWKX.js} +4 -4
- package/dist/{web-QGG74UCG.js → web-BEZ5EP5X.js} +16 -16
- package/dist/{web-YOE7ORW4.js → web-N7X4T3H6.js} +16 -16
- package/package.json +1 -1
|
@@ -2979,6 +2979,11 @@ function codexHookProbe() {
|
|
|
2979
2979
|
return status;
|
|
2980
2980
|
}
|
|
2981
2981
|
|
|
2982
|
+
// src/shared/codexSandboxMode.ts
|
|
2983
|
+
function codexSandboxMode(allowEdits) {
|
|
2984
|
+
return allowEdits === false ? "read-only" : "workspace-write";
|
|
2985
|
+
}
|
|
2986
|
+
|
|
2982
2987
|
// src/shared/readCodexRulePerms.ts
|
|
2983
2988
|
import { existsSync as existsSync7, readdirSync as readdirSync3, readFileSync as readFileSync7 } from "fs";
|
|
2984
2989
|
import { join as join13 } from "path";
|
|
@@ -3086,16 +3091,18 @@ function neutralizeCodexSkillMentions(prompt) {
|
|
|
3086
3091
|
return prompt.replace(/\$(?=[a-z])/g, `$${WORD_JOINER}`);
|
|
3087
3092
|
}
|
|
3088
3093
|
|
|
3094
|
+
// src/shared/codexSkillPrompt.ts
|
|
3095
|
+
function codexSkillPrompt(skill, prompt) {
|
|
3096
|
+
return [skill && `$${skill}`, prompt && neutralizeCodexSkillMentions(prompt)].filter(Boolean).join(" ");
|
|
3097
|
+
}
|
|
3098
|
+
|
|
3089
3099
|
// src/shared/spawnCodex.ts
|
|
3090
3100
|
function spawnCodex2(prompt, options = {}) {
|
|
3091
3101
|
const cwd = options.cwd ?? process.cwd();
|
|
3092
3102
|
trustCodexProject(cwd);
|
|
3093
3103
|
const untrusted = prepareCodexHookTrust();
|
|
3094
3104
|
if (untrusted) console.error(untrusted);
|
|
3095
|
-
const text =
|
|
3096
|
-
options.skill && `$${options.skill}`,
|
|
3097
|
-
prompt && neutralizeCodexSkillMentions(prompt)
|
|
3098
|
-
].filter(Boolean).join(" ");
|
|
3105
|
+
const text = codexSkillPrompt(options.skill, prompt);
|
|
3099
3106
|
const override = options.model && !options.resumeSessionId ? { args: ["-m", options.model], env: {} } : buildHarnessCodexArgs();
|
|
3100
3107
|
return spawnInherit(
|
|
3101
3108
|
harnesses.codex.command,
|
|
@@ -3327,7 +3334,6 @@ function rejectConnectorRun(harness) {
|
|
|
3327
3334
|
}
|
|
3328
3335
|
|
|
3329
3336
|
// src/shared/harnessAdapters/codexAdapter.ts
|
|
3330
|
-
var sandbox = (allowEdits) => allowEdits === false ? "read-only" : "workspace-write";
|
|
3331
3337
|
var codexAdapter = {
|
|
3332
3338
|
kind: "codex",
|
|
3333
3339
|
label: harnessLabel("codex"),
|
|
@@ -3353,14 +3359,14 @@ var codexAdapter = {
|
|
|
3353
3359
|
permissionRules: readCodexRulePerms,
|
|
3354
3360
|
launchSkill: (skill, args, { cwd, allowEdits, model }) => spawnCodex2(args ?? "", {
|
|
3355
3361
|
cwd,
|
|
3356
|
-
sandbox:
|
|
3362
|
+
sandbox: codexSandboxMode(allowEdits),
|
|
3357
3363
|
skill,
|
|
3358
3364
|
model
|
|
3359
3365
|
}),
|
|
3360
|
-
launchPrompt: (prompt, { cwd, allowEdits, model }) => spawnCodex2(prompt, { cwd, sandbox:
|
|
3366
|
+
launchPrompt: (prompt, { cwd, allowEdits, model }) => spawnCodex2(prompt, { cwd, sandbox: codexSandboxMode(allowEdits), model }),
|
|
3361
3367
|
resume: (conversationId, nudge, { cwd, allowEdits }) => spawnCodex2(nudge, {
|
|
3362
3368
|
cwd,
|
|
3363
|
-
sandbox:
|
|
3369
|
+
sandbox: codexSandboxMode(allowEdits),
|
|
3364
3370
|
resumeSessionId: conversationId
|
|
3365
3371
|
}),
|
|
3366
3372
|
interactive: ({
|
|
@@ -3579,14 +3585,33 @@ function createSdkExit(emit, child) {
|
|
|
3579
3585
|
};
|
|
3580
3586
|
}
|
|
3581
3587
|
|
|
3588
|
+
// src/commands/sessions/daemon/sdk/sdkEventListeners.ts
|
|
3589
|
+
function sdkEventListeners() {
|
|
3590
|
+
const listeners = [];
|
|
3591
|
+
let resumed = false;
|
|
3592
|
+
let conversation;
|
|
3593
|
+
return {
|
|
3594
|
+
onEvent: (listener) => {
|
|
3595
|
+
listeners.push(listener);
|
|
3596
|
+
if (resumed) listener({ kind: "resumed" });
|
|
3597
|
+
if (conversation) listener(conversation);
|
|
3598
|
+
},
|
|
3599
|
+
emit: (event) => {
|
|
3600
|
+
if (event.kind === "resumed") resumed = true;
|
|
3601
|
+
if (event.kind === "conversation") conversation = event;
|
|
3602
|
+
for (const listener of listeners) listener(event);
|
|
3603
|
+
}
|
|
3604
|
+
};
|
|
3605
|
+
}
|
|
3606
|
+
|
|
3582
3607
|
// src/commands/sessions/daemon/sdk/sdkSessionHandle.ts
|
|
3583
3608
|
function sdkSessionHandle(label, backgroundTasks) {
|
|
3584
|
-
const
|
|
3609
|
+
const events = sdkEventListeners();
|
|
3585
3610
|
let turn;
|
|
3586
3611
|
let prefixer;
|
|
3587
3612
|
const unbound = (action) => daemonLog(`${label} sdk ${action} dropped: query not started`);
|
|
3588
3613
|
const handle = {
|
|
3589
|
-
onEvent:
|
|
3614
|
+
onEvent: events.onEvent,
|
|
3590
3615
|
send: (text) => turn ? turn.send(text) : unbound("message"),
|
|
3591
3616
|
interrupt: () => turn ? turn.interrupt() : unbound("interrupt"),
|
|
3592
3617
|
dequeue: (index, text) => {
|
|
@@ -3603,9 +3628,7 @@ function sdkSessionHandle(label, backgroundTasks) {
|
|
|
3603
3628
|
};
|
|
3604
3629
|
return {
|
|
3605
3630
|
handle,
|
|
3606
|
-
emit:
|
|
3607
|
-
for (const listener of listeners) listener(event);
|
|
3608
|
-
},
|
|
3631
|
+
emit: events.emit,
|
|
3609
3632
|
/* why: held shell results join a message only as it reaches Claude, so a
|
|
3610
3633
|
* message queued mid-turn still picks up output that finished after it. */
|
|
3611
3634
|
prefix: (text) => {
|
|
@@ -4078,6 +4101,7 @@ function applyDrivenTurnEvent(event, control, turn, backgroundTasks) {
|
|
|
4078
4101
|
else if (event.kind === "elapsed") turn.setElapsed(event.seconds);
|
|
4079
4102
|
else if (event.kind === "suggestion")
|
|
4080
4103
|
control.emit({ kind: "suggestion", text: event.text });
|
|
4104
|
+
else if (event.kind === "conversation") control.emit(event);
|
|
4081
4105
|
else if (backgroundTasks)
|
|
4082
4106
|
control.emit({ kind: "background", tasks: event.tasks });
|
|
4083
4107
|
}
|
|
@@ -4592,6 +4616,24 @@ var claudeSdkAdapter = {
|
|
|
4592
4616
|
// src/commands/sessions/daemon/sdk/codex/codexSdkDriver.ts
|
|
4593
4617
|
import { Codex } from "@openai/codex-sdk";
|
|
4594
4618
|
|
|
4619
|
+
// src/commands/sessions/daemon/sdk/codex/awaitCodexResume.ts
|
|
4620
|
+
function awaitCodexResume(label, threadId, control) {
|
|
4621
|
+
findCodexRolloutPath(threadId).then(
|
|
4622
|
+
(rollout) => {
|
|
4623
|
+
daemonLog(
|
|
4624
|
+
rollout ? `${label} codex sdk resume complete: ${rollout}` : `${label} codex sdk resume found no rollout for thread ${threadId}`
|
|
4625
|
+
);
|
|
4626
|
+
control.emit({ kind: "resumed" });
|
|
4627
|
+
},
|
|
4628
|
+
(error) => {
|
|
4629
|
+
daemonLog(
|
|
4630
|
+
`${label} codex sdk resume lookup failed: ${error instanceof Error ? error.message : String(error)}`
|
|
4631
|
+
);
|
|
4632
|
+
control.emit({ kind: "resumed" });
|
|
4633
|
+
}
|
|
4634
|
+
);
|
|
4635
|
+
}
|
|
4636
|
+
|
|
4595
4637
|
// src/commands/sessions/daemon/sdk/codex/codexSdkConfig.ts
|
|
4596
4638
|
function codexSdkConfig(args) {
|
|
4597
4639
|
const config = {
|
|
@@ -4655,7 +4697,7 @@ function codexSdkOptions(opts2) {
|
|
|
4655
4697
|
thread: {
|
|
4656
4698
|
model: config.model,
|
|
4657
4699
|
workingDirectory: opts2.cwd,
|
|
4658
|
-
sandboxMode:
|
|
4700
|
+
sandboxMode: codexSandboxMode(opts2.allowEdits),
|
|
4659
4701
|
approvalPolicy: "on-request",
|
|
4660
4702
|
skipGitRepoCheck: true,
|
|
4661
4703
|
additionalDirectories: config.additionalDirectories
|
|
@@ -4690,7 +4732,7 @@ function codexEventTurnEvents(event, label) {
|
|
|
4690
4732
|
return [{ kind: "activity", text: codexItemActivity(event.item) }];
|
|
4691
4733
|
case "thread.started":
|
|
4692
4734
|
daemonLog(`${label} codex thread started: ${event.thread_id}`);
|
|
4693
|
-
return [];
|
|
4735
|
+
return [{ kind: "conversation", id: event.thread_id }];
|
|
4694
4736
|
case "turn.failed":
|
|
4695
4737
|
daemonLog(`${label} codex turn failed: ${event.error.message}`);
|
|
4696
4738
|
return [];
|
|
@@ -4732,10 +4774,116 @@ function codexTurnEvents(input, runTurn, label) {
|
|
|
4732
4774
|
};
|
|
4733
4775
|
}
|
|
4734
4776
|
|
|
4777
|
+
// src/commands/sessions/shared/codex/codexRolloutUsage.ts
|
|
4778
|
+
import * as fs15 from "fs";
|
|
4779
|
+
|
|
4780
|
+
// src/commands/sessions/shared/codex/applyTokenInfo.ts
|
|
4781
|
+
function applyTokenInfo(usage, byId, conversationId, rawInfo) {
|
|
4782
|
+
if (!rawInfo || typeof rawInfo !== "object") return;
|
|
4783
|
+
const info = rawInfo;
|
|
4784
|
+
const last = info.last_token_usage;
|
|
4785
|
+
const cumulative = info.total_token_usage?.total_tokens;
|
|
4786
|
+
if (!last || typeof cumulative !== "number") return;
|
|
4787
|
+
const messageId = `codex:${conversationId}:${cumulative}`;
|
|
4788
|
+
byId.set(messageId, {
|
|
4789
|
+
messageId,
|
|
4790
|
+
inputTokens: Math.max(
|
|
4791
|
+
0,
|
|
4792
|
+
(last.input_tokens ?? 0) - (last.cached_input_tokens ?? 0)
|
|
4793
|
+
),
|
|
4794
|
+
outputTokens: last.output_tokens ?? 0
|
|
4795
|
+
});
|
|
4796
|
+
const contextWindow = info.model_context_window;
|
|
4797
|
+
if (contextWindow && typeof last.total_tokens === "number")
|
|
4798
|
+
usage.usedPct = Math.min(100, last.total_tokens / contextWindow * 100);
|
|
4799
|
+
}
|
|
4800
|
+
|
|
4801
|
+
// src/commands/sessions/shared/codex/toRateLimits.ts
|
|
4802
|
+
var WINDOW_BY_MINUTES = {
|
|
4803
|
+
300: "five_hour",
|
|
4804
|
+
10080: "seven_day"
|
|
4805
|
+
};
|
|
4806
|
+
function toRateLimits(raw) {
|
|
4807
|
+
if (!raw || typeof raw !== "object") return void 0;
|
|
4808
|
+
const { primary, secondary } = raw;
|
|
4809
|
+
const rateLimits = {};
|
|
4810
|
+
for (const candidate of [primary, secondary]) {
|
|
4811
|
+
if (!candidate || typeof candidate !== "object") continue;
|
|
4812
|
+
const limit = candidate;
|
|
4813
|
+
const window = WINDOW_BY_MINUTES[limit.window_minutes ?? 0];
|
|
4814
|
+
if (!window || typeof limit.used_percent !== "number") continue;
|
|
4815
|
+
rateLimits[window] = {
|
|
4816
|
+
used_percentage: limit.used_percent,
|
|
4817
|
+
resets_at: limit.resets_at
|
|
4818
|
+
};
|
|
4819
|
+
}
|
|
4820
|
+
return Object.keys(rateLimits).length > 0 ? rateLimits : void 0;
|
|
4821
|
+
}
|
|
4822
|
+
|
|
4823
|
+
// src/commands/sessions/shared/codex/codexRolloutUsage.ts
|
|
4824
|
+
function codexRolloutUsage(lines) {
|
|
4825
|
+
const usage = { responses: [] };
|
|
4826
|
+
const byId = /* @__PURE__ */ new Map();
|
|
4827
|
+
let conversationId = "";
|
|
4828
|
+
for (const line of lines) {
|
|
4829
|
+
const entry = parseRolloutEntry(line);
|
|
4830
|
+
if (!entry) continue;
|
|
4831
|
+
conversationId ||= sessionMetaId(entry);
|
|
4832
|
+
const payload = tokenCountPayload(entry);
|
|
4833
|
+
if (!payload) continue;
|
|
4834
|
+
applyTokenInfo(usage, byId, conversationId, payload.info);
|
|
4835
|
+
usage.rateLimits = toRateLimits(payload.rate_limits) ?? usage.rateLimits;
|
|
4836
|
+
}
|
|
4837
|
+
usage.responses = [...byId.values()];
|
|
4838
|
+
return usage;
|
|
4839
|
+
}
|
|
4840
|
+
async function readCodexRolloutUsage(rolloutPath) {
|
|
4841
|
+
const content = await fs15.promises.readFile(rolloutPath, "utf8");
|
|
4842
|
+
return codexRolloutUsage(content.split("\n"));
|
|
4843
|
+
}
|
|
4844
|
+
function sessionMetaId(entry) {
|
|
4845
|
+
if (entry.type !== "session_meta") return "";
|
|
4846
|
+
return rolloutString(rolloutPayload(entry).session_id);
|
|
4847
|
+
}
|
|
4848
|
+
function tokenCountPayload(entry) {
|
|
4849
|
+
if (entry.type !== "event_msg") return void 0;
|
|
4850
|
+
const payload = rolloutPayload(entry);
|
|
4851
|
+
return payload.type === "token_count" ? payload : void 0;
|
|
4852
|
+
}
|
|
4853
|
+
|
|
4854
|
+
// src/commands/sessions/daemon/sdk/codex/recordCodexTurnUsage.ts
|
|
4855
|
+
async function recordCodexTurnUsage(label, sessionId, threadId, usage) {
|
|
4856
|
+
daemonLog(
|
|
4857
|
+
`${label} codex turn usage: thread ${threadId ?? "unknown"} in ${usage.input_tokens} (cached ${usage.cached_input_tokens}) out ${usage.output_tokens}`
|
|
4858
|
+
);
|
|
4859
|
+
const sink2 = sdkUsageSink();
|
|
4860
|
+
if (!sink2 || !sessionId || !threadId) return;
|
|
4861
|
+
try {
|
|
4862
|
+
const rollout = await findCodexRolloutPath(threadId);
|
|
4863
|
+
if (!rollout) {
|
|
4864
|
+
daemonLog(`${label} codex turn usage: no rollout for thread ${threadId}`);
|
|
4865
|
+
return;
|
|
4866
|
+
}
|
|
4867
|
+
sink2.session(sessionId, "codex", await readCodexRolloutUsage(rollout));
|
|
4868
|
+
} catch (error) {
|
|
4869
|
+
daemonLog(
|
|
4870
|
+
`${label} codex turn usage read failed: ${error instanceof Error ? error.message : String(error)}`
|
|
4871
|
+
);
|
|
4872
|
+
}
|
|
4873
|
+
}
|
|
4874
|
+
|
|
4875
|
+
// src/commands/sessions/daemon/sdk/codex/withCodexTurnUsage.ts
|
|
4876
|
+
async function* withCodexTurnUsage(events, onUsage) {
|
|
4877
|
+
for await (const event of events) {
|
|
4878
|
+
if (event.type === "turn.completed") onUsage(event.usage);
|
|
4879
|
+
yield event;
|
|
4880
|
+
}
|
|
4881
|
+
}
|
|
4882
|
+
|
|
4735
4883
|
// src/commands/sessions/daemon/sdk/codex/codexSdkDriver.ts
|
|
4736
4884
|
var codexSdkDriver = {
|
|
4737
4885
|
harness: "codex-sdk",
|
|
4738
|
-
start: ({ opts: opts2, label, abort, input }) => {
|
|
4886
|
+
start: ({ opts: opts2, label, abort, control, input }) => {
|
|
4739
4887
|
prepareCodexLaunch(opts2.cwd);
|
|
4740
4888
|
const options = codexSdkOptions(opts2);
|
|
4741
4889
|
daemonLog(
|
|
@@ -4743,11 +4891,15 @@ var codexSdkDriver = {
|
|
|
4743
4891
|
);
|
|
4744
4892
|
const codex = new Codex(options.codex);
|
|
4745
4893
|
const thread = opts2.resumeId ? codex.resumeThread(opts2.resumeId, options.thread) : codex.startThread(options.thread);
|
|
4894
|
+
if (opts2.resumeId) awaitCodexResume(label, opts2.resumeId, control);
|
|
4746
4895
|
const turns = codexTurnEvents(
|
|
4747
4896
|
input,
|
|
4748
|
-
async (text, signal) => (
|
|
4749
|
-
|
|
4750
|
-
|
|
4897
|
+
async (text, signal) => withCodexTurnUsage(
|
|
4898
|
+
(await thread.runStreamed(text, {
|
|
4899
|
+
signal: AbortSignal.any([abort.signal, signal])
|
|
4900
|
+
})).events,
|
|
4901
|
+
(usage) => void recordCodexTurnUsage(label, opts2.sessionId, thread.id, usage)
|
|
4902
|
+
),
|
|
4751
4903
|
label
|
|
4752
4904
|
);
|
|
4753
4905
|
return { events: turns.events, interrupt: turns.interrupt };
|
|
@@ -4771,6 +4923,27 @@ var codexSdkAdapter = {
|
|
|
4771
4923
|
"intercept.fileWrite": codexHookProbe
|
|
4772
4924
|
},
|
|
4773
4925
|
detect: () => detectHarness("codex-sdk"),
|
|
4926
|
+
launchSkill: (skill, args, { cwd, allowEdits, model }) => launchSdkViaDaemon({
|
|
4927
|
+
harness: "codex-sdk",
|
|
4928
|
+
prompt: codexSkillPrompt(skill, args ?? ""),
|
|
4929
|
+
cwd,
|
|
4930
|
+
allowEdits,
|
|
4931
|
+
model
|
|
4932
|
+
}),
|
|
4933
|
+
launchPrompt: (prompt, { cwd, allowEdits, model }) => launchSdkViaDaemon({
|
|
4934
|
+
harness: "codex-sdk",
|
|
4935
|
+
prompt: codexSkillPrompt(void 0, prompt),
|
|
4936
|
+
cwd,
|
|
4937
|
+
allowEdits,
|
|
4938
|
+
model
|
|
4939
|
+
}),
|
|
4940
|
+
resume: (conversationId, nudge, { cwd, allowEdits }) => launchSdkViaDaemon({
|
|
4941
|
+
harness: "codex-sdk",
|
|
4942
|
+
prompt: codexSkillPrompt(void 0, nudge),
|
|
4943
|
+
cwd,
|
|
4944
|
+
allowEdits,
|
|
4945
|
+
resumeId: conversationId
|
|
4946
|
+
}),
|
|
4774
4947
|
interactive: ({
|
|
4775
4948
|
sessionId,
|
|
4776
4949
|
resumeId,
|
|
@@ -4838,11 +5011,10 @@ export {
|
|
|
4838
5011
|
resolveCodexModel,
|
|
4839
5012
|
discoverCodexRolloutPaths,
|
|
4840
5013
|
parseRolloutEntry,
|
|
4841
|
-
rolloutPayload,
|
|
4842
|
-
rolloutString,
|
|
4843
5014
|
codexRolloutMeta,
|
|
4844
5015
|
readCodexHeadLines,
|
|
4845
5016
|
codexAdapter,
|
|
5017
|
+
readCodexRolloutUsage,
|
|
4846
5018
|
piAdapter,
|
|
4847
5019
|
harnessAdapter
|
|
4848
5020
|
};
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "./chunk-JM57BCD6.js";
|
|
11
11
|
import {
|
|
12
12
|
firstBrokenHop
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-X77FNPAE.js";
|
|
14
14
|
import {
|
|
15
15
|
describePeerError,
|
|
16
16
|
fetchPeerJson
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
resolveLinkTarget,
|
|
40
40
|
usageWindowKey,
|
|
41
41
|
watcherLogPath
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-DWAPTABB.js";
|
|
43
43
|
import {
|
|
44
44
|
TRACE_HEADER,
|
|
45
45
|
newTraceId
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
import {
|
|
48
48
|
ASSIST_VERSION,
|
|
49
49
|
PROTOCOL_VERSION
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-C57RCE2A.js";
|
|
51
51
|
import {
|
|
52
52
|
findLinkSpec
|
|
53
53
|
} from "./chunk-K2SS6JVP.js";
|
|
@@ -84,7 +84,7 @@ import {
|
|
|
84
84
|
} from "./chunk-UJBW7FVI.js";
|
|
85
85
|
import {
|
|
86
86
|
targetConversationEvents
|
|
87
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-WP3JQGEF.js";
|
|
88
88
|
import {
|
|
89
89
|
configEntryLayers,
|
|
90
90
|
ghFailure,
|
|
@@ -245,7 +245,7 @@ import {
|
|
|
245
245
|
} from "./chunk-VXKPQCJZ.js";
|
|
246
246
|
import {
|
|
247
247
|
rewindItemToPhase
|
|
248
|
-
} from "./chunk-
|
|
248
|
+
} from "./chunk-FFLNNXLN.js";
|
|
249
249
|
import {
|
|
250
250
|
loadItemSummaries,
|
|
251
251
|
phaseUsageTotals,
|
|
@@ -268,7 +268,7 @@ import {
|
|
|
268
268
|
} from "./chunk-CD2DY5Q2.js";
|
|
269
269
|
import {
|
|
270
270
|
resolveRewindPlan
|
|
271
|
-
} from "./chunk-
|
|
271
|
+
} from "./chunk-ZCNOOZ3S.js";
|
|
272
272
|
import {
|
|
273
273
|
deleteItem,
|
|
274
274
|
getOrigin,
|
|
@@ -317,7 +317,7 @@ import {
|
|
|
317
317
|
discoverSessionJsonlPaths,
|
|
318
318
|
harnessAdapter,
|
|
319
319
|
parseSessionFile
|
|
320
|
-
} from "./chunk-
|
|
320
|
+
} from "./chunk-YELDTSFL.js";
|
|
321
321
|
import {
|
|
322
322
|
harnessLabel
|
|
323
323
|
} from "./chunk-D7PUN52R.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveReviewPhase
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-43VSTJFO.js";
|
|
4
4
|
import {
|
|
5
5
|
resolvePlan
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-5U2HISQ5.js";
|
|
7
7
|
|
|
8
8
|
// src/commands/backlog/resolveRewindPlan.ts
|
|
9
9
|
function resolveRewindPlan(item) {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
decideToolOperations,
|
|
3
3
|
logPolicyDeny
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-XXOJFNEL.js";
|
|
5
5
|
import "./chunk-CDU6M5IX.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-4AWEQ3D2.js";
|
|
7
|
+
import "./chunk-XPBVVIGF.js";
|
|
8
8
|
import "./chunk-QM5642B7.js";
|
|
9
9
|
import {
|
|
10
10
|
currentExecutionIdentity
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-FV6TS4X6.js";
|
|
12
12
|
import "./chunk-ZMH7UZNP.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-4LL3UC6H.js";
|
|
14
14
|
import "./chunk-VDXS55BC.js";
|
|
15
15
|
import "./chunk-HKGCLAZ7.js";
|
|
16
16
|
import "./chunk-FPWL4VRC.js";
|
|
@@ -28,7 +28,7 @@ import "./chunk-KG5JSDGB.js";
|
|
|
28
28
|
import "./chunk-GLWZIHQB.js";
|
|
29
29
|
import {
|
|
30
30
|
claudeAdapter
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-YELDTSFL.js";
|
|
32
32
|
import "./chunk-MRUIXQXS.js";
|
|
33
33
|
import "./chunk-NMFBCWVV.js";
|
|
34
34
|
import "./chunk-ASVTB7SX.js";
|
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
findTruncatedReadDenyRaw,
|
|
6
6
|
isApprovedRead,
|
|
7
7
|
splitCompound
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-4LL3UC6H.js";
|
|
9
9
|
import "./chunk-VDXS55BC.js";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-YELDTSFL.js";
|
|
11
11
|
import "./chunk-MRUIXQXS.js";
|
|
12
12
|
import "./chunk-NMFBCWVV.js";
|
|
13
13
|
import "./chunk-ASVTB7SX.js";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
decideToolOperations,
|
|
3
3
|
logPolicyDeny
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-XXOJFNEL.js";
|
|
5
5
|
import "./chunk-CDU6M5IX.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-4AWEQ3D2.js";
|
|
7
|
+
import "./chunk-XPBVVIGF.js";
|
|
8
8
|
import "./chunk-QM5642B7.js";
|
|
9
9
|
import {
|
|
10
10
|
currentExecutionIdentity
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-FV6TS4X6.js";
|
|
12
12
|
import "./chunk-ZMH7UZNP.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-4LL3UC6H.js";
|
|
14
14
|
import "./chunk-VDXS55BC.js";
|
|
15
15
|
import "./chunk-HKGCLAZ7.js";
|
|
16
16
|
import {
|
|
@@ -20,7 +20,7 @@ import "./chunk-FPWL4VRC.js";
|
|
|
20
20
|
import "./chunk-H63MI5HI.js";
|
|
21
21
|
import {
|
|
22
22
|
adviceHookPayload
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-QRRBQ42Z.js";
|
|
24
24
|
import "./chunk-P7FVAGFQ.js";
|
|
25
25
|
import "./chunk-XJTXAL22.js";
|
|
26
26
|
import {
|
|
@@ -40,11 +40,11 @@ import "./chunk-P6KSXCDA.js";
|
|
|
40
40
|
import "./chunk-J6ULAU7G.js";
|
|
41
41
|
import "./chunk-KG5JSDGB.js";
|
|
42
42
|
import "./chunk-GLWZIHQB.js";
|
|
43
|
-
import "./chunk-
|
|
43
|
+
import "./chunk-7IQSU5AM.js";
|
|
44
44
|
import "./chunk-V7KLQEG2.js";
|
|
45
45
|
import {
|
|
46
46
|
codexAdapter
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-YELDTSFL.js";
|
|
48
48
|
import "./chunk-MRUIXQXS.js";
|
|
49
49
|
import "./chunk-NMFBCWVV.js";
|
|
50
50
|
import "./chunk-ASVTB7SX.js";
|