xkzoom 1.5.4 → 1.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -0
- package/dist/{chunk-4JXTPCOE.mjs → chunk-2NBVNRMZ.mjs} +1 -1
- package/dist/{chunk-VIZQURO5.mjs → chunk-2PWU4VN6.mjs} +7 -7
- package/dist/{chunk-F35EHL5U.mjs → chunk-3K6WOVYD.mjs} +6 -6
- package/dist/{chunk-76MFE24I.mjs → chunk-3TTLV2GM.mjs} +1 -1
- package/dist/{chunk-GIC2RBVM.mjs → chunk-4BCLMOYG.mjs} +1 -1
- package/dist/{chunk-HAI7DJD2.mjs → chunk-54GVKP6B.mjs} +6 -6
- package/dist/{chunk-I7O5UR24.mjs → chunk-5IAQOOZ2.mjs} +5 -5
- package/dist/{chunk-MRTQWCNC.mjs → chunk-5U4JST47.mjs} +1 -1
- package/dist/{chunk-2IQAT3PE.mjs → chunk-64QYTQH7.mjs} +3 -3
- package/dist/{chunk-WPMJCKI2.mjs → chunk-6SYECCCG.mjs} +8 -8
- package/dist/{chunk-TADSGGK2.mjs → chunk-6VSIGHGI.mjs} +7 -7
- package/dist/{chunk-M3ISDSQP.mjs → chunk-APQRVOZQ.mjs} +5 -5
- package/dist/{chunk-QADC4VKT.mjs → chunk-CRYBNNZU.mjs} +10 -10
- package/dist/{chunk-PW3ULDNL.mjs → chunk-CVIZMDMZ.mjs} +1 -1
- package/dist/{chunk-GIAML5K5.mjs → chunk-DQ7J7RST.mjs} +1 -1
- package/dist/{chunk-YYDDQEY4.mjs → chunk-DXPZNBSQ.mjs} +1 -1
- package/dist/{chunk-VNEPNUBZ.mjs → chunk-DZDEUZD2.mjs} +11 -11
- package/dist/{chunk-5SE4JOKE.mjs → chunk-EBVVOJVN.mjs} +15 -15
- package/dist/{chunk-DCSERRXG.mjs → chunk-ED4H2DM7.mjs} +1 -1
- package/dist/{chunk-CQUISJWG.mjs → chunk-EYK3W2NV.mjs} +1 -1
- package/dist/{chunk-3KJHUTOO.mjs → chunk-FAB2ZZYB.mjs} +2 -2
- package/dist/{chunk-Q33JD64H.mjs → chunk-FCK6QFJB.mjs} +1 -1
- package/dist/{chunk-UXEZFEB3.mjs → chunk-FZ7NLBVP.mjs} +13 -13
- package/dist/{chunk-MDZUWIBH.mjs → chunk-G4JWJKD7.mjs} +13 -13
- package/dist/{chunk-GZJMFCRG.mjs → chunk-G5LQ2PQ6.mjs} +2 -2
- package/dist/{chunk-6W4W5JLG.mjs → chunk-GSIZ5FR6.mjs} +2 -2
- package/dist/{chunk-27BXVTXH.mjs → chunk-H4BNL7XG.mjs} +1 -1
- package/dist/{chunk-FG6QCRVN.mjs → chunk-H7DNHHNA.mjs} +1 -1
- package/dist/{chunk-7LEEVP5O.mjs → chunk-HVDIL2V7.mjs} +11 -11
- package/dist/{chunk-PJKLQF3K.mjs → chunk-INFZEMQK.mjs} +1 -1
- package/dist/{chunk-IDQ5B572.mjs → chunk-JK5ZK32E.mjs} +5 -5
- package/dist/{chunk-LFZAVCVW.mjs → chunk-LJ6RMHC6.mjs} +1 -1
- package/dist/{chunk-L252ASZW.mjs → chunk-LKHL3NCW.mjs} +1 -1
- package/dist/{chunk-PS6X3CND.mjs → chunk-LKSRZTSL.mjs} +1 -0
- package/dist/{chunk-LESS4N25.mjs → chunk-LMIEVEGA.mjs} +5 -5
- package/dist/{chunk-COYZO24J.mjs → chunk-MCD5TOFD.mjs} +1 -1
- package/dist/{chunk-JBKRS62W.mjs → chunk-MFIBP6MD.mjs} +4 -4
- package/dist/{chunk-CFZVBILR.mjs → chunk-MIXYB6BH.mjs} +1 -1
- package/dist/{chunk-3ZH273T7.mjs → chunk-MLHV7EMJ.mjs} +33 -33
- package/dist/{chunk-ZMQ3UOGP.mjs → chunk-MMWLRPKT.mjs} +13 -1
- package/dist/{chunk-OBYPZT2S.mjs → chunk-MTRG3ZME.mjs} +7 -7
- package/dist/{chunk-J5AXFEDQ.mjs → chunk-N6VFFREI.mjs} +52 -52
- package/dist/{chunk-TVH4LII3.mjs → chunk-ND44D2ZA.mjs} +1 -1
- package/dist/{chunk-JG3K4N5B.mjs → chunk-NIV5GVCE.mjs} +1 -1
- package/dist/{chunk-MPGMU75K.mjs → chunk-NUXJHSSQ.mjs} +5 -5
- package/dist/{chunk-JFFBD5TV.mjs → chunk-O7MFL7L4.mjs} +10 -10
- package/dist/{chunk-PETWGCGB.mjs → chunk-OMLMLZUY.mjs} +2 -2
- package/dist/{chunk-B4YKXZ5W.mjs → chunk-OQMIECO2.mjs} +1 -1
- package/dist/{chunk-ZTKJR7OC.mjs → chunk-OWIXULFQ.mjs} +1 -1
- package/dist/{chunk-JXDHNASC.mjs → chunk-P4WX5RWE.mjs} +20 -20
- package/dist/{chunk-JJKRD5DL.mjs → chunk-PN6I6DTV.mjs} +4 -4
- package/dist/{chunk-5YEFG7BF.mjs → chunk-QEED7NAG.mjs} +31 -31
- package/dist/{chunk-HYSOWPIC.mjs → chunk-RVW5XO4A.mjs} +4 -4
- package/dist/{chunk-NHICONJ3.mjs → chunk-RYSPXH7G.mjs} +2 -2
- package/dist/{chunk-IGDJGBAI.mjs → chunk-S5ROBD7X.mjs} +2 -2
- package/dist/{chunk-RKZ56GST.mjs → chunk-SKQOHRBI.mjs} +2 -2
- package/dist/{chunk-TQBVFKCT.mjs → chunk-SLBCSYGP.mjs} +8 -8
- package/dist/{chunk-W75Z6CZR.mjs → chunk-TER7DFHP.mjs} +1 -1
- package/dist/{chunk-NIU6GWKB.mjs → chunk-TNBK63NV.mjs} +4 -4
- package/dist/{chunk-K7RZQIPZ.mjs → chunk-U6ONSC6B.mjs} +1 -1
- package/dist/{chunk-2DR5RT3I.mjs → chunk-UAUV2GYH.mjs} +101 -101
- package/dist/{chunk-VWAUDB4X.mjs → chunk-UFURP7VS.mjs} +1 -1
- package/dist/{chunk-76TKUYY3.mjs → chunk-UPD527M4.mjs} +6 -6
- package/dist/{chunk-YPKHMAO4.mjs → chunk-VHRFLCMY.mjs} +1 -1
- package/dist/{chunk-M5IU6U3O.mjs → chunk-W6JEB555.mjs} +2 -2
- package/dist/{chunk-KPDVZFJY.mjs → chunk-WOHFGPTL.mjs} +1 -1
- package/dist/{chunk-24GJWXMG.mjs → chunk-WQFYA2BW.mjs} +3 -3
- package/dist/{chunk-E2TTUY6R.mjs → chunk-XADONCIM.mjs} +10 -10
- package/dist/{chunk-3VA3YDYL.mjs → chunk-XDR276NG.mjs} +1 -1
- package/dist/{chunk-MWRQORKQ.mjs → chunk-XF4EURDX.mjs} +1 -1
- package/dist/{chunk-JI67TW4E.mjs → chunk-YFKOQIA7.mjs} +1 -1
- package/dist/{chunk-MBOWNG3A.mjs → chunk-YKACMPVT.mjs} +1 -1
- package/dist/{chunk-D3N7EHB2.mjs → chunk-YSLLUNNZ.mjs} +9 -9
- package/dist/chunk-YTBKWX7J.mjs +102 -0
- package/dist/{chunk-2VSERWT6.mjs → chunk-YW5STVWH.mjs} +1 -1
- package/dist/{chunk-ETD5LGJY.mjs → chunk-Z3COATFF.mjs} +1 -1
- package/dist/{chunk-MQKREMOB.mjs → chunk-ZE6GJFY7.mjs} +7 -7
- package/dist/index.js +262 -162
- package/dist/index.mjs +182 -181
- package/dist/mobile/action-planner.mjs +105 -105
- package/dist/mobile/agent-capabilities.mjs +106 -106
- package/dist/mobile/agent-shop/handlers.mjs +3 -3
- package/dist/mobile/agents-watch.js +346 -0
- package/dist/mobile/agents-watch.mjs +13 -0
- package/dist/mobile/anthropic-incremental-deliver.mjs +3 -3
- package/dist/mobile/anthropic-messages-turn-runner.mjs +115 -115
- package/dist/mobile/anthropic-owned-tool-executor.mjs +114 -114
- package/dist/mobile/api.mjs +63 -63
- package/dist/mobile/auth.mjs +1 -1
- package/dist/mobile/bucket-events/emit-bucket-frame.js +327 -0
- package/dist/mobile/bucket-events/emit-bucket-frame.mjs +8 -3
- package/dist/mobile/bucket-events/register-bucket-gateway-bridge.js +320 -3
- package/dist/mobile/bucket-events/register-bucket-gateway-bridge.mjs +9 -4
- package/dist/mobile/channel.mjs +2 -2
- package/dist/mobile/context-compact/compact-artifact-enrich.mjs +14 -14
- package/dist/mobile/context-compact/compact-artifact-writer.mjs +3 -3
- package/dist/mobile/context-compact/compact-engine-artifacts.mjs +4 -4
- package/dist/mobile/context-compact/compact-memory-distill-job.mjs +3 -3
- package/dist/mobile/context-compact/compact-message-collector.mjs +2 -2
- package/dist/mobile/context-compact/compact-orchestrator.mjs +29 -29
- package/dist/mobile/context-compact/compact-resume-prefetch.mjs +3 -3
- package/dist/mobile/context-compact/compact-summarizer-engine-artifact.mjs +15 -15
- package/dist/mobile/context-compact/compact-summarizer-llm-request.mjs +10 -10
- package/dist/mobile/context-compact/compact-summarizer-llm.mjs +11 -11
- package/dist/mobile/context-compact/compact-summarizer.mjs +13 -13
- package/dist/mobile/context-compact/compact-write-verifier.mjs +2 -2
- package/dist/mobile/context-compact/runtime-compact-hook.mjs +109 -109
- package/dist/mobile/group/conductor-llm.mjs +13 -13
- package/dist/mobile/group/conductor-plan-llm.mjs +19 -19
- package/dist/mobile/group/delivery-verification.mjs +4 -4
- package/dist/mobile/group/direct-chat-group-context.mjs +1 -1
- package/dist/mobile/group/execution-plan.mjs +5 -5
- package/dist/mobile/group/floor-scheduler.mjs +6 -6
- package/dist/mobile/group/floor-state-store.mjs +6 -6
- package/dist/mobile/group/group-api-handlers.mjs +45 -45
- package/dist/mobile/group/group-peer-private-context.mjs +1 -1
- package/dist/mobile/group/group-session.mjs +18 -18
- package/dist/mobile/group/index.mjs +39 -39
- package/dist/mobile/group/memory-supplement.mjs +9 -9
- package/dist/mobile/group/orchestrator.mjs +35 -35
- package/dist/mobile/group/pipeline-ceo-dept-mention-parse.mjs +3 -3
- package/dist/mobile/group/pipeline-handoff-verification.mjs +3 -3
- package/dist/mobile/group/pipeline-turn-outcome.mjs +2 -2
- package/dist/mobile/group/plan-runtime.mjs +17 -17
- package/dist/mobile/group/relation-distill.mjs +7 -7
- package/dist/mobile/group/runtime-integration.mjs +43 -43
- package/dist/mobile/group/team-memory-runtime.mjs +3 -3
- package/dist/mobile/index.js +277 -155
- package/dist/mobile/index.mjs +177 -176
- package/dist/mobile/memory-contract-r1-prefetch.mjs +10 -10
- package/dist/mobile/memory-contract-r5-empty-result.mjs +11 -11
- package/dist/mobile/memory-runtime-v2/eval-runner.mjs +11 -11
- package/dist/mobile/memory-runtime-v2/evidence-plan.mjs +13 -13
- package/dist/mobile/memory-runtime-v2/index.mjs +38 -38
- package/dist/mobile/memory-runtime-v2/local-source-import.mjs +3 -3
- package/dist/mobile/memory-runtime-v2/memory-control-plane.mjs +13 -13
- package/dist/mobile/memory-runtime-v2/memory-readiness.mjs +13 -13
- package/dist/mobile/memory-runtime-v2/orchestrator.mjs +4 -4
- package/dist/mobile/memory-runtime-v2/project-tool-event.mjs +2 -2
- package/dist/mobile/memory-runtime-v2/public-api.mjs +16 -16
- package/dist/mobile/memory-runtime-v2/retrieval.mjs +2 -2
- package/dist/mobile/native-anthropic-messages-stream.mjs +11 -11
- package/dist/mobile/native-openai-text-stream.mjs +2 -2
- package/dist/mobile/native-reply-route.mjs +10 -10
- package/dist/mobile/native-reply-system-prompt-layers.mjs +106 -106
- package/dist/mobile/native-stream-block-emit.mjs +2 -2
- package/dist/mobile/openai-completions-turn-runner.mjs +115 -115
- package/dist/mobile/reply-dispatch-warmup.mjs +5 -5
- package/dist/mobile/runtime.js +160 -39
- package/dist/mobile/runtime.mjs +174 -173
- package/dist/mobile/session-dispatch/mobile-session-agent-event-bridge.mjs +1 -1
- package/dist/mobile/tool-use-input-normalize.mjs +108 -108
- package/dist/mobile/tools/mobile-compact-tool-bridge.mjs +108 -108
- package/dist/mobile/types.js +1 -0
- package/dist/mobile/types.mjs +1 -1
- package/dist/mobile/websocket.js +327 -0
- package/dist/mobile/websocket.mjs +7 -2
- package/dist/org/dept-context.mjs +4 -4
- package/dist/org/index.mjs +8 -8
- package/dist/owned-tools/agents-list.mjs +1 -1
- package/dist/owned-tools/ceo-confirm-requirements.mjs +12 -12
- package/dist/owned-tools/ceo-decision.mjs +18 -18
- package/dist/owned-tools/ceo-ops-brief.mjs +12 -12
- package/dist/owned-tools/ceo-redirect.mjs +44 -44
- package/dist/owned-tools/commit-stack-lesson.mjs +13 -13
- package/dist/owned-tools/compact/execute.mjs +106 -106
- package/dist/owned-tools/compact/gateway-tool-factory.mjs +107 -107
- package/dist/owned-tools/compact/registry.mjs +105 -105
- package/dist/owned-tools/context-compact.mjs +46 -46
- package/dist/owned-tools/groups-history.mjs +2 -2
- package/dist/owned-tools/handoff.mjs +17 -17
- package/dist/owned-tools/media-asset-library.mjs +1 -1
- package/dist/owned-tools/memory-control.mjs +15 -15
- package/dist/owned-tools/memory-runtime-eval.mjs +14 -14
- package/dist/owned-tools/message.mjs +3 -3
- package/dist/owned-tools/models-list.mjs +2 -2
- package/dist/owned-tools/owned-reply.mjs +1 -1
- package/dist/owned-tools/providers/minimax-files.mjs +2 -2
- package/dist/owned-tools/providers/minimax-video-generate.mjs +3 -3
- package/dist/owned-tools/providers/minimax-voice.mjs +3 -3
- package/dist/owned-tools/register-owned-providers.mjs +7 -7
- package/dist/owned-tools/registry.mjs +104 -104
- package/dist/owned-tools/router.mjs +105 -105
- package/dist/owned-tools/runtime-bridge.mjs +106 -106
- package/dist/owned-tools/runtime-data.mjs +1 -1
- package/dist/owned-tools/session-status.mjs +1 -1
- package/dist/owned-tools/sessions-history-resolver.mjs +2 -2
- package/dist/owned-tools/sessions-history.mjs +2 -2
- package/dist/owned-tools/sessions-list.mjs +1 -1
- package/dist/owned-tools/sessions-send.mjs +1 -1
- package/dist/owned-tools/skills-create.mjs +1 -1
- package/dist/owned-tools/subagents.mjs +1 -1
- package/dist/owned-tools/tool-contract-prompt.mjs +105 -105
- package/dist/owned-tools/tool-result-envelope.mjs +107 -107
- package/dist/owned-tools/tool-usage-guide.mjs +104 -104
- package/dist/owned-tools/tts.mjs +3 -3
- package/dist/owned-tools/web-smoke.mjs +6 -6
- package/dist/project/file-tool-scope-default.mjs +6 -6
- package/dist/project-pipeline/handlers.mjs +44 -44
- package/dist/project-pipeline/index.mjs +47 -47
- package/dist/project-pipeline/pipeline-routing.mjs +2 -2
- package/dist/project-pipeline/post-close-skill-evolution.mjs +5 -5
- package/dist/project-pipeline/project-store.mjs +5 -5
- package/package.json +2 -2
- package/gateway-core/README.md +0 -6
- package/dist/{chunk-UNZ3D3B3.mjs → chunk-3OXBG4OP.mjs} +5 -5
- package/dist/{chunk-QM7MTC5Q.mjs → chunk-522D52FC.mjs} +3 -3
- package/dist/{chunk-NRJWLPTI.mjs → chunk-6AY6OPO5.mjs} +3 -3
- package/dist/{chunk-JA65ZG3H.mjs → chunk-6ZWKLMY3.mjs} +4 -4
- package/dist/{chunk-T23H5D4O.mjs → chunk-AINHKBJW.mjs} +3 -3
- package/dist/{chunk-MKYCBV3H.mjs → chunk-BHT6B2TV.mjs} +6 -6
- package/dist/{chunk-PX55IRYL.mjs → chunk-F5KN3REF.mjs} +4 -4
- package/dist/{chunk-2QCX6RPN.mjs → chunk-KCZIK3TH.mjs} +3 -3
- package/dist/{chunk-WPLDZLAL.mjs → chunk-L7PMYQN5.mjs} +3 -3
- package/dist/{chunk-5LUTMHVL.mjs → chunk-NXKHSX4M.mjs} +3 -3
- package/dist/{chunk-UR6LPERL.mjs → chunk-Q7NYATKS.mjs} +3 -3
- package/dist/{chunk-MGWYJD5Q.mjs → chunk-QCSNRVL2.mjs} +8 -8
- package/dist/{chunk-HWGRW6YP.mjs → chunk-VS2URZFN.mjs} +3 -3
package/dist/index.js
CHANGED
|
@@ -2369,6 +2369,7 @@ var init_types = __esm({
|
|
|
2369
2369
|
WsMessageType2["DEVICE_CONSENT"] = "device_consent";
|
|
2370
2370
|
WsMessageType2["COMPACT_PROGRESS"] = "compact_progress";
|
|
2371
2371
|
WsMessageType2["FLOOR_EVENT"] = "floor_event";
|
|
2372
|
+
WsMessageType2["AGENTS_CHANGED"] = "agents_changed";
|
|
2372
2373
|
WsMessageType2["PING"] = "ping";
|
|
2373
2374
|
WsMessageType2["PONG"] = "pong";
|
|
2374
2375
|
WsMessageType2["ERROR"] = "error";
|
|
@@ -15837,7 +15838,7 @@ ${baseWithNudge}` : baseWithNudge;
|
|
|
15837
15838
|
const autoFanout = mentionedMembers.length === 0 && deptMembers.length >= 1 && pipelineHandoffOutcome.kind !== "succeeded";
|
|
15838
15839
|
const dispatchMembers = mentionedMembers.length >= 1 ? mentionedMembers : autoFanout ? deptMembers : [];
|
|
15839
15840
|
if (dispatchMembers.length >= 1) {
|
|
15840
|
-
const
|
|
15841
|
+
const started2 = startPipelineDeptRollup(next, activeLead.deptSlug, dispatchMembers);
|
|
15841
15842
|
const rollupConductorReason = autoFanout ? `\u7EC4\u7EC7\u6D41\u6C34\u7EBF \xB7 ${activeLead.label} \u672A\u70B9\u540D\uFF0C\u81EA\u52A8\u6D3E\u53D1 ${dispatchMembers.length} \u540D\u7EC4\u5458\u5E76\u884C\u5206\u5DE5` : `\u7EC4\u7EC7\u6D41\u6C34\u7EBF \xB7 ${activeLead.label} \u6D3E\u53D1 ${dispatchMembers.length} \u540D\u7EC4\u5458\u5E76\u884C`;
|
|
15842
15843
|
const rollupVerdict = {
|
|
15843
15844
|
stop: false,
|
|
@@ -15856,13 +15857,13 @@ ${baseWithNudge}` : baseWithNudge;
|
|
|
15856
15857
|
const rollupPlan = buildExecutionPlan({
|
|
15857
15858
|
verdict: rollupVerdict,
|
|
15858
15859
|
userMessageVerbatim: replyText,
|
|
15859
|
-
epoch:
|
|
15860
|
+
epoch: started2.epoch,
|
|
15860
15861
|
advancePolicy: "none"
|
|
15861
15862
|
});
|
|
15862
15863
|
if (rollupPlan) {
|
|
15863
15864
|
setExecutionPlan(session.id, rollupPlan);
|
|
15864
15865
|
const planFloor = {
|
|
15865
|
-
...
|
|
15866
|
+
...started2,
|
|
15866
15867
|
interactionMode: "execution_plan",
|
|
15867
15868
|
conductedQueue: void 0,
|
|
15868
15869
|
executionPlanSnapshot: toExecutionPlanSnapshot(rollupPlan),
|
|
@@ -15870,7 +15871,7 @@ ${baseWithNudge}` : baseWithNudge;
|
|
|
15870
15871
|
pipelineDispatchPolicy: "user_directed",
|
|
15871
15872
|
currentSpeakerAgentId: void 0,
|
|
15872
15873
|
phase: "idle",
|
|
15873
|
-
seq:
|
|
15874
|
+
seq: started2.seq + 1
|
|
15874
15875
|
};
|
|
15875
15876
|
setGroupFloorState(session.id, planFloor);
|
|
15876
15877
|
this.emitFloor(session);
|
|
@@ -15878,13 +15879,13 @@ ${baseWithNudge}` : baseWithNudge;
|
|
|
15878
15879
|
return;
|
|
15879
15880
|
}
|
|
15880
15881
|
const conducted = {
|
|
15881
|
-
...
|
|
15882
|
+
...started2,
|
|
15882
15883
|
conductedQueue: dispatchMembers,
|
|
15883
15884
|
interactionMode: "directed",
|
|
15884
15885
|
conductorReason: `${rollupConductorReason}\uFF08\u4E32\u884C\u515C\u5E95\uFF09`,
|
|
15885
15886
|
pipelineDispatchPolicy: "user_directed",
|
|
15886
15887
|
currentSpeakerAgentId: void 0,
|
|
15887
|
-
seq:
|
|
15888
|
+
seq: started2.seq + 1
|
|
15888
15889
|
};
|
|
15889
15890
|
setGroupFloorState(session.id, conducted);
|
|
15890
15891
|
this.emitFloor(session);
|
|
@@ -15956,15 +15957,15 @@ ${baseWithNudge}` : baseWithNudge;
|
|
|
15956
15957
|
rosterAgentIds: members
|
|
15957
15958
|
});
|
|
15958
15959
|
if (ceoLeads.length >= 2) {
|
|
15959
|
-
const
|
|
15960
|
+
const started2 = startPipelineCeoRollup(next, ceoLeads);
|
|
15960
15961
|
const conducted = {
|
|
15961
|
-
...
|
|
15962
|
+
...started2,
|
|
15962
15963
|
conductedQueue: ceoLeads,
|
|
15963
15964
|
interactionMode: "directed",
|
|
15964
15965
|
conductorReason: `\u7EC4\u7EC7\u6D41\u6C34\u7EBF \xB7 CEO \u5E76\u884C\u6D3E\u6D3B ${ceoLeads.length} \u4E2A\u90E8\u95E8\u8D1F\u8D23\u4EBA`,
|
|
15965
15966
|
pipelineDispatchPolicy: "user_directed",
|
|
15966
15967
|
currentSpeakerAgentId: void 0,
|
|
15967
|
-
seq:
|
|
15968
|
+
seq: started2.seq + 1
|
|
15968
15969
|
};
|
|
15969
15970
|
setGroupFloorState(session.id, conducted);
|
|
15970
15971
|
this.emitFloor(session);
|
|
@@ -18761,10 +18762,10 @@ function resolveAgentAuthProfilesPath(agentId) {
|
|
|
18761
18762
|
function readAuthProfileStore(agentId) {
|
|
18762
18763
|
const filePath = resolveAgentAuthProfilesPath(agentId);
|
|
18763
18764
|
try {
|
|
18764
|
-
if (!
|
|
18765
|
+
if (!import_node_fs62.default.existsSync(filePath)) {
|
|
18765
18766
|
return null;
|
|
18766
18767
|
}
|
|
18767
|
-
const raw = JSON.parse(
|
|
18768
|
+
const raw = JSON.parse(import_node_fs62.default.readFileSync(filePath, "utf8"));
|
|
18768
18769
|
return isGatewayConfigRecord(raw) ? raw : null;
|
|
18769
18770
|
} catch {
|
|
18770
18771
|
return null;
|
|
@@ -18905,11 +18906,11 @@ function formatNativeReplyRouteMissMessage(diag) {
|
|
|
18905
18906
|
return "unknown";
|
|
18906
18907
|
}
|
|
18907
18908
|
}
|
|
18908
|
-
var
|
|
18909
|
+
var import_node_fs62, import_node_path61, PROVIDER_ENV_KEY_CANDIDATES;
|
|
18909
18910
|
var init_native_provider_api_key = __esm({
|
|
18910
18911
|
"src/mobile/native-provider-api-key.ts"() {
|
|
18911
18912
|
"use strict";
|
|
18912
|
-
|
|
18913
|
+
import_node_fs62 = __toESM(require("fs"));
|
|
18913
18914
|
import_node_path61 = __toESM(require("path"));
|
|
18914
18915
|
init_runtime_agent_paths();
|
|
18915
18916
|
init_native_gateway_config();
|
|
@@ -18948,7 +18949,7 @@ function resolveGatewayAuthBridgePath() {
|
|
|
18948
18949
|
import_node_path62.default.resolve(process.cwd(), "gateway-core", "runtime", "mobile", "native-provider-api-key-bridge.cjs")
|
|
18949
18950
|
);
|
|
18950
18951
|
for (const candidate of candidates) {
|
|
18951
|
-
if (
|
|
18952
|
+
if (import_node_fs63.default.existsSync(candidate)) {
|
|
18952
18953
|
return candidate;
|
|
18953
18954
|
}
|
|
18954
18955
|
}
|
|
@@ -18972,11 +18973,11 @@ async function resolveNativeProviderApiKeyViaGatewayAuth(cfg, providerId, agentI
|
|
|
18972
18973
|
agentId
|
|
18973
18974
|
});
|
|
18974
18975
|
}
|
|
18975
|
-
var
|
|
18976
|
+
var import_node_fs63, import_node_module3, import_node_path62, bridgeMemo;
|
|
18976
18977
|
var init_native_provider_api_key_gateway = __esm({
|
|
18977
18978
|
"src/mobile/native-provider-api-key-gateway.ts"() {
|
|
18978
18979
|
"use strict";
|
|
18979
|
-
|
|
18980
|
+
import_node_fs63 = __toESM(require("fs"));
|
|
18980
18981
|
import_node_module3 = require("module");
|
|
18981
18982
|
import_node_path62 = __toESM(require("path"));
|
|
18982
18983
|
bridgeMemo = null;
|
|
@@ -19083,10 +19084,10 @@ function readString3(value) {
|
|
|
19083
19084
|
function readConfigFile() {
|
|
19084
19085
|
try {
|
|
19085
19086
|
const configPath = resolveXkPath("xkzoom.json");
|
|
19086
|
-
if (!
|
|
19087
|
+
if (!import_node_fs73.default.existsSync(configPath)) {
|
|
19087
19088
|
return null;
|
|
19088
19089
|
}
|
|
19089
|
-
const parsed = JSON.parse(
|
|
19090
|
+
const parsed = JSON.parse(import_node_fs73.default.readFileSync(configPath, "utf8"));
|
|
19090
19091
|
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
19091
19092
|
} catch {
|
|
19092
19093
|
return null;
|
|
@@ -19139,10 +19140,10 @@ function readSelectedProviderId(categoryId) {
|
|
|
19139
19140
|
function readKeyFromAuthStore(categoryId, providerId, agentId = DEFAULT_OWNED_AGENT_ID) {
|
|
19140
19141
|
const authPath = resolveAuthProfilesPath(agentId);
|
|
19141
19142
|
try {
|
|
19142
|
-
if (!
|
|
19143
|
+
if (!import_node_fs73.default.existsSync(authPath)) {
|
|
19143
19144
|
return void 0;
|
|
19144
19145
|
}
|
|
19145
|
-
const store = JSON.parse(
|
|
19146
|
+
const store = JSON.parse(import_node_fs73.default.readFileSync(authPath, "utf8"));
|
|
19146
19147
|
const profiles = store.profiles;
|
|
19147
19148
|
if (!profiles || typeof profiles !== "object" || Array.isArray(profiles)) {
|
|
19148
19149
|
return void 0;
|
|
@@ -19187,11 +19188,11 @@ function agentToolProviderKeyMissingError(categoryId, providerId) {
|
|
|
19187
19188
|
`${categoryId} provider "${providerId}" API key is not configured. Configure it in desktop Settings \u2192 Agent tools, or save the matching model provider key.`
|
|
19188
19189
|
);
|
|
19189
19190
|
}
|
|
19190
|
-
var
|
|
19191
|
+
var import_node_fs73;
|
|
19191
19192
|
var init_agent_tool_config = __esm({
|
|
19192
19193
|
"src/owned-tools/agent-tool-config.ts"() {
|
|
19193
19194
|
"use strict";
|
|
19194
|
-
|
|
19195
|
+
import_node_fs73 = __toESM(require("fs"));
|
|
19195
19196
|
init_native_provider_api_key();
|
|
19196
19197
|
init_path2();
|
|
19197
19198
|
init_agent_tool_catalog();
|
|
@@ -19206,8 +19207,8 @@ function readString4(value) {
|
|
|
19206
19207
|
function resolveMinimaxApiOrigin() {
|
|
19207
19208
|
try {
|
|
19208
19209
|
const cfgPath = resolveXkPath("xkzoom.json");
|
|
19209
|
-
if (
|
|
19210
|
-
const cfg = JSON.parse(
|
|
19210
|
+
if (import_node_fs74.default.existsSync(cfgPath)) {
|
|
19211
|
+
const cfg = JSON.parse(import_node_fs74.default.readFileSync(cfgPath, "utf8"));
|
|
19211
19212
|
const models = cfg.models;
|
|
19212
19213
|
if (models && typeof models === "object" && !Array.isArray(models)) {
|
|
19213
19214
|
const providers = models.providers;
|
|
@@ -19237,11 +19238,11 @@ function resolveMinimaxAnthropicBaseUrl() {
|
|
|
19237
19238
|
}
|
|
19238
19239
|
return `${origin}/anthropic`;
|
|
19239
19240
|
}
|
|
19240
|
-
var
|
|
19241
|
+
var import_node_fs74;
|
|
19241
19242
|
var init_minimax_gateway = __esm({
|
|
19242
19243
|
"src/owned-tools/providers/minimax-gateway.ts"() {
|
|
19243
19244
|
"use strict";
|
|
19244
|
-
|
|
19245
|
+
import_node_fs74 = __toESM(require("fs"));
|
|
19245
19246
|
init_path2();
|
|
19246
19247
|
}
|
|
19247
19248
|
});
|
|
@@ -19408,7 +19409,7 @@ function toDataUrl(imageRef) {
|
|
|
19408
19409
|
if (/^data:image\//i.test(trimmed) || /^https?:\/\//i.test(trimmed)) {
|
|
19409
19410
|
return trimmed;
|
|
19410
19411
|
}
|
|
19411
|
-
const bytes2 =
|
|
19412
|
+
const bytes2 = import_node_fs76.default.readFileSync(trimmed);
|
|
19412
19413
|
const mime = guessImageMime(trimmed);
|
|
19413
19414
|
return `data:${mime};base64,${bytes2.toString("base64")}`;
|
|
19414
19415
|
}
|
|
@@ -19473,11 +19474,11 @@ function readMessageContent(value) {
|
|
|
19473
19474
|
return typeof record.text === "string" ? record.text : "";
|
|
19474
19475
|
}).join("").trim();
|
|
19475
19476
|
}
|
|
19476
|
-
var
|
|
19477
|
+
var import_node_fs76, import_node_path71, DASHSCOPE_VL_URL, MIME_BY_EXT3;
|
|
19477
19478
|
var init_dashscope_image_analyze = __esm({
|
|
19478
19479
|
"src/owned-tools/providers/dashscope-image-analyze.ts"() {
|
|
19479
19480
|
"use strict";
|
|
19480
|
-
|
|
19481
|
+
import_node_fs76 = __toESM(require("fs"));
|
|
19481
19482
|
import_node_path71 = __toESM(require("path"));
|
|
19482
19483
|
DASHSCOPE_VL_URL = "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions";
|
|
19483
19484
|
MIME_BY_EXT3 = {
|
|
@@ -19757,7 +19758,7 @@ function toImageUrl(imageRef) {
|
|
|
19757
19758
|
if (/^data:image\//i.test(trimmed) || /^https?:\/\//i.test(trimmed)) {
|
|
19758
19759
|
return trimmed;
|
|
19759
19760
|
}
|
|
19760
|
-
const bytes2 =
|
|
19761
|
+
const bytes2 = import_node_fs77.default.readFileSync(trimmed);
|
|
19761
19762
|
return `data:${guessMime(trimmed)};base64,${bytes2.toString("base64")}`;
|
|
19762
19763
|
}
|
|
19763
19764
|
async function minimaxImageAnalyze(input) {
|
|
@@ -19795,11 +19796,11 @@ async function minimaxImageAnalyze(input) {
|
|
|
19795
19796
|
}
|
|
19796
19797
|
return { text: text2, provider: "minimax-m3-vision" };
|
|
19797
19798
|
}
|
|
19798
|
-
var
|
|
19799
|
+
var import_node_fs77, import_node_path73;
|
|
19799
19800
|
var init_minimax_image_analyze = __esm({
|
|
19800
19801
|
"src/owned-tools/providers/minimax-image-analyze.ts"() {
|
|
19801
19802
|
"use strict";
|
|
19802
|
-
|
|
19803
|
+
import_node_fs77 = __toESM(require("fs"));
|
|
19803
19804
|
import_node_path73 = __toESM(require("path"));
|
|
19804
19805
|
init_minimax_gateway();
|
|
19805
19806
|
}
|
|
@@ -30163,10 +30164,10 @@ function normalizeTimestamp2(value, fallback) {
|
|
|
30163
30164
|
return date.toISOString();
|
|
30164
30165
|
}
|
|
30165
30166
|
function durationHoursBetween(startedAt, finishedAt) {
|
|
30166
|
-
const
|
|
30167
|
+
const started2 = new Date(startedAt).getTime();
|
|
30167
30168
|
const finished2 = new Date(finishedAt).getTime();
|
|
30168
|
-
if (!Number.isFinite(
|
|
30169
|
-
return Math.max(0, Number(((finished2 -
|
|
30169
|
+
if (!Number.isFinite(started2) || !Number.isFinite(finished2)) return 0;
|
|
30170
|
+
return Math.max(0, Number(((finished2 - started2) / 36e5).toFixed(3)));
|
|
30170
30171
|
}
|
|
30171
30172
|
function normalizeDuration(value, startedAt, finishedAt) {
|
|
30172
30173
|
if (typeof value === "number" && Number.isFinite(value) && value >= 0) {
|
|
@@ -33943,6 +33944,97 @@ function createMobileApiRequestHandler(runtime2) {
|
|
|
33943
33944
|
// src/mobile/websocket.ts
|
|
33944
33945
|
var import_ws = require("ws");
|
|
33945
33946
|
init_types();
|
|
33947
|
+
|
|
33948
|
+
// src/mobile/agents-watch.ts
|
|
33949
|
+
var import_node_fs47 = require("fs");
|
|
33950
|
+
init_root();
|
|
33951
|
+
init_resolver();
|
|
33952
|
+
var DEBOUNCE_MS = 400;
|
|
33953
|
+
var agentsDirWatcher = null;
|
|
33954
|
+
var stateRootWatcher = null;
|
|
33955
|
+
var debounceTimer = null;
|
|
33956
|
+
var started = false;
|
|
33957
|
+
function normalizeRel(filename) {
|
|
33958
|
+
return (filename ?? "").replace(/\\/g, "/");
|
|
33959
|
+
}
|
|
33960
|
+
function isRelevantAgentsPath(filename) {
|
|
33961
|
+
const rel = normalizeRel(filename);
|
|
33962
|
+
if (!rel) {
|
|
33963
|
+
return true;
|
|
33964
|
+
}
|
|
33965
|
+
if (!rel.includes("/")) {
|
|
33966
|
+
return true;
|
|
33967
|
+
}
|
|
33968
|
+
return rel.endsWith("/IDENTITY.md");
|
|
33969
|
+
}
|
|
33970
|
+
function startAgentsChangeWatch(onChange) {
|
|
33971
|
+
if (started) {
|
|
33972
|
+
return;
|
|
33973
|
+
}
|
|
33974
|
+
started = true;
|
|
33975
|
+
const fire = () => {
|
|
33976
|
+
if (debounceTimer) {
|
|
33977
|
+
clearTimeout(debounceTimer);
|
|
33978
|
+
}
|
|
33979
|
+
debounceTimer = setTimeout(() => {
|
|
33980
|
+
debounceTimer = null;
|
|
33981
|
+
try {
|
|
33982
|
+
onChange();
|
|
33983
|
+
} catch {
|
|
33984
|
+
}
|
|
33985
|
+
}, DEBOUNCE_MS);
|
|
33986
|
+
};
|
|
33987
|
+
try {
|
|
33988
|
+
const agentsDir = standardPaths.agents();
|
|
33989
|
+
if ((0, import_node_fs47.existsSync)(agentsDir)) {
|
|
33990
|
+
agentsDirWatcher = (0, import_node_fs47.watch)(agentsDir, { recursive: true }, (_event, filename) => {
|
|
33991
|
+
if (isRelevantAgentsPath(filename)) {
|
|
33992
|
+
fire();
|
|
33993
|
+
}
|
|
33994
|
+
});
|
|
33995
|
+
agentsDirWatcher.on("error", () => {
|
|
33996
|
+
});
|
|
33997
|
+
agentsDirWatcher.unref();
|
|
33998
|
+
}
|
|
33999
|
+
} catch {
|
|
34000
|
+
agentsDirWatcher = null;
|
|
34001
|
+
}
|
|
34002
|
+
try {
|
|
34003
|
+
const stateRoot = getXkRootPath();
|
|
34004
|
+
if ((0, import_node_fs47.existsSync)(stateRoot)) {
|
|
34005
|
+
stateRootWatcher = (0, import_node_fs47.watch)(stateRoot, { recursive: false }, (_event, filename) => {
|
|
34006
|
+
const rel = normalizeRel(filename);
|
|
34007
|
+
if (!rel || rel === "xkzoom.json") {
|
|
34008
|
+
fire();
|
|
34009
|
+
}
|
|
34010
|
+
});
|
|
34011
|
+
stateRootWatcher.on("error", () => {
|
|
34012
|
+
});
|
|
34013
|
+
stateRootWatcher.unref();
|
|
34014
|
+
}
|
|
34015
|
+
} catch {
|
|
34016
|
+
stateRootWatcher = null;
|
|
34017
|
+
}
|
|
34018
|
+
}
|
|
34019
|
+
function stopAgentsChangeWatch() {
|
|
34020
|
+
started = false;
|
|
34021
|
+
if (debounceTimer) {
|
|
34022
|
+
clearTimeout(debounceTimer);
|
|
34023
|
+
debounceTimer = null;
|
|
34024
|
+
}
|
|
34025
|
+
try {
|
|
34026
|
+
agentsDirWatcher?.close();
|
|
34027
|
+
} catch {
|
|
34028
|
+
}
|
|
34029
|
+
try {
|
|
34030
|
+
stateRootWatcher?.close();
|
|
34031
|
+
} catch {
|
|
34032
|
+
}
|
|
34033
|
+
agentsDirWatcher = null;
|
|
34034
|
+
stateRootWatcher = null;
|
|
34035
|
+
}
|
|
34036
|
+
|
|
34037
|
+
// src/mobile/websocket.ts
|
|
33946
34038
|
var PENDING_REPLY_TTL_MS = 6e5;
|
|
33947
34039
|
var PENDING_REPLY_MAX_PER_CONV = 50;
|
|
33948
34040
|
var HEARTBEAT_INTERVAL_MS = 15e3;
|
|
@@ -34505,6 +34597,7 @@ var MobileWebSocketServer = class {
|
|
|
34505
34597
|
}
|
|
34506
34598
|
}
|
|
34507
34599
|
close() {
|
|
34600
|
+
stopAgentsChangeWatch();
|
|
34508
34601
|
this.connections.forEach((ws) => ws.close());
|
|
34509
34602
|
this.connections.clear();
|
|
34510
34603
|
this.conversationTargets.clear();
|
|
@@ -34528,13 +34621,20 @@ var wssInstance = null;
|
|
|
34528
34621
|
function getMobileWebSocketServer() {
|
|
34529
34622
|
if (!wssInstance) {
|
|
34530
34623
|
wssInstance = new MobileWebSocketServer();
|
|
34624
|
+
startAgentsChangeWatch(() => {
|
|
34625
|
+
wssInstance?.broadcast({
|
|
34626
|
+
type: "agents_changed" /* AGENTS_CHANGED */,
|
|
34627
|
+
data: {},
|
|
34628
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
34629
|
+
});
|
|
34630
|
+
});
|
|
34531
34631
|
}
|
|
34532
34632
|
return wssInstance;
|
|
34533
34633
|
}
|
|
34534
34634
|
|
|
34535
34635
|
// src/mobile/runtime.ts
|
|
34536
34636
|
var import_node_crypto36 = require("crypto");
|
|
34537
|
-
var
|
|
34637
|
+
var import_node_fs81 = __toESM(require("fs"));
|
|
34538
34638
|
var import_node_module6 = require("module");
|
|
34539
34639
|
var import_node_path78 = __toESM(require("path"));
|
|
34540
34640
|
var import_node_url7 = require("url");
|
|
@@ -35105,10 +35205,10 @@ function extractMobileReplyPayload(payload) {
|
|
|
35105
35205
|
}
|
|
35106
35206
|
|
|
35107
35207
|
// src/mobile/inbound-message-client-rehydrate.ts
|
|
35108
|
-
var
|
|
35208
|
+
var import_node_fs51 = __toESM(require("fs"));
|
|
35109
35209
|
|
|
35110
35210
|
// src/mobile/inline-reply-image.ts
|
|
35111
|
-
var
|
|
35211
|
+
var import_node_fs48 = __toESM(require("fs"));
|
|
35112
35212
|
var import_node_path49 = __toESM(require("path"));
|
|
35113
35213
|
var import_node_url2 = require("url");
|
|
35114
35214
|
var DEFAULT_MAX_INLINE_BYTES = 2 * 1024 * 1024;
|
|
@@ -35163,8 +35263,8 @@ function tryInlineLocalImageAsDataUrl(content, options) {
|
|
|
35163
35263
|
if (!mime) {
|
|
35164
35264
|
return null;
|
|
35165
35265
|
}
|
|
35166
|
-
const stat5 = options?.statSync ??
|
|
35167
|
-
const read = options?.readFileSync ??
|
|
35266
|
+
const stat5 = options?.statSync ?? import_node_fs48.default.statSync;
|
|
35267
|
+
const read = options?.readFileSync ?? import_node_fs48.default.readFileSync;
|
|
35168
35268
|
const limit = options?.maxBytes ?? DEFAULT_MAX_INLINE_BYTES;
|
|
35169
35269
|
try {
|
|
35170
35270
|
const s = stat5(abs);
|
|
@@ -35186,7 +35286,7 @@ function tryInlineLocalImageAsDataUrl(content, options) {
|
|
|
35186
35286
|
}
|
|
35187
35287
|
|
|
35188
35288
|
// src/mobile/inline-reply-media.ts
|
|
35189
|
-
var
|
|
35289
|
+
var import_node_fs49 = __toESM(require("fs"));
|
|
35190
35290
|
var import_node_path50 = __toESM(require("path"));
|
|
35191
35291
|
var import_node_url3 = require("url");
|
|
35192
35292
|
var DEFAULT_MAX_INLINE_BYTES2 = 5 * 1024 * 1024;
|
|
@@ -35253,7 +35353,7 @@ function tryResolveLocalAbsolutePath2(content) {
|
|
|
35253
35353
|
if (!/^[a-z][a-z0-9+.-]*:/i.test(trimmed)) {
|
|
35254
35354
|
const resolved = import_node_path50.default.resolve(trimmed);
|
|
35255
35355
|
try {
|
|
35256
|
-
if (
|
|
35356
|
+
if (import_node_fs49.default.existsSync(resolved)) {
|
|
35257
35357
|
return resolved;
|
|
35258
35358
|
}
|
|
35259
35359
|
} catch {
|
|
@@ -35320,8 +35420,8 @@ function tryInlineLocalMediaAsDataUrl(content, options) {
|
|
|
35320
35420
|
if (!abs) {
|
|
35321
35421
|
return null;
|
|
35322
35422
|
}
|
|
35323
|
-
const stat5 = options?.statSync ??
|
|
35324
|
-
const read = options?.readFileSync ??
|
|
35423
|
+
const stat5 = options?.statSync ?? import_node_fs49.default.statSync;
|
|
35424
|
+
const read = options?.readFileSync ?? import_node_fs49.default.readFileSync;
|
|
35325
35425
|
const getBasename = options?.basename ?? ((p) => import_node_path50.default.basename(p));
|
|
35326
35426
|
const limit = options?.maxBytes ?? DEFAULT_MAX_INLINE_BYTES2;
|
|
35327
35427
|
try {
|
|
@@ -35370,7 +35470,7 @@ function deriveFileMetaFromUrlOrPath(value) {
|
|
|
35370
35470
|
}
|
|
35371
35471
|
|
|
35372
35472
|
// src/mobile/outbound-local-media-resolve.ts
|
|
35373
|
-
var
|
|
35473
|
+
var import_node_fs50 = __toESM(require("fs"));
|
|
35374
35474
|
var import_node_path51 = __toESM(require("path"));
|
|
35375
35475
|
var import_node_url4 = require("url");
|
|
35376
35476
|
init_resolver();
|
|
@@ -35390,7 +35490,7 @@ function pushCandidate(candidates, candidate) {
|
|
|
35390
35490
|
function tryReadableFile(absPath) {
|
|
35391
35491
|
try {
|
|
35392
35492
|
const resolved = import_node_path51.default.resolve(absPath);
|
|
35393
|
-
const stat5 =
|
|
35493
|
+
const stat5 = import_node_fs50.default.statSync(resolved);
|
|
35394
35494
|
if (stat5.isFile() && stat5.size > 0) {
|
|
35395
35495
|
return resolved;
|
|
35396
35496
|
}
|
|
@@ -35531,7 +35631,7 @@ function rehydrateOutboundFileMessageForClient(message, maxInlineBytes) {
|
|
|
35531
35631
|
return message;
|
|
35532
35632
|
}
|
|
35533
35633
|
try {
|
|
35534
|
-
const stat5 =
|
|
35634
|
+
const stat5 = import_node_fs51.default.statSync(resolved);
|
|
35535
35635
|
const meta = deriveFileMetaFromUrlOrPath(resolved);
|
|
35536
35636
|
const outboundPaths = message.persistedOutboundPaths?.filter((entry) => entry.trim()) ?? [];
|
|
35537
35637
|
return {
|
|
@@ -35632,7 +35732,7 @@ function sliceSessionMessagesV2Page(all, query) {
|
|
|
35632
35732
|
}
|
|
35633
35733
|
|
|
35634
35734
|
// src/mobile/outbound-image-rehost.ts
|
|
35635
|
-
var
|
|
35735
|
+
var import_node_fs52 = __toESM(require("fs"));
|
|
35636
35736
|
var import_promises = __toESM(require("fs/promises"));
|
|
35637
35737
|
var import_node_path52 = __toESM(require("path"));
|
|
35638
35738
|
init_state_dir();
|
|
@@ -35808,7 +35908,7 @@ function createOwnedReplyTextCapture() {
|
|
|
35808
35908
|
}
|
|
35809
35909
|
|
|
35810
35910
|
// src/path/state-root-hygiene.ts
|
|
35811
|
-
var
|
|
35911
|
+
var import_node_fs53 = __toESM(require("fs"));
|
|
35812
35912
|
var import_promises2 = __toESM(require("fs/promises"));
|
|
35813
35913
|
var import_node_path53 = __toESM(require("path"));
|
|
35814
35914
|
init_state_dir();
|
|
@@ -35848,7 +35948,7 @@ function patchSoulGreeting(raw) {
|
|
|
35848
35948
|
}
|
|
35849
35949
|
async function exists2(p) {
|
|
35850
35950
|
try {
|
|
35851
|
-
await import_promises2.default.access(p,
|
|
35951
|
+
await import_promises2.default.access(p, import_node_fs53.default.constants.F_OK);
|
|
35852
35952
|
return true;
|
|
35853
35953
|
} catch {
|
|
35854
35954
|
return false;
|
|
@@ -36096,7 +36196,7 @@ function resolveDefaultFileToolScopeForTurn(input) {
|
|
|
36096
36196
|
}
|
|
36097
36197
|
|
|
36098
36198
|
// src/mobile/media-wildcard.ts
|
|
36099
|
-
var
|
|
36199
|
+
var import_node_fs54 = __toESM(require("fs"));
|
|
36100
36200
|
var import_node_path54 = __toESM(require("path"));
|
|
36101
36201
|
var import_node_url5 = require("url");
|
|
36102
36202
|
var DEFAULT_MAX_CANDIDATES2 = 20;
|
|
@@ -36154,7 +36254,7 @@ function resolvePattern(pattern, cwd) {
|
|
|
36154
36254
|
}
|
|
36155
36255
|
function statFileCandidate(filePath) {
|
|
36156
36256
|
try {
|
|
36157
|
-
const stat5 =
|
|
36257
|
+
const stat5 = import_node_fs54.default.statSync(filePath);
|
|
36158
36258
|
if (!stat5.isFile()) {
|
|
36159
36259
|
return null;
|
|
36160
36260
|
}
|
|
@@ -36185,7 +36285,7 @@ function expandOneLocalPattern(rawPattern, options) {
|
|
|
36185
36285
|
if (hasWildcard(segment)) {
|
|
36186
36286
|
let entries;
|
|
36187
36287
|
try {
|
|
36188
|
-
entries =
|
|
36288
|
+
entries = import_node_fs54.default.readdirSync(dir, { withFileTypes: true });
|
|
36189
36289
|
} catch {
|
|
36190
36290
|
continue;
|
|
36191
36291
|
}
|
|
@@ -36214,7 +36314,7 @@ function expandOneLocalPattern(rawPattern, options) {
|
|
|
36214
36314
|
}
|
|
36215
36315
|
} else {
|
|
36216
36316
|
try {
|
|
36217
|
-
if (
|
|
36317
|
+
if (import_node_fs54.default.statSync(candidatePath).isDirectory()) {
|
|
36218
36318
|
nextDirs.push(candidatePath);
|
|
36219
36319
|
}
|
|
36220
36320
|
} catch {
|
|
@@ -36288,7 +36388,7 @@ function expandMediaUrlWildcards(rawUrls, options) {
|
|
|
36288
36388
|
}
|
|
36289
36389
|
|
|
36290
36390
|
// src/mobile/file-context.ts
|
|
36291
|
-
var
|
|
36391
|
+
var import_node_fs55 = __toESM(require("fs"));
|
|
36292
36392
|
var import_node_path55 = __toESM(require("path"));
|
|
36293
36393
|
var import_node_crypto27 = require("crypto");
|
|
36294
36394
|
var import_node_url6 = require("url");
|
|
@@ -36555,8 +36655,8 @@ function maxInboundBytesForAttachment(mime) {
|
|
|
36555
36655
|
}
|
|
36556
36656
|
function ensureInboundAttachmentDirs(root) {
|
|
36557
36657
|
for (const bucket of ["media", "file"]) {
|
|
36558
|
-
|
|
36559
|
-
|
|
36658
|
+
import_node_fs55.default.mkdirSync(import_node_path55.default.join(root, bucket, "inbound"), { recursive: true });
|
|
36659
|
+
import_node_fs55.default.mkdirSync(import_node_path55.default.join(root, bucket, "outbound"), { recursive: true });
|
|
36560
36660
|
}
|
|
36561
36661
|
}
|
|
36562
36662
|
function materializeFileContextInboundAttachments(attachments) {
|
|
@@ -36572,7 +36672,7 @@ function materializeFileContextInboundAttachments(attachments) {
|
|
|
36572
36672
|
const src = import_node_path55.default.normalize(import_node_path55.default.resolve(item.path));
|
|
36573
36673
|
let stat5;
|
|
36574
36674
|
try {
|
|
36575
|
-
stat5 =
|
|
36675
|
+
stat5 = import_node_fs55.default.statSync(src);
|
|
36576
36676
|
} catch {
|
|
36577
36677
|
throw new Error(`file_context_unavailable:${import_node_path55.default.basename(src)}`);
|
|
36578
36678
|
}
|
|
@@ -36582,7 +36682,7 @@ function materializeFileContextInboundAttachments(attachments) {
|
|
|
36582
36682
|
const alreadyInbound = src === inboundDirNorm || src.startsWith(`${inboundDirNorm}${import_node_path55.default.sep}`);
|
|
36583
36683
|
const target = alreadyInbound ? src : import_node_path55.default.join(inboundDir, `file-context-${(0, import_node_crypto27.randomUUID)()}.${inboundStoredExt(src, item.mediaType)}`);
|
|
36584
36684
|
if (!alreadyInbound) {
|
|
36585
|
-
|
|
36685
|
+
import_node_fs55.default.copyFileSync(src, target);
|
|
36586
36686
|
}
|
|
36587
36687
|
items.push(createInboundAttachment({
|
|
36588
36688
|
filePath: target,
|
|
@@ -36610,7 +36710,7 @@ function stageInboundAttachmentsForAgentWorkspace(attachments, workspaceRoot) {
|
|
|
36610
36710
|
const target = import_node_path55.default.join(inboundDir, import_node_path55.default.basename(src));
|
|
36611
36711
|
try {
|
|
36612
36712
|
if (import_node_path55.default.normalize(target) !== src) {
|
|
36613
|
-
|
|
36713
|
+
import_node_fs55.default.copyFileSync(src, target);
|
|
36614
36714
|
}
|
|
36615
36715
|
items.push(createInboundAttachment({
|
|
36616
36716
|
filePath: target,
|
|
@@ -36796,16 +36896,16 @@ init_tool_descriptor();
|
|
|
36796
36896
|
|
|
36797
36897
|
// src/owned-tools/vendored-libs.ts
|
|
36798
36898
|
var import_node_module = require("module");
|
|
36799
|
-
var
|
|
36899
|
+
var import_node_fs56 = __toESM(require("fs"));
|
|
36800
36900
|
var import_node_path56 = __toESM(require("path"));
|
|
36801
36901
|
var CJS_REQUIRE_SPECIFIERS = /* @__PURE__ */ new Set(["ipaddr.js"]);
|
|
36802
36902
|
function findXkzoomPackageJsonFromDir(startDir) {
|
|
36803
36903
|
let dir = import_node_path56.default.resolve(startDir);
|
|
36804
36904
|
for (let depth = 0; depth < 16; depth += 1) {
|
|
36805
36905
|
const pkg = import_node_path56.default.join(dir, "package.json");
|
|
36806
|
-
if (
|
|
36906
|
+
if (import_node_fs56.default.existsSync(pkg)) {
|
|
36807
36907
|
try {
|
|
36808
|
-
const meta = JSON.parse(
|
|
36908
|
+
const meta = JSON.parse(import_node_fs56.default.readFileSync(pkg, "utf8"));
|
|
36809
36909
|
if (meta.name === "xkzoom") {
|
|
36810
36910
|
return pkg;
|
|
36811
36911
|
}
|
|
@@ -38169,7 +38269,7 @@ function buildActionStepsBlock(actionSteps) {
|
|
|
38169
38269
|
}
|
|
38170
38270
|
|
|
38171
38271
|
// src/mobile/context-compact/compact-write-verifier.ts
|
|
38172
|
-
var
|
|
38272
|
+
var import_node_fs57 = require("fs");
|
|
38173
38273
|
var import_node_path57 = __toESM(require("path"));
|
|
38174
38274
|
init_runtime_agent_paths();
|
|
38175
38275
|
init_migrate_agent_ids_to_folder_names();
|
|
@@ -38402,7 +38502,7 @@ function resolveMemoryMdPath(agentId, teamId) {
|
|
|
38402
38502
|
}
|
|
38403
38503
|
async function fileMtimeMs(filePath) {
|
|
38404
38504
|
try {
|
|
38405
|
-
const st = await
|
|
38505
|
+
const st = await import_node_fs57.promises.stat(filePath);
|
|
38406
38506
|
return st.isFile() ? st.mtimeMs : void 0;
|
|
38407
38507
|
} catch {
|
|
38408
38508
|
return void 0;
|
|
@@ -38410,16 +38510,16 @@ async function fileMtimeMs(filePath) {
|
|
|
38410
38510
|
}
|
|
38411
38511
|
async function readFileUtf8(filePath) {
|
|
38412
38512
|
try {
|
|
38413
|
-
return await
|
|
38513
|
+
return await import_node_fs57.promises.readFile(filePath, "utf8");
|
|
38414
38514
|
} catch {
|
|
38415
38515
|
return null;
|
|
38416
38516
|
}
|
|
38417
38517
|
}
|
|
38418
38518
|
async function writeAtomicUtf8(targetPath, content) {
|
|
38419
|
-
await
|
|
38519
|
+
await import_node_fs57.promises.mkdir(import_node_path57.default.dirname(targetPath), { recursive: true });
|
|
38420
38520
|
const tmp = `${targetPath}.tmp-${process.pid}-${Date.now()}`;
|
|
38421
|
-
await
|
|
38422
|
-
await
|
|
38521
|
+
await import_node_fs57.promises.writeFile(tmp, content, "utf8");
|
|
38522
|
+
await import_node_fs57.promises.rename(tmp, targetPath);
|
|
38423
38523
|
}
|
|
38424
38524
|
async function seedCompactNoteSkeleton(input) {
|
|
38425
38525
|
const notePath = resolveCompactNotePathForTarget(input);
|
|
@@ -38433,10 +38533,10 @@ async function seedCompactNoteSkeleton(input) {
|
|
|
38433
38533
|
}
|
|
38434
38534
|
async function fileSizeChars(filePath) {
|
|
38435
38535
|
try {
|
|
38436
|
-
const st = await
|
|
38536
|
+
const st = await import_node_fs57.promises.stat(filePath);
|
|
38437
38537
|
if (!st.isFile()) return 0;
|
|
38438
38538
|
if (st.size === 0) return 0;
|
|
38439
|
-
const content = await
|
|
38539
|
+
const content = await import_node_fs57.promises.readFile(filePath, "utf8");
|
|
38440
38540
|
return content.length;
|
|
38441
38541
|
} catch {
|
|
38442
38542
|
return 0;
|
|
@@ -38448,7 +38548,7 @@ async function verifyCompactWriteArtifacts(input) {
|
|
|
38448
38548
|
const oversize = [];
|
|
38449
38549
|
const notePath = resolveCompactNotePathForTarget(input);
|
|
38450
38550
|
const memoryPath = resolveMemoryMdPath(input.agentId, input.teamId);
|
|
38451
|
-
const noteExists = await
|
|
38551
|
+
const noteExists = await import_node_fs57.promises.stat(notePath).then((st) => st.isFile()).catch(() => false);
|
|
38452
38552
|
if (!noteExists) {
|
|
38453
38553
|
missing.push("compact_note");
|
|
38454
38554
|
} else {
|
|
@@ -38498,7 +38598,7 @@ async function runMemoryIndexSync(agentId, cfg, teamId, managerForTests) {
|
|
|
38498
38598
|
}
|
|
38499
38599
|
|
|
38500
38600
|
// src/mobile/context-compact/compact-orchestrator.ts
|
|
38501
|
-
var
|
|
38601
|
+
var import_node_fs71 = require("fs");
|
|
38502
38602
|
|
|
38503
38603
|
// src/mobile/context-compact/resume-tool-step-tracker.ts
|
|
38504
38604
|
var RESUME_TOOL_SEQUENCE = [
|
|
@@ -38533,7 +38633,7 @@ function markResumeToolStepComplete(toolName, tracker) {
|
|
|
38533
38633
|
|
|
38534
38634
|
// src/mobile/context-compact/summarize-transcript.ts
|
|
38535
38635
|
var import_node_crypto28 = require("crypto");
|
|
38536
|
-
var
|
|
38636
|
+
var import_node_fs58 = require("fs");
|
|
38537
38637
|
var import_node_path58 = __toESM(require("path"));
|
|
38538
38638
|
init_state_dir();
|
|
38539
38639
|
init_migrate_agent_ids_to_folder_names();
|
|
@@ -38547,7 +38647,7 @@ async function resolveGatewayTranscriptPath(agentId, sessionKey) {
|
|
|
38547
38647
|
const indexPath = resolveAgentSessionsIndexPath(agentId);
|
|
38548
38648
|
let index;
|
|
38549
38649
|
try {
|
|
38550
|
-
const raw = await
|
|
38650
|
+
const raw = await import_node_fs58.promises.readFile(indexPath, "utf8");
|
|
38551
38651
|
index = JSON.parse(raw);
|
|
38552
38652
|
} catch {
|
|
38553
38653
|
return null;
|
|
@@ -38558,7 +38658,7 @@ async function resolveGatewayTranscriptPath(agentId, sessionKey) {
|
|
|
38558
38658
|
async function measureTranscriptBytes(sessionFile) {
|
|
38559
38659
|
if (!sessionFile) return 0;
|
|
38560
38660
|
try {
|
|
38561
|
-
const st = await
|
|
38661
|
+
const st = await import_node_fs58.promises.stat(sessionFile);
|
|
38562
38662
|
return st.isFile() ? st.size : 0;
|
|
38563
38663
|
} catch {
|
|
38564
38664
|
return 0;
|
|
@@ -38571,7 +38671,7 @@ async function measureTranscriptSummarizableBytes(sessionFile) {
|
|
|
38571
38671
|
if (!sessionFile) return 0;
|
|
38572
38672
|
let raw = "";
|
|
38573
38673
|
try {
|
|
38574
|
-
raw = await
|
|
38674
|
+
raw = await import_node_fs58.promises.readFile(sessionFile, "utf8");
|
|
38575
38675
|
} catch {
|
|
38576
38676
|
return 0;
|
|
38577
38677
|
}
|
|
@@ -38586,12 +38686,12 @@ async function archiveLegacyTranscript(sessionFile) {
|
|
|
38586
38686
|
const base = import_node_path58.default.basename(sessionFile, import_node_path58.default.extname(sessionFile));
|
|
38587
38687
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
38588
38688
|
const archived = import_node_path58.default.join(dir, `${base}.compact.${stamp}.${(0, import_node_crypto28.randomUUID)().slice(0, 8)}.bak`);
|
|
38589
|
-
await
|
|
38689
|
+
await import_node_fs58.promises.rename(sessionFile, archived);
|
|
38590
38690
|
return archived;
|
|
38591
38691
|
}
|
|
38592
38692
|
async function readFirstSessionMetaLine(sessionFile) {
|
|
38593
38693
|
try {
|
|
38594
|
-
const raw = await
|
|
38694
|
+
const raw = await import_node_fs58.promises.readFile(sessionFile, "utf8");
|
|
38595
38695
|
const firstLine = raw.split(/\r?\n/).find((l) => l.trim().length > 0);
|
|
38596
38696
|
if (!firstLine) return null;
|
|
38597
38697
|
const parsed = JSON.parse(firstLine);
|
|
@@ -38601,7 +38701,7 @@ async function readFirstSessionMetaLine(sessionFile) {
|
|
|
38601
38701
|
}
|
|
38602
38702
|
}
|
|
38603
38703
|
async function createFreshLegacyTranscript(sessionFile, sessionKey, metaExtras) {
|
|
38604
|
-
await
|
|
38704
|
+
await import_node_fs58.promises.mkdir(import_node_path58.default.dirname(sessionFile), { recursive: true });
|
|
38605
38705
|
const priorMeta = await readFirstSessionMetaLine(sessionFile).catch(() => null);
|
|
38606
38706
|
const header = {
|
|
38607
38707
|
type: "session",
|
|
@@ -38611,7 +38711,7 @@ async function createFreshLegacyTranscript(sessionFile, sessionKey, metaExtras)
|
|
|
38611
38711
|
...priorMeta?.agentId ? { agentId: priorMeta.agentId } : {},
|
|
38612
38712
|
...metaExtras ?? {}
|
|
38613
38713
|
};
|
|
38614
|
-
await
|
|
38714
|
+
await import_node_fs58.promises.writeFile(sessionFile, `${JSON.stringify(header)}
|
|
38615
38715
|
`, "utf8");
|
|
38616
38716
|
}
|
|
38617
38717
|
async function writeCompactionHintToFreshTranscript(sessionFile, compactionEntry, runningSummary) {
|
|
@@ -38627,7 +38727,7 @@ async function writeCompactionHintToFreshTranscript(sessionFile, compactionEntry
|
|
|
38627
38727
|
compactionEntryPreview: compactionEntry.slice(0, 500)
|
|
38628
38728
|
}
|
|
38629
38729
|
};
|
|
38630
|
-
await
|
|
38730
|
+
await import_node_fs58.promises.writeFile(sessionFile, `${JSON.stringify(header)}
|
|
38631
38731
|
`, "utf8");
|
|
38632
38732
|
}
|
|
38633
38733
|
function isRecord2(value) {
|
|
@@ -38636,20 +38736,20 @@ function isRecord2(value) {
|
|
|
38636
38736
|
async function updateSessionsIndexSessionFile(agentId, sessionKey, sessionFile) {
|
|
38637
38737
|
const indexPath = resolveAgentSessionsIndexPath(agentId);
|
|
38638
38738
|
const allowCreate = process.env.XKZOOM_LEGACY_LEGACY_SESSIONS_WRITE === "1";
|
|
38639
|
-
const indexExists = await
|
|
38739
|
+
const indexExists = await import_node_fs58.promises.stat(indexPath).then((st) => st.isFile()).catch(() => false);
|
|
38640
38740
|
if (!indexExists && !allowCreate) {
|
|
38641
38741
|
return;
|
|
38642
38742
|
}
|
|
38643
38743
|
let index = {};
|
|
38644
38744
|
try {
|
|
38645
|
-
index = JSON.parse(await
|
|
38745
|
+
index = JSON.parse(await import_node_fs58.promises.readFile(indexPath, "utf8"));
|
|
38646
38746
|
} catch {
|
|
38647
38747
|
index = {};
|
|
38648
38748
|
}
|
|
38649
38749
|
const prev = index[sessionKey] ?? {};
|
|
38650
38750
|
index[sessionKey] = { ...prev, sessionFile };
|
|
38651
|
-
await
|
|
38652
|
-
await
|
|
38751
|
+
await import_node_fs58.promises.mkdir(import_node_path58.default.dirname(indexPath), { recursive: true });
|
|
38752
|
+
await import_node_fs58.promises.writeFile(indexPath, `${JSON.stringify(index, null, 2)}
|
|
38653
38753
|
`, "utf8");
|
|
38654
38754
|
}
|
|
38655
38755
|
async function executeSummarizeTranscript(opts) {
|
|
@@ -38658,7 +38758,7 @@ async function executeSummarizeTranscript(opts) {
|
|
|
38658
38758
|
if (!sessionFile) {
|
|
38659
38759
|
return { ok: false, error: "session_file_not_found" };
|
|
38660
38760
|
}
|
|
38661
|
-
const exists3 = await
|
|
38761
|
+
const exists3 = await import_node_fs58.promises.stat(sessionFile).then((st) => st.isFile()).catch(() => false);
|
|
38662
38762
|
if (!exists3) {
|
|
38663
38763
|
await createFreshLegacyTranscript(sessionFile, opts.sessionKey);
|
|
38664
38764
|
await updateSessionsIndexSessionFile(opts.agentId, opts.sessionKey, sessionFile);
|
|
@@ -38674,7 +38774,7 @@ async function executeSummarizeTranscript(opts) {
|
|
|
38674
38774
|
}
|
|
38675
38775
|
|
|
38676
38776
|
// src/mobile/context-compact/compact-engine-artifacts.ts
|
|
38677
|
-
var
|
|
38777
|
+
var import_node_fs59 = require("fs");
|
|
38678
38778
|
var import_node_path59 = __toESM(require("path"));
|
|
38679
38779
|
|
|
38680
38780
|
// src/mobile/context-compact/compact-fact-extractor.ts
|
|
@@ -38937,10 +39037,10 @@ function buildMemoryAppendBlock(input) {
|
|
|
38937
39037
|
].join("\n");
|
|
38938
39038
|
}
|
|
38939
39039
|
async function writeAtomicUtf82(targetPath, content) {
|
|
38940
|
-
await
|
|
39040
|
+
await import_node_fs59.promises.mkdir(import_node_path59.default.dirname(targetPath), { recursive: true });
|
|
38941
39041
|
const tmp = `${targetPath}.tmp-${process.pid}-${Date.now()}`;
|
|
38942
|
-
await
|
|
38943
|
-
await
|
|
39042
|
+
await import_node_fs59.promises.writeFile(tmp, content, "utf8");
|
|
39043
|
+
await import_node_fs59.promises.rename(tmp, targetPath);
|
|
38944
39044
|
}
|
|
38945
39045
|
async function ensureCompactArtifactsEngineFallback(input) {
|
|
38946
39046
|
const budget = resolveRecoveryContextBudget();
|
|
@@ -38961,7 +39061,7 @@ async function ensureCompactArtifactsEngineFallback(input) {
|
|
|
38961
39061
|
try {
|
|
38962
39062
|
let existing = "";
|
|
38963
39063
|
try {
|
|
38964
|
-
existing = await
|
|
39064
|
+
existing = await import_node_fs59.promises.readFile(memoryPath, "utf8");
|
|
38965
39065
|
} catch {
|
|
38966
39066
|
existing = "# MEMORY\n\n## Facts\n\n## Decisions\n\n## Constraints\n\n## Notes\n";
|
|
38967
39067
|
}
|
|
@@ -38976,7 +39076,7 @@ ${appendBlock}`;
|
|
|
38976
39076
|
}
|
|
38977
39077
|
|
|
38978
39078
|
// src/mobile/context-compact/session-state-snapshot.ts
|
|
38979
|
-
var
|
|
39079
|
+
var import_node_fs60 = require("fs");
|
|
38980
39080
|
var import_node_path60 = __toESM(require("path"));
|
|
38981
39081
|
var import_node_crypto29 = require("crypto");
|
|
38982
39082
|
init_state_dir();
|
|
@@ -39060,15 +39160,15 @@ function buildSessionStateSnapshot(input) {
|
|
|
39060
39160
|
};
|
|
39061
39161
|
}
|
|
39062
39162
|
async function writeAtomicJson2(targetPath, data) {
|
|
39063
|
-
await
|
|
39163
|
+
await import_node_fs60.promises.mkdir(import_node_path60.default.dirname(targetPath), { recursive: true });
|
|
39064
39164
|
const tmp = `${targetPath}.tmp-${process.pid}-${(0, import_node_crypto29.randomUUID)().slice(0, 8)}`;
|
|
39065
39165
|
let serialized = JSON.stringify(data, null, 2);
|
|
39066
39166
|
if (serialized.length > LIMITS.snapshotJsonMax) {
|
|
39067
39167
|
const slim = { ...data, _truncated: true };
|
|
39068
39168
|
serialized = JSON.stringify(slim).slice(0, LIMITS.snapshotJsonMax);
|
|
39069
39169
|
}
|
|
39070
|
-
await
|
|
39071
|
-
await
|
|
39170
|
+
await import_node_fs60.promises.writeFile(tmp, serialized, "utf8");
|
|
39171
|
+
await import_node_fs60.promises.rename(tmp, targetPath);
|
|
39072
39172
|
}
|
|
39073
39173
|
async function writeSessionStateSnapshot(snapshot) {
|
|
39074
39174
|
const target = resolveSessionStatePath(snapshot.sessionId);
|
|
@@ -39078,7 +39178,7 @@ async function writeSessionStateSnapshot(snapshot) {
|
|
|
39078
39178
|
async function readSessionStateSnapshot(sessionId) {
|
|
39079
39179
|
const target = resolveSessionStatePath(sessionId);
|
|
39080
39180
|
try {
|
|
39081
|
-
const raw = await
|
|
39181
|
+
const raw = await import_node_fs60.promises.readFile(target, "utf8");
|
|
39082
39182
|
return JSON.parse(raw);
|
|
39083
39183
|
} catch {
|
|
39084
39184
|
return null;
|
|
@@ -39086,7 +39186,7 @@ async function readSessionStateSnapshot(sessionId) {
|
|
|
39086
39186
|
}
|
|
39087
39187
|
|
|
39088
39188
|
// src/mobile/context-compact/compact-resume-prefetch.ts
|
|
39089
|
-
var
|
|
39189
|
+
var import_node_fs61 = require("fs");
|
|
39090
39190
|
init_runtime_agent_paths();
|
|
39091
39191
|
|
|
39092
39192
|
// src/owned-tools/memory-search.ts
|
|
@@ -39245,7 +39345,7 @@ async function buildCompactResumePrefetchedContext(input) {
|
|
|
39245
39345
|
];
|
|
39246
39346
|
const notePath = input.teamId?.trim() ? resolveCompactNotePathForTarget(input) : await resolveCompactNotePathForRead(input.agentId, input.sessionId);
|
|
39247
39347
|
try {
|
|
39248
|
-
const note = await
|
|
39348
|
+
const note = await import_node_fs61.promises.readFile(notePath, "utf8");
|
|
39249
39349
|
const { text: text2 } = truncateMiddle(note, budget.notesGetMaxChars);
|
|
39250
39350
|
lines.push("#### Compact \u7B14\u8BB0", "", text2, "");
|
|
39251
39351
|
} catch {
|
|
@@ -39259,7 +39359,7 @@ async function buildCompactResumePrefetchedContext(input) {
|
|
|
39259
39359
|
}
|
|
39260
39360
|
const memoryPath = resolveMemoryMdPath(input.agentId, input.teamId);
|
|
39261
39361
|
try {
|
|
39262
|
-
const mem = await
|
|
39362
|
+
const mem = await import_node_fs61.promises.readFile(memoryPath, "utf8");
|
|
39263
39363
|
const tail2 = mem.length > 4e3 ? mem.slice(-4e3) : mem;
|
|
39264
39364
|
const { text: text2 } = truncateMiddle(tail2, 4e3);
|
|
39265
39365
|
lines.push("#### MEMORY.md\uFF08\u5C3E\u90E8\u6458\u5F55\uFF09", "", text2, "");
|
|
@@ -42250,7 +42350,7 @@ async function callCompactSummarizerRouteLlm(route, system, user, opts) {
|
|
|
42250
42350
|
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
|
42251
42351
|
const signal = opts?.signal ? AbortSignal.any([opts.signal, controller.signal]) : controller.signal;
|
|
42252
42352
|
const inputChars = opts?.inputChars ?? system.length + user.length;
|
|
42253
|
-
const
|
|
42353
|
+
const started2 = Date.now();
|
|
42254
42354
|
try {
|
|
42255
42355
|
if (route.platform === "openai-completions") {
|
|
42256
42356
|
const url2 = resolveNativeOpenAiChatCompletionsUrl(route.baseUrl);
|
|
@@ -42280,7 +42380,7 @@ async function callCompactSummarizerRouteLlm(route, system, user, opts) {
|
|
|
42280
42380
|
}
|
|
42281
42381
|
const out2 = await readOpenAiCompletionText(res2);
|
|
42282
42382
|
opts?.log?.(
|
|
42283
|
-
`[XKZOOM][context-compact] SUMMARIZER_LLM_DONE platform=openai-completions elapsedMs=${Date.now() -
|
|
42383
|
+
`[XKZOOM][context-compact] SUMMARIZER_LLM_DONE platform=openai-completions elapsedMs=${Date.now() - started2} outputChars=${out2.length}`
|
|
42284
42384
|
);
|
|
42285
42385
|
return out2;
|
|
42286
42386
|
}
|
|
@@ -42315,7 +42415,7 @@ async function callCompactSummarizerRouteLlm(route, system, user, opts) {
|
|
|
42315
42415
|
}
|
|
42316
42416
|
const out = await readAnthropicCompletionText(res);
|
|
42317
42417
|
opts?.log?.(
|
|
42318
|
-
`[XKZOOM][context-compact] SUMMARIZER_LLM_DONE platform=anthropic-messages elapsedMs=${Date.now() -
|
|
42418
|
+
`[XKZOOM][context-compact] SUMMARIZER_LLM_DONE platform=anthropic-messages elapsedMs=${Date.now() - started2} outputChars=${out.length}`
|
|
42319
42419
|
);
|
|
42320
42420
|
return out;
|
|
42321
42421
|
} finally {
|
|
@@ -42651,11 +42751,11 @@ function buildConversationTailContextBlock(messages) {
|
|
|
42651
42751
|
var import_node_crypto31 = require("crypto");
|
|
42652
42752
|
|
|
42653
42753
|
// src/mobile/tools/mobile-diary-tools.ts
|
|
42654
|
-
var
|
|
42754
|
+
var import_node_fs65 = require("fs");
|
|
42655
42755
|
var import_node_path64 = __toESM(require("path"));
|
|
42656
42756
|
|
|
42657
42757
|
// src/mobile/diary-prompt-injection.ts
|
|
42658
|
-
var
|
|
42758
|
+
var import_node_fs64 = require("fs");
|
|
42659
42759
|
var import_node_path63 = __toESM(require("path"));
|
|
42660
42760
|
function readPositiveIntEnv3(name, fallback, min = 1, max = 1e6) {
|
|
42661
42761
|
const raw = process.env[name]?.trim();
|
|
@@ -42672,9 +42772,9 @@ function resolveDiaryInjectMaxChars() {
|
|
|
42672
42772
|
}
|
|
42673
42773
|
async function readUtf8IfExists(absPath, maxBytes) {
|
|
42674
42774
|
try {
|
|
42675
|
-
const st = await
|
|
42775
|
+
const st = await import_node_fs64.promises.stat(absPath);
|
|
42676
42776
|
if (!st.isFile()) return null;
|
|
42677
|
-
const buf = st.size <= maxBytes ? await
|
|
42777
|
+
const buf = st.size <= maxBytes ? await import_node_fs64.promises.readFile(absPath) : (await import_node_fs64.promises.readFile(absPath)).subarray(0, maxBytes);
|
|
42678
42778
|
return buf.toString("utf8");
|
|
42679
42779
|
} catch {
|
|
42680
42780
|
return null;
|
|
@@ -42696,9 +42796,9 @@ async function readDiaryTextsForDayBundle(notesDir, bundle, maxBytesPerFile) {
|
|
|
42696
42796
|
async function collectRecentDiaryBundles(notesDir, days) {
|
|
42697
42797
|
let names = [];
|
|
42698
42798
|
try {
|
|
42699
|
-
const st = await
|
|
42799
|
+
const st = await import_node_fs64.promises.stat(notesDir);
|
|
42700
42800
|
if (!st.isDirectory()) return [];
|
|
42701
|
-
names = await
|
|
42801
|
+
names = await import_node_fs64.promises.readdir(notesDir);
|
|
42702
42802
|
} catch {
|
|
42703
42803
|
return [];
|
|
42704
42804
|
}
|
|
@@ -42818,9 +42918,9 @@ function clampSummary(summary, maxChars) {
|
|
|
42818
42918
|
async function readDiaryIndexPreview(workspaceDir) {
|
|
42819
42919
|
const diaryPath = import_node_path64.default.join(workspaceDir, "DIARY.md");
|
|
42820
42920
|
try {
|
|
42821
|
-
const st = await
|
|
42921
|
+
const st = await import_node_fs65.promises.stat(diaryPath);
|
|
42822
42922
|
if (!st.isFile()) return "";
|
|
42823
|
-
const buf = await
|
|
42923
|
+
const buf = await import_node_fs65.promises.readFile(diaryPath);
|
|
42824
42924
|
const text2 = buf.slice(0, DIARY_INDEX_MAX_BYTES).toString("utf8");
|
|
42825
42925
|
return buf.length > DIARY_INDEX_MAX_BYTES ? `${text2}\u2026` : text2;
|
|
42826
42926
|
} catch {
|
|
@@ -42984,7 +43084,7 @@ async function handleNotesGetTool(input) {
|
|
|
42984
43084
|
|
|
42985
43085
|
// src/mobile/context-compact/native-store-summarize.ts
|
|
42986
43086
|
var import_node_crypto30 = require("crypto");
|
|
42987
|
-
var
|
|
43087
|
+
var import_node_fs66 = require("fs");
|
|
42988
43088
|
var import_node_path65 = __toESM(require("path"));
|
|
42989
43089
|
init_state_dir();
|
|
42990
43090
|
function resolveNativeCompactArchiveDir() {
|
|
@@ -42993,7 +43093,7 @@ function resolveNativeCompactArchiveDir() {
|
|
|
42993
43093
|
}
|
|
42994
43094
|
async function writeArchiveSnapshot(sessionId, messages) {
|
|
42995
43095
|
const dir = resolveNativeCompactArchiveDir();
|
|
42996
|
-
await
|
|
43096
|
+
await import_node_fs66.promises.mkdir(dir, { recursive: true });
|
|
42997
43097
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
42998
43098
|
const archivedPath = import_node_path65.default.join(
|
|
42999
43099
|
dir,
|
|
@@ -43007,8 +43107,8 @@ async function writeArchiveSnapshot(sessionId, messages) {
|
|
|
43007
43107
|
messages
|
|
43008
43108
|
};
|
|
43009
43109
|
const tmp = `${archivedPath}.tmp-${process.pid}`;
|
|
43010
|
-
await
|
|
43011
|
-
await
|
|
43110
|
+
await import_node_fs66.promises.writeFile(tmp, JSON.stringify(payload, null, 2), "utf8");
|
|
43111
|
+
await import_node_fs66.promises.rename(tmp, archivedPath);
|
|
43012
43112
|
return archivedPath;
|
|
43013
43113
|
}
|
|
43014
43114
|
async function executeSummarizeNativeStore(opts) {
|
|
@@ -43058,7 +43158,7 @@ function yieldEventLoopForToolCardFlush() {
|
|
|
43058
43158
|
}
|
|
43059
43159
|
async function emitOwnedToolRun(emit, name, args, run) {
|
|
43060
43160
|
const toolCallId = `xkcompact-${name}-${(0, import_node_crypto31.randomUUID)().slice(0, 8)}`;
|
|
43061
|
-
const
|
|
43161
|
+
const started2 = Date.now();
|
|
43062
43162
|
emit({
|
|
43063
43163
|
phase: "start",
|
|
43064
43164
|
toolCallId,
|
|
@@ -43073,7 +43173,7 @@ async function emitOwnedToolRun(emit, name, args, run) {
|
|
|
43073
43173
|
phase: "result",
|
|
43074
43174
|
toolCallId,
|
|
43075
43175
|
result: previewResult(result),
|
|
43076
|
-
durationMs: Date.now() -
|
|
43176
|
+
durationMs: Date.now() - started2
|
|
43077
43177
|
});
|
|
43078
43178
|
return result;
|
|
43079
43179
|
} catch (error) {
|
|
@@ -43082,7 +43182,7 @@ async function emitOwnedToolRun(emit, name, args, run) {
|
|
|
43082
43182
|
toolCallId,
|
|
43083
43183
|
isError: true,
|
|
43084
43184
|
result: error instanceof Error ? error.message : String(error),
|
|
43085
|
-
durationMs: Date.now() -
|
|
43185
|
+
durationMs: Date.now() - started2
|
|
43086
43186
|
});
|
|
43087
43187
|
throw error;
|
|
43088
43188
|
}
|
|
@@ -43145,7 +43245,7 @@ function formatVisibleToolResultsForPrompt(results) {
|
|
|
43145
43245
|
}
|
|
43146
43246
|
|
|
43147
43247
|
// src/mobile/context-compact/compact-message-collector.ts
|
|
43148
|
-
var
|
|
43248
|
+
var import_node_fs67 = require("fs");
|
|
43149
43249
|
init_chat_visible_text();
|
|
43150
43250
|
init_runtime_agent_paths();
|
|
43151
43251
|
init_transcript_media_sanitize();
|
|
@@ -43182,7 +43282,7 @@ function collectMessagesForCompaction(store, sessionId, opts) {
|
|
|
43182
43282
|
async function parseLegacyTranscriptMessages(sessionFile) {
|
|
43183
43283
|
let raw = "";
|
|
43184
43284
|
try {
|
|
43185
|
-
raw = await
|
|
43285
|
+
raw = await import_node_fs67.promises.readFile(sessionFile, "utf8");
|
|
43186
43286
|
} catch {
|
|
43187
43287
|
return [];
|
|
43188
43288
|
}
|
|
@@ -43360,7 +43460,7 @@ function pickArtifactEnrichTail(collected) {
|
|
|
43360
43460
|
}
|
|
43361
43461
|
|
|
43362
43462
|
// src/mobile/context-compact/compact-transcript-rehydrate.ts
|
|
43363
|
-
var
|
|
43463
|
+
var import_node_fs68 = require("fs");
|
|
43364
43464
|
init_transcript_media_sanitize();
|
|
43365
43465
|
function transcriptMessageLine(role, content) {
|
|
43366
43466
|
return JSON.stringify({
|
|
@@ -43379,13 +43479,13 @@ async function appendKeepRecentMessagesToTranscript(sessionFile, messages) {
|
|
|
43379
43479
|
if (lines.length === 0) {
|
|
43380
43480
|
return 0;
|
|
43381
43481
|
}
|
|
43382
|
-
await
|
|
43482
|
+
await import_node_fs68.promises.appendFile(sessionFile, `${lines.map((l) => `${l}
|
|
43383
43483
|
`).join("")}`, "utf8");
|
|
43384
43484
|
return lines.length;
|
|
43385
43485
|
}
|
|
43386
43486
|
|
|
43387
43487
|
// src/mobile/context-compact/compact-artifact-writer.ts
|
|
43388
|
-
var
|
|
43488
|
+
var import_node_fs69 = require("fs");
|
|
43389
43489
|
var import_node_path66 = __toESM(require("path"));
|
|
43390
43490
|
async function writeCompactArtifactsAtomic(input) {
|
|
43391
43491
|
const budget = resolveRecoveryContextBudget();
|
|
@@ -43401,10 +43501,10 @@ async function writeCompactArtifactsAtomic(input) {
|
|
|
43401
43501
|
if (block.length > budget.memoryAppendMaxChars) {
|
|
43402
43502
|
throw new Error(`memory_append_oversize:${block.length}`);
|
|
43403
43503
|
}
|
|
43404
|
-
await
|
|
43504
|
+
await import_node_fs69.promises.mkdir(import_node_path66.default.dirname(memoryPath), { recursive: true }).catch(() => void 0);
|
|
43405
43505
|
const prefix = block.startsWith("\n") ? block : `
|
|
43406
43506
|
${block}`;
|
|
43407
|
-
await
|
|
43507
|
+
await import_node_fs69.promises.appendFile(memoryPath, prefix.endsWith("\n") ? prefix : `${prefix}
|
|
43408
43508
|
`, "utf8");
|
|
43409
43509
|
memoryAppended = true;
|
|
43410
43510
|
}
|
|
@@ -43569,7 +43669,7 @@ function logMemoryContractR6Deferred(logInfo, reason) {
|
|
|
43569
43669
|
}
|
|
43570
43670
|
|
|
43571
43671
|
// src/mobile/memory-contract-r2-writer.ts
|
|
43572
|
-
var
|
|
43672
|
+
var import_node_fs70 = __toESM(require("fs"));
|
|
43573
43673
|
var import_node_path67 = __toESM(require("path"));
|
|
43574
43674
|
init_runtime_agent_paths();
|
|
43575
43675
|
|
|
@@ -43711,11 +43811,11 @@ function resolveTargetFile(workspaceDir, signalType) {
|
|
|
43711
43811
|
return import_node_path67.default.join(workspaceDir, "MEMORY.md");
|
|
43712
43812
|
}
|
|
43713
43813
|
function ensureFileWithSeed(target, signalType) {
|
|
43714
|
-
if (
|
|
43814
|
+
if (import_node_fs70.default.existsSync(target)) return;
|
|
43715
43815
|
const dir = import_node_path67.default.dirname(target);
|
|
43716
|
-
|
|
43816
|
+
import_node_fs70.default.mkdirSync(dir, { recursive: true });
|
|
43717
43817
|
if (signalType === "preference") {
|
|
43718
|
-
|
|
43818
|
+
import_node_fs70.default.writeFileSync(
|
|
43719
43819
|
target,
|
|
43720
43820
|
[
|
|
43721
43821
|
"# USER",
|
|
@@ -43728,7 +43828,7 @@ function ensureFileWithSeed(target, signalType) {
|
|
|
43728
43828
|
"utf8"
|
|
43729
43829
|
);
|
|
43730
43830
|
} else {
|
|
43731
|
-
|
|
43831
|
+
import_node_fs70.default.writeFileSync(
|
|
43732
43832
|
target,
|
|
43733
43833
|
[
|
|
43734
43834
|
"# MEMORY",
|
|
@@ -43797,7 +43897,7 @@ async function enforceR2Write(input) {
|
|
|
43797
43897
|
return withWorkspaceLock(workspaceDir, async () => {
|
|
43798
43898
|
try {
|
|
43799
43899
|
ensureFileWithSeed(target, input.signalType);
|
|
43800
|
-
const existing = await
|
|
43900
|
+
const existing = await import_node_fs70.default.promises.readFile(target, "utf8").catch(() => "");
|
|
43801
43901
|
const dedup = checkR2Dedup(existing, input.signalType, userText);
|
|
43802
43902
|
if (dedup.decision === "skip-dedup") {
|
|
43803
43903
|
return {
|
|
@@ -43820,7 +43920,7 @@ async function enforceR2Write(input) {
|
|
|
43820
43920
|
sessionId: input.sessionId,
|
|
43821
43921
|
truncated
|
|
43822
43922
|
});
|
|
43823
|
-
await
|
|
43923
|
+
await import_node_fs70.default.promises.appendFile(target, entry, "utf8");
|
|
43824
43924
|
return {
|
|
43825
43925
|
written: true,
|
|
43826
43926
|
target,
|
|
@@ -44159,7 +44259,7 @@ async function requestGatewayCompaction(_input) {
|
|
|
44159
44259
|
// src/mobile/context-compact/compact-orchestrator.ts
|
|
44160
44260
|
async function readMtimeMs(filePath) {
|
|
44161
44261
|
try {
|
|
44162
|
-
const st = await
|
|
44262
|
+
const st = await import_node_fs71.promises.stat(filePath);
|
|
44163
44263
|
return st.isFile() ? st.mtimeMs : void 0;
|
|
44164
44264
|
} catch {
|
|
44165
44265
|
return void 0;
|
|
@@ -44562,7 +44662,7 @@ async function runCompactSummarizerPipeline(ctx) {
|
|
|
44562
44662
|
if (!verify.ok) {
|
|
44563
44663
|
return { status: "aborted", reason: "verify_failed" };
|
|
44564
44664
|
}
|
|
44565
|
-
const noteTextForGate = await
|
|
44665
|
+
const noteTextForGate = await import_node_fs71.promises.readFile(notePath, "utf8").catch(() => "");
|
|
44566
44666
|
if (noteTextForGate && isEngineSeededCompactNote(noteTextForGate) && !engineSeededNoteHasMinimalContinuity(noteTextForGate)) {
|
|
44567
44667
|
return { status: "aborted", reason: "engine_fallback_insufficient" };
|
|
44568
44668
|
}
|
|
@@ -44652,7 +44752,7 @@ async function runGatewayDispatchCompactPipeline(ctx) {
|
|
|
44652
44752
|
return { status: "aborted", reason: "verify_failed" };
|
|
44653
44753
|
}
|
|
44654
44754
|
}
|
|
44655
|
-
const noteTextForGate = await
|
|
44755
|
+
const noteTextForGate = await import_node_fs71.promises.readFile(notePath, "utf8").catch(() => "");
|
|
44656
44756
|
if (noteTextForGate && isEngineSeededCompactNote(noteTextForGate) && !engineSeededNoteHasMinimalContinuity(noteTextForGate)) {
|
|
44657
44757
|
return { status: "aborted", reason: "engine_fallback_insufficient" };
|
|
44658
44758
|
}
|
|
@@ -46020,7 +46120,7 @@ async function runOwnedExec(params) {
|
|
|
46020
46120
|
}
|
|
46021
46121
|
const warningList = warnings.length > 0 ? warnings : void 0;
|
|
46022
46122
|
if (effectiveBackground) {
|
|
46023
|
-
const
|
|
46123
|
+
const started2 = await startOwnedBackgroundProcess({
|
|
46024
46124
|
command: effectiveCommand,
|
|
46025
46125
|
cwd,
|
|
46026
46126
|
root: rootAbs,
|
|
@@ -46035,8 +46135,8 @@ async function runOwnedExec(params) {
|
|
|
46035
46135
|
stdout: "",
|
|
46036
46136
|
stderr: "",
|
|
46037
46137
|
background: true,
|
|
46038
|
-
sessionId:
|
|
46039
|
-
...
|
|
46138
|
+
sessionId: started2.sessionId,
|
|
46139
|
+
...started2.pid !== void 0 ? { pid: started2.pid } : {},
|
|
46040
46140
|
...warningList ? { warnings: warningList } : {}
|
|
46041
46141
|
};
|
|
46042
46142
|
}
|
|
@@ -46640,7 +46740,7 @@ var groupsHistoryTool = defineTool({
|
|
|
46640
46740
|
|
|
46641
46741
|
// src/owned-tools/handoff.ts
|
|
46642
46742
|
var import_node_crypto33 = require("crypto");
|
|
46643
|
-
var
|
|
46743
|
+
var import_node_fs72 = require("fs");
|
|
46644
46744
|
init_store();
|
|
46645
46745
|
init_floor_state_store();
|
|
46646
46746
|
init_pipeline_dept_rollup();
|
|
@@ -46801,8 +46901,8 @@ var handoffTool = defineTool({
|
|
|
46801
46901
|
if (ref3 && projectRoot) {
|
|
46802
46902
|
try {
|
|
46803
46903
|
const { absPath } = resolveWorkspaceRelativePath(projectRoot, ref3);
|
|
46804
|
-
if ((0,
|
|
46805
|
-
sha2564 = (0, import_node_crypto33.createHash)("sha256").update((0,
|
|
46904
|
+
if ((0, import_node_fs72.existsSync)(absPath)) {
|
|
46905
|
+
sha2564 = (0, import_node_crypto33.createHash)("sha256").update((0, import_node_fs72.readFileSync)(absPath)).digest("hex");
|
|
46806
46906
|
deliverableVerified3 = true;
|
|
46807
46907
|
}
|
|
46808
46908
|
} catch {
|
|
@@ -46915,8 +47015,8 @@ var handoffTool = defineTool({
|
|
|
46915
47015
|
let deliverableVerified2 = false;
|
|
46916
47016
|
try {
|
|
46917
47017
|
const { absPath } = resolveWorkspaceRelativePath(projectRoot, ref2);
|
|
46918
|
-
if ((0,
|
|
46919
|
-
sha2563 = (0, import_node_crypto33.createHash)("sha256").update((0,
|
|
47018
|
+
if ((0, import_node_fs72.existsSync)(absPath)) {
|
|
47019
|
+
sha2563 = (0, import_node_crypto33.createHash)("sha256").update((0, import_node_fs72.readFileSync)(absPath)).digest("hex");
|
|
46920
47020
|
deliverableVerified2 = true;
|
|
46921
47021
|
} else {
|
|
46922
47022
|
return handoffFail({
|
|
@@ -47007,8 +47107,8 @@ var handoffTool = defineTool({
|
|
|
47007
47107
|
if (ref2 && projectRoot) {
|
|
47008
47108
|
try {
|
|
47009
47109
|
const { absPath } = resolveWorkspaceRelativePath(projectRoot, ref2);
|
|
47010
|
-
if ((0,
|
|
47011
|
-
sha2563 = (0, import_node_crypto33.createHash)("sha256").update((0,
|
|
47110
|
+
if ((0, import_node_fs72.existsSync)(absPath)) {
|
|
47111
|
+
sha2563 = (0, import_node_crypto33.createHash)("sha256").update((0, import_node_fs72.readFileSync)(absPath)).digest("hex");
|
|
47012
47112
|
deliverableVerified2 = true;
|
|
47013
47113
|
}
|
|
47014
47114
|
} catch {
|
|
@@ -47078,8 +47178,8 @@ var handoffTool = defineTool({
|
|
|
47078
47178
|
let deliverableVerified = false;
|
|
47079
47179
|
try {
|
|
47080
47180
|
const { absPath } = resolveWorkspaceRelativePath(projectRoot, ref);
|
|
47081
|
-
if ((0,
|
|
47082
|
-
sha2562 = (0, import_node_crypto33.createHash)("sha256").update((0,
|
|
47181
|
+
if ((0, import_node_fs72.existsSync)(absPath)) {
|
|
47182
|
+
sha2562 = (0, import_node_crypto33.createHash)("sha256").update((0, import_node_fs72.readFileSync)(absPath)).digest("hex");
|
|
47083
47183
|
deliverableVerified = true;
|
|
47084
47184
|
} else {
|
|
47085
47185
|
return handoffFail({
|
|
@@ -52289,7 +52389,7 @@ function shouldSuppressAssistTextFromNativeDeliver(opts) {
|
|
|
52289
52389
|
}
|
|
52290
52390
|
|
|
52291
52391
|
// src/mobile/native-reply-local-media-promote.ts
|
|
52292
|
-
var
|
|
52392
|
+
var import_node_fs75 = __toESM(require("fs"));
|
|
52293
52393
|
var import_node_path69 = __toESM(require("path"));
|
|
52294
52394
|
var EXACT_OUTBOUND_REF_RE = /^(?:workspace\/)?(?:(?:media|file)\/outbound\/[^\r\n]+|generated\/[^\r\n]+)$/i;
|
|
52295
52395
|
function trimOnePairOfQuotes(value) {
|
|
@@ -52310,7 +52410,7 @@ function looksLikeExactOutboundReference(value) {
|
|
|
52310
52410
|
}
|
|
52311
52411
|
function safeFileSize(absPath, fallback) {
|
|
52312
52412
|
try {
|
|
52313
|
-
return
|
|
52413
|
+
return import_node_fs75.default.statSync(absPath).size;
|
|
52314
52414
|
} catch {
|
|
52315
52415
|
return fallback;
|
|
52316
52416
|
}
|
|
@@ -55976,7 +56076,7 @@ function routeProcessInput(input) {
|
|
|
55976
56076
|
}
|
|
55977
56077
|
|
|
55978
56078
|
// src/owned-tools/sessions-history-resolver.ts
|
|
55979
|
-
var
|
|
56079
|
+
var import_node_fs78 = require("fs");
|
|
55980
56080
|
var import_node_path74 = __toESM(require("path"));
|
|
55981
56081
|
function parseAgentIdFromSessionKey(sessionKey) {
|
|
55982
56082
|
const match = /^agent:([^:]+):/.exec(sessionKey.trim());
|
|
@@ -56002,7 +56102,7 @@ async function resolveSessionKeyInIndex(agentId, rawKey) {
|
|
|
56002
56102
|
const indexPath = resolveAgentSessionsIndexPath(agentId);
|
|
56003
56103
|
let index;
|
|
56004
56104
|
try {
|
|
56005
|
-
index = JSON.parse(await
|
|
56105
|
+
index = JSON.parse(await import_node_fs78.promises.readFile(indexPath, "utf8"));
|
|
56006
56106
|
} catch {
|
|
56007
56107
|
return null;
|
|
56008
56108
|
}
|
|
@@ -56041,7 +56141,7 @@ function isConversationMessage(message) {
|
|
|
56041
56141
|
return role === "user" || role === "assistant";
|
|
56042
56142
|
}
|
|
56043
56143
|
async function readJsonlMessages(sessionFile) {
|
|
56044
|
-
const raw = await
|
|
56144
|
+
const raw = await import_node_fs78.promises.readFile(sessionFile, "utf8");
|
|
56045
56145
|
const messages = [];
|
|
56046
56146
|
for (const line of raw.split(/\r?\n/)) {
|
|
56047
56147
|
if (!line.trim()) {
|
|
@@ -56058,7 +56158,7 @@ async function listCompactArchivePaths(sessionFile) {
|
|
|
56058
56158
|
const dir = import_node_path74.default.dirname(sessionFile);
|
|
56059
56159
|
const base = import_node_path74.default.basename(sessionFile, import_node_path74.default.extname(sessionFile));
|
|
56060
56160
|
try {
|
|
56061
|
-
const names = await
|
|
56161
|
+
const names = await import_node_fs78.promises.readdir(dir);
|
|
56062
56162
|
return names.filter((name) => name.startsWith(`${base}.compact.`) && name.endsWith(".bak")).map((name) => import_node_path74.default.join(dir, name)).sort().reverse();
|
|
56063
56163
|
} catch {
|
|
56064
56164
|
return [];
|
|
@@ -59067,7 +59167,7 @@ function formatNativeAnthropicTurnUserMessage(err, kind) {
|
|
|
59067
59167
|
init_current_project_context();
|
|
59068
59168
|
|
|
59069
59169
|
// src/mobile/workspace-bootstrap-context.ts
|
|
59070
|
-
var
|
|
59170
|
+
var import_node_fs79 = __toESM(require("fs"));
|
|
59071
59171
|
var import_node_path76 = __toESM(require("path"));
|
|
59072
59172
|
init_identity_md();
|
|
59073
59173
|
init_current_project_context();
|
|
@@ -59076,9 +59176,9 @@ var DEFAULT_MAX_CHARS_PER_FILE = 12e3;
|
|
|
59076
59176
|
var DEFAULT_MAX_TOTAL_CHARS = 36e3;
|
|
59077
59177
|
function readUtf8FileSync(absPath, maxBytes) {
|
|
59078
59178
|
try {
|
|
59079
|
-
const st =
|
|
59179
|
+
const st = import_node_fs79.default.statSync(absPath);
|
|
59080
59180
|
if (!st.isFile()) return null;
|
|
59081
|
-
const buf = st.size <= maxBytes ?
|
|
59181
|
+
const buf = st.size <= maxBytes ? import_node_fs79.default.readFileSync(absPath) : import_node_fs79.default.readFileSync(absPath).subarray(0, maxBytes);
|
|
59082
59182
|
const text2 = buf.toString("utf8").trim();
|
|
59083
59183
|
return text2.length > 0 ? text2 : null;
|
|
59084
59184
|
} catch {
|
|
@@ -59766,7 +59866,7 @@ async function resolveNativeReplyRouteAsync(input) {
|
|
|
59766
59866
|
init_native_gateway_config();
|
|
59767
59867
|
|
|
59768
59868
|
// src/mobile/reply-dispatch-warmup.ts
|
|
59769
|
-
var
|
|
59869
|
+
var import_node_fs80 = __toESM(require("fs"));
|
|
59770
59870
|
var import_node_module5 = require("module");
|
|
59771
59871
|
var import_node_path77 = __toESM(require("path"));
|
|
59772
59872
|
init_native_provider_api_key_gateway();
|
|
@@ -59792,7 +59892,7 @@ function resolveWarmReplyDispatchFlowPath() {
|
|
|
59792
59892
|
import_node_path77.default.resolve(process.cwd(), "gateway-core", "runtime", "reply", "warm-reply-dispatch-flow.cjs")
|
|
59793
59893
|
);
|
|
59794
59894
|
for (const candidate of candidates) {
|
|
59795
|
-
if (
|
|
59895
|
+
if (import_node_fs80.default.existsSync(candidate)) {
|
|
59796
59896
|
return candidate;
|
|
59797
59897
|
}
|
|
59798
59898
|
}
|
|
@@ -59955,7 +60055,7 @@ function resolveMobileGatewayPluginSdkAdapterPath() {
|
|
|
59955
60055
|
continue;
|
|
59956
60056
|
}
|
|
59957
60057
|
seen.add(candidate);
|
|
59958
|
-
if (
|
|
60058
|
+
if (import_node_fs81.default.existsSync(candidate)) {
|
|
59959
60059
|
return candidate;
|
|
59960
60060
|
}
|
|
59961
60061
|
}
|
|
@@ -60105,7 +60205,7 @@ function normalizeReplayInboundMediaTypes(paths, types, messageType) {
|
|
|
60105
60205
|
}
|
|
60106
60206
|
function buildConsumedInboundFromAnchoredPersisted(anchor, firstPath) {
|
|
60107
60207
|
try {
|
|
60108
|
-
const st =
|
|
60208
|
+
const st = import_node_fs81.default.statSync(firstPath);
|
|
60109
60209
|
const byteSize = Number(st.size);
|
|
60110
60210
|
if (!Number.isFinite(byteSize)) {
|
|
60111
60211
|
return null;
|
|
@@ -60652,7 +60752,7 @@ var MobileGatewayRuntime = class {
|
|
|
60652
60752
|
if (resolvedAbs) {
|
|
60653
60753
|
if (!filePart.fileSize || filePart.fileSize <= 0) {
|
|
60654
60754
|
try {
|
|
60655
|
-
filePart.fileSize =
|
|
60755
|
+
filePart.fileSize = import_node_fs81.default.statSync(resolvedAbs).size;
|
|
60656
60756
|
} catch {
|
|
60657
60757
|
}
|
|
60658
60758
|
}
|
|
@@ -60931,7 +61031,7 @@ var MobileGatewayRuntime = class {
|
|
|
60931
61031
|
if (!rel.startsWith("..") && !import_node_path78.default.isAbsolute(rel) && rel.startsWith("media/outbound/")) {
|
|
60932
61032
|
const meta2 = deriveFileMetaFromUrlOrPath(resolvedLocal);
|
|
60933
61033
|
if (meta2.fileMime.startsWith("image/")) {
|
|
60934
|
-
const stat5 =
|
|
61034
|
+
const stat5 = import_node_fs81.default.statSync(resolvedLocal);
|
|
60935
61035
|
return {
|
|
60936
61036
|
content: resolvedLocal,
|
|
60937
61037
|
type: "image",
|