@vibesdotdev/session 0.0.0-stage → 1.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +18 -0
- package/README.md +69 -2
- package/dist/backup/session.sessions.target.descriptor.d.ts +47 -0
- package/dist/backup/session.sessions.target.descriptor.d.ts.map +1 -0
- package/dist/backup/session.sessions.target.descriptor.js +41 -0
- package/dist/backup/session.sessions.target.descriptor.js.map +1 -0
- package/dist/cli/chat/session.chat.descriptor.d.ts +4 -0
- package/dist/cli/chat/session.chat.descriptor.d.ts.map +1 -0
- package/dist/cli/chat/session.chat.descriptor.js +19 -0
- package/dist/cli/chat/session.chat.descriptor.js.map +1 -0
- package/dist/cli/chat/session.chat.impl.d.ts +6 -0
- package/dist/cli/chat/session.chat.impl.d.ts.map +1 -0
- package/dist/cli/chat/session.chat.impl.js +37 -0
- package/dist/cli/chat/session.chat.impl.js.map +1 -0
- package/dist/cli/chat/session.jobs.descriptor.d.ts +4 -0
- package/dist/cli/chat/session.jobs.descriptor.d.ts.map +1 -0
- package/dist/cli/chat/session.jobs.descriptor.js +17 -0
- package/dist/cli/chat/session.jobs.descriptor.js.map +1 -0
- package/dist/cli/chat/session.jobs.impl.d.ts +6 -0
- package/dist/cli/chat/session.jobs.impl.d.ts.map +1 -0
- package/dist/cli/chat/session.jobs.impl.js +29 -0
- package/dist/cli/chat/session.jobs.impl.js.map +1 -0
- package/dist/cli/chat/session.participants.descriptor.d.ts +4 -0
- package/dist/cli/chat/session.participants.descriptor.d.ts.map +1 -0
- package/dist/cli/chat/session.participants.descriptor.js +18 -0
- package/dist/cli/chat/session.participants.descriptor.js.map +1 -0
- package/dist/cli/chat/session.participants.impl.d.ts +12 -0
- package/dist/cli/chat/session.participants.impl.d.ts.map +1 -0
- package/dist/cli/chat/session.participants.impl.js +37 -0
- package/dist/cli/chat/session.participants.impl.js.map +1 -0
- package/dist/cli/command.d.ts +44 -0
- package/dist/cli/command.d.ts.map +1 -0
- package/dist/cli/command.js +57 -0
- package/dist/cli/command.js.map +1 -0
- package/dist/cli/display.d.ts +10 -0
- package/dist/cli/display.d.ts.map +1 -0
- package/dist/cli/display.js +16 -0
- package/dist/cli/display.js.map +1 -0
- package/dist/cli/index.d.ts +8 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +7 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/lifecycle/session.archive.descriptor.d.ts +4 -0
- package/dist/cli/lifecycle/session.archive.descriptor.d.ts.map +1 -0
- package/dist/cli/lifecycle/session.archive.descriptor.js +16 -0
- package/dist/cli/lifecycle/session.archive.descriptor.js.map +1 -0
- package/dist/cli/lifecycle/session.archive.impl.d.ts +6 -0
- package/dist/cli/lifecycle/session.archive.impl.d.ts.map +1 -0
- package/dist/cli/lifecycle/session.archive.impl.js +18 -0
- package/dist/cli/lifecycle/session.archive.impl.js.map +1 -0
- package/dist/cli/lifecycle/session.init.descriptor.d.ts +4 -0
- package/dist/cli/lifecycle/session.init.descriptor.d.ts.map +1 -0
- package/dist/cli/lifecycle/session.init.descriptor.js +31 -0
- package/dist/cli/lifecycle/session.init.descriptor.js.map +1 -0
- package/dist/cli/lifecycle/session.init.impl.d.ts +6 -0
- package/dist/cli/lifecycle/session.init.impl.d.ts.map +1 -0
- package/dist/cli/lifecycle/session.init.impl.js +38 -0
- package/dist/cli/lifecycle/session.init.impl.js.map +1 -0
- package/dist/cli/lifecycle/session.list.descriptor.d.ts +4 -0
- package/dist/cli/lifecycle/session.list.descriptor.d.ts.map +1 -0
- package/dist/cli/lifecycle/session.list.descriptor.js +27 -0
- package/dist/cli/lifecycle/session.list.descriptor.js.map +1 -0
- package/dist/cli/lifecycle/session.list.impl.d.ts +12 -0
- package/dist/cli/lifecycle/session.list.impl.d.ts.map +1 -0
- package/dist/cli/lifecycle/session.list.impl.js +46 -0
- package/dist/cli/lifecycle/session.list.impl.js.map +1 -0
- package/dist/cli/lifecycle/session.pause.descriptor.d.ts +4 -0
- package/dist/cli/lifecycle/session.pause.descriptor.d.ts.map +1 -0
- package/dist/cli/lifecycle/session.pause.descriptor.js +13 -0
- package/dist/cli/lifecycle/session.pause.descriptor.js.map +1 -0
- package/dist/cli/lifecycle/session.pause.impl.d.ts +6 -0
- package/dist/cli/lifecycle/session.pause.impl.d.ts.map +1 -0
- package/dist/cli/lifecycle/session.pause.impl.js +18 -0
- package/dist/cli/lifecycle/session.pause.impl.js.map +1 -0
- package/dist/cli/lifecycle/session.resume.descriptor.d.ts +4 -0
- package/dist/cli/lifecycle/session.resume.descriptor.d.ts.map +1 -0
- package/dist/cli/lifecycle/session.resume.descriptor.js +21 -0
- package/dist/cli/lifecycle/session.resume.descriptor.js.map +1 -0
- package/dist/cli/lifecycle/session.resume.impl.d.ts +6 -0
- package/dist/cli/lifecycle/session.resume.impl.d.ts.map +1 -0
- package/dist/cli/lifecycle/session.resume.impl.js +18 -0
- package/dist/cli/lifecycle/session.resume.impl.js.map +1 -0
- package/dist/cli/lifecycle/session.search.descriptor.d.ts +4 -0
- package/dist/cli/lifecycle/session.search.descriptor.d.ts.map +1 -0
- package/dist/cli/lifecycle/session.search.descriptor.js +17 -0
- package/dist/cli/lifecycle/session.search.descriptor.js.map +1 -0
- package/dist/cli/lifecycle/session.search.impl.d.ts +12 -0
- package/dist/cli/lifecycle/session.search.impl.d.ts.map +1 -0
- package/dist/cli/lifecycle/session.search.impl.js +43 -0
- package/dist/cli/lifecycle/session.search.impl.js.map +1 -0
- package/dist/cli/lifecycle/session.status.descriptor.d.ts +4 -0
- package/dist/cli/lifecycle/session.status.descriptor.d.ts.map +1 -0
- package/dist/cli/lifecycle/session.status.descriptor.js +13 -0
- package/dist/cli/lifecycle/session.status.descriptor.js.map +1 -0
- package/dist/cli/lifecycle/session.status.impl.d.ts +6 -0
- package/dist/cli/lifecycle/session.status.impl.d.ts.map +1 -0
- package/dist/cli/lifecycle/session.status.impl.js +38 -0
- package/dist/cli/lifecycle/session.status.impl.js.map +1 -0
- package/dist/cli/output.d.ts +14 -0
- package/dist/cli/output.d.ts.map +1 -0
- package/dist/cli/output.js +19 -0
- package/dist/cli/output.js.map +1 -0
- package/dist/cli/schemas/commands.d.ts +709 -0
- package/dist/cli/schemas/commands.d.ts.map +1 -0
- package/dist/cli/schemas/commands.js +359 -0
- package/dist/cli/schemas/commands.js.map +1 -0
- package/dist/cli/scratchpad/session.scratchpad.cli-group.descriptor.d.ts +4 -0
- package/dist/cli/scratchpad/session.scratchpad.cli-group.descriptor.d.ts.map +1 -0
- package/dist/cli/scratchpad/session.scratchpad.cli-group.descriptor.js +13 -0
- package/dist/cli/scratchpad/session.scratchpad.cli-group.descriptor.js.map +1 -0
- package/dist/cli/scratchpad/session.scratchpad.list.descriptor.d.ts +4 -0
- package/dist/cli/scratchpad/session.scratchpad.list.descriptor.d.ts.map +1 -0
- package/dist/cli/scratchpad/session.scratchpad.list.descriptor.js +16 -0
- package/dist/cli/scratchpad/session.scratchpad.list.descriptor.js.map +1 -0
- package/dist/cli/scratchpad/session.scratchpad.list.impl.d.ts +6 -0
- package/dist/cli/scratchpad/session.scratchpad.list.impl.d.ts.map +1 -0
- package/dist/cli/scratchpad/session.scratchpad.list.impl.js +33 -0
- package/dist/cli/scratchpad/session.scratchpad.list.impl.js.map +1 -0
- package/dist/cli/scratchpad/session.scratchpad.read.descriptor.d.ts +4 -0
- package/dist/cli/scratchpad/session.scratchpad.read.descriptor.d.ts.map +1 -0
- package/dist/cli/scratchpad/session.scratchpad.read.descriptor.js +13 -0
- package/dist/cli/scratchpad/session.scratchpad.read.descriptor.js.map +1 -0
- package/dist/cli/scratchpad/session.scratchpad.read.impl.d.ts +6 -0
- package/dist/cli/scratchpad/session.scratchpad.read.impl.d.ts.map +1 -0
- package/dist/cli/scratchpad/session.scratchpad.read.impl.js +18 -0
- package/dist/cli/scratchpad/session.scratchpad.read.impl.js.map +1 -0
- package/dist/cli/scratchpad/session.scratchpad.search.descriptor.d.ts +4 -0
- package/dist/cli/scratchpad/session.scratchpad.search.descriptor.d.ts.map +1 -0
- package/dist/cli/scratchpad/session.scratchpad.search.descriptor.js +18 -0
- package/dist/cli/scratchpad/session.scratchpad.search.descriptor.js.map +1 -0
- package/dist/cli/scratchpad/session.scratchpad.search.impl.d.ts +6 -0
- package/dist/cli/scratchpad/session.scratchpad.search.impl.d.ts.map +1 -0
- package/dist/cli/scratchpad/session.scratchpad.search.impl.js +29 -0
- package/dist/cli/scratchpad/session.scratchpad.search.impl.js.map +1 -0
- package/dist/cli/scratchpad/session.scratchpad.write.descriptor.d.ts +4 -0
- package/dist/cli/scratchpad/session.scratchpad.write.descriptor.d.ts.map +1 -0
- package/dist/cli/scratchpad/session.scratchpad.write.descriptor.js +23 -0
- package/dist/cli/scratchpad/session.scratchpad.write.descriptor.js.map +1 -0
- package/dist/cli/scratchpad/session.scratchpad.write.impl.d.ts +6 -0
- package/dist/cli/scratchpad/session.scratchpad.write.impl.d.ts.map +1 -0
- package/dist/cli/scratchpad/session.scratchpad.write.impl.js +18 -0
- package/dist/cli/scratchpad/session.scratchpad.write.impl.js.map +1 -0
- package/dist/cli/services/session/jobs.d.ts +61 -0
- package/dist/cli/services/session/jobs.d.ts.map +1 -0
- package/dist/cli/services/session/jobs.js +36 -0
- package/dist/cli/services/session/jobs.js.map +1 -0
- package/dist/cli/services/session/participant.d.ts +9 -0
- package/dist/cli/services/session/participant.d.ts.map +1 -0
- package/dist/cli/services/session/participant.js +93 -0
- package/dist/cli/services/session/participant.js.map +1 -0
- package/dist/cli/services/session/participants.d.ts +84 -0
- package/dist/cli/services/session/participants.d.ts.map +1 -0
- package/dist/cli/services/session/participants.js +33 -0
- package/dist/cli/services/session/participants.js.map +1 -0
- package/dist/cli/services/session/refusals.d.ts +15 -0
- package/dist/cli/services/session/refusals.d.ts.map +1 -0
- package/dist/cli/services/session/refusals.js +28 -0
- package/dist/cli/services/session/refusals.js.map +1 -0
- package/dist/cli/services/session/scratchpad.d.ts +89 -0
- package/dist/cli/services/session/scratchpad.d.ts.map +1 -0
- package/dist/cli/services/session/scratchpad.js +63 -0
- package/dist/cli/services/session/scratchpad.js.map +1 -0
- package/dist/cli/services/session/sessions.d.ts +277 -0
- package/dist/cli/services/session/sessions.d.ts.map +1 -0
- package/dist/cli/services/session/sessions.js +149 -0
- package/dist/cli/services/session/sessions.js.map +1 -0
- package/dist/cli/services/session/todos.d.ts +132 -0
- package/dist/cli/services/session/todos.d.ts.map +1 -0
- package/dist/cli/services/session/todos.js +85 -0
- package/dist/cli/services/session/todos.js.map +1 -0
- package/dist/cli/services/session-cli-context.d.ts +29 -0
- package/dist/cli/services/session-cli-context.d.ts.map +1 -0
- package/dist/cli/services/session-cli-context.js +21 -0
- package/dist/cli/services/session-cli-context.js.map +1 -0
- package/dist/cli/services/session.cli.consumer.d.ts +58 -0
- package/dist/cli/services/session.cli.consumer.d.ts.map +1 -0
- package/dist/cli/services/session.cli.consumer.js +13 -0
- package/dist/cli/services/session.cli.consumer.js.map +1 -0
- package/dist/cli/session-cli.plugin.d.ts +3 -0
- package/dist/cli/session-cli.plugin.d.ts.map +1 -0
- package/dist/cli/session-cli.plugin.js +150 -0
- package/dist/cli/session-cli.plugin.js.map +1 -0
- package/dist/cli/session.cli-group.descriptor.d.ts +4 -0
- package/dist/cli/session.cli-group.descriptor.d.ts.map +1 -0
- package/dist/cli/session.cli-group.descriptor.js +12 -0
- package/dist/cli/session.cli-group.descriptor.js.map +1 -0
- package/dist/cli/session.cli.descriptor.d.ts +4 -0
- package/dist/cli/session.cli.descriptor.d.ts.map +1 -0
- package/dist/cli/session.cli.descriptor.js +13 -0
- package/dist/cli/session.cli.descriptor.js.map +1 -0
- package/dist/cli/todo/session.todo.add.descriptor.d.ts +4 -0
- package/dist/cli/todo/session.todo.add.descriptor.d.ts.map +1 -0
- package/dist/cli/todo/session.todo.add.descriptor.js +23 -0
- package/dist/cli/todo/session.todo.add.descriptor.js.map +1 -0
- package/dist/cli/todo/session.todo.add.impl.d.ts +6 -0
- package/dist/cli/todo/session.todo.add.impl.d.ts.map +1 -0
- package/dist/cli/todo/session.todo.add.impl.js +22 -0
- package/dist/cli/todo/session.todo.add.impl.js.map +1 -0
- package/dist/cli/todo/session.todo.cli-group.descriptor.d.ts +4 -0
- package/dist/cli/todo/session.todo.cli-group.descriptor.d.ts.map +1 -0
- package/dist/cli/todo/session.todo.cli-group.descriptor.js +12 -0
- package/dist/cli/todo/session.todo.cli-group.descriptor.js.map +1 -0
- package/dist/cli/todo/session.todo.complete.descriptor.d.ts +4 -0
- package/dist/cli/todo/session.todo.complete.descriptor.d.ts.map +1 -0
- package/dist/cli/todo/session.todo.complete.descriptor.js +16 -0
- package/dist/cli/todo/session.todo.complete.descriptor.js.map +1 -0
- package/dist/cli/todo/session.todo.complete.impl.d.ts +6 -0
- package/dist/cli/todo/session.todo.complete.impl.d.ts.map +1 -0
- package/dist/cli/todo/session.todo.complete.impl.js +18 -0
- package/dist/cli/todo/session.todo.complete.impl.js.map +1 -0
- package/dist/cli/todo/session.todo.list.descriptor.d.ts +4 -0
- package/dist/cli/todo/session.todo.list.descriptor.d.ts.map +1 -0
- package/dist/cli/todo/session.todo.list.descriptor.js +19 -0
- package/dist/cli/todo/session.todo.list.descriptor.js.map +1 -0
- package/dist/cli/todo/session.todo.list.impl.d.ts +6 -0
- package/dist/cli/todo/session.todo.list.impl.d.ts.map +1 -0
- package/dist/cli/todo/session.todo.list.impl.js +34 -0
- package/dist/cli/todo/session.todo.list.impl.js.map +1 -0
- package/dist/cli/todo/session.todo.tree.descriptor.d.ts +4 -0
- package/dist/cli/todo/session.todo.tree.descriptor.d.ts.map +1 -0
- package/dist/cli/todo/session.todo.tree.descriptor.js +21 -0
- package/dist/cli/todo/session.todo.tree.descriptor.js.map +1 -0
- package/dist/cli/todo/session.todo.tree.impl.d.ts +6 -0
- package/dist/cli/todo/session.todo.tree.impl.d.ts.map +1 -0
- package/dist/cli/todo/session.todo.tree.impl.js +26 -0
- package/dist/cli/todo/session.todo.tree.impl.js.map +1 -0
- package/dist/cli/todo/session.todo.update.descriptor.d.ts +4 -0
- package/dist/cli/todo/session.todo.update.descriptor.d.ts.map +1 -0
- package/dist/cli/todo/session.todo.update.descriptor.js +21 -0
- package/dist/cli/todo/session.todo.update.descriptor.js.map +1 -0
- package/dist/cli/todo/session.todo.update.impl.d.ts +6 -0
- package/dist/cli/todo/session.todo.update.impl.d.ts.map +1 -0
- package/dist/cli/todo/session.todo.update.impl.js +18 -0
- package/dist/cli/todo/session.todo.update.impl.js.map +1 -0
- package/dist/client.d.ts +40 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +114 -0
- package/dist/client.js.map +1 -0
- package/dist/cockpit/build-state.d.ts +104 -0
- package/dist/cockpit/build-state.d.ts.map +1 -0
- package/dist/cockpit/build-state.js +273 -0
- package/dist/cockpit/build-state.js.map +1 -0
- package/dist/cockpit/resolve-participant.d.ts +55 -0
- package/dist/cockpit/resolve-participant.d.ts.map +1 -0
- package/dist/cockpit/resolve-participant.js +116 -0
- package/dist/cockpit/resolve-participant.js.map +1 -0
- package/dist/docs/session.docs.descriptor.d.ts +24 -0
- package/dist/docs/session.docs.descriptor.d.ts.map +1 -0
- package/dist/docs/session.docs.descriptor.js +589 -0
- package/dist/docs/session.docs.descriptor.js.map +1 -0
- package/dist/events/session.bound.event.descriptor.d.ts +100 -0
- package/dist/events/session.bound.event.descriptor.d.ts.map +1 -0
- package/dist/events/session.bound.event.descriptor.js +121 -0
- package/dist/events/session.bound.event.descriptor.js.map +1 -0
- package/dist/events/session.unbound.event.descriptor.d.ts +58 -0
- package/dist/events/session.unbound.event.descriptor.d.ts.map +1 -0
- package/dist/events/session.unbound.event.descriptor.js +45 -0
- package/dist/events/session.unbound.event.descriptor.js.map +1 -0
- package/dist/helper.d.ts +15 -0
- package/dist/helper.d.ts.map +1 -0
- package/dist/helper.js +23 -0
- package/dist/helper.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/knowledge-source/vibes.descriptor.d.ts +10 -0
- package/dist/knowledge-source/vibes.descriptor.d.ts.map +1 -0
- package/dist/knowledge-source/vibes.descriptor.js +10 -0
- package/dist/knowledge-source/vibes.descriptor.js.map +1 -0
- package/dist/knowledge-source/vibes.impl.consumer.d.ts +47 -0
- package/dist/knowledge-source/vibes.impl.consumer.d.ts.map +1 -0
- package/dist/knowledge-source/vibes.impl.consumer.js +457 -0
- package/dist/knowledge-source/vibes.impl.consumer.js.map +1 -0
- package/dist/manager/cli-body-connection.d.ts +4 -0
- package/dist/manager/cli-body-connection.d.ts.map +1 -0
- package/dist/manager/cli-body-connection.js +7 -0
- package/dist/manager/cli-body-connection.js.map +1 -0
- package/dist/manager/index.d.ts +3 -0
- package/dist/manager/index.d.ts.map +1 -0
- package/dist/manager/index.js +2 -0
- package/dist/manager/index.js.map +1 -0
- package/dist/manager/resolve-bound-session.d.ts +95 -0
- package/dist/manager/resolve-bound-session.d.ts.map +1 -0
- package/dist/manager/resolve-bound-session.js +163 -0
- package/dist/manager/resolve-bound-session.js.map +1 -0
- package/dist/manager.d.ts +630 -0
- package/dist/manager.d.ts.map +1 -0
- package/dist/manager.js +2669 -0
- package/dist/manager.js.map +1 -0
- package/dist/mcp/index.d.ts +14 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +11 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/schemas/coordination.d.ts +20 -0
- package/dist/mcp/schemas/coordination.d.ts.map +1 -0
- package/dist/mcp/schemas/coordination.js +5 -0
- package/dist/mcp/schemas/coordination.js.map +1 -0
- package/dist/mcp/schemas/tools.d.ts +348 -0
- package/dist/mcp/schemas/tools.d.ts.map +1 -0
- package/dist/mcp/schemas/tools.js +266 -0
- package/dist/mcp/schemas/tools.js.map +1 -0
- package/dist/mcp/types.d.ts +3 -0
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/mcp/types.js +2 -0
- package/dist/mcp/types.js.map +1 -0
- package/dist/mcp/utils/coordination.d.ts +17 -0
- package/dist/mcp/utils/coordination.d.ts.map +1 -0
- package/dist/mcp/utils/coordination.js +56 -0
- package/dist/mcp/utils/coordination.js.map +1 -0
- package/dist/mcp/utils/knowledge.d.ts +90 -0
- package/dist/mcp/utils/knowledge.d.ts.map +1 -0
- package/dist/mcp/utils/knowledge.js +455 -0
- package/dist/mcp/utils/knowledge.js.map +1 -0
- package/dist/mcp/utils/mcp-session-resolver.d.ts +19 -0
- package/dist/mcp/utils/mcp-session-resolver.d.ts.map +1 -0
- package/dist/mcp/utils/mcp-session-resolver.js +28 -0
- package/dist/mcp/utils/mcp-session-resolver.js.map +1 -0
- package/dist/mcp/utils/participant.d.ts +409 -0
- package/dist/mcp/utils/participant.d.ts.map +1 -0
- package/dist/mcp/utils/participant.js +1429 -0
- package/dist/mcp/utils/participant.js.map +1 -0
- package/dist/mcp/utils/session-registry.d.ts +194 -0
- package/dist/mcp/utils/session-registry.d.ts.map +1 -0
- package/dist/mcp/utils/session-registry.js +479 -0
- package/dist/mcp/utils/session-registry.js.map +1 -0
- package/dist/mcp/utils/surface-sessions.d.ts +54 -0
- package/dist/mcp/utils/surface-sessions.d.ts.map +1 -0
- package/dist/mcp/utils/surface-sessions.js +118 -0
- package/dist/mcp/utils/surface-sessions.js.map +1 -0
- package/dist/mcp/utils/unbound-guidance.d.ts +97 -0
- package/dist/mcp/utils/unbound-guidance.d.ts.map +1 -0
- package/dist/mcp/utils/unbound-guidance.js +236 -0
- package/dist/mcp/utils/unbound-guidance.js.map +1 -0
- package/dist/schemas/chatter.d.ts +228 -0
- package/dist/schemas/chatter.d.ts.map +1 -0
- package/dist/schemas/chatter.js +130 -0
- package/dist/schemas/chatter.js.map +1 -0
- package/dist/schemas/cockpit.d.ts +332 -0
- package/dist/schemas/cockpit.d.ts.map +1 -0
- package/dist/schemas/cockpit.js +139 -0
- package/dist/schemas/cockpit.js.map +1 -0
- package/dist/schemas/harness-seat.d.ts +41 -0
- package/dist/schemas/harness-seat.d.ts.map +1 -0
- package/dist/schemas/harness-seat.js +61 -0
- package/dist/schemas/harness-seat.js.map +1 -0
- package/dist/schemas/index.d.ts +29 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +29 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/job.d.ts +261 -0
- package/dist/schemas/job.d.ts.map +1 -0
- package/dist/schemas/job.js +144 -0
- package/dist/schemas/job.js.map +1 -0
- package/dist/schemas/json-text.d.ts +9 -0
- package/dist/schemas/json-text.d.ts.map +1 -0
- package/dist/schemas/json-text.js +129 -0
- package/dist/schemas/json-text.js.map +1 -0
- package/dist/schemas/knowledge.d.ts +109 -0
- package/dist/schemas/knowledge.d.ts.map +1 -0
- package/dist/schemas/knowledge.js +81 -0
- package/dist/schemas/knowledge.js.map +1 -0
- package/dist/schemas/mcp.d.ts +179 -0
- package/dist/schemas/mcp.d.ts.map +1 -0
- package/dist/schemas/mcp.js +46 -0
- package/dist/schemas/mcp.js.map +1 -0
- package/dist/schemas/participant.d.ts +377 -0
- package/dist/schemas/participant.d.ts.map +1 -0
- package/dist/schemas/participant.js +188 -0
- package/dist/schemas/participant.js.map +1 -0
- package/dist/schemas/presence-core.d.ts +93 -0
- package/dist/schemas/presence-core.d.ts.map +1 -0
- package/dist/schemas/presence-core.js +53 -0
- package/dist/schemas/presence-core.js.map +1 -0
- package/dist/schemas/presence.d.ts +69 -0
- package/dist/schemas/presence.d.ts.map +1 -0
- package/dist/schemas/presence.js +44 -0
- package/dist/schemas/presence.js.map +1 -0
- package/dist/schemas/registry-state.d.ts +64 -0
- package/dist/schemas/registry-state.d.ts.map +1 -0
- package/dist/schemas/registry-state.js +30 -0
- package/dist/schemas/registry-state.js.map +1 -0
- package/dist/schemas/scratchpad.d.ts +163 -0
- package/dist/schemas/scratchpad.d.ts.map +1 -0
- package/dist/schemas/scratchpad.js +119 -0
- package/dist/schemas/scratchpad.js.map +1 -0
- package/dist/schemas/session.d.ts +266 -0
- package/dist/schemas/session.d.ts.map +1 -0
- package/dist/schemas/session.js +179 -0
- package/dist/schemas/session.js.map +1 -0
- package/dist/schemas/todo-status-category.d.ts +21 -0
- package/dist/schemas/todo-status-category.d.ts.map +1 -0
- package/dist/schemas/todo-status-category.js +27 -0
- package/dist/schemas/todo-status-category.js.map +1 -0
- package/dist/schemas/todo.d.ts +293 -0
- package/dist/schemas/todo.d.ts.map +1 -0
- package/dist/schemas/todo.js +130 -0
- package/dist/schemas/todo.js.map +1 -0
- package/dist/schemas/types.d.ts +15 -0
- package/dist/schemas/types.d.ts.map +1 -0
- package/dist/schemas/types.js +9 -0
- package/dist/schemas/types.js.map +1 -0
- package/dist/schemas.d.ts +2 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +2 -0
- package/dist/schemas.js.map +1 -0
- package/dist/search/providers/scratchpad.d.ts +9 -0
- package/dist/search/providers/scratchpad.d.ts.map +1 -0
- package/dist/search/providers/scratchpad.js +64 -0
- package/dist/search/providers/scratchpad.js.map +1 -0
- package/dist/search/providers/session.d.ts +13 -0
- package/dist/search/providers/session.d.ts.map +1 -0
- package/dist/search/providers/session.js +48 -0
- package/dist/search/providers/session.js.map +1 -0
- package/dist/session.client.descriptor.d.ts +27 -0
- package/dist/session.client.descriptor.d.ts.map +1 -0
- package/dist/session.client.descriptor.js +8 -0
- package/dist/session.client.descriptor.js.map +1 -0
- package/dist/session.client.impl.d.ts +7 -0
- package/dist/session.client.impl.d.ts.map +1 -0
- package/dist/session.client.impl.js +9 -0
- package/dist/session.client.impl.js.map +1 -0
- package/dist/session.cloud.plugin.d.ts +3 -0
- package/dist/session.cloud.plugin.d.ts.map +1 -0
- package/dist/session.cloud.plugin.js +16 -0
- package/dist/session.cloud.plugin.js.map +1 -0
- package/dist/session.consumer.plugin.d.ts +3 -0
- package/dist/session.consumer.plugin.d.ts.map +1 -0
- package/dist/session.consumer.plugin.js +28 -0
- package/dist/session.consumer.plugin.js.map +1 -0
- package/dist/session.context.descriptor.d.ts +33 -0
- package/dist/session.context.descriptor.d.ts.map +1 -0
- package/dist/session.context.descriptor.js +9 -0
- package/dist/session.context.descriptor.js.map +1 -0
- package/dist/session.context.impl.consumer.d.ts +3 -0
- package/dist/session.context.impl.consumer.d.ts.map +1 -0
- package/dist/session.context.impl.consumer.js +3 -0
- package/dist/session.context.impl.consumer.js.map +1 -0
- package/dist/session.context.impl.d.ts +8 -0
- package/dist/session.context.impl.d.ts.map +1 -0
- package/dist/session.context.impl.js +13 -0
- package/dist/session.context.impl.js.map +1 -0
- package/dist/session.plugin.d.ts +3 -0
- package/dist/session.plugin.d.ts.map +1 -0
- package/dist/session.plugin.js +129 -0
- package/dist/session.plugin.js.map +1 -0
- package/dist/storage/record-draft.d.ts +9 -0
- package/dist/storage/record-draft.d.ts.map +1 -0
- package/dist/storage/record-draft.js +2 -0
- package/dist/storage/record-draft.js.map +1 -0
- package/dist/storage/session-connections.record.descriptor.d.ts +37 -0
- package/dist/storage/session-connections.record.descriptor.d.ts.map +1 -0
- package/dist/storage/session-connections.record.descriptor.js +105 -0
- package/dist/storage/session-connections.record.descriptor.js.map +1 -0
- package/dist/storage/session-jobs.record.descriptor.d.ts +86 -0
- package/dist/storage/session-jobs.record.descriptor.d.ts.map +1 -0
- package/dist/storage/session-jobs.record.descriptor.js +135 -0
- package/dist/storage/session-jobs.record.descriptor.js.map +1 -0
- package/dist/storage/session-knowledge-refs.record.descriptor.d.ts +48 -0
- package/dist/storage/session-knowledge-refs.record.descriptor.d.ts.map +1 -0
- package/dist/storage/session-knowledge-refs.record.descriptor.js +103 -0
- package/dist/storage/session-knowledge-refs.record.descriptor.js.map +1 -0
- package/dist/storage/session-membership-leases.record.descriptor.d.ts +39 -0
- package/dist/storage/session-membership-leases.record.descriptor.d.ts.map +1 -0
- package/dist/storage/session-membership-leases.record.descriptor.js +185 -0
- package/dist/storage/session-membership-leases.record.descriptor.js.map +1 -0
- package/dist/storage/session-messages.record.descriptor.d.ts +79 -0
- package/dist/storage/session-messages.record.descriptor.d.ts.map +1 -0
- package/dist/storage/session-messages.record.descriptor.js +142 -0
- package/dist/storage/session-messages.record.descriptor.js.map +1 -0
- package/dist/storage/session-participants.record.descriptor.d.ts +78 -0
- package/dist/storage/session-participants.record.descriptor.d.ts.map +1 -0
- package/dist/storage/session-participants.record.descriptor.js +119 -0
- package/dist/storage/session-participants.record.descriptor.js.map +1 -0
- package/dist/storage/session-presence.record.descriptor.d.ts +43 -0
- package/dist/storage/session-presence.record.descriptor.d.ts.map +1 -0
- package/dist/storage/session-presence.record.descriptor.js +141 -0
- package/dist/storage/session-presence.record.descriptor.js.map +1 -0
- package/dist/storage/session-scratchpad.record.descriptor.d.ts +54 -0
- package/dist/storage/session-scratchpad.record.descriptor.d.ts.map +1 -0
- package/dist/storage/session-scratchpad.record.descriptor.js +134 -0
- package/dist/storage/session-scratchpad.record.descriptor.js.map +1 -0
- package/dist/storage/session-sessions.record.descriptor.d.ts +68 -0
- package/dist/storage/session-sessions.record.descriptor.d.ts.map +1 -0
- package/dist/storage/session-sessions.record.descriptor.js +260 -0
- package/dist/storage/session-sessions.record.descriptor.js.map +1 -0
- package/dist/storage/session-state.record.descriptor.d.ts +37 -0
- package/dist/storage/session-state.record.descriptor.d.ts.map +1 -0
- package/dist/storage/session-state.record.descriptor.js +84 -0
- package/dist/storage/session-state.record.descriptor.js.map +1 -0
- package/dist/storage/session-todo.record.descriptor.d.ts +84 -0
- package/dist/storage/session-todo.record.descriptor.d.ts.map +1 -0
- package/dist/storage/session-todo.record.descriptor.js +245 -0
- package/dist/storage/session-todo.record.descriptor.js.map +1 -0
- package/dist/subscriptions/session.bound.scope.descriptor.d.ts +21 -0
- package/dist/subscriptions/session.bound.scope.descriptor.d.ts.map +1 -0
- package/dist/subscriptions/session.bound.scope.descriptor.js +21 -0
- package/dist/subscriptions/session.bound.scope.descriptor.js.map +1 -0
- package/dist/subscriptions/session.bound.scope.impl.d.ts +29 -0
- package/dist/subscriptions/session.bound.scope.impl.d.ts.map +1 -0
- package/dist/subscriptions/session.bound.scope.impl.js +40 -0
- package/dist/subscriptions/session.bound.scope.impl.js.map +1 -0
- package/dist/svelte/components/SessionCockpit.svelte +360 -0
- package/dist/svelte/components/SessionCockpit.svelte.d.ts +17 -0
- package/dist/svelte/components/SessionCockpit.svelte.d.ts.map +1 -0
- package/dist/svelte/index.d.ts +18 -0
- package/dist/svelte/index.d.ts.map +1 -0
- package/dist/svelte/index.js +16 -0
- package/dist/svelte/session-svelte.plugin.d.ts +10 -0
- package/dist/svelte/session-svelte.plugin.d.ts.map +1 -0
- package/dist/svelte/session-svelte.plugin.js +54 -0
- package/dist/svelte/styles.css +6 -0
- package/dist/svelte/tool-widgets/SessionCollaborateToolCard.svelte +53 -0
- package/dist/svelte/tool-widgets/SessionCollaborateToolCard.svelte.d.ts +5 -0
- package/dist/svelte/tool-widgets/SessionCollaborateToolCard.svelte.d.ts.map +1 -0
- package/dist/svelte/tool-widgets/SessionScratchpadToolCard.svelte +47 -0
- package/dist/svelte/tool-widgets/SessionScratchpadToolCard.svelte.d.ts +5 -0
- package/dist/svelte/tool-widgets/SessionScratchpadToolCard.svelte.d.ts.map +1 -0
- package/dist/svelte/tool-widgets/SessionTodoToolCard.svelte +43 -0
- package/dist/svelte/tool-widgets/SessionTodoToolCard.svelte.d.ts +5 -0
- package/dist/svelte/tool-widgets/SessionTodoToolCard.svelte.d.ts.map +1 -0
- package/dist/svelte/tool-widgets/SessionToolCard.svelte +47 -0
- package/dist/svelte/tool-widgets/SessionToolCard.svelte.d.ts +5 -0
- package/dist/svelte/tool-widgets/SessionToolCard.svelte.d.ts.map +1 -0
- package/dist/svelte/tool-widgets/SessionWorkspaceToolCard.svelte +44 -0
- package/dist/svelte/tool-widgets/SessionWorkspaceToolCard.svelte.d.ts +5 -0
- package/dist/svelte/tool-widgets/SessionWorkspaceToolCard.svelte.d.ts.map +1 -0
- package/dist/svelte/tool-widgets/card-fields.d.ts +68 -0
- package/dist/svelte/tool-widgets/card-fields.d.ts.map +1 -0
- package/dist/svelte/tool-widgets/card-fields.js +274 -0
- package/dist/testing/harness/transport-mocks.d.ts +380 -0
- package/dist/testing/harness/transport-mocks.d.ts.map +1 -0
- package/dist/testing/harness/transport-mocks.js +809 -0
- package/dist/testing/harness/transport-mocks.js.map +1 -0
- package/dist/tools/best-effort.d.ts +27 -0
- package/dist/tools/best-effort.d.ts.map +1 -0
- package/dist/tools/best-effort.js +31 -0
- package/dist/tools/best-effort.js.map +1 -0
- package/dist/tools/lifecycle/archive/handler.d.ts +19 -0
- package/dist/tools/lifecycle/archive/handler.d.ts.map +1 -0
- package/dist/tools/lifecycle/archive/handler.js +31 -0
- package/dist/tools/lifecycle/archive/handler.js.map +1 -0
- package/dist/tools/lifecycle/archive/schemas.d.ts +24 -0
- package/dist/tools/lifecycle/archive/schemas.d.ts.map +1 -0
- package/dist/tools/lifecycle/archive/schemas.js +22 -0
- package/dist/tools/lifecycle/archive/schemas.js.map +1 -0
- package/dist/tools/lifecycle/context/handler.d.ts +115 -0
- package/dist/tools/lifecycle/context/handler.d.ts.map +1 -0
- package/dist/tools/lifecycle/context/handler.js +82 -0
- package/dist/tools/lifecycle/context/handler.js.map +1 -0
- package/dist/tools/lifecycle/context/schemas.d.ts +44 -0
- package/dist/tools/lifecycle/context/schemas.d.ts.map +1 -0
- package/dist/tools/lifecycle/context/schemas.js +42 -0
- package/dist/tools/lifecycle/context/schemas.js.map +1 -0
- package/dist/tools/lifecycle/delete/handler.d.ts +7 -0
- package/dist/tools/lifecycle/delete/handler.d.ts.map +1 -0
- package/dist/tools/lifecycle/delete/handler.js +29 -0
- package/dist/tools/lifecycle/delete/handler.js.map +1 -0
- package/dist/tools/lifecycle/delete/schemas.d.ts +16 -0
- package/dist/tools/lifecycle/delete/schemas.d.ts.map +1 -0
- package/dist/tools/lifecycle/delete/schemas.js +14 -0
- package/dist/tools/lifecycle/delete/schemas.js.map +1 -0
- package/dist/tools/lifecycle/get/handler.d.ts +18 -0
- package/dist/tools/lifecycle/get/handler.d.ts.map +1 -0
- package/dist/tools/lifecycle/get/handler.js +28 -0
- package/dist/tools/lifecycle/get/handler.js.map +1 -0
- package/dist/tools/lifecycle/get/schemas.d.ts +26 -0
- package/dist/tools/lifecycle/get/schemas.d.ts.map +1 -0
- package/dist/tools/lifecycle/get/schemas.js +24 -0
- package/dist/tools/lifecycle/get/schemas.js.map +1 -0
- package/dist/tools/lifecycle/init/atlas.consumer.d.ts +17 -0
- package/dist/tools/lifecycle/init/atlas.consumer.d.ts.map +1 -0
- package/dist/tools/lifecycle/init/atlas.consumer.js +180 -0
- package/dist/tools/lifecycle/init/atlas.consumer.js.map +1 -0
- package/dist/tools/lifecycle/init/handler.d.ts +4 -0
- package/dist/tools/lifecycle/init/handler.d.ts.map +1 -0
- package/dist/tools/lifecycle/init/handler.js +353 -0
- package/dist/tools/lifecycle/init/handler.js.map +1 -0
- package/dist/tools/lifecycle/init/knowledge.d.ts +18 -0
- package/dist/tools/lifecycle/init/knowledge.d.ts.map +1 -0
- package/dist/tools/lifecycle/init/knowledge.js +86 -0
- package/dist/tools/lifecycle/init/knowledge.js.map +1 -0
- package/dist/tools/lifecycle/init/language.d.ts +10 -0
- package/dist/tools/lifecycle/init/language.d.ts.map +1 -0
- package/dist/tools/lifecycle/init/language.js +26 -0
- package/dist/tools/lifecycle/init/language.js.map +1 -0
- package/dist/tools/lifecycle/init/participant.d.ts +58 -0
- package/dist/tools/lifecycle/init/participant.d.ts.map +1 -0
- package/dist/tools/lifecycle/init/participant.js +219 -0
- package/dist/tools/lifecycle/init/participant.js.map +1 -0
- package/dist/tools/lifecycle/init/schemas.d.ts +99 -0
- package/dist/tools/lifecycle/init/schemas.d.ts.map +1 -0
- package/dist/tools/lifecycle/init/schemas.js +81 -0
- package/dist/tools/lifecycle/init/schemas.js.map +1 -0
- package/dist/tools/lifecycle/init/types.d.ts +137 -0
- package/dist/tools/lifecycle/init/types.d.ts.map +1 -0
- package/dist/tools/lifecycle/init/types.js +3 -0
- package/dist/tools/lifecycle/init/types.js.map +1 -0
- package/dist/tools/lifecycle/init/workspace.consumer.d.ts +13 -0
- package/dist/tools/lifecycle/init/workspace.consumer.d.ts.map +1 -0
- package/dist/tools/lifecycle/init/workspace.consumer.js +58 -0
- package/dist/tools/lifecycle/init/workspace.consumer.js.map +1 -0
- package/dist/tools/lifecycle/list/handler.d.ts +47 -0
- package/dist/tools/lifecycle/list/handler.d.ts.map +1 -0
- package/dist/tools/lifecycle/list/handler.js +48 -0
- package/dist/tools/lifecycle/list/handler.js.map +1 -0
- package/dist/tools/lifecycle/list/schemas.d.ts +37 -0
- package/dist/tools/lifecycle/list/schemas.d.ts.map +1 -0
- package/dist/tools/lifecycle/list/schemas.js +30 -0
- package/dist/tools/lifecycle/list/schemas.js.map +1 -0
- package/dist/tools/lifecycle/packet/handler.d.ts +490 -0
- package/dist/tools/lifecycle/packet/handler.d.ts.map +1 -0
- package/dist/tools/lifecycle/packet/handler.js +428 -0
- package/dist/tools/lifecycle/packet/handler.js.map +1 -0
- package/dist/tools/lifecycle/packet/schemas.d.ts +100 -0
- package/dist/tools/lifecycle/packet/schemas.d.ts.map +1 -0
- package/dist/tools/lifecycle/packet/schemas.js +36 -0
- package/dist/tools/lifecycle/packet/schemas.js.map +1 -0
- package/dist/tools/lifecycle/packet/todos.d.ts +30 -0
- package/dist/tools/lifecycle/packet/todos.d.ts.map +1 -0
- package/dist/tools/lifecycle/packet/todos.js +47 -0
- package/dist/tools/lifecycle/packet/todos.js.map +1 -0
- package/dist/tools/lifecycle/search/handler.d.ts +36 -0
- package/dist/tools/lifecycle/search/handler.d.ts.map +1 -0
- package/dist/tools/lifecycle/search/handler.js +44 -0
- package/dist/tools/lifecycle/search/handler.js.map +1 -0
- package/dist/tools/lifecycle/search/schemas.d.ts +37 -0
- package/dist/tools/lifecycle/search/schemas.d.ts.map +1 -0
- package/dist/tools/lifecycle/search/schemas.js +30 -0
- package/dist/tools/lifecycle/search/schemas.js.map +1 -0
- package/dist/tools/lifecycle/snapshot/handler.d.ts +144 -0
- package/dist/tools/lifecycle/snapshot/handler.d.ts.map +1 -0
- package/dist/tools/lifecycle/snapshot/handler.js +31 -0
- package/dist/tools/lifecycle/snapshot/handler.js.map +1 -0
- package/dist/tools/lifecycle/snapshot/schemas.d.ts +27 -0
- package/dist/tools/lifecycle/snapshot/schemas.d.ts.map +1 -0
- package/dist/tools/lifecycle/snapshot/schemas.js +25 -0
- package/dist/tools/lifecycle/snapshot/schemas.js.map +1 -0
- package/dist/tools/lifecycle/state/pause/handler.d.ts +13 -0
- package/dist/tools/lifecycle/state/pause/handler.d.ts.map +1 -0
- package/dist/tools/lifecycle/state/pause/handler.js +33 -0
- package/dist/tools/lifecycle/state/pause/handler.js.map +1 -0
- package/dist/tools/lifecycle/state/pause/schemas.d.ts +21 -0
- package/dist/tools/lifecycle/state/pause/schemas.d.ts.map +1 -0
- package/dist/tools/lifecycle/state/pause/schemas.js +19 -0
- package/dist/tools/lifecycle/state/pause/schemas.js.map +1 -0
- package/dist/tools/lifecycle/state/resume/handler.d.ts +13 -0
- package/dist/tools/lifecycle/state/resume/handler.d.ts.map +1 -0
- package/dist/tools/lifecycle/state/resume/handler.js +31 -0
- package/dist/tools/lifecycle/state/resume/handler.js.map +1 -0
- package/dist/tools/lifecycle/state/resume/schemas.d.ts +21 -0
- package/dist/tools/lifecycle/state/resume/schemas.d.ts.map +1 -0
- package/dist/tools/lifecycle/state/resume/schemas.js +19 -0
- package/dist/tools/lifecycle/state/resume/schemas.js.map +1 -0
- package/dist/tools/lifecycle/state/status/handler.d.ts +133 -0
- package/dist/tools/lifecycle/state/status/handler.d.ts.map +1 -0
- package/dist/tools/lifecycle/state/status/handler.js +232 -0
- package/dist/tools/lifecycle/state/status/handler.js.map +1 -0
- package/dist/tools/lifecycle/state/status/schemas.d.ts +85 -0
- package/dist/tools/lifecycle/state/status/schemas.d.ts.map +1 -0
- package/dist/tools/lifecycle/state/status/schemas.js +84 -0
- package/dist/tools/lifecycle/state/status/schemas.js.map +1 -0
- package/dist/tools/lifecycle/tool/schemas/index.d.ts +130 -0
- package/dist/tools/lifecycle/tool/schemas/index.d.ts.map +1 -0
- package/dist/tools/lifecycle/tool/schemas/index.js +66 -0
- package/dist/tools/lifecycle/tool/schemas/index.js.map +1 -0
- package/dist/tools/lifecycle/tool/session.tool.descriptor.d.ts +8 -0
- package/dist/tools/lifecycle/tool/session.tool.descriptor.d.ts.map +1 -0
- package/dist/tools/lifecycle/tool/session.tool.descriptor.js +44 -0
- package/dist/tools/lifecycle/tool/session.tool.descriptor.js.map +1 -0
- package/dist/tools/lifecycle/tool/session.variant.archive.impl.d.ts +7 -0
- package/dist/tools/lifecycle/tool/session.variant.archive.impl.d.ts.map +1 -0
- package/dist/tools/lifecycle/tool/session.variant.archive.impl.js +4 -0
- package/dist/tools/lifecycle/tool/session.variant.archive.impl.js.map +1 -0
- package/dist/tools/lifecycle/tool/session.variant.context.impl.d.ts +6 -0
- package/dist/tools/lifecycle/tool/session.variant.context.impl.d.ts.map +1 -0
- package/dist/tools/lifecycle/tool/session.variant.context.impl.js +4 -0
- package/dist/tools/lifecycle/tool/session.variant.context.impl.js.map +1 -0
- package/dist/tools/lifecycle/tool/session.variant.delete.impl.d.ts +7 -0
- package/dist/tools/lifecycle/tool/session.variant.delete.impl.d.ts.map +1 -0
- package/dist/tools/lifecycle/tool/session.variant.delete.impl.js +4 -0
- package/dist/tools/lifecycle/tool/session.variant.delete.impl.js.map +1 -0
- package/dist/tools/lifecycle/tool/session.variant.get.impl.d.ts +6 -0
- package/dist/tools/lifecycle/tool/session.variant.get.impl.d.ts.map +1 -0
- package/dist/tools/lifecycle/tool/session.variant.get.impl.js +4 -0
- package/dist/tools/lifecycle/tool/session.variant.get.impl.js.map +1 -0
- package/dist/tools/lifecycle/tool/session.variant.init.impl.cloud.d.ts +32 -0
- package/dist/tools/lifecycle/tool/session.variant.init.impl.cloud.d.ts.map +1 -0
- package/dist/tools/lifecycle/tool/session.variant.init.impl.cloud.js +6 -0
- package/dist/tools/lifecycle/tool/session.variant.init.impl.cloud.js.map +1 -0
- package/dist/tools/lifecycle/tool/session.variant.init.impl.consumer.d.ts +32 -0
- package/dist/tools/lifecycle/tool/session.variant.init.impl.consumer.d.ts.map +1 -0
- package/dist/tools/lifecycle/tool/session.variant.init.impl.consumer.js +4 -0
- package/dist/tools/lifecycle/tool/session.variant.init.impl.consumer.js.map +1 -0
- package/dist/tools/lifecycle/tool/session.variant.list.impl.d.ts +8 -0
- package/dist/tools/lifecycle/tool/session.variant.list.impl.d.ts.map +1 -0
- package/dist/tools/lifecycle/tool/session.variant.list.impl.js +4 -0
- package/dist/tools/lifecycle/tool/session.variant.list.impl.js.map +1 -0
- package/dist/tools/lifecycle/tool/session.variant.packet.impl.d.ts +9 -0
- package/dist/tools/lifecycle/tool/session.variant.packet.impl.d.ts.map +1 -0
- package/dist/tools/lifecycle/tool/session.variant.packet.impl.js +4 -0
- package/dist/tools/lifecycle/tool/session.variant.packet.impl.js.map +1 -0
- package/dist/tools/lifecycle/tool/session.variant.pause.impl.d.ts +6 -0
- package/dist/tools/lifecycle/tool/session.variant.pause.impl.d.ts.map +1 -0
- package/dist/tools/lifecycle/tool/session.variant.pause.impl.js +4 -0
- package/dist/tools/lifecycle/tool/session.variant.pause.impl.js.map +1 -0
- package/dist/tools/lifecycle/tool/session.variant.resume.impl.d.ts +6 -0
- package/dist/tools/lifecycle/tool/session.variant.resume.impl.d.ts.map +1 -0
- package/dist/tools/lifecycle/tool/session.variant.resume.impl.js +4 -0
- package/dist/tools/lifecycle/tool/session.variant.resume.impl.js.map +1 -0
- package/dist/tools/lifecycle/tool/session.variant.search.impl.d.ts +8 -0
- package/dist/tools/lifecycle/tool/session.variant.search.impl.d.ts.map +1 -0
- package/dist/tools/lifecycle/tool/session.variant.search.impl.js +4 -0
- package/dist/tools/lifecycle/tool/session.variant.search.impl.js.map +1 -0
- package/dist/tools/lifecycle/tool/session.variant.snapshot.impl.d.ts +6 -0
- package/dist/tools/lifecycle/tool/session.variant.snapshot.impl.d.ts.map +1 -0
- package/dist/tools/lifecycle/tool/session.variant.snapshot.impl.js +4 -0
- package/dist/tools/lifecycle/tool/session.variant.snapshot.impl.js.map +1 -0
- package/dist/tools/lifecycle/tool/session.variant.status.impl.d.ts +8 -0
- package/dist/tools/lifecycle/tool/session.variant.status.impl.d.ts.map +1 -0
- package/dist/tools/lifecycle/tool/session.variant.status.impl.js +4 -0
- package/dist/tools/lifecycle/tool/session.variant.status.impl.js.map +1 -0
- package/dist/tools/lifecycle/tool/session.variant.update.impl.d.ts +9 -0
- package/dist/tools/lifecycle/tool/session.variant.update.impl.d.ts.map +1 -0
- package/dist/tools/lifecycle/tool/session.variant.update.impl.js +4 -0
- package/dist/tools/lifecycle/tool/session.variant.update.impl.js.map +1 -0
- package/dist/tools/lifecycle/update/handler.d.ts +47 -0
- package/dist/tools/lifecycle/update/handler.d.ts.map +1 -0
- package/dist/tools/lifecycle/update/handler.js +17 -0
- package/dist/tools/lifecycle/update/handler.js.map +1 -0
- package/dist/tools/lifecycle/update/schemas.d.ts +24 -0
- package/dist/tools/lifecycle/update/schemas.d.ts.map +1 -0
- package/dist/tools/lifecycle/update/schemas.js +22 -0
- package/dist/tools/lifecycle/update/schemas.js.map +1 -0
- package/dist/tools/lifecycle/workspace-capabilities.consumer.d.ts +3 -0
- package/dist/tools/lifecycle/workspace-capabilities.consumer.d.ts.map +1 -0
- package/dist/tools/lifecycle/workspace-capabilities.consumer.js +3 -0
- package/dist/tools/lifecycle/workspace-capabilities.consumer.js.map +1 -0
- package/dist/tools/lifecycle/workspace-capabilities.d.ts +14 -0
- package/dist/tools/lifecycle/workspace-capabilities.d.ts.map +1 -0
- package/dist/tools/lifecycle/workspace-capabilities.js +38 -0
- package/dist/tools/lifecycle/workspace-capabilities.js.map +1 -0
- package/dist/tools/messages/delete/schemas.d.ts +37 -0
- package/dist/tools/messages/delete/schemas.d.ts.map +1 -0
- package/dist/tools/messages/delete/schemas.js +50 -0
- package/dist/tools/messages/delete/schemas.js.map +1 -0
- package/dist/tools/messages/handlers.d.ts +143 -0
- package/dist/tools/messages/handlers.d.ts.map +1 -0
- package/dist/tools/messages/handlers.js +562 -0
- package/dist/tools/messages/handlers.js.map +1 -0
- package/dist/tools/messages/list/schemas.d.ts +38 -0
- package/dist/tools/messages/list/schemas.d.ts.map +1 -0
- package/dist/tools/messages/list/schemas.js +40 -0
- package/dist/tools/messages/list/schemas.js.map +1 -0
- package/dist/tools/messages/mark-read/schemas.d.ts +63 -0
- package/dist/tools/messages/mark-read/schemas.d.ts.map +1 -0
- package/dist/tools/messages/mark-read/schemas.js +60 -0
- package/dist/tools/messages/mark-read/schemas.js.map +1 -0
- package/dist/tools/messages/send/schemas.d.ts +50 -0
- package/dist/tools/messages/send/schemas.d.ts.map +1 -0
- package/dist/tools/messages/send/schemas.js +61 -0
- package/dist/tools/messages/send/schemas.js.map +1 -0
- package/dist/tools/messages/tool/schemas/index.d.ts +70 -0
- package/dist/tools/messages/tool/schemas/index.d.ts.map +1 -0
- package/dist/tools/messages/tool/schemas/index.js +22 -0
- package/dist/tools/messages/tool/schemas/index.js.map +1 -0
- package/dist/tools/messages/tool/session-collaborate.descriptor.d.ts +8 -0
- package/dist/tools/messages/tool/session-collaborate.descriptor.d.ts.map +1 -0
- package/dist/tools/messages/tool/session-collaborate.descriptor.js +32 -0
- package/dist/tools/messages/tool/session-collaborate.descriptor.js.map +1 -0
- package/dist/tools/messages/tool/session-collaborate.variant.delete.impl.d.ts +10 -0
- package/dist/tools/messages/tool/session-collaborate.variant.delete.impl.d.ts.map +1 -0
- package/dist/tools/messages/tool/session-collaborate.variant.delete.impl.js +4 -0
- package/dist/tools/messages/tool/session-collaborate.variant.delete.impl.js.map +1 -0
- package/dist/tools/messages/tool/session-collaborate.variant.list.impl.d.ts +12 -0
- package/dist/tools/messages/tool/session-collaborate.variant.list.impl.d.ts.map +1 -0
- package/dist/tools/messages/tool/session-collaborate.variant.list.impl.js +4 -0
- package/dist/tools/messages/tool/session-collaborate.variant.list.impl.js.map +1 -0
- package/dist/tools/messages/tool/session-collaborate.variant.mark-read.impl.d.ts +11 -0
- package/dist/tools/messages/tool/session-collaborate.variant.mark-read.impl.d.ts.map +1 -0
- package/dist/tools/messages/tool/session-collaborate.variant.mark-read.impl.js +4 -0
- package/dist/tools/messages/tool/session-collaborate.variant.mark-read.impl.js.map +1 -0
- package/dist/tools/messages/tool/session-collaborate.variant.send.impl.d.ts +18 -0
- package/dist/tools/messages/tool/session-collaborate.variant.send.impl.d.ts.map +1 -0
- package/dist/tools/messages/tool/session-collaborate.variant.send.impl.js +4 -0
- package/dist/tools/messages/tool/session-collaborate.variant.send.impl.js.map +1 -0
- package/dist/tools/scratchpad/delete/schemas.d.ts +18 -0
- package/dist/tools/scratchpad/delete/schemas.d.ts.map +1 -0
- package/dist/tools/scratchpad/delete/schemas.js +16 -0
- package/dist/tools/scratchpad/delete/schemas.js.map +1 -0
- package/dist/tools/scratchpad/handlers.d.ts +88 -0
- package/dist/tools/scratchpad/handlers.d.ts.map +1 -0
- package/dist/tools/scratchpad/handlers.js +189 -0
- package/dist/tools/scratchpad/handlers.js.map +1 -0
- package/dist/tools/scratchpad/list/schemas.d.ts +34 -0
- package/dist/tools/scratchpad/list/schemas.d.ts.map +1 -0
- package/dist/tools/scratchpad/list/schemas.js +27 -0
- package/dist/tools/scratchpad/list/schemas.js.map +1 -0
- package/dist/tools/scratchpad/read/schemas.d.ts +34 -0
- package/dist/tools/scratchpad/read/schemas.d.ts.map +1 -0
- package/dist/tools/scratchpad/read/schemas.js +34 -0
- package/dist/tools/scratchpad/read/schemas.js.map +1 -0
- package/dist/tools/scratchpad/search/schemas.d.ts +28 -0
- package/dist/tools/scratchpad/search/schemas.d.ts.map +1 -0
- package/dist/tools/scratchpad/search/schemas.js +26 -0
- package/dist/tools/scratchpad/search/schemas.js.map +1 -0
- package/dist/tools/scratchpad/tool/schemas/index.d.ts +102 -0
- package/dist/tools/scratchpad/tool/schemas/index.d.ts.map +1 -0
- package/dist/tools/scratchpad/tool/schemas/index.js +42 -0
- package/dist/tools/scratchpad/tool/schemas/index.js.map +1 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.descriptor.d.ts +8 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.descriptor.d.ts.map +1 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.descriptor.js +36 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.descriptor.js.map +1 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.batch-delete.impl.d.ts +9 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.batch-delete.impl.d.ts.map +1 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.batch-delete.impl.js +4 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.batch-delete.impl.js.map +1 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.batch-read.impl.d.ts +8 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.batch-read.impl.d.ts.map +1 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.batch-read.impl.js +4 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.batch-read.impl.js.map +1 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.batch-write.impl.d.ts +14 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.batch-write.impl.d.ts.map +1 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.batch-write.impl.js +4 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.batch-write.impl.js.map +1 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.delete.impl.d.ts +9 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.delete.impl.d.ts.map +1 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.delete.impl.js +4 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.delete.impl.js.map +1 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.list.impl.d.ts +9 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.list.impl.d.ts.map +1 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.list.impl.js +4 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.list.impl.js.map +1 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.read.impl.d.ts +8 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.read.impl.d.ts.map +1 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.read.impl.js +4 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.read.impl.js.map +1 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.search.impl.d.ts +8 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.search.impl.d.ts.map +1 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.search.impl.js +4 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.search.impl.js.map +1 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.write.impl.d.ts +14 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.write.impl.d.ts.map +1 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.write.impl.js +4 -0
- package/dist/tools/scratchpad/tool/session-scratchpad.variant.write.impl.js.map +1 -0
- package/dist/tools/scratchpad/write/schemas/index.d.ts +47 -0
- package/dist/tools/scratchpad/write/schemas/index.d.ts.map +1 -0
- package/dist/tools/scratchpad/write/schemas/index.js +26 -0
- package/dist/tools/scratchpad/write/schemas/index.js.map +1 -0
- package/dist/tools/todos/add/handler.d.ts +37 -0
- package/dist/tools/todos/add/handler.d.ts.map +1 -0
- package/dist/tools/todos/add/handler.js +59 -0
- package/dist/tools/todos/add/handler.js.map +1 -0
- package/dist/tools/todos/add/schemas.d.ts +92 -0
- package/dist/tools/todos/add/schemas.d.ts.map +1 -0
- package/dist/tools/todos/add/schemas.js +59 -0
- package/dist/tools/todos/add/schemas.js.map +1 -0
- package/dist/tools/todos/batch-add/handler.d.ts +21 -0
- package/dist/tools/todos/batch-add/handler.d.ts.map +1 -0
- package/dist/tools/todos/batch-add/handler.js +46 -0
- package/dist/tools/todos/batch-add/handler.js.map +1 -0
- package/dist/tools/todos/batch-add/schemas.d.ts +65 -0
- package/dist/tools/todos/batch-add/schemas.d.ts.map +1 -0
- package/dist/tools/todos/batch-add/schemas.js +47 -0
- package/dist/tools/todos/batch-add/schemas.js.map +1 -0
- package/dist/tools/todos/batch-update/handler.d.ts +4 -0
- package/dist/tools/todos/batch-update/handler.d.ts.map +1 -0
- package/dist/tools/todos/batch-update/handler.js +25 -0
- package/dist/tools/todos/batch-update/handler.js.map +1 -0
- package/dist/tools/todos/batch-update/schemas.d.ts +35 -0
- package/dist/tools/todos/batch-update/schemas.d.ts.map +1 -0
- package/dist/tools/todos/batch-update/schemas.js +22 -0
- package/dist/tools/todos/batch-update/schemas.js.map +1 -0
- package/dist/tools/todos/complete/handler.d.ts +22 -0
- package/dist/tools/todos/complete/handler.d.ts.map +1 -0
- package/dist/tools/todos/complete/handler.js +76 -0
- package/dist/tools/todos/complete/handler.js.map +1 -0
- package/dist/tools/todos/complete/schemas.d.ts +27 -0
- package/dist/tools/todos/complete/schemas.d.ts.map +1 -0
- package/dist/tools/todos/complete/schemas.js +25 -0
- package/dist/tools/todos/complete/schemas.js.map +1 -0
- package/dist/tools/todos/delete/handler.d.ts +4 -0
- package/dist/tools/todos/delete/handler.d.ts.map +1 -0
- package/dist/tools/todos/delete/handler.js +58 -0
- package/dist/tools/todos/delete/handler.js.map +1 -0
- package/dist/tools/todos/delete/schemas.d.ts +25 -0
- package/dist/tools/todos/delete/schemas.d.ts.map +1 -0
- package/dist/tools/todos/delete/schemas.js +23 -0
- package/dist/tools/todos/delete/schemas.js.map +1 -0
- package/dist/tools/todos/get/handler.d.ts +45 -0
- package/dist/tools/todos/get/handler.d.ts.map +1 -0
- package/dist/tools/todos/get/handler.js +10 -0
- package/dist/tools/todos/get/handler.js.map +1 -0
- package/dist/tools/todos/get/schemas.d.ts +17 -0
- package/dist/tools/todos/get/schemas.d.ts.map +1 -0
- package/dist/tools/todos/get/schemas.js +15 -0
- package/dist/tools/todos/get/schemas.js.map +1 -0
- package/dist/tools/todos/list/handler.d.ts +58 -0
- package/dist/tools/todos/list/handler.d.ts.map +1 -0
- package/dist/tools/todos/list/handler.js +91 -0
- package/dist/tools/todos/list/handler.js.map +1 -0
- package/dist/tools/todos/list/schemas.d.ts +40 -0
- package/dist/tools/todos/list/schemas.d.ts.map +1 -0
- package/dist/tools/todos/list/schemas.js +34 -0
- package/dist/tools/todos/list/schemas.js.map +1 -0
- package/dist/tools/todos/project-ref.d.ts +19 -0
- package/dist/tools/todos/project-ref.d.ts.map +1 -0
- package/dist/tools/todos/project-ref.js +37 -0
- package/dist/tools/todos/project-ref.js.map +1 -0
- package/dist/tools/todos/tool/schemas/index.d.ts +219 -0
- package/dist/tools/todos/tool/schemas/index.d.ts.map +1 -0
- package/dist/tools/todos/tool/schemas/index.js +56 -0
- package/dist/tools/todos/tool/schemas/index.js.map +1 -0
- package/dist/tools/todos/tool/session-todo.descriptor.d.ts +8 -0
- package/dist/tools/todos/tool/session-todo.descriptor.d.ts.map +1 -0
- package/dist/tools/todos/tool/session-todo.descriptor.js +39 -0
- package/dist/tools/todos/tool/session-todo.descriptor.js.map +1 -0
- package/dist/tools/todos/tool/session-todo.variant.add.impl.d.ts +40 -0
- package/dist/tools/todos/tool/session-todo.variant.add.impl.d.ts.map +1 -0
- package/dist/tools/todos/tool/session-todo.variant.add.impl.js +4 -0
- package/dist/tools/todos/tool/session-todo.variant.add.impl.js.map +1 -0
- package/dist/tools/todos/tool/session-todo.variant.batch-add.impl.d.ts +24 -0
- package/dist/tools/todos/tool/session-todo.variant.batch-add.impl.d.ts.map +1 -0
- package/dist/tools/todos/tool/session-todo.variant.batch-add.impl.js +4 -0
- package/dist/tools/todos/tool/session-todo.variant.batch-add.impl.js.map +1 -0
- package/dist/tools/todos/tool/session-todo.variant.batch-complete.impl.d.ts +9 -0
- package/dist/tools/todos/tool/session-todo.variant.batch-complete.impl.d.ts.map +1 -0
- package/dist/tools/todos/tool/session-todo.variant.batch-complete.impl.js +4 -0
- package/dist/tools/todos/tool/session-todo.variant.batch-complete.impl.js.map +1 -0
- package/dist/tools/todos/tool/session-todo.variant.batch-delete.impl.d.ts +10 -0
- package/dist/tools/todos/tool/session-todo.variant.batch-delete.impl.d.ts.map +1 -0
- package/dist/tools/todos/tool/session-todo.variant.batch-delete.impl.js +4 -0
- package/dist/tools/todos/tool/session-todo.variant.batch-delete.impl.js.map +1 -0
- package/dist/tools/todos/tool/session-todo.variant.batch-update.impl.d.ts +9 -0
- package/dist/tools/todos/tool/session-todo.variant.batch-update.impl.d.ts.map +1 -0
- package/dist/tools/todos/tool/session-todo.variant.batch-update.impl.js +4 -0
- package/dist/tools/todos/tool/session-todo.variant.batch-update.impl.js.map +1 -0
- package/dist/tools/todos/tool/session-todo.variant.complete.impl.d.ts +9 -0
- package/dist/tools/todos/tool/session-todo.variant.complete.impl.d.ts.map +1 -0
- package/dist/tools/todos/tool/session-todo.variant.complete.impl.js +4 -0
- package/dist/tools/todos/tool/session-todo.variant.complete.impl.js.map +1 -0
- package/dist/tools/todos/tool/session-todo.variant.delete.impl.d.ts +10 -0
- package/dist/tools/todos/tool/session-todo.variant.delete.impl.d.ts.map +1 -0
- package/dist/tools/todos/tool/session-todo.variant.delete.impl.js +4 -0
- package/dist/tools/todos/tool/session-todo.variant.delete.impl.js.map +1 -0
- package/dist/tools/todos/tool/session-todo.variant.get.impl.d.ts +6 -0
- package/dist/tools/todos/tool/session-todo.variant.get.impl.d.ts.map +1 -0
- package/dist/tools/todos/tool/session-todo.variant.get.impl.js +4 -0
- package/dist/tools/todos/tool/session-todo.variant.get.impl.js.map +1 -0
- package/dist/tools/todos/tool/session-todo.variant.list.impl.d.ts +14 -0
- package/dist/tools/todos/tool/session-todo.variant.list.impl.d.ts.map +1 -0
- package/dist/tools/todos/tool/session-todo.variant.list.impl.js +4 -0
- package/dist/tools/todos/tool/session-todo.variant.list.impl.js.map +1 -0
- package/dist/tools/todos/tool/session-todo.variant.tree.impl.d.ts +7 -0
- package/dist/tools/todos/tool/session-todo.variant.tree.impl.d.ts.map +1 -0
- package/dist/tools/todos/tool/session-todo.variant.tree.impl.js +4 -0
- package/dist/tools/todos/tool/session-todo.variant.tree.impl.js.map +1 -0
- package/dist/tools/todos/tool/session-todo.variant.update.impl.d.ts +21 -0
- package/dist/tools/todos/tool/session-todo.variant.update.impl.d.ts.map +1 -0
- package/dist/tools/todos/tool/session-todo.variant.update.impl.js +4 -0
- package/dist/tools/todos/tool/session-todo.variant.update.impl.js.map +1 -0
- package/dist/tools/todos/tree/handler.d.ts +20 -0
- package/dist/tools/todos/tree/handler.d.ts.map +1 -0
- package/dist/tools/todos/tree/handler.js +41 -0
- package/dist/tools/todos/tree/handler.js.map +1 -0
- package/dist/tools/todos/tree/schemas.d.ts +21 -0
- package/dist/tools/todos/tree/schemas.d.ts.map +1 -0
- package/dist/tools/todos/tree/schemas.js +19 -0
- package/dist/tools/todos/tree/schemas.js.map +1 -0
- package/dist/tools/todos/update/handler.d.ts +54 -0
- package/dist/tools/todos/update/handler.d.ts.map +1 -0
- package/dist/tools/todos/update/handler.js +60 -0
- package/dist/tools/todos/update/handler.js.map +1 -0
- package/dist/tools/todos/update/schemas.d.ts +57 -0
- package/dist/tools/todos/update/schemas.d.ts.map +1 -0
- package/dist/tools/todos/update/schemas.js +35 -0
- package/dist/tools/todos/update/schemas.js.map +1 -0
- package/dist/tools/tool-runtime.d.ts +17 -0
- package/dist/tools/tool-runtime.d.ts.map +1 -0
- package/dist/tools/tool-runtime.js +39 -0
- package/dist/tools/tool-runtime.js.map +1 -0
- package/dist/tools/workspace/handlers.d.ts +75 -0
- package/dist/tools/workspace/handlers.d.ts.map +1 -0
- package/dist/tools/workspace/handlers.js +154 -0
- package/dist/tools/workspace/handlers.js.map +1 -0
- package/dist/tools/workspace/tool/schemas/index.d.ts +47 -0
- package/dist/tools/workspace/tool/schemas/index.d.ts.map +1 -0
- package/dist/tools/workspace/tool/schemas/index.js +33 -0
- package/dist/tools/workspace/tool/schemas/index.js.map +1 -0
- package/dist/tools/workspace/tool/session-workspace.descriptor.d.ts +8 -0
- package/dist/tools/workspace/tool/session-workspace.descriptor.d.ts.map +1 -0
- package/dist/tools/workspace/tool/session-workspace.descriptor.js +31 -0
- package/dist/tools/workspace/tool/session-workspace.descriptor.js.map +1 -0
- package/dist/tools/workspace/tool/session-workspace.variant.list.impl.d.ts +5 -0
- package/dist/tools/workspace/tool/session-workspace.variant.list.impl.d.ts.map +1 -0
- package/dist/tools/workspace/tool/session-workspace.variant.list.impl.js +7 -0
- package/dist/tools/workspace/tool/session-workspace.variant.list.impl.js.map +1 -0
- package/dist/tools/workspace/tool/session-workspace.variant.pair.impl.d.ts +8 -0
- package/dist/tools/workspace/tool/session-workspace.variant.pair.impl.d.ts.map +1 -0
- package/dist/tools/workspace/tool/session-workspace.variant.pair.impl.js +4 -0
- package/dist/tools/workspace/tool/session-workspace.variant.pair.impl.js.map +1 -0
- package/dist/tools/workspace/tool/session-workspace.variant.unpair.impl.d.ts +6 -0
- package/dist/tools/workspace/tool/session-workspace.variant.unpair.impl.d.ts.map +1 -0
- package/dist/tools/workspace/tool/session-workspace.variant.unpair.impl.js +4 -0
- package/dist/tools/workspace/tool/session-workspace.variant.unpair.impl.js.map +1 -0
- package/dist/tui/components/SessionDetailView.d.ts +17 -0
- package/dist/tui/components/SessionDetailView.d.ts.map +1 -0
- package/dist/tui/components/SessionDetailView.js +229 -0
- package/dist/tui/components/SessionDetailView.js.map +1 -0
- package/dist/tui/index.d.ts +7 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js +7 -0
- package/dist/tui/index.js.map +1 -0
- package/dist/tui/session-actions.d.ts +20 -0
- package/dist/tui/session-actions.d.ts.map +1 -0
- package/dist/tui/session-actions.js +27 -0
- package/dist/tui/session-actions.js.map +1 -0
- package/dist/tui/session-tui.plugin.d.ts +10 -0
- package/dist/tui/session-tui.plugin.d.ts.map +1 -0
- package/dist/tui/session-tui.plugin.js +29 -0
- package/dist/tui/session-tui.plugin.js.map +1 -0
- package/dist/tui/sessions-open.descriptor.d.ts +9 -0
- package/dist/tui/sessions-open.descriptor.d.ts.map +1 -0
- package/dist/tui/sessions-open.descriptor.js +18 -0
- package/dist/tui/sessions-open.descriptor.js.map +1 -0
- package/dist/tui/sessions-open.impl.consumer.d.ts +9 -0
- package/dist/tui/sessions-open.impl.consumer.d.ts.map +1 -0
- package/dist/tui/sessions-open.impl.consumer.js +13 -0
- package/dist/tui/sessions-open.impl.consumer.js.map +1 -0
- package/dist/tui/sessions-recovery.d.ts +14 -0
- package/dist/tui/sessions-recovery.d.ts.map +1 -0
- package/dist/tui/sessions-recovery.js +23 -0
- package/dist/tui/sessions-recovery.js.map +1 -0
- package/dist/tui/sessions-registry.descriptor.d.ts +11 -0
- package/dist/tui/sessions-registry.descriptor.d.ts.map +1 -0
- package/dist/tui/sessions-registry.descriptor.js +17 -0
- package/dist/tui/sessions-registry.descriptor.js.map +1 -0
- package/dist/tui/sessions-registry.impl.consumer.d.ts +15 -0
- package/dist/tui/sessions-registry.impl.consumer.d.ts.map +1 -0
- package/dist/tui/sessions-registry.impl.consumer.js +79 -0
- package/dist/tui/sessions-registry.impl.consumer.js.map +1 -0
- package/dist/tui/sessions-registry.state-key.d.ts +32 -0
- package/dist/tui/sessions-registry.state-key.d.ts.map +1 -0
- package/dist/tui/sessions-registry.state-key.js +8 -0
- package/dist/tui/sessions-registry.state-key.js.map +1 -0
- package/dist/tui/sessions.descriptor.d.ts +10 -0
- package/dist/tui/sessions.descriptor.d.ts.map +1 -0
- package/dist/tui/sessions.descriptor.js +25 -0
- package/dist/tui/sessions.descriptor.js.map +1 -0
- package/dist/tui/sessions.impl.consumer.d.ts +4 -0
- package/dist/tui/sessions.impl.consumer.d.ts.map +1 -0
- package/dist/tui/sessions.impl.consumer.js +284 -0
- package/dist/tui/sessions.impl.consumer.js.map +1 -0
- package/dist/tui/sessions.logic.d.ts +33 -0
- package/dist/tui/sessions.logic.d.ts.map +1 -0
- package/dist/tui/sessions.logic.js +94 -0
- package/dist/tui/sessions.logic.js.map +1 -0
- package/package.json +273 -4
|
@@ -0,0 +1,1429 @@
|
|
|
1
|
+
import { StoredClientInfoSchema } from "../../schemas/participant.js";
|
|
2
|
+
/**
|
|
3
|
+
* MCP Participant Utilities
|
|
4
|
+
* Auto-registration and identification for MCP clients
|
|
5
|
+
*
|
|
6
|
+
* HTTP transport state is connection-scoped; durable identity and session
|
|
7
|
+
* routing are resolved by the canonical SessionManager.
|
|
8
|
+
*/
|
|
9
|
+
import { CapabilityError, CaughtFailureSchema, isCapabilityError, valueFreeFailure } from '@vibesdotdev/kernel';
|
|
10
|
+
import * as z from 'zod/v4';
|
|
11
|
+
import { boundSessionIdOf } from '@vibesdotdev/kernel/schemas/scope';
|
|
12
|
+
import { getLogger } from '@vibesdotdev/logging';
|
|
13
|
+
import { generateId } from '@vibesdotdev/shared/utils';
|
|
14
|
+
import { harnessSeatOf, harnessSeatSlug, harnessSessionSeat } from "../../schemas/harness-seat.js";
|
|
15
|
+
import { McpSessionRegistry, mcpSessionRegistryFor } from "./session-registry.js";
|
|
16
|
+
import { unboundSessionErrorFields } from "./unbound-guidance.js";
|
|
17
|
+
/** The serving root's MCP transport registry: the manager's runtime names the root. */
|
|
18
|
+
function registryOf(session) {
|
|
19
|
+
return mcpSessionRegistryFor(session.servingRuntime);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get participant cache for an MCP session
|
|
23
|
+
* Uses connection-scoped cache for HTTP and one transport cache for stdio.
|
|
24
|
+
*/
|
|
25
|
+
function getParticipantCache(registry, mcpSessionId) {
|
|
26
|
+
return registry.getParticipantCache(mcpSessionId ?? null);
|
|
27
|
+
}
|
|
28
|
+
function getRuntimeClientInfo(registry, mcpSessionId) {
|
|
29
|
+
return registry.getClientInfo(mcpSessionId ?? null) ?? undefined;
|
|
30
|
+
}
|
|
31
|
+
/** Connection-scoped initialize identity for bind/receipt projection, on the manager's root. */
|
|
32
|
+
export function getMcpClientInfo(session, mcpSessionId) {
|
|
33
|
+
return getRuntimeClientInfo(registryOf(session), mcpSessionId);
|
|
34
|
+
}
|
|
35
|
+
function getRuntimeConnectionState(registry, mcpSessionId) {
|
|
36
|
+
return registry.getConnectionState(mcpSessionId ?? null) ?? undefined;
|
|
37
|
+
}
|
|
38
|
+
function updateRuntimeConnectionState(registry, updates, mcpSessionId) {
|
|
39
|
+
const effectiveKey = mcpSessionId || updates.connectionId || undefined;
|
|
40
|
+
const previous = getRuntimeConnectionState(registry, effectiveKey) ?? {
|
|
41
|
+
transport: 'stdio'
|
|
42
|
+
};
|
|
43
|
+
const next = {
|
|
44
|
+
transport: updates.transport ?? previous.transport ?? 'stdio',
|
|
45
|
+
connectionId: updates.connectionId ?? previous.connectionId,
|
|
46
|
+
sessionId: updates.sessionId ?? previous.sessionId,
|
|
47
|
+
participantId: updates.participantId ?? previous.participantId ?? null,
|
|
48
|
+
participantSlug: updates.participantSlug ?? previous.participantSlug ?? null,
|
|
49
|
+
httpPeer: updates.httpPeer ?? previous.httpPeer,
|
|
50
|
+
// Map to base type fields for compatibility
|
|
51
|
+
agentId: updates.participantId ?? previous.participantId ?? previous.agentId ?? null,
|
|
52
|
+
agentSlug: updates.participantSlug ?? previous.participantSlug ?? previous.agentSlug ?? null
|
|
53
|
+
};
|
|
54
|
+
registry.setConnectionState(effectiveKey ?? null, next);
|
|
55
|
+
return next;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Publish an already-authoritative participant/session receipt into one live
|
|
59
|
+
* transport context. This is deliberately memory-only: reconnect recovery has
|
|
60
|
+
* already validated the durable participant mapping and must not create a new
|
|
61
|
+
* connection row, routing row, presence row, or lease merely to teach the
|
|
62
|
+
* replacement HTTP transport what it owns.
|
|
63
|
+
*/
|
|
64
|
+
export function bindRuntimeConnectionReceipt(runtime, mcpSessionId, participantId, sessionId) {
|
|
65
|
+
updateRuntimeConnectionState(mcpSessionRegistryFor(runtime), {
|
|
66
|
+
transport: 'http',
|
|
67
|
+
connectionId: mcpSessionId,
|
|
68
|
+
participantId,
|
|
69
|
+
sessionId
|
|
70
|
+
}, mcpSessionId);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Every session refusal code, mapped onto the CapabilityError taxonomy. The
|
|
74
|
+
* session code travels as the kebab-case `reason` and as
|
|
75
|
+
* `details.sessionCode` (compatibility for readers of the old wire code).
|
|
76
|
+
*/
|
|
77
|
+
const SESSION_TOOL_ERROR_CODES = {
|
|
78
|
+
AMBIGUOUS_BATCH_SEND: 'CONFLICT',
|
|
79
|
+
BATCH_BROADCAST_UNSUPPORTED: 'INVALID_INPUT',
|
|
80
|
+
CONNECTION_UNBOUND: 'AUTH_REQUIRED',
|
|
81
|
+
FORBIDDEN_MARK_READ: 'PERMISSION_DENIED',
|
|
82
|
+
INVALID_MESSAGE_TARGET: 'INVALID_INPUT',
|
|
83
|
+
INVALID_PATH: 'INVALID_INPUT',
|
|
84
|
+
INVALID_SCRATCHPAD_INPUT: 'INVALID_INPUT',
|
|
85
|
+
INVALID_SCRATCHPAD_TARGET: 'INVALID_INPUT',
|
|
86
|
+
MESSAGE_TOO_LONG: 'INVALID_INPUT',
|
|
87
|
+
MISSING_BATCH_ID: 'INVALID_INPUT',
|
|
88
|
+
MISSING_CONTENT: 'INVALID_INPUT',
|
|
89
|
+
MISSING_RECIPIENT: 'INVALID_INPUT',
|
|
90
|
+
NO_BROADCAST_RECIPIENTS: 'NOT_FOUND',
|
|
91
|
+
NOT_FOUND: 'NOT_FOUND',
|
|
92
|
+
PARTICIPANT_IDENTITY_REQUIRED: 'AUTH_REQUIRED',
|
|
93
|
+
PARTICIPANT_NOT_FOUND: 'NOT_FOUND',
|
|
94
|
+
PROJECT_REF_CONFLICT: 'CONFLICT',
|
|
95
|
+
PROJECT_REF_UNBOUND: 'CONFLICT',
|
|
96
|
+
REQUESTED_SESSION_UNRESOLVABLE: 'NOT_FOUND',
|
|
97
|
+
SCRATCHPAD_ENTRY_NOT_FOUND: 'NOT_FOUND',
|
|
98
|
+
SESSION_MANAGER_UNAVAILABLE: 'UNAVAILABLE',
|
|
99
|
+
SESSION_NOT_ACTIVE: 'CONFLICT',
|
|
100
|
+
SESSION_NOT_FOUND: 'NOT_FOUND',
|
|
101
|
+
SESSION_RECEIPT_STALE: 'CONFLICT',
|
|
102
|
+
SESSION_TARGET_REQUIRED: 'INVALID_INPUT',
|
|
103
|
+
SESSION_REFERENCE_AMBIGUOUS: 'CONFLICT',
|
|
104
|
+
SESSION_REQUIRED: 'AUTH_REQUIRED',
|
|
105
|
+
STALE_SESSION_MANAGER: 'UNAVAILABLE',
|
|
106
|
+
TODO_FILTER_CONFLICT: 'INVALID_INPUT',
|
|
107
|
+
TODO_GRAPH_CYCLE: 'CONFLICT',
|
|
108
|
+
TODO_NOT_FOUND: 'NOT_FOUND',
|
|
109
|
+
UNKNOWN_PARTICIPANT: 'NOT_FOUND',
|
|
110
|
+
UNKNOWN_RECIPIENT: 'NOT_FOUND'
|
|
111
|
+
};
|
|
112
|
+
/** `SESSION_NOT_ACTIVE` → `session-not-active`. */
|
|
113
|
+
export function sessionToolErrorReason(code) {
|
|
114
|
+
return code.toLowerCase().replaceAll('_', '-');
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Build a session tool refusal as a typed CapabilityError: the taxonomy code
|
|
118
|
+
* mapped from `code`, `reason` the kebab-case session code, the hint as its
|
|
119
|
+
* `recoveryHint`, and `details` (JSON) plus `details.sessionCode`.
|
|
120
|
+
*/
|
|
121
|
+
export function createSessionToolError(code, message, hint, details) {
|
|
122
|
+
const options = {
|
|
123
|
+
reason: sessionToolErrorReason(code),
|
|
124
|
+
details: { ...details, sessionCode: code }
|
|
125
|
+
};
|
|
126
|
+
if (hint)
|
|
127
|
+
options.recoveryHint = hint;
|
|
128
|
+
return new CapabilityError(message, SESSION_TOOL_ERROR_CODES[code], options);
|
|
129
|
+
}
|
|
130
|
+
/** Whether `error` is the session refusal `code` (read from its reason, never its message). */
|
|
131
|
+
export function isSessionToolError(error, code) {
|
|
132
|
+
return isCapabilityError(error) && error.reason === sessionToolErrorReason(code);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Get the one canonical process SessionManager (sync version).
|
|
136
|
+
*
|
|
137
|
+
* @deprecated There is no ambient process manager. Resolve the runtime's own
|
|
138
|
+
* owner instead: `runtime.context('session/manager')` or
|
|
139
|
+
* `getVibesClient<SessionClient>('session', runtime).getManager()`. Kept
|
|
140
|
+
* exported for external callers; it always refuses typed.
|
|
141
|
+
*/
|
|
142
|
+
export function getSessionManager() {
|
|
143
|
+
throw createSessionToolError('SESSION_MANAGER_UNAVAILABLE', 'Session manager is not initialized for this runtime.', 'Resolve runtime.context("session/manager") during surface bootstrap.');
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Resolve the manager owned by an explicit runtime.
|
|
147
|
+
*/
|
|
148
|
+
export async function getSessionManagerAsync(runtime) {
|
|
149
|
+
if (runtime?.hasContext?.('session/manager')) {
|
|
150
|
+
return await runtime.context('session/manager');
|
|
151
|
+
}
|
|
152
|
+
throw createSessionToolError('SESSION_MANAGER_UNAVAILABLE', 'The runtime has no session/manager context.', 'Ensure the session plugin is registered before using session tools.');
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Ensure session manager is initialized for the runtime.
|
|
156
|
+
*
|
|
157
|
+
* @deprecated Pass-through to {@link getSessionManagerAsync}. Use the canonical
|
|
158
|
+
* owner directly: `runtime.context('session/manager')` or
|
|
159
|
+
* `getVibesClient<SessionClient>('session', runtime).getManager()`.
|
|
160
|
+
*/
|
|
161
|
+
export function ensureSessionManagerAsync(runtime) {
|
|
162
|
+
return getSessionManagerAsync(runtime);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Seed the canonical process SessionManager during surface bootstrap.
|
|
166
|
+
*
|
|
167
|
+
* @deprecated The manager is runtime-owned; this is a no-op. Register the
|
|
168
|
+
* session plugin and resolve `runtime.context('session/manager')` (or
|
|
169
|
+
* `getVibesClient<SessionClient>('session', runtime).getManager()`) instead.
|
|
170
|
+
*/
|
|
171
|
+
export function setSessionManager(_manager) {
|
|
172
|
+
// Deprecated: SessionManager is runtime-owned via runtime.context('session/manager').
|
|
173
|
+
}
|
|
174
|
+
const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
175
|
+
const SLUG_REGEX = /^[a-z0-9](?:[a-z0-9-]{1,62}[a-z0-9])?$/;
|
|
176
|
+
/**
|
|
177
|
+
* Hex soup that reads as a BOTCHED UUID (>=20 hex chars once dashes drop) is a
|
|
178
|
+
* typo'd identity, never a deliberate seat name. Self-identification must
|
|
179
|
+
* refuse to register these: store-writer reproduced the disease live — one
|
|
180
|
+
* mistyped UUID digit in fromParticipant minted a phantom whose slug IS the
|
|
181
|
+
* typo, and the send reported success (stoa L-14, FROM-side).
|
|
182
|
+
*/
|
|
183
|
+
function looksLikeBotchedUuid(reference) {
|
|
184
|
+
const compact = reference.replace(/-/g, '');
|
|
185
|
+
return !UUID_REGEX.test(reference) && /^[0-9a-f]{20,}$/i.test(compact);
|
|
186
|
+
}
|
|
187
|
+
export function sanitizeSlugCandidate(candidate) {
|
|
188
|
+
const normalized = candidate
|
|
189
|
+
.trim()
|
|
190
|
+
.toLowerCase()
|
|
191
|
+
.replace(/[^a-z0-9-]+/g, '-')
|
|
192
|
+
.replace(/-+/g, '-')
|
|
193
|
+
.replace(/^-+/, '')
|
|
194
|
+
.replace(/-+$/, '');
|
|
195
|
+
if (normalized.length === 0) {
|
|
196
|
+
return 'participant';
|
|
197
|
+
}
|
|
198
|
+
return normalized.slice(0, 64);
|
|
199
|
+
}
|
|
200
|
+
/** The profile metadata fields identity reads; each parsed independently, a malformed one is absent. */
|
|
201
|
+
const IdentityMetadataSchema = z.object({
|
|
202
|
+
slug: z.string().min(1).optional().catch(undefined),
|
|
203
|
+
clientInfo: z
|
|
204
|
+
.object({ harnessSessionId: z.string().optional().catch(undefined) })
|
|
205
|
+
.optional()
|
|
206
|
+
.catch(undefined),
|
|
207
|
+
source: z.string().optional().catch(undefined),
|
|
208
|
+
connectionId: z.string().optional().catch(undefined),
|
|
209
|
+
registeredAt: z.string().optional().catch(undefined)
|
|
210
|
+
});
|
|
211
|
+
function identityMetadataOf(metadata) {
|
|
212
|
+
const parsed = IdentityMetadataSchema.safeParse(metadata ?? {});
|
|
213
|
+
return parsed.success ? parsed.data : {};
|
|
214
|
+
}
|
|
215
|
+
function extractSlug(metadata) {
|
|
216
|
+
const slug = identityMetadataOf(metadata).slug;
|
|
217
|
+
return slug ? sanitizeSlugCandidate(slug) : null;
|
|
218
|
+
}
|
|
219
|
+
export async function ensureParticipantSlug(session, participantId, profile) {
|
|
220
|
+
const resolvedProfile = profile ?? (await session.getParticipant(participantId));
|
|
221
|
+
if (!resolvedProfile) {
|
|
222
|
+
throw createSessionToolError('PARTICIPANT_NOT_FOUND', `Participant ${participantId} is not registered in this workspace.`, 'Call `session-participant-list` to inspect registered participants or register a new participant before assignment.');
|
|
223
|
+
}
|
|
224
|
+
const existingSlug = extractSlug(resolvedProfile.metadata);
|
|
225
|
+
if (existingSlug && SLUG_REGEX.test(existingSlug)) {
|
|
226
|
+
return { profile: resolvedProfile, slug: existingSlug };
|
|
227
|
+
}
|
|
228
|
+
const slug = sanitizeSlugCandidate(resolvedProfile.name || participantId);
|
|
229
|
+
const metadata = {
|
|
230
|
+
...resolvedProfile.metadata,
|
|
231
|
+
clientInfo: StoredClientInfoSchema.parse(resolvedProfile.metadata.clientInfo),
|
|
232
|
+
slug
|
|
233
|
+
};
|
|
234
|
+
await session.updateParticipant(resolvedProfile.participantId, { metadata });
|
|
235
|
+
return {
|
|
236
|
+
profile: {
|
|
237
|
+
...resolvedProfile,
|
|
238
|
+
metadata
|
|
239
|
+
},
|
|
240
|
+
slug
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Resolve an already-registered participant without repairing metadata or
|
|
245
|
+
* registering a new seat. Recovery admission uses this read-only lookup before
|
|
246
|
+
* deciding whether a legacy bind can take the parallel receipt lane.
|
|
247
|
+
*/
|
|
248
|
+
export async function resolveExistingParticipantReference(reference, session) {
|
|
249
|
+
const trimmed = reference.trim();
|
|
250
|
+
if (UUID_REGEX.test(trimmed)) {
|
|
251
|
+
const profile = await session.getParticipant(trimmed);
|
|
252
|
+
if (!profile)
|
|
253
|
+
return null;
|
|
254
|
+
return {
|
|
255
|
+
participantId: profile.participantId,
|
|
256
|
+
profile,
|
|
257
|
+
slug: extractSlug(profile.metadata) ?? sanitizeSlugCandidate(profile.name || profile.participantId)
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
const scan = await scanParticipantsBySlug(session, trimmed);
|
|
261
|
+
if (!scan.match)
|
|
262
|
+
return null;
|
|
263
|
+
return {
|
|
264
|
+
participantId: scan.match.participantId,
|
|
265
|
+
profile: scan.match,
|
|
266
|
+
slug: extractSlug(scan.match.metadata) ??
|
|
267
|
+
sanitizeSlugCandidate(scan.match.name || scan.match.participantId)
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Harness conversation ids (Grok TUI, Codex, Claude Code, Muse). Distinct
|
|
272
|
+
* from the MCP transport `connectionId`, which must never seed a slug —
|
|
273
|
+
* that minted a participant per hook handshake and buried the roster.
|
|
274
|
+
* Order is precedence when several are set; a body normally sets one.
|
|
275
|
+
*/
|
|
276
|
+
export const HARNESS_SESSION_ENV_KEYS = [
|
|
277
|
+
'GROK_SESSION_ID',
|
|
278
|
+
'CODEX_SESSION_ID',
|
|
279
|
+
// Claude Code exports CLAUDE_CODE_SESSION_ID; CLAUDE_SESSION_ID was never
|
|
280
|
+
// set by it, so Claude seats had no harness session and a bare init fell
|
|
281
|
+
// through to the workspace default session.
|
|
282
|
+
'CLAUDE_CODE_SESSION_ID',
|
|
283
|
+
'CLAUDE_SESSION_ID',
|
|
284
|
+
'MUSE_SESSION_ID'
|
|
285
|
+
];
|
|
286
|
+
export function readHarnessSessionIdFromEnv(runtime, env) {
|
|
287
|
+
// Reads through the handed runtime's environment gateway rather than the
|
|
288
|
+
// `process` global. This module is reachable from unqualified public exports
|
|
289
|
+
// (`./mcp/utils/participant`, `./mcp/utils/mcp-session-resolver`), so its
|
|
290
|
+
// closure has to import in EVERY scope — and `process` does not exist in
|
|
291
|
+
// workerd. An explicit `env` still wins, which is what the tests pass.
|
|
292
|
+
for (const key of HARNESS_SESSION_ENV_KEYS) {
|
|
293
|
+
const value = (env ? env[key] : runtime.getEnv(key))?.trim();
|
|
294
|
+
if (value)
|
|
295
|
+
return value;
|
|
296
|
+
}
|
|
297
|
+
return undefined;
|
|
298
|
+
}
|
|
299
|
+
/** Legacy display key. Never use this truncated value as custody authority. */
|
|
300
|
+
export function shortHarnessSeat(harnessSessionId) {
|
|
301
|
+
const compact = harnessSessionId.replace(/[^a-zA-Z0-9]/g, '').toLowerCase();
|
|
302
|
+
return compact.slice(0, 8);
|
|
303
|
+
}
|
|
304
|
+
/** Collision-resistant seat key derived from the complete normalized harness identity. */
|
|
305
|
+
export { harnessSessionSeat };
|
|
306
|
+
/**
|
|
307
|
+
* A slug derived from identity the client DECLARES about itself, never from
|
|
308
|
+
* the transport connection it arrived on.
|
|
309
|
+
*
|
|
310
|
+
* Two identities live on one body:
|
|
311
|
+
* - **Kind** (`agentId`, e.g. `grok`) keys presence/brain/storage. Shared.
|
|
312
|
+
* - **Seat** (participant slug) is this harness conversation. Unique without
|
|
313
|
+
* the agent inventing a nickname.
|
|
314
|
+
*
|
|
315
|
+
* A connection is how a body reached us. Seeding the slug with `connectionId`
|
|
316
|
+
* minted a participant per hook handshake and buried the roster. Harness
|
|
317
|
+
* session id is the interactive seat. `externalToolId` remains the durable
|
|
318
|
+
* seat for short-lived tool runners.
|
|
319
|
+
*/
|
|
320
|
+
export function declaredIdentitySlug(clientInfo) {
|
|
321
|
+
if (!clientInfo)
|
|
322
|
+
return undefined;
|
|
323
|
+
const seat = harnessSeatOf(clientInfo);
|
|
324
|
+
if (seat)
|
|
325
|
+
return harnessSeatSlug(seat);
|
|
326
|
+
const kind = sanitizeSlugCandidate(clientInfo.agentId || clientInfo.name || '');
|
|
327
|
+
if (clientInfo.harnessSessionId) {
|
|
328
|
+
const seat = harnessSessionSeat(clientInfo.harnessSessionId);
|
|
329
|
+
if (kind && kind !== 'participant' && seat) {
|
|
330
|
+
const slug = sanitizeSlugCandidate(`${kind}-${seat}`);
|
|
331
|
+
return slug.length > 0 ? slug : undefined;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
const declared = clientInfo.externalToolId ?? clientInfo.agentId;
|
|
335
|
+
if (!declared)
|
|
336
|
+
return undefined;
|
|
337
|
+
const seed = clientInfo.name ? `${clientInfo.name}-${declared}` : declared;
|
|
338
|
+
const slug = sanitizeSlugCandidate(seed);
|
|
339
|
+
return slug.length > 0 ? slug : undefined;
|
|
340
|
+
}
|
|
341
|
+
function legacyDeclaredIdentitySlug(clientInfo) {
|
|
342
|
+
if (!clientInfo.harnessSessionId)
|
|
343
|
+
return undefined;
|
|
344
|
+
const kind = sanitizeSlugCandidate(clientInfo.agentId || clientInfo.name || '');
|
|
345
|
+
const seat = shortHarnessSeat(clientInfo.harnessSessionId);
|
|
346
|
+
if (!kind || kind === 'participant' || !seat)
|
|
347
|
+
return undefined;
|
|
348
|
+
return sanitizeSlugCandidate(`${kind}-${seat}`);
|
|
349
|
+
}
|
|
350
|
+
function storedHarnessSessionId(profile) {
|
|
351
|
+
return identityMetadataOf(profile.metadata).clientInfo?.harnessSessionId?.trim().toLowerCase();
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Every participant in STABLE order (participantId ascending), one keyset page
|
|
355
|
+
* at a time: each page is a single range read of the participantId index, so a
|
|
356
|
+
* full scan reads each row once. OFFSET paging re-walked every earlier row on
|
|
357
|
+
* every page, which is quadratic in the directory size.
|
|
358
|
+
*/
|
|
359
|
+
export async function* stableParticipantPages(session, pageSize) {
|
|
360
|
+
let after;
|
|
361
|
+
while (true) {
|
|
362
|
+
const page = await session.listParticipants(after === undefined
|
|
363
|
+
? { limit: pageSize, orderBy: 'stable' }
|
|
364
|
+
: { limit: pageSize, orderBy: 'stable', after });
|
|
365
|
+
if (page.length > 0)
|
|
366
|
+
yield page;
|
|
367
|
+
if (page.length < pageSize)
|
|
368
|
+
return;
|
|
369
|
+
after = page[page.length - 1].participantId;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Scan the participant directory for a slug in STABLE order.
|
|
374
|
+
*
|
|
375
|
+
* Paging over the default recency sort (lastSeenAt desc) is a race: any
|
|
376
|
+
* participant whose lastSeenAt is bumped mid-scan moves across the page
|
|
377
|
+
* cursor, so a registered slug can be SKIPPED (→ duplicate registration) or
|
|
378
|
+
* visited twice (ledger L-19). participantId-ascending is immutable and
|
|
379
|
+
* unique, so every scanner walks the same total order and — when duplicates
|
|
380
|
+
* of a slug do exist — every resolver converges on the same deterministic
|
|
381
|
+
* winner (the first in that order).
|
|
382
|
+
*/
|
|
383
|
+
async function scanParticipantsBySlug(session, slug) {
|
|
384
|
+
const normalized = sanitizeSlugCandidate(slug);
|
|
385
|
+
const knownSlugs = new Set();
|
|
386
|
+
for await (const participants of stableParticipantPages(session, 200)) {
|
|
387
|
+
for (const participant of participants) {
|
|
388
|
+
const metadataSlug = extractSlug(participant.metadata);
|
|
389
|
+
if (metadataSlug)
|
|
390
|
+
knownSlugs.add(sanitizeSlugCandidate(metadataSlug));
|
|
391
|
+
if (participant.name)
|
|
392
|
+
knownSlugs.add(sanitizeSlugCandidate(participant.name));
|
|
393
|
+
if ((metadataSlug && sanitizeSlugCandidate(metadataSlug) === normalized) ||
|
|
394
|
+
sanitizeSlugCandidate(participant.name) === normalized ||
|
|
395
|
+
sanitizeSlugCandidate(participant.participantId) === normalized) {
|
|
396
|
+
return { match: participant, knownSlugs: Array.from(knownSlugs) };
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
return { match: null, knownSlugs: Array.from(knownSlugs) };
|
|
401
|
+
}
|
|
402
|
+
async function scanLegacyParticipantByHarness(session, legacySlug, harnessSessionId) {
|
|
403
|
+
const normalizedSlug = sanitizeSlugCandidate(legacySlug);
|
|
404
|
+
const normalizedHarness = harnessSessionId.trim().toLowerCase();
|
|
405
|
+
for await (const participants of stableParticipantPages(session, 200)) {
|
|
406
|
+
for (const participant of participants) {
|
|
407
|
+
if (extractSlug(participant.metadata) === normalizedSlug &&
|
|
408
|
+
storedHarnessSessionId(participant) === normalizedHarness) {
|
|
409
|
+
return participant;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
return null;
|
|
414
|
+
}
|
|
415
|
+
async function resolveDeclaredIdentityParticipant(session, clientInfo) {
|
|
416
|
+
const currentSlug = declaredIdentitySlug(clientInfo);
|
|
417
|
+
if (!currentSlug)
|
|
418
|
+
return null;
|
|
419
|
+
const seat = harnessSeatOf(clientInfo);
|
|
420
|
+
if (seat) {
|
|
421
|
+
const seated = await session.findHarnessSeat(seat);
|
|
422
|
+
if (seated) {
|
|
423
|
+
return { participantId: seated.participantId, profile: seated, slug: currentSlug, legacy: false };
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
const current = (await scanParticipantsBySlug(session, currentSlug)).match;
|
|
427
|
+
if (current) {
|
|
428
|
+
return { participantId: current.participantId, profile: current, slug: currentSlug, legacy: false };
|
|
429
|
+
}
|
|
430
|
+
const legacySlug = legacyDeclaredIdentitySlug(clientInfo);
|
|
431
|
+
if (!legacySlug || legacySlug === currentSlug || !clientInfo.harnessSessionId)
|
|
432
|
+
return null;
|
|
433
|
+
const legacy = await scanLegacyParticipantByHarness(session, legacySlug, clientInfo.harnessSessionId);
|
|
434
|
+
if (!legacy)
|
|
435
|
+
return null;
|
|
436
|
+
return { participantId: legacy.participantId, profile: legacy, slug: currentSlug, legacy: true };
|
|
437
|
+
}
|
|
438
|
+
/** Bounded Levenshtein distance (early-exit above `max`) for typo suggestions. */
|
|
439
|
+
function editDistanceAtMost(a, b, max) {
|
|
440
|
+
if (Math.abs(a.length - b.length) > max)
|
|
441
|
+
return max + 1;
|
|
442
|
+
const previous = Array.from({ length: b.length + 1 }, () => 0);
|
|
443
|
+
const current = Array.from({ length: b.length + 1 }, () => 0);
|
|
444
|
+
for (let j = 0; j <= b.length; j++)
|
|
445
|
+
previous[j] = j;
|
|
446
|
+
for (let i = 1; i <= a.length; i++) {
|
|
447
|
+
current[0] = i;
|
|
448
|
+
let rowMin = current[0];
|
|
449
|
+
for (let j = 1; j <= b.length; j++) {
|
|
450
|
+
current[j] = Math.min(previous[j] + 1, current[j - 1] + 1, previous[j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1));
|
|
451
|
+
rowMin = Math.min(rowMin, current[j]);
|
|
452
|
+
}
|
|
453
|
+
if (rowMin > max)
|
|
454
|
+
return max + 1;
|
|
455
|
+
for (let j = 0; j <= b.length; j++)
|
|
456
|
+
previous[j] = current[j];
|
|
457
|
+
}
|
|
458
|
+
return previous[b.length];
|
|
459
|
+
}
|
|
460
|
+
/** Rank known slugs by closeness to a mistyped reference; top 3 within distance 2 or containment. */
|
|
461
|
+
function suggestNearMissSlugs(target, knownSlugs) {
|
|
462
|
+
const scored = [];
|
|
463
|
+
for (const slug of new Set(knownSlugs)) {
|
|
464
|
+
if (!slug || slug === target)
|
|
465
|
+
continue;
|
|
466
|
+
const distance = editDistanceAtMost(target, slug, 2);
|
|
467
|
+
if (distance <= 2) {
|
|
468
|
+
scored.push({ slug, distance });
|
|
469
|
+
}
|
|
470
|
+
else if (slug.includes(target) || target.includes(slug)) {
|
|
471
|
+
scored.push({ slug, distance: 3 });
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
scored.sort((a, b) => a.distance - b.distance || a.slug.localeCompare(b.slug));
|
|
475
|
+
return scored.slice(0, 3).map((entry) => entry.slug);
|
|
476
|
+
}
|
|
477
|
+
export async function resolveParticipantReference(reference, sessionManager, mcpSessionId, options = {}) {
|
|
478
|
+
const session = sessionManager ?? getSessionManager();
|
|
479
|
+
const trimmed = reference.trim();
|
|
480
|
+
if (UUID_REGEX.test(trimmed)) {
|
|
481
|
+
const { profile, slug } = await ensureParticipantSlug(session, trimmed);
|
|
482
|
+
return { participantId: trimmed, profile, slug, registered: false };
|
|
483
|
+
}
|
|
484
|
+
const scan = await scanParticipantsBySlug(session, trimmed);
|
|
485
|
+
let profile = scan.match;
|
|
486
|
+
let registered = false;
|
|
487
|
+
if (!profile) {
|
|
488
|
+
if (options.registerIfMissing && looksLikeBotchedUuid(trimmed)) {
|
|
489
|
+
throw createSessionToolError(options.missingCode ?? 'UNKNOWN_PARTICIPANT', `"${trimmed}" reads as a mistyped UUID, not a participant name — refusing to register it as a new identity.`, 'Copy the exact UUID from session status / the roster. If you really meant a new seat, pick a human-readable slug.', { reference: trimmed, suggestions: [] });
|
|
490
|
+
}
|
|
491
|
+
if (!options.registerIfMissing) {
|
|
492
|
+
const sanitized = sanitizeSlugCandidate(trimmed);
|
|
493
|
+
const suggestions = suggestNearMissSlugs(sanitized, scan.knownSlugs);
|
|
494
|
+
throw createSessionToolError(options.missingCode ?? 'UNKNOWN_PARTICIPANT', `No participant matches "${trimmed}".${suggestions.length > 0 ? ` Closest registered: ${suggestions.join(', ')}.` : ''}`, 'Copy the exact UUID or slug from session status / the session roster. Participants are only auto-registered when identifying THEMSELVES (init/status participantId, message fromParticipant); a recipient, filter, or assignee must already exist.', { reference: trimmed, suggestions });
|
|
495
|
+
}
|
|
496
|
+
const sanitizedSlug = sanitizeSlugCandidate(trimmed);
|
|
497
|
+
const generatedId = generateId();
|
|
498
|
+
profile = await session.registerParticipant({
|
|
499
|
+
participantId: generatedId,
|
|
500
|
+
name: sanitizedSlug.length > 0 ? sanitizedSlug : `participant-${generatedId.slice(0, 8)}`,
|
|
501
|
+
role: 'participant',
|
|
502
|
+
metadata: {
|
|
503
|
+
source: 'mcp',
|
|
504
|
+
autoRegistered: true,
|
|
505
|
+
slug: sanitizedSlug.length > 0 ? sanitizedSlug : undefined
|
|
506
|
+
}
|
|
507
|
+
});
|
|
508
|
+
registered = true;
|
|
509
|
+
// Registration race guard (ledger L-19): find-then-create has no unique
|
|
510
|
+
// constraint, so two concurrent self-identifications with the same fresh
|
|
511
|
+
// slug can BOTH register. Re-scan in stable order and yield to the
|
|
512
|
+
// deterministic winner, deleting our own extra row so the slug maps to
|
|
513
|
+
// ONE identity everywhere.
|
|
514
|
+
const winner = (await scanParticipantsBySlug(session, sanitizedSlug)).match;
|
|
515
|
+
if (winner && winner.participantId !== profile.participantId) {
|
|
516
|
+
await deleteLosingDuplicate(session, profile.participantId);
|
|
517
|
+
profile = winner;
|
|
518
|
+
registered = false;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
const { profile: ensuredProfile, slug } = await ensureParticipantSlug(session, profile.participantId, profile);
|
|
522
|
+
return { participantId: ensuredProfile.participantId, profile: ensuredProfile, slug, registered };
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Best-effort cleanup of a registration race loser: the row is seconds old and
|
|
526
|
+
* unreferenced, so a failed delete leaves it dormant while every resolver
|
|
527
|
+
* converges on the winner. The failure is reported, value-free, once.
|
|
528
|
+
*/
|
|
529
|
+
async function deleteLosingDuplicate(session, participantId) {
|
|
530
|
+
// Session's MCP logger on the manager's runtime: that root's sinks and redaction.
|
|
531
|
+
const logger = getLogger('session:mcp', session.servingRuntime);
|
|
532
|
+
try {
|
|
533
|
+
await session.deleteParticipant(participantId);
|
|
534
|
+
}
|
|
535
|
+
catch (error) {
|
|
536
|
+
logger.warn('Failed to delete losing duplicate participant row', {
|
|
537
|
+
participantId,
|
|
538
|
+
error: valueFreeFailure(CaughtFailureSchema.parse(error))
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* Reserved references that mean "everyone in this session" rather than a single
|
|
544
|
+
* participant slug. Sending to one of these fans out (see
|
|
545
|
+
* {@link resolveSessionBroadcastRecipients}); it must NEVER be resolved as an
|
|
546
|
+
* ordinary slug, because {@link resolveParticipantReference} would auto-register
|
|
547
|
+
* a phantom participant literally named "all"/"everyone" that reaches nobody.
|
|
548
|
+
*/
|
|
549
|
+
export const BROADCAST_KEYWORDS = new Set([
|
|
550
|
+
'all',
|
|
551
|
+
'everyone',
|
|
552
|
+
'everybody',
|
|
553
|
+
'broadcast',
|
|
554
|
+
'*'
|
|
555
|
+
]);
|
|
556
|
+
export function isBroadcastReference(reference) {
|
|
557
|
+
return BROADCAST_KEYWORDS.has(reference.trim().toLowerCase());
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* Enumerate the real recipients of a session broadcast.
|
|
561
|
+
*
|
|
562
|
+
* Session membership is NOT a first-class durable table — `participant_profiles`
|
|
563
|
+
* is workspace-global — so membership is derived from durable, session-scoped
|
|
564
|
+
* signals, unioned for robustness against any single source going cold:
|
|
565
|
+
* 1. every participant that has sent or received a message in this session
|
|
566
|
+
* 2. the session owner
|
|
567
|
+
* 3. anyone with live presence in this session (best-effort; 5-min window)
|
|
568
|
+
*
|
|
569
|
+
* The sender is excluded, and any legacy phantom broadcast-keyword participants
|
|
570
|
+
* (auto-registered "all"/"everyone" from the pre-fix behavior) are filtered out
|
|
571
|
+
* by slug so a broadcast never re-targets the very phantoms this replaces.
|
|
572
|
+
*/
|
|
573
|
+
export async function resolveSessionBroadcastRecipients(session, sessionId, senderParticipantId) {
|
|
574
|
+
const candidateIds = new Set();
|
|
575
|
+
// Union every session-scoped membership signal. Exclusive-preferring
|
|
576
|
+
// leases delivered to 1 of N when only one lease was live. A signal whose
|
|
577
|
+
// read fails fails the broadcast: delivering to a silently narrowed set
|
|
578
|
+
// would report success while reaching only part of the session.
|
|
579
|
+
for (const lease of await session.listActiveMembershipLeases(sessionId)) {
|
|
580
|
+
if (lease.participantId)
|
|
581
|
+
candidateIds.add(lease.participantId);
|
|
582
|
+
}
|
|
583
|
+
const messages = await session.getMessages(sessionId, { limit: 5000, offset: 0 });
|
|
584
|
+
for (const message of messages) {
|
|
585
|
+
if (message.fromParticipant)
|
|
586
|
+
candidateIds.add(message.fromParticipant);
|
|
587
|
+
if (message.toParticipant)
|
|
588
|
+
candidateIds.add(message.toParticipant);
|
|
589
|
+
}
|
|
590
|
+
const sessionData = await session.getSession(sessionId);
|
|
591
|
+
if (sessionData?.ownerParticipant)
|
|
592
|
+
candidateIds.add(sessionData.ownerParticipant);
|
|
593
|
+
if (sessionData?.assignedParticipant)
|
|
594
|
+
candidateIds.add(sessionData.assignedParticipant);
|
|
595
|
+
for (const record of await session.getActivePresence(sessionId)) {
|
|
596
|
+
if (record.participantId)
|
|
597
|
+
candidateIds.add(record.participantId);
|
|
598
|
+
}
|
|
599
|
+
for (const participantId of await session.listBoundParticipantIds(sessionId)) {
|
|
600
|
+
candidateIds.add(participantId);
|
|
601
|
+
}
|
|
602
|
+
candidateIds.delete(senderParticipantId);
|
|
603
|
+
const recipients = [];
|
|
604
|
+
for (const participantId of candidateIds) {
|
|
605
|
+
// Only a confirmed-unregistered id is skipped (a stale reference in history);
|
|
606
|
+
// a failed read propagates.
|
|
607
|
+
const profile = await session.getParticipant(participantId);
|
|
608
|
+
if (!profile)
|
|
609
|
+
continue;
|
|
610
|
+
const { slug } = await ensureParticipantSlug(session, participantId, profile);
|
|
611
|
+
if (BROADCAST_KEYWORDS.has(slug))
|
|
612
|
+
continue;
|
|
613
|
+
recipients.push({ participantId, slug });
|
|
614
|
+
}
|
|
615
|
+
return recipients;
|
|
616
|
+
}
|
|
617
|
+
async function updateTransportSessionBinding(sessionManager, resolved, mcpSessionId, participantId) {
|
|
618
|
+
if (!mcpSessionId)
|
|
619
|
+
return;
|
|
620
|
+
if (resolved?.status === 'active') {
|
|
621
|
+
await sessionManager.linkMcpSession(mcpSessionId, resolved.id);
|
|
622
|
+
await recordTransportPresence(sessionManager, resolved.id, mcpSessionId, participantId);
|
|
623
|
+
return;
|
|
624
|
+
}
|
|
625
|
+
await sessionManager.unlinkMcpSession(mcpSessionId);
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* Presence is an advisory liveness signal (a five-minute window), recorded
|
|
629
|
+
* after the binding itself is durable: a failed write is reported, value-free,
|
|
630
|
+
* once and never undoes the bind it decorates.
|
|
631
|
+
*/
|
|
632
|
+
async function recordTransportPresence(sessionManager, sessionId, mcpSessionId, participantId) {
|
|
633
|
+
const logger = getLogger('session:mcp', sessionManager.servingRuntime);
|
|
634
|
+
try {
|
|
635
|
+
await sessionManager.recordPresence({
|
|
636
|
+
sessionId,
|
|
637
|
+
connectionId: mcpSessionId,
|
|
638
|
+
participantId: participantId ?? undefined,
|
|
639
|
+
metadata: { transport: 'mcp-http' }
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
catch (error) {
|
|
643
|
+
logger.warn('Failed to record MCP session presence', {
|
|
644
|
+
mcpSessionId,
|
|
645
|
+
error: valueFreeFailure(CaughtFailureSchema.parse(error))
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
async function setResolvedSession(sessionManager, participantId, session, mcpSessionId, options = {}) {
|
|
650
|
+
await sessionManager.setParticipantActiveSession(participantId, session.id);
|
|
651
|
+
if (options.setDefault !== false) {
|
|
652
|
+
await sessionManager.setDefaultActiveSession(session.id);
|
|
653
|
+
}
|
|
654
|
+
await updateTransportSessionBinding(sessionManager, session, mcpSessionId, participantId);
|
|
655
|
+
return session.id;
|
|
656
|
+
}
|
|
657
|
+
async function resolveFromSession(sessionManager, participantId, candidate, mcpSessionId, options) {
|
|
658
|
+
if (!candidate || candidate.status === 'archived')
|
|
659
|
+
return null;
|
|
660
|
+
const writable = candidate.status === 'paused'
|
|
661
|
+
? await sessionManager.openSessionForWork(candidate.id)
|
|
662
|
+
: candidate;
|
|
663
|
+
return setResolvedSession(sessionManager, participantId, writable, mcpSessionId, options);
|
|
664
|
+
}
|
|
665
|
+
async function resolveFromId(sessionManager, participantId, sessionId, mcpSessionId, options) {
|
|
666
|
+
if (!sessionId)
|
|
667
|
+
return null;
|
|
668
|
+
// Only a confirmed-missing or archived session falls through to the next
|
|
669
|
+
// resolution step; a failed read propagates rather than binding elsewhere.
|
|
670
|
+
const resolved = await sessionManager.getSession(sessionId);
|
|
671
|
+
if (!resolved || resolved.status === 'archived')
|
|
672
|
+
return null;
|
|
673
|
+
const writable = resolved.status === 'paused'
|
|
674
|
+
? await sessionManager.openSessionForWork(resolved.id)
|
|
675
|
+
: resolved;
|
|
676
|
+
return setResolvedSession(sessionManager, participantId, writable, mcpSessionId, options);
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* Bind an explicitly-resolved participant identity to THIS transport connection.
|
|
680
|
+
*
|
|
681
|
+
* A seat-scoped `session {action:"status"|"init", participantId}` used to
|
|
682
|
+
* resolve the participant durably but leave the CONNECTION's identity unbound
|
|
683
|
+
* — the very next ambient call (no participantId) then ran the anonymous
|
|
684
|
+
* getOrCreateMCPParticipant path and minted a fresh 'MCP Participant' whose
|
|
685
|
+
* slug equals its UUID (ledger L-15). Stamping the connection state and the
|
|
686
|
+
* participant cache here makes the bound identity the ONE ambient resolution
|
|
687
|
+
* path for the rest of the connection's life.
|
|
688
|
+
*/
|
|
689
|
+
/**
|
|
690
|
+
* Stable durable connection key for a unix-RPC (stdio-family) seat, scoped by
|
|
691
|
+
* (workspace, agent).
|
|
692
|
+
*
|
|
693
|
+
* The unix daemon is a long-lived, per-workspace process shared by every agent
|
|
694
|
+
* seated in it (Aris, Rig, ...). A seat bound to it must survive daemon
|
|
695
|
+
* restarts, so its binding persists under this key via recordConnection /
|
|
696
|
+
* getParticipantByConnection — the same durable path HTTP transports use with
|
|
697
|
+
* their connection id. Scoping by agent keeps each seat's binding independent:
|
|
698
|
+
* the last binder on the shared in-memory slot never shadows another seat's
|
|
699
|
+
* durable row.
|
|
700
|
+
*
|
|
701
|
+
* The digest is FNV-1a (non-cryptographic): this is a storage key, not a
|
|
702
|
+
* security boundary.
|
|
703
|
+
*/
|
|
704
|
+
export function unixSeatConnectionKey(workspaceRoot, agentId) {
|
|
705
|
+
const root = String(workspaceRoot ?? '').trim();
|
|
706
|
+
const agent = String(agentId ?? '').trim().toLowerCase();
|
|
707
|
+
if (!root || !agent)
|
|
708
|
+
return undefined;
|
|
709
|
+
let hash = 0x811c9dc5;
|
|
710
|
+
for (let i = 0; i < root.length; i++) {
|
|
711
|
+
hash ^= root.charCodeAt(i);
|
|
712
|
+
hash = Math.imul(hash, 0x01000193);
|
|
713
|
+
}
|
|
714
|
+
const digest = (hash >>> 0).toString(16).padStart(8, '0');
|
|
715
|
+
return `unix-${agent}-${digest}`;
|
|
716
|
+
}
|
|
717
|
+
/** The participant currently bound to this transport connection, if any. */
|
|
718
|
+
export function getBoundConnectionParticipantId(session, mcpSessionId) {
|
|
719
|
+
return getRuntimeConnectionState(registryOf(session), mcpSessionId)?.participantId ?? null;
|
|
720
|
+
}
|
|
721
|
+
/**
|
|
722
|
+
* Durable seat key for an MCP client that declared nothing beyond its kind:
|
|
723
|
+
* "the <kind> seat in Vibes session <id>".
|
|
724
|
+
*
|
|
725
|
+
* Identity used to key on the transport connection id — per-process,
|
|
726
|
+
* per-connection state that changes on every body restart and every `/mcp`
|
|
727
|
+
* reconnect. The same Claude Code conversation therefore came back as a NEW
|
|
728
|
+
* participant each time; mail and todos addressed to the old one were
|
|
729
|
+
* orphaned and slug lookups broke (session-hygiene wave, 2026-08-28). Keying
|
|
730
|
+
* the seat on (client kind, session) makes it the same row across restarts.
|
|
731
|
+
*
|
|
732
|
+
* Same durable mechanism unix seats use (`recordConnection` /
|
|
733
|
+
* `getParticipantByConnection`), keyed differently. Two undeclared clients of
|
|
734
|
+
* the same kind in ONE session cannot be told apart by anything on the wire:
|
|
735
|
+
* the second keeps a fresh seat while the first is live (see
|
|
736
|
+
* {@link isSeatLiveElsewhere}); such clients should declare `participantId`
|
|
737
|
+
* or `harnessSessionId`.
|
|
738
|
+
*/
|
|
739
|
+
export function mcpSeatConnectionKey(clientInfo, sessionId) {
|
|
740
|
+
if (!sessionId || !UUID_REGEX.test(sessionId))
|
|
741
|
+
return undefined;
|
|
742
|
+
const kind = mcpClientKind(clientInfo);
|
|
743
|
+
if (!kind)
|
|
744
|
+
return undefined;
|
|
745
|
+
return `mcp-seat:${kind}:${sessionId.toLowerCase()}`;
|
|
746
|
+
}
|
|
747
|
+
/** Client kind for seat keys and slug seeds: agent family first, product name second. */
|
|
748
|
+
export function mcpClientKind(clientInfo) {
|
|
749
|
+
if (!clientInfo)
|
|
750
|
+
return undefined;
|
|
751
|
+
const kind = sanitizeSlugCandidate(clientInfo.agentId || clientInfo.name || '');
|
|
752
|
+
return kind && kind !== 'participant' ? kind : undefined;
|
|
753
|
+
}
|
|
754
|
+
const SEAT_LIVE_WINDOW_MS = 2 * 60 * 1000;
|
|
755
|
+
/**
|
|
756
|
+
* True when ANOTHER registered transport connection in this process is bound
|
|
757
|
+
* to the participant and spoke within the liveness window. A fresh daemon has
|
|
758
|
+
* an empty registry, so a restart never blocks a reclaim; a context left
|
|
759
|
+
* behind by a client that vanished without DELETE ages out of "live" after
|
|
760
|
+
* the window even though the registry retains it for hours.
|
|
761
|
+
*/
|
|
762
|
+
export function isSeatLiveElsewhere(registry, participantId, mcpSessionId, now = Date.now()) {
|
|
763
|
+
for (const id of registry.getActiveSessionIds()) {
|
|
764
|
+
if (id === mcpSessionId)
|
|
765
|
+
continue;
|
|
766
|
+
const context = registry.peek(id);
|
|
767
|
+
const state = context?.connectionState;
|
|
768
|
+
const bound = state?.participantId ?? state?.agentId ?? null;
|
|
769
|
+
if (bound !== participantId)
|
|
770
|
+
continue;
|
|
771
|
+
if (now - (context?.lastActivityAt ?? 0) < SEAT_LIVE_WINDOW_MS)
|
|
772
|
+
return true;
|
|
773
|
+
}
|
|
774
|
+
return false;
|
|
775
|
+
}
|
|
776
|
+
/** Same-kind undeclared clients sharing one session get ordinal seats up to this. */
|
|
777
|
+
const MCP_SEAT_ORDINALS = 8;
|
|
778
|
+
/**
|
|
779
|
+
* Find the seat this client kind may take in `sessionId`: the first ordinal
|
|
780
|
+
* slot that is either free or recorded for a participant no other live
|
|
781
|
+
* connection holds. Pure lookup: binds and records nothing. Null when the key
|
|
782
|
+
* cannot be formed or every slot is held by a live connection.
|
|
783
|
+
*/
|
|
784
|
+
export async function reclaimMcpSeat(session, clientInfo, sessionId, mcpSessionId) {
|
|
785
|
+
const base = mcpSeatConnectionKey(clientInfo, sessionId);
|
|
786
|
+
if (!base)
|
|
787
|
+
return null;
|
|
788
|
+
const registry = registryOf(session);
|
|
789
|
+
for (let ordinal = 1; ordinal <= MCP_SEAT_ORDINALS; ordinal++) {
|
|
790
|
+
const seatKey = ordinal === 1 ? base : `${base}#${ordinal}`;
|
|
791
|
+
// A storage failure propagates: only a confirmed-absent row is a free
|
|
792
|
+
// seat. Reading a failed lookup as "no seat" minted a duplicate identity.
|
|
793
|
+
const profile = await session.getParticipantByConnection(seatKey);
|
|
794
|
+
if (!profile)
|
|
795
|
+
return { seatKey, profile: null };
|
|
796
|
+
if (isSeatLiveElsewhere(registry, profile.participantId, mcpSessionId))
|
|
797
|
+
continue;
|
|
798
|
+
return { seatKey, profile };
|
|
799
|
+
}
|
|
800
|
+
return null;
|
|
801
|
+
}
|
|
802
|
+
/** Persist "this participant is the <kind> seat in <session>" under a resolved key. */
|
|
803
|
+
export async function recordMcpSeat(session, clientInfo, seatKey, participantId) {
|
|
804
|
+
await session.recordConnection({
|
|
805
|
+
connectionId: seatKey,
|
|
806
|
+
participantId,
|
|
807
|
+
clientName: clientInfo?.name ?? 'MCP Client',
|
|
808
|
+
clientVersion: clientInfo?.version
|
|
809
|
+
});
|
|
810
|
+
return seatKey;
|
|
811
|
+
}
|
|
812
|
+
const AMBIENT_MINT_RETIRE_WINDOW_MS = 10 * 60 * 1000;
|
|
813
|
+
/**
|
|
814
|
+
* Retire the participant the ambient pre-call minted for THIS connection once
|
|
815
|
+
* the bind resolved a different durable seat. Without this, every restart left
|
|
816
|
+
* one more ghost row in the roster. Guarded so nothing older, foreign, or
|
|
817
|
+
* referenced is ever removed: the row must be this connection's own auto-mint,
|
|
818
|
+
* minutes old, and own no session. Best-effort — a ghost that survives is
|
|
819
|
+
* dormant, never authoritative.
|
|
820
|
+
*/
|
|
821
|
+
export async function retireAmbientMint(session, ghostParticipantId, mcpSessionId) {
|
|
822
|
+
const profile = await session.getParticipant(ghostParticipantId);
|
|
823
|
+
if (!profile)
|
|
824
|
+
return false;
|
|
825
|
+
const metadata = identityMetadataOf(profile.metadata);
|
|
826
|
+
if (metadata.source !== 'mcp')
|
|
827
|
+
return false;
|
|
828
|
+
if (metadata.connectionId !== (mcpSessionId ?? 'mcp-unknown'))
|
|
829
|
+
return false;
|
|
830
|
+
const registeredAt = metadata.registeredAt === undefined ? Number.NaN : Date.parse(metadata.registeredAt);
|
|
831
|
+
if (!Number.isFinite(registeredAt) || Date.now() - registeredAt > AMBIENT_MINT_RETIRE_WINDOW_MS) {
|
|
832
|
+
return false;
|
|
833
|
+
}
|
|
834
|
+
const owned = await session.countSessions({ ownerParticipant: ghostParticipantId });
|
|
835
|
+
if (owned > 0)
|
|
836
|
+
return false;
|
|
837
|
+
await session.clearParticipantActiveSession(ghostParticipantId);
|
|
838
|
+
await session.deleteParticipant(ghostParticipantId);
|
|
839
|
+
return true;
|
|
840
|
+
}
|
|
841
|
+
/**
|
|
842
|
+
* Retire an ambient mint as the advisory cleanup the bind promises: a ghost
|
|
843
|
+
* that survives is dormant, never authoritative, so a failed retirement is
|
|
844
|
+
* reported, value-free, once and never fails the bind that already succeeded.
|
|
845
|
+
*/
|
|
846
|
+
export async function retireAmbientMintAfterBind(session, ghostParticipantId, mcpSessionId) {
|
|
847
|
+
const logger = getLogger('session:mcp', session.servingRuntime);
|
|
848
|
+
try {
|
|
849
|
+
await retireAmbientMint(session, ghostParticipantId, mcpSessionId);
|
|
850
|
+
}
|
|
851
|
+
catch (error) {
|
|
852
|
+
logger.warn('Ambient mint retirement failed; leaving the participant in place', {
|
|
853
|
+
participantId: ghostParticipantId,
|
|
854
|
+
error: valueFreeFailure(CaughtFailureSchema.parse(error))
|
|
855
|
+
});
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
export async function bindConnectionParticipant(session, participantId, slug, mcpSessionId, seatKey, options = {}) {
|
|
859
|
+
const effectiveConnectionId = mcpSessionId ?? seatKey;
|
|
860
|
+
const registry = registryOf(session);
|
|
861
|
+
const connectionUpdate = { participantId, participantSlug: slug };
|
|
862
|
+
if (effectiveConnectionId)
|
|
863
|
+
connectionUpdate.connectionId = effectiveConnectionId;
|
|
864
|
+
updateRuntimeConnectionState(registry, connectionUpdate, effectiveConnectionId);
|
|
865
|
+
// Seed the ambient participant cache under every key getOrCreateMCPParticipant
|
|
866
|
+
// derives (the participant id AND the connection key), so ambient calls
|
|
867
|
+
// resolve this identity without re-running the registration path. The cache
|
|
868
|
+
// is reset first: after a rebind (seat reclaim, self-identification) a stale
|
|
869
|
+
// connection-key entry would keep answering with the previous, possibly
|
|
870
|
+
// retired, participant.
|
|
871
|
+
const cache = getParticipantCache(registry, effectiveConnectionId);
|
|
872
|
+
cache.clear();
|
|
873
|
+
cache.set(participantId.toLowerCase(), Promise.resolve(participantId));
|
|
874
|
+
const connectionKey = effectiveConnectionId ?? getRuntimeConnectionState(registry, effectiveConnectionId)?.connectionId;
|
|
875
|
+
if (connectionKey)
|
|
876
|
+
cache.set(connectionKey.toLowerCase(), Promise.resolve(participantId));
|
|
877
|
+
// HTTP transports carry a durable connection id; unix seats carry a stable
|
|
878
|
+
// (workspace, agent) seat key. Persist the binding under either so
|
|
879
|
+
// caller-identity lookups (getParticipantByConnection) survive daemon
|
|
880
|
+
// restarts. Plain stdio has no durable connection id; its binding lives in
|
|
881
|
+
// the transport context above for the life of the process.
|
|
882
|
+
const durableConnectionId = effectiveConnectionId;
|
|
883
|
+
if (durableConnectionId && options.persistConnection !== false) {
|
|
884
|
+
const clientInfo = getRuntimeClientInfo(registry, effectiveConnectionId);
|
|
885
|
+
await session.recordConnection({
|
|
886
|
+
connectionId: durableConnectionId,
|
|
887
|
+
participantId,
|
|
888
|
+
clientName: clientInfo?.name ?? (seatKey ? 'unix-seat' : 'MCP Client'),
|
|
889
|
+
clientVersion: clientInfo?.version
|
|
890
|
+
});
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
/**
|
|
894
|
+
* Get or create participant ID for MCP client.
|
|
895
|
+
* Uses Layer 2 identification (connection-based) unless a preferred ID is supplied.
|
|
896
|
+
* @param clientInfo - Optional client info from MCP connection
|
|
897
|
+
* @param options - Optional participant options
|
|
898
|
+
* @param mcpSessionId - MCP session ID for HTTP transport isolation
|
|
899
|
+
*/
|
|
900
|
+
export async function getOrCreateMCPParticipant(clientInfo, options = {}, mcpSessionId, caller, sessionManager, workspaceRoot) {
|
|
901
|
+
// Durable seat key for unix-RPC (stdio-family) transports: scoped by
|
|
902
|
+
// (workspace, agent) so each seat on the shared per-workspace daemon keeps
|
|
903
|
+
// its own persisted binding. HTTP transports keep their connection id.
|
|
904
|
+
const seatKey = mcpSessionId ? undefined : unixSeatConnectionKey(workspaceRoot, caller?.agentId);
|
|
905
|
+
// The serving root's manager and transport registry: every connection read
|
|
906
|
+
// and write below is that root's, never another root's in this process.
|
|
907
|
+
const session = sessionManager ?? (await getSessionManagerAsync());
|
|
908
|
+
const registry = registryOf(session);
|
|
909
|
+
// The admitted connection this call belongs to: the transport's key, or the
|
|
910
|
+
// seat's own key. Its in-memory state, client info and cache are read and
|
|
911
|
+
// written under this key only; a seat-keyed bind never answers from the
|
|
912
|
+
// process-wide stdio slot, which is whichever connection bound last.
|
|
913
|
+
const connectionScope = mcpSessionId ?? seatKey;
|
|
914
|
+
// The stdio slot (keyed null) is the in-memory home of a plain-stdio bind
|
|
915
|
+
// (no seat key): that bind writes no durable row, so a later seat-keyed
|
|
916
|
+
// ambient read must still resolve it from the slot until the seat persists.
|
|
917
|
+
// A seat-keyed bind never writes the stdio slot, so this fallback cannot
|
|
918
|
+
// leak one agent's seat to another (per-agent scope).
|
|
919
|
+
const runtimeConnection = getRuntimeConnectionState(registry, connectionScope) ??
|
|
920
|
+
(mcpSessionId ? undefined : getRuntimeConnectionState(registry, null));
|
|
921
|
+
const hasExplicitIdentity = Boolean(options.preferredParticipantId?.trim() ||
|
|
922
|
+
options.preferredSlug?.trim() ||
|
|
923
|
+
caller?.participantId?.trim());
|
|
924
|
+
const hasBoundIdentity = Boolean(runtimeConnection?.participantId);
|
|
925
|
+
// The refusal must key on a REGISTERED HTTP transport context — never on
|
|
926
|
+
// the mere truthiness of the mcpSessionId string. Callers that mistake the
|
|
927
|
+
// slot for a session-scoped id (brain passed scope.qualifiers.sessionId
|
|
928
|
+
// here) have no registered context; keying on truthiness let them sail past
|
|
929
|
+
// the guard and phantom-mint (stoa L-23 adversarial, 2026-07-17).
|
|
930
|
+
const isRegisteredTransport = Boolean(mcpSessionId) &&
|
|
931
|
+
(runtimeConnection?.transport === 'http' ||
|
|
932
|
+
runtimeConnection?.transport === 'stdio' ||
|
|
933
|
+
Boolean(runtimeConnection?.connectionId) ||
|
|
934
|
+
Boolean(getRuntimeClientInfo(registry, mcpSessionId)));
|
|
935
|
+
// Anonymous stdio (no transport id and no agent-scoped seat key) may create
|
|
936
|
+
// its connection identity. Once an agent id produces a durable seat key,
|
|
937
|
+
// bind-once applies: a missing row must refuse instead of minting a new seat.
|
|
938
|
+
// A truthy mcpSessionId that is NOT registered HTTP is likewise the L-23
|
|
939
|
+
// injury (a Vibes session UUID stuffed into the transport slot).
|
|
940
|
+
const isAnonymousStdioTransport = !mcpSessionId && !seatKey;
|
|
941
|
+
const runtimeClientInfo = getRuntimeClientInfo(registry, connectionScope);
|
|
942
|
+
const effectiveClientInfo = clientInfo ?? runtimeClientInfo;
|
|
943
|
+
const explicitParticipantId = options.preferredParticipantId?.trim() ??
|
|
944
|
+
caller?.participantId?.trim() ??
|
|
945
|
+
undefined;
|
|
946
|
+
// A seat's key is its admitted identity and wins over any client-supplied
|
|
947
|
+
// connection id, so the same seat always resolves the same durable row.
|
|
948
|
+
const connectionKeySource = seatKey ??
|
|
949
|
+
effectiveClientInfo?.connectionId ??
|
|
950
|
+
runtimeConnection?.connectionId ??
|
|
951
|
+
'mcp-unknown';
|
|
952
|
+
// Durable binding for this connection key (HTTP connection id or unix seat
|
|
953
|
+
// key), consulted BEFORE the in-memory slot: the slot is last-binder-wins
|
|
954
|
+
// and shared across agents on the unix daemon, while the row is scoped to
|
|
955
|
+
// this seat. On a fresh daemon process the slot is empty but the row
|
|
956
|
+
// survives — this is what makes a unix seat bind-once.
|
|
957
|
+
// A storage failure propagates: the in-memory slot cannot stand in for the
|
|
958
|
+
// durable row, and reading a failed lookup as absence mints a second seat.
|
|
959
|
+
let persistedParticipant = null;
|
|
960
|
+
if (connectionKeySource !== 'mcp-unknown') {
|
|
961
|
+
persistedParticipant = (await session.getParticipantByConnection(connectionKeySource)) ?? null;
|
|
962
|
+
}
|
|
963
|
+
if (!isRegisteredTransport &&
|
|
964
|
+
!isAnonymousStdioTransport &&
|
|
965
|
+
!hasBoundIdentity &&
|
|
966
|
+
!hasExplicitIdentity &&
|
|
967
|
+
!(seatKey && persistedParticipant)) {
|
|
968
|
+
throw createSessionToolError('CONNECTION_UNBOUND', 'Cannot resolve an ambient participant before this connection identifies itself.', 'Call session init or status with participantId first, or pass fromParticipant for a self-identifying message.', { transport: runtimeConnection?.transport ?? 'stdio', requiresIdentity: true });
|
|
969
|
+
}
|
|
970
|
+
const cacheKey = (explicitParticipantId || connectionKeySource).toLowerCase();
|
|
971
|
+
// The admitted connection's own cache (the stdio transport's only when the
|
|
972
|
+
// call has neither a transport key nor a seat key).
|
|
973
|
+
// IMPORTANT: Don't cache for 'mcp-unknown' key to prevent cross-contamination
|
|
974
|
+
// between different Claude Code instances sharing the same MCP server
|
|
975
|
+
const cache = getParticipantCache(registry, connectionScope);
|
|
976
|
+
const shouldCache = cacheKey !== 'mcp-unknown';
|
|
977
|
+
if (shouldCache) {
|
|
978
|
+
const cached = cache.get(cacheKey);
|
|
979
|
+
if (cached) {
|
|
980
|
+
return cached;
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
const createParticipantPromise = (async () => {
|
|
984
|
+
// Priority: explicit identity → durable seat row (scoped) → in-memory
|
|
985
|
+
// slot (last-binder-wins) → durable row for non-seat connection keys.
|
|
986
|
+
const preferredIdCandidate = explicitParticipantId ??
|
|
987
|
+
(seatKey ? persistedParticipant?.participantId : undefined) ??
|
|
988
|
+
runtimeConnection?.participantId ??
|
|
989
|
+
persistedParticipant?.participantId;
|
|
990
|
+
// A client that declared a durable identity gets the seat it already owns
|
|
991
|
+
// rather than a fresh one per connection. Reuses the same stable-order
|
|
992
|
+
// scan the self-identification path uses (ledger L-19), so concurrent
|
|
993
|
+
// reconnects converge on one winner instead of racing to register.
|
|
994
|
+
const declaredSlug = declaredIdentitySlug(effectiveClientInfo);
|
|
995
|
+
let declaredSeatId;
|
|
996
|
+
let declaredSeatWasLegacy = false;
|
|
997
|
+
if (!preferredIdCandidate && declaredSlug && effectiveClientInfo) {
|
|
998
|
+
const seated = await resolveDeclaredIdentityParticipant(session, effectiveClientInfo);
|
|
999
|
+
declaredSeatId = seated?.participantId;
|
|
1000
|
+
declaredSeatWasLegacy = seated?.legacy === true;
|
|
1001
|
+
// A harness conversation's seat is derived, not minted: register it
|
|
1002
|
+
// under its derived id so the harness hook resolves the same row.
|
|
1003
|
+
const seat = harnessSeatOf(effectiveClientInfo);
|
|
1004
|
+
if (!declaredSeatId && seat) {
|
|
1005
|
+
declaredSeatId = (await session.ensureHarnessSeat({
|
|
1006
|
+
...seat,
|
|
1007
|
+
name: effectiveClientInfo.name,
|
|
1008
|
+
source: 'mcp'
|
|
1009
|
+
})).participantId;
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
// An UNDECLARED client (bare product name) reaching a fresh body: reclaim
|
|
1013
|
+
// the seat its kind holds in the workspace's durable default session
|
|
1014
|
+
// before minting. Nothing stable arrives on the wire for such a client,
|
|
1015
|
+
// so this — not the transport connection id — is what survives a daemon
|
|
1016
|
+
// restart. `session init` re-keys the seat to the session it binds.
|
|
1017
|
+
// A lookup failure propagates; only a confirmed-free seat falls through to a mint.
|
|
1018
|
+
let reclaimedSeatId;
|
|
1019
|
+
if (!preferredIdCandidate && !declaredSlug) {
|
|
1020
|
+
const anchor = await session.getDefaultActiveSession();
|
|
1021
|
+
const reclaimed = await reclaimMcpSeat(session, effectiveClientInfo, anchor, mcpSessionId);
|
|
1022
|
+
reclaimedSeatId = reclaimed?.profile?.participantId;
|
|
1023
|
+
}
|
|
1024
|
+
// Generate participant identifier from provided references or random UUID
|
|
1025
|
+
let participantId;
|
|
1026
|
+
if (preferredIdCandidate && UUID_REGEX.test(preferredIdCandidate)) {
|
|
1027
|
+
participantId = preferredIdCandidate;
|
|
1028
|
+
}
|
|
1029
|
+
else if (preferredIdCandidate) {
|
|
1030
|
+
const slugCandidate = sanitizeSlugCandidate(preferredIdCandidate);
|
|
1031
|
+
participantId = slugCandidate.startsWith('participant-')
|
|
1032
|
+
? slugCandidate
|
|
1033
|
+
: `participant-${slugCandidate}`;
|
|
1034
|
+
}
|
|
1035
|
+
else if (declaredSeatId) {
|
|
1036
|
+
participantId = declaredSeatId;
|
|
1037
|
+
}
|
|
1038
|
+
else if (reclaimedSeatId) {
|
|
1039
|
+
participantId = reclaimedSeatId;
|
|
1040
|
+
}
|
|
1041
|
+
else {
|
|
1042
|
+
participantId = generateId();
|
|
1043
|
+
}
|
|
1044
|
+
// Slug seed is NEVER the transport connection id (session/SPEC.md hard
|
|
1045
|
+
// rule). Seeding it minted `claude-code-<Mcp-Session-Id>` on every
|
|
1046
|
+
// reconnect and broke slug lookups after each restart. A fresh seat is
|
|
1047
|
+
// `<kind>-<8 of its own id>`: stable for the row's life and independent
|
|
1048
|
+
// of how it connected.
|
|
1049
|
+
const kind = mcpClientKind(effectiveClientInfo);
|
|
1050
|
+
const slugSeed = options.preferredSlug ??
|
|
1051
|
+
declaredSlug ??
|
|
1052
|
+
(kind
|
|
1053
|
+
? `${kind}-${participantId.replace(/^participant-/, '').slice(0, 8)}`
|
|
1054
|
+
: runtimeConnection?.httpPeer?.remoteAddress
|
|
1055
|
+
? `peer-${runtimeConnection.httpPeer.remoteAddress}`
|
|
1056
|
+
: participantId.replace(/^participant-/, ''));
|
|
1057
|
+
const slug = sanitizeSlugCandidate(slugSeed);
|
|
1058
|
+
// Check if participant exists
|
|
1059
|
+
const existing = await session.getParticipant(participantId);
|
|
1060
|
+
if (!existing) {
|
|
1061
|
+
const registration = {
|
|
1062
|
+
source: 'mcp',
|
|
1063
|
+
connectionId: connectionKeySource,
|
|
1064
|
+
transport: runtimeConnection?.transport ?? effectiveClientInfo?.transport ?? 'stdio',
|
|
1065
|
+
httpPeer: runtimeConnection?.httpPeer,
|
|
1066
|
+
registeredAt: new Date().toISOString(),
|
|
1067
|
+
slug
|
|
1068
|
+
};
|
|
1069
|
+
if (effectiveClientInfo)
|
|
1070
|
+
registration.clientInfo = effectiveClientInfo;
|
|
1071
|
+
// Register new participant
|
|
1072
|
+
await session.registerParticipant({
|
|
1073
|
+
participantId,
|
|
1074
|
+
name: effectiveClientInfo?.name || 'MCP Participant',
|
|
1075
|
+
role: 'assistant',
|
|
1076
|
+
capabilities: [
|
|
1077
|
+
'session-management',
|
|
1078
|
+
'todo-tracking',
|
|
1079
|
+
'scratchpad-notes',
|
|
1080
|
+
'code-analysis',
|
|
1081
|
+
'planning'
|
|
1082
|
+
],
|
|
1083
|
+
metadata: registration
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1086
|
+
else {
|
|
1087
|
+
if (options.preferredSlug || declaredSeatWasLegacy) {
|
|
1088
|
+
const metadata = { ...existing.metadata, slug };
|
|
1089
|
+
if (effectiveClientInfo)
|
|
1090
|
+
metadata.clientInfo = effectiveClientInfo;
|
|
1091
|
+
await session.updateParticipant(existing.participantId, { metadata });
|
|
1092
|
+
}
|
|
1093
|
+
await ensureParticipantSlug(session, existing.participantId, existing);
|
|
1094
|
+
}
|
|
1095
|
+
const ensured = await session.ensureParticipantSession(participantId);
|
|
1096
|
+
if (ensured) {
|
|
1097
|
+
await updateTransportSessionBinding(session, ensured, mcpSessionId, participantId);
|
|
1098
|
+
}
|
|
1099
|
+
if (connectionKeySource !== 'mcp-unknown') {
|
|
1100
|
+
await session.recordConnection({
|
|
1101
|
+
connectionId: connectionKeySource,
|
|
1102
|
+
participantId,
|
|
1103
|
+
clientName: effectiveClientInfo?.name ?? 'MCP Client',
|
|
1104
|
+
clientVersion: effectiveClientInfo?.version
|
|
1105
|
+
});
|
|
1106
|
+
}
|
|
1107
|
+
updateRuntimeConnectionState(registry, {
|
|
1108
|
+
transport: runtimeConnection?.transport ?? 'stdio',
|
|
1109
|
+
// 'mcp-unknown' is a sentinel for "no durable connection key", not a
|
|
1110
|
+
// real transport id: writing it would store anonymous-stdio state
|
|
1111
|
+
// under a key the next ambient read never consults, minting a fresh
|
|
1112
|
+
// participant on every call (stoa L-23).
|
|
1113
|
+
connectionId: connectionKeySource === 'mcp-unknown' ? undefined : connectionKeySource,
|
|
1114
|
+
sessionId: runtimeConnection?.sessionId,
|
|
1115
|
+
participantId: participantId,
|
|
1116
|
+
participantSlug: slug,
|
|
1117
|
+
httpPeer: runtimeConnection?.httpPeer
|
|
1118
|
+
}, connectionScope);
|
|
1119
|
+
return participantId;
|
|
1120
|
+
})().catch((error) => {
|
|
1121
|
+
cache.delete(cacheKey);
|
|
1122
|
+
throw error;
|
|
1123
|
+
});
|
|
1124
|
+
if (shouldCache) {
|
|
1125
|
+
cache.set(cacheKey, createParticipantPromise);
|
|
1126
|
+
}
|
|
1127
|
+
return createParticipantPromise;
|
|
1128
|
+
}
|
|
1129
|
+
/**
|
|
1130
|
+
* Normalize a caller-supplied participant reference to a registered UUID
|
|
1131
|
+
* before it touches session resolution. The durable participant→session map
|
|
1132
|
+
* is UUID-keyed: a raw slug READ misses it (ghost SESSION_NOT_ACTIVE on
|
|
1133
|
+
* stdio) and a raw slug WRITE pollutes it with slug keys (ledger L-04). This
|
|
1134
|
+
* chokepoint never registers — self-identification sites resolve (and may
|
|
1135
|
+
* register) BEFORE calling into session resolution.
|
|
1136
|
+
*/
|
|
1137
|
+
async function normalizeParticipantIdForSessionResolution(reference, session, mcpSessionId) {
|
|
1138
|
+
const trimmed = reference.trim();
|
|
1139
|
+
if (UUID_REGEX.test(trimmed))
|
|
1140
|
+
return trimmed;
|
|
1141
|
+
const resolved = await resolveParticipantReference(trimmed, session, mcpSessionId);
|
|
1142
|
+
return resolved.participantId;
|
|
1143
|
+
}
|
|
1144
|
+
/**
|
|
1145
|
+
* The canonical scope-bound vibes session, when a surface announced one.
|
|
1146
|
+
*
|
|
1147
|
+
* `session.bound` (emitted by session init / MCP serve lifecycle / CLI
|
|
1148
|
+
* bootstrap) records the bind in the session registry, which feeds each
|
|
1149
|
+
* invocation's `scope.actor.sessionId`. Brain already resolves its bound
|
|
1150
|
+
* session from there; the session family ignored it — two resolution paths for
|
|
1151
|
+
* one concern (stoa L-09 seam, cross-lane with cog-writer). The reader is the
|
|
1152
|
+
* runtime's `boundSessionIdOf`; brain uses it too. Note the TRANSPORT key
|
|
1153
|
+
* (the MCP connection id, never a declared-scope qualifier) is deliberately
|
|
1154
|
+
* excluded — transport→session mapping already resolves durably via
|
|
1155
|
+
* getSessionForMcpConnection.
|
|
1156
|
+
*/
|
|
1157
|
+
export function getScopeBoundSessionId(runtime, caller) {
|
|
1158
|
+
return boundSessionIdOf(runtime?.scope, caller);
|
|
1159
|
+
}
|
|
1160
|
+
/** The participant identity committed alongside the ambient session bind (the invocation actor's). */
|
|
1161
|
+
export function getScopeBoundParticipantId(runtime, caller) {
|
|
1162
|
+
const callerParticipantId = caller?.participantId?.trim();
|
|
1163
|
+
if (callerParticipantId)
|
|
1164
|
+
return callerParticipantId;
|
|
1165
|
+
const actorParticipantId = runtime?.scope?.actor?.participantId?.trim();
|
|
1166
|
+
return actorParticipantId ? actorParticipantId : null;
|
|
1167
|
+
}
|
|
1168
|
+
/**
|
|
1169
|
+
* Get session ID from input or active session
|
|
1170
|
+
* @param sessionId - Optional explicit session ID
|
|
1171
|
+
* @param participantId - Optional participant ID
|
|
1172
|
+
* @param mcpSessionId - MCP session ID for HTTP transport isolation
|
|
1173
|
+
*/
|
|
1174
|
+
export async function resolveSessionIdForParticipant(sessionId, participantId, mcpSessionId, options = {}, sessionManager, runtime) {
|
|
1175
|
+
const session = sessionManager ?? getSessionManager();
|
|
1176
|
+
if (sessionId && options.intent === 'read') {
|
|
1177
|
+
// Pure lookup: no resume, no participant-map write, no workspace-default
|
|
1178
|
+
// retarget, no transport link. Archived sessions stay archived and are
|
|
1179
|
+
// readable in place (ledger L-13).
|
|
1180
|
+
const existing = await session.getSession(sessionId);
|
|
1181
|
+
if (!existing) {
|
|
1182
|
+
throw createSessionToolError('SESSION_NOT_FOUND', `Session ${sessionId} was not found.`, 'Provide a valid sessionId or call session-init first.');
|
|
1183
|
+
}
|
|
1184
|
+
return existing.id;
|
|
1185
|
+
}
|
|
1186
|
+
if (!participantId && options.intent === 'read' && !sessionId) {
|
|
1187
|
+
const scopeBoundId = getScopeBoundSessionId(runtime, options.caller);
|
|
1188
|
+
if (scopeBoundId) {
|
|
1189
|
+
const existing = await session.getSession(scopeBoundId);
|
|
1190
|
+
if (!existing) {
|
|
1191
|
+
throw createSessionToolError('SESSION_NOT_FOUND', `Session ${scopeBoundId} was not found.`, 'Provide a valid sessionId or call session-init first.');
|
|
1192
|
+
}
|
|
1193
|
+
return existing.id;
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
if (!participantId && options.intent === 'read') {
|
|
1197
|
+
participantId =
|
|
1198
|
+
getScopeBoundParticipantId(runtime, options.caller) ??
|
|
1199
|
+
(await resolveBoundMCPParticipant(undefined, mcpSessionId, session, options)) ??
|
|
1200
|
+
undefined;
|
|
1201
|
+
if (!participantId) {
|
|
1202
|
+
throw createSessionToolError('CONNECTION_UNBOUND', 'An unbound session read cannot create a participant.', 'Identify this connection or supply an existing sessionId first.');
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
const resolvedParticipantId = participantId
|
|
1206
|
+
? await normalizeParticipantIdForSessionResolution(participantId, session, mcpSessionId)
|
|
1207
|
+
: await getOrCreateMCPParticipant(undefined, {}, mcpSessionId, options.caller, session);
|
|
1208
|
+
if (sessionId) {
|
|
1209
|
+
const existing = await session.getSession(sessionId);
|
|
1210
|
+
if (!existing) {
|
|
1211
|
+
throw createSessionToolError('SESSION_NOT_FOUND', `Session ${sessionId} was not found.`, 'Provide a valid sessionId or call session-init first.');
|
|
1212
|
+
}
|
|
1213
|
+
if (existing.status === 'archived') {
|
|
1214
|
+
throw createSessionToolError('SESSION_NOT_ACTIVE', `Session ${sessionId} is archived; this mutation will not reopen it implicitly.`, `Call session { action: "resume", sessionId: "${sessionId}" } first if reopening this collaboration is intentional.`);
|
|
1215
|
+
}
|
|
1216
|
+
const writable = existing.status === 'paused' ? await session.openSessionForWork(sessionId) : existing;
|
|
1217
|
+
return setResolvedSession(session, resolvedParticipantId, writable, mcpSessionId, {
|
|
1218
|
+
setDefault: !mcpSessionId
|
|
1219
|
+
});
|
|
1220
|
+
}
|
|
1221
|
+
const boundSession = mcpSessionId ? await session.getSessionForMcpConnection(mcpSessionId) : null;
|
|
1222
|
+
const resolvedFromBinding = await resolveFromSession(session, resolvedParticipantId, boundSession, mcpSessionId, { setDefault: false });
|
|
1223
|
+
if (resolvedFromBinding)
|
|
1224
|
+
return resolvedFromBinding;
|
|
1225
|
+
const mappedId = await session.getParticipantActiveSession(resolvedParticipantId);
|
|
1226
|
+
const resolvedFromMap = await resolveFromId(session, resolvedParticipantId, mappedId, mcpSessionId, {
|
|
1227
|
+
setDefault: false
|
|
1228
|
+
});
|
|
1229
|
+
if (resolvedFromMap)
|
|
1230
|
+
return resolvedFromMap;
|
|
1231
|
+
// Canonical scope-bound session (session.bound → session registry →
|
|
1232
|
+
// invocation actor.sessionId) — the SAME source brain resolves. Honored after the
|
|
1233
|
+
// caller's own durable bindings so an explicit participant mapping always
|
|
1234
|
+
// wins, and before failing SESSION_NOT_ACTIVE (stoa L-09 seam).
|
|
1235
|
+
const scopeBoundId = getScopeBoundSessionId(runtime, options.caller);
|
|
1236
|
+
const resolvedFromScope = await resolveFromId(session, resolvedParticipantId, scopeBoundId, mcpSessionId, { setDefault: false });
|
|
1237
|
+
if (resolvedFromScope)
|
|
1238
|
+
return resolvedFromScope;
|
|
1239
|
+
// Do not adopt the workspace default or "the" active session. Listing
|
|
1240
|
+
// related rows is the unbound receipt; attaching is an explicit init.
|
|
1241
|
+
// No session found - provide helpful error
|
|
1242
|
+
// For stdio transport without mcpSessionId, this is expected behavior:
|
|
1243
|
+
// each Claude instance should explicitly init its own session
|
|
1244
|
+
const unbound = await unboundSessionErrorFields(session, {
|
|
1245
|
+
workspacePath: options.workspaceRoot
|
|
1246
|
+
});
|
|
1247
|
+
throw createSessionToolError('SESSION_NOT_ACTIVE', unbound.message, unbound.hint, unbound.details);
|
|
1248
|
+
}
|
|
1249
|
+
/**
|
|
1250
|
+
* Resolve the identity ALREADY bound to this transport connection without
|
|
1251
|
+
* minting, caching, or registering anything. Returns null when the connection
|
|
1252
|
+
* is genuinely unbound. Read-intent callers use this so a bound seat still
|
|
1253
|
+
* satisfies identity-shaped filters (e.g. todo list `mine=true`) while a
|
|
1254
|
+
* virgin stdio connection resolves sessions identity-free (ledger L-23).
|
|
1255
|
+
*/
|
|
1256
|
+
export async function resolveBoundMCPParticipant(clientInfo, mcpSessionId, sessionManager, callerOrOptions, workspaceRoot) {
|
|
1257
|
+
const options = resolutionOptionsOf(callerOrOptions, workspaceRoot);
|
|
1258
|
+
const caller = options.caller;
|
|
1259
|
+
const resolvedWorkspaceRoot = options.workspaceRoot;
|
|
1260
|
+
const manager = sessionManager ?? (await getSessionManagerAsync());
|
|
1261
|
+
const registry = registryOf(manager);
|
|
1262
|
+
const callerSeatKey = mcpSessionId
|
|
1263
|
+
? undefined
|
|
1264
|
+
: unixSeatConnectionKey(resolvedWorkspaceRoot, caller?.agentId);
|
|
1265
|
+
if (callerSeatKey) {
|
|
1266
|
+
const persisted = await manager.getParticipantByConnection(callerSeatKey);
|
|
1267
|
+
if (persisted?.participantId)
|
|
1268
|
+
return persisted.participantId;
|
|
1269
|
+
}
|
|
1270
|
+
const effectiveKey = mcpSessionId ?? callerSeatKey ?? clientInfo?.connectionId;
|
|
1271
|
+
const runtimeConnection = effectiveKey
|
|
1272
|
+
? getRuntimeConnectionState(registry, effectiveKey)
|
|
1273
|
+
: getRuntimeConnectionState(registry, mcpSessionId);
|
|
1274
|
+
if (runtimeConnection?.participantId) {
|
|
1275
|
+
if (!effectiveKey ||
|
|
1276
|
+
!runtimeConnection.connectionId ||
|
|
1277
|
+
runtimeConnection.connectionId === effectiveKey) {
|
|
1278
|
+
return runtimeConnection.participantId;
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
const runtimeClientInfo = getRuntimeClientInfo(registry, effectiveKey ?? mcpSessionId);
|
|
1282
|
+
const connectionId = clientInfo?.connectionId ??
|
|
1283
|
+
effectiveKey ??
|
|
1284
|
+
runtimeClientInfo?.connectionId ??
|
|
1285
|
+
runtimeConnection?.connectionId ??
|
|
1286
|
+
undefined;
|
|
1287
|
+
if (!connectionId)
|
|
1288
|
+
return null;
|
|
1289
|
+
const persisted = await manager.getParticipantByConnection(connectionId);
|
|
1290
|
+
return persisted?.participantId ?? null;
|
|
1291
|
+
}
|
|
1292
|
+
/** The caller and workspace root, from either the options form or the legacy positional caller. */
|
|
1293
|
+
function resolutionOptionsOf(callerOrOptions, workspaceRoot) {
|
|
1294
|
+
if (callerOrOptions === undefined)
|
|
1295
|
+
return { workspaceRoot };
|
|
1296
|
+
if (isResolutionOptions(callerOrOptions)) {
|
|
1297
|
+
return { caller: callerOrOptions.caller, workspaceRoot: callerOrOptions.workspaceRoot };
|
|
1298
|
+
}
|
|
1299
|
+
return { caller: callerOrOptions, workspaceRoot };
|
|
1300
|
+
}
|
|
1301
|
+
function isResolutionOptions(value) {
|
|
1302
|
+
return 'caller' in value || 'workspaceRoot' in value;
|
|
1303
|
+
}
|
|
1304
|
+
/**
|
|
1305
|
+
* Resolve the participant an already-known HTTP client seat owned before a
|
|
1306
|
+
* host replacement. This is deliberately read-only: recovery admission may
|
|
1307
|
+
* reuse durable authority, but it must never mint a participant merely because
|
|
1308
|
+
* an old relay replayed its pre-receipt `session init` request.
|
|
1309
|
+
*/
|
|
1310
|
+
export async function resolveExistingMcpParticipant(clientInfo, mcpSessionId, sessionManager) {
|
|
1311
|
+
const bound = await resolveBoundMCPParticipant(clientInfo, mcpSessionId, sessionManager);
|
|
1312
|
+
if (bound)
|
|
1313
|
+
return resolveExistingParticipantReference(bound, sessionManager);
|
|
1314
|
+
const effectiveClientInfo = clientInfo ?? getRuntimeClientInfo(registryOf(sessionManager), mcpSessionId);
|
|
1315
|
+
const declaredSlug = declaredIdentitySlug(effectiveClientInfo);
|
|
1316
|
+
if (declaredSlug && effectiveClientInfo) {
|
|
1317
|
+
const resolved = await resolveDeclaredIdentityParticipant(sessionManager, effectiveClientInfo);
|
|
1318
|
+
if (resolved) {
|
|
1319
|
+
return {
|
|
1320
|
+
participantId: resolved.participantId,
|
|
1321
|
+
profile: resolved.profile,
|
|
1322
|
+
slug: extractSlug(resolved.profile.metadata) ?? resolved.slug
|
|
1323
|
+
};
|
|
1324
|
+
}
|
|
1325
|
+
return null;
|
|
1326
|
+
}
|
|
1327
|
+
const anchor = await sessionManager.getDefaultActiveSession();
|
|
1328
|
+
if (!anchor)
|
|
1329
|
+
return null;
|
|
1330
|
+
const reclaimed = await reclaimMcpSeat(sessionManager, effectiveClientInfo, anchor, mcpSessionId);
|
|
1331
|
+
if (!reclaimed?.profile)
|
|
1332
|
+
return null;
|
|
1333
|
+
return resolveExistingParticipantReference(reclaimed.profile.participantId, sessionManager);
|
|
1334
|
+
}
|
|
1335
|
+
/**
|
|
1336
|
+
* Ensure session context is available
|
|
1337
|
+
* @param sessionId - Optional explicit session ID
|
|
1338
|
+
* @param participantId - Optional participant ID
|
|
1339
|
+
* @param mcpSessionId - MCP session ID for HTTP transport isolation
|
|
1340
|
+
*/
|
|
1341
|
+
export async function ensureSessionContext(sessionId, participantId, mcpSessionId, options = {}, runtime) {
|
|
1342
|
+
const session = await getSessionManagerAsync(runtime);
|
|
1343
|
+
return ensureSessionContextWithManager(session, runtime, sessionId, participantId, mcpSessionId, options);
|
|
1344
|
+
}
|
|
1345
|
+
/**
|
|
1346
|
+
* Manager-bound form used by cross-feature consumers resolving the registered
|
|
1347
|
+
* `session/manager` context. It never falls back to a second ambient manager.
|
|
1348
|
+
*/
|
|
1349
|
+
export async function ensureSessionContextWithManager(session, runtime, sessionId, participantId, mcpSessionId, options = {}) {
|
|
1350
|
+
const readOnly = options.intent === 'read';
|
|
1351
|
+
const participant = participantId ??
|
|
1352
|
+
(readOnly
|
|
1353
|
+
? (options.caller?.participantId?.trim() ??
|
|
1354
|
+
(await resolveBoundMCPParticipant(undefined, mcpSessionId, session, { caller: options.caller, workspaceRoot: options.workspaceRoot })) ??
|
|
1355
|
+
getScopeBoundParticipantId(runtime) ??
|
|
1356
|
+
undefined)
|
|
1357
|
+
: await getOrCreateMCPParticipant(undefined, {}, mcpSessionId, options.caller, session, options.workspaceRoot));
|
|
1358
|
+
if (readOnly && !participant && !sessionId && !getScopeBoundSessionId(runtime, options.caller)) {
|
|
1359
|
+
throw createSessionToolError('CONNECTION_UNBOUND', 'An unbound session read cannot create a participant.', 'Identify this connection or supply an existing sessionId first.');
|
|
1360
|
+
}
|
|
1361
|
+
const resolvedSessionId = await resolveSessionIdForParticipant(sessionId, participant, mcpSessionId, options, session, runtime);
|
|
1362
|
+
const sessionData = await session.getSession(resolvedSessionId);
|
|
1363
|
+
return { session, sessionId: resolvedSessionId, participantId: participant, sessionData };
|
|
1364
|
+
}
|
|
1365
|
+
/**
|
|
1366
|
+
* Refresh session state from database
|
|
1367
|
+
* @param sessionManager - Optional session manager instance
|
|
1368
|
+
* @param mcpSessionId - MCP session ID for HTTP transport isolation
|
|
1369
|
+
*/
|
|
1370
|
+
export async function refreshSessionState(sessionManager, mcpSessionId) {
|
|
1371
|
+
const session = sessionManager ?? getSessionManager();
|
|
1372
|
+
if (!mcpSessionId)
|
|
1373
|
+
return;
|
|
1374
|
+
const defaultId = await session.getDefaultActiveSession();
|
|
1375
|
+
const resolved = defaultId ? await session.getSession(defaultId) : null;
|
|
1376
|
+
await updateTransportSessionBinding(session, resolved, mcpSessionId);
|
|
1377
|
+
}
|
|
1378
|
+
/**
|
|
1379
|
+
* The participant a transport's connection state names: `participantId`, or
|
|
1380
|
+
* `agentId`, which mirrors it and is the field the MCP surface keeps when it
|
|
1381
|
+
* restamps the connection.
|
|
1382
|
+
*/
|
|
1383
|
+
const membershipIdentitySchema = z.object({
|
|
1384
|
+
participantId: z.string().nullish(),
|
|
1385
|
+
agentId: z.string().nullish()
|
|
1386
|
+
});
|
|
1387
|
+
/**
|
|
1388
|
+
* Renew the durable membership lease while the MCP transport remains alive.
|
|
1389
|
+
* Tool-activity heartbeats are useful, but they are insufficient when an agent
|
|
1390
|
+
* is thinking or waiting for another lane; the transport registry supplies the
|
|
1391
|
+
* missing liveness clock.
|
|
1392
|
+
*/
|
|
1393
|
+
async function renewTransportMembershipLease(runtime, registry, mcpSessionId) {
|
|
1394
|
+
const state = registry.getConnectionState(mcpSessionId);
|
|
1395
|
+
if (!state)
|
|
1396
|
+
return;
|
|
1397
|
+
const identity = membershipIdentitySchema.parse(state);
|
|
1398
|
+
const participantId = identity.participantId ?? identity.agentId;
|
|
1399
|
+
if (!participantId)
|
|
1400
|
+
return;
|
|
1401
|
+
const session = await getSessionManagerAsync(runtime);
|
|
1402
|
+
const sessionId = state.sessionId ??
|
|
1403
|
+
(mcpSessionId
|
|
1404
|
+
? (await session.getSessionForMcpConnection(mcpSessionId))?.id
|
|
1405
|
+
: null) ??
|
|
1406
|
+
(await session.getParticipantActiveSession(participantId));
|
|
1407
|
+
if (!sessionId)
|
|
1408
|
+
return;
|
|
1409
|
+
// Archive closes membership, and only the explicit resume action reopens it:
|
|
1410
|
+
// a transport whose recorded session was archived or removed renews no claim
|
|
1411
|
+
// on it (the rule getSessionForMcpConnection applies to the durable mapping).
|
|
1412
|
+
const target = await session.getSession(sessionId);
|
|
1413
|
+
if (!target || target.status === 'archived')
|
|
1414
|
+
return;
|
|
1415
|
+
await session.acquireMembershipLease({
|
|
1416
|
+
sessionId,
|
|
1417
|
+
participantId,
|
|
1418
|
+
connectionKey: state.connectionId ?? mcpSessionId ?? 'local'
|
|
1419
|
+
});
|
|
1420
|
+
}
|
|
1421
|
+
/** Resolve the declared manager before admitting any renewal timers. */
|
|
1422
|
+
export async function attachMcpMembershipOwner(runtime, registry = mcpSessionRegistryFor(runtime)) {
|
|
1423
|
+
await getSessionManagerAsync(runtime);
|
|
1424
|
+
return registry.attachMembershipOwner(runtime, (id) => renewTransportMembershipLease(runtime, registry, id));
|
|
1425
|
+
}
|
|
1426
|
+
// The registry class and the per-root accessor; no process-wide registry exists.
|
|
1427
|
+
export { McpSessionRegistry, mcpSessionRegistryFor };
|
|
1428
|
+
export { buildUnboundSessionGuidance, isSessionDiscoveryCall, renderUnboundSessionGuidance, UNBOUND_SESSION_HINT, unboundSessionErrorFields } from "./unbound-guidance.js";
|
|
1429
|
+
//# sourceMappingURL=participant.js.map
|