@code-yeongyu/senpi 2026.11.6-2 → 2026.11.9-2
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/CHANGELOG.md +64 -0
- package/dist/bundle/chunks/{bun-extension-importer-RCGPQTI2.js → bun-extension-importer-GQ6IKEXD.js} +2 -2
- package/dist/bundle/chunks/{chunk-RQ6CHXQ2.js → chunk-3TZQXZKH.js} +1 -1
- package/dist/bundle/chunks/{chunk-QN2BHP3M.js → chunk-44BJPS5I.js} +1 -1
- package/dist/bundle/chunks/{chunk-WGRKM3N6.js → chunk-45MVD7BU.js} +1 -1
- package/dist/bundle/chunks/chunk-4JIBEZZE.js +106 -0
- package/dist/bundle/chunks/{chunk-CF5OGBC4.js → chunk-4NYNMAYF.js} +1 -1
- package/dist/bundle/chunks/{chunk-X5ZVYNOL.js → chunk-4UR6UFBH.js} +1 -1
- package/dist/bundle/chunks/{chunk-LNPAT22L.js → chunk-527Q2UYM.js} +9 -8
- package/dist/bundle/chunks/{chunk-HLM46XEB.js → chunk-622VYTRI.js} +1 -1
- package/dist/bundle/chunks/{chunk-D5MRJWUK.js → chunk-7CFORZPE.js} +221 -229
- package/dist/bundle/chunks/{chunk-GKAYPJ4E.js → chunk-7PROV6BB.js} +1 -1
- package/dist/bundle/chunks/{chunk-4E7GDG4H.js → chunk-7VMEE62L.js} +1 -1
- package/dist/bundle/chunks/{chunk-C7OKUC7L.js → chunk-K3UHGDUQ.js} +1 -1
- package/dist/bundle/chunks/{chunk-7III44PV.js → chunk-LHSWAJJL.js} +1 -1
- package/dist/bundle/chunks/{chunk-47PPZKPO.js → chunk-LM6DOWQH.js} +4 -4
- package/dist/bundle/chunks/chunk-LPYBKMPT.js +2 -0
- package/dist/bundle/chunks/{chunk-2FDW2LQL.js → chunk-M7GF73FO.js} +2 -2
- package/dist/bundle/chunks/{chunk-ECW7VBMB.js → chunk-NDSWTAYJ.js} +1 -1
- package/dist/bundle/chunks/{chunk-GSKCWXXG.js → chunk-Q6NR6644.js} +1 -1
- package/dist/bundle/chunks/{chunk-TIPKAMSS.js → chunk-SGAFIMAU.js} +1 -1
- package/dist/bundle/chunks/{chunk-7PSBD5KS.js → chunk-STGOYIXC.js} +1 -1
- package/dist/bundle/chunks/{chunk-DSWDJ7HT.js → chunk-WQ4RBPMS.js} +1 -1
- package/dist/bundle/chunks/chunk-XZDCMDUH.js +2 -0
- package/dist/bundle/chunks/{chunk-GNSMNSL7.js → chunk-Y5L4UFMI.js} +2 -2
- package/dist/bundle/chunks/{cli-main-T74YJGIF.js → cli-main-XBEFQW5A.js} +1 -1
- package/dist/bundle/chunks/{dispatch-BAK2YZKD.js → dispatch-VDIYSXQN.js} +1 -1
- package/dist/bundle/chunks/{hand-entry-AYRUGE2A.js → hand-entry-QFEY3JMQ.js} +1 -1
- package/dist/bundle/chunks/{headless-host-ES74ZB6M.js → headless-host-YXUGONR3.js} +1 -1
- package/dist/bundle/chunks/{host-command-YRXZE4TV.js → host-command-VHX2ILLM.js} +1 -1
- package/dist/bundle/chunks/{host-session-command-N7IN7ZDV.js → host-session-command-P3MRW63Z.js} +1 -1
- package/dist/bundle/chunks/interactive-mode-YGL3QHU6.js +2 -0
- package/dist/bundle/chunks/main-5SD4DHMC.js +2 -0
- package/dist/bundle/chunks/{multi-session-host-XSUJDHFZ.js → multi-session-host-PGRHY3JP.js} +20 -17
- package/dist/bundle/chunks/{package-manager-cli-GLUNPQJU.js → package-manager-cli-SADLU7QX.js} +1 -1
- package/dist/bundle/chunks/{role-RRFFHZF5.js → role-4BUU46VW.js} +3 -3
- package/dist/bundle/chunks/{rotation-stream-BN2YK2MC.js → rotation-stream-TODBIHXJ.js} +1 -1
- package/dist/bundle/chunks/rpc-mode-27TC7W6K.js +2 -0
- package/dist/bundle/chunks/{run-attached-tui-W236SEOR.js → run-attached-tui-MXCC5IZR.js} +1 -1
- package/dist/bundle/chunks/{runtime-session-OBXYK4PI.js → runtime-session-VO3X4OE3.js} +1 -1
- package/dist/bundle/chunks/{schedule-command-B2EJTBOE.js → schedule-command-MX56D6UE.js} +1 -1
- package/dist/bundle/chunks/{session-control-endpoint-YIMLHGLG.js → session-control-endpoint-IL6ERD4U.js} +1 -1
- package/dist/bundle/chunks/{session-picker-E6ZONUJB.js → session-picker-6VRC25MJ.js} +1 -1
- package/dist/bundle/chunks/session-worker.js +114 -110
- package/dist/bundle/cli.js +2 -2
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/bundle/runtime-manifest.json +1 -1
- package/dist/core/agent-session-runtime.d.ts +2 -0
- package/dist/core/agent-session-runtime.js +9 -2
- package/dist/core/agent-session-services.d.ts +2 -0
- package/dist/core/agent-session-services.js +1 -0
- package/dist/core/agent-session.d.ts +32 -3
- package/dist/core/agent-session.js +142 -29
- package/dist/core/credential-pool/rotation-slots.d.ts +3 -3
- package/dist/core/credential-pool/state-store.d.ts +1 -1
- package/dist/core/egress/classify.d.ts +8 -3
- package/dist/core/egress/classify.js +177 -158
- package/dist/core/egress/console-redactor.d.ts +7 -0
- package/dist/core/egress/console-redactor.js +74 -0
- package/dist/core/egress/credentials.d.ts +73 -0
- package/dist/core/egress/credentials.js +20 -0
- package/dist/core/egress/device-custody.d.ts +1 -1
- package/dist/core/egress/device-custody.js +18 -15
- package/dist/core/egress/device-proxy-call.d.ts +59 -0
- package/dist/core/egress/device-proxy-call.js +148 -0
- package/dist/core/egress/device-proxy-lost-calls.d.ts +27 -0
- package/dist/core/egress/device-proxy-lost-calls.js +28 -0
- package/dist/core/egress/device-proxy-ports.d.ts +49 -0
- package/dist/core/egress/device-proxy-ports.js +2 -0
- package/dist/core/egress/device-proxy-request.d.ts +34 -0
- package/dist/core/egress/device-proxy-request.js +69 -0
- package/dist/core/egress/device-proxy-waits.d.ts +40 -0
- package/dist/core/egress/device-proxy-waits.js +67 -0
- package/dist/core/egress/device-proxy.d.ts +3 -0
- package/dist/core/egress/device-proxy.js +214 -0
- package/dist/core/egress/endpoint.js +2 -1
- package/dist/core/egress/entry-verify.d.ts +13 -0
- package/dist/core/egress/entry-verify.js +33 -0
- package/dist/core/egress/hpke.d.ts +63 -0
- package/dist/core/egress/hpke.js +192 -0
- package/dist/core/egress/key-policy-template.d.ts +7 -1
- package/dist/core/egress/ledger-schema.d.ts +80 -0
- package/dist/core/egress/ledger-schema.js +117 -0
- package/dist/core/egress/ledger.d.ts +55 -0
- package/dist/core/egress/ledger.js +159 -0
- package/dist/core/egress/pinned-infra.d.ts +23 -2
- package/dist/core/egress/pinned-infra.js +9 -2
- package/dist/core/egress/placement-claim.d.ts +69 -0
- package/dist/core/egress/placement-claim.js +115 -0
- package/dist/core/egress/pool-state.d.ts +18 -0
- package/dist/core/egress/pool-state.js +5 -0
- package/dist/core/egress/redact.d.ts +10 -0
- package/dist/core/egress/redact.js +134 -0
- package/dist/core/egress/sealed-format.d.ts +101 -0
- package/dist/core/egress/sealed-format.js +174 -0
- package/dist/core/egress/sealed-source.d.ts +35 -0
- package/dist/core/egress/sealed-source.js +140 -0
- package/dist/core/egress/verified-keys.js +1 -1
- package/dist/core/egress/wire.d.ts +228 -0
- package/dist/core/egress/wire.js +49 -0
- package/dist/core/extensions/builtin/ask-user/escape-residue.d.ts +50 -0
- package/dist/core/extensions/builtin/ask-user/escape-residue.js +113 -0
- package/dist/core/extensions/builtin/ask-user/extension.js +7 -1
- package/dist/core/extensions/builtin/ask-user/resume.js +2 -1
- package/dist/core/extensions/builtin/ask-user/tool.d.ts +3 -0
- package/dist/core/extensions/builtin/ask-user/tool.js +8 -0
- package/dist/core/extensions/builtin/goal/index.js +46 -0
- package/dist/core/extensions/builtin/goal/stop-pause.d.ts +1 -0
- package/dist/core/extensions/builtin/goal/stop-pause.js +4 -2
- package/dist/core/extensions/builtin/monitor-state-event.d.ts +26 -0
- package/dist/core/extensions/builtin/monitor-state-event.js +2 -0
- package/dist/core/extensions/builtin/permission-system/index.js +10 -4
- package/dist/core/extensions/builtin/permission-system/preset-registry.d.ts +2 -0
- package/dist/core/extensions/builtin/permission-system/preset-registry.js +11 -0
- package/dist/core/extensions/builtin/permission-system/settings.d.ts +2 -0
- package/dist/core/extensions/builtin/permission-system/settings.js +10 -1
- package/dist/core/extensions/builtin/terminal/background-age.d.ts +25 -0
- package/dist/core/extensions/builtin/terminal/background-age.js +91 -0
- package/dist/core/extensions/builtin/terminal/extension-state.d.ts +1 -1
- package/dist/core/extensions/builtin/terminal/extension-state.js +21 -3
- package/dist/core/extensions/builtin/terminal/notify.d.ts +6 -0
- package/dist/core/extensions/builtin/terminal/notify.js +39 -5
- package/dist/core/extensions/builtin/terminal/session-bundle.d.ts +9 -2
- package/dist/core/extensions/builtin/terminal/session-bundle.js +36 -1
- package/dist/core/extensions/builtin/terminal/settings.d.ts +2 -0
- package/dist/core/extensions/builtin/terminal/settings.js +8 -0
- package/dist/core/extensions/builtin/terminal/tools/background-auto-reap.d.ts +15 -0
- package/dist/core/extensions/builtin/terminal/tools/background-auto-reap.js +87 -0
- package/dist/core/extensions/builtin/terminal/tools/bash.d.ts +3 -1
- package/dist/core/extensions/builtin/terminal/tools/bash.js +44 -15
- package/dist/core/extensions/builtin/terminal/tools/child-placement.d.ts +8 -0
- package/dist/core/extensions/builtin/terminal/tools/child-placement.js +43 -6
- package/dist/core/extensions/builtin/terminal/tools/context.d.ts +14 -2
- package/dist/core/extensions/bun-extension-importer.js +4 -3
- package/dist/core/extensions/bun-extension-load-turns.d.ts +4 -0
- package/dist/core/extensions/bun-extension-load-turns.js +45 -0
- package/dist/core/extensions/bun-extension-registry.d.ts +1 -0
- package/dist/core/extensions/bun-extension-registry.js +19 -1
- package/dist/core/extensions/loader.js +5 -0
- package/dist/core/extensions/session-control-types.d.ts +15 -0
- package/dist/core/extensions/session-control-types.js +11 -0
- package/dist/core/extensions/session-dialog-api.d.ts +5 -0
- package/dist/core/extensions/session-dialog-api.js +13 -0
- package/dist/core/extensions/types.d.ts +14 -1
- package/dist/core/external-admission.d.ts +16 -2
- package/dist/core/external-admission.js +22 -4
- package/dist/core/permission-decision.d.ts +22 -0
- package/dist/core/permission-decision.js +53 -0
- package/dist/core/permission-mode.d.ts +56 -0
- package/dist/core/permission-mode.js +133 -0
- package/dist/core/retry-fallback/controller-types.d.ts +6 -0
- package/dist/core/retry-fallback/controller.d.ts +9 -0
- package/dist/core/retry-fallback/controller.js +34 -3
- package/dist/core/retry-fallback/unusable.d.ts +25 -1
- package/dist/core/retry-fallback/unusable.js +87 -2
- package/dist/core/retry-fallback/usage-limit.d.ts +6 -1
- package/dist/core/retry-fallback/usage-limit.js +12 -4
- package/dist/core/sdk.d.ts +6 -1
- package/dist/core/sdk.js +3 -0
- package/dist/core/session-log.js +1 -1
- package/dist/core/stall-warning.d.ts +41 -0
- package/dist/core/stall-warning.js +72 -0
- package/dist/core/terminal-settings.d.ts +1 -0
- package/dist/core/turn-origin.d.ts +31 -0
- package/dist/core/turn-origin.js +64 -0
- package/dist/modes/interactive/components/remote-delivery-message.d.ts +2 -1
- package/dist/modes/interactive/components/remote-delivery-message.js +13 -5
- package/dist/modes/rpc/admit-external-message-command.d.ts +37 -0
- package/dist/modes/rpc/admit-external-message-command.js +61 -0
- package/dist/modes/rpc/admit-external-message-wire.d.ts +42 -0
- package/dist/modes/rpc/admit-external-message-wire.js +55 -0
- package/dist/modes/rpc/client-input-handler.d.ts +2 -0
- package/dist/modes/rpc/client-input-handler.js +2 -0
- package/dist/modes/rpc/connection-handler.js +30 -5
- package/dist/modes/rpc/connection-roles.d.ts +6 -0
- package/dist/modes/rpc/connection-roles.js +13 -0
- package/dist/modes/rpc/delegated-drive-origin.d.ts +9 -0
- package/dist/modes/rpc/delegated-drive-origin.js +16 -0
- package/dist/modes/rpc/effect-commands.d.ts +7 -1
- package/dist/modes/rpc/host-bare-endpoint-registration.d.ts +7 -0
- package/dist/modes/rpc/host-bare-endpoint-registration.js +35 -0
- package/dist/modes/rpc/host-capabilities.d.ts +2 -0
- package/dist/modes/rpc/host-capabilities.js +3 -0
- package/dist/modes/rpc/host-handover-parked.d.ts +11 -0
- package/dist/modes/rpc/host-handover-parked.js +17 -0
- package/dist/modes/rpc/host-handover-reopen.js +18 -6
- package/dist/modes/rpc/host-handover-resident-writer.d.ts +16 -0
- package/dist/modes/rpc/host-handover-resident-writer.js +57 -0
- package/dist/modes/rpc/host-idle-handover.js +1 -0
- package/dist/modes/rpc/host-warm.d.ts +16 -1
- package/dist/modes/rpc/host-warm.js +33 -6
- package/dist/modes/rpc/method-classes-schema-delivery.d.ts +32 -0
- package/dist/modes/rpc/method-classes-schema-delivery.js +22 -0
- package/dist/modes/rpc/method-classes-schema-session.d.ts +36 -0
- package/dist/modes/rpc/method-classes-schema-session.js +3 -0
- package/dist/modes/rpc/method-classes-schema.d.ts +36 -0
- package/dist/modes/rpc/method-classes.d.ts +2 -0
- package/dist/modes/rpc/method-classes.js +4 -0
- package/dist/modes/rpc/multi-session-host.js +6 -1
- package/dist/modes/rpc/permission-preset-command.d.ts +6 -0
- package/dist/modes/rpc/permission-preset-command.js +27 -0
- package/dist/modes/rpc/rpc-input-validation.js +4 -3
- package/dist/modes/rpc/rpc-mutation-response-types.d.ts +7 -0
- package/dist/modes/rpc/rpc-response-types.d.ts +2 -1
- package/dist/modes/rpc/rpc-session-command-types.d.ts +6 -1
- package/dist/modes/rpc/rpc-session-event-types.d.ts +5 -2
- package/dist/modes/rpc/rpc-session-state-types.d.ts +2 -1
- package/dist/modes/rpc/rpc-session-state.js +2 -0
- package/dist/modes/rpc/session-attachment-commands.js +3 -3
- package/dist/modes/rpc/session-event-writer-connections.js +1 -0
- package/dist/modes/rpc/session-event-writer.d.ts +1 -1
- package/dist/modes/rpc/session-registry-attach.d.ts +0 -9
- package/dist/modes/rpc/session-registry-attach.js +16 -3
- package/dist/modes/rpc/session-registry-types.d.ts +2 -0
- package/dist/modes/rpc/session-registry.d.ts +2 -0
- package/dist/modes/rpc/session-registry.js +16 -3
- package/dist/modes/rpc/session-router-close.js +43 -6
- package/dist/modes/rpc/session-router-context.js +2 -0
- package/dist/modes/rpc/session-router-occupancy.js +2 -11
- package/dist/modes/rpc/session-router-open-profile.js +4 -0
- package/dist/modes/rpc/session-router-open.d.ts +1 -1
- package/dist/modes/rpc/session-router-open.js +6 -17
- package/dist/modes/rpc/session-router-residency.d.ts +24 -0
- package/dist/modes/rpc/session-router-residency.js +90 -0
- package/dist/modes/rpc/session-router-routing.js +7 -1
- package/dist/modes/rpc/session-status.js +4 -1
- package/dist/modes/rpc/session-worker.js +4 -0
- package/dist/modes/rpc/tool-child/terminal-jobs.d.ts +1 -0
- package/dist/modes/rpc/tool-child/terminal-jobs.js +17 -1
- package/dist/modes/rpc/worker-session-registry.js +5 -2
- package/docs/engine-socket/fixtures/admission-routes/h-legacy.json +1 -1
- package/docs/engine-socket/fixtures/rpc-inbound-samples.json +29 -2
- package/docs/extensions.md +12 -0
- package/docs/rpc.md +129 -12
- package/docs/terminal-tools.md +25 -1
- package/native/socket-secret/prebuilds/win32-arm64/senpi_socket_secret.win32-arm64.node +0 -0
- package/native/socket-secret/prebuilds/win32-x64/senpi_socket_secret.win32-x64.node +0 -0
- package/package.json +6 -6
- package/dist/bundle/chunks/chunk-C7HEEBFH.js +0 -2
- package/dist/bundle/chunks/chunk-XCMII2VQ.js +0 -98
- package/dist/bundle/chunks/interactive-mode-B5SQDLH7.js +0 -2
- package/dist/bundle/chunks/main-UQFVFCNY.js +0 -2
- package/dist/bundle/chunks/rpc-mode-JYN3E7P7.js +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,69 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2026.11.9-2] - 2026-11-09
|
|
4
|
+
|
|
5
|
+
### Breaking Changes
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
### Removed
|
|
14
|
+
|
|
15
|
+
## [2026.11.9] - 2026-11-09
|
|
16
|
+
|
|
17
|
+
### Breaking Changes
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- A background terminal session that is still running is reported at 10 minutes and then every 30 minutes, naming its `bash_id`, its command and the `kill_bash` call that stops it. The report reaches the agent like a completion notice, shows in the TUI, and goes to RPC clients as the typed `terminal_background_age` event. Nothing is killed by default; the new `terminal.backgroundAutoReapMinutes` setting or the `bash` parameter `auto_reap_minutes` opts into stopping a background session at that age (TERM, then KILL to its process group, as `kill_bash` does), which its completion notice and a `reaped` event report; a stop that does not end the session is reported once as failed with the reason and is not retried ([#6212](https://github.com/code-yeongyu/senpi/pull/6212))
|
|
22
|
+
- Sealed credential source for hosted model-key custody (internal, no caller yet): per-instance leases with bounded reloads, entry-signature verification, secret redaction and a tenant-scoped console redactor, plus a `no-module-state` lint that keeps tenant state out of module scope in `src/core/egress` ([#6225](https://github.com/code-yeongyu/senpi/pull/6225))
|
|
23
|
+
- Device-proxy egress and the egress_call ledger for hosted model-key custody; not wired to any command yet ([#6234](https://github.com/code-yeongyu/senpi/pull/6234))
|
|
24
|
+
- `CreateAgentSessionOptions.commitStep`: forwarded to the session's `Agent` when set ([#6239](https://github.com/code-yeongyu/senpi/pull/6239))
|
|
25
|
+
- RPC `admit_external_message`: admits a relayed peer-agent message as the engine's own delivery entry, with the remote device stamped by the engine, never as user input ([#6240](https://github.com/code-yeongyu/senpi/pull/6240))
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
- A message another session sends from a different device now reads to the receiving agent exactly like one from a session on the same machine; the device is kept in the delivery's metadata only ([#6251](https://github.com/code-yeongyu/senpi/pull/6251))
|
|
30
|
+
|
|
31
|
+
### Fixed
|
|
32
|
+
|
|
33
|
+
- When one account in a provider's credential pool runs out of credits, the session no longer refuses every later turn for that provider while another account can still serve; when every account is out, the refusal names each one and why ([#5598](https://github.com/code-yeongyu/senpi/pull/5598))
|
|
34
|
+
|
|
35
|
+
### Removed
|
|
36
|
+
|
|
37
|
+
## [2026.11.6-3] - 2026-11-08
|
|
38
|
+
|
|
39
|
+
### Breaking Changes
|
|
40
|
+
|
|
41
|
+
### Added
|
|
42
|
+
|
|
43
|
+
- Sealed custody formats for hosted model-key custody (internal, no caller yet): HPKE P-256 key wraps and AES-256-GCM provider fields and config objects, each bound to an AAD the opener rebuilds and never stores ([#5886](https://github.com/code-yeongyu/senpi/pull/5886))
|
|
44
|
+
- A tool call stalled before it runs now leaves a trace: when its wait on the session's event queue or its `tool_call` hooks (the permission decision) outlives 30 s, or a bash spawn outlives 30 s (or the call's own shorter `timeout`), one warning naming the call goes to the session log, and the queue warning also names the entry the call waits behind. Nothing is aborted or delayed ([#6189](https://github.com/code-yeongyu/senpi/issues/6189))
|
|
45
|
+
- `set_permission_preset` RPC record (classic and multi-session, `set_permission_preset_v1`) and the permission-mode fields on `get_state` and the `open_session` reply; a client-named preset is recorded in the session file ([#6204](https://github.com/code-yeongyu/senpi/pull/6204))
|
|
46
|
+
- `pi.sessionDialog`, the `audience: "session"` dialog option and the `permission_preset_changed` event ([#6204](https://github.com/code-yeongyu/senpi/pull/6204))
|
|
47
|
+
- Brain-to-hand wire messages and the signed placement-claim verifier for hosted model-key custody; not wired to any command yet ([#6220](https://github.com/code-yeongyu/senpi/pull/6220))
|
|
48
|
+
|
|
49
|
+
### Changed
|
|
50
|
+
|
|
51
|
+
- Work a remote device starts now asks for approval on a session with no client-named mode, and child sessions follow their live parent's mode; a local turn keeps the host default ([#6206](https://github.com/code-yeongyu/senpi/pull/6206))
|
|
52
|
+
|
|
53
|
+
### Fixed
|
|
54
|
+
|
|
55
|
+
- A weekly usage limit that names no model family no longer marks every model on the provider spent: one request on another model family decides, and the refusal names both families when both are limited ([#5613](https://github.com/code-yeongyu/senpi/pull/5613))
|
|
56
|
+
- A goal paused by a Stop while the agent is idle now shows `Goal paused` and stops counting elapsed time; paused time no longer counts toward the goal ([#6173](https://github.com/code-yeongyu/senpi/pull/6173))
|
|
57
|
+
- An RPC socket host restores its `retain_on_disconnect` sessions after it restarts, whether it was killed or stopped cleanly and whether the session was idle or mid-turn: the next host on the same socket and agent dir lists them again with their durable id and transcript, so viewers re-attach instead of getting `session_not_found` (senpi#6190)
|
|
58
|
+
- A clean host stop parks a retained session (`session_parked { reason: "host_shutdown" }`) instead of closing it, and a turn the stop cuts short ends with `abortSource: "system"` and `abortCause: { kind: "host_shutdown" }` instead of a user abort (senpi#6190)
|
|
59
|
+
- A socket host started without `host ensure` (`--mode rpc --listen`, `--headless`) writes its `endpoint.json` registry record before it serves, so after `host gc` collected its dead endpoint during an outage the restarted host is listed again, instead of serving while relay discovery and `host status --all` find nothing ([#6195](https://github.com/code-yeongyu/senpi/pull/6195), part of #6190)
|
|
60
|
+
- `ask_user_question` / `request_user_input` refuse question text holding undecoded `\uXXXX` escapes once and ask the model to re-call with raw UTF-8 text; the re-call in a later turn opens as written with a warning, and parallel calls in one message are each refused once ([#6198](https://github.com/code-yeongyu/senpi/pull/6198))
|
|
61
|
+
- A multi-session host launched with a private-fd table answers a client's RPC auth handshake while its boot extension load runs, instead of timing out the first client (`RPC authentication timed out`) until the whole extension graph had compiled; an `open_session` that arrives during that load (or a warm of its working directory) now builds its runtime after it, waiting at most the close grace window ([#6200](https://github.com/code-yeongyu/senpi/pull/6200), fixes #6199)
|
|
62
|
+
- The terminal pipe fallback (used when the native PTY binding is unavailable) settles a session when its process exits, after a short drain of the output already written, instead of waiting for every process holding stdout or stderr to close. A command that left a process running (`cmd &`, a daemon, or the children of a shell killed from outside) no longer keeps its background terminal session, and the agent's `waiting_background` wait, open for that process's whole life. Settling does not kill those processes and does not put them out of reach: `kill_bash`, `TerminalSession.kill()`/`terminate()`, registry teardown and the registry's removal of exited sessions (capacity pruning, `sweepExited({ remove: true })`) still send TERM, then KILL after the grace, to the session's process group while it has members. The session forgets that group within about a second of it emptying, so an id the system later reuses is never signalled. The native PTY already settled when the shell exited ([#6203](https://github.com/code-yeongyu/senpi/pull/6203), part of #6201)
|
|
63
|
+
- An extension import (a tool child's module job included) no longer fails with "Extension generation N has been disposed" when its importer is garbage-collected between two module loads; the import keeps its graph alive until it settles ([#6210](https://github.com/code-yeongyu/senpi/pull/6210), fixes #6208)
|
|
64
|
+
|
|
65
|
+
### Removed
|
|
66
|
+
|
|
3
67
|
## [2026.11.6-2] - 2026-11-07
|
|
4
68
|
|
|
5
69
|
### Breaking Changes
|
package/dist/bundle/chunks/{bun-extension-importer-RCGPQTI2.js → bun-extension-importer-GQ6IKEXD.js}
RENAMED
|
@@ -7,7 +7,7 @@ import{external_exports}from"./chunk-KUPQO7MC.js";import"./chunk-IKOFCODM.js";im
|
|
|
7
7
|
`):f2,s2=b2}}function u(e,i2){if(a.rts(),!a.rt())return;let r2="",s2=e+1,f2=e+1,c2=a.te();for(;f2<i2;){let e2=t.charCodeAt(f2);if(e2===96)break;e2!==92?e2!==42?e2===36&&t.charCodeAt(f2+1)===123&&f2+2<=c2?(r2+=t.slice(s2,f2)+"*",f2=s2=c2,c2=a.rt()?a.te():-1):f2++:(r2+=t.slice(s2,f2)+"\\*",s2=++f2):f2+=2}return r2+t.slice(s2,f2)}function o(e,a2){(a2<1||e+a2>t.length)&&(k=e,h());let i2=0,r2=e+a2;for(let a3=e;a3<r2;a3++){let e2=t.charCodeAt(a3),r3=32|e2,s2=e2>=48&&e2<=57?e2-48:r3>=97&&r3<=102?r3-87:-1;s2===-1&&(k=a3,h()),i2=16*i2+s2}return i2}function h(){throw Object.assign(Error(`Parse error ${b}:${t.slice(0,k).split(`
|
|
8
8
|
`).length}:${k-t.lastIndexOf(`
|
|
9
9
|
`,k-1)}`),{idx:k})}import{readFileSync}from"node:fs";import{basename,dirname,extname,join,parse as parsePath}from"node:path";var commonJsByPath=new Map;function isCommonJsFile(path){let cached=commonJsByPath.get(path);if(cached!==void 0)return cached;let result=detect(path);return commonJsByPath.set(path,result),result}function isEsmByPackageType(path){let directory=dirname(path),{root}=parsePath(directory);for(;;){if(basename(directory)==="node_modules")return!1;let manifestPath=join(directory,"package.json"),manifest;try{manifest=readFileSync(manifestPath,"utf8")}catch(error){let code=error.code;if(code!=="ENOENT"&&code!=="ENOTDIR")throw error}if(manifest!==void 0)return JSON.parse(manifest).type==="module";if(directory===root)return!1;let parent=dirname(directory);if(parent===directory)return!1;directory=parent}}function detect(path){let extension=extname(path);if(extension===".cjs")return!0;if(extension===".mjs"||extension===".ts"||extension===".tsx"||extension===".mts"||extension===".js"&&isEsmByPackageType(path))return!1;try{let[,,,hasModuleSyntax]=parse(readFileSync(path,"utf8"),path);return!hasModuleSyntax}catch{return!1}}function parseImportClause(clause){let rest=clause.trim();if(rest==="")return;let defaultBinding,namespaceBinding,named=[],braceStart=rest.indexOf("{"),head=(braceStart>=0?rest.slice(0,braceStart):rest).trim().replace(/,$/,"").trim();if(head!==""){let namespace=/^\*\s+as\s+([A-Za-z_$][\w$]*)$/.exec(head);if(namespace?.[1]!==void 0)namespaceBinding=namespace[1];else if(/^[A-Za-z_$][\w$]*$/.test(head))defaultBinding=head;else return}if(braceStart>=0){let braceEnd=rest.lastIndexOf("}");if(braceEnd<braceStart)return;rest=rest.slice(braceStart+1,braceEnd);for(let raw of rest.split(",")){let entry=raw.trim();if(entry==="")continue;let aliased=/^(?:(["'])(.+?)\1|([A-Za-z_$][\w$]*))\s+as\s+([A-Za-z_$][\w$]*)$/.exec(entry);if(aliased){named.push({imported:aliased[2]??aliased[3]??"",local:aliased[4]??""});continue}if(/^[A-Za-z_$][\w$]*$/.test(entry)){named.push({imported:entry,local:entry});continue}return}}return{defaultBinding,namespaceBinding,named}}function rewriteCommonJsImport(clause,resolvedId,alias,attributes=""){let parsed=parseImportClause(clause);if(parsed===void 0)return`import ${JSON.stringify(resolvedId)}${attributes};`;let lines=[`import ${alias} from ${JSON.stringify(resolvedId)}${attributes};`];if(parsed.defaultBinding!==void 0&&lines.push(`const ${parsed.defaultBinding} = ${alias};`),parsed.namespaceBinding!==void 0&&lines.push(`const ${parsed.namespaceBinding} = ${alias};`),parsed.named.length>0){let pattern=parsed.named.map(({imported,local})=>{let key=/^[A-Za-z_$][\w$]*$/.test(imported)?imported:JSON.stringify(imported);return key===local?key:`${key}: ${local}`}).join(", ");lines.push(`const { ${pattern} } = ${alias};`)}return lines.join(" ")}var diagnosticSchema=external_exports.object({message:external_exports.string(),position:external_exports.object({line:external_exports.number(),column:external_exports.number()}).nullish()}),ExtensionSourceError=class extends Error{constructor(filename,cause){let diagnostics=external_exports.array(diagnosticSchema).parse(cause.errors).map(({message,position})=>({message,...position?{line:position.line,column:position.column}:{}}));super(diagnostics.map(item=>`${filename}${item.line===void 0?"":`:${item.line}:${item.column}`}: ${item.message}`).join(`
|
|
10
|
-
`),{cause}),this.name="ExtensionSourceError",this.filename=filename,this.diagnostics=diagnostics}};import{createHash}from"node:crypto";import{mkdirSync,readdirSync,readFileSync as readFileSync2,renameSync,rmSync,statSync,writeFileSync}from"node:fs";import{join as join2}from"node:path";var MAX_ENTRY_AGE_MS=720*60*60*1e3,sha256=text=>createHash("sha256").update(text).digest("hex");function isPreparedSource(value){if(typeof value!="object"||value===null)return!1;let field=name=>typeof Reflect.get(value,name);return field("key")==="string"&&field("fingerprint")==="string"&&field("token")==="string"&&field("contents")==="string"&&field("commonJs")==="boolean"&&field("esmByType")==="boolean"&&Array.isArray(Reflect.get(value,"edges"))}function prune(directory){let cutoff=Date.now()-MAX_ENTRY_AGE_MS;for(let name of readdirSync(directory)){let path=join2(directory,name);statSync(path).mtimeMs<cutoff&&rmSync(path,{force:!0})}}function createPreparedSourceCache(directory,keyParts){let key=sha256(keyParts.join("\0")),entryPath=filename=>join2(directory,`${sha256(filename).slice(0,40)}.json`),pruned=!1;return{read(filename,fingerprint){let parsed;try{parsed=JSON.parse(readFileSync2(entryPath(filename),"utf8"))}catch{return}if(!(!isPreparedSource(parsed)||parsed.key!==key||parsed.fingerprint!==fingerprint))return parsed},write(filename,fingerprint,prepared){let target=entryPath(filename),temporary=`${target}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;try{mkdirSync(directory,{recursive:!0}),writeFileSync(temporary,JSON.stringify({...prepared,key,fingerprint})),renameSync(temporary,target),pruned||(pruned=!0,prune(directory))}catch{rmSync(temporary,{force:!0})}}}}import{existsSync}from"node:fs";import{dirname as dirname2,isAbsolute}from"node:path";import{fileURLToPath,pathToFileURL}from"node:url";var RUNTIME_METADATA=Symbol.for("senpi.extension.runtime.metadata");function publishRuntimeMetadata(value){globalThis[RUNTIME_METADATA]=value}var importModule=new Function("specifier","options","return import(specifier, options)"),extensionNamespace="senpi-extension",RUNTIME_SPECIFIER="runtime",runtimeModulePath=resolveRuntimeModulePath();function resolveRuntimeModulePath(){try{let candidate=fileURLToPath(new URL("./extension-runtime-module.js",import.meta.url));return existsSync(candidate)?candidate:void 0}catch{return}}function splitModuleId(id){let slash=id.indexOf("/");if(!(slash<=0||slash===id.length-1))return{generation:id.slice(0,slash),filename:decodeURIComponent(id.slice(slash+1))}}var graphs=new Map,collected=new FinalizationRegistry(generation=>graphs.delete(generation)),nextGeneration=0,installed=!1,pluginRegistrations=0,registeredHosts=new Set,ExtensionModuleIdError=class extends Error{constructor(id){super(`Extension module id is not "<generation>/<encoded filename>": ${id}`),this.name="ExtensionModuleIdError"}},ExtensionGenerationDisposedError=class extends Error{constructor(generation){super(`Extension generation ${generation} has been disposed`),this.name="ExtensionGenerationDisposedError",this.generation=generation}};function graphFor(generation){let graph=graphs.get(generation)?.deref();if(!graph)throw new ExtensionGenerationDisposedError(generation);return graph}function metadata(generation,filename){let resolvePath=specifier=>{let id=graphFor(generation).resolve(specifier,filename);return id.startsWith(`${extensionNamespace}:`)?decodeURIComponent(id.slice(id.indexOf("/")+1)):isAbsolute(id)?id:void 0},require2=Object.assign(specifier=>graphFor(generation).require(specifier,filename),{resolve:specifier=>resolvePath(specifier)??graphFor(generation).resolve(specifier,filename)});return{url:pathToFileURL(filename).href,path:filename,dir:dirname2(filename),filename,dirname:dirname2(filename),require:require2,commonJs:body=>graphFor(generation).evaluateCommonJs(filename,body),import:async(specifier,options)=>importModule(graphFor(generation).resolve(specifier,filename),options),resolve:specifier=>{let path=resolvePath(specifier);return path===void 0?graphFor(generation).resolve(specifier,filename):pathToFileURL(path).href}}}function installRegistry(virtualModules){let hosts=Object.entries(virtualModules).filter(([name])=>!registeredHosts.has(name));(!installed||hosts.length>0)&&(pluginRegistrations++,Bun.plugin({name:extensionNamespace,setup(builder){for(let[name,exports]of hosts)builder.module(name,()=>({exports,loader:"object"})),registeredHosts.add(name);installed||(publishRuntimeMetadata(metadata),builder.module(`${extensionNamespace}:${RUNTIME_SPECIFIER}`,()=>({exports:{metadata},loader:"object"})),builder.onResolve({filter:/.*/,namespace:extensionNamespace},({path})=>{if(path===RUNTIME_SPECIFIER)return runtimeModulePath===void 0?{path,namespace:extensionNamespace}:{path:runtimeModulePath,namespace:"file"};let parsed=splitModuleId(path);if(parsed===void 0)throw new ExtensionModuleIdError(path);return graphFor(parsed.generation),{path,namespace:extensionNamespace}}),builder.onLoad({filter:/.*/,namespace:extensionNamespace},({path})=>{let parsed=splitModuleId(path);if(parsed===void 0)throw new ExtensionModuleIdError(path);return graphFor(parsed.generation).load(parsed.filename)}),installed=!0)}}))}function registerExtensionGraph(graph,virtualModules){installRegistry(virtualModules);let generation=String(nextGeneration++);return graphs.set(generation,new WeakRef(graph)),collected.register(graph,generation,graph),{generation,dispose(){graphs.delete(generation),collected.unregister(graph)}}}function bunExtensionImporterStats(){return{generations:[...graphs.values()].filter(entry=>entry.deref()).length,plugins:pluginRegistrations}}function skipTrivia(source,index){let hasLineTerminator=!1;for(;index<source.length;){let char=source[index];if(char==="\r"||char===`
|
|
10
|
+
`),{cause}),this.name="ExtensionSourceError",this.filename=filename,this.diagnostics=diagnostics}};var queued=[],draining=!1,synchronousDepth=0;function drainOne(){queued.shift()?.(),queued.length>0?setImmediate(drainOne):draining=!1}function loadInTurn(load){return synchronousDepth>0?load():new Promise((resolve2,reject)=>{queued.push(()=>{try{resolve2(load())}catch(error){reject(error)}}),!draining&&(draining=!0,setImmediate(drainOne))})}function loadSynchronously(require2){synchronousDepth++;try{return require2()}finally{synchronousDepth--}}import{createHash}from"node:crypto";import{mkdirSync,readdirSync,readFileSync as readFileSync2,renameSync,rmSync,statSync,writeFileSync}from"node:fs";import{join as join2}from"node:path";var MAX_ENTRY_AGE_MS=720*60*60*1e3,sha256=text=>createHash("sha256").update(text).digest("hex");function isPreparedSource(value){if(typeof value!="object"||value===null)return!1;let field=name=>typeof Reflect.get(value,name);return field("key")==="string"&&field("fingerprint")==="string"&&field("token")==="string"&&field("contents")==="string"&&field("commonJs")==="boolean"&&field("esmByType")==="boolean"&&Array.isArray(Reflect.get(value,"edges"))}function prune(directory){let cutoff=Date.now()-MAX_ENTRY_AGE_MS;for(let name of readdirSync(directory)){let path=join2(directory,name);statSync(path).mtimeMs<cutoff&&rmSync(path,{force:!0})}}function createPreparedSourceCache(directory,keyParts){let key=sha256(keyParts.join("\0")),entryPath=filename=>join2(directory,`${sha256(filename).slice(0,40)}.json`),pruned=!1;return{read(filename,fingerprint){let parsed;try{parsed=JSON.parse(readFileSync2(entryPath(filename),"utf8"))}catch{return}if(!(!isPreparedSource(parsed)||parsed.key!==key||parsed.fingerprint!==fingerprint))return parsed},write(filename,fingerprint,prepared){let target=entryPath(filename),temporary=`${target}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;try{mkdirSync(directory,{recursive:!0}),writeFileSync(temporary,JSON.stringify({...prepared,key,fingerprint})),renameSync(temporary,target),pruned||(pruned=!0,prune(directory))}catch{rmSync(temporary,{force:!0})}}}}import{existsSync}from"node:fs";import{dirname as dirname2,isAbsolute}from"node:path";import{fileURLToPath,pathToFileURL}from"node:url";var RUNTIME_METADATA=Symbol.for("senpi.extension.runtime.metadata");function publishRuntimeMetadata(value){globalThis[RUNTIME_METADATA]=value}var importModule=new Function("specifier","options","return import(specifier, options)"),extensionNamespace="senpi-extension",RUNTIME_SPECIFIER="runtime",runtimeModulePath=resolveRuntimeModulePath();function resolveRuntimeModulePath(){try{let candidate=fileURLToPath(new URL("./extension-runtime-module.js",import.meta.url));return existsSync(candidate)?candidate:void 0}catch{return}}function splitModuleId(id){let slash=id.indexOf("/");if(!(slash<=0||slash===id.length-1))return{generation:id.slice(0,slash),filename:decodeURIComponent(id.slice(slash+1))}}var graphs=new Map,collected=new FinalizationRegistry(generation=>graphs.delete(generation)),importing=new Map,nextGeneration=0,installed=!1,pluginRegistrations=0,registeredHosts=new Set,ExtensionModuleIdError=class extends Error{constructor(id){super(`Extension module id is not "<generation>/<encoded filename>": ${id}`),this.name="ExtensionModuleIdError"}},ExtensionGenerationDisposedError=class extends Error{constructor(generation){super(`Extension generation ${generation} has been disposed`),this.name="ExtensionGenerationDisposedError",this.generation=generation}};function graphFor(generation){let graph=graphs.get(generation)?.deref();if(!graph)throw new ExtensionGenerationDisposedError(generation);return graph}function metadata(generation,filename){let resolvePath=specifier=>{let id=graphFor(generation).resolve(specifier,filename);return id.startsWith(`${extensionNamespace}:`)?decodeURIComponent(id.slice(id.indexOf("/")+1)):isAbsolute(id)?id:void 0},require2=Object.assign(specifier=>graphFor(generation).require(specifier,filename),{resolve:specifier=>resolvePath(specifier)??graphFor(generation).resolve(specifier,filename)});return{url:pathToFileURL(filename).href,path:filename,dir:dirname2(filename),filename,dirname:dirname2(filename),require:require2,commonJs:body=>graphFor(generation).evaluateCommonJs(filename,body),import:async(specifier,options)=>importModule(graphFor(generation).resolve(specifier,filename),options),resolve:specifier=>{let path=resolvePath(specifier);return path===void 0?graphFor(generation).resolve(specifier,filename):pathToFileURL(path).href}}}function installRegistry(virtualModules){let hosts=Object.entries(virtualModules).filter(([name])=>!registeredHosts.has(name));(!installed||hosts.length>0)&&(pluginRegistrations++,Bun.plugin({name:extensionNamespace,setup(builder){for(let[name,exports]of hosts)builder.module(name,()=>({exports,loader:"object"})),registeredHosts.add(name);installed||(publishRuntimeMetadata(metadata),builder.module(`${extensionNamespace}:${RUNTIME_SPECIFIER}`,()=>({exports:{metadata},loader:"object"})),builder.onResolve({filter:/.*/,namespace:extensionNamespace},({path})=>{if(path===RUNTIME_SPECIFIER)return runtimeModulePath===void 0?{path,namespace:extensionNamespace}:{path:runtimeModulePath,namespace:"file"};let parsed=splitModuleId(path);if(parsed===void 0)throw new ExtensionModuleIdError(path);return graphFor(parsed.generation),{path,namespace:extensionNamespace}}),builder.onLoad({filter:/.*/,namespace:extensionNamespace},({path})=>{let parsed=splitModuleId(path);if(parsed===void 0)throw new ExtensionModuleIdError(path);return loadInTurn(()=>graphFor(parsed.generation).load(parsed.filename))}),installed=!0)}}))}function registerExtensionGraph(graph,virtualModules){installRegistry(virtualModules);let generation=String(nextGeneration++);return graphs.set(generation,new WeakRef(graph)),collected.register(graph,generation,graph),{generation,async holdDuring(pending){importing.set(graph,(importing.get(graph)??0)+1);try{return await pending}finally{let remaining=(importing.get(graph)??1)-1;remaining===0?importing.delete(graph):importing.set(graph,remaining)}},dispose(){graphs.delete(generation),collected.unregister(graph)}}}function bunExtensionImporterStats(){return{generations:[...graphs.values()].filter(entry=>entry.deref()).length,plugins:pluginRegistrations}}function skipTrivia(source,index){let hasLineTerminator=!1;for(;index<source.length;){let char=source[index];if(char==="\r"||char===`
|
|
11
11
|
`||char==="\u2028"||char==="\u2029"){hasLineTerminator=!0,index+=1;continue}if(char!==void 0&&/\s/u.test(char)){index+=1;continue}if(char==="/"&&source[index+1]==="/"){for(index+=2;index<source.length&&!/[\r\n\u2028\u2029]/u.test(source[index]??"");)index+=1;continue}if(char==="/"&&source[index+1]==="*"){for(index+=2;index<source.length;){let commentChar=source[index];if((commentChar==="\r"||commentChar===`
|
|
12
12
|
`||commentChar==="\u2028"||commentChar==="\u2029")&&(hasLineTerminator=!0),commentChar==="*"&&source[index+1]==="/"){index+=2;break}index+=1}continue}break}return{index,hasLineTerminator}}function stringLiteralEnd(source,index){let quote=source[index];if(!(quote!=='"'&"e!=="'"))for(index+=1;index<source.length;index+=1){let char=source[index];if(char==="\\"){index+=1,source[index]==="\r"&&source[index+1]===`
|
|
13
13
|
`&&(index+=1);continue}if(char===quote)return index+1;if(char==="\r"||char===`
|
|
@@ -18,4 +18,4 @@ import{external_exports}from"./chunk-KUPQO7MC.js";import"./chunk-IKOFCODM.js";im
|
|
|
18
18
|
//# sourceURL=${pathToFileURL2(filename).href}`;contents=[`const ${name}Body = Function(${JSON.stringify(name)}, "exports", "module", ${JSON.stringify(body)});`,`export default ${name}.commonJs(function (exports, module) {`,` return ${name}Body.call(this, ${name}, exports, module);`,"});"].join(`
|
|
19
19
|
`)}return contents=`import { metadata as ${name}Factory } from "${extensionNamespace}:runtime"; // runtime ${runtimeModulePath===void 0?"virtual":encodeURI(runtimeModulePath)}
|
|
20
20
|
const ${name} = ${name}Factory(${JSON.stringify(token)}, ${JSON.stringify(filename)});
|
|
21
|
-
${contents}`,{token,contents,commonJs:isCommonJs,esmByType,edges}},graph={assertActive,resolve(specifier,filename){return resolveTarget(specifier,filename).id},require(specifier,filename){let id=graph.resolve(specifier,filename),evaluating=commonJsModules.get(id);if(evaluating!==void 0)return evaluating.exports;let result=nativeRequire(id);return commonJs.has(id)?result.default:result},evaluateCommonJs(filename,body){assertActive();let id=moduleId(filename),module={exports:{}};commonJsModules.set(id,module);try{body.call(module.exports,module.exports,module)}catch(error){throw commonJsModules.delete(id),error}return module.exports},load(filename){assertActive();let existing=sources.get(filename);if(existing)return existing;let source=readFileSync3(filename,"utf8"),fingerprint=createHash2("sha256").update(source).digest("hex"),name="__senpiExtensionMeta";for(;source.includes(name)||filename.includes(name);)name+="_";let token=`${name}:generation`,esmByType=extname2(filename)===".js"&&isEsmByPackageType(filename),cached=preparedCache?.read(filename,fingerprint),ready=cached?.token===token&&cached.esmByType===esmByType&&edgesStillResolve(cached.edges,filename,token)?cached:void 0;ready===void 0&&(ready=prepare(source,filename,token,name,esmByType),preparedCache?.write(filename,fingerprint,ready)),ready.commonJs&&commonJs.add(moduleId(filename));let prepared={contents:ready.contents.replaceAll(token,registration.generation),loader:"js"};return sources.set(filename,prepared),fingerprints.set(filename,fingerprint),prepared}},registration=registerExtensionGraph(graph,virtualModules);return{async import(path,_options){assertActive();let absolute=realpathSync(resolve(path)),entry=statSync2(absolute).isDirectory()?realpathSync(Bun.resolveSync(absolute,absolute)):absolute,{id}=fileTarget(entry),factory=(await import(__rewriteRelativeImportExtension(id))).default;return typeof factory!="function"?factory:function(...args){return graph.assertActive(),factory.apply(this,args)}},async importNamespace(path){assertActive();let{id}=fileTarget(realpathSync(resolve(path)));return import(__rewriteRelativeImportExtension(id))},compiledSources(){return fingerprints},dispose(){active=!1,registration.dispose(),sources.clear(),fingerprints.clear(),commonJs.clear(),commonJsModules.clear()}}}export{bunExtensionImporterStats,createBunExtensionImporter};
|
|
21
|
+
${contents}`,{token,contents,commonJs:isCommonJs,esmByType,edges}},graph={assertActive,resolve(specifier,filename){return resolveTarget(specifier,filename).id},require(specifier,filename){let id=graph.resolve(specifier,filename),evaluating=commonJsModules.get(id);if(evaluating!==void 0)return evaluating.exports;let result=loadSynchronously(()=>nativeRequire(id));return commonJs.has(id)?result.default:result},evaluateCommonJs(filename,body){assertActive();let id=moduleId(filename),module={exports:{}};commonJsModules.set(id,module);try{body.call(module.exports,module.exports,module)}catch(error){throw commonJsModules.delete(id),error}return module.exports},load(filename){assertActive();let existing=sources.get(filename);if(existing)return existing;let source=readFileSync3(filename,"utf8"),fingerprint=createHash2("sha256").update(source).digest("hex"),name="__senpiExtensionMeta";for(;source.includes(name)||filename.includes(name);)name+="_";let token=`${name}:generation`,esmByType=extname2(filename)===".js"&&isEsmByPackageType(filename),cached=preparedCache?.read(filename,fingerprint),ready=cached?.token===token&&cached.esmByType===esmByType&&edgesStillResolve(cached.edges,filename,token)?cached:void 0;ready===void 0&&(ready=prepare(source,filename,token,name,esmByType),preparedCache?.write(filename,fingerprint,ready)),ready.commonJs&&commonJs.add(moduleId(filename));let prepared={contents:ready.contents.replaceAll(token,registration.generation),loader:"js"};return sources.set(filename,prepared),fingerprints.set(filename,fingerprint),prepared}},registration=registerExtensionGraph(graph,virtualModules);return{async import(path,_options){assertActive();let absolute=realpathSync(resolve(path)),entry=statSync2(absolute).isDirectory()?realpathSync(Bun.resolveSync(absolute,absolute)):absolute,{id}=fileTarget(entry),factory=(await registration.holdDuring(import(__rewriteRelativeImportExtension(id)))).default;return typeof factory!="function"?factory:function(...args){return graph.assertActive(),factory.apply(this,args)}},async importNamespace(path){assertActive();let{id}=fileTarget(realpathSync(resolve(path)));return registration.holdDuring(import(__rewriteRelativeImportExtension(id)))},compiledSources(){return fingerprints},dispose(){active=!1,registration.dispose(),sources.clear(),fingerprints.clear(),commonJs.clear(),commonJsModules.clear()}}}export{bunExtensionImporterStats,createBunExtensionImporter};
|