@bastani/atomic 0.10.20-alpha.1 → 0.10.20-alpha.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 +35 -0
- package/dist/_shared/dist-KOELCESV.js +2 -2
- package/dist/_shared/fork-row-index-UAUAQRD5.js +2 -2
- package/dist/_shared/lib-4PES5P4V.js +2 -2
- package/dist/_shared/mode-interactive-sdk-JXBZ3H27.js +72 -39
- package/dist/_shared/mode-interactive-sdk-JXBZ3H27.js.map +1 -1
- package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +57 -18
- package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js.map +1 -1
- package/dist/_shared/mode-shared-2QJSCUM6.js +59 -14
- package/dist/_shared/mode-shared-2QJSCUM6.js.map +1 -1
- package/dist/_shared/p0-cli-BB45ZQY6.js +2 -2
- package/dist/_shared/p1a-prewarm-XIU57JHF.js +3 -3
- package/dist/_shared/p1b-elig-BY2G5BUE.js +6 -3
- package/dist/_shared/p1b-elig-BY2G5BUE.js.map +1 -1
- package/dist/_shared/runtime-O4KCSG4C.js +4 -4
- package/dist/_shared/sdk-5ZFNDXUJ.js +208 -54
- package/dist/_shared/sdk-5ZFNDXUJ.js.map +1 -1
- package/dist/_shared/session-data-AHTU7IS6.js +14 -7
- package/dist/_shared/session-data-AHTU7IS6.js.map +1 -1
- package/dist/_shared/session-manager-list-2BLEEZVG.js +1 -1
- package/dist/_shared/settings-startup-HXQLSUWM.js +2 -2
- package/dist/_shared/settings-startup-HXQLSUWM.js.map +1 -1
- package/dist/_shared/{startup-0-0-FPPQF42L.js → startup-0-0-OWBJIX35.js} +161 -86
- package/dist/_shared/startup-0-0-OWBJIX35.js.map +1 -0
- package/dist/_shared/{startup-0-1-Q7GBLBEL.js → startup-0-1-DZYE4E5Z.js} +321 -17
- package/dist/_shared/startup-0-1-DZYE4E5Z.js.map +1 -0
- package/dist/_shared/{startup-0-2-JNYN24UI.js → startup-0-2-WFLTE4SC.js} +113 -6
- package/dist/_shared/startup-0-2-WFLTE4SC.js.map +1 -0
- package/dist/_shared/startup-0-3-DE2NCS6A.js +47 -23
- package/dist/_shared/startup-0-3-DE2NCS6A.js.map +1 -1
- package/dist/_shared/{startup-0-4-ZZXFKE55.js → startup-0-4-6XXL4JMZ.js} +37 -13
- package/dist/_shared/startup-0-4-6XXL4JMZ.js.map +1 -0
- package/dist/_shared/{startup-0-5-WN2IYA25.js → startup-0-5-DNS6FYS7.js} +126 -150
- package/dist/_shared/startup-0-5-DNS6FYS7.js.map +1 -0
- package/dist/_shared/startup-10-0-O6DAT7U4.js +93 -72
- package/dist/_shared/startup-10-0-O6DAT7U4.js.map +1 -1
- package/dist/_shared/startup-12-0-55AAXBJZ.js +3 -3
- package/dist/_shared/startup-14-0-MLX36RBG.js +5 -5
- package/dist/_shared/startup-15-0-E7RYG5YF.js +6 -6
- package/dist/_shared/startup-15-1-WQZBOTMZ.js +289 -122
- package/dist/_shared/startup-15-1-WQZBOTMZ.js.map +1 -1
- package/dist/_shared/startup-8-0-34CBHPZH.js +263 -145
- package/dist/_shared/startup-8-0-34CBHPZH.js.map +1 -1
- package/dist/_shared/{startup-8-1-QZMXUGHI.js → startup-8-1-VXBL37AI.js} +325 -10
- package/dist/_shared/startup-8-1-VXBL37AI.js.map +1 -0
- package/dist/_shared/storage-command-7MGXLJGZ.js +11 -273
- package/dist/_shared/storage-command-7MGXLJGZ.js.map +1 -1
- package/dist/_shared/storage-status-T6FUXRIM.js +4 -4
- package/dist/_shared/task-reference-stream-JWMUZSJX.js +1 -1
- package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
- package/dist/_shared/team-DOQKICG2.js +2 -2
- package/dist/_shared/tree-outline-MUEPK5B7.js +9 -2
- package/dist/_shared/tree-outline-MUEPK5B7.js.map +1 -1
- package/dist/binary-self-update.js +3 -3
- package/dist/builtin/intercom/broker/broker.bundle.mjs +46 -8
- package/dist/builtin/intercom/broker/broker.ts +1 -0
- package/dist/builtin/intercom/broker/client.ts +5 -1
- package/dist/builtin/intercom/broker/departed-children.ts +12 -6
- package/dist/builtin/intercom/broker/ended-child-wakes.ts +2 -0
- package/dist/builtin/intercom/index.bundle.mjs +130 -264
- package/dist/builtin/intercom/message-display.ts +42 -0
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/intercom/types.ts +1 -0
- package/dist/builtin/mcp/index.bundle.mjs +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +99 -20
- package/dist/builtin/web-access/index.bundle.mjs +15 -9
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/cli/args.js +2 -2
- package/dist/cli/auth-cli.code.js +6 -6
- package/dist/cli/auth-cli.impl.js +3 -3
- package/dist/cli/auth-cli.js +3 -3
- package/dist/cli/blueprint-command.code.js +4 -4
- package/dist/cli/blueprint-command.impl.js +3 -3
- package/dist/cli/blueprint-command.js +3 -3
- package/dist/cli/intercom-command.code.js +3 -3
- package/dist/cli/intercom-command.impl.js +3 -3
- package/dist/cli/intercom-command.js +3 -3
- package/dist/cli/list-models.code.js +3 -3
- package/dist/cli/list-models.impl.js +3 -3
- package/dist/cli/list-models.js +3 -3
- package/dist/cli/session-picker.code.js +2 -2
- package/dist/cli/session-picker.impl.js +3 -3
- package/dist/cli/session-picker.js +3 -3
- package/dist/cli/startup-ui.code.js +2 -2
- package/dist/cli/startup-ui.impl.js +3 -3
- package/dist/cli/startup-ui.js +3 -3
- package/dist/cli/storage-command.impl.js +3 -3
- package/dist/cli/storage-command.js +3 -3
- package/dist/cli/storage-search-session.code.js +2 -2
- package/dist/cli/storage-search-session.impl.js +3 -3
- package/dist/cli/storage-search-session.js +3 -3
- package/dist/cli/team-command.code.js +2 -2
- package/dist/cli/team-command.impl.js +3 -3
- package/dist/cli/team-command.js +3 -3
- package/dist/cli.js +2 -2
- package/dist/core/agent-session-runtime.d.ts +14 -3
- package/dist/core/agent-session-types.d.ts +5 -1
- package/dist/core/debug.impl.js +3 -3
- package/dist/core/debug.js +3 -3
- package/dist/core/export-html/card-projection.code.js +74 -72
- package/dist/core/export-html/card-projection.code.js.map +1 -1
- package/dist/core/export-html/card-projection.impl.js +3 -3
- package/dist/core/export-html/card-projection.js +3 -3
- package/dist/core/export-html/index.code.js +12 -4
- package/dist/core/export-html/index.code.js.map +1 -1
- package/dist/core/export-html/index.impl.js +3 -3
- package/dist/core/export-html/index.js +3 -3
- package/dist/core/export-html/json-spans.impl.js +3 -3
- package/dist/core/export-html/json-spans.js +3 -3
- package/dist/core/export-html/oversized-render-inputs.code.js +1 -1
- package/dist/core/export-html/oversized-render-inputs.impl.js +3 -3
- package/dist/core/export-html/oversized-render-inputs.js +3 -3
- package/dist/core/export-html/template.js +24 -23
- package/dist/core/export-html/tool-renderer.code.js +1 -1
- package/dist/core/export-html/tool-renderer.impl.js +3 -3
- package/dist/core/export-html/tool-renderer.js +3 -3
- package/dist/core/extensions/jiti-loader.impl.js +3 -3
- package/dist/core/extensions/jiti-loader.js +3 -3
- package/dist/core/extensions/jiti-static-loader.impl.js +3 -3
- package/dist/core/extensions/jiti-static-loader.js +3 -3
- package/dist/core/extensions/loader-host-modules.code.js +1 -1
- package/dist/core/extensions/loader-host-modules.impl.js +3 -3
- package/dist/core/extensions/loader-host-modules.js +3 -3
- package/dist/core/extensions/loader-virtual-modules.js +2 -2
- package/dist/core/extensions/runner-context.js +2 -2
- package/dist/core/intercom-broker-control-host.impl.js +3 -3
- package/dist/core/intercom-broker-control-host.js +3 -3
- package/dist/core/intercom-broker-control.code.js +3 -3
- package/dist/core/intercom-broker-control.impl.js +3 -3
- package/dist/core/intercom-broker-control.js +3 -3
- package/dist/core/model-registry.js +2 -2
- package/dist/core/package-manager-storage-adapters.code.js +1 -1
- package/dist/core/package-manager-storage-adapters.impl.js +3 -3
- package/dist/core/package-manager-storage-adapters.js +3 -3
- package/dist/core/resume/failure.d.ts +1 -1
- package/dist/core/sdk.code.js +4 -4
- package/dist/core/sdk.impl.js +3 -3
- package/dist/core/sdk.js +3 -3
- package/dist/core/session-claims.d.ts +13 -2
- package/dist/core/session-load-events.d.ts +42 -0
- package/dist/core/session-manager-core.d.ts +13 -2
- package/dist/core/session-manager-core.js +211 -98
- package/dist/core/session-manager-core.js.map +1 -1
- package/dist/core/session-manager-errors.d.ts +2 -2
- package/dist/core/session-manager-list.impl.js +3 -3
- package/dist/core/session-manager-list.js +3 -3
- package/dist/core/session-manager.code.js +1 -1
- package/dist/core/session-manager.impl.js +3 -3
- package/dist/core/session-manager.js +3 -3
- package/dist/core/session-storage.code.js +1 -1
- package/dist/core/session-storage.impl.js +3 -3
- package/dist/core/session-storage.js +3 -3
- package/dist/core/settings-manager.js +2 -2
- package/dist/core/storage/index.js +2 -2
- package/dist/core/storage/node-sqlite-thread.js +2 -2
- package/dist/core/storage/node-sqlite.js +2 -2
- package/dist/core/storage/offline-snapshot-file.impl.js +3 -3
- package/dist/core/storage/offline-snapshot-file.js +3 -3
- package/dist/core/storage/provider.js +2 -2
- package/dist/core/storage/schema-catalog.d.ts +2 -1
- package/dist/core/storage/schema-catalog.js +25 -6
- package/dist/core/storage/schema-catalog.js.map +1 -1
- package/dist/core/storage/selection.js +2 -2
- package/dist/core/storage/session/branch-fork-source.code.js +17 -4
- package/dist/core/storage/session/branch-fork-source.code.js.map +1 -1
- package/dist/core/storage/session/branch-fork-source.impl.js +3 -3
- package/dist/core/storage/session/branch-fork-source.js +3 -3
- package/dist/core/storage/session/card-view.impl.js +3 -3
- package/dist/core/storage/session/card-view.js +3 -3
- package/dist/core/storage/session/child-reader.code.js +3 -3
- package/dist/core/storage/session/child-reader.impl.js +3 -3
- package/dist/core/storage/session/child-reader.js +3 -3
- package/dist/core/storage/session/chunked-resume-projection.code.js +1 -1
- package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -3
- package/dist/core/storage/session/chunked-resume-projection.js +3 -3
- package/dist/core/storage/session/expanded-child-details.code.js +3 -3
- package/dist/core/storage/session/expanded-child-details.impl.js +3 -3
- package/dist/core/storage/session/expanded-child-details.js +3 -3
- package/dist/core/storage/session/fork-row-bytes.impl.js +3 -3
- package/dist/core/storage/session/fork-row-bytes.js +3 -3
- package/dist/core/storage/session/fork-row-index.impl.js +3 -3
- package/dist/core/storage/session/fork-row-index.js +3 -3
- package/dist/core/storage/session/fork-staging.code.js +8 -4
- package/dist/core/storage/session/fork-staging.code.js.map +1 -1
- package/dist/core/storage/session/fork-staging.impl.js +3 -3
- package/dist/core/storage/session/fork-staging.js +3 -3
- package/dist/core/storage/session/fork-window.code.js +29 -14
- package/dist/core/storage/session/fork-window.code.js.map +1 -1
- package/dist/core/storage/session/fork-window.impl.js +3 -3
- package/dist/core/storage/session/fork-window.js +3 -3
- package/dist/core/storage/session/history-pages.impl.js +3 -3
- package/dist/core/storage/session/history-pages.js +3 -3
- package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -3
- package/dist/core/storage/session/jsonl-entry-projection.js +3 -3
- package/dist/core/storage/session/jsonl-session-store.d.ts +8 -4
- package/dist/core/storage/session/jsonl-session-store.impl.js +3 -3
- package/dist/core/storage/session/jsonl-session-store.js +3 -3
- package/dist/core/storage/session/memory-session-store.d.ts +3 -3
- package/dist/core/storage/session/memory-session-store.impl.js +3 -3
- package/dist/core/storage/session/memory-session-store.js +3 -3
- package/dist/core/storage/session/parent-links.d.ts +122 -0
- package/dist/core/storage/session/pinned-branch-resume.code.js +3 -3
- package/dist/core/storage/session/pinned-branch-resume.impl.js +3 -3
- package/dist/core/storage/session/pinned-branch-resume.js +3 -3
- package/dist/core/storage/session/released-history-files.code.js +3 -3
- package/dist/core/storage/session/released-history-files.impl.js +3 -3
- package/dist/core/storage/session/released-history-files.js +3 -3
- package/dist/core/storage/session/resident-fork-rows.impl.js +3 -3
- package/dist/core/storage/session/resident-fork-rows.js +3 -3
- package/dist/core/storage/session/session-resume.impl.js +3 -3
- package/dist/core/storage/session/session-resume.js +3 -3
- package/dist/core/storage/session/snapshot-cut.impl.js +3 -3
- package/dist/core/storage/session/snapshot-cut.js +3 -3
- package/dist/core/storage/session/snapshot-history.code.js +5 -6
- package/dist/core/storage/session/snapshot-history.code.js.map +1 -1
- package/dist/core/storage/session/snapshot-history.impl.js +3 -3
- package/dist/core/storage/session/snapshot-history.js +3 -3
- package/dist/core/storage/session/sql-session-store.d.ts +4 -3
- package/dist/core/storage/session/sql-session-store.impl.js +3 -3
- package/dist/core/storage/session/sql-session-store.js +3 -3
- package/dist/core/storage/session/tree-outline.impl.js +3 -3
- package/dist/core/storage/session/tree-outline.js +3 -3
- package/dist/core/storage/session/tree-presentation.code.js +1 -1
- package/dist/core/storage/session/tree-presentation.impl.js +3 -3
- package/dist/core/storage/session/tree-presentation.js +3 -3
- package/dist/core/storage/session/types.d.ts +9 -3
- package/dist/core/storage/session/usage-observations.js +1 -1
- package/dist/core/storage/storage-status.impl.js +3 -3
- package/dist/core/storage/storage-status.js +3 -3
- package/dist/core/storage/team.impl.js +3 -3
- package/dist/core/storage/team.js +3 -3
- package/dist/core/structured-output/index.impl.js +3 -3
- package/dist/core/structured-output/index.js +3 -3
- package/dist/core/tasks/task-completion-entry.code.js +1 -1
- package/dist/core/tasks/task-completion-entry.impl.js +3 -3
- package/dist/core/tasks/task-completion-entry.js +3 -3
- package/dist/core/tasks/task-file-history.code.js +3 -3
- package/dist/core/tasks/task-file-history.impl.js +3 -3
- package/dist/core/tasks/task-file-history.js +3 -3
- package/dist/core/tasks/task-reference-archive.code.js +5 -5
- package/dist/core/tasks/task-reference-archive.js +3 -3
- package/dist/core/tasks/task-reference-identity.code.js +1 -1
- package/dist/core/tasks/task-reference-identity.js +3 -3
- package/dist/core/tasks/task-reference-stream.impl.js +3 -3
- package/dist/core/tasks/task-reference-stream.js +3 -3
- package/dist/core/tasks/task-unsaved-answer.impl.js +3 -3
- package/dist/core/tasks/task-unsaved-answer.js +3 -3
- package/dist/core/tasks/task-view-source.code.js +1 -1
- package/dist/core/tasks/task-view-source.impl.js +3 -3
- package/dist/core/tasks/task-view-source.js +3 -3
- package/dist/core/tools/read-url.code.js +3 -3
- package/dist/core/tools/read-url.impl.js +3 -3
- package/dist/core/tools/read-url.js +3 -3
- package/dist/core/worktree-snapshot/blob-store.js +2 -2
- package/dist/core/worktree-snapshot/errors.code.js +3 -3
- package/dist/core/worktree-snapshot/errors.impl.js +3 -3
- package/dist/core/worktree-snapshot/errors.js +3 -3
- package/dist/core/worktree-snapshot/session-index-reset.impl.js +3 -3
- package/dist/core/worktree-snapshot/session-index-reset.js +3 -3
- package/dist/extensions/codemode/execute.code.js +2 -2
- package/dist/extensions/codemode/execute.impl.js +3 -3
- package/dist/extensions/codemode/execute.js +3 -3
- package/dist/extensions/codemode/renderer.code.js +12 -7
- package/dist/extensions/codemode/renderer.code.js.map +1 -1
- package/dist/extensions/codemode/renderer.impl.js +3 -3
- package/dist/extensions/codemode/renderer.js +3 -3
- package/dist/extensions/mcp/cli.code.js +2 -2
- package/dist/extensions/mcp/cli.impl.js +3 -3
- package/dist/extensions/mcp/cli.js +3 -3
- package/dist/extensions/mcp/cli.lazy.code.js +2 -2
- package/dist/extensions/mcp/cli.lazy.impl.js +3 -3
- package/dist/extensions/mcp/cli.lazy.js +3 -3
- package/dist/extensions/mcp/runtime.impl.js +3 -3
- package/dist/extensions/mcp/runtime.js +3 -3
- package/dist/index.d.ts +5 -2
- package/dist/index.js +7 -7
- package/dist/main-first-time-setup.code.js +2 -2
- package/dist/main-first-time-setup.impl.js +3 -3
- package/dist/main-first-time-setup.js +3 -3
- package/dist/main.js +1 -1
- package/dist/modes/index.d.ts +1 -1
- package/dist/modes/interactive/components/intercom-wake-notice.d.ts +4 -0
- package/dist/modes/interactive/components/notice-line.d.ts +1 -1
- package/dist/modes/interactive/components/stored-tree-view.code.js +6 -5
- package/dist/modes/interactive/components/stored-tree-view.code.js.map +1 -1
- package/dist/modes/interactive/components/stored-tree-view.impl.js +3 -3
- package/dist/modes/interactive/components/stored-tree-view.js +3 -3
- package/dist/modes/interactive/components/tool-block.d.ts +5 -1
- package/dist/modes/interactive/components/user-message-selector-archive.code.js +1 -1
- package/dist/modes/interactive/components/user-message-selector-archive.impl.js +3 -3
- package/dist/modes/interactive/components/user-message-selector-archive.js +3 -3
- package/dist/modes/interactive-engine/isolated-runtime.d.ts +3 -3
- package/dist/modes/interactive-engine/protocol.d.ts +0 -4
- package/dist/modes/rpc/rpc-client-api.d.ts +5 -0
- package/dist/modes/rpc/rpc-types.d.ts +23 -5
- package/dist/package-manager-cli.code.js +7 -7
- package/dist/package-manager-cli.impl.js +3 -3
- package/dist/package-manager-cli.js +3 -3
- package/dist/rpc-entry.js +1 -1
- package/dist/startup-files.json +1 -1
- package/dist/startup-stages/10.js +1 -1
- package/dist/startup-stages/12.js +1 -1
- package/dist/startup-stages/13.js +2 -1
- package/dist/startup-stages/14.js +1 -0
- package/dist/startup-stages/4.js +1 -1
- package/dist/startup-stages/6.js +1 -1
- package/dist/startup-stages/7.js +1 -1
- package/dist/startup-stages/8.js +1 -1
- package/dist/startup-stages/stages.json +1 -1
- package/dist/utils/startup-database-spare.code.js +3 -3
- package/dist/utils/startup-database-spare.impl.js +3 -3
- package/dist/utils/startup-database-spare.js +3 -3
- package/dist/utils/tools-manager.code.js +1 -1
- package/dist/utils/tools-manager.impl.js +3 -3
- package/dist/utils/tools-manager.js +3 -3
- package/docs/.agents/context/DESIGN.md +30 -0
- package/docs/changelog.mdx +23 -0
- package/docs/docs.json +1 -1
- package/docs/guides/subscription-usage.md +3 -3
- package/docs/intercom.md +3 -1
- package/docs/json.md +3 -3
- package/docs/providers.md +2 -0
- package/docs/rpc/protocol.md +1 -1
- package/docs/sdk.md +2 -0
- package/docs/sessions.md +36 -1
- package/docs/subagents.md +2 -0
- package/package.json +8 -8
- package/dist/_shared/startup-0-0-FPPQF42L.js.map +0 -1
- package/dist/_shared/startup-0-1-Q7GBLBEL.js.map +0 -1
- package/dist/_shared/startup-0-2-JNYN24UI.js.map +0 -1
- package/dist/_shared/startup-0-4-ZZXFKE55.js.map +0 -1
- package/dist/_shared/startup-0-5-WN2IYA25.js.map +0 -1
- package/dist/_shared/startup-8-1-QZMXUGHI.js.map +0 -1
|
@@ -11090,6 +11090,39 @@ import { Socket } from "node:net";
|
|
|
11090
11090
|
// dist/builtin/intercom/broker/departed-children.ts
|
|
11091
11091
|
init_group();
|
|
11092
11092
|
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
11093
|
+
|
|
11094
|
+
// dist/builtin/intercom/message-display.ts
|
|
11095
|
+
function splitsUtf16SurrogatePair(text, index) {
|
|
11096
|
+
if (index <= 0 || index >= text.length)
|
|
11097
|
+
return false;
|
|
11098
|
+
const prev = text.charCodeAt(index - 1);
|
|
11099
|
+
const curr = text.charCodeAt(index);
|
|
11100
|
+
return prev >= 55296 && prev <= 56319 && curr >= 56320 && curr <= 57343;
|
|
11101
|
+
}
|
|
11102
|
+
function extractProjectedDisplayText(content) {
|
|
11103
|
+
const text = content.text;
|
|
11104
|
+
const ranges = content.displayRanges;
|
|
11105
|
+
if (!Array.isArray(ranges) || ranges.length === 0)
|
|
11106
|
+
return text;
|
|
11107
|
+
const parts = [];
|
|
11108
|
+
let lastEnd = 0;
|
|
11109
|
+
let totalProjectedLength = 0;
|
|
11110
|
+
for (const range of ranges) {
|
|
11111
|
+
if (typeof range !== "object" || range === null || Array.isArray(range) || typeof range.start !== "number" || typeof range.end !== "number" || !Number.isSafeInteger(range.start) || !Number.isSafeInteger(range.end) || range.start < lastEnd || range.end <= range.start || range.end > text.length || splitsUtf16SurrogatePair(text, range.start) || splitsUtf16SurrogatePair(text, range.end)) {
|
|
11112
|
+
return text;
|
|
11113
|
+
}
|
|
11114
|
+
const sliceLength = range.end - range.start;
|
|
11115
|
+
totalProjectedLength += sliceLength;
|
|
11116
|
+
if (totalProjectedLength > text.length)
|
|
11117
|
+
return text;
|
|
11118
|
+
parts.push(text.slice(range.start, range.end));
|
|
11119
|
+
lastEnd = range.end;
|
|
11120
|
+
}
|
|
11121
|
+
const projected = parts.join("");
|
|
11122
|
+
return projected.trim().length > 0 ? projected : text;
|
|
11123
|
+
}
|
|
11124
|
+
|
|
11125
|
+
// dist/builtin/intercom/broker/departed-children.ts
|
|
11093
11126
|
init_ended_child_wakes();
|
|
11094
11127
|
init_group_membership();
|
|
11095
11128
|
init_recipient_gone_errors();
|
|
@@ -11238,7 +11271,7 @@ class DepartedChildren {
|
|
|
11238
11271
|
this.journalAll(departure);
|
|
11239
11272
|
if (messages === "wake" && departure.wake === undefined) {
|
|
11240
11273
|
const first = this.firstWaker(departure);
|
|
11241
|
-
const started = first === undefined ? undefined : this.startWake(departure, first);
|
|
11274
|
+
const started = first === undefined ? undefined : this.startWake(departure, first.sender, first.held);
|
|
11242
11275
|
if (started?.ok === false)
|
|
11243
11276
|
this.failQueued(departure, () => notResumedReason(departure.childName, started.why));
|
|
11244
11277
|
else if (started !== undefined)
|
|
@@ -11470,7 +11503,7 @@ class DepartedChildren {
|
|
|
11470
11503
|
}
|
|
11471
11504
|
let wake;
|
|
11472
11505
|
if (messages === "wake" && verdict !== undefined && ownerHere && departure.wake === undefined && !ownerHolds) {
|
|
11473
|
-
const started = this.startWake(departure, sender);
|
|
11506
|
+
const started = this.startWake(departure, sender, held);
|
|
11474
11507
|
if (!started.ok) {
|
|
11475
11508
|
const error = this.errorFor(departure, ended, target);
|
|
11476
11509
|
return { kind: "refused", error, reason: `${error.message} It was not resumed for this message: ${started.why}.` };
|
|
@@ -11505,7 +11538,7 @@ class DepartedChildren {
|
|
|
11505
11538
|
this.heldTotal += 1;
|
|
11506
11539
|
this.queuedIds.set(held.messageId, departure);
|
|
11507
11540
|
}
|
|
11508
|
-
startWake(departure, sender) {
|
|
11541
|
+
startWake(departure, sender, held) {
|
|
11509
11542
|
const budget = this.wakes?.budget?.check(departure.key, sender.wakeKey) ?? { ok: true, depth: 1 };
|
|
11510
11543
|
if (!budget.ok)
|
|
11511
11544
|
return budget;
|
|
@@ -11515,6 +11548,8 @@ class DepartedChildren {
|
|
|
11515
11548
|
this.armQueueTimer(departure, ENDED_CHILD_WAKE_ANSWER_MS, "its launching session did not answer");
|
|
11516
11549
|
this.wakes?.journal?.wake(this.journalDeparture(departure), { id, depth: budget.depth });
|
|
11517
11550
|
const childId = departure.verdict?.kind === "ended" ? departure.verdict.childId : departure.restored?.childId;
|
|
11551
|
+
const content = held.clientMessage.message?.content;
|
|
11552
|
+
const messageText = typeof content?.text === "string" ? extractProjectedDisplayText(content) : undefined;
|
|
11518
11553
|
return {
|
|
11519
11554
|
ok: true,
|
|
11520
11555
|
wake: {
|
|
@@ -11523,7 +11558,8 @@ class DepartedChildren {
|
|
|
11523
11558
|
...childId === undefined ? {} : { childId },
|
|
11524
11559
|
wakeId: id,
|
|
11525
11560
|
waker: sender.waker,
|
|
11526
|
-
depth: budget.depth
|
|
11561
|
+
depth: budget.depth,
|
|
11562
|
+
...messageText === undefined ? {} : { messageText }
|
|
11527
11563
|
}
|
|
11528
11564
|
};
|
|
11529
11565
|
}
|
|
@@ -11565,7 +11601,7 @@ class DepartedChildren {
|
|
|
11565
11601
|
this.wakes.journal?.ownerAway([this.journalDeparture(departure)], departure.awaySince);
|
|
11566
11602
|
} else if (departure.verdict?.kind === "ended" && departure.verdict.messages === "wake" && departure.wake === undefined) {
|
|
11567
11603
|
const first = this.firstWaker(departure);
|
|
11568
|
-
const started = first === undefined ? undefined : this.startWake(departure, first);
|
|
11604
|
+
const started = first === undefined ? undefined : this.startWake(departure, first.sender, first.held);
|
|
11569
11605
|
if (started?.ok === false)
|
|
11570
11606
|
this.failQueued(departure, () => notResumedReason(departure.childName, started.why));
|
|
11571
11607
|
else if (started !== undefined)
|
|
@@ -11576,8 +11612,9 @@ class DepartedChildren {
|
|
|
11576
11612
|
return wakes;
|
|
11577
11613
|
}
|
|
11578
11614
|
firstWaker(departure) {
|
|
11579
|
-
const
|
|
11580
|
-
|
|
11615
|
+
const held = departure.queued.find((message) => !isMaybeDelivered(message));
|
|
11616
|
+
const sender = held === undefined ? undefined : this.wakeSenders.get(held);
|
|
11617
|
+
return held === undefined || sender === undefined ? undefined : { held, sender };
|
|
11581
11618
|
}
|
|
11582
11619
|
dropQueued(messageIds, own) {
|
|
11583
11620
|
const dropped = [];
|
|
@@ -20257,7 +20294,8 @@ class IntercomBroker {
|
|
|
20257
20294
|
...wake.childId === undefined ? {} : { childId: wake.childId },
|
|
20258
20295
|
wakeId: wake.wakeId,
|
|
20259
20296
|
from: wake.waker,
|
|
20260
|
-
depth: wake.depth
|
|
20297
|
+
depth: wake.depth,
|
|
20298
|
+
...wake.messageText === undefined ? {} : { messageText: wake.messageText }
|
|
20261
20299
|
});
|
|
20262
20300
|
}
|
|
20263
20301
|
failQueuedForWake(failures) {
|
|
@@ -293,6 +293,8 @@ export interface EndedChildWakeNotice {
|
|
|
293
293
|
readonly wakeId: string;
|
|
294
294
|
/** The sender of the message that woke it. */
|
|
295
295
|
readonly from: { readonly id: string; readonly name?: string };
|
|
296
|
+
/** Display text only; older brokers do not send it. */
|
|
297
|
+
readonly messageText?: string;
|
|
296
298
|
/** How far down a chain of wakes this one is (1: its sender was not itself woken). */
|
|
297
299
|
readonly depth: number;
|
|
298
300
|
}
|
|
@@ -1199,7 +1201,7 @@ export class IntercomClient extends EventEmitter {
|
|
|
1199
1201
|
break;
|
|
1200
1202
|
}
|
|
1201
1203
|
case "ended_child_wake": {
|
|
1202
|
-
const { childName, childId, wakeId, from, depth } = brokerMessage;
|
|
1204
|
+
const { childName, childId, wakeId, from, depth, messageText } = brokerMessage;
|
|
1203
1205
|
const waker = from as { id?: unknown; name?: unknown } | undefined;
|
|
1204
1206
|
if (
|
|
1205
1207
|
typeof childName !== "string" ||
|
|
@@ -1209,6 +1211,7 @@ export class IntercomClient extends EventEmitter {
|
|
|
1209
1211
|
waker === null ||
|
|
1210
1212
|
typeof waker.id !== "string" ||
|
|
1211
1213
|
(waker.name !== undefined && typeof waker.name !== "string") ||
|
|
1214
|
+
(messageText !== undefined && typeof messageText !== "string") ||
|
|
1212
1215
|
typeof depth !== "number"
|
|
1213
1216
|
) {
|
|
1214
1217
|
throw new Error("Invalid ended_child_wake message");
|
|
@@ -1220,6 +1223,7 @@ export class IntercomClient extends EventEmitter {
|
|
|
1220
1223
|
wakeId,
|
|
1221
1224
|
from: { id: waker.id, ...(typeof waker.name === "string" ? { name: waker.name } : {}) },
|
|
1222
1225
|
depth,
|
|
1226
|
+
...(messageText === undefined ? {} : { messageText }),
|
|
1223
1227
|
};
|
|
1224
1228
|
this.emit("ended_child_wake", notice);
|
|
1225
1229
|
break;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import { hasGroup, normalizeGroup } from "../group.js";
|
|
3
|
+
import { extractProjectedDisplayText } from "../message-display.js";
|
|
3
4
|
import type { ReleasedChildRefusal } from "../types.js";
|
|
4
5
|
import { intercomMessageBytes } from "../message-size.js";
|
|
5
6
|
import type { Message } from "../types.js";
|
|
@@ -473,7 +474,7 @@ export class DepartedChildren {
|
|
|
473
474
|
if (restored !== undefined && restored.messages !== messages) this.journalAll(departure);
|
|
474
475
|
if (messages === "wake" && departure.wake === undefined) {
|
|
475
476
|
const first = this.firstWaker(departure);
|
|
476
|
-
const started = first === undefined ? undefined : this.startWake(departure, first);
|
|
477
|
+
const started = first === undefined ? undefined : this.startWake(departure, first.sender, first.held);
|
|
477
478
|
if (started?.ok === false)
|
|
478
479
|
this.failQueued(departure, () => notResumedReason(departure.childName, started.why));
|
|
479
480
|
else if (started !== undefined) wakes.push(started.wake);
|
|
@@ -788,7 +789,7 @@ export class DepartedChildren {
|
|
|
788
789
|
// A child stopped on purpose is not woken: the message waits for its owner to continue it. Nor is one whose owner is
|
|
789
790
|
// away, or has not reported it since a restart: its owner is asked once it is back and has.
|
|
790
791
|
if (messages === "wake" && verdict !== undefined && ownerHere && departure.wake === undefined && !ownerHolds) {
|
|
791
|
-
const started = this.startWake(departure, sender);
|
|
792
|
+
const started = this.startWake(departure, sender, held);
|
|
792
793
|
if (!started.ok) {
|
|
793
794
|
const error = this.errorFor(departure, ended, target);
|
|
794
795
|
return { kind: "refused", error, reason: `${error.message} It was not resumed for this message: ${started.why}.` };
|
|
@@ -838,6 +839,7 @@ export class DepartedChildren {
|
|
|
838
839
|
private startWake(
|
|
839
840
|
departure: Departure,
|
|
840
841
|
sender: WakeSender,
|
|
842
|
+
held: HeldSend,
|
|
841
843
|
): { readonly ok: true; readonly wake: EndedChildWakeRequest } | { readonly ok: false; readonly why: string } {
|
|
842
844
|
const budget = this.wakes?.budget?.check(departure.key, sender.wakeKey) ?? { ok: true as const, depth: 1 };
|
|
843
845
|
if (!budget.ok) return budget;
|
|
@@ -847,6 +849,8 @@ export class DepartedChildren {
|
|
|
847
849
|
this.armQueueTimer(departure, ENDED_CHILD_WAKE_ANSWER_MS, "its launching session did not answer");
|
|
848
850
|
this.wakes?.journal?.wake(this.journalDeparture(departure), { id, depth: budget.depth });
|
|
849
851
|
const childId = departure.verdict?.kind === "ended" ? departure.verdict.childId : departure.restored?.childId;
|
|
852
|
+
const content = (held.clientMessage.message as Message | undefined)?.content;
|
|
853
|
+
const messageText = typeof content?.text === "string" ? extractProjectedDisplayText(content) : undefined;
|
|
850
854
|
return {
|
|
851
855
|
ok: true,
|
|
852
856
|
wake: {
|
|
@@ -856,6 +860,7 @@ export class DepartedChildren {
|
|
|
856
860
|
wakeId: id,
|
|
857
861
|
waker: sender.waker,
|
|
858
862
|
depth: budget.depth,
|
|
863
|
+
...(messageText === undefined ? {} : { messageText }),
|
|
859
864
|
},
|
|
860
865
|
};
|
|
861
866
|
}
|
|
@@ -919,7 +924,7 @@ export class DepartedChildren {
|
|
|
919
924
|
this.wakes.journal?.ownerAway([this.journalDeparture(departure)], departure.awaySince);
|
|
920
925
|
} else if (departure.verdict?.kind === "ended" && departure.verdict.messages === "wake" && departure.wake === undefined) {
|
|
921
926
|
const first = this.firstWaker(departure);
|
|
922
|
-
const started = first === undefined ? undefined : this.startWake(departure, first);
|
|
927
|
+
const started = first === undefined ? undefined : this.startWake(departure, first.sender, first.held);
|
|
923
928
|
if (started?.ok === false) this.failQueued(departure, () => notResumedReason(departure.childName, started.why));
|
|
924
929
|
else if (started !== undefined) wakes.push(started.wake);
|
|
925
930
|
}
|
|
@@ -932,9 +937,10 @@ export class DepartedChildren {
|
|
|
932
937
|
* Who to name as waking the child for its queue: the sender of its first message never handed over to it. Undefined
|
|
933
938
|
* when every message may already have reached it (an earlier broker handed them over): those wake nobody.
|
|
934
939
|
*/
|
|
935
|
-
private firstWaker(departure: Departure): WakeSender | undefined {
|
|
936
|
-
const
|
|
937
|
-
|
|
940
|
+
private firstWaker(departure: Departure): { held: HeldSend; sender: WakeSender } | undefined {
|
|
941
|
+
const held = departure.queued.find((message) => !isMaybeDelivered(message));
|
|
942
|
+
const sender = held === undefined ? undefined : this.wakeSenders.get(held);
|
|
943
|
+
return held === undefined || sender === undefined ? undefined : { held, sender };
|
|
938
944
|
}
|
|
939
945
|
|
|
940
946
|
/**
|
|
@@ -85,6 +85,8 @@ export interface EndedChildWakeRequest {
|
|
|
85
85
|
/** Names this wake; the owner's answer must carry it. */
|
|
86
86
|
readonly wakeId: string;
|
|
87
87
|
readonly waker: EndedChildWaker;
|
|
88
|
+
/** The waking message's display text, without attachments. */
|
|
89
|
+
readonly messageText?: string;
|
|
88
90
|
/** How far down a chain of wakes this one is (1: its sender was not itself woken). */
|
|
89
91
|
readonly depth: number;
|
|
90
92
|
}
|