@maudecode/talaria-web 1.17.2 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_release.json +8 -8
- package/dist/api/auth-raw.d.ts +1 -1
- package/dist/api/auth-raw.js +20 -20
- package/dist/api/auth-raw.js.map +1 -1
- package/dist/api/automation-raw.d.ts +7 -1
- package/dist/api/automation-raw.js +74 -27
- package/dist/api/automation-raw.js.map +1 -1
- package/dist/api/automation-router.d.ts +128 -23
- package/dist/api/automation-router.js +29 -13
- package/dist/api/automation-router.js.map +1 -1
- package/dist/api/chat-router.d.ts +1845 -40
- package/dist/api/chat-router.js +196 -114
- package/dist/api/chat-router.js.map +1 -1
- package/dist/api/git-router.d.ts +37 -3
- package/dist/api/git-router.js +47 -48
- package/dist/api/git-router.js.map +1 -1
- package/dist/api/raw-routes.d.ts +9 -1
- package/dist/api/raw-routes.js +286 -73
- package/dist/api/raw-routes.js.map +1 -1
- package/dist/api/router.d.ts +16 -6
- package/dist/api/router.js +28 -26
- package/dist/api/router.js.map +1 -1
- package/dist/api/session-visibility.d.ts +4 -4
- package/dist/api/session-visibility.js +26 -16
- package/dist/api/session-visibility.js.map +1 -1
- package/dist/api/sessions-router.d.ts +3312 -131
- package/dist/api/sessions-router.js +287 -157
- package/dist/api/sessions-router.js.map +1 -1
- package/dist/api/settings-router.d.ts +457 -8
- package/dist/api/settings-router.js +54 -33
- package/dist/api/settings-router.js.map +1 -1
- package/dist/api/sse-routes.d.ts +7 -2
- package/dist/api/sse-routes.js +109 -62
- package/dist/api/sse-routes.js.map +1 -1
- package/dist/api/tools-raw.d.ts +5 -0
- package/dist/api/tools-raw.js +63 -55
- package/dist/api/tools-raw.js.map +1 -1
- package/dist/api/tools-router.d.ts +998 -85
- package/dist/api/tools-router.js +447 -61
- package/dist/api/tools-router.js.map +1 -1
- package/dist/api/transcribe-stream.d.ts +16 -0
- package/dist/api/transcribe-stream.js +172 -0
- package/dist/api/transcribe-stream.js.map +1 -0
- package/dist/app.d.ts +4 -1
- package/dist/app.js +98 -59
- package/dist/app.js.map +1 -1
- package/dist/auth/gate.js +15 -11
- package/dist/auth/gate.js.map +1 -1
- package/dist/auth/oidc.d.ts +5 -2
- package/dist/auth/oidc.js +8 -7
- package/dist/auth/oidc.js.map +1 -1
- package/dist/auth/passkeys.d.ts +15 -14
- package/dist/auth/passkeys.js +89 -91
- package/dist/auth/passkeys.js.map +1 -1
- package/dist/auth/store.d.ts +17 -7
- package/dist/auth/store.js +93 -52
- package/dist/auth/store.js.map +1 -1
- package/dist/bin/talaria-web.js +12 -81
- package/dist/bin/talaria-web.js.map +1 -1
- package/dist/cli/ctl.js +2 -1
- package/dist/cli/ctl.js.map +1 -1
- package/dist/cli/dotenv.d.ts +5 -0
- package/dist/cli/dotenv.js +15 -2
- package/dist/cli/dotenv.js.map +1 -1
- package/dist/cli/launcher.js +5 -5
- package/dist/cli/launcher.js.map +1 -1
- package/dist/cli/main.d.ts +1 -0
- package/dist/cli/main.js +85 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/supervise.d.ts +2 -0
- package/dist/cli/supervise.js +67 -4
- package/dist/cli/supervise.js.map +1 -1
- package/dist/config/agent-config.d.ts +34 -11
- package/dist/config/agent-config.js +116 -60
- package/dist/config/agent-config.js.map +1 -1
- package/dist/config.d.ts +4 -0
- package/dist/config.js +19 -6
- package/dist/config.js.map +1 -1
- package/dist/fs/atomic.d.ts +1 -0
- package/dist/fs/atomic.js +4 -1
- package/dist/fs/atomic.js.map +1 -1
- package/dist/fs/stat.d.ts +1 -0
- package/dist/fs/stat.js +11 -0
- package/dist/fs/stat.js.map +1 -0
- package/dist/http/context.d.ts +31 -12
- package/dist/http/context.js +60 -24
- package/dist/http/context.js.map +1 -1
- package/dist/http/csp.d.ts +2 -1
- package/dist/http/csp.js +3 -2
- package/dist/http/csp.js.map +1 -1
- package/dist/onboarding.d.ts +2 -2
- package/dist/onboarding.js +10 -8
- package/dist/onboarding.js.map +1 -1
- package/dist/profiles/profiles.d.ts +20 -4
- package/dist/profiles/profiles.js +115 -30
- package/dist/profiles/profiles.js.map +1 -1
- package/dist/projects.d.ts +15 -6
- package/dist/projects.js +55 -47
- package/dist/projects.js.map +1 -1
- package/dist/providers/catalog.d.ts +84 -14
- package/dist/providers/catalog.js +474 -151
- package/dist/providers/catalog.js.map +1 -1
- package/dist/providers/env-file.d.ts +10 -3
- package/dist/providers/env-file.js +24 -75
- package/dist/providers/env-file.js.map +1 -1
- package/dist/providers/runtime-env.d.ts +4 -2
- package/dist/providers/runtime-env.js +9 -6
- package/dist/providers/runtime-env.js.map +1 -1
- package/dist/providers/tables.d.ts +3 -1
- package/dist/providers/tables.js +4 -2
- package/dist/providers/tables.js.map +1 -1
- package/dist/raster-image.d.ts +7 -0
- package/dist/raster-image.js +267 -0
- package/dist/raster-image.js.map +1 -0
- package/dist/redact.js +342 -46
- package/dist/redact.js.map +1 -1
- package/dist/release.d.ts +7 -0
- package/dist/release.js +14 -0
- package/dist/release.js.map +1 -1
- package/dist/runtime.d.ts +5 -1
- package/dist/runtime.js +305 -96
- package/dist/runtime.js.map +1 -1
- package/dist/server.js +15 -0
- package/dist/server.js.map +1 -1
- package/dist/sessions/anchor.d.ts +9 -3
- package/dist/sessions/anchor.js +28 -36
- package/dist/sessions/anchor.js.map +1 -1
- package/dist/sessions/background-events.d.ts +2 -0
- package/dist/sessions/background-events.js +10 -0
- package/dist/sessions/background-events.js.map +1 -0
- package/dist/sessions/background-tasks.d.ts +26 -27
- package/dist/sessions/background-tasks.js +89 -97
- package/dist/sessions/background-tasks.js.map +1 -1
- package/dist/sessions/background-updates.d.ts +15 -8
- package/dist/sessions/background-updates.js +101 -25
- package/dist/sessions/background-updates.js.map +1 -1
- package/dist/sessions/cli-sessions.d.ts +27 -6
- package/dist/sessions/cli-sessions.js +152 -42
- package/dist/sessions/cli-sessions.js.map +1 -1
- package/dist/sessions/completions.d.ts +77 -9
- package/dist/sessions/completions.js +482 -45
- package/dist/sessions/completions.js.map +1 -1
- package/dist/sessions/compress.d.ts +8 -0
- package/dist/sessions/compress.js +2 -2
- package/dist/sessions/compress.js.map +1 -1
- package/dist/sessions/drafts.d.ts +14 -10
- package/dist/sessions/drafts.js +38 -43
- package/dist/sessions/drafts.js.map +1 -1
- package/dist/sessions/export.d.ts +5 -0
- package/dist/sessions/export.js +30 -0
- package/dist/sessions/export.js.map +1 -1
- package/dist/sessions/gateway-sessions.d.ts +46 -0
- package/dist/sessions/gateway-sessions.js +378 -0
- package/dist/sessions/gateway-sessions.js.map +1 -0
- package/dist/sessions/gateway-watcher.d.ts +7 -3
- package/dist/sessions/gateway-watcher.js +31 -19
- package/dist/sessions/gateway-watcher.js.map +1 -1
- package/dist/sessions/goals.d.ts +31 -0
- package/dist/sessions/goals.js +75 -0
- package/dist/sessions/goals.js.map +1 -0
- package/dist/sessions/handoff.d.ts +32 -0
- package/dist/sessions/handoff.js +114 -0
- package/dist/sessions/handoff.js.map +1 -0
- package/dist/sessions/journal.d.ts +5 -79
- package/dist/sessions/journal.js +15 -606
- package/dist/sessions/journal.js.map +1 -1
- package/dist/sessions/list.d.ts +31 -16
- package/dist/sessions/list.js +139 -129
- package/dist/sessions/list.js.map +1 -1
- package/dist/sessions/merge.d.ts +69 -13
- package/dist/sessions/merge.js +265 -64
- package/dist/sessions/merge.js.map +1 -1
- package/dist/sessions/notices.d.ts +22 -0
- package/dist/sessions/notices.js +72 -0
- package/dist/sessions/notices.js.map +1 -0
- package/dist/sessions/pending.d.ts +10 -4
- package/dist/sessions/pending.js +83 -7
- package/dist/sessions/pending.js.map +1 -1
- package/dist/sessions/prefix-index.d.ts +82 -0
- package/dist/sessions/prefix-index.js +232 -0
- package/dist/sessions/prefix-index.js.map +1 -0
- package/dist/sessions/recovery.d.ts +19 -0
- package/dist/sessions/recovery.js +322 -0
- package/dist/sessions/recovery.js.map +1 -0
- package/dist/sessions/relay.d.ts +38 -19
- package/dist/sessions/relay.js +302 -79
- package/dist/sessions/relay.js.map +1 -1
- package/dist/sessions/service.d.ts +260 -55
- package/dist/sessions/service.js +1448 -462
- package/dist/sessions/service.js.map +1 -1
- package/dist/sessions/session.d.ts +24 -2
- package/dist/sessions/session.js +69 -7
- package/dist/sessions/session.js.map +1 -1
- package/dist/sessions/shares.d.ts +7 -6
- package/dist/sessions/shares.js +22 -45
- package/dist/sessions/shares.js.map +1 -1
- package/dist/sessions/source-kind.js +1 -0
- package/dist/sessions/source-kind.js.map +1 -1
- package/dist/sessions/state-db-identity.d.ts +18 -0
- package/dist/sessions/state-db-identity.js +67 -0
- package/dist/sessions/state-db-identity.js.map +1 -0
- package/dist/sessions/state-db-worker.d.ts +1 -0
- package/dist/sessions/state-db-worker.js +35 -0
- package/dist/sessions/state-db-worker.js.map +1 -0
- package/dist/sessions/state-db.d.ts +113 -7
- package/dist/sessions/state-db.js +861 -44
- package/dist/sessions/state-db.js.map +1 -1
- package/dist/sessions/storage/backend.d.ts +162 -0
- package/dist/sessions/storage/backend.js +19 -0
- package/dist/sessions/storage/backend.js.map +1 -0
- package/dist/sessions/storage/conformance.d.ts +20 -0
- package/dist/sessions/storage/conformance.js +237 -0
- package/dist/sessions/storage/conformance.js.map +1 -0
- package/dist/sessions/storage/document.d.ts +16 -0
- package/dist/sessions/storage/document.js +44 -0
- package/dist/sessions/storage/document.js.map +1 -0
- package/dist/sessions/storage/json-documents.d.ts +23 -0
- package/dist/sessions/storage/json-documents.js +233 -0
- package/dist/sessions/storage/json-documents.js.map +1 -0
- package/dist/sessions/storage/json-files.d.ts +12 -0
- package/dist/sessions/storage/json-files.js +124 -0
- package/dist/sessions/storage/json-files.js.map +1 -0
- package/dist/sessions/storage/json-installation.d.ts +3 -0
- package/dist/sessions/storage/json-installation.js +31 -0
- package/dist/sessions/storage/json-installation.js.map +1 -0
- package/dist/sessions/storage/json-journal.d.ts +114 -0
- package/dist/sessions/storage/json-journal.js +686 -0
- package/dist/sessions/storage/json-journal.js.map +1 -0
- package/dist/sessions/storage/json-recovery.d.ts +4 -0
- package/dist/sessions/storage/json-recovery.js +195 -0
- package/dist/sessions/storage/json-recovery.js.map +1 -0
- package/dist/sessions/storage/json.d.ts +68 -0
- package/dist/sessions/storage/json.js +258 -0
- package/dist/sessions/storage/json.js.map +1 -0
- package/dist/sessions/storage/row.d.ts +6 -0
- package/dist/sessions/storage/row.js +49 -0
- package/dist/sessions/storage/row.js.map +1 -0
- package/dist/sessions/storage/search-text.d.ts +4 -0
- package/dist/sessions/storage/search-text.js +16 -0
- package/dist/sessions/storage/search-text.js.map +1 -0
- package/dist/sessions/store.d.ts +65 -68
- package/dist/sessions/store.js +305 -602
- package/dist/sessions/store.js.map +1 -1
- package/dist/sessions/streams.d.ts +4 -0
- package/dist/sessions/streams.js +9 -1
- package/dist/sessions/streams.js.map +1 -1
- package/dist/sessions/titles.d.ts +2 -0
- package/dist/sessions/titles.js +5 -1
- package/dist/sessions/titles.js.map +1 -1
- package/dist/sessions/todo.d.ts +5 -0
- package/dist/sessions/todo.js +28 -21
- package/dist/sessions/todo.js.map +1 -1
- package/dist/sessions/tool-display.d.ts +5 -4
- package/dist/sessions/tool-display.js +30 -50
- package/dist/sessions/tool-display.js.map +1 -1
- package/dist/sessions/turn-context.d.ts +11 -2
- package/dist/sessions/turn-context.js +18 -11
- package/dist/sessions/turn-context.js.map +1 -1
- package/dist/sessions/turn.d.ts +122 -17
- package/dist/sessions/turn.js +939 -358
- package/dist/sessions/turn.js.map +1 -1
- package/dist/sessions/wakeup-pause.d.ts +54 -0
- package/dist/sessions/wakeup-pause.js +163 -0
- package/dist/sessions/wakeup-pause.js.map +1 -0
- package/dist/sessions/window.js +13 -12
- package/dist/sessions/window.js.map +1 -1
- package/dist/settings.d.ts +19 -7
- package/dist/settings.js +178 -184
- package/dist/settings.js.map +1 -1
- package/dist/sidecar/client.d.ts +17 -3
- package/dist/sidecar/client.js +78 -8
- package/dist/sidecar/client.js.map +1 -1
- package/dist/sidecar/discover.d.ts +2 -1
- package/dist/sidecar/discover.js +93 -10
- package/dist/sidecar/discover.js.map +1 -1
- package/dist/sidecar/env.d.ts +4 -0
- package/dist/sidecar/env.js +3 -0
- package/dist/sidecar/env.js.map +1 -0
- package/dist/sidecar/fake.d.ts +2 -2
- package/dist/sidecar/fake.js +19 -2
- package/dist/sidecar/fake.js.map +1 -1
- package/dist/startup.d.ts +13 -5
- package/dist/startup.js +48 -0
- package/dist/startup.js.map +1 -1
- package/dist/test/env-file.d.ts +5 -0
- package/dist/test/env-file.js +88 -0
- package/dist/test/env-file.js.map +1 -0
- package/dist/test/harness.d.ts +1 -0
- package/dist/test/harness.js +1 -1
- package/dist/test/harness.js.map +1 -1
- package/dist/test/passkeys.d.ts +22 -0
- package/dist/test/passkeys.js +62 -0
- package/dist/test/passkeys.js.map +1 -0
- package/dist/test/storage.d.ts +15 -0
- package/dist/test/storage.js +26 -0
- package/dist/test/storage.js.map +1 -0
- package/dist/test/ts-worker-hooks.d.ts +1 -0
- package/dist/test/ts-worker-hooks.js +24 -0
- package/dist/test/ts-worker-hooks.js.map +1 -0
- package/dist/text/diff.d.ts +9 -14
- package/dist/text/diff.js +74 -108
- package/dist/text/diff.js.map +1 -1
- package/dist/tools/commands.d.ts +6 -1
- package/dist/tools/commands.js +8 -2
- package/dist/tools/commands.js.map +1 -1
- package/dist/tools/connectors.d.ts +33 -0
- package/dist/tools/connectors.js +121 -0
- package/dist/tools/connectors.js.map +1 -0
- package/dist/tools/crons.d.ts +38 -1
- package/dist/tools/crons.js +122 -18
- package/dist/tools/crons.js.map +1 -1
- package/dist/tools/dashboard-plugins.d.ts +53 -0
- package/dist/tools/dashboard-plugins.js +188 -0
- package/dist/tools/dashboard-plugins.js.map +1 -0
- package/dist/tools/extensions.d.ts +18 -5
- package/dist/tools/extensions.js +344 -266
- package/dist/tools/extensions.js.map +1 -1
- package/dist/tools/gateway-restart.d.ts +62 -0
- package/dist/tools/gateway-restart.js +142 -0
- package/dist/tools/gateway-restart.js.map +1 -0
- package/dist/tools/health.d.ts +44 -0
- package/dist/tools/health.js +201 -46
- package/dist/tools/health.js.map +1 -1
- package/dist/tools/hygiene.d.ts +4 -3
- package/dist/tools/hygiene.js +23 -9
- package/dist/tools/hygiene.js.map +1 -1
- package/dist/tools/kanban.d.ts +4 -2
- package/dist/tools/kanban.js +28 -19
- package/dist/tools/kanban.js.map +1 -1
- package/dist/tools/mcp.d.ts +13 -0
- package/dist/tools/mcp.js +88 -0
- package/dist/tools/mcp.js.map +1 -1
- package/dist/tools/memory-masks.d.ts +5 -0
- package/dist/tools/memory-masks.js +256 -0
- package/dist/tools/memory-masks.js.map +1 -0
- package/dist/tools/memory.d.ts +29 -3
- package/dist/tools/memory.js +69 -27
- package/dist/tools/memory.js.map +1 -1
- package/dist/tools/plugin-settings.d.ts +15 -0
- package/dist/tools/plugin-settings.js +90 -0
- package/dist/tools/plugin-settings.js.map +1 -0
- package/dist/tools/project-os.d.ts +11 -0
- package/dist/tools/project-os.js +267 -0
- package/dist/tools/project-os.js.map +1 -0
- package/dist/tools/skills.d.ts +14 -5
- package/dist/tools/skills.js +49 -16
- package/dist/tools/skills.js.map +1 -1
- package/dist/tools/update-notifications.d.ts +34 -15
- package/dist/tools/update-notifications.js +141 -57
- package/dist/tools/update-notifications.js.map +1 -1
- package/dist/tools/update-rollback.d.ts +11 -0
- package/dist/tools/update-rollback.js +28 -0
- package/dist/tools/update-rollback.js.map +1 -0
- package/dist/tools/updates.d.ts +110 -32
- package/dist/tools/updates.js +1112 -294
- package/dist/tools/updates.js.map +1 -1
- package/dist/tools/wiki.d.ts +68 -0
- package/dist/tools/wiki.js +413 -0
- package/dist/tools/wiki.js.map +1 -0
- package/dist/util.d.ts +2 -0
- package/dist/util.js +5 -0
- package/dist/util.js.map +1 -1
- package/dist/workspace/escape.d.ts +61 -0
- package/dist/workspace/escape.js +149 -0
- package/dist/workspace/escape.js.map +1 -0
- package/dist/workspace/extract.d.ts +22 -0
- package/dist/workspace/extract.js +308 -0
- package/dist/workspace/extract.js.map +1 -0
- package/dist/workspace/fs.d.ts +12 -0
- package/dist/workspace/fs.js +92 -23
- package/dist/workspace/fs.js.map +1 -1
- package/dist/workspace/git.d.ts +34 -1
- package/dist/workspace/git.js +328 -35
- package/dist/workspace/git.js.map +1 -1
- package/dist/workspace/media.d.ts +16 -13
- package/dist/workspace/media.js +43 -61
- package/dist/workspace/media.js.map +1 -1
- package/dist/workspace/rollback.d.ts +36 -22
- package/dist/workspace/rollback.js +178 -272
- package/dist/workspace/rollback.js.map +1 -1
- package/dist/workspace/unzip.js +4 -1
- package/dist/workspace/unzip.js.map +1 -1
- package/dist/workspace/upload.d.ts +7 -4
- package/dist/workspace/upload.js +5 -2
- package/dist/workspace/upload.js.map +1 -1
- package/dist/workspace/workspaces.d.ts +15 -19
- package/dist/workspace/workspaces.js +55 -127
- package/dist/workspace/workspaces.js.map +1 -1
- package/dist/workspace/worktrees.d.ts +2 -1
- package/dist/workspace/worktrees.js +179 -42
- package/dist/workspace/worktrees.js.map +1 -1
- package/package.json +7 -3
- package/sidecar/agent_dependency.json +4 -4
- package/sidecar/agent_support.json +26 -0
- package/sidecar/scripts/record-fixtures.py +12 -3
- package/sidecar/scripts/replay_sidecar.py +32 -0
- package/sidecar/scripts/suite_runner.py +302 -0
- package/sidecar/scripts/test.sh +12 -4
- package/sidecar/talaria_sidecar/__init__.py +6 -1
- package/sidecar/talaria_sidecar/__main__.py +4 -2
- package/sidecar/talaria_sidecar/agent_mutation.py +975 -0
- package/sidecar/talaria_sidecar/agent_services.py +1053 -0
- package/sidecar/talaria_sidecar/dependency_sync.py +85 -0
- package/sidecar/talaria_sidecar/home.py +56 -3
- package/sidecar/talaria_sidecar/methods/__init__.py +2 -2
- package/sidecar/talaria_sidecar/methods/aux.py +166 -24
- package/sidecar/talaria_sidecar/methods/chat.py +852 -135
- package/sidecar/talaria_sidecar/methods/checkpoints.py +89 -0
- package/sidecar/talaria_sidecar/methods/commands.py +294 -4
- package/sidecar/talaria_sidecar/methods/config.py +123 -4
- package/sidecar/talaria_sidecar/methods/connectors.py +343 -0
- package/sidecar/talaria_sidecar/methods/cron.py +395 -36
- package/sidecar/talaria_sidecar/methods/cron_execution.py +284 -0
- package/sidecar/talaria_sidecar/methods/gateway.py +212 -55
- package/sidecar/talaria_sidecar/methods/gateway_sessions.py +234 -0
- package/sidecar/talaria_sidecar/methods/goals.py +81 -41
- package/sidecar/talaria_sidecar/methods/kanban.py +108 -34
- package/sidecar/talaria_sidecar/methods/mcp.py +1 -1
- package/sidecar/talaria_sidecar/methods/memory.py +84 -0
- package/sidecar/talaria_sidecar/methods/oauth.py +5 -2
- package/sidecar/talaria_sidecar/methods/process.py +218 -15
- package/sidecar/talaria_sidecar/methods/profiles.py +121 -13
- package/sidecar/talaria_sidecar/methods/providers.py +217 -28
- package/sidecar/talaria_sidecar/methods/runtime.py +69 -1
- package/sidecar/talaria_sidecar/methods/skills.py +67 -4
- package/sidecar/talaria_sidecar/methods/state_db.py +316 -75
- package/sidecar/talaria_sidecar/methods/stt.py +159 -78
- package/sidecar/talaria_sidecar/methods/text.py +14 -1
- package/sidecar/talaria_sidecar/methods/toolsets.py +49 -0
- package/sidecar/talaria_sidecar/methods/usage.py +113 -14
- package/sidecar/talaria_sidecar/methods/worktree.py +26 -19
- package/sidecar/talaria_sidecar/methods/write_approval.py +181 -0
- package/sidecar/talaria_sidecar/rpc.py +45 -4
- package/sidecar/talaria_sidecar/runtime.py +98 -13
- package/sidecar/talaria_sidecar/speed.py +35 -0
- package/static/dist/FILES.txt +126 -126
- package/static/dist/assets/AppShell-cey33v9s.js +8 -0
- package/static/dist/assets/ChatPage-i8wnugr7.js +18 -0
- package/static/dist/assets/ConnectTargets-hg19553x.js +1 -0
- package/static/dist/assets/ExtensionRoute-cly4apm5.js +1 -0
- package/static/dist/assets/Field-j8uqoigz.js +9 -0
- package/static/dist/assets/HubRoute-e4bgz41j.js +2 -0
- package/static/dist/assets/Markdown-lahuichm.js +598 -0
- package/static/dist/assets/RightPanel-lbo4i0fn.js +1 -0
- package/static/dist/assets/Select-gqatm2e0.js +1 -0
- package/static/dist/assets/SessionListPanel-mfqayfjh.js +1 -0
- package/static/dist/assets/SettingsLayout-b8980u7k.js +1 -0
- package/static/dist/assets/States-e7dkgtxf.js +1 -0
- package/static/dist/assets/Toaster-bfqqy786.js +1 -0
- package/static/dist/assets/_app-n1n6pfx1.js +1 -0
- package/static/dist/assets/{_app.ext._extensionId-opyh9y0v.js → _app.ext._extensionId-buxjxav3.js} +1 -1
- package/static/dist/assets/_app.index-jt8zwiu2.js +1 -0
- package/static/dist/assets/_app.insights-cv76ml71.js +1 -0
- package/static/dist/assets/_app.kanban-h6ts53j7.js +1 -0
- package/static/dist/assets/_app.logs-dm873z90.js +1 -0
- package/static/dist/assets/_app.memory-glk5y6m8.js +1 -0
- package/static/dist/assets/_app.profiles-ka6zpstq.js +1 -0
- package/static/dist/assets/{_app.session._sessionId-bfd4h3id.js → _app.session._sessionId-g2vzghvc.js} +1 -1
- package/static/dist/assets/_app.settings-hgjdhzcd.js +1 -0
- package/static/dist/assets/_app.settings._section-jf2kmhae.js +3 -0
- package/static/dist/assets/_app.skills-cii852yq.js +1 -0
- package/static/dist/assets/_app.tasks-fp9q7atm.js +1 -0
- package/static/dist/assets/_app.todos-dw94qzue.js +1 -0
- package/static/dist/assets/_app.workspaces-inyygzze.js +1 -0
- package/static/dist/assets/{abnfDiagram-VCTEODGH-b2x1lqot.js → abnfDiagram-VCTEODGH-gjayq3ra.js} +1 -1
- package/static/dist/assets/architecture-7GRP2DOG-lp56972r.js +1 -0
- package/static/dist/assets/{architectureDiagram-5GKGNRK7-h38o5l7b.js → architectureDiagram-5GKGNRK7-nwb3xovn.js} +1 -1
- package/static/dist/assets/archive-b1j004vn.js +1 -0
- package/static/dist/assets/back-g74gkozu.js +1 -0
- package/static/dist/assets/{blockDiagram-I7D4REHJ-bqquxv2u.js → blockDiagram-I7D4REHJ-joedghi3.js} +1 -1
- package/static/dist/assets/{c4Diagram-7LVT6UL2-f3fb8w6z.js → c4Diagram-7LVT6UL2-hyrjrohe.js} +1 -1
- package/static/dist/assets/channel-es95o4y8.js +1 -0
- package/static/dist/assets/{chunk-4HAMMTFA-bzfyyzp3.js → chunk-4HAMMTFA-koouqbut.js} +1 -1
- package/static/dist/assets/{chunk-75Z2AOVW-ly99rfx5.js → chunk-75Z2AOVW-bl4bhdnt.js} +1 -1
- package/static/dist/assets/{chunk-DU6HZSFF-bg6ecfqf.js → chunk-DU6HZSFF-gpedttsp.js} +3 -3
- package/static/dist/assets/{chunk-F27PBJKO-e8k7mmqw.js → chunk-F27PBJKO-d8xxi0zi.js} +1 -1
- package/static/dist/assets/{chunk-GMAD6QVW-cmalnoaj.js → chunk-GMAD6QVW-jro0hl73.js} +1 -1
- package/static/dist/assets/{chunk-GVQU2GXP-gmif5o01.js → chunk-GVQU2GXP-djn6gbyu.js} +1 -1
- package/static/dist/assets/{chunk-IMKFNOWR-f1nwwh6u.js → chunk-IMKFNOWR-vw4p5p7o.js} +1 -1
- package/static/dist/assets/{chunk-L3NEJ4N5-oktfh5v7.js → chunk-L3NEJ4N5-n1hj77q8.js} +1 -1
- package/static/dist/assets/{chunk-OSK3NFVY-b1sdx96z.js → chunk-OSK3NFVY-oy0gwn2n.js} +1 -1
- package/static/dist/assets/{chunk-P2QGCYS3-fhu4nzxt.js → chunk-P2QGCYS3-onf1hz6c.js} +1 -1
- package/static/dist/assets/{chunk-POPQ4Y6H-em31rnef.js → chunk-POPQ4Y6H-m8sqn7cs.js} +1 -1
- package/static/dist/assets/{chunk-PWAF6VOD-bxhhyftw.js → chunk-PWAF6VOD-ek4smc8x.js} +1 -1
- package/static/dist/assets/{chunk-SHT3W25Y-fmrvwcav.js → chunk-SHT3W25Y-g9gfvefo.js} +3 -3
- package/static/dist/assets/{chunk-SVP7TREG-lymukl2j.js → chunk-SVP7TREG-f9nfv2cu.js} +1 -1
- package/static/dist/assets/{chunk-TICWLB2K-lmza6k23.js → chunk-TICWLB2K-bnk3m1mq.js} +1 -1
- package/static/dist/assets/classDiagram-ZZMXUADV-kmihoqxh.js +1 -0
- package/static/dist/assets/classDiagram-v2-VYDZK3BY-kmihoqxh.js +1 -0
- package/static/dist/assets/copied-bli9tbcx.js +1 -0
- package/static/dist/assets/{copy-fw5b1pc6.js → copy-jamtd1pf.js} +1 -1
- package/static/dist/assets/{cynefin-OW5HDTMX-czlhbyhs.js → cynefin-OW5HDTMX-f8xfdd3f.js} +1 -1
- package/static/dist/assets/{cynefinDiagram-5FMLGOSQ-gq7mvswb.js → cynefinDiagram-5FMLGOSQ-n9lb99h9.js} +1 -1
- package/static/dist/assets/{dagre-GXQ25YYZ-cqdbf7dr.js → dagre-GXQ25YYZ-dgailddi.js} +4 -4
- package/static/dist/assets/{diagram-S7CK7UJ4-o6arxa58.js → diagram-S7CK7UJ4-m6aeoe7c.js} +1 -1
- package/static/dist/assets/{diagram-UQ7AKVKN-nhnd68tz.js → diagram-UQ7AKVKN-jall3j0x.js} +1 -1
- package/static/dist/assets/{diagram-VSXAHHWV-dk2sclzn.js → diagram-VSXAHHWV-hbawi7hn.js} +1 -1
- package/static/dist/assets/{diagram-VX7I27RA-n3k5nyx3.js → diagram-VX7I27RA-hendl2tt.js} +1 -1
- package/static/dist/assets/{diagram-Z3DM3KII-m6q9cwdh.js → diagram-Z3DM3KII-igwc35p3.js} +1 -1
- package/static/dist/assets/{ebnfDiagram-PWID7BFC-lsa5641p.js → ebnfDiagram-PWID7BFC-c64knz08.js} +1 -1
- package/static/dist/assets/{erDiagram-RLTQ6QDP-fo2ckbe6.js → erDiagram-RLTQ6QDP-brdu9lcm.js} +1 -1
- package/static/dist/assets/eventmodeling-NTZA5JFV-njk1j8wl.js +1 -0
- package/static/dist/assets/flowDiagram-HODETNUW-nma6f0ga.js +1 -0
- package/static/dist/assets/folder-plus-lvt9kudb.js +1 -0
- package/static/dist/assets/{ganttDiagram-EL5Y4UJY-nzqz6x9g.js → ganttDiagram-EL5Y4UJY-ma6jxj5i.js} +1 -1
- package/static/dist/assets/{gitGraph-4MIJSDKK-gukvcxe6.js → gitGraph-4MIJSDKK-naa9w6xa.js} +1 -1
- package/static/dist/assets/{gitGraphDiagram-WWUBYQGX-lqhdp8f0.js → gitGraphDiagram-WWUBYQGX-hzltvsod.js} +1 -1
- package/static/dist/assets/{highlighted-body-KPVGNVTW-igw6cp39.js → highlighted-body-KPVGNVTW-ghoavj8d.js} +1 -1
- package/static/dist/assets/host-hzm8n85n.js +1 -0
- package/static/dist/assets/index-drdcaqeq.css +2 -0
- package/static/dist/assets/index-jzm844he.js +11 -0
- package/static/dist/assets/{info-A6RAGUB7-gvu7a93l.js → info-A6RAGUB7-mn2ut5ko.js} +1 -1
- package/static/dist/assets/{infoDiagram-27XIBGKW-m8t8g6w1.js → infoDiagram-27XIBGKW-h6kuqvsb.js} +1 -1
- package/static/dist/assets/{ishikawaDiagram-5VMMS53U-l07vkbgj.js → ishikawaDiagram-5VMMS53U-e7bnwq7h.js} +1 -1
- package/static/dist/assets/{journeyDiagram-3NMN7TZE-hybkgj8l.js → journeyDiagram-3NMN7TZE-etd1bi6p.js} +1 -1
- package/static/dist/assets/{kanban-definition-UXKFOSKX-by13uvtn.js → kanban-definition-UXKFOSKX-emb1g9dz.js} +4 -4
- package/static/dist/assets/lazyRouteComponent-o816ytzl.js +1 -0
- package/static/dist/assets/{line-osxq6fq7.js → line-h0ojzsvs.js} +1 -1
- package/static/dist/assets/link-k01ryaf9.js +1 -0
- package/static/dist/assets/login-bsae49ew.js +1 -0
- package/static/dist/assets/mermaid-HWGCJPDP-ihl34s74.js +1 -0
- package/static/dist/assets/{mermaid-parser.core-i91oxmou.js → mermaid-parser.core-bnre27u8.js} +3 -3
- package/static/dist/assets/{mindmap-definition-YA3MSWOX-m82mx8ww.js → mindmap-definition-YA3MSWOX-o1vathns.js} +1 -1
- package/static/dist/assets/onboarding-c65tysya.js +1 -0
- package/static/dist/assets/onboarding_model_label-gpn28uix.js +1 -0
- package/static/dist/assets/{packet-AYTQ26CC-nbtgge2o.js → packet-AYTQ26CC-hatq7m2e.js} +1 -1
- package/static/dist/assets/pcmTap.worklet-74EKjWAZ.js +1 -0
- package/static/dist/assets/{pegDiagram-XKGWAZYB-f1zxzga1.js → pegDiagram-XKGWAZYB-gwisz8jv.js} +1 -1
- package/static/dist/assets/{pie-WAS4IAKB-of8vuhxs.js → pie-WAS4IAKB-fpftf0mk.js} +1 -1
- package/static/dist/assets/{pieDiagram-E7YTZNPT-o7y8ftio.js → pieDiagram-E7YTZNPT-khm1o9a6.js} +1 -1
- package/static/dist/assets/{quadrantDiagram-AXDQQJYC-iqiwia1t.js → quadrantDiagram-AXDQQJYC-owqc4uqn.js} +1 -1
- package/static/dist/assets/{radar-RG4KPBEZ-delnsy2v.js → radar-RG4KPBEZ-cntfwjpq.js} +1 -1
- package/static/dist/assets/{railroad-74A4TZTK-nspnyq9u.js → railroad-74A4TZTK-a7t5eibp.js} +1 -1
- package/static/dist/assets/railroad-abnf-HS5TGJTU-ol8cdktf.js +1 -0
- package/static/dist/assets/railroad-ebnf-LZEXJU2U-i8vzd429.js +1 -0
- package/static/dist/assets/railroad-peg-WCYAUIDC-nw3ulewz.js +1 -0
- package/static/dist/assets/{railroadDiagram-O6MQD6OU-z41tqx5z.js → railroadDiagram-O6MQD6OU-etuh0qa0.js} +1 -1
- package/static/dist/assets/{refresh-cw-nt1dtsx4.js → refresh-cw-mqbkv2a3.js} +1 -1
- package/static/dist/assets/refresh-l29ljp76.js +1 -0
- package/static/dist/assets/{requirementDiagram-BXWQKSXE-bdvif194.js → requirementDiagram-BXWQKSXE-oq2ulk22.js} +1 -1
- package/static/dist/assets/{sankeyDiagram-P5KCCOFB-h73e0rol.js → sankeyDiagram-P5KCCOFB-iqc02emv.js} +1 -1
- package/static/dist/assets/saved-ndd4t2xb.js +1 -0
- package/static/dist/assets/{sequenceDiagram-WJ2MYXX4-iv95mb1z.js → sequenceDiagram-WJ2MYXX4-i0v116q0.js} +2 -2
- package/static/dist/assets/settings_section_extensions_title-jhfo6o8z.js +1 -0
- package/static/dist/assets/share._token-c1ri0hy1.js +2 -0
- package/static/dist/assets/sliders-horizontal-j3jjt9tv.js +1 -0
- package/static/dist/assets/{stateDiagram-D77RDMKH-k417ixmf.js → stateDiagram-D77RDMKH-dnpt1ato.js} +1 -1
- package/static/dist/assets/stateDiagram-v2-MP3YSRHH-bxjacpk6.js +1 -0
- package/static/dist/assets/{swimlanes-42K2YHIH-esola70w.js → swimlanes-42K2YHIH-loqbdazb.js} +1 -1
- package/static/dist/assets/swimlanesDiagram-VR7AAH4N-id62p9hz.js +8 -0
- package/static/dist/assets/{timeline-definition-24CTP7MA-getrz2y8.js → timeline-definition-24CTP7MA-ol2hnvma.js} +1 -1
- package/static/dist/assets/toast-i3h34v6o.js +64 -0
- package/static/dist/assets/{treeView-Q6P3EWNA-hc7ap1q7.js → treeView-Q6P3EWNA-idrj6iox.js} +1 -1
- package/static/dist/assets/{treemap-WGGIJYW6-b7k1syy5.js → treemap-WGGIJYW6-lzr49vv5.js} +1 -1
- package/static/dist/assets/untitled-oaoya4qj.js +1 -0
- package/static/dist/assets/useForm-nfaxgmsk.js +1 -0
- package/static/dist/assets/{useParams-lhg566ew.js → useParams-gjc70qru.js} +1 -1
- package/static/dist/assets/{useSearch-lbrh6ejn.js → useSearch-e6ae539u.js} +1 -1
- package/static/dist/assets/{vennDiagram-4TSXK5OY-n6pcy5qb.js → vennDiagram-4TSXK5OY-bvwr9o2z.js} +1 -1
- package/static/dist/assets/{wardley-WFR3VGLG-lpa18vz1.js → wardley-WFR3VGLG-31ui8tma.js} +1 -1
- package/static/dist/assets/{wardleyDiagram-VM6X3IG4-kpclwwg7.js → wardleyDiagram-VM6X3IG4-k5wqtx4b.js} +1 -1
- package/static/dist/assets/{xychartDiagram-S5SC5T6Z-paa2n8y0.js → xychartDiagram-S5SC5T6Z-aqbgvujg.js} +1 -1
- package/static/dist/index.html +1 -1
- package/static/dist/sw.js +1 -1
- package/static/dist/assets/AppShell-fb2td9zi.js +0 -1
- package/static/dist/assets/ChatPage-cj96kiy9.js +0 -25
- package/static/dist/assets/Dialog-kxcg7ard.js +0 -1
- package/static/dist/assets/ExtensionRoute-jf7h0754.js +0 -1
- package/static/dist/assets/HubRoute-gmanpd5y.js +0 -2
- package/static/dist/assets/Markdown-mdwlvj3w.js +0 -598
- package/static/dist/assets/RightPanel-ftvrjlcp.js +0 -1
- package/static/dist/assets/Select-bilaypej.js +0 -1
- package/static/dist/assets/SessionListPanel-og8n36qs.js +0 -1
- package/static/dist/assets/SettingsLayout-jonjefmj.js +0 -1
- package/static/dist/assets/States-nmejrwrm.js +0 -1
- package/static/dist/assets/Toaster-nnl8zkt9.js +0 -1
- package/static/dist/assets/_app-gdidzd94.js +0 -1
- package/static/dist/assets/_app.index-hbarzbjx.js +0 -1
- package/static/dist/assets/_app.insights-luywlarz.js +0 -1
- package/static/dist/assets/_app.kanban-kincnbr8.js +0 -1
- package/static/dist/assets/_app.logs-oi2gr3gs.js +0 -1
- package/static/dist/assets/_app.memory-b6jfivt6.js +0 -1
- package/static/dist/assets/_app.profiles-lpvixmqp.js +0 -1
- package/static/dist/assets/_app.settings-vowx3iq0.js +0 -1
- package/static/dist/assets/_app.settings._section-cnntg1tu.js +0 -3
- package/static/dist/assets/_app.skills-fb57lpau.js +0 -1
- package/static/dist/assets/_app.tasks-eszpx1q7.js +0 -2
- package/static/dist/assets/_app.todos-nr05ac6w.js +0 -1
- package/static/dist/assets/_app.workspaces-d2luomu6.js +0 -1
- package/static/dist/assets/architecture-7GRP2DOG-hd0o7bde.js +0 -1
- package/static/dist/assets/back-bemaer09.js +0 -1
- package/static/dist/assets/cancel-drd0g6d9.js +0 -1
- package/static/dist/assets/channel-cpdgf867.js +0 -1
- package/static/dist/assets/classDiagram-ZZMXUADV-ko09sguk.js +0 -1
- package/static/dist/assets/classDiagram-v2-VYDZK3BY-ko09sguk.js +0 -1
- package/static/dist/assets/copied-ima3pysb.js +0 -1
- package/static/dist/assets/endpoints-d33siokx.js +0 -64
- package/static/dist/assets/eventmodeling-NTZA5JFV-emctlo64.js +0 -1
- package/static/dist/assets/flowDiagram-HODETNUW-bfi3moqa.js +0 -1
- package/static/dist/assets/index-cxq58xb1.js +0 -11
- package/static/dist/assets/index-hgtx08n5.css +0 -2
- package/static/dist/assets/lazyRouteComponent-af0lvgjx.js +0 -1
- package/static/dist/assets/link-jyxicdhg.js +0 -1
- package/static/dist/assets/login-ec21t39x.js +0 -1
- package/static/dist/assets/mermaid-HWGCJPDP-gfl8z3ep.js +0 -1
- package/static/dist/assets/onboarding-btnltvyz.js +0 -1
- package/static/dist/assets/onboarding_model_label-dp7xffoh.js +0 -1
- package/static/dist/assets/railroad-abnf-HS5TGJTU-nst1qxyn.js +0 -1
- package/static/dist/assets/railroad-ebnf-LZEXJU2U-ci37x8qy.js +0 -1
- package/static/dist/assets/railroad-peg-WCYAUIDC-aimkk07z.js +0 -1
- package/static/dist/assets/refresh-b4uams1i.js +0 -1
- package/static/dist/assets/saved-kg52csy7.js +0 -1
- package/static/dist/assets/settings_section_extensions_title-ej0iapxe.js +0 -1
- package/static/dist/assets/share._token-f97e94r0.js +0 -2
- package/static/dist/assets/sliders-horizontal-fj18it47.js +0 -1
- package/static/dist/assets/sse-fwpqtzbg.js +0 -1
- package/static/dist/assets/stateDiagram-v2-MP3YSRHH-hwn4apct.js +0 -1
- package/static/dist/assets/swimlanesDiagram-VR7AAH4N-d1h97oyg.js +0 -8
- package/static/dist/assets/todoStore-eginf9h4.js +0 -1
- package/static/dist/assets/tts-lxdxnmjd.js +0 -1
- package/static/dist/assets/untitled-ovpfthg4.js +0 -1
- package/static/dist/assets/useForm-bcblv1rx.js +0 -1
- package/static/dist/assets/useLocale-fi5jb8ma.js +0 -1
package/dist/sessions/merge.js
CHANGED
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
* `_extract_tool_calls_from_messages`, `_build_partial_message`).
|
|
5
5
|
*/
|
|
6
6
|
import { buildActiveTurnToken, completedToolIndex } from '../redact.js';
|
|
7
|
-
import {
|
|
7
|
+
import { selectAuthoritativeTerminalEvent } from './journal.js';
|
|
8
8
|
import { str } from '../util.js';
|
|
9
|
-
import {
|
|
9
|
+
import { stateDbMessageKey, stateDbMessageFingerprint, stateDbRowId, stateDbIdentityKeys, stateDbMessageRepresented } from './state-db-identity.js';
|
|
10
|
+
import { stripAttachedFilesMarker, stripWorkspacePrefix } from './session.js';
|
|
11
|
+
export { WORKSPACE_PREFIX_RE, stripWorkspacePrefix } from './session.js';
|
|
10
12
|
import { decidedEditDiff, toolEditDiff, toolName } from './tool-display.js';
|
|
11
|
-
|
|
12
|
-
const LEGACY_WORKSPACE_PREFIX_RE = /^\s*\[Workspace:[^\]]+\]\s*/;
|
|
13
|
+
import { sourceKind } from './source-kind.js';
|
|
13
14
|
const TOOL_RESULT_SNIPPET_MAX = 4000;
|
|
14
15
|
// Python `_TOOL_ARG_CONTENT_KEYS`: file bodies, commands, and patch text keep up to the content cap; incidental args cut at 120.
|
|
15
16
|
export const TOOL_ARG_CONTENT_KEYS = new Set(['command', 'cmd', 'script', 'code', 'patch', 'diff', 'old_string', 'new_string', 'content', 'path', 'file_path']);
|
|
@@ -18,16 +19,6 @@ export const isDict = (v) => Boolean(v) && typeof v === 'object' && !Array.isArr
|
|
|
18
19
|
export function escapeWorkspacePrefixPath(path) {
|
|
19
20
|
return path.replace(/\\/g, '\\\\').replace(/]/g, '\\]');
|
|
20
21
|
}
|
|
21
|
-
export function workspaceContextPrefix(path) {
|
|
22
|
-
return `[Workspace::v1: ${escapeWorkspacePrefixPath(path)}]\n`;
|
|
23
|
-
}
|
|
24
|
-
export function stripWorkspacePrefix(text, includeLegacy = false) {
|
|
25
|
-
const value = str(text);
|
|
26
|
-
let stripped = value.replace(WORKSPACE_PREFIX_RE, '');
|
|
27
|
-
if (includeLegacy && stripped === value)
|
|
28
|
-
stripped = value.replace(LEGACY_WORKSPACE_PREFIX_RE, '');
|
|
29
|
-
return stripped.trim();
|
|
30
|
-
}
|
|
31
22
|
/** Python `_message_text`: flatten string or multimodal content to text. */
|
|
32
23
|
export function isReasoningBlock(part) {
|
|
33
24
|
return part.type === 'reasoning' || part.type === 'thinking';
|
|
@@ -57,11 +48,33 @@ export function messageText(content) {
|
|
|
57
48
|
}
|
|
58
49
|
return str(content);
|
|
59
50
|
}
|
|
51
|
+
/** Agent-injected memory is model context, never typed user text. Match the Agent's fence, including an unclosed tail. */
|
|
52
|
+
function withoutMemoryContext(text) {
|
|
53
|
+
const stripped = text.replace(/(?:\r?\n)?<memory-context>[\s\S]*?(?:<\/memory-context>|$)/gi, '');
|
|
54
|
+
// Remove the fence's line separator, not the prompt's indentation or trailing whitespace.
|
|
55
|
+
return stripped !== text && !stripped.trim() ? '' : stripped;
|
|
56
|
+
}
|
|
57
|
+
/** Display-only user projection shared by transcript hydration and turn identity; model history stays untouched. */
|
|
58
|
+
export function normalizeUserDisplay(message) {
|
|
59
|
+
if (!isDict(message) || message.role !== 'user')
|
|
60
|
+
return message;
|
|
61
|
+
const content = message.content;
|
|
62
|
+
if (typeof content === 'string')
|
|
63
|
+
return { ...message, content: withoutMemoryContext(content) };
|
|
64
|
+
if (!Array.isArray(content))
|
|
65
|
+
return message;
|
|
66
|
+
return { ...message, content: content.flatMap((part) => {
|
|
67
|
+
if (!isDict(part) || part.type !== 'text' || typeof part.text !== 'string')
|
|
68
|
+
return [part];
|
|
69
|
+
const text = withoutMemoryContext(part.text);
|
|
70
|
+
return text === part.text ? [part] : text ? [{ ...part, text }] : [];
|
|
71
|
+
}) };
|
|
72
|
+
}
|
|
60
73
|
export function messageIdentity(msg, textLimit = 500) {
|
|
61
74
|
if (!isDict(msg))
|
|
62
75
|
return null;
|
|
63
76
|
const role = str(msg.role);
|
|
64
|
-
let text = messageText(msg.content);
|
|
77
|
+
let text = messageText(normalizeUserDisplay(msg).content);
|
|
65
78
|
if (role === 'user') {
|
|
66
79
|
const typed = userPromptText(text);
|
|
67
80
|
// An attachment-only prompt has no typed text; its whole attached-files line (never truncated) tells one such turn
|
|
@@ -121,15 +134,77 @@ export function markerKind(msg) {
|
|
|
121
134
|
export function isContextCompressionMarker(msg) {
|
|
122
135
|
return markerKind(msg) === 'context_compaction';
|
|
123
136
|
}
|
|
137
|
+
// The Agent's failed-turn boundary copy (`agent/turn_failure_copy.py`): an older row carries it without its kind.
|
|
138
|
+
const FAILED_TURN_NOTICES = new Set([
|
|
139
|
+
'Your request was not processed. Send it again if you still want me to carry it out.',
|
|
140
|
+
'This turn did not complete. Some actions may already have run; verify their effects before resending.',
|
|
141
|
+
]);
|
|
142
|
+
/**
|
|
143
|
+
* TAL-815: rows the Agent writes outside the conversation, by its `display_kind` and its own read-side rules.
|
|
144
|
+
* `failed_turn`: the assistant boundary closing a turn that failed, never the model's reply. `hidden`: a row the Agent
|
|
145
|
+
* never renders, such as the empty interrupt placeholder or an untyped `[System:` scaffold notice in a user row.
|
|
146
|
+
*/
|
|
147
|
+
export function agentRowKind(msg) {
|
|
148
|
+
if (!isDict(msg))
|
|
149
|
+
return null;
|
|
150
|
+
if (msg.display_kind === 'hidden')
|
|
151
|
+
return 'hidden';
|
|
152
|
+
if (msg.role === 'assistant' && (msg.display_kind === 'failed_turn' || (!msg.display_kind && typeof msg.content === 'string' && FAILED_TURN_NOTICES.has(msg.content.trim()))))
|
|
153
|
+
return 'failed_turn';
|
|
154
|
+
return msg.role === 'user' && !msg.display_kind && typeof msg.content === 'string' && msg.content.trimStart().startsWith('[System:') ? 'hidden' : null;
|
|
155
|
+
}
|
|
156
|
+
const DELIVERY_PREFIXES = [['webhook', '[Webhook delivery: '], ['cron', '[Cron delivery: ']];
|
|
157
|
+
/**
|
|
158
|
+
* TAL-816: the user row the Agent's gateway mirrors into a chat's transcript after a webhook or cron delivery
|
|
159
|
+
* (`gateway/mirror.py` callers): exactly `[Webhook delivery: <route>]` or `[Cron delivery: <job>]`, a newline, then the
|
|
160
|
+
* delivered text. Only meaningful in a messaging session; anyone can type the same prefix elsewhere.
|
|
161
|
+
*/
|
|
162
|
+
export function deliveryNotice(msg) {
|
|
163
|
+
if (!isDict(msg) || msg.role !== 'user' || typeof msg.content !== 'string')
|
|
164
|
+
return null;
|
|
165
|
+
const newline = msg.content.indexOf('\n');
|
|
166
|
+
const label = newline < 0 ? '' : msg.content.slice(0, newline);
|
|
167
|
+
const match = DELIVERY_PREFIXES.find(([, prefix]) => label.startsWith(prefix));
|
|
168
|
+
if (!match || !label.endsWith(']') || label.length <= match[1].length + 1)
|
|
169
|
+
return null;
|
|
170
|
+
return { kind: match[0], name: label.slice(match[1].length, -1), body: msg.content.slice(newline + 1) };
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* TAL-816: `session`'s rows for a copy that is no longer a messaging session (duplicate, branch), each mirrored delivery
|
|
174
|
+
* marked with the Agent's own mirror metadata (`mirror_source`, which it drops at the SQLite boundary) so the copy still
|
|
175
|
+
* shows it as a delivery. Returns copies; stored rows are untouched.
|
|
176
|
+
*/
|
|
177
|
+
export function withMirrorSources(messages, session) {
|
|
178
|
+
if (sourceKind(session) !== 'messaging')
|
|
179
|
+
return messages;
|
|
180
|
+
return messages.map((m) => {
|
|
181
|
+
const delivery = deliveryNotice(m);
|
|
182
|
+
return delivery ? { ...m, mirror_source: delivery.kind } : m;
|
|
183
|
+
});
|
|
184
|
+
}
|
|
124
185
|
/**
|
|
125
186
|
* TAL-305: stamps `_marker_kind` on marker rows, and `_marker_body` (the list without its marker line) on a preserved
|
|
126
|
-
* task list, so clients render a marker card instead of a message.
|
|
187
|
+
* task list, so clients render a marker card instead of a message. TAL-815: a failed turn's boundary gets
|
|
188
|
+
* `_notice_kind`, unless the turn (`_turn_id`) already carries Web's own error row; that copy and every other row the
|
|
189
|
+
* Agent hides leave as `display_kind: 'hidden'`. TAL-816: a mirrored delivery in a messaging `session`, or one a copy
|
|
190
|
+
* marked with its `mirror_source`, gets `_delivery`. Returns copies; stored rows are untouched.
|
|
127
191
|
*/
|
|
128
|
-
export function withMarkerKinds(messages) {
|
|
192
|
+
export function withMarkerKinds(messages, session) {
|
|
193
|
+
const erroredTurns = new Set(messages.flatMap((m) => (isDict(m) && m._error ? [str(m._turn_id)] : [])));
|
|
194
|
+
const messaging = sourceKind(session) === 'messaging';
|
|
129
195
|
return messages.map((m) => {
|
|
130
|
-
|
|
131
|
-
if (!kind || !isDict(m))
|
|
196
|
+
if (!isDict(m))
|
|
132
197
|
return m;
|
|
198
|
+
const delivery = deliveryNotice(m);
|
|
199
|
+
if (delivery && (messaging || m.mirror_source === delivery.kind))
|
|
200
|
+
return { ...m, _delivery: delivery };
|
|
201
|
+
const kind = markerKind(m);
|
|
202
|
+
if (!kind) {
|
|
203
|
+
const agentKind = agentRowKind(m);
|
|
204
|
+
if (!agentKind)
|
|
205
|
+
return m;
|
|
206
|
+
return agentKind === 'failed_turn' && !erroredTurns.has(str(m._turn_id)) ? { ...m, _notice_kind: agentKind } : { ...m, display_kind: 'hidden' };
|
|
207
|
+
}
|
|
133
208
|
if (kind === 'context_compaction')
|
|
134
209
|
return { ...m, _marker_kind: kind };
|
|
135
210
|
const body = messageText(m.content).trim().slice(PRESERVED_TASK_LIST_PREFIX.length).trim();
|
|
@@ -143,7 +218,7 @@ export function looksLikeCurrentUserTurn(msg, msgText) {
|
|
|
143
218
|
// A persisted steer is display-only: it is never the prompt that opened a turn.
|
|
144
219
|
if (!isDict(msg) || str(msg.role) !== 'user' || isDict(msg._steer))
|
|
145
220
|
return false;
|
|
146
|
-
const candidate = normalizeUserText(messageText(msg.content));
|
|
221
|
+
const candidate = normalizeUserText(messageText(normalizeUserDisplay(msg).content));
|
|
147
222
|
const target = normalizeUserText(msgText);
|
|
148
223
|
// An attachment-only prompt (TAL-276) has no text: the Agent's row for it carries none either.
|
|
149
224
|
if (!target)
|
|
@@ -180,7 +255,8 @@ export function findCurrentUserTurn(messages, msgText) {
|
|
|
180
255
|
/** Python `_merge_display_messages_after_agent_result` (append-only display merge). */
|
|
181
256
|
/** Python `_assistant_message_has_final_visible_text`: a non-error assistant row carrying visible answer text. */
|
|
182
257
|
function assistantHasFinalVisibleText(msg) {
|
|
183
|
-
|
|
258
|
+
// The Agent's failed-turn boundary is no answer (TAL-815).
|
|
259
|
+
if (msg.role !== 'assistant' || msg._error || agentRowKind(msg))
|
|
184
260
|
return false;
|
|
185
261
|
return messageText(msg.content).trim().length > 0;
|
|
186
262
|
}
|
|
@@ -614,7 +690,7 @@ export function extractToolCallsFromMessages(messages, liveToolCalls = [], recor
|
|
|
614
690
|
* (recorded live, else `null`), `result` (the result snippet, else `null`) and `result_view` (its display sections, TAL-315,
|
|
615
691
|
* else `null`). Returns copies; stored rows are untouched.
|
|
616
692
|
*/
|
|
617
|
-
export function withToolCallOutcomes(messages, sessionToolCalls, activeTurnId) {
|
|
693
|
+
export function withToolCallOutcomes(messages, sessionToolCalls, activeTurnId, baseIndex = 0) {
|
|
618
694
|
// Every identifier a stored call may carry (`ToolCallSchema`).
|
|
619
695
|
const callId = (tc) => (isDict(tc) ? toolCallId(tc) || str(tc.tool_call_id) : '');
|
|
620
696
|
// Providers may reuse an id (`call_1` in every response), so a reply answers the latest earlier assistant row that
|
|
@@ -631,7 +707,7 @@ export function withToolCallOutcomes(messages, sessionToolCalls, activeTurnId) {
|
|
|
631
707
|
if (!isDict(m))
|
|
632
708
|
return;
|
|
633
709
|
if (m.role === 'tool')
|
|
634
|
-
answer(str(m.tool_call_id) || str(m.tool_use_id), { content: m.content, is_error: false });
|
|
710
|
+
answer(str(m.tool_call_id) || str(m.tool_use_id), { content: m.content, is_error: false, display_metadata: m.display_metadata });
|
|
635
711
|
else if (m.role === 'user' && Array.isArray(m.content)) {
|
|
636
712
|
// Anthropic-style results: `tool_result` blocks in a user row, each naming its call.
|
|
637
713
|
for (const part of m.content)
|
|
@@ -668,7 +744,7 @@ export function withToolCallOutcomes(messages, sessionToolCalls, activeTurnId) {
|
|
|
668
744
|
// Calls known only from a record: the session-level list's, and the live calls a failed or cancelled turn's partial
|
|
669
745
|
// snapshot kept (`_partial_tool_calls`).
|
|
670
746
|
const records = [];
|
|
671
|
-
const rowRecords = recordedByRow.get(index) ?? [];
|
|
747
|
+
const rowRecords = recordedByRow.get(baseIndex + index) ?? [];
|
|
672
748
|
const recorded = new Map(rowRecords.filter((tc) => str(tc.tid)).map((tc) => [str(tc.tid), tc]));
|
|
673
749
|
for (const tc of [...rowRecords, ...(Array.isArray(m._partial_tool_calls) ? m._partial_tool_calls : [])]) {
|
|
674
750
|
if (!isDict(tc))
|
|
@@ -687,7 +763,7 @@ export function withToolCallOutcomes(messages, sessionToolCalls, activeTurnId) {
|
|
|
687
763
|
const reply = id ? replies.get(key(index, id)) : undefined;
|
|
688
764
|
const outcome = reply ? { ...toolOutcome(reply.content), flagged: reply.is_error } : null;
|
|
689
765
|
// TAL-448: a file edit's change, from its full reply, else the one its live record decided.
|
|
690
|
-
const editDiff = reply ? toolEditDiff(name, reply.content) : decidedEditDiff(rec?.edit_diff);
|
|
766
|
+
const editDiff = reply ? toolEditDiff(name, reply.content, reply.display_metadata) : decidedEditDiff(rec?.edit_diff);
|
|
691
767
|
return {
|
|
692
768
|
...(editDiff ? { edit_diff: editDiff } : {}),
|
|
693
769
|
done: Boolean(reply) || answered || !running, is_error: outcome ? outcome.flagged || outcome.is_error : rec?.is_error === true,
|
|
@@ -811,7 +887,7 @@ export function journalOutputRows(events, turnId) {
|
|
|
811
887
|
at = e.created_at || at;
|
|
812
888
|
}
|
|
813
889
|
flush();
|
|
814
|
-
const done =
|
|
890
|
+
const done = selectAuthoritativeTerminalEvent(events);
|
|
815
891
|
if (done?.event !== 'done')
|
|
816
892
|
return { rows, answered: false };
|
|
817
893
|
// The last row answers only with visible prose and no calls after it (a reasoning-only segment is no answer).
|
|
@@ -956,8 +1032,7 @@ export function normalizeAssistantDisplay(message) {
|
|
|
956
1032
|
* TAL-493: once a boundary or settled turn recorded the highest state.db id it read (`stateDbSeenId`) and the rows carry
|
|
957
1033
|
* ids, identity replaces the timestamp rules: rows up to that id are covered, and every newer row not already in the
|
|
958
1034
|
* sidecar is appended, even one a writer stamped before the newest local row or the watermark but committed later.
|
|
959
|
-
*
|
|
960
|
-
* add it if a mixed WebUI/CLI transcript shows duplicated turns.
|
|
1035
|
+
* Direct and absorbed durable identities cover merged Agent prompts even when their text and timestamp changed.
|
|
961
1036
|
*/
|
|
962
1037
|
export function mergeSessionMessagesAppendOnly(sidecar, state, opts = {}) {
|
|
963
1038
|
const watermark = Number(opts.truncationWatermark);
|
|
@@ -965,32 +1040,43 @@ export function mergeSessionMessagesAppendOnly(sidecar, state, opts = {}) {
|
|
|
965
1040
|
if (!state.length)
|
|
966
1041
|
return sidecar;
|
|
967
1042
|
const ts = (m) => { const n = Number(m.timestamp); return Number.isFinite(n) ? n : null; };
|
|
968
|
-
const key =
|
|
1043
|
+
const key = stateDbMessageKey;
|
|
969
1044
|
const seenId = opts.stateDbSeenId;
|
|
1045
|
+
const generation = opts.stateDbGeneration ?? null;
|
|
1046
|
+
const includeUids = state.some((m) => stateDbIdentityKeys(m).some((id) => id.startsWith('uid:')));
|
|
1047
|
+
const identities = (m) => stateDbIdentityKeys(m, includeUids, generation);
|
|
1048
|
+
const representedIds = new Set(sidecar.flatMap((m) => identities(m)));
|
|
1049
|
+
const isRepresented = (m) => stateDbMessageRepresented(m, representedIds, includeUids, generation);
|
|
1050
|
+
const rememberIds = (m) => { for (const id of identities(m))
|
|
1051
|
+
representedIds.add(id); };
|
|
970
1052
|
if (typeof seenId === 'number' && Number.isFinite(seenId) && state.some((m) => stateDbRowId(m) !== null)) {
|
|
971
|
-
// Each local row stands for at most one new state.db row: a persisted copy by its id, any other by its key.
|
|
972
|
-
const localIds = new Set(sidecar.map(stateDbRowId));
|
|
973
1053
|
const localKeys = new Map();
|
|
974
1054
|
for (const m of sidecar)
|
|
975
|
-
if (
|
|
1055
|
+
if (!identities(m).length)
|
|
976
1056
|
localKeys.set(key(m), (localKeys.get(key(m)) ?? 0) + 1);
|
|
977
|
-
|
|
978
|
-
for (const m of state) {
|
|
979
|
-
const id = stateDbRowId(m);
|
|
980
|
-
if (id !== null && localIds.has(id))
|
|
981
|
-
continue;
|
|
982
|
-
// In state.db order, so a covered row matches its own local copy before a newer duplicate can.
|
|
983
|
-
const left = localKeys.get(key(m)) ?? 0;
|
|
984
|
-
if (left > 0) {
|
|
985
|
-
localKeys.set(key(m), left - 1);
|
|
986
|
-
continue;
|
|
987
|
-
}
|
|
988
|
-
if (id === null || id <= seenId)
|
|
989
|
-
continue;
|
|
990
|
-
merged.push(m);
|
|
991
|
-
}
|
|
992
|
-
return merged;
|
|
1057
|
+
return [...sidecar, ...appendStateDbIdentityRows(state, seenId, representedIds, localKeys, generation, includeUids)];
|
|
993
1058
|
}
|
|
1059
|
+
// Legacy sidecars may have no seen marker or row IDs. A verified copy can still match its archived
|
|
1060
|
+
// source's exact role/timestamp/content key. This only removes represented copies; the timestamp
|
|
1061
|
+
// and truncate/compress gates below continue to decide which remaining rows may be appended.
|
|
1062
|
+
const represented = new Set();
|
|
1063
|
+
const remember = (message) => {
|
|
1064
|
+
represented.add(stateDbMessageFingerprint(message));
|
|
1065
|
+
if (typeof message._state_db_source_key === 'string')
|
|
1066
|
+
represented.add(message._state_db_source_key);
|
|
1067
|
+
};
|
|
1068
|
+
for (const message of sidecar)
|
|
1069
|
+
remember(message);
|
|
1070
|
+
state = state.filter((message) => {
|
|
1071
|
+
if (isRepresented(message))
|
|
1072
|
+
return false;
|
|
1073
|
+
const sourceKey = message._state_db_source_key;
|
|
1074
|
+
if (typeof sourceKey === 'string' && represented.has(sourceKey))
|
|
1075
|
+
return false;
|
|
1076
|
+
remember(message);
|
|
1077
|
+
rememberIds(message);
|
|
1078
|
+
return true;
|
|
1079
|
+
});
|
|
994
1080
|
if (!sidecar.length) {
|
|
995
1081
|
if (!hasWatermark) {
|
|
996
1082
|
const seen = new Set();
|
|
@@ -1025,10 +1111,28 @@ export function mergeSessionMessagesAppendOnly(sidecar, state, opts = {}) {
|
|
|
1025
1111
|
}
|
|
1026
1112
|
return merged;
|
|
1027
1113
|
}
|
|
1028
|
-
/**
|
|
1029
|
-
function
|
|
1030
|
-
const
|
|
1031
|
-
|
|
1114
|
+
/** Shared identity-mode append step; an indexed prefix supplies the same witnesses without visiting its rows. */
|
|
1115
|
+
export function appendStateDbIdentityRows(state, seenId, represented, localKeys, generation, includeUids) {
|
|
1116
|
+
const added = new Set();
|
|
1117
|
+
const consumed = new Map();
|
|
1118
|
+
const witnesses = { has: (id) => represented.has(id) || added.has(id) };
|
|
1119
|
+
const appended = [];
|
|
1120
|
+
for (const m of state) {
|
|
1121
|
+
if (stateDbMessageRepresented(m, witnesses, includeUids, generation))
|
|
1122
|
+
continue;
|
|
1123
|
+
const id = stateDbRowId(m), key = stateDbMessageKey(m);
|
|
1124
|
+
const used = consumed.get(key) ?? 0;
|
|
1125
|
+
const left = (localKeys.get(key) ?? 0) - used;
|
|
1126
|
+
if (left > 0 && (m._state_db_authored_change !== true || id === null || id <= seenId))
|
|
1127
|
+
consumed.set(key, used + 1);
|
|
1128
|
+
else if (id !== null && id > seenId)
|
|
1129
|
+
appended.push(m);
|
|
1130
|
+
else
|
|
1131
|
+
continue;
|
|
1132
|
+
for (const identity of stateDbIdentityKeys(m, includeUids, generation))
|
|
1133
|
+
added.add(identity);
|
|
1134
|
+
}
|
|
1135
|
+
return appended;
|
|
1032
1136
|
}
|
|
1033
1137
|
/** TAL-493: the `state_db_seen_id` after reading `rows`: their highest id, or null when they carry none. */
|
|
1034
1138
|
export function stateDbSeenId(rows) {
|
|
@@ -1114,6 +1218,44 @@ export function withDisplayMedia(messages, project) {
|
|
|
1114
1218
|
return out;
|
|
1115
1219
|
});
|
|
1116
1220
|
}
|
|
1221
|
+
/** Anthropic-style tool calls: `tool_use` blocks in the content array, interleaved with the text around them. */
|
|
1222
|
+
export function hasToolUseBlocks(message) {
|
|
1223
|
+
return Array.isArray(message.content) && message.content.some((part) => isDict(part) && part.type === 'tool_use');
|
|
1224
|
+
}
|
|
1225
|
+
/**
|
|
1226
|
+
* The final answer rule: the turn's last assistant row, with visible content, no tool calls, not interim or partial.
|
|
1227
|
+
* A Stop row is no answer: its outcome is the status (TAL-364; older rows still carry English copy).
|
|
1228
|
+
*/
|
|
1229
|
+
export function finalAnswerOf(last) {
|
|
1230
|
+
if ((Array.isArray(last.tool_calls) && last.tool_calls.length > 0) || hasToolUseBlocks(last) || last._interim === true || last._partial === true)
|
|
1231
|
+
return '';
|
|
1232
|
+
if (last._error === true && (last._terminal_state === 'cancelled' || last.provider_details_label === 'Cancellation details'))
|
|
1233
|
+
return '';
|
|
1234
|
+
return splitDisplayText(messageText(last.content))[0];
|
|
1235
|
+
}
|
|
1236
|
+
/** Conversation classification shared by the indexed selector and the hydrated projection. */
|
|
1237
|
+
export function isConversationalAssistant(message) {
|
|
1238
|
+
return isDict(message) && message.role === 'assistant' && !agentRowKind(message) && !markerKind(message)
|
|
1239
|
+
&& !message._marker_kind && !message._notice_kind && !message._background_silent && !message._background_update && !message._delivery;
|
|
1240
|
+
}
|
|
1241
|
+
/** Absolute coordinate of the newest settled visible answer; running and answerless turns never displace it. */
|
|
1242
|
+
export function newestSettledReply(messages, activeTurnId, offset = 0) {
|
|
1243
|
+
const visited = new Set();
|
|
1244
|
+
for (let i = messages.length - 1; i >= 0; i -= 1) {
|
|
1245
|
+
const m = messages[i];
|
|
1246
|
+
if (!isConversationalAssistant(m))
|
|
1247
|
+
continue;
|
|
1248
|
+
const turn = typeof m._turn_id === 'string' ? m._turn_id : `row:${offset + i}`;
|
|
1249
|
+
if (turn === activeTurnId || visited.has(turn))
|
|
1250
|
+
continue;
|
|
1251
|
+
visited.add(turn);
|
|
1252
|
+
const scene = m._anchor_activity_scene;
|
|
1253
|
+
const answer = isDict(scene) ? str(scene.final_answer) : finalAnswerOf(m);
|
|
1254
|
+
if (!m._error && !m._partial && !m._interim && splitDisplayText(answer)[0].trim())
|
|
1255
|
+
return offset + i;
|
|
1256
|
+
}
|
|
1257
|
+
return null;
|
|
1258
|
+
}
|
|
1117
1259
|
/** TAL-456: a settled user or assistant body longer than this ships a collapsed excerpt for clients to render. */
|
|
1118
1260
|
export const BODY_EXCERPT_LIMIT = 3000;
|
|
1119
1261
|
const graphemes = new Intl.Segmenter(undefined, { granularity: 'grapheme' });
|
|
@@ -1135,20 +1277,28 @@ function bodyExcerpt(text) {
|
|
|
1135
1277
|
/**
|
|
1136
1278
|
* TAL-456: stamps `_display_excerpt` and `_display_truncated` on settled user and assistant rows whose display text is longer than
|
|
1137
1279
|
* `BODY_EXCERPT_LIMIT`, and `final_answer_excerpt` on a settled scene whose final answer is, so clients render a bounded
|
|
1138
|
-
* excerpt instead of laying out the whole body.
|
|
1280
|
+
* excerpt instead of laying out the whole body. The newest settled answer and running turn stay full; copy and edit retain full text.
|
|
1139
1281
|
* Runs after scene hydration. Returns copies; stored rows are untouched.
|
|
1140
1282
|
*/
|
|
1141
|
-
export function withBodyExcerpts(messages, activeTurnId) {
|
|
1142
|
-
return messages.map((m) => {
|
|
1283
|
+
export function withBodyExcerpts(messages, activeTurnId, newestReplyIndex = newestSettledReply(messages, activeTurnId), offset = 0) {
|
|
1284
|
+
return messages.map((m, index) => {
|
|
1143
1285
|
if (!isDict(m) || (m.role !== 'user' && m.role !== 'assistant'))
|
|
1144
1286
|
return m;
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1287
|
+
let out = { ...m };
|
|
1288
|
+
delete out._display_excerpt;
|
|
1289
|
+
delete out._display_truncated;
|
|
1290
|
+
if (isDict(out._anchor_activity_scene)) {
|
|
1291
|
+
const scene = { ...out._anchor_activity_scene };
|
|
1292
|
+
delete scene.final_answer_excerpt;
|
|
1293
|
+
out._anchor_activity_scene = scene;
|
|
1294
|
+
}
|
|
1295
|
+
if ((activeTurnId && m._turn_id === activeTurnId) || index + offset === newestReplyIndex)
|
|
1296
|
+
return out;
|
|
1297
|
+
// A delivery shows its body under its own label (TAL-816), so the excerpt is the body's.
|
|
1298
|
+
const text = isDict(m._delivery) ? str(m._delivery.body) : typeof m._display_content === 'string' ? m._display_content : messageText(m.content);
|
|
1149
1299
|
if (text.length > BODY_EXCERPT_LIMIT)
|
|
1150
1300
|
out = { ...out, _display_excerpt: bodyExcerpt(text), _display_truncated: true };
|
|
1151
|
-
const scene =
|
|
1301
|
+
const scene = out._anchor_activity_scene;
|
|
1152
1302
|
const finalAnswer = isDict(scene) ? (typeof scene.final_answer_display === 'string' ? scene.final_answer_display : scene.final_answer) : null;
|
|
1153
1303
|
if (isDict(scene) && typeof finalAnswer === 'string' && finalAnswer.length > BODY_EXCERPT_LIMIT) {
|
|
1154
1304
|
out = { ...out, _anchor_activity_scene: { ...scene, final_answer_excerpt: bodyExcerpt(finalAnswer) } };
|
|
@@ -1243,6 +1393,11 @@ function toolCallId(tc) {
|
|
|
1243
1393
|
return str(tc.id) || str(tc.call_id);
|
|
1244
1394
|
}
|
|
1245
1395
|
const API_SAFE_MSG_KEYS = new Set(['role', 'content', 'tool_calls', 'tool_call_id', 'tool_use_id', 'name', 'refusal', 'reasoning_content']);
|
|
1396
|
+
// TAL-927: the Agent's reload projection (`_rows_to_conversation`) restores these on assistant rows so prior reasoning
|
|
1397
|
+
// replays and keeps its signatures; turn history keeps them too. Persistence-only: the Agent strips them per route.
|
|
1398
|
+
const AGENT_ASSISTANT_REPLAY_KEYS = new Set(['reasoning', 'reasoning_details', 'codex_reasoning_items', 'codex_message_items', 'finish_reason']);
|
|
1399
|
+
// The opaque ones are bound to the provider that issued them.
|
|
1400
|
+
const PROVIDER_ISSUED_REASONING_KEYS = new Set(['reasoning_details', 'codex_reasoning_items', 'codex_message_items']);
|
|
1246
1401
|
const OOB_USER_MESSAGE_BLOCK_RE = /\[OUT-OF-BAND\s+USER\s+MESSAGE(?:\s*(?:—|-)\s*[\s\S]*?)?\]\s*?[\s\S]*?\[\/OUT-OF-BAND\s+USER\s+MESSAGE\]/gi;
|
|
1247
1402
|
const OOB_DELIVERY_RE = /^\s*\[OUT-OF-BAND\s+USER\s+MESSAGE[^\]]*\]\s*([\s\S]*?)\s*\[\/OUT-OF-BAND\s+USER\s+MESSAGE\]\s*$/i;
|
|
1248
1403
|
/** The Agent's own record of a steer it delivered (`display_kind: 'steer'`, an out-of-band block): its text, else null. */
|
|
@@ -1284,9 +1439,11 @@ function stripOobBlocks(content) {
|
|
|
1284
1439
|
* out-of-band blocks, and keeps a cancelled (`_recovered`) user prompt only where it separates two assistant turns —
|
|
1285
1440
|
* otherwise the neighbours fuse cleanly or the prompt is stale, and replaying it would answer it again.
|
|
1286
1441
|
* `preserveApiContent` (Python `_sanitize_messages_for_agent`) keeps the Agent's `api_content` replay sidecar on
|
|
1287
|
-
* user/assistant rows
|
|
1442
|
+
* user/assistant rows, every row's `timestamp`, and the assistant reasoning carriers the Agent replays (TAL-927) for
|
|
1443
|
+
* turn history; compression and other projections strip them all. Provider-issued carriers stay only on rows stamped at
|
|
1444
|
+
* or after `issuedReasoningSince`, the turn provider's start; without one they stay home too.
|
|
1288
1445
|
*/
|
|
1289
|
-
export function sanitizeMessagesForApi(messages, { preserveApiContent = false } = {}) {
|
|
1446
|
+
export function sanitizeMessagesForApi(messages, { preserveApiContent = false, issuedReasoningSince = null, maxMessages = Infinity } = {}) {
|
|
1290
1447
|
// Calls are OpenAI `tool_calls` or Anthropic-style `tool_use` content blocks; results name them by `tool_call_id`,
|
|
1291
1448
|
// `tool_use_id`, or a user row's `tool_result` blocks.
|
|
1292
1449
|
const toolUseIds = (msg) => (Array.isArray(msg.content) ? msg.content.flatMap((part) => (isDict(part) && part.type === 'tool_use' && str(part.id) ? [str(part.id)] : [])) : []);
|
|
@@ -1311,7 +1468,7 @@ export function sanitizeMessagesForApi(messages, { preserveApiContent = false }
|
|
|
1311
1468
|
if (isReasoningOnlyAssistant(msg) && !replay)
|
|
1312
1469
|
continue;
|
|
1313
1470
|
// The Agent already received a steer mid-turn; its persisted row is display-only.
|
|
1314
|
-
if (msg._error || isDict(msg._steer))
|
|
1471
|
+
if (msg._error || isDict(msg._steer) || msg._notice_kind === 'session_finalize')
|
|
1315
1472
|
continue;
|
|
1316
1473
|
if (msg._partial && !messageText(msg.content).trim())
|
|
1317
1474
|
continue;
|
|
@@ -1321,11 +1478,18 @@ export function sanitizeMessagesForApi(messages, { preserveApiContent = false }
|
|
|
1321
1478
|
if (!tid || !validToolCallIds.has(tid))
|
|
1322
1479
|
continue;
|
|
1323
1480
|
}
|
|
1324
|
-
const
|
|
1481
|
+
const replayCarriers = preserveApiContent && msg.role === 'assistant';
|
|
1482
|
+
const issuedHere = issuedReasoningSince !== null && Number(msg.timestamp) >= issuedReasoningSince;
|
|
1483
|
+
const replayKey = (k) => replayCarriers && AGENT_ASSISTANT_REPLAY_KEYS.has(k) && (issuedHere || !PROVIDER_ISSUED_REASONING_KEYS.has(k));
|
|
1484
|
+
const sanitized = Object.fromEntries(Object.entries(msg).filter(([k]) => API_SAFE_MSG_KEYS.has(k) || replayKey(k)));
|
|
1325
1485
|
if (Array.isArray(sanitized.tool_calls) && !sanitized.tool_calls.length)
|
|
1326
1486
|
Reflect.deleteProperty(sanitized, 'tool_calls');
|
|
1327
1487
|
if (replay)
|
|
1328
1488
|
sanitized.api_content = replay;
|
|
1489
|
+
// TAL-681: the Agent re-inserts turn history when it prunes and keys display dedupe on the row timestamp, so turn
|
|
1490
|
+
// history keeps it (persistence-only: the Agent strips it before the provider call).
|
|
1491
|
+
if (preserveApiContent && msg.timestamp != null)
|
|
1492
|
+
sanitized.timestamp = msg.timestamp;
|
|
1329
1493
|
if (recovered)
|
|
1330
1494
|
sanitized._recovered = true;
|
|
1331
1495
|
if ('content' in sanitized)
|
|
@@ -1374,9 +1538,46 @@ export function sanitizeMessagesForApi(messages, { preserveApiContent = false }
|
|
|
1374
1538
|
msg = Object.fromEntries(Object.entries(msg).filter(([k]) => k !== '_recovered'));
|
|
1375
1539
|
}
|
|
1376
1540
|
final.push(msg);
|
|
1541
|
+
if (final.length >= maxMessages)
|
|
1542
|
+
break;
|
|
1377
1543
|
}
|
|
1378
1544
|
return final;
|
|
1379
1545
|
}
|
|
1546
|
+
/** A revision's compression threshold, using the sanitizer itself and stopping once four retained rows prove it. */
|
|
1547
|
+
export class ApiMessageSummary {
|
|
1548
|
+
excludeTurn;
|
|
1549
|
+
displayHistory;
|
|
1550
|
+
rows = [];
|
|
1551
|
+
unidentified = [new Map(), new Map()];
|
|
1552
|
+
enough = false;
|
|
1553
|
+
marker = false;
|
|
1554
|
+
nextCheck = 4;
|
|
1555
|
+
constructor(excludeTurn = null, displayHistory = true) {
|
|
1556
|
+
this.excludeTurn = excludeTurn;
|
|
1557
|
+
this.displayHistory = displayHistory;
|
|
1558
|
+
}
|
|
1559
|
+
add(row) {
|
|
1560
|
+
if (this.enough)
|
|
1561
|
+
return;
|
|
1562
|
+
if (this.displayHistory && (row._error || row._partial))
|
|
1563
|
+
return;
|
|
1564
|
+
this.marker ||= isContextCompressionMarker(row);
|
|
1565
|
+
if (this.enough || (this.excludeTurn && row._turn_id === this.excludeTurn))
|
|
1566
|
+
return;
|
|
1567
|
+
this.rows.push(row);
|
|
1568
|
+
for (const [mode, includeUids] of [false, true].entries())
|
|
1569
|
+
if (!stateDbIdentityKeys(row, includeUids).length) {
|
|
1570
|
+
const key = stateDbMessageKey(row);
|
|
1571
|
+
this.unidentified[mode].set(key, (this.unidentified[mode].get(key) ?? 0) + 1);
|
|
1572
|
+
}
|
|
1573
|
+
if (this.rows.length >= this.nextCheck) {
|
|
1574
|
+
this.finish();
|
|
1575
|
+
this.nextCheck *= 2;
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
finish() { if (!this.enough)
|
|
1579
|
+
this.enough = sanitizeMessagesForApi(this.rows, { maxMessages: 4 }).length >= 4; }
|
|
1580
|
+
}
|
|
1380
1581
|
const isNativeImagePart = (part) => isDict(part) && (part.type === 'image_url' || 'image_url' in part);
|
|
1381
1582
|
/** True when any row's content carries a native `image_url` part. */
|
|
1382
1583
|
export function hasNativeImages(messages) {
|