@intentic/sandbox-contract 1.247.0 → 1.249.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -15
- package/dist/chores/chores.d.ts.map +1 -1
- package/dist/chores/chores.js.map +1 -1
- package/dist/chores/digest.d.ts.map +1 -1
- package/dist/chores/digest.js.map +1 -1
- package/dist/chores/extension-update.d.ts.map +1 -1
- package/dist/chores/extension-update.js.map +1 -1
- package/dist/chores/fix-deps.d.ts.map +1 -1
- package/dist/chores/fix-deps.js.map +1 -1
- package/dist/chores/index.d.ts +2 -2
- package/dist/chores/index.d.ts.map +1 -1
- package/dist/chores/index.js +1 -1
- package/dist/chores/index.js.map +1 -1
- package/dist/chores/probes.d.ts.map +1 -1
- package/dist/chores/probes.js.map +1 -1
- package/dist/chores/prompt.d.ts.map +1 -1
- package/dist/chores/prompt.js.map +1 -1
- package/dist/chores/stack.d.ts.map +1 -1
- package/dist/chores/stack.js.map +1 -1
- package/dist/chores/verdict.d.ts +7 -1
- package/dist/chores/verdict.d.ts.map +1 -1
- package/dist/chores/verdict.js +8 -0
- package/dist/chores/verdict.js.map +1 -1
- package/dist/contracts/accounts.contract.d.ts.map +1 -1
- package/dist/contracts/accounts.contract.js.map +1 -1
- package/dist/contracts/activity.contract.d.ts +1 -0
- package/dist/contracts/activity.contract.d.ts.map +1 -1
- package/dist/contracts/agent.contract.d.ts +13 -205
- package/dist/contracts/agent.contract.d.ts.map +1 -1
- package/dist/contracts/agent.contract.js +2 -1
- package/dist/contracts/agent.contract.js.map +1 -1
- package/dist/contracts/agents.contract.d.ts +228 -54
- package/dist/contracts/agents.contract.d.ts.map +1 -1
- package/dist/contracts/agents.contract.js +11 -2
- package/dist/contracts/agents.contract.js.map +1 -1
- package/dist/contracts/automations.contract.d.ts +35 -17
- package/dist/contracts/automations.contract.d.ts.map +1 -1
- package/dist/contracts/automations.contract.js +10 -1
- package/dist/contracts/automations.contract.js.map +1 -1
- package/dist/contracts/capabilities.contract.d.ts +0 -12
- package/dist/contracts/capabilities.contract.d.ts.map +1 -1
- package/dist/contracts/capabilities.contract.js +1 -1
- package/dist/contracts/capabilities.contract.js.map +1 -1
- package/dist/contracts/chores.contract.d.ts.map +1 -1
- package/dist/contracts/chores.contract.js.map +1 -1
- package/dist/contracts/ci.contract.d.ts +9 -0
- package/dist/contracts/ci.contract.d.ts.map +1 -1
- package/dist/contracts/endpoints.contract.d.ts.map +1 -1
- package/dist/contracts/endpoints.contract.js.map +1 -1
- package/dist/contracts/exit.contract.d.ts.map +1 -1
- package/dist/contracts/exit.contract.js +1 -1
- package/dist/contracts/exit.contract.js.map +1 -1
- package/dist/contracts/extensions.contract.d.ts.map +1 -1
- package/dist/contracts/extensions.contract.js.map +1 -1
- package/dist/contracts/git.contract.d.ts +45 -6
- package/dist/contracts/git.contract.d.ts.map +1 -1
- package/dist/contracts/git.contract.js +9 -9
- package/dist/contracts/git.contract.js.map +1 -1
- package/dist/contracts/host.contract.d.ts +2 -0
- package/dist/contracts/host.contract.d.ts.map +1 -1
- package/dist/contracts/host.contract.js.map +1 -1
- package/dist/contracts/intentic.contract.js +1 -1
- package/dist/contracts/intentic.contract.js.map +1 -1
- package/dist/contracts/logs.contract.d.ts.map +1 -1
- package/dist/contracts/logs.contract.js.map +1 -1
- package/dist/contracts/loops.contract.d.ts.map +1 -1
- package/dist/contracts/loops.contract.js.map +1 -1
- package/dist/contracts/personas.contract.d.ts +39 -4
- package/dist/contracts/personas.contract.d.ts.map +1 -1
- package/dist/contracts/personas.contract.js +10 -1
- package/dist/contracts/personas.contract.js.map +1 -1
- package/dist/contracts/providers.contract.d.ts.map +1 -1
- package/dist/contracts/providers.contract.js.map +1 -1
- package/dist/contracts/runner.contract.d.ts +6 -80
- package/dist/contracts/runner.contract.d.ts.map +1 -1
- package/dist/contracts/runner.contract.js +2 -2
- package/dist/contracts/runner.contract.js.map +1 -1
- package/dist/contracts/safety.contract.d.ts.map +1 -1
- package/dist/contracts/safety.contract.js +1 -1
- package/dist/contracts/safety.contract.js.map +1 -1
- package/dist/contracts/secrets.contract.d.ts.map +1 -1
- package/dist/contracts/secrets.contract.js.map +1 -1
- package/dist/contracts/sessions.contract.d.ts +2 -41
- package/dist/contracts/sessions.contract.d.ts.map +1 -1
- package/dist/contracts/sessions.contract.js +1 -1
- package/dist/contracts/sessions.contract.js.map +1 -1
- package/dist/contracts/settings.contract.d.ts +10 -10
- package/dist/contracts/settings.contract.d.ts.map +1 -1
- package/dist/contracts/settings.contract.js.map +1 -1
- package/dist/contracts/share.contract.d.ts.map +1 -1
- package/dist/contracts/share.contract.js.map +1 -1
- package/dist/contracts/skills.contract.d.ts.map +1 -1
- package/dist/contracts/skills.contract.js.map +1 -1
- package/dist/contracts/system.contract.d.ts +49 -73
- package/dist/contracts/system.contract.d.ts.map +1 -1
- package/dist/contracts/system.contract.js +12 -2
- package/dist/contracts/system.contract.js.map +1 -1
- package/dist/contracts/usage.contract.d.ts.map +1 -1
- package/dist/contracts/usage.contract.js.map +1 -1
- package/dist/contracts/vpn.contract.d.ts.map +1 -1
- package/dist/contracts/vpn.contract.js +1 -1
- package/dist/contracts/vpn.contract.js.map +1 -1
- package/dist/contracts/webext.contract.d.ts.map +1 -1
- package/dist/contracts/webext.contract.js.map +1 -1
- package/dist/contracts/workflows.contract.d.ts +7 -6
- package/dist/contracts/workflows.contract.d.ts.map +1 -1
- package/dist/contracts/workflows.contract.js +12 -3
- package/dist/contracts/workflows.contract.js.map +1 -1
- package/dist/contracts/workspace.contract.d.ts.map +1 -1
- package/dist/contracts/workspace.contract.js.map +1 -1
- package/dist/events/agent-events.d.ts +1237 -0
- package/dist/events/agent-events.d.ts.map +1 -0
- package/dist/events/agent-events.js +226 -0
- package/dist/events/agent-events.js.map +1 -0
- package/dist/events/cards.d.ts +404 -0
- package/dist/events/cards.d.ts.map +1 -0
- package/dist/events/cards.js +179 -0
- package/dist/events/cards.js.map +1 -0
- package/dist/events/resume.d.ts +23 -0
- package/dist/events/resume.d.ts.map +1 -0
- package/dist/events/resume.js +31 -0
- package/dist/events/resume.js.map +1 -0
- package/dist/events/system-events.d.ts +615 -0
- package/dist/events/system-events.d.ts.map +1 -0
- package/dist/events/system-events.js +64 -0
- package/dist/events/system-events.js.map +1 -0
- package/dist/events/transcript.d.ts +1755 -0
- package/dist/events/transcript.d.ts.map +1 -0
- package/dist/events/transcript.js +205 -0
- package/dist/events/transcript.js.map +1 -0
- package/dist/ids/conversation-ids.d.ts +8 -0
- package/dist/ids/conversation-ids.d.ts.map +1 -0
- package/dist/{conversation-ids.js → ids/conversation-ids.js} +13 -0
- package/dist/ids/conversation-ids.js.map +1 -0
- package/dist/ids/hostnames.d.ts.map +1 -0
- package/dist/ids/hostnames.js.map +1 -0
- package/dist/ids/session-names.d.ts.map +1 -0
- package/dist/ids/session-names.js.map +1 -0
- package/dist/ids/share-paths.d.ts.map +1 -0
- package/dist/ids/share-paths.js.map +1 -0
- package/dist/{tunnel-ids.d.ts → ids/tunnel-ids.d.ts} +1 -0
- package/dist/ids/tunnel-ids.d.ts.map +1 -0
- package/dist/{tunnel-ids.js → ids/tunnel-ids.js} +1 -0
- package/dist/ids/tunnel-ids.js.map +1 -0
- package/dist/index.d.ts +464 -447
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +54 -47
- package/dist/index.js.map +1 -1
- package/dist/{agent-catalog.d.ts → models/agent-catalog.d.ts} +2 -2
- package/dist/models/agent-catalog.d.ts.map +1 -0
- package/dist/models/agent-catalog.js.map +1 -0
- package/dist/models/agent-runtimes.d.ts.map +1 -0
- package/dist/models/agent-runtimes.js.map +1 -0
- package/dist/{fast-tier.d.ts → models/fast-tier.d.ts} +1 -1
- package/dist/models/fast-tier.d.ts.map +1 -0
- package/dist/models/fast-tier.js.map +1 -0
- package/dist/models/model-order.d.ts.map +1 -0
- package/dist/models/model-order.js.map +1 -0
- package/dist/{model-pins.d.ts → models/model-pins.d.ts} +2 -4
- package/dist/models/model-pins.d.ts.map +1 -0
- package/dist/models/model-pins.js +22 -0
- package/dist/models/model-pins.js.map +1 -0
- package/dist/{model-roles.d.ts → models/model-roles.d.ts} +25 -30
- package/dist/models/model-roles.d.ts.map +1 -0
- package/dist/{model-roles.js → models/model-roles.js} +30 -27
- package/dist/models/model-roles.js.map +1 -0
- package/dist/{plan-pools.d.ts → models/plan-pools.d.ts} +1 -1
- package/dist/models/plan-pools.d.ts.map +1 -0
- package/dist/models/plan-pools.js.map +1 -0
- package/dist/models/prompt-complexity.d.ts.map +1 -0
- package/dist/models/prompt-complexity.js.map +1 -0
- package/dist/models/provider-specs.d.ts.map +1 -0
- package/dist/models/provider-specs.js.map +1 -0
- package/dist/policy/approvals-execution.d.ts.map +1 -0
- package/dist/policy/approvals-execution.js.map +1 -0
- package/dist/{batch-runs.d.ts → policy/batch-runs.d.ts} +5 -1
- package/dist/policy/batch-runs.d.ts.map +1 -0
- package/dist/{batch-runs.js → policy/batch-runs.js} +10 -7
- package/dist/policy/batch-runs.js.map +1 -0
- package/dist/policy/capability-env.d.ts.map +1 -0
- package/dist/policy/capability-env.js.map +1 -0
- package/dist/policy/capability-secrets.d.ts.map +1 -0
- package/dist/policy/capability-secrets.js.map +1 -0
- package/dist/{card-status.d.ts → policy/card-status.d.ts} +2 -2
- package/dist/policy/card-status.d.ts.map +1 -0
- package/dist/{card-status.js → policy/card-status.js} +1 -5
- package/dist/policy/card-status.js.map +1 -0
- package/dist/{command-classes.d.ts → policy/command-classes.d.ts} +6 -2
- package/dist/policy/command-classes.d.ts.map +1 -0
- package/dist/{command-classes.js → policy/command-classes.js} +48 -11
- package/dist/policy/command-classes.js.map +1 -0
- package/dist/{command-run.d.ts → policy/command-run.d.ts} +1 -1
- package/dist/policy/command-run.d.ts.map +1 -0
- package/dist/policy/command-run.js.map +1 -0
- package/dist/policy/control-scopes.d.ts +16 -0
- package/dist/policy/control-scopes.d.ts.map +1 -0
- package/dist/policy/control-scopes.js +26 -0
- package/dist/policy/control-scopes.js.map +1 -0
- package/dist/policy/credential-material.d.ts.map +1 -0
- package/dist/policy/credential-material.js.map +1 -0
- package/dist/policy/needs-action.d.ts.map +1 -0
- package/dist/policy/needs-action.js.map +1 -0
- package/dist/policy/output-fields.d.ts.map +1 -0
- package/dist/policy/output-fields.js.map +1 -0
- package/dist/policy/overlay-lint.d.ts.map +1 -0
- package/dist/policy/overlay-lint.js.map +1 -0
- package/dist/policy/owner-ticket.d.ts.map +1 -0
- package/dist/{owner-ticket.js → policy/owner-ticket.js} +1 -1
- package/dist/policy/owner-ticket.js.map +1 -0
- package/dist/{safety-policy.d.ts → policy/safety-policy.d.ts} +6 -5
- package/dist/policy/safety-policy.d.ts.map +1 -0
- package/dist/{safety-policy.js → policy/safety-policy.js} +12 -12
- package/dist/policy/safety-policy.js.map +1 -0
- package/dist/policy/search-globs.d.ts.map +1 -0
- package/dist/policy/search-globs.js.map +1 -0
- package/dist/protocol/container-requirements.d.ts +20 -0
- package/dist/protocol/container-requirements.d.ts.map +1 -0
- package/dist/protocol/container-requirements.js +23 -0
- package/dist/protocol/container-requirements.js.map +1 -0
- package/dist/{host-protocol.d.ts → protocol/host-protocol.d.ts} +1 -0
- package/dist/protocol/host-protocol.d.ts.map +1 -0
- package/dist/{host-protocol.js → protocol/host-protocol.js} +1 -0
- package/dist/protocol/host-protocol.js.map +1 -0
- package/dist/protocol/ingress-contract.d.ts.map +1 -0
- package/dist/{ingress-contract.js → protocol/ingress-contract.js} +1 -1
- package/dist/protocol/ingress-contract.js.map +1 -0
- package/dist/protocol/ingress-protocol.d.ts.map +1 -0
- package/dist/protocol/ingress-protocol.js.map +1 -0
- package/dist/protocol/listener-protocol.d.ts.map +1 -0
- package/dist/{listener-protocol.js → protocol/listener-protocol.js} +1 -1
- package/dist/protocol/listener-protocol.js.map +1 -0
- package/dist/{peer-dial.d.ts → protocol/peer-dial.d.ts} +4 -1
- package/dist/protocol/peer-dial.d.ts.map +1 -0
- package/dist/{peer-dial.js → protocol/peer-dial.js} +51 -10
- package/dist/protocol/peer-dial.js.map +1 -0
- package/dist/protocol/peer-mcp-server.d.ts.map +1 -0
- package/dist/protocol/peer-mcp-server.js.map +1 -0
- package/dist/protocol/request-id.d.ts.map +1 -0
- package/dist/protocol/request-id.js.map +1 -0
- package/dist/protocol/routes.d.ts.map +1 -0
- package/dist/protocol/routes.js.map +1 -0
- package/dist/{runner-protocol.d.ts → protocol/runner-protocol.d.ts} +1 -0
- package/dist/protocol/runner-protocol.d.ts.map +1 -0
- package/dist/{runner-protocol.js → protocol/runner-protocol.js} +2 -1
- package/dist/protocol/runner-protocol.js.map +1 -0
- package/dist/protocol/sse.d.ts.map +1 -0
- package/dist/protocol/sse.js.map +1 -0
- package/dist/{terminal-protocol.d.ts → protocol/terminal-protocol.d.ts} +1 -3
- package/dist/protocol/terminal-protocol.d.ts.map +1 -0
- package/dist/protocol/terminal-protocol.js.map +1 -0
- package/dist/protocol/webext-links.d.ts.map +1 -0
- package/dist/protocol/webext-links.js.map +1 -0
- package/dist/{webext-protocol.d.ts → protocol/webext-protocol.d.ts} +1 -0
- package/dist/protocol/webext-protocol.d.ts.map +1 -0
- package/dist/{webext-protocol.js → protocol/webext-protocol.js} +1 -0
- package/dist/protocol/webext-protocol.js.map +1 -0
- package/dist/schemas/activity.d.ts +2 -0
- package/dist/schemas/activity.d.ts.map +1 -1
- package/dist/schemas/activity.js +4 -0
- package/dist/schemas/activity.js.map +1 -1
- package/dist/schemas/agent.d.ts +17 -4
- package/dist/schemas/agent.d.ts.map +1 -1
- package/dist/schemas/agent.js +21 -4
- package/dist/schemas/agent.js.map +1 -1
- package/dist/schemas/agents.d.ts +17 -4
- package/dist/schemas/agents.d.ts.map +1 -1
- package/dist/schemas/agents.js +15 -4
- package/dist/schemas/agents.js.map +1 -1
- package/dist/schemas/approvals.d.ts.map +1 -1
- package/dist/schemas/approvals.js.map +1 -1
- package/dist/schemas/automations.d.ts +54 -28
- package/dist/schemas/automations.d.ts.map +1 -1
- package/dist/schemas/automations.js +26 -8
- package/dist/schemas/automations.js.map +1 -1
- package/dist/schemas/capabilities.d.ts +0 -8
- package/dist/schemas/capabilities.d.ts.map +1 -1
- package/dist/schemas/capabilities.js +0 -4
- package/dist/schemas/capabilities.js.map +1 -1
- package/dist/schemas/ci.d.ts +10 -0
- package/dist/schemas/ci.d.ts.map +1 -1
- package/dist/schemas/ci.js +9 -1
- package/dist/schemas/ci.js.map +1 -1
- package/dist/schemas/codebase-health.d.ts.map +1 -1
- package/dist/schemas/codebase-health.js.map +1 -1
- package/dist/schemas/devices.d.ts +90 -0
- package/dist/schemas/devices.d.ts.map +1 -1
- package/dist/schemas/devices.js +10 -1
- package/dist/schemas/devices.js.map +1 -1
- package/dist/schemas/engines.d.ts.map +1 -1
- package/dist/schemas/engines.js.map +1 -1
- package/dist/schemas/environment.d.ts.map +1 -1
- package/dist/schemas/environment.js.map +1 -1
- package/dist/schemas/exit.d.ts.map +1 -1
- package/dist/schemas/exit.js.map +1 -1
- package/dist/schemas/extension-updates.d.ts.map +1 -1
- package/dist/schemas/extension-updates.js.map +1 -1
- package/dist/schemas/git-history.d.ts.map +1 -1
- package/dist/schemas/git-history.js.map +1 -1
- package/dist/schemas/git.d.ts +80 -16
- package/dist/schemas/git.d.ts.map +1 -1
- package/dist/schemas/git.js +37 -25
- package/dist/schemas/git.js.map +1 -1
- package/dist/schemas/history.d.ts.map +1 -1
- package/dist/schemas/history.js.map +1 -1
- package/dist/schemas/hosts.d.ts.map +1 -1
- package/dist/schemas/hosts.js.map +1 -1
- package/dist/schemas/inventory.d.ts.map +1 -1
- package/dist/schemas/inventory.js.map +1 -1
- package/dist/schemas/issues.d.ts +0 -1
- package/dist/schemas/issues.d.ts.map +1 -1
- package/dist/schemas/issues.js +0 -1
- package/dist/schemas/issues.js.map +1 -1
- package/dist/schemas/logs.d.ts.map +1 -1
- package/dist/schemas/logs.js.map +1 -1
- package/dist/schemas/loops.d.ts.map +1 -1
- package/dist/schemas/loops.js +1 -1
- package/dist/schemas/loops.js.map +1 -1
- package/dist/schemas/maintenance.d.ts.map +1 -1
- package/dist/schemas/maintenance.js.map +1 -1
- package/dist/schemas/marketplace.d.ts +0 -4
- package/dist/schemas/marketplace.d.ts.map +1 -1
- package/dist/schemas/panels.d.ts.map +1 -1
- package/dist/schemas/panels.js.map +1 -1
- package/dist/schemas/personas.d.ts +49 -4
- package/dist/schemas/personas.d.ts.map +1 -1
- package/dist/schemas/personas.js +32 -5
- package/dist/schemas/personas.js.map +1 -1
- package/dist/schemas/plan-limits.d.ts +2 -4
- package/dist/schemas/plan-limits.d.ts.map +1 -1
- package/dist/schemas/plan-limits.js +5 -8
- package/dist/schemas/plan-limits.js.map +1 -1
- package/dist/schemas/ports.d.ts.map +1 -1
- package/dist/schemas/ports.js.map +1 -1
- package/dist/schemas/provider-oauth.d.ts.map +1 -1
- package/dist/schemas/provider-oauth.js.map +1 -1
- package/dist/schemas/provider-subscriptions.d.ts +1 -1
- package/dist/schemas/provider-subscriptions.d.ts.map +1 -1
- package/dist/schemas/provider-subscriptions.js +1 -1
- package/dist/schemas/provider-subscriptions.js.map +1 -1
- package/dist/schemas/public.d.ts.map +1 -1
- package/dist/schemas/public.js.map +1 -1
- package/dist/schemas/push.d.ts.map +1 -1
- package/dist/schemas/push.js.map +1 -1
- package/dist/schemas/secrets.d.ts.map +1 -1
- package/dist/schemas/secrets.js.map +1 -1
- package/dist/schemas/settings.d.ts +7 -5
- package/dist/schemas/settings.d.ts.map +1 -1
- package/dist/schemas/settings.js +18 -8
- package/dist/schemas/settings.js.map +1 -1
- package/dist/schemas/share.d.ts.map +1 -1
- package/dist/schemas/share.js.map +1 -1
- package/dist/schemas/shared.d.ts +4 -0
- package/dist/schemas/shared.d.ts.map +1 -1
- package/dist/schemas/shared.js +3 -0
- package/dist/schemas/shared.js.map +1 -1
- package/dist/schemas/system.d.ts +6 -0
- package/dist/schemas/system.d.ts.map +1 -1
- package/dist/schemas/system.js +10 -0
- package/dist/schemas/system.js.map +1 -1
- package/dist/schemas/terminal.d.ts.map +1 -1
- package/dist/schemas/terminal.js.map +1 -1
- package/dist/schemas/usage.d.ts.map +1 -1
- package/dist/schemas/usage.js.map +1 -1
- package/dist/schemas/vpn.d.ts.map +1 -1
- package/dist/schemas/vpn.js.map +1 -1
- package/dist/schemas/webext.d.ts.map +1 -1
- package/dist/schemas/webext.js.map +1 -1
- package/dist/schemas/workflows.d.ts +66 -9
- package/dist/schemas/workflows.d.ts.map +1 -1
- package/dist/schemas/workflows.js +6 -5
- package/dist/schemas/workflows.js.map +1 -1
- package/dist/schemas/workspace-repos.d.ts.map +1 -1
- package/dist/schemas/workspace-repos.js.map +1 -1
- package/dist/schemas/workspace-search.d.ts.map +1 -1
- package/dist/schemas/workspace-search.js.map +1 -1
- package/dist/schemas/workspace-setup.d.ts.map +1 -1
- package/dist/schemas/workspace-setup.js.map +1 -1
- package/dist/schemas/workspace-tree.d.ts.map +1 -1
- package/dist/schemas/workspace-tree.js.map +1 -1
- package/dist/state/arrival.d.ts.map +1 -0
- package/dist/{arrival.js → state/arrival.js} +1 -1
- package/dist/state/arrival.js.map +1 -0
- package/dist/state/contract-lock.d.ts.map +1 -0
- package/dist/{contract-lock.js → state/contract-lock.js} +1 -1
- package/dist/state/contract-lock.js.map +1 -0
- package/dist/{definition.d.ts → state/definition.d.ts} +21 -17
- package/dist/state/definition.d.ts.map +1 -0
- package/dist/{definition.js → state/definition.js} +4 -4
- package/dist/state/definition.js.map +1 -0
- package/dist/state/history-state.d.ts.map +1 -0
- package/dist/{history-state.js → state/history-state.js} +1 -0
- package/dist/state/history-state.js.map +1 -0
- package/dist/state/runtime-state.d.ts.map +1 -0
- package/dist/state/runtime-state.js.map +1 -0
- package/dist/state/starter.d.ts.map +1 -0
- package/dist/state/starter.js.map +1 -0
- package/dist/state/state-portability.d.ts.map +1 -0
- package/dist/state/state-portability.js.map +1 -0
- package/dist/state/versions.d.ts.map +1 -0
- package/dist/state/versions.js.map +1 -0
- package/dist/{workspace-state.d.ts → state/workspace-state.d.ts} +8 -5
- package/dist/state/workspace-state.d.ts.map +1 -0
- package/dist/{workspace-state.js → state/workspace-state.js} +25 -1
- package/dist/state/workspace-state.js.map +1 -0
- package/dist/{documents.d.ts → text/documents.d.ts} +1 -1
- package/dist/text/documents.d.ts.map +1 -0
- package/dist/{documents.js → text/documents.js} +1 -1
- package/dist/text/documents.js.map +1 -0
- package/dist/text/embed.d.ts.map +1 -0
- package/dist/text/embed.js.map +1 -0
- package/dist/text/mentions.d.ts.map +1 -0
- package/dist/text/mentions.js.map +1 -0
- package/dist/text/model-answer.d.ts +3 -0
- package/dist/text/model-answer.d.ts.map +1 -0
- package/dist/text/model-answer.js +3 -0
- package/dist/text/model-answer.js.map +1 -0
- package/dist/text/path-refs.d.ts.map +1 -0
- package/dist/text/path-refs.js.map +1 -0
- package/dist/{shell-regions.d.ts → text/shell-regions.d.ts} +1 -1
- package/dist/text/shell-regions.d.ts.map +1 -0
- package/dist/text/shell-regions.js.map +1 -0
- package/dist/text/title.d.ts.map +1 -0
- package/dist/text/title.js.map +1 -0
- package/dist/{transcript-fold.d.ts → text/transcript-fold.d.ts} +2 -1
- package/dist/text/transcript-fold.d.ts.map +1 -0
- package/dist/{transcript-fold.js → text/transcript-fold.js} +2 -16
- package/dist/text/transcript-fold.js.map +1 -0
- package/dist/text/whisper.d.ts +3 -0
- package/dist/text/whisper.d.ts.map +1 -0
- package/dist/text/whisper.js +11 -0
- package/dist/text/whisper.js.map +1 -0
- package/dist/{workflow-faults.d.ts → text/workflow-faults.d.ts} +1 -1
- package/dist/text/workflow-faults.d.ts.map +1 -0
- package/dist/{workflow-faults.js → text/workflow-faults.js} +1 -1
- package/dist/text/workflow-faults.js.map +1 -0
- package/package.json +70 -70
- package/src/chores/chores.test.ts +4 -10
- package/src/chores/chores.ts +148 -392
- package/src/chores/digest.ts +8 -28
- package/src/chores/extension-update.ts +3 -8
- package/src/chores/fix-deps.ts +4 -18
- package/src/chores/index.ts +2 -2
- package/src/chores/probes.test.ts +7 -43
- package/src/chores/probes.ts +62 -167
- package/src/chores/prompt.ts +10 -34
- package/src/chores/stack.test.ts +6 -45
- package/src/chores/stack.ts +27 -118
- package/src/chores/verdict.test.ts +101 -80
- package/src/chores/verdict.ts +54 -99
- package/src/contracts/accounts.contract.ts +4 -19
- package/src/contracts/agent.contract.ts +7 -22
- package/src/contracts/agents.contract.ts +25 -71
- package/src/contracts/automations.contract.ts +14 -30
- package/src/contracts/capabilities.contract.ts +8 -35
- package/src/contracts/chores.contract.ts +4 -15
- package/src/contracts/endpoints.contract.ts +5 -22
- package/src/contracts/exit.contract.ts +7 -30
- package/src/contracts/extensions.contract.ts +8 -30
- package/src/contracts/git.contract.ts +25 -49
- package/src/contracts/host.contract.ts +9 -44
- package/src/contracts/intentic.contract.ts +1 -1
- package/src/contracts/logs.contract.ts +3 -13
- package/src/contracts/loops.contract.ts +9 -40
- package/src/contracts/personas.contract.ts +22 -30
- package/src/contracts/providers.contract.ts +4 -17
- package/src/contracts/runner.contract.ts +12 -39
- package/src/contracts/safety.contract.ts +5 -14
- package/src/contracts/secrets.contract.ts +4 -22
- package/src/contracts/sessions.contract.ts +1 -1
- package/src/contracts/settings.contract.ts +4 -10
- package/src/contracts/share.contract.ts +3 -9
- package/src/contracts/skills.contract.ts +4 -15
- package/src/contracts/system.contract.ts +26 -52
- package/src/contracts/usage.contract.ts +7 -21
- package/src/contracts/vpn.contract.ts +9 -16
- package/src/contracts/webext.contract.ts +9 -25
- package/src/contracts/workflows.contract.ts +34 -58
- package/src/contracts/workspace.contract.ts +19 -50
- package/src/events/agent-events.ts +345 -0
- package/src/events/cards.ts +286 -0
- package/src/{events.test.ts → events/resume.test.ts} +4 -19
- package/src/events/resume.ts +60 -0
- package/src/events/system-events.ts +139 -0
- package/src/events/transcript.ts +320 -0
- package/src/{conversation-ids.test.ts → ids/conversation-ids.test.ts} +25 -13
- package/src/ids/conversation-ids.ts +178 -0
- package/src/ids/hostnames.ts +129 -0
- package/src/ids/session-names.ts +29 -0
- package/src/ids/share-paths.ts +43 -0
- package/src/{tunnel-ids.test.ts → ids/tunnel-ids.test.ts} +1 -14
- package/src/ids/tunnel-ids.ts +29 -0
- package/src/index.ts +71 -88
- package/src/{agent-catalog.test.ts → models/agent-catalog.test.ts} +19 -93
- package/src/models/agent-catalog.ts +174 -0
- package/src/models/agent-runtimes.ts +201 -0
- package/src/models/capability-ledger.test.ts +84 -0
- package/src/{fast-tier.test.ts → models/fast-tier.test.ts} +7 -18
- package/src/models/fast-tier.ts +36 -0
- package/src/{model-order.test.ts → models/model-order.test.ts} +19 -40
- package/src/models/model-order.ts +163 -0
- package/src/models/model-pins.test.ts +87 -0
- package/src/models/model-pins.ts +57 -0
- package/src/models/model-roles.test.ts +38 -0
- package/src/models/model-roles.ts +180 -0
- package/src/{plan-pools.test.ts → models/plan-pools.test.ts} +6 -11
- package/src/models/plan-pools.ts +65 -0
- package/src/{prompt-complexity.test.ts → models/prompt-complexity.test.ts} +8 -60
- package/src/models/prompt-complexity.ts +215 -0
- package/src/{provider-specs.test.ts → models/provider-specs.test.ts} +18 -47
- package/src/models/provider-specs.ts +272 -0
- package/src/policy/approvals-execution.ts +58 -0
- package/src/{batch-runs.test.ts → policy/batch-runs.test.ts} +4 -20
- package/src/policy/batch-runs.ts +137 -0
- package/src/policy/capability-secrets.ts +5 -0
- package/src/{card-status.ts → policy/card-status.ts} +11 -26
- package/src/{command-classes.test.ts → policy/command-classes.test.ts} +11 -118
- package/src/policy/command-classes.ts +395 -0
- package/src/policy/command-run.ts +65 -0
- package/src/policy/control-scopes.ts +38 -0
- package/src/{credential-material.test.ts → policy/credential-material.test.ts} +4 -26
- package/src/policy/credential-material.ts +91 -0
- package/src/policy/needs-action.ts +5 -0
- package/src/policy/output-fields.ts +86 -0
- package/src/policy/overlay-lint.ts +100 -0
- package/src/{owner-ticket.test.ts → policy/owner-ticket.test.ts} +1 -1
- package/src/{owner-ticket.ts → policy/owner-ticket.ts} +9 -31
- package/src/policy/safety-policy.test.ts +84 -0
- package/src/policy/safety-policy.ts +142 -0
- package/src/policy/search-globs.ts +60 -0
- package/src/protocol/container-requirements.test.ts +72 -0
- package/src/protocol/container-requirements.ts +58 -0
- package/src/protocol/host-protocol.ts +29 -0
- package/src/protocol/ingress-contract.ts +103 -0
- package/src/{ingress-protocol.test.ts → protocol/ingress-protocol.test.ts} +25 -90
- package/src/protocol/ingress-protocol.ts +441 -0
- package/src/protocol/listener-protocol.ts +75 -0
- package/src/{peer-dial.test.ts → protocol/peer-dial.test.ts} +52 -1
- package/src/protocol/peer-dial.ts +207 -0
- package/src/{peer-mcp-server.ts → protocol/peer-mcp-server.ts} +16 -41
- package/src/protocol/request-id.ts +5 -0
- package/src/{routes.test.ts → protocol/routes.test.ts} +14 -22
- package/src/protocol/routes.ts +159 -0
- package/src/protocol/runner-protocol.ts +197 -0
- package/src/protocol/terminal-protocol.ts +13 -0
- package/src/protocol/webext-links.ts +50 -0
- package/src/protocol/webext-protocol.ts +24 -0
- package/src/schemas/activity.ts +22 -30
- package/src/schemas/agent.ts +130 -238
- package/src/schemas/agents.ts +165 -483
- package/src/schemas/approvals.ts +23 -71
- package/src/schemas/automations.ts +145 -249
- package/src/schemas/capabilities.ts +127 -414
- package/src/schemas/ci.ts +56 -108
- package/src/schemas/codebase-health.ts +7 -11
- package/src/schemas/devices.ts +98 -321
- package/src/schemas/engines.ts +16 -44
- package/src/schemas/environment.ts +41 -91
- package/src/schemas/exit.ts +24 -81
- package/src/schemas/extension-updates.ts +42 -87
- package/src/schemas/git-history.ts +30 -84
- package/src/schemas/git.ts +141 -256
- package/src/schemas/history.ts +14 -40
- package/src/schemas/hosts.ts +9 -15
- package/src/schemas/inventory.ts +8 -10
- package/src/schemas/issues.ts +66 -134
- package/src/schemas/logs.ts +15 -34
- package/src/schemas/loops.ts +46 -163
- package/src/schemas/maintenance.ts +47 -172
- package/src/schemas/panels.ts +20 -45
- package/src/schemas/personas.ts +85 -168
- package/src/schemas/plan-limits.ts +58 -197
- package/src/schemas/ports.ts +14 -32
- package/src/schemas/provider-oauth.ts +23 -76
- package/src/schemas/provider-subscriptions.ts +4 -13
- package/src/schemas/public.ts +4 -15
- package/src/schemas/push.ts +8 -36
- package/src/schemas/secrets.ts +20 -64
- package/src/schemas/settings.ts +177 -597
- package/src/schemas/share.ts +14 -32
- package/src/schemas/shared.ts +14 -13
- package/src/schemas/system.ts +46 -78
- package/src/schemas/terminal.ts +41 -120
- package/src/schemas/usage.ts +44 -233
- package/src/schemas/version-seam.test.ts +9 -26
- package/src/schemas/vpn.ts +27 -64
- package/src/schemas/webext.ts +22 -53
- package/src/schemas/workflows.ts +57 -183
- package/src/schemas/workspace-repos.ts +12 -24
- package/src/schemas/workspace-search.ts +17 -35
- package/src/schemas/workspace-setup.ts +4 -11
- package/src/schemas/workspace-tree.ts +32 -91
- package/src/state/arrival.ts +109 -0
- package/src/state/contract-lock.test.ts +17 -0
- package/src/state/contract-lock.ts +49 -0
- package/src/state/definition.ts +143 -0
- package/src/state/history-state.ts +103 -0
- package/src/{runtime-state.test.ts → state/runtime-state.test.ts} +3 -10
- package/src/state/runtime-state.ts +62 -0
- package/src/state/starter.ts +5 -0
- package/src/state/state-portability.ts +27 -0
- package/src/state/versions.ts +26 -0
- package/src/{workspace-state.test.ts → state/workspace-state.test.ts} +65 -173
- package/src/state/workspace-state.ts +669 -0
- package/src/{documents.test.ts → text/documents.test.ts} +1 -1
- package/src/text/documents.ts +42 -0
- package/src/text/embed.ts +132 -0
- package/src/text/mentions.ts +21 -0
- package/src/text/model-answer.ts +9 -0
- package/src/text/path-refs.ts +39 -0
- package/src/text/shell-regions.ts +224 -0
- package/src/{title.test.ts → text/title.test.ts} +13 -32
- package/src/text/title.ts +202 -0
- package/src/{transcript-fold.test.ts → text/transcript-fold.test.ts} +5 -83
- package/src/{transcript-fold.ts → text/transcript-fold.ts} +65 -170
- package/src/text/whisper.test.ts +19 -0
- package/src/text/whisper.ts +17 -0
- package/src/{workflow-faults.test.ts → text/workflow-faults.test.ts} +6 -24
- package/src/{workflow-faults.ts → text/workflow-faults.ts} +20 -60
- package/dist/agent-catalog.d.ts.map +0 -1
- package/dist/agent-catalog.js.map +0 -1
- package/dist/agent-runtimes.d.ts.map +0 -1
- package/dist/agent-runtimes.js.map +0 -1
- package/dist/approvals-execution.d.ts.map +0 -1
- package/dist/approvals-execution.js.map +0 -1
- package/dist/arrival.d.ts.map +0 -1
- package/dist/arrival.js.map +0 -1
- package/dist/batch-runs.d.ts.map +0 -1
- package/dist/batch-runs.js.map +0 -1
- package/dist/capability-env.d.ts.map +0 -1
- package/dist/capability-env.js.map +0 -1
- package/dist/capability-secrets.d.ts.map +0 -1
- package/dist/capability-secrets.js.map +0 -1
- package/dist/card-status.d.ts.map +0 -1
- package/dist/card-status.js.map +0 -1
- package/dist/command-classes.d.ts.map +0 -1
- package/dist/command-classes.js.map +0 -1
- package/dist/command-run.d.ts.map +0 -1
- package/dist/command-run.js.map +0 -1
- package/dist/contract-lock.d.ts.map +0 -1
- package/dist/contract-lock.js.map +0 -1
- package/dist/conversation-ids.d.ts +0 -4
- package/dist/conversation-ids.d.ts.map +0 -1
- package/dist/conversation-ids.js.map +0 -1
- package/dist/credential-material.d.ts.map +0 -1
- package/dist/credential-material.js.map +0 -1
- package/dist/definition.d.ts.map +0 -1
- package/dist/definition.js.map +0 -1
- package/dist/documents.d.ts.map +0 -1
- package/dist/documents.js.map +0 -1
- package/dist/embed.d.ts.map +0 -1
- package/dist/embed.js.map +0 -1
- package/dist/events.d.ts +0 -4336
- package/dist/events.d.ts.map +0 -1
- package/dist/events.js +0 -725
- package/dist/events.js.map +0 -1
- package/dist/fast-tier.d.ts.map +0 -1
- package/dist/fast-tier.js.map +0 -1
- package/dist/history-state.d.ts.map +0 -1
- package/dist/history-state.js.map +0 -1
- package/dist/host-protocol.d.ts.map +0 -1
- package/dist/host-protocol.js.map +0 -1
- package/dist/hostnames.d.ts.map +0 -1
- package/dist/hostnames.js.map +0 -1
- package/dist/ingress-contract.d.ts.map +0 -1
- package/dist/ingress-contract.js.map +0 -1
- package/dist/ingress-protocol.d.ts.map +0 -1
- package/dist/ingress-protocol.js.map +0 -1
- package/dist/listener-protocol.d.ts.map +0 -1
- package/dist/listener-protocol.js.map +0 -1
- package/dist/mentions.d.ts.map +0 -1
- package/dist/mentions.js.map +0 -1
- package/dist/model-order.d.ts.map +0 -1
- package/dist/model-order.js.map +0 -1
- package/dist/model-pins.d.ts.map +0 -1
- package/dist/model-pins.js +0 -45
- package/dist/model-pins.js.map +0 -1
- package/dist/model-roles.d.ts.map +0 -1
- package/dist/model-roles.js.map +0 -1
- package/dist/needs-action.d.ts.map +0 -1
- package/dist/needs-action.js.map +0 -1
- package/dist/output-fields.d.ts.map +0 -1
- package/dist/output-fields.js.map +0 -1
- package/dist/overlay-lint.d.ts.map +0 -1
- package/dist/overlay-lint.js.map +0 -1
- package/dist/owner-ticket.d.ts.map +0 -1
- package/dist/owner-ticket.js.map +0 -1
- package/dist/path-refs.d.ts.map +0 -1
- package/dist/path-refs.js.map +0 -1
- package/dist/peer-dial.d.ts.map +0 -1
- package/dist/peer-dial.js.map +0 -1
- package/dist/peer-mcp-server.d.ts.map +0 -1
- package/dist/peer-mcp-server.js.map +0 -1
- package/dist/plan-pools.d.ts.map +0 -1
- package/dist/plan-pools.js.map +0 -1
- package/dist/prompt-complexity.d.ts.map +0 -1
- package/dist/prompt-complexity.js.map +0 -1
- package/dist/provider-specs.d.ts.map +0 -1
- package/dist/provider-specs.js.map +0 -1
- package/dist/request-id.d.ts.map +0 -1
- package/dist/request-id.js.map +0 -1
- package/dist/routes.d.ts.map +0 -1
- package/dist/routes.js.map +0 -1
- package/dist/runner-protocol.d.ts.map +0 -1
- package/dist/runner-protocol.js.map +0 -1
- package/dist/runtime-state.d.ts.map +0 -1
- package/dist/runtime-state.js.map +0 -1
- package/dist/safety-policy.d.ts.map +0 -1
- package/dist/safety-policy.js.map +0 -1
- package/dist/schemas/context.d.ts +0 -30
- package/dist/schemas/context.d.ts.map +0 -1
- package/dist/schemas/context.js +0 -34
- package/dist/schemas/context.js.map +0 -1
- package/dist/search-globs.d.ts.map +0 -1
- package/dist/search-globs.js.map +0 -1
- package/dist/session-names.d.ts.map +0 -1
- package/dist/session-names.js.map +0 -1
- package/dist/share-paths.d.ts.map +0 -1
- package/dist/share-paths.js.map +0 -1
- package/dist/shell-regions.d.ts.map +0 -1
- package/dist/shell-regions.js.map +0 -1
- package/dist/sse.d.ts.map +0 -1
- package/dist/sse.js.map +0 -1
- package/dist/starter.d.ts.map +0 -1
- package/dist/starter.js.map +0 -1
- package/dist/state-portability.d.ts.map +0 -1
- package/dist/state-portability.js.map +0 -1
- package/dist/terminal-protocol.d.ts.map +0 -1
- package/dist/terminal-protocol.js.map +0 -1
- package/dist/title.d.ts.map +0 -1
- package/dist/title.js.map +0 -1
- package/dist/transcript-fold.d.ts.map +0 -1
- package/dist/transcript-fold.js.map +0 -1
- package/dist/tunnel-ids.d.ts.map +0 -1
- package/dist/tunnel-ids.js.map +0 -1
- package/dist/versions.d.ts.map +0 -1
- package/dist/versions.js.map +0 -1
- package/dist/webext-links.d.ts.map +0 -1
- package/dist/webext-links.js.map +0 -1
- package/dist/webext-protocol.d.ts.map +0 -1
- package/dist/webext-protocol.js.map +0 -1
- package/dist/workflow-faults.d.ts.map +0 -1
- package/dist/workflow-faults.js.map +0 -1
- package/dist/workspace-state.d.ts.map +0 -1
- package/dist/workspace-state.js.map +0 -1
- package/src/agent-catalog.ts +0 -316
- package/src/agent-runtimes.ts +0 -419
- package/src/approvals-execution.ts +0 -96
- package/src/arrival.ts +0 -160
- package/src/batch-runs.ts +0 -188
- package/src/capability-ledger.test.ts +0 -140
- package/src/capability-secrets.ts +0 -20
- package/src/command-classes.ts +0 -617
- package/src/command-run.ts +0 -78
- package/src/contract-lock.test.ts +0 -23
- package/src/contract-lock.ts +0 -66
- package/src/conversation-ids.ts +0 -207
- package/src/credential-material.ts +0 -181
- package/src/definition.ts +0 -207
- package/src/documents.ts +0 -67
- package/src/embed.ts +0 -164
- package/src/events.ts +0 -1870
- package/src/fast-tier.ts +0 -72
- package/src/history-state.ts +0 -174
- package/src/host-protocol.ts +0 -36
- package/src/hostnames.ts +0 -180
- package/src/ingress-contract.ts +0 -157
- package/src/ingress-protocol.ts +0 -625
- package/src/listener-protocol.ts +0 -96
- package/src/mentions.ts +0 -25
- package/src/model-order.ts +0 -262
- package/src/model-pins.test.ts +0 -202
- package/src/model-pins.ts +0 -183
- package/src/model-roles.ts +0 -224
- package/src/needs-action.ts +0 -14
- package/src/output-fields.ts +0 -111
- package/src/overlay-lint.ts +0 -116
- package/src/path-refs.ts +0 -59
- package/src/peer-dial.ts +0 -163
- package/src/plan-pools.ts +0 -92
- package/src/prompt-complexity.ts +0 -334
- package/src/provider-specs.ts +0 -432
- package/src/request-id.ts +0 -41
- package/src/routes.ts +0 -219
- package/src/runner-protocol.ts +0 -239
- package/src/runtime-state.ts +0 -140
- package/src/safety-policy.test.ts +0 -88
- package/src/safety-policy.ts +0 -258
- package/src/schemas/context.ts +0 -87
- package/src/search-globs.ts +0 -76
- package/src/session-names.ts +0 -44
- package/src/share-paths.ts +0 -68
- package/src/shell-regions.ts +0 -289
- package/src/starter.ts +0 -13
- package/src/state-portability.ts +0 -56
- package/src/terminal-protocol.ts +0 -16
- package/src/title.ts +0 -267
- package/src/tunnel-ids.ts +0 -57
- package/src/versions.ts +0 -48
- package/src/webext-links.ts +0 -90
- package/src/webext-protocol.ts +0 -27
- package/src/workspace-state.ts +0 -1096
- /package/dist/{hostnames.d.ts → ids/hostnames.d.ts} +0 -0
- /package/dist/{hostnames.js → ids/hostnames.js} +0 -0
- /package/dist/{session-names.d.ts → ids/session-names.d.ts} +0 -0
- /package/dist/{session-names.js → ids/session-names.js} +0 -0
- /package/dist/{share-paths.d.ts → ids/share-paths.d.ts} +0 -0
- /package/dist/{share-paths.js → ids/share-paths.js} +0 -0
- /package/dist/{agent-catalog.js → models/agent-catalog.js} +0 -0
- /package/dist/{agent-runtimes.d.ts → models/agent-runtimes.d.ts} +0 -0
- /package/dist/{agent-runtimes.js → models/agent-runtimes.js} +0 -0
- /package/dist/{fast-tier.js → models/fast-tier.js} +0 -0
- /package/dist/{model-order.d.ts → models/model-order.d.ts} +0 -0
- /package/dist/{model-order.js → models/model-order.js} +0 -0
- /package/dist/{plan-pools.js → models/plan-pools.js} +0 -0
- /package/dist/{prompt-complexity.d.ts → models/prompt-complexity.d.ts} +0 -0
- /package/dist/{prompt-complexity.js → models/prompt-complexity.js} +0 -0
- /package/dist/{provider-specs.d.ts → models/provider-specs.d.ts} +0 -0
- /package/dist/{provider-specs.js → models/provider-specs.js} +0 -0
- /package/dist/{approvals-execution.d.ts → policy/approvals-execution.d.ts} +0 -0
- /package/dist/{approvals-execution.js → policy/approvals-execution.js} +0 -0
- /package/dist/{capability-env.d.ts → policy/capability-env.d.ts} +0 -0
- /package/dist/{capability-env.js → policy/capability-env.js} +0 -0
- /package/dist/{capability-secrets.d.ts → policy/capability-secrets.d.ts} +0 -0
- /package/dist/{capability-secrets.js → policy/capability-secrets.js} +0 -0
- /package/dist/{command-run.js → policy/command-run.js} +0 -0
- /package/dist/{credential-material.d.ts → policy/credential-material.d.ts} +0 -0
- /package/dist/{credential-material.js → policy/credential-material.js} +0 -0
- /package/dist/{needs-action.d.ts → policy/needs-action.d.ts} +0 -0
- /package/dist/{needs-action.js → policy/needs-action.js} +0 -0
- /package/dist/{output-fields.d.ts → policy/output-fields.d.ts} +0 -0
- /package/dist/{output-fields.js → policy/output-fields.js} +0 -0
- /package/dist/{overlay-lint.d.ts → policy/overlay-lint.d.ts} +0 -0
- /package/dist/{overlay-lint.js → policy/overlay-lint.js} +0 -0
- /package/dist/{owner-ticket.d.ts → policy/owner-ticket.d.ts} +0 -0
- /package/dist/{search-globs.d.ts → policy/search-globs.d.ts} +0 -0
- /package/dist/{search-globs.js → policy/search-globs.js} +0 -0
- /package/dist/{ingress-contract.d.ts → protocol/ingress-contract.d.ts} +0 -0
- /package/dist/{ingress-protocol.d.ts → protocol/ingress-protocol.d.ts} +0 -0
- /package/dist/{ingress-protocol.js → protocol/ingress-protocol.js} +0 -0
- /package/dist/{listener-protocol.d.ts → protocol/listener-protocol.d.ts} +0 -0
- /package/dist/{peer-mcp-server.d.ts → protocol/peer-mcp-server.d.ts} +0 -0
- /package/dist/{peer-mcp-server.js → protocol/peer-mcp-server.js} +0 -0
- /package/dist/{request-id.d.ts → protocol/request-id.d.ts} +0 -0
- /package/dist/{request-id.js → protocol/request-id.js} +0 -0
- /package/dist/{routes.d.ts → protocol/routes.d.ts} +0 -0
- /package/dist/{routes.js → protocol/routes.js} +0 -0
- /package/dist/{sse.d.ts → protocol/sse.d.ts} +0 -0
- /package/dist/{sse.js → protocol/sse.js} +0 -0
- /package/dist/{terminal-protocol.js → protocol/terminal-protocol.js} +0 -0
- /package/dist/{webext-links.d.ts → protocol/webext-links.d.ts} +0 -0
- /package/dist/{webext-links.js → protocol/webext-links.js} +0 -0
- /package/dist/{arrival.d.ts → state/arrival.d.ts} +0 -0
- /package/dist/{contract-lock.d.ts → state/contract-lock.d.ts} +0 -0
- /package/dist/{history-state.d.ts → state/history-state.d.ts} +0 -0
- /package/dist/{runtime-state.d.ts → state/runtime-state.d.ts} +0 -0
- /package/dist/{runtime-state.js → state/runtime-state.js} +0 -0
- /package/dist/{starter.d.ts → state/starter.d.ts} +0 -0
- /package/dist/{starter.js → state/starter.js} +0 -0
- /package/dist/{state-portability.d.ts → state/state-portability.d.ts} +0 -0
- /package/dist/{state-portability.js → state/state-portability.js} +0 -0
- /package/dist/{versions.d.ts → state/versions.d.ts} +0 -0
- /package/dist/{versions.js → state/versions.js} +0 -0
- /package/dist/{embed.d.ts → text/embed.d.ts} +0 -0
- /package/dist/{embed.js → text/embed.js} +0 -0
- /package/dist/{mentions.d.ts → text/mentions.d.ts} +0 -0
- /package/dist/{mentions.js → text/mentions.js} +0 -0
- /package/dist/{path-refs.d.ts → text/path-refs.d.ts} +0 -0
- /package/dist/{path-refs.js → text/path-refs.js} +0 -0
- /package/dist/{shell-regions.js → text/shell-regions.js} +0 -0
- /package/dist/{title.d.ts → text/title.d.ts} +0 -0
- /package/dist/{title.js → text/title.js} +0 -0
- /package/src/{hostnames.test.ts → ids/hostnames.test.ts} +0 -0
- /package/src/{share-paths.test.ts → ids/share-paths.test.ts} +0 -0
- /package/src/{capability-env.ts → policy/capability-env.ts} +0 -0
- /package/src/{overlay-lint.test.ts → policy/overlay-lint.test.ts} +0 -0
- /package/src/{search-globs.test.ts → policy/search-globs.test.ts} +0 -0
- /package/src/{ingress-contract.test.ts → protocol/ingress-contract.test.ts} +0 -0
- /package/src/{peer-mcp-server.test.ts → protocol/peer-mcp-server.test.ts} +0 -0
- /package/src/{sse.ts → protocol/sse.ts} +0 -0
- /package/src/{versions.test.ts → state/versions.test.ts} +0 -0
- /package/src/{embed.test.ts → text/embed.test.ts} +0 -0
- /package/src/{mentions.test.ts → text/mentions.test.ts} +0 -0
- /package/src/{path-refs.test.ts → text/path-refs.test.ts} +0 -0
package/src/shell-regions.ts
DELETED
|
@@ -1,289 +0,0 @@
|
|
|
1
|
-
/* WHICH PARTS OF A COMMAND ARE TEXT RATHER THAN A PROGRAM, so the one tier that cannot be argued with stops
|
|
2
|
-
* firing on a mention of a dangerous verb.
|
|
3
|
-
*
|
|
4
|
-
* WHAT THIS IS FOR, precisely, because it bounds how good it has to be. The triage catalog next door
|
|
5
|
-
* (command-classes.ts) is deliberately over-inclusive: a match only means a judge should look, and a false
|
|
6
|
-
* positive there costs one model call. That economy holds for every class except the hard-ruled one, where a
|
|
7
|
-
* match is an interruption no policy and no verdict can waive (safety-policy.ts hardRuleClasses). So
|
|
8
|
-
* `echo "rm -rf /" >> notes.md` and `rg 'rm -rf /'` raised un-waivable cards over a string being written to a
|
|
9
|
-
* file and a search of the tree — the exact failure the judge redesign was built to end, surviving in the one
|
|
10
|
-
* tier the judge cannot reach.
|
|
11
|
-
*
|
|
12
|
-
* This says where a fragment sits. A fragment inside a region below is still REPORTED (the class holds, the
|
|
13
|
-
* judge still reads it, the card still marks it); it just does not trip the hard rule.
|
|
14
|
-
*
|
|
15
|
-
* WHICH IS WHY A REGEX-LEVEL SCANNER IS ENOUGH, and this is the design argument rather than an excuse. Both
|
|
16
|
-
* ways of being wrong are cheap:
|
|
17
|
-
*
|
|
18
|
-
* · MISS a region (call text a program) ⇒ one judge call. Exactly today's behaviour, which is the floor.
|
|
19
|
-
* · INVENT a region (call a program text) ⇒ the class is still reported and the judge still rules on it.
|
|
20
|
-
* Only the un-waivable tier is skipped, and the judge is the tier that reads the owner's policy.
|
|
21
|
-
*
|
|
22
|
-
* Precision has to be good enough to skip tier 1½, never good enough to skip tier 1. Nothing here is a
|
|
23
|
-
* boundary, for the same reason nothing in command-classes.ts is: `sh -c "$CMD"` and a path assembled from a
|
|
24
|
-
* variable walk past all of it. The boundaries are structural and elsewhere.
|
|
25
|
-
*
|
|
26
|
-
* THREE KINDS OF REGION, and each is a place a shell will not run what it holds:
|
|
27
|
-
*
|
|
28
|
-
* 1 A COMMENT, `#` to end of line.
|
|
29
|
-
* 2 A HEREDOC BODY, the usual way an agent writes a script it is not running yet.
|
|
30
|
-
* 3 A QUOTED ARGUMENT OF A VERB THAT CANNOT EXECUTE ONE — echo, printf, and the searchers. Plus a quoted
|
|
31
|
-
* commit message after -m, whatever the verb, because message text never runs.
|
|
32
|
-
*
|
|
33
|
-
* `sed`, `awk` and `perl` are deliberately NOT in that verb list, though they are the obvious next entries:
|
|
34
|
-
* each can run a shell out of its own quoted program (`awk 'BEGIN{system("…")}'`, `perl -e`, GNU sed's `s///e`),
|
|
35
|
-
* so their quoted argument is a program and calling it text would be wrong rather than merely imprecise.
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
import type { CommandSpan } from "./command-classes.js";
|
|
39
|
-
|
|
40
|
-
/* Verbs whose quoted arguments this scanner will call text. Every one of them either prints its argument or
|
|
41
|
-
* matches with it, and none has a documented way to execute it. Widening this list is safe in the sense the
|
|
42
|
-
* header sets out, but each entry should be able to answer "how would this run its argument?" with "it cannot". */
|
|
43
|
-
const QUOTING_VERBS: ReadonlySet<string> = new Set([
|
|
44
|
-
"echo",
|
|
45
|
-
"printf",
|
|
46
|
-
"rg",
|
|
47
|
-
"grep",
|
|
48
|
-
"egrep",
|
|
49
|
-
"fgrep",
|
|
50
|
-
"ack",
|
|
51
|
-
"ag",
|
|
52
|
-
"ripgrep",
|
|
53
|
-
]);
|
|
54
|
-
|
|
55
|
-
/* A flag whose value is a message: git's -m, and the long spelling. A quoted string here is prose that reaches
|
|
56
|
-
* a commit, a tag or a PR, and `git commit -m "rm -rf the old build dir"` is one of the more ordinary ways to
|
|
57
|
-
* write a dangerous-looking command that is not one. Read on the WORD BEFORE a quoted argument, so it applies
|
|
58
|
-
* whatever the verb is. */
|
|
59
|
-
const MESSAGE_FLAGS: ReadonlySet<string> = new Set(["-m", "--message", "-am", "--body", "-b"]);
|
|
60
|
-
|
|
61
|
-
// Where an unquoted word ends: whitespace, a pipeline or list operator, a redirect, a subshell paren.
|
|
62
|
-
const WORD_END = /[\s;|&<>()]/;
|
|
63
|
-
|
|
64
|
-
// A word that is a variable assignment prefixing a command (`FOO=bar cmd …`), skipped when looking for the verb.
|
|
65
|
-
const ASSIGNMENT = /^[A-Za-z_][A-Za-z0-9_]*=/;
|
|
66
|
-
|
|
67
|
-
/* `<<EOF`, `<<-EOF`, `<<'EOF'`, `<<"EOF"`. The delimiter's quoting only decides whether the body expands, which
|
|
68
|
-
* changes nothing here: an expanded body is still a body being written somewhere rather than run. */
|
|
69
|
-
const HEREDOC_OPEN = /<<-?\s*(['"]?)([A-Za-z_][A-Za-z0-9_]*)\1/g;
|
|
70
|
-
|
|
71
|
-
/* The heredoc bodies in a command, as spans. Found first and in their own pass, because a body is line-oriented
|
|
72
|
-
* and can hold anything at all — an odd number of quotes in it would otherwise throw the word scanner out of
|
|
73
|
-
* step for the rest of the command. */
|
|
74
|
-
const heredocBodies = (command: string): CommandSpan[] => {
|
|
75
|
-
const bodies: CommandSpan[] = [];
|
|
76
|
-
for (const open of command.matchAll(HEREDOC_OPEN)) {
|
|
77
|
-
const indented = command.slice(open.index, open.index + 3).startsWith("<<-");
|
|
78
|
-
const newline = command.indexOf("\n", open.index + open[0].length);
|
|
79
|
-
if (newline === -1) {
|
|
80
|
-
// `cat <<EOF` with nothing after it: an unterminated heredoc, so there is no body to mark.
|
|
81
|
-
continue;
|
|
82
|
-
}
|
|
83
|
-
const start = newline + 1;
|
|
84
|
-
const terminator = new RegExp(`^${indented ? "[ \\t]*" : ""}${open[2] as string}[ \\t]*$`, "m");
|
|
85
|
-
const rest = command.slice(start);
|
|
86
|
-
const end = terminator.exec(rest)?.index;
|
|
87
|
-
// An unterminated body runs to the end of the command, which is what the shell would read too.
|
|
88
|
-
bodies.push({ start, end: end === undefined ? command.length : start + end });
|
|
89
|
-
}
|
|
90
|
-
return bodies;
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
// Is this offset inside one of the spans already found? Heredoc bodies are skipped wholesale by the word scan.
|
|
94
|
-
const within = (spans: readonly CommandSpan[], offset: number): CommandSpan | undefined =>
|
|
95
|
-
spans.find((span) => offset >= span.start && offset < span.end);
|
|
96
|
-
|
|
97
|
-
// A substitution inside double quotes, the one thing that makes a quoted argument a program again.
|
|
98
|
-
const EXPANDS = /\$\(|`/;
|
|
99
|
-
|
|
100
|
-
/* One quoted segment inside a word: the span covers the quotes as well as what is between them, so a region
|
|
101
|
-
* handed back from here contains the whole `"rm -rf /"` and a match on any part of it reads as contained. */
|
|
102
|
-
interface QuotedSegment {
|
|
103
|
-
readonly span: CommandSpan;
|
|
104
|
-
/* Does a shell expand anything in here? `"$(rm -rf /)"` inside an echo is a real delete whose output is
|
|
105
|
-
* printed, so a double-quoted segment carrying a substitution is NOT text and never becomes a region. Single
|
|
106
|
-
* quotes expand nothing, so they never set this. */
|
|
107
|
-
readonly expands: boolean;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
interface ShellWord {
|
|
111
|
-
readonly start: number;
|
|
112
|
-
// The word with its quoting removed, which is what a verb name and a flag are compared against.
|
|
113
|
-
readonly text: string;
|
|
114
|
-
readonly quoted: readonly QuotedSegment[];
|
|
115
|
-
// Does this word begin a simple command? True for the first word after a separator or at the start.
|
|
116
|
-
readonly opensCommand: boolean;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// A verb by its bare name: `/bin/echo` and `./echo` are echo, and the path in front of it says nothing new.
|
|
120
|
-
const bareVerb = (text: string): string => text.slice(Math.max(text.lastIndexOf("/"), text.lastIndexOf("\\")) + 1);
|
|
121
|
-
|
|
122
|
-
// Every list and pipeline operator: past one of these the next word is a verb again.
|
|
123
|
-
const SEPARATORS = new Set(["\n", ";", "|", "&", "(", ")"]);
|
|
124
|
-
const BLANKS = new Set([" ", "\t", "\r"]);
|
|
125
|
-
|
|
126
|
-
/* One quoted run, from its opening quote to its closing one. An unbalanced quote takes the rest of the
|
|
127
|
-
* command, which is what a shell waiting for more input would do and keeps the caller advancing. */
|
|
128
|
-
const readQuoted = (command: string, open: number): QuotedSegment & { readonly text: string; readonly end: number } => {
|
|
129
|
-
const quote = command[open] as string;
|
|
130
|
-
const close = command.indexOf(quote, open + 1);
|
|
131
|
-
const end = close === -1 ? command.length : close + 1;
|
|
132
|
-
const text = command.slice(open + 1, close === -1 ? command.length : close);
|
|
133
|
-
return { span: { start: open, end }, expands: quote === '"' && EXPANDS.test(text), text, end };
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
/* One word, from `start` to whatever ends it, with the quoted runs inside it kept as spans. `end === start`
|
|
137
|
-
* cannot happen: the caller only enters here on a character that is neither blank nor a separator. */
|
|
138
|
-
const readWord = (command: string, start: number): { readonly word: Omit<ShellWord, "opensCommand">; readonly end: number } => {
|
|
139
|
-
const quoted: QuotedSegment[] = [];
|
|
140
|
-
let text = "";
|
|
141
|
-
let index = start;
|
|
142
|
-
while (index < command.length && !WORD_END.test(command[index] as string)) {
|
|
143
|
-
const char = command[index] as string;
|
|
144
|
-
if (char === "'" || char === '"') {
|
|
145
|
-
const segment = readQuoted(command, index);
|
|
146
|
-
quoted.push({ span: segment.span, expands: segment.expands });
|
|
147
|
-
text += segment.text;
|
|
148
|
-
index = segment.end;
|
|
149
|
-
continue;
|
|
150
|
-
}
|
|
151
|
-
if (char === "\\") {
|
|
152
|
-
text += command[index + 1] ?? "";
|
|
153
|
-
index += 2;
|
|
154
|
-
continue;
|
|
155
|
-
}
|
|
156
|
-
text += char;
|
|
157
|
-
index += 1;
|
|
158
|
-
}
|
|
159
|
-
return { word: { start, text, quoted }, end: index };
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
/* The command taken apart into words, with each word's quoted segments and whether it opens a simple command.
|
|
163
|
-
* Deliberately a scanner rather than a parser: it tracks quoting and the separators that start a new command,
|
|
164
|
-
* and it knows nothing about control flow, functions or expansion. Everything it gets wrong is bounded by the
|
|
165
|
-
* header's argument. */
|
|
166
|
-
const scanWords = (command: string, skip: readonly CommandSpan[]): ShellWord[] => {
|
|
167
|
-
const words: ShellWord[] = [];
|
|
168
|
-
let index = 0;
|
|
169
|
-
let opensCommand = true;
|
|
170
|
-
while (index < command.length) {
|
|
171
|
-
const skipped = within(skip, index);
|
|
172
|
-
if (skipped !== undefined) {
|
|
173
|
-
index = skipped.end;
|
|
174
|
-
continue;
|
|
175
|
-
}
|
|
176
|
-
const char = command[index] as string;
|
|
177
|
-
if (SEPARATORS.has(char)) {
|
|
178
|
-
opensCommand = true;
|
|
179
|
-
index += 1;
|
|
180
|
-
continue;
|
|
181
|
-
}
|
|
182
|
-
if (BLANKS.has(char)) {
|
|
183
|
-
index += 1;
|
|
184
|
-
continue;
|
|
185
|
-
}
|
|
186
|
-
if (char === "#") {
|
|
187
|
-
// A comment runs to the end of the line. Only reached at a word boundary, so `a#b` is one word.
|
|
188
|
-
const newline = command.indexOf("\n", index);
|
|
189
|
-
index = newline === -1 ? command.length : newline;
|
|
190
|
-
continue;
|
|
191
|
-
}
|
|
192
|
-
const { word, end } = readWord(command, index);
|
|
193
|
-
// A character that is neither a separator nor part of a word (a stray redirect): step over it so the
|
|
194
|
-
// loop always advances.
|
|
195
|
-
index = end === index ? index + 1 : end;
|
|
196
|
-
if (end !== word.start) {
|
|
197
|
-
words.push({ ...word, opensCommand });
|
|
198
|
-
opensCommand = false;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
return words;
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
/* WHERE A COMMAND HOLDS TEXT RATHER THAN A PROGRAM, as spans over the command, unsorted and possibly
|
|
205
|
-
* overlapping — callers ask containment questions of them rather than rendering them.
|
|
206
|
-
*
|
|
207
|
-
* Exported for the classifier, which asks it once per command and hands the answer to every table. */
|
|
208
|
-
export const inertRegions = (command: string): CommandSpan[] => {
|
|
209
|
-
const bodies = heredocBodies(command);
|
|
210
|
-
const regions: CommandSpan[] = [...bodies];
|
|
211
|
-
const words = scanWords(command, bodies);
|
|
212
|
-
// Comments are consumed by the scanner rather than reported, so they are found again here: the scan is
|
|
213
|
-
// where the quoting state lives, and a `#` inside a quoted string is not a comment.
|
|
214
|
-
let quotingVerb = false;
|
|
215
|
-
let previous: ShellWord | undefined;
|
|
216
|
-
for (const word of words) {
|
|
217
|
-
if (word.opensCommand) {
|
|
218
|
-
quotingVerb = QUOTING_VERBS.has(bareVerb(word.text));
|
|
219
|
-
previous = undefined;
|
|
220
|
-
}
|
|
221
|
-
/* An env assignment in front of the verb (`LC_ALL=C grep …`) is not the verb. Re-read the next word as
|
|
222
|
-
* one instead of giving up on the command. */
|
|
223
|
-
if (word.opensCommand && ASSIGNMENT.test(word.text) && word.quoted.length === 0) {
|
|
224
|
-
quotingVerb = false;
|
|
225
|
-
previous = undefined;
|
|
226
|
-
continue;
|
|
227
|
-
}
|
|
228
|
-
const afterMessageFlag = previous !== undefined && MESSAGE_FLAGS.has(previous.text);
|
|
229
|
-
if (quotingVerb || afterMessageFlag) {
|
|
230
|
-
regions.push(...word.quoted.filter((segment) => !segment.expands).map((segment) => segment.span));
|
|
231
|
-
}
|
|
232
|
-
previous = word;
|
|
233
|
-
}
|
|
234
|
-
regions.push(...commentRegions(command, bodies));
|
|
235
|
-
return regions;
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
/* Comments, on the same scan discipline as the words: a `#` only opens one where a word could have started, so
|
|
239
|
-
* `sha#1` is not a comment, and a quoted `"# …"` is not one either.
|
|
240
|
-
*
|
|
241
|
-
* Its own walk rather than a by-product of scanWords, because the two want different things from a quote — the
|
|
242
|
-
* word scan needs what is INSIDE one, this needs only to be past it. Sharing readQuoted keeps them agreeing on
|
|
243
|
-
* where one ends, which is the only fact they both depend on. */
|
|
244
|
-
const commentRegions = (command: string, skip: readonly CommandSpan[]): CommandSpan[] => {
|
|
245
|
-
const comments: CommandSpan[] = [];
|
|
246
|
-
let index = 0;
|
|
247
|
-
while (index < command.length) {
|
|
248
|
-
const skipped = within(skip, index);
|
|
249
|
-
if (skipped !== undefined) {
|
|
250
|
-
index = skipped.end;
|
|
251
|
-
continue;
|
|
252
|
-
}
|
|
253
|
-
const char = command[index] as string;
|
|
254
|
-
if (char === "'" || char === '"') {
|
|
255
|
-
index = readQuoted(command, index).end;
|
|
256
|
-
continue;
|
|
257
|
-
}
|
|
258
|
-
if (char === "\\") {
|
|
259
|
-
index += 2;
|
|
260
|
-
continue;
|
|
261
|
-
}
|
|
262
|
-
// A word boundary in front is what makes it a comment rather than part of a word.
|
|
263
|
-
if (char === "#" && (index === 0 || WORD_END.test(command[index - 1] as string))) {
|
|
264
|
-
const newline = command.indexOf("\n", index);
|
|
265
|
-
const end = newline === -1 ? command.length : newline;
|
|
266
|
-
comments.push({ start: index, end });
|
|
267
|
-
index = end;
|
|
268
|
-
continue;
|
|
269
|
-
}
|
|
270
|
-
index += 1;
|
|
271
|
-
}
|
|
272
|
-
return comments;
|
|
273
|
-
};
|
|
274
|
-
|
|
275
|
-
/* Is this fragment somewhere a shell would RUN it? The question the hard rule asks of every span triage matched.
|
|
276
|
-
*
|
|
277
|
-
* JUDGED ON WHERE THE FRAGMENT STARTS, not on whether a region contains the whole of it, and the difference is
|
|
278
|
-
* not a relaxation — it is the only reading that answers the question asked. Every pattern in the catalog is
|
|
279
|
-
* written to BEGIN at the verb (`rm`, `docker volume rm`, `mkfs`, `git push`), so the span's first character is
|
|
280
|
-
* where the dangerous thing was found. Whether the match then ran on past a closing quote says something about
|
|
281
|
-
* the regex, not about the command: `rm`'s own parser reads to the end of the invocation and `>` is not a
|
|
282
|
-
* terminator, so `echo "rm -rf /" >> notes.md` produces a span covering `rm -rf /" >> notes.md`. Requiring
|
|
283
|
-
* containment made that command live — which is exactly the card this whole change exists to stop raising.
|
|
284
|
-
*
|
|
285
|
-
* The conservative direction is preserved where it matters: a fragment whose verb sits OUTSIDE every region is
|
|
286
|
-
* live no matter what it runs into afterwards, so `echo "tidying" && rm -rf /` and `rm -rf "$(cat list)" # ok`
|
|
287
|
-
* both stay live. */
|
|
288
|
-
export const isLive = (span: CommandSpan, regions: readonly CommandSpan[]): boolean =>
|
|
289
|
-
!regions.some((region) => span.start >= region.start && span.start < region.end);
|
package/src/starter.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/* THE STARTER SITE'S NAMES, declared where both sides of the wire read them.
|
|
2
|
-
*
|
|
3
|
-
* A fresh sandbox opens with one real, running thing in it: a one-page site, copied out of the image and
|
|
4
|
-
* started by the daemon's first boot (sandbox src/scaffold/starter-site.ts). The browser's job is the other
|
|
5
|
-
* half of that promise, to have it on screen when the user arrives (web shell/ShellDesktop.vue), and to do
|
|
6
|
-
* that it has to name the same repo and the same app the daemon seeded.
|
|
7
|
-
*
|
|
8
|
-
* Two constants rather than one because they are two different kinds of name: `site` is the repo directory a
|
|
9
|
-
* person would have picked, and `landing` is the template's own app name, which the apps extension, the
|
|
10
|
-
* preview hostname (preview-site--landing-<id>.<zone>) and the folder under `_apps/` all inherit. Renaming
|
|
11
|
-
* either is a product decision, not a rename: the seeded workspaces already out there keep the old names. */
|
|
12
|
-
export const STARTER_REPO = "site";
|
|
13
|
-
export const STARTER_APP = "landing";
|
package/src/state-portability.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/* WHETHER A PIECE OF DAEMON STATE TRAVELS, the second thing every state manifest declares.
|
|
2
|
-
*
|
|
3
|
-
* A sandbox's environment is not one directory. `/work` holds the workspace and the daemon's manifests,
|
|
4
|
-
* `/history` holds the real git dirs, the fleet registry and the ledgers, and the container carries the built
|
|
5
|
-
* image and its env. "Export the environment" therefore means walking state that lives in two volumes and
|
|
6
|
-
* deciding, per entry, which of four things it is, and that decision has to be written down beside the entry
|
|
7
|
-
* itself, or the exporter becomes the hand-kept list that workspace-state.ts exists to argue against.
|
|
8
|
-
*
|
|
9
|
-
* So each manifest entry carries a class, and both the bundler and the restorer derive from it. Adding a store
|
|
10
|
-
* without saying whether it travels is a failing coverage test, not a file that silently goes missing from
|
|
11
|
-
* every bundle.
|
|
12
|
-
*
|
|
13
|
-
* The classes are exhaustive on purpose, there is no "unset", because the failure mode of a default is
|
|
14
|
-
* exactly the one that matters: a credential store added later would inherit `carry` and ride out of the
|
|
15
|
-
* sandbox in a file the owner thought was safe to email.
|
|
16
|
-
*/
|
|
17
|
-
export type Portability =
|
|
18
|
-
/* Ordinary state. Travels in every bundle. */
|
|
19
|
-
| "carry"
|
|
20
|
-
/* Holds a credential, a provider token, a webhook secret, an ssh key. Travels ONLY when the owner opts
|
|
21
|
-
* in at export, and the bundle records that it did. Never the default. */
|
|
22
|
-
| "secret"
|
|
23
|
-
/* Binds this sandbox to its owner, its browsers or its host: who may drive it, the session-signing secret,
|
|
24
|
-
* push subscriptions, enrollments, certificates. Never travels, the target mints its own, and carrying
|
|
25
|
-
* one would either hand the target's ownership to the source or leave two sandboxes claiming one identity. */
|
|
26
|
-
| "identity"
|
|
27
|
-
/* Regenerated by the target from state that does travel: composed files, caches, indexes, checkouts. Left
|
|
28
|
-
* out for size, not for safety, carrying it would only ship a stale copy of something the daemon rebuilds
|
|
29
|
-
* on its own. */
|
|
30
|
-
| "derived";
|
|
31
|
-
|
|
32
|
-
// One entry of a state manifest: the path it owns and what happens to it at export. `note` is user-facing,
|
|
33
|
-
// the import report prints it beside a skipped entry, so it is written as an instruction to the owner ("log in
|
|
34
|
-
// again"), not as a rationale for the next reader. Rationale belongs in a comment on the entry.
|
|
35
|
-
export interface StateFile {
|
|
36
|
-
readonly path: string;
|
|
37
|
-
readonly portability: Portability;
|
|
38
|
-
readonly note?: string;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/* The entry that owns a path, LONGEST PREFIX FIRST.
|
|
42
|
-
*
|
|
43
|
-
* Manifests may deliberately nest when one subtree has a different lifecycle. First-match resolution would
|
|
44
|
-
* classify the child by whichever entry happened to be listed first, so the specific entry has to win over the
|
|
45
|
-
* general one by construction rather than by list order, the same reason a .gitignore consults its deepest
|
|
46
|
-
* matcher first.
|
|
47
|
-
*
|
|
48
|
-
* Undefined for a path no entry claims. Callers decide what that means: workspace content (including an
|
|
49
|
-
* extension's undeclared output) defaults to `carry`, while unclaimed history machinery defaults to `derived`.
|
|
50
|
-
* The daemon's state-path coverage guard is what prevents one of its own credential stores from relying on the
|
|
51
|
-
* workspace default.
|
|
52
|
-
*/
|
|
53
|
-
export const stateFileFor = <T extends StateFile>(path: string, files: readonly T[]): T | undefined =>
|
|
54
|
-
files
|
|
55
|
-
.filter((file) => path === file.path || path.startsWith(file.path) || `${path}/` === file.path)
|
|
56
|
-
.reduce<T | undefined>((best, file) => (best === undefined || file.path.length > best.path.length ? file : best), undefined);
|
package/src/terminal-protocol.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// The /system/terminal WebSocket wire protocol. JSON text frames both ways (xterm speaks strings), shared by
|
|
2
|
-
// the daemon's terminal route and the browser's terminal session so the two can't drift. Plain types, not zod
|
|
3
|
-
// schemas: `data` is the per-pty-chunk hot path between two mutually authenticated endpoints, and no oRPC
|
|
4
|
-
// eventIterator validates these frames (which is why events.ts uses schemas).
|
|
5
|
-
|
|
6
|
-
// `ping` is the client's 30s keepalive against tunnel idle-reaping; the server answers with `pong`, so a
|
|
7
|
-
// healthy idle connection always sees a frame within the ping interval, silence beyond it means half-open.
|
|
8
|
-
export type TerminalClientMessage =
|
|
9
|
-
| { readonly type: "input"; readonly data: string }
|
|
10
|
-
| { readonly type: "resize"; readonly cols: number; readonly rows: number }
|
|
11
|
-
| { readonly type: "ping" };
|
|
12
|
-
|
|
13
|
-
// `data` is raw pty output; `exit` fires when the tmux client ends (shell exited, or an attach-only session
|
|
14
|
-
// doesn't exist) and is terminal, the client never reconnects after it.
|
|
15
|
-
export type TerminalServerMessage =
|
|
16
|
-
{ readonly type: "data"; readonly data: string } | { readonly type: "exit"; readonly code: number } | { readonly type: "pong" };
|
package/src/title.ts
DELETED
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
/* HOW A CONVERSATION NAMES ITSELF from its opening prompt, the title a chat tab, a fleet card and the agent
|
|
2
|
-
* detail header wear from the first keystroke of a turn until something better arrives.
|
|
3
|
-
*
|
|
4
|
-
* The naive rule (collapse whitespace, cut at N) reads the prompt as if it were a headline, and opening
|
|
5
|
-
* prompts are not headlines. They are pasted stack traces, links dropped in with two words of context,
|
|
6
|
-
* politeness that eats half the budget before the ask begins, and multi-line asks whose first line is throat-
|
|
7
|
-
* clearing. Cutting those at 40 characters yields `Error: ENOENT: no such file or directo…`, a title that
|
|
8
|
-
* names the paste rather than the work, and that reads identically for every one of the day's five pastes.
|
|
9
|
-
*
|
|
10
|
-
* So the prompt is read as prose FIRST and cut second: quoted material and fenced code are not the ask, the
|
|
11
|
-
* opener is not the ask, and a reference is worth only its last segment. What survives is the earliest line
|
|
12
|
-
* that still says something, cut on a sentence or a word rather than mid-syllable.
|
|
13
|
-
*
|
|
14
|
-
* Both sides derive: the browser names a conversation the instant it sends (conversation.ts), and the daemon
|
|
15
|
-
* names a turn that arrived without one, an automation, a Discord message, a webchat visitor (agents-
|
|
16
|
-
* registry.ts). One rule, because two would let the same prompt open under two different names depending on
|
|
17
|
-
* where it entered. Nothing here calls a model: the title has to exist before the first frame comes back.
|
|
18
|
-
*
|
|
19
|
-
* Which is exactly the ceiling on it. Cutting is not naming, what comes out is the user's own sentence,
|
|
20
|
-
* shortened, and a column of those is scannable only where the users' sentences happened to differ early. The
|
|
21
|
-
* name a conversation ends up WEARING is written a second or two later by a model that reads the same prompt
|
|
22
|
-
* and answers in the fleet board's own shape (the daemon's title-namer.ts). This is the title that holds the
|
|
23
|
-
* tab until that arrives, and the one it keeps if nothing is connected to write a better one. */
|
|
24
|
-
|
|
25
|
-
// The registry's title budget (agents-registry MAX_TITLE_LENGTH, the rename input's maxlength), the widest
|
|
26
|
-
// any surface stores. Every surface truncates in CSS to its own width, so the clamp here is a storage cap,
|
|
27
|
-
// not a display rule: cutting shorter than the widest surface (a full-width fleet card) would throw away
|
|
28
|
-
// signal that surface has room to show, and no narrow surface is hurt because its CSS cuts first anyway.
|
|
29
|
-
const MAX_LENGTH = 80;
|
|
30
|
-
// Below this a sentence-shaped cut is more likely an abbreviation (`e.g.`, `i.e.`) than a sentence, so the
|
|
31
|
-
// length clamp takes over.
|
|
32
|
-
const MIN_SENTENCE = 12;
|
|
33
|
-
// A word-boundary cut this far back strands a fragment; better to cut mid-word than to title a conversation
|
|
34
|
-
// with two characters and an ellipsis.
|
|
35
|
-
const MIN_WORD_CUT = MAX_LENGTH * 0.6;
|
|
36
|
-
|
|
37
|
-
// Markdown's two fence syntaxes, and the quote marker. Both open and close on the same shape, so a fence line
|
|
38
|
-
// toggles rather than matching a pair, an UNTERMINATED fence (a paste the user never closed) then swallows
|
|
39
|
-
// the rest of the prompt, which is what it visually does too.
|
|
40
|
-
const FENCE = /^\s*(?:```|~~~)/;
|
|
41
|
-
const QUOTE = /^\s*>/;
|
|
42
|
-
|
|
43
|
-
// The ways an ask opens without starting. Stripped repeatedly, so `Hey, can you please …` unwinds one layer
|
|
44
|
-
// per pass; a line that unwinds to nothing was pure throat-clearing and the next line carries the ask.
|
|
45
|
-
const OPENERS: readonly RegExp[] = [
|
|
46
|
-
/^(?:hey|hi|hello|yo|ok|okay|so|well|also|btw|now|next|then)\b[\s,.:;!—–-]*/i,
|
|
47
|
-
/^(?:please|pls)\b[\s,.:;!—–-]*/i,
|
|
48
|
-
/^(?:can|could|would|will)\s+(?:you|u|we)\b\s*(?:please|pls)?[\s,.:;!—–-]*/i,
|
|
49
|
-
/^i(?:'d|\s+would)?\s+(?:want|need|like)\s+(?:you\s+)?to\b[\s,.:;!—–-]*/i,
|
|
50
|
-
/^(?:let'?s|lets)\b[\s,.:;!—–-]*/i,
|
|
51
|
-
/^we\s+(?:need|have|ought)\s+to\b[\s,.:;!—–-]*/i,
|
|
52
|
-
/^(?:quick\s+(?:one|question|q)|one\s+more\s+thing)\b[\s,.:;!—–-]*/i,
|
|
53
|
-
];
|
|
54
|
-
|
|
55
|
-
// A sentence ends on terminal punctuation that is actually followed by a break, which is what holds `v1.2`
|
|
56
|
-
// and `foo.ts` together while still ending `Why is it red?`.
|
|
57
|
-
const SENTENCE_END = /[.!?](?=\s|$)/;
|
|
58
|
-
|
|
59
|
-
/* A report of work already done, `We have recently added…`, `I've just landed…`, `we were refactoring…`. The
|
|
60
|
-
* one first-sentence shape that is reliably CONTEXT rather than the ask: prompts that open on it set the scene
|
|
61
|
-
* for an instruction further down, and titling from the scene names every such conversation after last week's
|
|
62
|
-
* work instead of this one's.
|
|
63
|
-
*
|
|
64
|
-
* Detected as we/I, an optional aux chain, then a verb in past or progressive form: the regular `…ed`/`…ing`
|
|
65
|
-
* endings plus the irregular pasts that actually appear in prompts about software. The lookahead excludes the
|
|
66
|
-
* handful of present-tense verbs the `…ed` ending would swallow (`we need…`, `we embed…`); `…ing` wants three
|
|
67
|
-
* letters in front so `we ping`/`we bring` stay present tense. */
|
|
68
|
-
const NARRATION =
|
|
69
|
-
/^(?:(?:recently|previously|earlier|today|yesterday|lately)[\s,]+)?(?:we|i)(?:'ve|'d|'m|'re)?(?:\s+(?:have|had|am|are|was|were|been|just|recently|already|earlier|previously|also|finally|now|currently|still))*\s+(?!(?:need|feed|speed|shed|heed|breed|bleed|embed|proceed|exceed|succeed)\b)(?:\w+ed|\w{3,}ing|built|wrote|rewrote|made|found|saw|thought|began|got|kept|put|set|sent|split|ran|did|redid|went|came|gave|held|hit|cut|let|read|understood|broke|chose|became|brought|spent|meant|lost|forgot|rebuilt|told|taught|stood|drew|grew|knew|threw|took|left|felt|hid)\b/i;
|
|
70
|
-
|
|
71
|
-
// The ask read as an instruction: a sentence leading with a bare verb of the kind coding asks lead with. A
|
|
72
|
-
// curated list rather than grammar. English hands out noun/verb ambiguity too freely for anything cleverer.
|
|
73
|
-
const IMPERATIVE =
|
|
74
|
-
/^(?:add|fix|make|implement|create|build|write|rewrite|refactor|rename|remove|delete|drop|update|change|convert|migrate|move|extract|split|merge|rebase|revert|restore|wire|connect|integrate|support|handle|improve|clean|simplify|redesign|rework|rethink|investigate|analyze|analyse|debug|find|figure|check|verify|test|run|try|document|describe|explain|propose|design|draft|prepare|stop|prevent|ensure|allow|enable|disable|introduce|replace|swap|optimize|optimise|reduce|bump|upgrade|deploy|ship|release|adjust|tweak|polish|finish|complete|continue|extend|unify|dedupe|deduplicate|cache|persist|expose|hide|show|render|port|automate|wrap|inline|audit|review|profile|measure|instrument|validate|parse|generate|turn|look|think|come|consider|help|start|use|keep|avoid|teach|harden|tighten|localize|localise|translate)\b/i;
|
|
75
|
-
|
|
76
|
-
// An unmistakable ask: an instruction, or a question asked outright. Anything less deliberate is not worth
|
|
77
|
-
// skipping a sentence for.
|
|
78
|
-
const isAsk = (sentence: string): boolean => sentence.endsWith("?") || IMPERATIVE.test(sentence);
|
|
79
|
-
|
|
80
|
-
const collapse = (text: string): string =>
|
|
81
|
-
text
|
|
82
|
-
.replaceAll(/[\p{Cc}\p{Cf}]+/gu, " ")
|
|
83
|
-
.replaceAll(/\s+/g, " ")
|
|
84
|
-
.trim();
|
|
85
|
-
|
|
86
|
-
// The prompt minus everything the user pasted rather than wrote. Fenced blocks and quoted blocks are evidence
|
|
87
|
-
// attached to the ask, never the ask itself.
|
|
88
|
-
const proseLines = (prompt: string): string[] => {
|
|
89
|
-
const lines: string[] = [];
|
|
90
|
-
let fenced = false;
|
|
91
|
-
for (const line of prompt.split(/\r?\n/)) {
|
|
92
|
-
if (FENCE.test(line)) {
|
|
93
|
-
fenced = !fenced;
|
|
94
|
-
continue;
|
|
95
|
-
}
|
|
96
|
-
if (!fenced && !QUOTE.test(line)) {
|
|
97
|
-
lines.push(line);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return lines;
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
/* Peel the openers off a line, but only keep the peeling when something with shape is left underneath.
|
|
104
|
-
*
|
|
105
|
-
* Three outcomes, and the difference between them is the whole point. A remnant of SEVERAL words is the ask,
|
|
106
|
-
* `Can you please fix the auth tests?` was carrying `fix the auth tests?`. A remnant of NOTHING was pure
|
|
107
|
-
* greeting (`Hey, quick one -`), and returning empty is how the caller learns to read the next line instead.
|
|
108
|
-
* A remnant of ONE word means the opener was meaningful. `Hi there` is not a conversation about `there`,
|
|
109
|
-
* and `So what?` is not one about `what?`, so the line stands as written. */
|
|
110
|
-
const withoutOpener = (line: string): string => {
|
|
111
|
-
let text = line;
|
|
112
|
-
for (let pass = 0; pass < OPENERS.length; pass++) {
|
|
113
|
-
const stripped = OPENERS.reduce((current, opener) => current.replace(opener, ""), text);
|
|
114
|
-
if (stripped === text) {
|
|
115
|
-
break;
|
|
116
|
-
}
|
|
117
|
-
text = stripped;
|
|
118
|
-
}
|
|
119
|
-
const remnant = text.trim();
|
|
120
|
-
if (text === line || remnant === "") {
|
|
121
|
-
return text;
|
|
122
|
-
}
|
|
123
|
-
return remnant.includes(" ") ? text : line;
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
// A URL is worth its last meaningful segment: the host when there is no path, and the segment before a purely
|
|
127
|
-
// numeric one so an issue link reads `merge_requests/42` rather than `42`.
|
|
128
|
-
const shortUrl = (token: string): string => {
|
|
129
|
-
let url: URL;
|
|
130
|
-
try {
|
|
131
|
-
url = new URL(token);
|
|
132
|
-
} catch {
|
|
133
|
-
return token;
|
|
134
|
-
}
|
|
135
|
-
const segments = url.pathname.split("/").filter((segment) => segment !== "");
|
|
136
|
-
const last = segments.at(-1);
|
|
137
|
-
if (last === undefined) {
|
|
138
|
-
return url.hostname.replace(/^www\./, "");
|
|
139
|
-
}
|
|
140
|
-
const previous = segments.at(-2);
|
|
141
|
-
return /^\d+$/.test(last) && previous !== undefined ? `${previous}/${last}` : last;
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
// A path is worth its basename once it is deep enough that the lead is scaffolding, `src/foo.ts` already
|
|
145
|
-
// reads as a place, `_editor/web/src/composables/chat/conversation.ts` reads as a wall.
|
|
146
|
-
const shortPath = (token: string): string => {
|
|
147
|
-
const segments = token.replace(/^@/, "").split("/");
|
|
148
|
-
return segments.length > 2 ? (segments.findLast((segment) => segment !== "") ?? token) : token;
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
// Trailing punctuation belongs to the sentence, not to the reference inside it, so it is set aside across the
|
|
152
|
-
// shortening and put back, `see _editor/web/src/foo.ts,` collapses to `see foo.ts,`.
|
|
153
|
-
const shortReference = (token: string): string => {
|
|
154
|
-
const match = /^(.*?)([\s,.;:!?)\]]*)$/s.exec(token);
|
|
155
|
-
const core = match?.[1] ?? token;
|
|
156
|
-
const tail = match?.[2] ?? "";
|
|
157
|
-
if (/^https?:\/\//i.test(core)) {
|
|
158
|
-
return `${shortUrl(core)}${tail}`;
|
|
159
|
-
}
|
|
160
|
-
if (core.includes("/")) {
|
|
161
|
-
return `${shortPath(core)}${tail}`;
|
|
162
|
-
}
|
|
163
|
-
return token;
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
const collapseReferences = (text: string): string => text.split(" ").map(shortReference).join(" ");
|
|
167
|
-
|
|
168
|
-
const firstSentence = (text: string): string => {
|
|
169
|
-
const end = text.search(SENTENCE_END);
|
|
170
|
-
if (end < MIN_SENTENCE) {
|
|
171
|
-
return text;
|
|
172
|
-
}
|
|
173
|
-
// A question mark or a bang carries tone worth keeping; a full stop on a title is just noise.
|
|
174
|
-
const terminator = text[end];
|
|
175
|
-
return terminator === "." ? text.slice(0, end) : text.slice(0, end + 1);
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
// Every sentence in turn, terminators handled as in firstSentence, the walk the ask-scan below reads. No
|
|
179
|
-
// abbreviation guard here: a fragment split off at an `e.g.` never leads with an imperative, so it simply
|
|
180
|
-
// loses the scan rather than corrupting it.
|
|
181
|
-
const sentencesOf = (text: string): string[] => {
|
|
182
|
-
const parts: string[] = [];
|
|
183
|
-
let rest = text;
|
|
184
|
-
while (rest !== "") {
|
|
185
|
-
const end = rest.search(SENTENCE_END);
|
|
186
|
-
if (end === -1) {
|
|
187
|
-
parts.push(rest);
|
|
188
|
-
break;
|
|
189
|
-
}
|
|
190
|
-
parts.push(rest[end] === "." ? rest.slice(0, end) : rest.slice(0, end + 1));
|
|
191
|
-
rest = rest.slice(end + 1).trimStart();
|
|
192
|
-
}
|
|
193
|
-
return parts;
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
/* THE ELLIPSIS IS PART OF THE BUDGET, not an addition to it. MAX_LENGTH is a STORAGE cap the wire contract
|
|
197
|
-
* enforces (AgentTurnSchema.title), so a title one character over it is not a wide tab, it is a 400 on the
|
|
198
|
-
* turn that carried it. Cutting to MAX_LENGTH and appending afterwards was exactly that off-by-one, and it
|
|
199
|
-
* hid for as long as it did because the word-boundary backoff almost always absorbed it: an ordinary sentence
|
|
200
|
-
* has a space late in the window, so `kept` came back short and the ellipsis fit. What has no such space is a
|
|
201
|
-
* long unbroken token straddling the cut, a SCREAMING_SNAKE env var, a hash, a base64 blob, and there the
|
|
202
|
-
* fallback kept the full-width slice and made it one character too long. The conversation then wedged: the
|
|
203
|
-
* browser writes the derived title into its state before it sends, so every later turn re-sent the same
|
|
204
|
-
* rejected name. */
|
|
205
|
-
const clamped = (text: string): string => {
|
|
206
|
-
if (text.length <= MAX_LENGTH) {
|
|
207
|
-
return text;
|
|
208
|
-
}
|
|
209
|
-
const cut = text.slice(0, MAX_LENGTH - 1);
|
|
210
|
-
const boundary = cut.lastIndexOf(" ");
|
|
211
|
-
const kept = boundary >= MIN_WORD_CUT ? cut.slice(0, boundary) : cut;
|
|
212
|
-
return `${kept.replace(/[\s,;:—–-]+$/, "")}…`;
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
// Sentence case, but only when the opening word is plainly lowercase prose. An identifier (`useAgents`), a
|
|
216
|
-
// path (`src/foo`) or an abbreviation (`e.g`) means something by its casing and is left alone.
|
|
217
|
-
const capitalized = (text: string): string => {
|
|
218
|
-
const [first = ""] = text.split(" ", 1);
|
|
219
|
-
if (!/^[a-z]/.test(first) || /[A-Z/.\\]/.test(first)) {
|
|
220
|
-
return text;
|
|
221
|
-
}
|
|
222
|
-
return `${text[0]?.toUpperCase() ?? ""}${text.slice(1)}`;
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
/* Split a plan's markdown into its leading heading and the remaining body.
|
|
226
|
-
*
|
|
227
|
-
* The heading is the one place in a turn where an agent writes a name for the WHOLE job rather than for a step
|
|
228
|
-
*, a task checklist describes `Read the failing test`, `Fix the assertion`, `Run the suite`, none of which is
|
|
229
|
-
* what the conversation is about, whereas a plan opens `## Fix the flaky auth tests`. That makes it the only
|
|
230
|
-
* authored line in the stream worth promoting to a title, which is why this lives here rather than next to the
|
|
231
|
-
* plan card that also renders it: the browser titles its own tabs from it and the daemon titles fleet cards. */
|
|
232
|
-
export const planParts = (text: string): { title?: string; body: string } => {
|
|
233
|
-
const match = /^\s*#{1,6}\s+(.+)/.exec(text);
|
|
234
|
-
if (match === null) {
|
|
235
|
-
return { body: text };
|
|
236
|
-
}
|
|
237
|
-
return { title: match[1]!.trim(), body: text.slice(match.index + match[0].length).trimStart() };
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
/* Name a conversation after the prompt that opened it. Never empty for a non-empty prompt: a paste with no
|
|
241
|
-
* prose around it still titles as its own first line, which at least names what was pasted. */
|
|
242
|
-
export const deriveTitle = (prompt: string): string => {
|
|
243
|
-
const prose = proseLines(prompt)
|
|
244
|
-
.map(collapse)
|
|
245
|
-
.filter((line) => line !== "");
|
|
246
|
-
// Lines that survive opener-stripping with letters in them. The first is the title's default; the rest
|
|
247
|
-
// only matter when that default turns out to be scene-setting.
|
|
248
|
-
const lines = prose.map(withoutOpener).filter((line) => /\p{L}/u.test(line));
|
|
249
|
-
const primary = lines[0];
|
|
250
|
-
if (primary !== undefined) {
|
|
251
|
-
/* A first sentence that reports work already done is the scene, not the ask, `We have recently added
|
|
252
|
-
* iq map. Now let's expose health.` is a conversation about exposing health. Skipped only for an
|
|
253
|
-
* unmistakable ask further in (an instruction or an outright question); anything hazier and the
|
|
254
|
-
* narration stands, exactly as every non-narrative opening always does. */
|
|
255
|
-
const head = firstSentence(primary);
|
|
256
|
-
const ask = NARRATION.test(head)
|
|
257
|
-
? lines
|
|
258
|
-
.flatMap(sentencesOf)
|
|
259
|
-
.map(withoutOpener)
|
|
260
|
-
.find((sentence) => sentence !== head && isAsk(sentence))
|
|
261
|
-
: undefined;
|
|
262
|
-
return capitalized(clamped(firstSentence(collapseReferences(ask ?? primary))));
|
|
263
|
-
}
|
|
264
|
-
// Everything the user sent was code, a quote, or a greeting, title it as what it is rather than blank.
|
|
265
|
-
const fallback = prose[0] ?? collapse(prompt.replaceAll(/^\s*(?:```|~~~).*$/gm, ""));
|
|
266
|
-
return clamped(collapseReferences(fallback === "" ? collapse(prompt) : fallback));
|
|
267
|
-
};
|