@wrongstack/core 0.313.1 → 0.316.1
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/chronicle/index.js +31 -31
- package/dist/chronicle/legacy-journal-import.d.ts +0 -6
- package/dist/chronicle/metrics-ingest.d.ts +14 -0
- package/dist/chronicle/metrics-schema.d.ts +10 -1
- package/dist/chronicle/metrics-store.d.ts +20 -2
- package/dist/chronicle/project-server.js +39 -31
- package/dist/chronicle/sink.d.ts +13 -0
- package/dist/chronicle/sqlite-journal.d.ts +20 -2
- package/dist/{chunk-WOEZV3Q4.js → chunk-25LSLC3G.js} +2 -1
- package/dist/{chunk-AI4LLQ2U.js → chunk-27QIURLN.js} +229 -12
- package/dist/{chunk-I45KAW2N.js → chunk-3AGWVSS7.js} +38 -450
- package/dist/chunk-3BDV7RL3.js +211 -0
- package/dist/{chunk-NFAYHPRH.js → chunk-3ECENVHL.js} +10 -8
- package/dist/{chunk-FW5LDDMJ.js → chunk-45WI72ZB.js} +1576 -1156
- package/dist/{chunk-AT4V4XGI.js → chunk-4BMVPOHO.js} +539 -313
- package/dist/{chunk-YBUJCZ57.js → chunk-4I7HGVVA.js} +17 -5
- package/dist/{chunk-JVGPR3TS.js → chunk-4LCZVJVF.js} +7 -55
- package/dist/{chunk-4ZHTKJHM.js → chunk-4SJNS7OB.js} +36 -2
- package/dist/{chunk-AD7ZFZCS.js → chunk-5BMIE7QG.js} +3 -3
- package/dist/{chunk-IQ35HMQL.js → chunk-5YPSXQXM.js} +71 -24
- package/dist/chunk-6FHWXLPT.js +10 -0
- package/dist/{chunk-FIV4IJL7.js → chunk-6H5GEOET.js} +163 -20
- package/dist/{chunk-VB3H5WWB.js → chunk-6NWEVFEL.js} +2 -2
- package/dist/{chunk-E6I5RXVK.js → chunk-AYW5YINX.js} +2 -2
- package/dist/{chunk-DEIQMBD2.js → chunk-B7F4WVP4.js} +2 -2
- package/dist/{chunk-XQ2XGIBF.js → chunk-BPBKKBUK.js} +6 -7
- package/dist/{chunk-K4YUNKU7.js → chunk-BYD345OX.js} +2 -2
- package/dist/{chunk-LZDDLNCZ.js → chunk-C27KDLOX.js} +4 -4
- package/dist/{chunk-6AKOTGLM.js → chunk-CU546ESW.js} +7 -7
- package/dist/{chunk-ZZ4V3WIZ.js → chunk-DLHHXUAM.js} +10 -1
- package/dist/{chunk-BAKVJLEV.js → chunk-DOTHQSJ2.js} +28 -16
- package/dist/{chunk-KBZGE6LN.js → chunk-DYLPMV4Q.js} +4 -3
- package/dist/{chunk-52RTVH4M.js → chunk-F3JWNST7.js} +2 -2
- package/dist/{chunk-WEBMSQP2.js → chunk-FC2ZGRF3.js} +21 -4
- package/dist/{chunk-FHAMQS7Q.js → chunk-FCBTO76Z.js} +76 -146
- package/dist/{chunk-4LJJYBAU.js → chunk-FHZVFYSL.js} +9 -1
- package/dist/{chunk-W4A6QA3D.js → chunk-FWNLEZYG.js} +4 -3
- package/dist/{chunk-OJZEX73F.js → chunk-GDQ7CZRQ.js} +5 -1
- package/dist/{chunk-QVOVMXJR.js → chunk-GJJGJB2R.js} +32 -9
- package/dist/{chunk-4XV6IR37.js → chunk-HI3JGZR2.js} +7 -6
- package/dist/{chunk-FSWCWSTS.js → chunk-HMLIGAU7.js} +26 -26
- package/dist/{chunk-PFXFQQRT.js → chunk-HXKZ7OBQ.js} +7 -43
- package/dist/{chunk-2FQL4PDC.js → chunk-I7DALG7J.js} +5 -5
- package/dist/{chunk-GM54GJBU.js → chunk-IRUTEHCE.js} +3 -3
- package/dist/{chunk-TYW2GI5I.js → chunk-J2WRWR37.js} +40 -13
- package/dist/{chunk-ZEHUCJHY.js → chunk-JFPJ6LLQ.js} +2 -2
- package/dist/chunk-JMULFFLN.js +9 -0
- package/dist/{chunk-RD6DEE36.js → chunk-JO4MGB6Z.js} +94 -8
- package/dist/{chunk-5DSMEVA4.js → chunk-K6BXGITA.js} +7 -7
- package/dist/{chunk-O74MJHXU.js → chunk-KZMSZV32.js} +2 -2
- package/dist/{chunk-GFJOMSHG.js → chunk-LA7CLDRW.js} +6 -2
- package/dist/{chunk-M2WF6AXG.js → chunk-LSMMOS2Z.js} +7 -3
- package/dist/{chunk-ASX6AW36.js → chunk-LXWCMQNJ.js} +3 -3
- package/dist/{chunk-WZO23AWO.js → chunk-M27LIEKV.js} +72 -22
- package/dist/{chunk-JTHKOYWU.js → chunk-MJPHJRAL.js} +15 -15
- package/dist/{chunk-G5AAKEEZ.js → chunk-MTL4O5YR.js} +5 -5
- package/dist/chunk-NHJ75HXY.js +1 -0
- package/dist/{chunk-ZYU2YOJ6.js → chunk-NIOAGFPB.js} +29 -15
- package/dist/{chunk-Y2GE5TSI.js → chunk-NS52ISWS.js} +2 -2
- package/dist/{chunk-UIWONWVG.js → chunk-NSOFPKGT.js} +541 -148
- package/dist/{chunk-RCQYT2I4.js → chunk-NVIZG63R.js} +2 -2
- package/dist/{chunk-EPC3GZD4.js → chunk-OOYZPOXM.js} +2 -2
- package/dist/{chunk-7ZHZE5EO.js → chunk-OSGLYW5J.js} +2 -2
- package/dist/{chunk-CE4ZOCOI.js → chunk-PFCMSSUF.js} +9 -9
- package/dist/{chunk-GFXZTHNI.js → chunk-PGRVXIMY.js} +5 -5
- package/dist/{chunk-JJPMWPB6.js → chunk-PISBFBJN.js} +6 -6
- package/dist/chunk-POOOIWE5.js +9 -0
- package/dist/{chunk-5RP3QTRL.js → chunk-PQNS3U7Z.js} +20 -3
- package/dist/{chunk-3E244UDA.js → chunk-QSTSJOCK.js} +52 -6
- package/dist/{chunk-YUPMXOGP.js → chunk-RFQMOKWK.js} +3 -3
- package/dist/chunk-RTOTNK3P.js +484 -0
- package/dist/{chunk-SN2DQRL6.js → chunk-RXKSDUAU.js} +7 -7
- package/dist/{chunk-T3KGZBU5.js → chunk-S45JPKQN.js} +189 -43
- package/dist/{chunk-YNCVSFGF.js → chunk-SAFHACFA.js} +4 -1
- package/dist/{chunk-KI4L2DUL.js → chunk-TCCHINEF.js} +114 -19
- package/dist/{chunk-AWNQ6ED6.js → chunk-THEGTRAG.js} +7 -2
- package/dist/{chunk-2KKODIQU.js → chunk-TR4LQE7L.js} +15 -15
- package/dist/{chunk-GPQ3NJPR.js → chunk-TWJMGXCI.js} +3 -3
- package/dist/{chunk-H72H4XDU.js → chunk-U45AXT5D.js} +9 -9
- package/dist/{chunk-62V2AFVG.js → chunk-U4FWBSO3.js} +160 -73
- package/dist/{chunk-A455ATZB.js → chunk-UBGDX6FI.js} +8 -1
- package/dist/chunk-UJILKYES.js +75 -0
- package/dist/{chunk-KSJ5UTP7.js → chunk-ULMAQV3T.js} +84 -4
- package/dist/{chunk-CB2HFKTP.js → chunk-VVBP6KGT.js} +1 -1
- package/dist/{chunk-RPOA7IAE.js → chunk-W5VITDM2.js} +43 -25
- package/dist/{chunk-QRTG4XTI.js → chunk-WAHQVNWT.js} +7 -1
- package/dist/{chunk-SQP64RCS.js → chunk-WGGYRBXH.js} +3019 -2976
- package/dist/{chunk-K3G6JBUC.js → chunk-WLYKU45P.js} +679 -141
- package/dist/chunk-WP7BVANJ.js +53 -0
- package/dist/{chunk-GAZEWQEZ.js → chunk-XF4VUMKW.js} +2 -2
- package/dist/{chunk-PAAWLLZX.js → chunk-Y5YXDM7D.js} +2 -2
- package/dist/{chunk-65RDIOR2.js → chunk-YOPAUVU4.js} +162 -44
- package/dist/{chunk-FFSX2QDQ.js → chunk-YPT4A46F.js} +3 -3
- package/dist/chunk-YWXT3JNM.js +425 -0
- package/dist/{chunk-EFEHDQGY.js → chunk-ZHZ2Y2DH.js} +64 -10
- package/dist/{chunk-CQQL4ZOQ.js → chunk-ZT7JNIGX.js} +4 -3
- package/dist/coordination/agent-monitor.d.ts +9 -1
- package/dist/coordination/agent-subagent-runner.d.ts +1 -1
- package/dist/coordination/agents/agent-prompts.d.ts +8 -0
- package/dist/coordination/agents/index.d.ts +33 -1
- package/dist/coordination/agents/index.js +52 -22
- package/dist/coordination/agents/phase3-wave1-platform.d.ts +1 -3
- package/dist/coordination/agents/phase3-wave2-meta.d.ts +1 -3
- package/dist/coordination/agents/phase8-wave3-products.d.ts +1 -3
- package/dist/coordination/agents/phase9-wave4-platform-meta.d.ts +1 -3
- package/dist/coordination/agents/project-agent-identity.d.ts +11 -11
- package/dist/coordination/agents/types.d.ts +13 -2
- package/dist/coordination/brain-monitor.d.ts +30 -7
- package/dist/coordination/collab-debug.d.ts +1 -1
- package/dist/coordination/collab-pause.d.ts +1 -1
- package/dist/coordination/delegate-tool.d.ts +7 -5
- package/dist/coordination/director-kanban-queue-helpers.d.ts +1 -0
- package/dist/coordination/director-options.d.ts +7 -0
- package/dist/coordination/director-spawn-model.d.ts +17 -0
- package/dist/coordination/director-tools.d.ts +2 -2
- package/dist/coordination/director.d.ts +12 -0
- package/dist/coordination/dispatcher.d.ts +8 -0
- package/dist/coordination/fleet-bus.d.ts +35 -4
- package/dist/coordination/fleet-supervisor.d.ts +10 -2
- package/dist/coordination/fleet.d.ts +16 -7
- package/dist/coordination/index.d.ts +4 -0
- package/dist/coordination/index.js +86 -49
- package/dist/coordination/kanban-dispatch-port.d.ts +2 -2
- package/dist/coordination/mailbox-http-router.d.ts +4 -3
- package/dist/coordination/mailbox-http-validation.d.ts +1 -1
- package/dist/coordination/mailbox-project-server.js +15 -15
- package/dist/coordination/mailbox-types.d.ts +24 -6
- package/dist/coordination/model-tier-leader.d.ts +122 -0
- package/dist/coordination/model-tier.d.ts +122 -0
- package/dist/coordination/multi-agent-coordinator.d.ts +24 -0
- package/dist/coordination/origin-session.d.ts +16 -0
- package/dist/coordination/provider-status-tracker.d.ts +37 -5
- package/dist/coordination/session-note-hub.d.ts +44 -0
- package/dist/coordination/session-note-tool.d.ts +10 -0
- package/dist/core/agent.d.ts +1 -1
- package/dist/core/context.d.ts +22 -3
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +130 -38
- package/dist/core/request-conversation-binding.d.ts +37 -0
- package/dist/core/session-notes.d.ts +25 -0
- package/dist/core/system-prompt-builder.d.ts +11 -2
- package/dist/core/system-prompt-variants.d.ts +78 -0
- package/dist/design/index.js +3 -3
- package/dist/execution/auto-compaction-middleware.d.ts +11 -0
- package/dist/execution/autonomy-brain.d.ts +2 -1
- package/dist/execution/autonomy-prompt-contributor.d.ts +7 -2
- package/dist/execution/compaction-core.d.ts +4 -4
- package/dist/execution/eternal-autonomy.d.ts +1 -1
- package/dist/execution/index.js +138 -129
- package/dist/execution/model-runtime.d.ts +0 -7
- package/dist/execution/parallel-eternal-engine.d.ts +7 -7
- package/dist/extension/index.js +3 -3
- package/dist/goal/index.js +6 -6
- package/dist/hooks/index.js +3 -3
- package/dist/hq/index.js +14 -12
- package/dist/hq/persistence/event-log.d.ts +0 -1
- package/dist/hq/persistence.d.ts +4 -4
- package/dist/hq/publisher.d.ts +2 -0
- package/dist/index.d.ts +14 -11
- package/dist/index.js +728 -635
- package/dist/infrastructure/index.d.ts +4 -4
- package/dist/infrastructure/index.js +281 -260
- package/dist/infrastructure/token-counter.d.ts +9 -0
- package/dist/kernel/events/agent-events.d.ts +77 -3
- package/dist/kernel/events/brain-events.d.ts +12 -0
- package/dist/kernel/events/provider-events.d.ts +7 -1
- package/dist/kernel/events/session-events.d.ts +14 -0
- package/dist/kernel/events/tool-events.d.ts +13 -0
- package/dist/kernel/index.js +4 -4
- package/dist/mailbox-attach.d.ts +1 -1
- package/dist/models/index.js +10 -9
- package/dist/observability/event-bridge.d.ts +25 -5
- package/dist/observability/index.d.ts +9 -8
- package/dist/observability/index.js +459 -351
- package/dist/observability/tool-usage-source.d.ts +65 -0
- package/dist/plugin/index.d.ts +5 -0
- package/dist/plugin/index.js +66 -50
- package/dist/plugins/auto-review-plugin.d.ts +3 -2
- package/dist/plugins/review-finding-commands.d.ts +0 -8
- package/dist/{review-finding-store-DKAV3AS6.js → plugins/review-finding-store.js} +7 -6
- package/dist/plugins/review-finding-types.js +19 -0
- package/dist/plugins/review-report-integration.js +21 -0
- package/dist/{review-report-store-OWY3EC3N.js → plugins/review-report-store.js} +7 -6
- package/dist/plugins/review-report-types.js +13 -0
- package/dist/prompts/index.js +5 -5
- package/dist/registry/index.js +3 -3
- package/dist/registry/tool-registry.d.ts +59 -9
- package/dist/{registry-R23UBE7H.js → registry-7N4O3E7W.js} +5 -5
- package/dist/security/capabilities.d.ts +6 -0
- package/dist/security/file-permissions.d.ts +1 -1
- package/dist/security/index.js +47 -33
- package/dist/security/permission-policy.d.ts +12 -1
- package/dist/security/secret-scrubber.d.ts +15 -0
- package/dist/session-catalog/index.d.ts +1 -0
- package/dist/session-catalog/index.js +19 -14
- package/dist/session-catalog/project-server.js +30 -13
- package/dist/session-catalog/protocol.d.ts +32 -1
- package/dist/session-catalog/registry.d.ts +17 -1
- package/dist/session-catalog/session-agents.d.ts +56 -0
- package/dist/session-catalog/store-rebuild.d.ts +14 -0
- package/dist/session-catalog/store-schema.d.ts +26 -0
- package/dist/session-catalog/store.d.ts +27 -1
- package/dist/session-note-attach.d.ts +9 -0
- package/dist/skills/index.js +5 -5
- package/dist/statusline/index.d.ts +43 -0
- package/dist/statusline/index.js +102 -0
- package/dist/storage/board-store-port.d.ts +2 -2
- package/dist/storage/config-loader/in-project-policy.d.ts +29 -0
- package/dist/storage/config-loader.d.ts +3 -2
- package/dist/storage/file-session-writer.d.ts +4 -2
- package/dist/storage/goal-coordination.d.ts +6 -1
- package/dist/storage/goal-kanban.d.ts +4 -1
- package/dist/storage/index.d.ts +12 -4
- package/dist/storage/index.js +76 -61
- package/dist/storage/input-history-store.d.ts +2 -4
- package/dist/storage/memory-curator.d.ts +133 -0
- package/dist/storage/session-agent-attribution.d.ts +39 -0
- package/dist/storage/session-doctor.d.ts +109 -0
- package/dist/storage/session-event-bridge.d.ts +5 -7
- package/dist/storage/session-outcome.d.ts +42 -0
- package/dist/storage/session-recovery.d.ts +55 -0
- package/dist/storage/session-store/load-session-data.d.ts +11 -0
- package/dist/storage/session-store/prune-helpers.d.ts +1 -1
- package/dist/storage/session-store/resume-session.d.ts +0 -2
- package/dist/storage/session-store/types.d.ts +8 -0
- package/dist/storage/session-store.d.ts +3 -3
- package/dist/storage/session-summary-tracker.d.ts +8 -1
- package/dist/storage/session-write-buffer.d.ts +18 -0
- package/dist/storage/session-writer-truncate.d.ts +2 -0
- package/dist/tasking/index.js +2 -2
- package/dist/tools/fallback-manage-tools.d.ts +6 -4
- package/dist/tools/index.js +21 -21
- package/dist/tools/model-tier-set-tool.d.ts +66 -0
- package/dist/types/agent-bridge.d.ts +2 -1
- package/dist/types/config/mcp-features.d.ts +7 -0
- package/dist/types/config/model-tiers.d.ts +148 -0
- package/dist/types/config/root.d.ts +9 -0
- package/dist/types/config/tools.d.ts +73 -0
- package/dist/types/config.d.ts +1 -0
- package/dist/types/context.d.ts +2 -0
- package/dist/types/default-config.d.ts +6 -0
- package/dist/types/errors.d.ts +2 -1
- package/dist/types/index.d.ts +11 -9
- package/dist/types/index.js +25 -15
- package/dist/types/multi-agent.d.ts +43 -0
- package/dist/types/plugin.d.ts +1 -1
- package/dist/types/provider.d.ts +15 -0
- package/dist/types/runtime-capability-manifest.d.ts +1 -1
- package/dist/types/secret-scrubber.d.ts +15 -0
- package/dist/types/session-markers.d.ts +37 -10
- package/dist/types/session-markers.js +1 -1
- package/dist/types/session-timeline.d.ts +197 -0
- package/dist/types/session-timeline.js +12 -0
- package/dist/types/session.d.ts +172 -11
- package/dist/types/system-prompt.d.ts +27 -0
- package/dist/utils/config-backup.d.ts +9 -1
- package/dist/utils/heap-watchdog.js +2 -2
- package/dist/utils/index.js +50 -48
- package/dist/utils/message-invariants.d.ts +4 -1
- package/dist/utils/regex-guard.d.ts +1 -1
- package/dist/utils/socket-path.d.ts +1 -1
- package/dist/utils/token-estimate.d.ts +6 -2
- package/dist/utils/wstack-paths.d.ts +2 -0
- package/dist/wiring/proxy-rewrite.d.ts +28 -0
- package/dist/wiring/proxy-rewrite.js +7 -1
- package/dist/worktree/index.js +2 -2
- package/instructions/agents/explore-companion.md +45 -18
- package/instructions/agents/memory-curator.md +34 -22
- package/instructions/coordination/director-preamble.md +12 -7
- package/instructions/coordination/subagent-baseline.md +26 -5
- package/instructions/leader-after-task.md +4 -1
- package/instructions/llm/chimera-review.md +30 -9
- package/instructions/llm/memory-curator.md +31 -0
- package/instructions/sections/tool/delegation-compact.md +2 -0
- package/instructions/sections/tool/delegation-full.md +5 -1
- package/instructions/sections/tool/mailbox-compact.md +5 -1
- package/instructions/sections/tool/mailbox-full.md +3 -0
- package/instructions/sections/tool/session-note-compact.md +3 -0
- package/instructions/sections/tool/session-note-full.md +15 -0
- package/instructions/system-lite.md +9 -4
- package/instructions/system-pro.md +66 -143
- package/instructions/system.md +73 -175
- package/package.json +32 -4
- package/dist/chunk-2BUUIMQB.js +0 -225
- package/dist/chunk-FAYRX2AD.js +0 -13
- package/dist/chunk-H5E77KUJ.js +0 -15
- package/dist/chunk-M7BS2K6U.js +0 -1
- package/dist/coordination/agents.d.ts +0 -8
- package/dist/coordination/transport.d.ts +0 -2
- package/dist/storage/session-writer/session-writer-summary-tracker.d.ts +0 -28
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
atomicWrite,
|
|
3
3
|
withFileLock
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-OSGLYW5J.js";
|
|
5
|
+
import {
|
|
6
|
+
expectDefined
|
|
7
|
+
} from "./chunk-PFZO3C6H.js";
|
|
5
8
|
import {
|
|
6
9
|
ERROR_CODES,
|
|
7
10
|
FsError,
|
|
8
11
|
WrongStackError
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import {
|
|
11
|
-
expectDefined
|
|
12
|
-
} from "./chunk-PFZO3C6H.js";
|
|
12
|
+
} from "./chunk-25LSLC3G.js";
|
|
13
13
|
|
|
14
14
|
// src/storage/cloud-config-sync/sanitize.ts
|
|
15
15
|
var SAGE_TREE = {
|
|
@@ -59,6 +59,7 @@ var CORE_RUNTIME_TREE = {
|
|
|
59
59
|
restrictToProjectRoot: true,
|
|
60
60
|
descriptionMode: true,
|
|
61
61
|
disabledTools: true,
|
|
62
|
+
disabledToolMeta: true,
|
|
62
63
|
maxToolTimeoutMs: true,
|
|
63
64
|
loopDetection: {
|
|
64
65
|
mode: true,
|
|
@@ -66,6 +67,13 @@ var CORE_RUNTIME_TREE = {
|
|
|
66
67
|
cutThreshold: true,
|
|
67
68
|
windowSize: true,
|
|
68
69
|
callRepeatThreshold: true
|
|
70
|
+
},
|
|
71
|
+
autoThin: {
|
|
72
|
+
enabled: true,
|
|
73
|
+
idleDays: true,
|
|
74
|
+
minInvocations: true,
|
|
75
|
+
neverAutoThin: true,
|
|
76
|
+
applyOnBoot: true
|
|
69
77
|
}
|
|
70
78
|
},
|
|
71
79
|
log: { level: true, format: true },
|
|
@@ -276,6 +284,16 @@ var INBOUND_DENIED_PATHS = [
|
|
|
276
284
|
path: "tools.disabledTools",
|
|
277
285
|
reason: "Could re-enable a tool the operator deliberately switched off."
|
|
278
286
|
},
|
|
287
|
+
{
|
|
288
|
+
namespace: "core.runtime",
|
|
289
|
+
path: "tools.disabledToolMeta",
|
|
290
|
+
reason: "Could rewrite the disabled-tool audit trail to hide operator intent."
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
namespace: "core.runtime",
|
|
294
|
+
path: "tools.autoThin",
|
|
295
|
+
reason: "Could switch on or tune the auto-thinning pipeline without operator consent, silently disabling tools on remote pulls."
|
|
296
|
+
},
|
|
279
297
|
{
|
|
280
298
|
namespace: "ui.preferences",
|
|
281
299
|
path: "autonomy.defaultMode",
|
|
@@ -423,7 +441,7 @@ function reinjectLocalSecrets(local, incoming) {
|
|
|
423
441
|
const out = { ...incoming };
|
|
424
442
|
for (const [key, value] of Object.entries(local)) {
|
|
425
443
|
const secretish = SECRET_KEY.test(key) || typeof value === "string" && ENCRYPTED_VALUE.test(value);
|
|
426
|
-
if (secretish && !(key in incoming)) {
|
|
444
|
+
if (secretish && (!(key in incoming) || incoming[key] === void 0 || incoming[key] === null)) {
|
|
427
445
|
out[key] = value;
|
|
428
446
|
continue;
|
|
429
447
|
}
|
|
@@ -812,14 +830,14 @@ var PromptUsageStore = class {
|
|
|
812
830
|
async recent(limit = 15) {
|
|
813
831
|
const usage = await this.load();
|
|
814
832
|
return Object.entries(usage).map(([slug, u]) => ({ slug, usage: u })).sort(
|
|
815
|
-
(a, b) =>
|
|
833
|
+
(a, b) => toTimestamp(b.usage.lastUsedAt) - toTimestamp(a.usage.lastUsedAt) || b.usage.count - a.usage.count
|
|
816
834
|
).slice(0, limit);
|
|
817
835
|
}
|
|
818
836
|
/** Slugs ordered by usage count (then recency), capped at `limit`. */
|
|
819
837
|
async top(limit = 15) {
|
|
820
838
|
const usage = await this.load();
|
|
821
839
|
return Object.entries(usage).map(([slug, u]) => ({ slug, usage: u })).sort(
|
|
822
|
-
(a, b) => b.usage.count - a.usage.count ||
|
|
840
|
+
(a, b) => b.usage.count - a.usage.count || toTimestamp(b.usage.lastUsedAt) - toTimestamp(a.usage.lastUsedAt)
|
|
823
841
|
).slice(0, limit);
|
|
824
842
|
}
|
|
825
843
|
scheduleDrain() {
|
|
@@ -881,6 +899,11 @@ function sameSignature(a, b) {
|
|
|
881
899
|
function cloneUsage(usage) {
|
|
882
900
|
return Object.fromEntries(Object.entries(usage).map(([slug, value]) => [slug, { ...value }]));
|
|
883
901
|
}
|
|
902
|
+
function toTimestamp(iso) {
|
|
903
|
+
if (!iso) return 0;
|
|
904
|
+
const t = new Date(iso).getTime();
|
|
905
|
+
return Number.isNaN(t) ? 0 : t;
|
|
906
|
+
}
|
|
884
907
|
|
|
885
908
|
// src/storage/cloud-sync.ts
|
|
886
909
|
import * as fs3 from "node:fs/promises";
|
|
@@ -1348,4 +1371,4 @@ export {
|
|
|
1348
1371
|
ALL_SYNC_CATEGORIES,
|
|
1349
1372
|
CloudSync
|
|
1350
1373
|
};
|
|
1351
|
-
//# sourceMappingURL=chunk-
|
|
1374
|
+
//# sourceMappingURL=chunk-GJJGJB2R.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
atomicWrite
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OSGLYW5J.js";
|
|
4
4
|
|
|
5
5
|
// src/utils/ulid.ts
|
|
6
6
|
import { randomBytes } from "node:crypto";
|
|
@@ -27,10 +27,11 @@ function encodeRandom(len) {
|
|
|
27
27
|
return str;
|
|
28
28
|
}
|
|
29
29
|
function ulid(seedTime = Date.now()) {
|
|
30
|
-
|
|
30
|
+
const safeTime = typeof seedTime === "number" && Number.isFinite(seedTime) && seedTime > 0 ? seedTime : Date.now();
|
|
31
|
+
return encodeTime(safeTime, TIME_LEN) + encodeRandom(RANDOM_LEN);
|
|
31
32
|
}
|
|
32
33
|
function isUlid(value) {
|
|
33
|
-
if (value.length !== TIME_LEN + RANDOM_LEN) return false;
|
|
34
|
+
if (typeof value !== "string" || value.length !== TIME_LEN + RANDOM_LEN) return false;
|
|
34
35
|
for (const ch of value) {
|
|
35
36
|
if (!ENCODING.includes(ch)) return false;
|
|
36
37
|
}
|
|
@@ -130,8 +131,8 @@ async function ensureProjectGitignore(projectRoot) {
|
|
|
130
131
|
}
|
|
131
132
|
}
|
|
132
133
|
if (!changed) return;
|
|
133
|
-
|
|
134
|
-
|
|
134
|
+
const eol = content.includes("\r\n") ? "\r\n" : "\n";
|
|
135
|
+
await atomicWrite(filePath, `${lines.join(eol)}${eol}`);
|
|
135
136
|
}
|
|
136
137
|
function makeIdentity(projectId) {
|
|
137
138
|
if (!isProjectId(projectId)) {
|
|
@@ -184,4 +185,4 @@ export {
|
|
|
184
185
|
rekeyProjectIdentity,
|
|
185
186
|
ensureProjectGitignore
|
|
186
187
|
};
|
|
187
|
-
//# sourceMappingURL=chunk-
|
|
188
|
+
//# sourceMappingURL=chunk-HI3JGZR2.js.map
|
|
@@ -133,29 +133,18 @@ var MODEL_FAMILY_RATIO = {
|
|
|
133
133
|
// DeepSeek: ~3.5 chars/token
|
|
134
134
|
deepseek: 3.5
|
|
135
135
|
};
|
|
136
|
-
var
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
let
|
|
141
|
-
|
|
142
|
-
|
|
136
|
+
var PAYLOAD_TOKEN_MEMO = /* @__PURE__ */ new WeakMap();
|
|
137
|
+
function memoizedPayloadTokens(payload) {
|
|
138
|
+
const cached = PAYLOAD_TOKEN_MEMO.get(payload);
|
|
139
|
+
if (cached !== void 0) return cached;
|
|
140
|
+
let str;
|
|
141
|
+
try {
|
|
142
|
+
str = JSON.stringify(payload) ?? "";
|
|
143
|
+
} catch {
|
|
144
|
+
str = String(payload);
|
|
143
145
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
function getCachedEstimate(source, compute) {
|
|
147
|
-
const key = estimateCacheKey(source);
|
|
148
|
-
const existing = ESTIMATE_CACHE.get(key);
|
|
149
|
-
if (existing !== void 0) return existing;
|
|
150
|
-
if (ESTIMATE_CACHE.size >= ESTIMATE_CACHE_MAX_SIZE) {
|
|
151
|
-
while (ESTIMATE_CACHE.size > Math.floor(ESTIMATE_CACHE_MAX_SIZE / 2)) {
|
|
152
|
-
const oldest = _estimateCacheOrder.shift();
|
|
153
|
-
if (oldest !== void 0) ESTIMATE_CACHE.delete(oldest);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
const estimate = compute(source);
|
|
157
|
-
ESTIMATE_CACHE.set(key, estimate);
|
|
158
|
-
_estimateCacheOrder.push(key);
|
|
146
|
+
const estimate = RoughTokenEstimate(str);
|
|
147
|
+
PAYLOAD_TOKEN_MEMO.set(payload, estimate);
|
|
159
148
|
return estimate;
|
|
160
149
|
}
|
|
161
150
|
function estimateToolInputTokens(input) {
|
|
@@ -163,11 +152,14 @@ function estimateToolInputTokens(input) {
|
|
|
163
152
|
if (input === null || typeof input !== "object") {
|
|
164
153
|
return RoughTokenEstimate(String(input));
|
|
165
154
|
}
|
|
166
|
-
return
|
|
155
|
+
return memoizedPayloadTokens(input);
|
|
167
156
|
}
|
|
168
157
|
function estimateToolResultTokens(content) {
|
|
169
158
|
if (typeof content === "string") return RoughTokenEstimate(content);
|
|
170
|
-
|
|
159
|
+
if (content === null || typeof content !== "object") {
|
|
160
|
+
return RoughTokenEstimate(String(content));
|
|
161
|
+
}
|
|
162
|
+
return memoizedPayloadTokens(content);
|
|
171
163
|
}
|
|
172
164
|
function estimateTextTokens(text) {
|
|
173
165
|
return RoughTokenEstimate(text);
|
|
@@ -179,7 +171,15 @@ function computeMessageTokens(msg) {
|
|
|
179
171
|
if (b.type === "text") total += estimateTextTokens(b.text);
|
|
180
172
|
else if (b.type === "tool_use") total += estimateToolInputTokens(b.input);
|
|
181
173
|
else if (b.type === "tool_result") total += estimateToolResultTokens(b.content);
|
|
182
|
-
else
|
|
174
|
+
else {
|
|
175
|
+
let str;
|
|
176
|
+
try {
|
|
177
|
+
str = JSON.stringify(b) ?? "";
|
|
178
|
+
} catch {
|
|
179
|
+
str = String(b);
|
|
180
|
+
}
|
|
181
|
+
total += RoughTokenEstimate(str);
|
|
182
|
+
}
|
|
183
183
|
}
|
|
184
184
|
return total;
|
|
185
185
|
}
|
|
@@ -392,4 +392,4 @@ export {
|
|
|
392
392
|
estimateRequestTokensUpperBound,
|
|
393
393
|
resetCalibration
|
|
394
394
|
};
|
|
395
|
-
//# sourceMappingURL=chunk-
|
|
395
|
+
//# sourceMappingURL=chunk-HMLIGAU7.js.map
|
|
@@ -1,55 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
reportEventTypeFor,
|
|
3
|
+
validateReportTransition
|
|
4
|
+
} from "./chunk-WP7BVANJ.js";
|
|
1
5
|
import {
|
|
2
6
|
SECRET_FILE_MODE
|
|
3
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-6FHWXLPT.js";
|
|
4
8
|
import {
|
|
5
9
|
atomicWrite,
|
|
6
10
|
withFileLock
|
|
7
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-OSGLYW5J.js";
|
|
8
12
|
|
|
9
13
|
// src/plugins/review-report-store.ts
|
|
10
14
|
import { randomUUID } from "node:crypto";
|
|
11
15
|
import * as fsp from "node:fs/promises";
|
|
12
16
|
import * as path from "node:path";
|
|
13
|
-
|
|
14
|
-
// src/plugins/review-report-types.ts
|
|
15
|
-
var InvalidReportTransitionError = class extends Error {
|
|
16
|
-
from;
|
|
17
|
-
to;
|
|
18
|
-
constructor(from, to, reason) {
|
|
19
|
-
const msg = reason ?? `Invalid report transition from "${from}" to "${to}"`;
|
|
20
|
-
super(msg);
|
|
21
|
-
this.name = "InvalidReportTransitionError";
|
|
22
|
-
this.from = from;
|
|
23
|
-
this.to = to;
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
var REPORT_TRANSITION_MATRIX = {
|
|
27
|
-
open: /* @__PURE__ */ new Set(["actioned", "completed", "skipped"]),
|
|
28
|
-
actioned: /* @__PURE__ */ new Set(["completed", "skipped"]),
|
|
29
|
-
completed: /* @__PURE__ */ new Set(["open"]),
|
|
30
|
-
skipped: /* @__PURE__ */ new Set(["open"])
|
|
31
|
-
};
|
|
32
|
-
function validateReportTransition(from, to) {
|
|
33
|
-
if (from === to) return;
|
|
34
|
-
const allowed = REPORT_TRANSITION_MATRIX[from];
|
|
35
|
-
if (!allowed?.has(to)) {
|
|
36
|
-
throw new InvalidReportTransitionError(from, to);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
function reportEventTypeFor(to) {
|
|
40
|
-
switch (to) {
|
|
41
|
-
case "actioned":
|
|
42
|
-
return "actioned";
|
|
43
|
-
case "completed":
|
|
44
|
-
return "completed";
|
|
45
|
-
case "skipped":
|
|
46
|
-
return "skipped";
|
|
47
|
-
default:
|
|
48
|
-
return "reopened";
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// src/plugins/review-report-store.ts
|
|
53
17
|
var REPORT_RETENTION_MS = 90 * 24 * 60 * 60 * 1e3;
|
|
54
18
|
var REPORT_DEFAULT_PAGE_SIZE = 25;
|
|
55
19
|
var NL = "\n";
|
|
@@ -336,4 +300,4 @@ export {
|
|
|
336
300
|
resolveReportStorePath,
|
|
337
301
|
JsonlReportStore
|
|
338
302
|
};
|
|
339
|
-
//# sourceMappingURL=chunk-
|
|
303
|
+
//# sourceMappingURL=chunk-HXKZ7OBQ.js.map
|
|
@@ -7,13 +7,13 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
estimateMessageTokens,
|
|
9
9
|
estimateTextTokens
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import {
|
|
12
|
-
isTextBlock
|
|
13
|
-
} from "./chunk-O37BQ65S.js";
|
|
10
|
+
} from "./chunk-HMLIGAU7.js";
|
|
14
11
|
import {
|
|
15
12
|
expectDefined
|
|
16
13
|
} from "./chunk-PFZO3C6H.js";
|
|
14
|
+
import {
|
|
15
|
+
isTextBlock
|
|
16
|
+
} from "./chunk-O37BQ65S.js";
|
|
17
17
|
|
|
18
18
|
// src/utils/compaction-preview.ts
|
|
19
19
|
var PATH_HINT_PATTERN = /(?:(?:[A-Za-z]:)?[./\\]?[\w@.-]+(?:[\\/][\w@(). -]+)+\.[A-Za-z0-9]{1,12})/g;
|
|
@@ -289,4 +289,4 @@ export {
|
|
|
289
289
|
buildCompactionPreview,
|
|
290
290
|
LLMSelector
|
|
291
291
|
};
|
|
292
|
-
//# sourceMappingURL=chunk-
|
|
292
|
+
//# sourceMappingURL=chunk-I7DALG7J.js.map
|
|
@@ -2,13 +2,13 @@ import {
|
|
|
2
2
|
isMailboxReceiptRecordV2,
|
|
3
3
|
normalizeRecipient,
|
|
4
4
|
validateSendType
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-FWNLEZYG.js";
|
|
6
6
|
import {
|
|
7
7
|
withSqliteExperimentalWarningSuppressed
|
|
8
8
|
} from "./chunk-LX5QWLBL.js";
|
|
9
9
|
import {
|
|
10
10
|
projectSlug
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-SAFHACFA.js";
|
|
12
12
|
|
|
13
13
|
// src/coordination/mailbox-constants.ts
|
|
14
14
|
var AGENT_STALE_MS = 6e4;
|
|
@@ -957,4 +957,4 @@ export {
|
|
|
957
957
|
initializeSchema,
|
|
958
958
|
migrateLegacyFiles
|
|
959
959
|
};
|
|
960
|
-
//# sourceMappingURL=chunk-
|
|
960
|
+
//# sourceMappingURL=chunk-IRUTEHCE.js.map
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SYSTEM_BLOCK_SOURCE,
|
|
3
3
|
buildLiveNextStepsGateBlock
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-M27LIEKV.js";
|
|
5
5
|
import {
|
|
6
6
|
color,
|
|
7
7
|
writeErr
|
|
8
8
|
} from "./chunk-4VWO3ZXL.js";
|
|
9
9
|
import {
|
|
10
10
|
buildCompletedWorkLedgerBlock
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-ZHZ2Y2DH.js";
|
|
12
12
|
import {
|
|
13
13
|
estimateTextTokens,
|
|
14
14
|
estimateToolDefTokens,
|
|
15
15
|
estimateToolInputTokens,
|
|
16
16
|
estimateToolResultTokens
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-HMLIGAU7.js";
|
|
18
18
|
import {
|
|
19
19
|
expectDefined
|
|
20
20
|
} from "./chunk-PFZO3C6H.js";
|
|
@@ -46,6 +46,7 @@ async function checkConnectivity(opts) {
|
|
|
46
46
|
async function probe(url, timeoutMs) {
|
|
47
47
|
const controller = new AbortController();
|
|
48
48
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
49
|
+
if (typeof timer.unref === "function") timer.unref();
|
|
49
50
|
try {
|
|
50
51
|
await fetch(url, { method: "HEAD", signal: controller.signal });
|
|
51
52
|
return true;
|
|
@@ -143,11 +144,25 @@ function getContextBreakdown(ctx) {
|
|
|
143
144
|
case "tool_result":
|
|
144
145
|
histToolResults += estimateToolResultTokens(b.content);
|
|
145
146
|
break;
|
|
146
|
-
case "thinking":
|
|
147
|
-
|
|
147
|
+
case "thinking": {
|
|
148
|
+
let str;
|
|
149
|
+
try {
|
|
150
|
+
str = JSON.stringify(b) ?? "";
|
|
151
|
+
} catch {
|
|
152
|
+
str = String(b);
|
|
153
|
+
}
|
|
154
|
+
histThinking += estimateTextTokens(str);
|
|
148
155
|
break;
|
|
149
|
-
|
|
150
|
-
|
|
156
|
+
}
|
|
157
|
+
default: {
|
|
158
|
+
let str;
|
|
159
|
+
try {
|
|
160
|
+
str = JSON.stringify(b) ?? "";
|
|
161
|
+
} catch {
|
|
162
|
+
str = String(b);
|
|
163
|
+
}
|
|
164
|
+
histOther += estimateTextTokens(str);
|
|
165
|
+
}
|
|
151
166
|
}
|
|
152
167
|
}
|
|
153
168
|
}
|
|
@@ -335,8 +350,8 @@ function backtrack(trace, a, b, N, M, finalD) {
|
|
|
335
350
|
}
|
|
336
351
|
function unifiedDiff(oldText, newText, opts = {}) {
|
|
337
352
|
const context = opts.context ?? 3;
|
|
338
|
-
const a = oldText.split("\n");
|
|
339
|
-
const b = newText.split("\n");
|
|
353
|
+
const a = oldText.replace(/\r\n/g, "\n").split("\n");
|
|
354
|
+
const b = newText.replace(/\r\n/g, "\n").split("\n");
|
|
340
355
|
if (a[a.length - 1] === "") a.pop();
|
|
341
356
|
if (b[b.length - 1] === "") b.pop();
|
|
342
357
|
const edits = myersDiff(a, b);
|
|
@@ -482,6 +497,12 @@ function globToRegex(pat) {
|
|
|
482
497
|
re += "[^/\\\\]";
|
|
483
498
|
i++;
|
|
484
499
|
} else if (c === "[") {
|
|
500
|
+
const closeIndex = pat.indexOf("]", i + 1);
|
|
501
|
+
if (closeIndex === -1) {
|
|
502
|
+
re += "\\[";
|
|
503
|
+
i++;
|
|
504
|
+
continue;
|
|
505
|
+
}
|
|
485
506
|
let cls = "[";
|
|
486
507
|
i++;
|
|
487
508
|
if (pat[i] === "!" || pat[i] === "^") {
|
|
@@ -521,10 +542,12 @@ function baseDir(pat) {
|
|
|
521
542
|
}
|
|
522
543
|
async function expandGlob(pattern) {
|
|
523
544
|
if (!isGlob(pattern)) return [pattern];
|
|
545
|
+
const normalized = pattern.replace(/\\/g, "/");
|
|
524
546
|
const results = /* @__PURE__ */ new Set();
|
|
525
547
|
const abs = isAbsolute(pattern);
|
|
526
|
-
const base =
|
|
527
|
-
const
|
|
548
|
+
const base = baseDir(pattern);
|
|
549
|
+
const baseNorm = base.replace(/\\/g, "/");
|
|
550
|
+
const relPat = base === "." ? normalized : normalized.slice(baseNorm.length + 1);
|
|
528
551
|
async function walk(dir, pat) {
|
|
529
552
|
let entries;
|
|
530
553
|
try {
|
|
@@ -680,6 +703,7 @@ function mergeCustomModelDefs(providerCustomModels, configModels) {
|
|
|
680
703
|
|
|
681
704
|
// src/utils/newline-normalize.ts
|
|
682
705
|
function detectNewlineStyle(text) {
|
|
706
|
+
if (typeof text !== "string") return "lf";
|
|
683
707
|
let lf = 0;
|
|
684
708
|
let crlf = 0;
|
|
685
709
|
let cr = 0;
|
|
@@ -701,12 +725,14 @@ function detectNewlineStyle(text) {
|
|
|
701
725
|
return "lf";
|
|
702
726
|
}
|
|
703
727
|
function toStyle(text, style) {
|
|
728
|
+
if (typeof text !== "string") return "";
|
|
704
729
|
const normalized = text.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
705
730
|
if (style === "lf") return normalized;
|
|
706
731
|
if (style === "crlf") return normalized.replace(/\n/g, "\r\n");
|
|
707
732
|
return normalized.replace(/\n/g, "\r");
|
|
708
733
|
}
|
|
709
734
|
function normalizeToLf(text) {
|
|
735
|
+
if (typeof text !== "string") return "";
|
|
710
736
|
return text.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
711
737
|
}
|
|
712
738
|
|
|
@@ -714,7 +740,7 @@ function normalizeToLf(text) {
|
|
|
714
740
|
import * as path from "node:path";
|
|
715
741
|
var MAX_PATH_SEGMENT_LENGTH = 256;
|
|
716
742
|
function isSafePathSegment(value) {
|
|
717
|
-
if (value.length === 0 || value.length > MAX_PATH_SEGMENT_LENGTH) return false;
|
|
743
|
+
if (typeof value !== "string" || value.length === 0 || value.length > MAX_PATH_SEGMENT_LENGTH) return false;
|
|
718
744
|
if (value === "." || value === "..") return false;
|
|
719
745
|
if (value.includes("/") || value.includes("\\")) return false;
|
|
720
746
|
if (value.includes("\0")) return false;
|
|
@@ -814,6 +840,7 @@ function sleep(ms) {
|
|
|
814
840
|
|
|
815
841
|
// src/utils/slug.ts
|
|
816
842
|
function slugify(name, fallback = "prompt", maxLen = 64) {
|
|
843
|
+
if (typeof name !== "string") return fallback;
|
|
817
844
|
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, maxLen).replace(/-+$/g, "") || fallback;
|
|
818
845
|
}
|
|
819
846
|
|
|
@@ -1074,4 +1101,4 @@ export {
|
|
|
1074
1101
|
getToolResultRenderMode,
|
|
1075
1102
|
applyToolResultRenderModes
|
|
1076
1103
|
};
|
|
1077
|
-
//# sourceMappingURL=chunk-
|
|
1104
|
+
//# sourceMappingURL=chunk-J2WRWR37.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ToolCapabilities
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-UBGDX6FI.js";
|
|
4
4
|
|
|
5
5
|
// src/security/readonly-permission-policy.ts
|
|
6
6
|
import * as path from "node:path";
|
|
@@ -126,4 +126,4 @@ export {
|
|
|
126
126
|
toolMutates,
|
|
127
127
|
ReadOnlyPermissionPolicy
|
|
128
128
|
};
|
|
129
|
-
//# sourceMappingURL=chunk-
|
|
129
|
+
//# sourceMappingURL=chunk-JFPJ6LLQ.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// src/storage/session-store/directory-scan.ts
|
|
2
|
+
function shouldSkipSessionDirectoryEntry(name) {
|
|
3
|
+
return name.startsWith(".") && name !== ".wrongstack" || name === "shared" || name === "subagents" || name === "attachments";
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export {
|
|
7
|
+
shouldSkipSessionDirectoryEntry
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=chunk-JMULFFLN.js.map
|
|
@@ -6,23 +6,24 @@ import {
|
|
|
6
6
|
isMailboxProjectServerMessage,
|
|
7
7
|
mailboxProjectServerEndpoint,
|
|
8
8
|
mailboxProjectServerMetadataPath
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-PQNS3U7Z.js";
|
|
10
10
|
import {
|
|
11
11
|
HQ_MAILBOX_SNAPSHOT_MIN_INTERVAL_MS,
|
|
12
12
|
resolveProjectDir,
|
|
13
13
|
resolveSendTypeSafe
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-IRUTEHCE.js";
|
|
15
15
|
import {
|
|
16
16
|
acceptMailboxMessageForSession,
|
|
17
17
|
isMailboxMessageVisibleTo,
|
|
18
|
+
mailboxIdentityBase,
|
|
18
19
|
normalizeRecipient
|
|
19
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-FWNLEZYG.js";
|
|
20
21
|
import {
|
|
21
22
|
ToolCapabilities
|
|
22
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-UBGDX6FI.js";
|
|
23
24
|
import {
|
|
24
25
|
wstackGlobalRoot
|
|
25
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-SAFHACFA.js";
|
|
26
27
|
import {
|
|
27
28
|
toErrorMessage
|
|
28
29
|
} from "./chunk-TBRL2RCC.js";
|
|
@@ -1027,7 +1028,12 @@ async function executeSend(mb, identity, sessionId, i, ctx) {
|
|
|
1027
1028
|
audience: delivery.audience,
|
|
1028
1029
|
priority: i.priority ?? "normal",
|
|
1029
1030
|
replyTo: i.replyTo,
|
|
1030
|
-
senderSessionId: sessionId
|
|
1031
|
+
senderSessionId: sessionId,
|
|
1032
|
+
// Same scoping rule as `mail_send`: with four tabs live, every one of them
|
|
1033
|
+
// has a leader on this mailbox and an unscoped "to: leader" is accepted by
|
|
1034
|
+
// all four. Only the ambiguous alias, and only from a sender that carries
|
|
1035
|
+
// an explicit owning stamp — see `scopeAgentMailToOwningSession`.
|
|
1036
|
+
...typeof ctx.meta["sessionId"] === "string" && ctx.meta["sessionId"].length > 0 && delivery.to.trim().toLowerCase() === "leader" ? { sessionAffinity: { sessionId } } : {}
|
|
1031
1037
|
});
|
|
1032
1038
|
return {
|
|
1033
1039
|
ok: true,
|
|
@@ -1163,6 +1169,83 @@ function formatMessage(m, readerId) {
|
|
|
1163
1169
|
};
|
|
1164
1170
|
}
|
|
1165
1171
|
|
|
1172
|
+
// src/coordination/session-note-hub.ts
|
|
1173
|
+
function resolveInboxSessionId(inbox) {
|
|
1174
|
+
return typeof inbox.sessionId === "function" ? inbox.sessionId() : inbox.sessionId;
|
|
1175
|
+
}
|
|
1176
|
+
function identityKeys(inbox) {
|
|
1177
|
+
const keys = /* @__PURE__ */ new Set();
|
|
1178
|
+
const add = (raw) => {
|
|
1179
|
+
if (typeof raw !== "string") return;
|
|
1180
|
+
const value = raw.trim().toLowerCase();
|
|
1181
|
+
if (!value) return;
|
|
1182
|
+
keys.add(value);
|
|
1183
|
+
keys.add(mailboxIdentityBase(value).toLowerCase());
|
|
1184
|
+
};
|
|
1185
|
+
add(inbox.agentId);
|
|
1186
|
+
for (const alias of inbox.aliases ?? []) add(alias);
|
|
1187
|
+
return keys;
|
|
1188
|
+
}
|
|
1189
|
+
var SessionNoteHub = class {
|
|
1190
|
+
inboxes = /* @__PURE__ */ new Set();
|
|
1191
|
+
buses = /* @__PURE__ */ new Map();
|
|
1192
|
+
register(inbox) {
|
|
1193
|
+
this.inboxes.add(inbox);
|
|
1194
|
+
const rawSid = resolveInboxSessionId(inbox);
|
|
1195
|
+
const sid = rawSid ? rawSid.trim().replace(/\\/g, "/") : void 0;
|
|
1196
|
+
if (sid && inbox.events && !this.buses.has(sid)) this.buses.set(sid, inbox.events);
|
|
1197
|
+
return () => {
|
|
1198
|
+
this.inboxes.delete(inbox);
|
|
1199
|
+
};
|
|
1200
|
+
}
|
|
1201
|
+
post(input) {
|
|
1202
|
+
const sessionId = input.sessionId.trim().replace(/\\/g, "/");
|
|
1203
|
+
const body = input.body.trim();
|
|
1204
|
+
if (!sessionId || !body) return { delivered: 0 };
|
|
1205
|
+
const to = input.to.trim().toLowerCase();
|
|
1206
|
+
const from = input.from.trim() || "unknown";
|
|
1207
|
+
const broadcast = to === "@session" || to === "*" || to === "all";
|
|
1208
|
+
const note = {
|
|
1209
|
+
from,
|
|
1210
|
+
kind: input.kind,
|
|
1211
|
+
body,
|
|
1212
|
+
...input.subject?.trim() ? { subject: input.subject.trim() } : {}
|
|
1213
|
+
};
|
|
1214
|
+
let delivered = 0;
|
|
1215
|
+
const fromKey = from.toLowerCase();
|
|
1216
|
+
for (const inbox of this.inboxes) {
|
|
1217
|
+
const inboxSid = resolveInboxSessionId(inbox)?.trim().replace(/\\/g, "/");
|
|
1218
|
+
if (inboxSid !== sessionId) continue;
|
|
1219
|
+
const keys = identityKeys(inbox);
|
|
1220
|
+
if (keys.has(fromKey)) continue;
|
|
1221
|
+
if (!broadcast && !keys.has(to)) continue;
|
|
1222
|
+
try {
|
|
1223
|
+
inbox.deliver(note);
|
|
1224
|
+
delivered += 1;
|
|
1225
|
+
} catch {
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
try {
|
|
1229
|
+
const bus = input.events ?? this.buses.get(sessionId);
|
|
1230
|
+
bus?.emit("session.note", {
|
|
1231
|
+
sessionId,
|
|
1232
|
+
from,
|
|
1233
|
+
to: input.to.trim(),
|
|
1234
|
+
kind: input.kind,
|
|
1235
|
+
body: note.body,
|
|
1236
|
+
subject: note.subject,
|
|
1237
|
+
ts: Date.now()
|
|
1238
|
+
});
|
|
1239
|
+
} catch {
|
|
1240
|
+
}
|
|
1241
|
+
return { delivered };
|
|
1242
|
+
}
|
|
1243
|
+
};
|
|
1244
|
+
var sessionNoteHub = new SessionNoteHub();
|
|
1245
|
+
function postSessionNote(input) {
|
|
1246
|
+
return sessionNoteHub.post(input);
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1166
1249
|
export {
|
|
1167
1250
|
isMailboxProjectServerAvailable,
|
|
1168
1251
|
MailboxProjectServerConnection,
|
|
@@ -1173,6 +1256,9 @@ export {
|
|
|
1173
1256
|
mailboxSessionTag,
|
|
1174
1257
|
resolveMailboxIdentity,
|
|
1175
1258
|
applyMailboxSendPolicy,
|
|
1176
|
-
makeMailboxTool
|
|
1259
|
+
makeMailboxTool,
|
|
1260
|
+
SessionNoteHub,
|
|
1261
|
+
sessionNoteHub,
|
|
1262
|
+
postSessionNote
|
|
1177
1263
|
};
|
|
1178
|
-
//# sourceMappingURL=chunk-
|
|
1264
|
+
//# sourceMappingURL=chunk-JO4MGB6Z.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DESIGN_STACKS,
|
|
3
|
-
isDesignStack
|
|
4
|
-
} from "./chunk-G5S3S5ZN.js";
|
|
5
1
|
import {
|
|
6
2
|
stripFrontmatter
|
|
7
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FC2ZGRF3.js";
|
|
8
4
|
import {
|
|
9
5
|
resolveWstackPaths
|
|
10
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SAFHACFA.js";
|
|
7
|
+
import {
|
|
8
|
+
DESIGN_STACKS,
|
|
9
|
+
isDesignStack
|
|
10
|
+
} from "./chunk-G5S3S5ZN.js";
|
|
11
11
|
|
|
12
12
|
// src/execution/design-kit-loader.ts
|
|
13
13
|
import { existsSync } from "node:fs";
|
|
@@ -928,4 +928,4 @@ export {
|
|
|
928
928
|
makeDesignStudioRequestMiddleware,
|
|
929
929
|
installDesignStudioMiddleware
|
|
930
930
|
};
|
|
931
|
-
//# sourceMappingURL=chunk-
|
|
931
|
+
//# sourceMappingURL=chunk-K6BXGITA.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ERROR_CODES,
|
|
3
3
|
WrongStackError
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-25LSLC3G.js";
|
|
5
5
|
|
|
6
6
|
// src/kernel/container.ts
|
|
7
7
|
var Container = class {
|
|
@@ -184,4 +184,4 @@ var Container = class {
|
|
|
184
184
|
export {
|
|
185
185
|
Container
|
|
186
186
|
};
|
|
187
|
-
//# sourceMappingURL=chunk-
|
|
187
|
+
//# sourceMappingURL=chunk-KZMSZV32.js.map
|