@overdeck/contracts 0.73.1 → 0.75.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/dist/index.cjs CHANGED
@@ -82,6 +82,19 @@ function indexPanesByAgentKey(panes) {
82
82
  }
83
83
  return byKey;
84
84
  }
85
+ /**
86
+ * Session presence a pane's own state implies (PAN-5011). Herdr `done` is a
87
+ * finished turn with the harness pane still alive, never an exit, so it maps
88
+ * to `idle`, not `ended`; only `exited` (no pane left) ends a session.
89
+ */
90
+ function presenceForPaneState(state) {
91
+ switch (state) {
92
+ case "working":
93
+ case "blocked": return "active";
94
+ case "exited": return "ended";
95
+ default: return "idle";
96
+ }
97
+ }
85
98
  //#endregion
86
99
  //#region src/derived-issue-state.ts
87
100
  /**
@@ -580,7 +593,8 @@ const AgentSnapshot = effect.Schema.Struct({
580
593
  })),
581
594
  resolution: effect.Schema.optional(AgentResolution),
582
595
  resolutionCount: effect.Schema.optional(effect.Schema.Number),
583
- turnEndAssessment: effect.Schema.optional(TurnEndAssessment)
596
+ turnEndAssessment: effect.Schema.optional(TurnEndAssessment),
597
+ deftExternalEscalations: effect.Schema.optional(effect.Schema.Number)
584
598
  });
585
599
  /** PAN-3151: A recorded cycle in the review convergence tracking series */
586
600
  const TurnDiffFileChange = effect.Schema.Struct({
@@ -720,12 +734,24 @@ const RestartGateOutcome = effect.Schema.Struct({
720
734
  at: effect.Schema.String
721
735
  });
722
736
  /**
737
+ * The operator restart hold (PAN-5007), set by `pan restart hold` and lifted by
738
+ * `pan restart release` or its `until` time. While it is active every reload,
739
+ * restart and restart-gate approval refuses.
740
+ */
741
+ const RestartHold = effect.Schema.Struct({
742
+ reason: effect.Schema.String,
743
+ who: effect.Schema.String,
744
+ setAt: effect.Schema.String,
745
+ until: effect.Schema.optional(effect.Schema.String)
746
+ });
747
+ /**
723
748
  * The operator-facing view of the restart gate — identical to the body of
724
749
  * `GET /api/restart-gate`, so the banner and the CLI read the same shape.
725
750
  *
726
751
  * `idle` no live requests; `pending` requests are waiting for approval;
727
752
  * `approved` the operator approved an epoch that nobody has claimed yet;
728
753
  * `claimed` one requester holds the exclusive right to perform the restart.
754
+ * `restartHold` is present while an operator restart hold is active.
729
755
  */
730
756
  const RestartGateSnapshot = effect.Schema.Struct({
731
757
  status: effect.Schema.Literals([
@@ -735,7 +761,8 @@ const RestartGateSnapshot = effect.Schema.Struct({
735
761
  "claimed"
736
762
  ]),
737
763
  pending: effect.Schema.Array(RestartGateRequest),
738
- lastOutcome: effect.Schema.optional(RestartGateOutcome)
764
+ lastOutcome: effect.Schema.optional(RestartGateOutcome),
765
+ restartHold: effect.Schema.optional(RestartHold)
739
766
  });
740
767
  const DashboardSnapshot = effect.Schema.Struct({
741
768
  sequence: SequenceNumber,
@@ -1841,7 +1868,8 @@ const AgentEnrichmentChangedEvent = effect.Schema.Struct({
1841
1868
  })),
1842
1869
  resolution: effect.Schema.optional(AgentResolution),
1843
1870
  resolutionCount: effect.Schema.optional(effect.Schema.Number),
1844
- turnEndAssessment: effect.Schema.optional(TurnEndAssessment)
1871
+ turnEndAssessment: effect.Schema.optional(TurnEndAssessment),
1872
+ deftExternalEscalations: effect.Schema.optional(effect.Schema.Number)
1845
1873
  })
1846
1874
  });
1847
1875
  /** New — agent created in database */
@@ -4255,7 +4283,8 @@ function applyEvent(state, event) {
4255
4283
  pendingProposedPlan: event.payload.pendingProposedPlan,
4256
4284
  resolution: event.payload.resolution,
4257
4285
  resolutionCount: event.payload.resolutionCount,
4258
- turnEndAssessment: event.payload.turnEndAssessment
4286
+ turnEndAssessment: event.payload.turnEndAssessment,
4287
+ deftExternalEscalations: event.payload.deftExternalEscalations
4259
4288
  }
4260
4289
  }
4261
4290
  };
@@ -4394,6 +4423,7 @@ function applyEvent(state, event) {
4394
4423
  delete base["pendingAskUserQuestion"];
4395
4424
  delete base["pendingProposedPlan"];
4396
4425
  delete base["turnEndAssessment"];
4426
+ delete base["deftExternalEscalations"];
4397
4427
  }
4398
4428
  return base;
4399
4429
  })();
@@ -4591,7 +4621,8 @@ function applyEvent(state, event) {
4591
4621
  restartGate: {
4592
4622
  status: event.payload.status,
4593
4623
  pending: event.payload.pending,
4594
- ...event.payload.lastOutcome === void 0 ? {} : { lastOutcome: event.payload.lastOutcome }
4624
+ ...event.payload.lastOutcome === void 0 ? {} : { lastOutcome: event.payload.lastOutcome },
4625
+ ...event.payload.restartHold === void 0 ? {} : { restartHold: event.payload.restartHold }
4595
4626
  }
4596
4627
  };
4597
4628
  case "github_quota.changed": return {
@@ -6207,7 +6238,8 @@ const HARNESS_CAPABILITY_KEYS = [
6207
6238
  "correlatesBySessionId",
6208
6239
  "answersQuestionByMessage",
6209
6240
  "askAnswerDelivery",
6210
- "runsOnFlyMachine"
6241
+ "runsOnFlyMachine",
6242
+ "overdeckMcp"
6211
6243
  ];
6212
6244
  const CLAUDE_CODE_CAPABILITIES = {
6213
6245
  contextChannel: "append-system-prompt-file",
@@ -6230,7 +6262,8 @@ const CLAUDE_CODE_CAPABILITIES = {
6230
6262
  correlatesBySessionId: false,
6231
6263
  answersQuestionByMessage: true,
6232
6264
  askAnswerDelivery: "message",
6233
- runsOnFlyMachine: true
6265
+ runsOnFlyMachine: true,
6266
+ overdeckMcp: true
6234
6267
  };
6235
6268
  const OHMYPI_CAPABILITIES = {
6236
6269
  contextChannel: "append-system-prompt",
@@ -6253,7 +6286,8 @@ const OHMYPI_CAPABILITIES = {
6253
6286
  correlatesBySessionId: true,
6254
6287
  answersQuestionByMessage: false,
6255
6288
  askAnswerDelivery: "pi-ask-modal",
6256
- runsOnFlyMachine: false
6289
+ runsOnFlyMachine: false,
6290
+ overdeckMcp: false
6257
6291
  };
6258
6292
  const CODEX_CAPABILITIES = {
6259
6293
  contextChannel: "developer_instructions",
@@ -6275,8 +6309,9 @@ const CODEX_CAPABILITIES = {
6275
6309
  workspaceResolution: "agent-dir",
6276
6310
  correlatesBySessionId: true,
6277
6311
  answersQuestionByMessage: false,
6278
- askAnswerDelivery: "message",
6279
- runsOnFlyMachine: true
6312
+ askAnswerDelivery: "codex-approval",
6313
+ runsOnFlyMachine: true,
6314
+ overdeckMcp: true
6280
6315
  };
6281
6316
  const ACP_CAPABILITIES = {
6282
6317
  contextChannel: "acp-initial-context",
@@ -6299,7 +6334,8 @@ const ACP_CAPABILITIES = {
6299
6334
  correlatesBySessionId: true,
6300
6335
  answersQuestionByMessage: false,
6301
6336
  askAnswerDelivery: "message",
6302
- runsOnFlyMachine: false
6337
+ runsOnFlyMachine: false,
6338
+ overdeckMcp: true
6303
6339
  };
6304
6340
  const KIMI_CODE_CAPABILITIES = {
6305
6341
  contextChannel: "initial-message-envelope",
@@ -6322,7 +6358,8 @@ const KIMI_CODE_CAPABILITIES = {
6322
6358
  correlatesBySessionId: true,
6323
6359
  answersQuestionByMessage: false,
6324
6360
  askAnswerDelivery: "message",
6325
- runsOnFlyMachine: false
6361
+ runsOnFlyMachine: false,
6362
+ overdeckMcp: false
6326
6363
  };
6327
6364
  const OPENCODE_CAPABILITIES = {
6328
6365
  contextChannel: "acp-initial-context",
@@ -6345,7 +6382,8 @@ const OPENCODE_CAPABILITIES = {
6345
6382
  correlatesBySessionId: true,
6346
6383
  answersQuestionByMessage: false,
6347
6384
  askAnswerDelivery: "message",
6348
- runsOnFlyMachine: false
6385
+ runsOnFlyMachine: false,
6386
+ overdeckMcp: true
6349
6387
  };
6350
6388
  const MUSE_CAPABILITIES = {
6351
6389
  contextChannel: "append-system-prompt-file",
@@ -6368,7 +6406,8 @@ const MUSE_CAPABILITIES = {
6368
6406
  correlatesBySessionId: true,
6369
6407
  answersQuestionByMessage: false,
6370
6408
  askAnswerDelivery: "message",
6371
- runsOnFlyMachine: false
6409
+ runsOnFlyMachine: false,
6410
+ overdeckMcp: false
6372
6411
  };
6373
6412
  const PRIME_AGENT_CAPABILITIES = {
6374
6413
  contextChannel: "prime-agent-append-system-prompt",
@@ -6391,7 +6430,8 @@ const PRIME_AGENT_CAPABILITIES = {
6391
6430
  correlatesBySessionId: true,
6392
6431
  answersQuestionByMessage: false,
6393
6432
  askAnswerDelivery: "message",
6394
- runsOnFlyMachine: false
6433
+ runsOnFlyMachine: false,
6434
+ overdeckMcp: false
6395
6435
  };
6396
6436
  //#endregion
6397
6437
  //#region src/harness-behavior.ts
@@ -6754,7 +6794,18 @@ const TELEMETRY_EVENT_NAMES = [
6754
6794
  "pipeline_stage_changed",
6755
6795
  "github_quota_sample",
6756
6796
  "github_rate_limited",
6757
- "instance_heartbeat"
6797
+ "instance_heartbeat",
6798
+ "machine_link_started",
6799
+ "machine_link_approved",
6800
+ "machine_link_failed",
6801
+ "phone_paired",
6802
+ "phone_removed",
6803
+ "anywhere_channel_opened",
6804
+ "relay_usage_sampled",
6805
+ "mcp_session_seen",
6806
+ "mcp_tool_called",
6807
+ "client_request_failed",
6808
+ "phone_link_state"
6758
6809
  ];
6759
6810
  const TELEMETRY_CLI_VERBS = [
6760
6811
  "abort",
@@ -6817,6 +6868,356 @@ const TELEMETRY_CLI_VERBS = [
6817
6868
  "write-sequence",
6818
6869
  "other"
6819
6870
  ];
6871
+ const TELEMETRY_HARNESSES = [
6872
+ "claude-code",
6873
+ "ohmypi",
6874
+ "codex",
6875
+ "acp",
6876
+ "kimi-code",
6877
+ "opencode",
6878
+ "muse",
6879
+ "prime-agent"
6880
+ ];
6881
+ /** PAN-5084: what kind of install reported an event — distinguishes real adoption from CI/test/VM churn. */
6882
+ const TELEMETRY_INSTALL_KINDS = [
6883
+ "user",
6884
+ "remote_vm",
6885
+ "dev_checkout",
6886
+ "container"
6887
+ ];
6888
+ /**
6889
+ * PAN-4264: GitHub quota callers as telemetry values (`-` → `_`). Mirrors
6890
+ * `GITHUB_QUOTA_CALLERS` in ./github-quota; a unit test keeps them in step.
6891
+ */
6892
+ const TELEMETRY_GITHUB_CALLERS = [
6893
+ "pipeline_membership",
6894
+ "pr_cache",
6895
+ "pr_sync",
6896
+ "ci_repair",
6897
+ "issue_poller",
6898
+ "close_out",
6899
+ "tracker_client",
6900
+ "app_rest",
6901
+ "quota_sampler",
6902
+ "agent",
6903
+ "pr_adoption",
6904
+ "other"
6905
+ ];
6906
+ /** PAN-5016: route kinds (ROUTE_KINDS in ./machines) plus `stored`, the stored-route probe phase. */
6907
+ const TELEMETRY_CHANNEL_ROUTES = [
6908
+ "lan",
6909
+ "tailnet",
6910
+ "ssh",
6911
+ "public",
6912
+ "direct",
6913
+ "relay",
6914
+ "stored"
6915
+ ];
6916
+ /** PAN-5083: the Overdeck MCP tool names (ALL_TOOLS in src/lib/mcp/server.ts); a unit test keeps them in step. */
6917
+ const TELEMETRY_MCP_TOOLS = [
6918
+ "answer_agent_permission",
6919
+ "answer_agent_plan",
6920
+ "answer_codex_approval",
6921
+ "answer_pane_choice",
6922
+ "answer_permission",
6923
+ "answer_pi_ask",
6924
+ "answer_plan",
6925
+ "answer_question",
6926
+ "delegate_task",
6927
+ "delete_scheduled",
6928
+ "done",
6929
+ "handoff",
6930
+ "interrupt_conversation",
6931
+ "lane_report",
6932
+ "lane_start",
6933
+ "lane_status",
6934
+ "lane_stop",
6935
+ "lane_wait",
6936
+ "link_machine",
6937
+ "link_machine_wait",
6938
+ "link_pull_request",
6939
+ "list_conversations",
6940
+ "list_machines",
6941
+ "list_pending_input",
6942
+ "list_pull_request_watches",
6943
+ "list_scheduled",
6944
+ "list_workers",
6945
+ "memory_add",
6946
+ "memory_search",
6947
+ "read_conversation",
6948
+ "request_secret",
6949
+ "schedule_message",
6950
+ "schedule_recurring",
6951
+ "search_conversations",
6952
+ "secret_wait",
6953
+ "send_message",
6954
+ "start_conversation",
6955
+ "start_issue",
6956
+ "start_worker",
6957
+ "stop_conversation",
6958
+ "task_block",
6959
+ "task_cancel",
6960
+ "task_claim",
6961
+ "task_done",
6962
+ "task_status",
6963
+ "task_wait",
6964
+ "unwatch_pull_request",
6965
+ "update_scheduled",
6966
+ "wait_job",
6967
+ "watch_pull_request",
6968
+ "worker_report"
6969
+ ];
6970
+ /**
6971
+ * PAN-5100: every `ROUTE_SCOPES` path (`src/dashboard/server/route-scopes.ts`),
6972
+ * sorted, then `other`. Literal so the type stays a closed union; regenerate with:
6973
+ * grep -oE "path: '[^']*'" src/dashboard/server/route-scopes.ts | sed "s/path: '//; s/'//" | { cat; echo /api/telemetry/client-config; } | LC_ALL=C sort -u
6974
+ */
6975
+ const TELEMETRY_CLIENT_ROUTES = [
6976
+ "/api/activity",
6977
+ "/api/agent-directory",
6978
+ "/api/agent-requests",
6979
+ "/api/agents",
6980
+ "/api/agents/:id/answer-question",
6981
+ "/api/agents/:id/message",
6982
+ "/api/agents/:id/permissions/:requestId/respond",
6983
+ "/api/agents/:id/plan-action",
6984
+ "/api/agents/:id/tell",
6985
+ "/api/connectors/self",
6986
+ "/api/conversations",
6987
+ "/api/conversations/:id",
6988
+ "/api/conversations/:id/codex-approval",
6989
+ "/api/conversations/:id/pane-choice",
6990
+ "/api/conversations/:id/permission",
6991
+ "/api/conversations/:id/pi-ask-answer",
6992
+ "/api/conversations/:name/abort",
6993
+ "/api/conversations/:name/about",
6994
+ "/api/conversations/:name/attachments/:file",
6995
+ "/api/conversations/:name/bookmarks",
6996
+ "/api/conversations/:name/compact",
6997
+ "/api/conversations/:name/delete-image",
6998
+ "/api/conversations/:name/diffs",
6999
+ "/api/conversations/:name/diffs/:turnId",
7000
+ "/api/conversations/:name/kickoff",
7001
+ "/api/conversations/:name/message",
7002
+ "/api/conversations/:name/message-locator",
7003
+ "/api/conversations/:name/messages",
7004
+ "/api/conversations/:name/plan-action",
7005
+ "/api/conversations/:name/preview-ports",
7006
+ "/api/conversations/:name/pull-requests",
7007
+ "/api/conversations/:name/pull-requests/sync",
7008
+ "/api/conversations/:name/release",
7009
+ "/api/conversations/:name/release/complete",
7010
+ "/api/conversations/:name/release/transfer/:transferId",
7011
+ "/api/conversations/:name/release/undo",
7012
+ "/api/conversations/:name/resume",
7013
+ "/api/conversations/:name/scheduled-messages",
7014
+ "/api/conversations/:name/scheduled-messages/:id",
7015
+ "/api/conversations/:name/schedules",
7016
+ "/api/conversations/:name/schedules/:id",
7017
+ "/api/conversations/:name/stop",
7018
+ "/api/conversations/:name/switch-model",
7019
+ "/api/conversations/:name/thinking-level",
7020
+ "/api/conversations/:name/tool-body/:toolUseId",
7021
+ "/api/conversations/:name/upload-image",
7022
+ "/api/conversations/pending-input",
7023
+ "/api/costs/request-digest",
7024
+ "/api/costs/summary",
7025
+ "/api/disk-alert",
7026
+ "/api/fleet/conversations",
7027
+ "/api/fleet/issues/:id/activity",
7028
+ "/api/fleet/issues/:id/start",
7029
+ "/api/fleet/machines",
7030
+ "/api/fleet/needs-you",
7031
+ "/api/fleet/placement",
7032
+ "/api/fleet/search",
7033
+ "/api/fleet/workers",
7034
+ "/api/fleet/workers/:id/stop",
7035
+ "/api/flywheel/status",
7036
+ "/api/issues",
7037
+ "/api/lanes",
7038
+ "/api/lanes/:name",
7039
+ "/api/lanes/:name/stop",
7040
+ "/api/machines/conversations",
7041
+ "/api/machines/heartbeat",
7042
+ "/api/machines/issue-activity",
7043
+ "/api/machines/needs-you",
7044
+ "/api/machines/projects",
7045
+ "/api/machines/projects/:key/file",
7046
+ "/api/machines/projects/:key/source",
7047
+ "/api/machines/self",
7048
+ "/api/machines/work/conversations",
7049
+ "/api/machines/work/issues/:id/start",
7050
+ "/api/machines/work/lanes",
7051
+ "/api/machines/work/lanes/:name/reap",
7052
+ "/api/machines/work/lanes/:name/status",
7053
+ "/api/machines/work/projects",
7054
+ "/api/machines/work/projects/:jobId",
7055
+ "/api/machines/work/workers",
7056
+ "/api/needs-you",
7057
+ "/api/palette/search",
7058
+ "/api/phones/self",
7059
+ "/api/phones/self/notification-preferences",
7060
+ "/api/phones/self/push-key",
7061
+ "/api/pipeline/membership",
7062
+ "/api/pull-requests",
7063
+ "/api/pull-requests/conversations",
7064
+ "/api/registered-projects",
7065
+ "/api/self/done",
7066
+ "/api/self/handoff",
7067
+ "/api/self/jobs/:id",
7068
+ "/api/self/jobs/:id/wait",
7069
+ "/api/self/lanes",
7070
+ "/api/self/lanes/report",
7071
+ "/api/self/lanes/wait",
7072
+ "/api/self/machine-link-requests",
7073
+ "/api/self/machine-link-requests/:id/wait",
7074
+ "/api/self/memory/facts",
7075
+ "/api/self/memory/search",
7076
+ "/api/self/pull-request-watches",
7077
+ "/api/self/pull-request-watches/:id",
7078
+ "/api/self/pull-requests",
7079
+ "/api/self/secret-requests",
7080
+ "/api/self/secret-requests/:id/wait",
7081
+ "/api/self/tasks/block",
7082
+ "/api/self/tasks/claim",
7083
+ "/api/self/tasks/done",
7084
+ "/api/self/worker-report",
7085
+ "/api/self/workers",
7086
+ "/api/self/workers/:id",
7087
+ "/api/self/workers/:id/wait",
7088
+ "/api/settings/resolved",
7089
+ "/api/telemetry/client-config",
7090
+ "/api/versions/self",
7091
+ "/api/versions/self/update",
7092
+ "/api/workers",
7093
+ "/api/workers/:id/status",
7094
+ "/api/workers/:id/stop",
7095
+ "/events/stream",
7096
+ "/events/version",
7097
+ "other"
7098
+ ];
7099
+ /**
7100
+ * PAN-5100: the distinct first segments after `/api/` of every `NO_LOSS_MATRIX`
7101
+ * HTTP surface whose disposition is not `DELETE` (`tests/unit/lib/overdeck/no-loss-matrix.ts`),
7102
+ * plus `events` and `telemetry`, sorted, then `other`.
7103
+ */
7104
+ const TELEMETRY_CLIENT_ROUTE_AREAS = [
7105
+ "access-tokens",
7106
+ "account",
7107
+ "activity",
7108
+ "admin",
7109
+ "agent-directory",
7110
+ "agent-requests",
7111
+ "agents",
7112
+ "anywhere",
7113
+ "artifacts",
7114
+ "autopreso",
7115
+ "backlog",
7116
+ "boot-reconciliation",
7117
+ "cache",
7118
+ "cache-status",
7119
+ "claude-code",
7120
+ "cliproxy",
7121
+ "cloister",
7122
+ "color-themes",
7123
+ "command-deck",
7124
+ "commands",
7125
+ "confirmations",
7126
+ "connectors",
7127
+ "context",
7128
+ "conversations",
7129
+ "costs",
7130
+ "dashboard",
7131
+ "deacon",
7132
+ "deft",
7133
+ "deploy",
7134
+ "dev",
7135
+ "devices",
7136
+ "diffs",
7137
+ "directory",
7138
+ "discovered-sessions",
7139
+ "disk-alert",
7140
+ "effort",
7141
+ "environment",
7142
+ "events",
7143
+ "fleet",
7144
+ "flywheel",
7145
+ "fs",
7146
+ "git-activity",
7147
+ "github-quota",
7148
+ "godview",
7149
+ "health",
7150
+ "hooks",
7151
+ "internal",
7152
+ "issues",
7153
+ "jev",
7154
+ "joins",
7155
+ "knowledge-viewer",
7156
+ "lanes",
7157
+ "linear-mcp-auth",
7158
+ "linked-conversations",
7159
+ "machines",
7160
+ "mcp",
7161
+ "mcp-oauth",
7162
+ "memory",
7163
+ "merge-queue",
7164
+ "merge-train",
7165
+ "metrics",
7166
+ "model-presets",
7167
+ "models",
7168
+ "needs-you",
7169
+ "no-resume-mode",
7170
+ "orders",
7171
+ "pairing",
7172
+ "palette",
7173
+ "parked",
7174
+ "phones",
7175
+ "pipeline",
7176
+ "planning",
7177
+ "prereqs",
7178
+ "project-mappings",
7179
+ "projects",
7180
+ "pull-requests",
7181
+ "push",
7182
+ "rally",
7183
+ "registered-projects",
7184
+ "registry",
7185
+ "remote",
7186
+ "resources",
7187
+ "restart-gate",
7188
+ "resume-all",
7189
+ "review",
7190
+ "self",
7191
+ "session-trees",
7192
+ "settings",
7193
+ "shadow",
7194
+ "share-probe",
7195
+ "shares",
7196
+ "show",
7197
+ "skills",
7198
+ "specialists",
7199
+ "system",
7200
+ "tailscale",
7201
+ "telemetry",
7202
+ "terminals",
7203
+ "tiered",
7204
+ "tracker-status",
7205
+ "trackers",
7206
+ "triggers",
7207
+ "tts",
7208
+ "update",
7209
+ "vault",
7210
+ "velocity",
7211
+ "version",
7212
+ "versions",
7213
+ "voice",
7214
+ "webhooks",
7215
+ "workers",
7216
+ "workspace-registry",
7217
+ "workspace-stack-health",
7218
+ "workspaces",
7219
+ "other"
7220
+ ];
6820
7221
  const TELEMETRY_PROPERTY_DOMAINS = {
6821
7222
  agent_spawn_mode: ["spawn-and-send", "spawn-work-and-send"],
6822
7223
  answer_type: [
@@ -6827,7 +7228,22 @@ const TELEMETRY_PROPERTY_DOMAINS = {
6827
7228
  ],
6828
7229
  auto_merge_variant: ["segmented", "badge"],
6829
7230
  boolean: [false, true],
7231
+ channel_error_class: [
7232
+ "none",
7233
+ "unreachable",
7234
+ "identity_refused",
7235
+ "unknown_peer",
7236
+ "unsupported",
7237
+ "no_relay_plan",
7238
+ "descriptor_failed",
7239
+ "wrong_machine",
7240
+ "heartbeat_failed",
7241
+ "revoked"
7242
+ ],
7243
+ channel_route: TELEMETRY_CHANNEL_ROUTES,
6830
7244
  cli_verb: TELEMETRY_CLI_VERBS,
7245
+ client_route: TELEMETRY_CLIENT_ROUTES,
7246
+ client_route_area: TELEMETRY_CLIENT_ROUTE_AREAS,
6831
7247
  close_out_variant: ["card", "inspector"],
6832
7248
  count_bucket: [
6833
7249
  "0",
@@ -6876,30 +7292,103 @@ const TELEMETRY_PROPERTY_DOMAINS = {
6876
7292
  "handoff",
6877
7293
  "plain"
6878
7294
  ],
6879
- github_caller: [
6880
- "pipeline_membership",
6881
- "pr_cache",
6882
- "pr_sync",
6883
- "ci_repair",
6884
- "issue_poller",
6885
- "close_out",
6886
- "tracker_client",
6887
- "app_rest",
6888
- "quota_sampler",
6889
- "agent",
6890
- "pr_adoption",
7295
+ github_caller: TELEMETRY_GITHUB_CALLERS,
7296
+ harness: TELEMETRY_HARNESSES,
7297
+ http_method: [
7298
+ "GET",
7299
+ "POST",
7300
+ "PUT",
7301
+ "PATCH",
7302
+ "DELETE",
7303
+ "other"
7304
+ ],
7305
+ install_kind: TELEMETRY_INSTALL_KINDS,
7306
+ link_failure_reason: [
7307
+ "bad_pairing_url",
7308
+ "unreachable",
7309
+ "pairing_refused",
7310
+ "unsupported",
7311
+ "identity_mismatch",
7312
+ "exchange_failed",
7313
+ "grant_refused",
7314
+ "offline",
7315
+ "approval_refused",
7316
+ "approval_failed",
7317
+ "other"
7318
+ ],
7319
+ link_method: [
7320
+ "pairing_code",
7321
+ "ssh",
7322
+ "fly",
7323
+ "directory_approval",
7324
+ "other"
7325
+ ],
7326
+ link_reason: [
7327
+ "none",
7328
+ "offline",
7329
+ "no_path",
7330
+ "unreachable",
7331
+ "removed",
7332
+ "pairing_refused",
7333
+ "identity_mismatch",
7334
+ "unsupported",
7335
+ "channel_failed",
7336
+ "delayed",
7337
+ "restarting",
7338
+ "unauthorized",
7339
+ "resume",
6891
7340
  "other"
6892
7341
  ],
6893
- harness: [
6894
- "claude-code",
6895
- "ohmypi",
7342
+ link_route: [
7343
+ "direct",
7344
+ "relay",
7345
+ "unknown"
7346
+ ],
7347
+ link_side: ["requester", "approver"],
7348
+ link_state: [
7349
+ "failed",
7350
+ "dropped",
7351
+ "recovered",
7352
+ "route_changed"
7353
+ ],
7354
+ mcp_auth: [
7355
+ "agent_token",
7356
+ "oauth",
7357
+ "access_token",
7358
+ "connector"
7359
+ ],
7360
+ mcp_client: [
7361
+ "claude_code",
6896
7362
  "codex",
6897
- "acp",
6898
- "kimi-code",
7363
+ "cursor",
7364
+ "vscode",
7365
+ "chatgpt",
7366
+ "grok",
7367
+ "hermes",
7368
+ "openclaw",
7369
+ "gemini",
6899
7370
  "opencode",
6900
- "muse",
6901
- "prime-agent"
7371
+ "kimi",
7372
+ "overdeck_connector",
7373
+ "other"
6902
7374
  ],
7375
+ mcp_protocol: [
7376
+ "2026-07-28",
7377
+ "2025-11-25",
7378
+ "2025-06-18",
7379
+ "2025-03-26",
7380
+ "2024-11-05",
7381
+ "2024-10-07",
7382
+ "other"
7383
+ ],
7384
+ mcp_surface: [
7385
+ "dashboard_http",
7386
+ "public_http",
7387
+ "stdio",
7388
+ "connector_http",
7389
+ "connector_stdio"
7390
+ ],
7391
+ mcp_tool: TELEMETRY_MCP_TOOLS,
6903
7392
  merge_kind: ["pipeline"],
6904
7393
  model_family: [
6905
7394
  "claude",
@@ -6911,6 +7400,7 @@ const TELEMETRY_PROPERTY_DOMAINS = {
6911
7400
  "mimo",
6912
7401
  "other"
6913
7402
  ],
7403
+ phone_removed_by: ["operator", "phone"],
6914
7404
  pipeline_stage: [
6915
7405
  "work_done",
6916
7406
  "review_passed",
@@ -6941,7 +7431,43 @@ const TELEMETRY_PROPERTY_DOMAINS = {
6941
7431
  "2500+",
6942
7432
  "unknown"
6943
7433
  ],
6944
- rate_limit_kind: ["primary", "secondary"]
7434
+ rate_limit_kind: ["primary", "secondary"],
7435
+ recovery_bucket: [
7436
+ "none",
7437
+ "under_1s",
7438
+ "1s-4s",
7439
+ "5s-14s",
7440
+ "15s-59s",
7441
+ "60s+"
7442
+ ],
7443
+ relay_bytes_bucket: [
7444
+ "under_1mb",
7445
+ "1mb-9mb",
7446
+ "10mb-99mb",
7447
+ "100mb-999mb",
7448
+ "1gb+"
7449
+ ],
7450
+ request_status: [
7451
+ "400",
7452
+ "401",
7453
+ "403",
7454
+ "404",
7455
+ "408",
7456
+ "409",
7457
+ "413",
7458
+ "422",
7459
+ "429",
7460
+ "other_4xx",
7461
+ "500",
7462
+ "502",
7463
+ "503",
7464
+ "504",
7465
+ "other_5xx",
7466
+ "network",
7467
+ "timeout",
7468
+ "aborted"
7469
+ ],
7470
+ telemetry_client: ["phone", "desktop"]
6945
7471
  };
6946
7472
  const TELEMETRY_EVENT_CATALOG = {
6947
7473
  dashboard_tab_viewed: { tab: "dashboard_tab" },
@@ -7022,6 +7548,48 @@ const TELEMETRY_EVENT_CATALOG = {
7022
7548
  project_count: "count_bucket",
7023
7549
  active_agent_count: "count_bucket",
7024
7550
  dashboard_running: "boolean"
7551
+ },
7552
+ machine_link_started: { method: "link_method" },
7553
+ machine_link_approved: {
7554
+ method: "link_method",
7555
+ side: "link_side"
7556
+ },
7557
+ machine_link_failed: {
7558
+ method: "link_method",
7559
+ side: "link_side",
7560
+ reason: "link_failure_reason"
7561
+ },
7562
+ phone_paired: { replaced_previous: "boolean" },
7563
+ phone_removed: { by: "phone_removed_by" },
7564
+ anywhere_channel_opened: {
7565
+ route: "channel_route",
7566
+ ok: "boolean",
7567
+ error_class: "channel_error_class"
7568
+ },
7569
+ relay_usage_sampled: { bytes: "relay_bytes_bucket" },
7570
+ mcp_session_seen: {
7571
+ mcp_surface: "mcp_surface",
7572
+ mcp_protocol: "mcp_protocol",
7573
+ mcp_client: "mcp_client",
7574
+ mcp_auth: "mcp_auth"
7575
+ },
7576
+ mcp_tool_called: {
7577
+ mcp_surface: "mcp_surface",
7578
+ mcp_client: "mcp_client",
7579
+ mcp_tool: "mcp_tool"
7580
+ },
7581
+ client_request_failed: {
7582
+ client: "telemetry_client",
7583
+ route: "client_route",
7584
+ route_area: "client_route_area",
7585
+ method: "http_method",
7586
+ status: "request_status"
7587
+ },
7588
+ phone_link_state: {
7589
+ state: "link_state",
7590
+ reason: "link_reason",
7591
+ route: "link_route",
7592
+ recover_time: "recovery_bucket"
7025
7593
  }
7026
7594
  };
7027
7595
  /** PAN-4264: GitHub quota points as a coarse bucket (raw counts are never sent). */
@@ -7044,6 +7612,65 @@ function bucketQuotaRemaining(remaining) {
7044
7612
  if (remaining < 2500) return "1000-2499";
7045
7613
  return "2500+";
7046
7614
  }
7615
+ /** PAN-5016: relayed bytes as a coarse bucket (raw byte counts are never sent). */
7616
+ function bucketRelayBytes(bytes) {
7617
+ if (!(bytes >= 1e6)) return "under_1mb";
7618
+ if (bytes < 1e7) return "1mb-9mb";
7619
+ if (bytes < 1e8) return "10mb-99mb";
7620
+ if (bytes < 1e9) return "100mb-999mb";
7621
+ return "1gb+";
7622
+ }
7623
+ /** PAN-5100: the closed route template and area for a same-origin path (query and hash ignored). */
7624
+ function clientRouteOf(pathname) {
7625
+ const segments = (pathname.split(/[?#]/)[0] ?? pathname).split("/").filter((segment) => segment.length > 0);
7626
+ let bestTemplate = null;
7627
+ let bestLiteralCount = -1;
7628
+ for (const template of TELEMETRY_CLIENT_ROUTES) {
7629
+ if (template === "other") continue;
7630
+ const templateSegments = template.split("/").filter((segment) => segment.length > 0);
7631
+ if (templateSegments.length !== segments.length) continue;
7632
+ let literalCount = 0;
7633
+ let matches = true;
7634
+ for (let i = 0; i < templateSegments.length; i++) {
7635
+ const templateSegment = templateSegments[i];
7636
+ const pathSegment = segments[i];
7637
+ if (templateSegment.startsWith(":")) continue;
7638
+ if (templateSegment !== pathSegment) {
7639
+ matches = false;
7640
+ break;
7641
+ }
7642
+ literalCount++;
7643
+ }
7644
+ if (matches && literalCount > bestLiteralCount) {
7645
+ bestTemplate = template;
7646
+ bestLiteralCount = literalCount;
7647
+ }
7648
+ }
7649
+ const route = bestTemplate ?? "other";
7650
+ let route_area = "other";
7651
+ if (segments[0] === "events") route_area = "events";
7652
+ else if (segments[0] === "api" && segments[1] !== void 0 && TELEMETRY_CLIENT_ROUTE_AREAS.includes(segments[1])) route_area = segments[1];
7653
+ return {
7654
+ route,
7655
+ route_area
7656
+ };
7657
+ }
7658
+ /** PAN-5100: an HTTP status (≥ 400) as a closed bucket. */
7659
+ function bucketRequestStatus(status) {
7660
+ const exact = String(status);
7661
+ if (TELEMETRY_PROPERTY_DOMAINS.request_status.includes(exact)) return exact;
7662
+ if (status >= 400 && status < 500) return "other_4xx";
7663
+ return "other_5xx";
7664
+ }
7665
+ /** PAN-5100: milliseconds to recover as a coarse bucket. */
7666
+ function bucketRecoveryMs(ms) {
7667
+ if (ms === null) return "none";
7668
+ if (ms < 1e3) return "under_1s";
7669
+ if (ms < 5e3) return "1s-4s";
7670
+ if (ms < 15e3) return "5s-14s";
7671
+ if (ms < 6e4) return "15s-59s";
7672
+ return "60s+";
7673
+ }
7047
7674
  //#endregion
7048
7675
  //#region src/composer-commands.generated.ts
7049
7676
  const COMPOSER_COMMAND_MANIFEST = [
@@ -7553,7 +8180,7 @@ const COMPOSER_COMMAND_MANIFEST = [
7553
8180
  "status"
7554
8181
  ],
7555
8182
  "display": "/pan skills pack sageox status",
7556
- "description": "Show, per project, the sageox pack state and the upload state",
8183
+ "description": "Show, per project, the sageox pack state, the upload state and the link state",
7557
8184
  "args": [],
7558
8185
  "options": [{
7559
8186
  "flags": "--project <key>",
@@ -7593,6 +8220,51 @@ const COMPOSER_COMMAND_MANIFEST = [
7593
8220
  "aliases": [],
7594
8221
  "category": "Core"
7595
8222
  },
8223
+ {
8224
+ "id": "pan-skills-pack-sageox-link",
8225
+ "path": [
8226
+ "skills",
8227
+ "pack",
8228
+ "sageox",
8229
+ "link"
8230
+ ],
8231
+ "display": "/pan skills pack sageox link",
8232
+ "description": "Run ox init in a throwaway worktree and store the project's SageOx link files (changes no checkout)",
8233
+ "args": [],
8234
+ "options": [{
8235
+ "flags": "--project <key>",
8236
+ "description": "Project key",
8237
+ "required": true,
8238
+ "valueHint": "key"
8239
+ }, {
8240
+ "flags": "--team <team>",
8241
+ "description": "SageOx team (name, slug or id) passed to ox init",
8242
+ "required": true,
8243
+ "valueHint": "team"
8244
+ }],
8245
+ "aliases": [],
8246
+ "category": "Core"
8247
+ },
8248
+ {
8249
+ "id": "pan-skills-pack-sageox-commit",
8250
+ "path": [
8251
+ "skills",
8252
+ "pack",
8253
+ "sageox",
8254
+ "commit"
8255
+ ],
8256
+ "display": "/pan skills pack sageox commit",
8257
+ "description": "Open one PR that adds the project's stored SageOx link files as .sageox/, then record sageox_binding: committed",
8258
+ "args": [],
8259
+ "options": [{
8260
+ "flags": "--project <key>",
8261
+ "description": "Project key",
8262
+ "required": true,
8263
+ "valueHint": "key"
8264
+ }],
8265
+ "aliases": [],
8266
+ "category": "Core"
8267
+ },
7596
8268
  {
7597
8269
  "id": "pan-skills-deft",
7598
8270
  "path": ["skills", "deft"],
@@ -8437,7 +9109,300 @@ const COMPOSER_COMMAND_MANIFEST = [
8437
9109
  "id": "pan-mcp-serve",
8438
9110
  "path": ["mcp", "serve"],
8439
9111
  "display": "/pan mcp serve",
8440
- "description": "Serve Overdeck as an MCP server over stdio (token from OVERDECK_MCP_TOKEN; see configuration/mcp.mdx)",
9112
+ "description": "Serve Overdeck as an MCP server over stdio (token from OVERDECK_MCP_TOKEN or OVERDECK_MCP_TOKEN_FILE; see configuration/mcp.mdx)",
9113
+ "args": [],
9114
+ "options": [],
9115
+ "aliases": [],
9116
+ "category": "CLI"
9117
+ },
9118
+ {
9119
+ "id": "pan-mcp-oauth",
9120
+ "path": ["mcp", "oauth"],
9121
+ "display": "/pan mcp oauth",
9122
+ "description": "Manage OAuth sign-ins to /mcp (see configuration/mcp.mdx)",
9123
+ "args": [],
9124
+ "options": [],
9125
+ "aliases": [],
9126
+ "category": "CLI"
9127
+ },
9128
+ {
9129
+ "id": "pan-mcp-oauth-issue",
9130
+ "path": [
9131
+ "mcp",
9132
+ "oauth",
9133
+ "issue"
9134
+ ],
9135
+ "display": "/pan mcp oauth issue",
9136
+ "description": "Create a sign-in for a client that cannot open a browser; prints its tokens once",
9137
+ "args": [],
9138
+ "options": [{
9139
+ "flags": "--name <name>",
9140
+ "description": "Name shown in the sign-in list",
9141
+ "required": true,
9142
+ "valueHint": "name"
9143
+ }, {
9144
+ "flags": "--level <level>",
9145
+ "description": "Access level: read, message, operate or approve",
9146
+ "required": true,
9147
+ "valueHint": "level"
9148
+ }],
9149
+ "aliases": [],
9150
+ "category": "CLI"
9151
+ },
9152
+ {
9153
+ "id": "pan-mcp-oauth-list",
9154
+ "path": [
9155
+ "mcp",
9156
+ "oauth",
9157
+ "list"
9158
+ ],
9159
+ "display": "/pan mcp oauth list",
9160
+ "description": "List active OAuth sign-ins",
9161
+ "args": [],
9162
+ "options": [],
9163
+ "aliases": [],
9164
+ "category": "CLI"
9165
+ },
9166
+ {
9167
+ "id": "pan-mcp-oauth-revoke",
9168
+ "path": [
9169
+ "mcp",
9170
+ "oauth",
9171
+ "revoke"
9172
+ ],
9173
+ "display": "/pan mcp oauth revoke",
9174
+ "description": "End one OAuth sign-in",
9175
+ "args": [{
9176
+ "name": "familyId",
9177
+ "required": true,
9178
+ "variadic": false
9179
+ }],
9180
+ "options": [],
9181
+ "aliases": [],
9182
+ "category": "CLI"
9183
+ },
9184
+ {
9185
+ "id": "pan-mcp-oauth-pending",
9186
+ "path": [
9187
+ "mcp",
9188
+ "oauth",
9189
+ "pending"
9190
+ ],
9191
+ "display": "/pan mcp oauth pending",
9192
+ "description": "List sign-ins waiting for your approval",
9193
+ "args": [],
9194
+ "options": [],
9195
+ "aliases": [],
9196
+ "category": "CLI"
9197
+ },
9198
+ {
9199
+ "id": "pan-mcp-oauth-approve",
9200
+ "path": [
9201
+ "mcp",
9202
+ "oauth",
9203
+ "approve"
9204
+ ],
9205
+ "display": "/pan mcp oauth approve",
9206
+ "description": "Approve the waiting sign-in that shows this approval code",
9207
+ "args": [{
9208
+ "name": "code",
9209
+ "required": true,
9210
+ "variadic": false
9211
+ }],
9212
+ "options": [{
9213
+ "flags": "--level <level>",
9214
+ "description": "Access level: read, message, operate or approve",
9215
+ "required": true,
9216
+ "valueHint": "level"
9217
+ }],
9218
+ "aliases": [],
9219
+ "category": "CLI"
9220
+ },
9221
+ {
9222
+ "id": "pan-mcp-oauth-deny",
9223
+ "path": [
9224
+ "mcp",
9225
+ "oauth",
9226
+ "deny"
9227
+ ],
9228
+ "display": "/pan mcp oauth deny",
9229
+ "description": "Deny the waiting sign-in that shows this approval code",
9230
+ "args": [{
9231
+ "name": "code",
9232
+ "required": true,
9233
+ "variadic": false
9234
+ }],
9235
+ "options": [],
9236
+ "aliases": [],
9237
+ "category": "CLI"
9238
+ },
9239
+ {
9240
+ "id": "pan-mcp-connector",
9241
+ "path": ["mcp", "connector"],
9242
+ "display": "/pan mcp connector",
9243
+ "description": "Run an Overdeck connector for a self-hosted bot (see configuration/mcp.mdx)",
9244
+ "args": [],
9245
+ "options": [],
9246
+ "aliases": [],
9247
+ "category": "CLI"
9248
+ },
9249
+ {
9250
+ "id": "pan-mcp-connector-connect",
9251
+ "path": [
9252
+ "mcp",
9253
+ "connector",
9254
+ "connect"
9255
+ ],
9256
+ "display": "/pan mcp connector connect",
9257
+ "description": "Sign in, pair, verify and print the MCP registration in one resumable command (for bots)",
9258
+ "args": [{
9259
+ "name": "pairingString",
9260
+ "required": true,
9261
+ "variadic": false
9262
+ }],
9263
+ "options": [
9264
+ {
9265
+ "flags": "--name <bot>",
9266
+ "description": "the bot name shown on the sign-in page and on the machine (default: host name)",
9267
+ "required": true,
9268
+ "valueHint": "bot"
9269
+ },
9270
+ {
9271
+ "flags": "--platform <id>",
9272
+ "description": "grok-bot, grok-build, hermes, openclaw, other (default: other)",
9273
+ "required": true,
9274
+ "valueHint": "id"
9275
+ },
9276
+ {
9277
+ "flags": "--wait <seconds>",
9278
+ "description": "how long a rerun waits for the sign-in approval (default 120)",
9279
+ "required": true,
9280
+ "valueHint": "seconds"
9281
+ },
9282
+ {
9283
+ "flags": "--account-url <url>",
9284
+ "description": "overdeck.ai account service URL",
9285
+ "required": true,
9286
+ "valueHint": "url"
9287
+ },
9288
+ {
9289
+ "flags": "--directory-url <url>",
9290
+ "description": "overdeck.ai directory URL",
9291
+ "required": true,
9292
+ "valueHint": "url"
9293
+ }
9294
+ ],
9295
+ "aliases": [],
9296
+ "category": "CLI"
9297
+ },
9298
+ {
9299
+ "id": "pan-mcp-connector-login",
9300
+ "path": [
9301
+ "mcp",
9302
+ "connector",
9303
+ "login"
9304
+ ],
9305
+ "display": "/pan mcp connector login",
9306
+ "description": "Sign this connector in to overdeck.ai with the device flow",
9307
+ "args": [],
9308
+ "options": [{
9309
+ "flags": "--account-url <url>",
9310
+ "description": "overdeck.ai account service URL",
9311
+ "required": true,
9312
+ "valueHint": "url"
9313
+ }, {
9314
+ "flags": "--directory-url <url>",
9315
+ "description": "overdeck.ai directory URL",
9316
+ "required": true,
9317
+ "valueHint": "url"
9318
+ }],
9319
+ "aliases": [],
9320
+ "category": "CLI"
9321
+ },
9322
+ {
9323
+ "id": "pan-mcp-connector-pair",
9324
+ "path": [
9325
+ "mcp",
9326
+ "connector",
9327
+ "pair"
9328
+ ],
9329
+ "display": "/pan mcp connector pair",
9330
+ "description": "Pair with one Overdeck machine using the string from Connect a bot",
9331
+ "args": [{
9332
+ "name": "pairingString",
9333
+ "required": true,
9334
+ "variadic": false
9335
+ }],
9336
+ "options": [{
9337
+ "flags": "--label <name>",
9338
+ "description": "name this connector shows on the machine (default: host name)",
9339
+ "required": true,
9340
+ "valueHint": "name"
9341
+ }],
9342
+ "aliases": [],
9343
+ "category": "CLI"
9344
+ },
9345
+ {
9346
+ "id": "pan-mcp-connector-serve",
9347
+ "path": [
9348
+ "mcp",
9349
+ "connector",
9350
+ "serve"
9351
+ ],
9352
+ "display": "/pan mcp connector serve",
9353
+ "description": "Serve the Overdeck MCP tools on 127.0.0.1 (or stdio) for the paired machine",
9354
+ "args": [],
9355
+ "options": [
9356
+ {
9357
+ "flags": "--port <port>",
9358
+ "description": "loopback port for http://127.0.0.1:<port>/mcp (default 7466)",
9359
+ "required": true,
9360
+ "valueHint": "port"
9361
+ },
9362
+ {
9363
+ "flags": "--stdio",
9364
+ "description": "serve one MCP session on stdin and stdout instead",
9365
+ "required": false,
9366
+ "valueHint": null
9367
+ },
9368
+ {
9369
+ "flags": "--label <name>",
9370
+ "description": "name this connector shows in the overdeck.ai directory (default: host name)",
9371
+ "required": true,
9372
+ "valueHint": "name"
9373
+ }
9374
+ ],
9375
+ "aliases": [],
9376
+ "category": "CLI"
9377
+ },
9378
+ {
9379
+ "id": "pan-mcp-connector-status",
9380
+ "path": [
9381
+ "mcp",
9382
+ "connector",
9383
+ "status"
9384
+ ],
9385
+ "display": "/pan mcp connector status",
9386
+ "description": "Show the signed-in account, the paired machine, its scopes and the live route",
9387
+ "args": [],
9388
+ "options": [{
9389
+ "flags": "--port <port>",
9390
+ "description": "port of the running serve (default 7466)",
9391
+ "required": true,
9392
+ "valueHint": "port"
9393
+ }],
9394
+ "aliases": [],
9395
+ "category": "CLI"
9396
+ },
9397
+ {
9398
+ "id": "pan-mcp-connector-logout",
9399
+ "path": [
9400
+ "mcp",
9401
+ "connector",
9402
+ "logout"
9403
+ ],
9404
+ "display": "/pan mcp connector logout",
9405
+ "description": "Remove this connector from its machine and overdeck.ai, then delete its files",
8441
9406
  "args": [],
8442
9407
  "options": [],
8443
9408
  "aliases": [],
@@ -9302,7 +10267,7 @@ const COMPOSER_COMMAND_MANIFEST = [
9302
10267
  },
9303
10268
  {
9304
10269
  "flags": "--pack <id>",
9305
- "description": "Turn every skill of this cached skill pack on for the new conversation only (repeatable)",
10270
+ "description": "Turn on every non-opt-in skill of this cached skill pack for the new conversation only (repeatable)",
9306
10271
  "required": true,
9307
10272
  "valueHint": "id"
9308
10273
  },
@@ -11277,6 +12242,44 @@ const COMPOSER_COMMAND_MANIFEST = [
11277
12242
  "aliases": [],
11278
12243
  "category": "CLI"
11279
12244
  },
12245
+ {
12246
+ "id": "pan-share",
12247
+ "path": ["share"],
12248
+ "display": "/pan share",
12249
+ "description": "Share a conversation by link: print the join link and join code (Shared Sessions)",
12250
+ "args": [{
12251
+ "name": "conversation",
12252
+ "required": true,
12253
+ "variadic": false
12254
+ }],
12255
+ "options": [{
12256
+ "flags": "--json",
12257
+ "description": "Print the share as JSON",
12258
+ "required": false,
12259
+ "valueHint": null
12260
+ }],
12261
+ "aliases": [],
12262
+ "category": "CLI"
12263
+ },
12264
+ {
12265
+ "id": "pan-join",
12266
+ "path": ["join"],
12267
+ "display": "/pan join",
12268
+ "description": "Join a shared conversation from a link or join code: signs in, starts Overdeck if needed, opens the lobby",
12269
+ "args": [{
12270
+ "name": "link-or-code",
12271
+ "required": true,
12272
+ "variadic": false
12273
+ }],
12274
+ "options": [{
12275
+ "flags": "--no-open",
12276
+ "description": "Print the shared-conversation URL instead of opening a browser",
12277
+ "required": false,
12278
+ "valueHint": null
12279
+ }],
12280
+ "aliases": [],
12281
+ "category": "CLI"
12282
+ },
11280
12283
  {
11281
12284
  "id": "pan-test",
11282
12285
  "path": ["test"],
@@ -11781,6 +12784,12 @@ const COMPOSER_COMMAND_MANIFEST = [
11781
12784
  "required": true,
11782
12785
  "valueHint": "n"
11783
12786
  },
12787
+ {
12788
+ "flags": "--facts",
12789
+ "description": "With --json: also return matching curated facts from this checkout, the operator and the machine store, scope the search to the current project, and print one line { facts, observations }",
12790
+ "required": false,
12791
+ "valueHint": null
12792
+ },
11784
12793
  {
11785
12794
  "flags": "--json",
11786
12795
  "description": "Output JSON",
@@ -15457,7 +16466,7 @@ const COMPOSER_COMMAND_MANIFEST = [
15457
16466
  "id": "pan-lane",
15458
16467
  "path": ["lane"],
15459
16468
  "display": "/pan lane",
15460
- "description": "Gauntlet lanes: launch, list, show, wait on, report from, stop and reap lane conversations",
16469
+ "description": "Gauntlet lanes: launch, list, show, wait on, report from, stop, reap and disk-check lane conversations",
15461
16470
  "args": [],
15462
16471
  "options": [],
15463
16472
  "aliases": [],
@@ -15625,6 +16634,12 @@ const COMPOSER_COMMAND_MANIFEST = [
15625
16634
  "required": true,
15626
16635
  "valueHint": "conv"
15627
16636
  },
16637
+ {
16638
+ "flags": "--reapable",
16639
+ "description": "Only lanes a newer iteration superseded that pan lane reap can remove now",
16640
+ "required": false,
16641
+ "valueHint": null
16642
+ },
15628
16643
  {
15629
16644
  "flags": "--json",
15630
16645
  "description": "Print JSON",
@@ -15798,6 +16813,26 @@ const COMPOSER_COMMAND_MANIFEST = [
15798
16813
  "aliases": [],
15799
16814
  "category": "CLI"
15800
16815
  },
16816
+ {
16817
+ "id": "pan-lane-disk-check",
16818
+ "path": ["lane", "disk-check"],
16819
+ "display": "/pan lane disk-check",
16820
+ "description": "Check the disk floor before launching lanes or creating a worktree (exit 0 room, 4 disk low, 1 error)",
16821
+ "args": [],
16822
+ "options": [{
16823
+ "flags": "--project <key>",
16824
+ "description": "Check the project's lanes root with the cost of one new lane, and list directories there that are not lanes",
16825
+ "required": true,
16826
+ "valueHint": "key"
16827
+ }, {
16828
+ "flags": "--path <dir>",
16829
+ "description": "Check the filesystem holding this directory (default: the current directory)",
16830
+ "required": true,
16831
+ "valueHint": "dir"
16832
+ }],
16833
+ "aliases": [],
16834
+ "category": "CLI"
16835
+ },
15801
16836
  {
15802
16837
  "id": "pan-flywheel",
15803
16838
  "path": ["flywheel"],
@@ -16484,6 +17519,45 @@ const COMPOSER_COMMAND_MANIFEST = [
16484
17519
  "aliases": [],
16485
17520
  "category": "Core"
16486
17521
  },
17522
+ {
17523
+ "id": "pan-restart-hold",
17524
+ "path": ["restart", "hold"],
17525
+ "display": "/pan restart hold",
17526
+ "description": "Hold every dashboard restart and reload until `pan restart release` (or --until expires)",
17527
+ "args": [],
17528
+ "options": [
17529
+ {
17530
+ "flags": "--reason <text>",
17531
+ "description": "Why restarts are held; every refused command prints it",
17532
+ "required": true,
17533
+ "valueHint": "text"
17534
+ },
17535
+ {
17536
+ "flags": "--until <when>",
17537
+ "description": "Lift the hold on its own: a duration (90m, 2h, 1d) or an ISO time",
17538
+ "required": true,
17539
+ "valueHint": "when"
17540
+ },
17541
+ {
17542
+ "flags": "--status",
17543
+ "description": "Show the current hold instead of setting one",
17544
+ "required": false,
17545
+ "valueHint": null
17546
+ }
17547
+ ],
17548
+ "aliases": [],
17549
+ "category": "Core"
17550
+ },
17551
+ {
17552
+ "id": "pan-restart-release",
17553
+ "path": ["restart", "release"],
17554
+ "display": "/pan restart release",
17555
+ "description": "Release the restart hold so `pan reload` and `pan restart` run again",
17556
+ "args": [],
17557
+ "options": [],
17558
+ "aliases": [],
17559
+ "category": "Core"
17560
+ },
16487
17561
  {
16488
17562
  "id": "pan-project",
16489
17563
  "path": ["project"],
@@ -17947,7 +19021,7 @@ const MachinePlacementMode = effect.Schema.Literals(["auto", "on-request"]);
17947
19021
  /** PAN-4651 FR-6: `CPU 3% · 41 GB · 2 agents` (unknown parts `n/a`); null without a sample. */
17948
19022
  function formatMachineLoad(load) {
17949
19023
  if (!load) return null;
17950
- return `CPU ${load.cpuPsiSomeAvg10 === null ? "n/a" : `${Math.round(load.cpuPsiSomeAvg10)}%`} · ${load.memAvailableBytes === null ? "n/a" : `${Math.floor(load.memAvailableBytes / 2 ** 30)}`} GB · ${load.workingAgents} agents`;
19024
+ return `CPU ${load.cpuPsiSomeAvg10 === null ? "n/a" : `${Math.round(load.cpuPsiSomeAvg10)}%`} · ${load.memAvailableBytes === null ? "n/a" : `${Math.floor(load.memAvailableBytes / 2 ** 30)}`} GB · ${load.workingAgents} ${load.workingAgents === 1 ? "agent" : "agents"}`;
17951
19025
  }
17952
19026
  /** PAN-4651 FR-7: `tags: docker, linux · reserved`; null when there is neither. */
17953
19027
  function formatMachineProfile(tags, placement) {
@@ -18046,7 +19120,11 @@ const MachinesResponse = effect.Schema.Struct({
18046
19120
  /** PAN-4651: this machine's own load sample, tags and placement mode. */
18047
19121
  load: effect.Schema.optional(effect.Schema.NullOr(LoadSample)),
18048
19122
  tags: effect.Schema.optional(effect.Schema.Array(effect.Schema.String)),
18049
- placement: effect.Schema.optional(MachinePlacementMode)
19123
+ placement: effect.Schema.optional(MachinePlacementMode),
19124
+ /** PAN-4905: config.toml `[remote] enabled`; the Add a Fly machine dialog reads it before the click. */
19125
+ remoteEnabled: effect.Schema.optional(effect.Schema.Boolean),
19126
+ /** PAN-4905: config.toml as a display path (`~/.overdeck/config.toml`). */
19127
+ remoteConfigFile: effect.Schema.optional(effect.Schema.String)
18050
19128
  }),
18051
19129
  links: effect.Schema.Array(MachineLinkView),
18052
19130
  inbound: effect.Schema.Array(InboundMachineView)
@@ -18095,7 +19173,11 @@ const EnvironmentCapabilities = effect.Schema.Struct({
18095
19173
  /** `/ws/*` upgrades require a credential (PAN-1166). */
18096
19174
  terminalAuth: effect.Schema.Boolean,
18097
19175
  /** Secure machine links are accepted (PAN-4645). Absent on older servers ⇒ `unsupported`. */
18098
- machineLinks: effect.Schema.optional(effect.Schema.Boolean)
19176
+ machineLinks: effect.Schema.optional(effect.Schema.Boolean),
19177
+ /** The phone app can pair and use this machine (PAN-4835). Absent on older servers ⇒ unsupported. */
19178
+ phoneApp: effect.Schema.optional(effect.Schema.Boolean),
19179
+ /** An Overdeck connector can pair with this machine (PAN-4927 W-CONN1). Absent on older servers ⇒ unsupported. */
19180
+ connector: effect.Schema.optional(effect.Schema.Boolean)
18099
19181
  });
18100
19182
  const EnvironmentDescriptor = effect.Schema.Struct({
18101
19183
  descriptorVersion: effect.Schema.Literal(1),
@@ -18163,6 +19245,8 @@ const INBOX_HOLD_MS = 864e5;
18163
19245
  const APPROVAL_TTL_MS = 6e5;
18164
19246
  /** Phones (directory clients) one account may register (PAN-4823 D-2, NFR-3). Clients never count as machines. */
18165
19247
  const CLIENT_LIMIT = 5;
19248
+ /** PAN-4927 D-18: connectors are counted apart from phones. */
19249
+ const CONNECTOR_LIMIT = 10;
18166
19250
  /** Pushes the directory forwards per account per minute (PAN-4823 D-9). */
18167
19251
  const PUSH_RATE_PER_MINUTE = 30;
18168
19252
  /**
@@ -18175,10 +19259,19 @@ const PUSH_SEALED_MAX_CHARS = 3072;
18175
19259
  * grows by 4/3, so 2,256 bytes seal to exactly `PUSH_SEALED_MAX_CHARS` characters.
18176
19260
  */
18177
19261
  const PUSH_PLAINTEXT_MAX_BYTES = 2256;
19262
+ /** Live Activity (PAN-4839, OD-1): the most either count may be. */
19263
+ const ACTIVITY_COUNT_MAX = 9999;
19264
+ /** A machine's report counts toward a phone's card this long; also the APNs `stale-date` offset. */
19265
+ const ACTIVITY_STALE_MS = 6e5;
19266
+ /** The directory re-pushes unchanged counts at most this often, so the stale date moves ahead. */
19267
+ const ACTIVITY_REFRESH_MS = 24e4;
19268
+ /** Live Activity pushes per account per minute, counted apart from alert pushes (NFR-1). */
19269
+ const ACTIVITY_PUSH_RATE_PER_MINUTE = 60;
18178
19270
  const FREE_MACHINE_LIMIT_MESSAGE = "The free account includes 3 machines";
18179
19271
  const NO_DIRECT_PATH_MESSAGE = "No direct path; install Tailscale or use the relay plan";
18180
19272
  const RELAY_CAP_MESSAGE = "Relay allowance used; install Tailscale or add 50 GB";
18181
19273
  const CLIENT_LIMIT_MESSAGE = "This account already has 5 phones. Remove one in the app or on a machine.";
19274
+ const CONNECTOR_LIMIT_MESSAGE = "This account already has 10 Overdeck connectors. Remove one in Settings → Anywhere → Bots.";
18182
19275
  /** WebSocket close codes the directory uses. */
18183
19276
  const CONNECT_CLOSE_CODES = {
18184
19277
  unauthorized: 4001,
@@ -18188,7 +19281,7 @@ const CONNECT_CLOSE_CODES = {
18188
19281
  /** Replaced by a newer socket for the same machine. */
18189
19282
  replaced: 4011,
18190
19283
  forgotten: 4012,
18191
- /** A sixth phone on one account (PAN-4823 D-2). */
19284
+ /** A sixth phone or an eleventh connector on one account (PAN-4823 D-2, PAN-4927 D-18). */
18192
19285
  clientLimit: 4013
18193
19286
  };
18194
19287
  //#endregion
@@ -18279,6 +19372,137 @@ const DirectoryResponse = effect.Schema.Struct({
18279
19372
  relay: effect.Schema.NullOr(RelayStatusView)
18280
19373
  });
18281
19374
  //#endregion
19375
+ //#region src/phone-pairing.ts
19376
+ /** The phone app's bundle id and private-use URI scheme (RFC 8252 §7.1). */
19377
+ const PHONE_APP_SCHEME = "ai.overdeck.app";
19378
+ const PHONE_PAIR_LINK_VERSION = 1;
19379
+ /** Everything before the fragment. Single slash after the colon. */
19380
+ const PHONE_PAIR_LINK_PREFIX = `${PHONE_APP_SCHEME}:/pair#`;
19381
+ const PHONE_PAIR_ENVIRONMENT_ID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
19382
+ const PHONE_PAIR_MACHINE_KEY_RE = /^[0-9a-f]{64}$/;
19383
+ const PHONE_PAIR_CODE_RE = /^odp_[0-9a-f]{64}$/;
19384
+ /** `ai.overdeck.app:/pair#v=1&e=<environmentId>&k=<machineKeyHex>&c=<code>`; throws on a malformed input. */
19385
+ function buildPhonePairLink(input) {
19386
+ if (!PHONE_PAIR_ENVIRONMENT_ID_RE.test(input.environmentId)) throw new Error("environmentId must be a lowercase UUID v4");
19387
+ if (!PHONE_PAIR_MACHINE_KEY_RE.test(input.machineKeyHex)) throw new Error("machineKeyHex must be 64 lowercase hex characters");
19388
+ if (!PHONE_PAIR_CODE_RE.test(input.code)) throw new Error("code must be an odp_ pairing code");
19389
+ return `${PHONE_PAIR_LINK_PREFIX}v=1&e=${input.environmentId}&k=${input.machineKeyHex}&c=${input.code}`;
19390
+ }
19391
+ /** The inverse of `buildPhonePairLink`: the link's fields, or null unless every part is well formed. Surrounding whitespace is ignored. */
19392
+ function parsePhonePairLink(text) {
19393
+ const link = text.trim();
19394
+ if (!link.startsWith(PHONE_PAIR_LINK_PREFIX)) return null;
19395
+ const params = new URLSearchParams(link.slice(PHONE_PAIR_LINK_PREFIX.length));
19396
+ const environmentId = params.get("e");
19397
+ const machineKeyHex = params.get("k");
19398
+ const code = params.get("c");
19399
+ if (params.get("v") !== String(1)) return null;
19400
+ if (environmentId === null || !PHONE_PAIR_ENVIRONMENT_ID_RE.test(environmentId)) return null;
19401
+ if (machineKeyHex === null || !PHONE_PAIR_MACHINE_KEY_RE.test(machineKeyHex)) return null;
19402
+ if (code === null || !PHONE_PAIR_CODE_RE.test(code)) return null;
19403
+ return {
19404
+ environmentId,
19405
+ machineKeyHex,
19406
+ code
19407
+ };
19408
+ }
19409
+ //#endregion
19410
+ //#region src/phone-notifications.ts
19411
+ const PHONE_NOTIFICATION_CATEGORIES = [
19412
+ "question",
19413
+ "plan",
19414
+ "permission",
19415
+ "finished",
19416
+ "failed",
19417
+ "stopped"
19418
+ ];
19419
+ const DEFAULT_PHONE_NOTIFICATION_PREFERENCES = {
19420
+ v: 1,
19421
+ pause: null,
19422
+ muted: []
19423
+ };
19424
+ function isPlainObject$1(value) {
19425
+ return typeof value === "object" && value !== null && !Array.isArray(value);
19426
+ }
19427
+ function parsePause(value) {
19428
+ if (value === null) return null;
19429
+ if (!isPlainObject$1(value)) return void 0;
19430
+ const until = value.until;
19431
+ if (until === null) return { until: null };
19432
+ if (typeof until !== "string" || Number.isNaN(Date.parse(until))) return void 0;
19433
+ return { until };
19434
+ }
19435
+ /** Null for anything that is not a v1 prefs object; drops unknown/duplicate `muted` entries; never throws. */
19436
+ function parsePhoneNotificationPreferences(value) {
19437
+ if (!isPlainObject$1(value)) return null;
19438
+ if (value.v !== 1) return null;
19439
+ const pause = parsePause(value.pause);
19440
+ if (pause === void 0) return null;
19441
+ const rawMuted = value.muted;
19442
+ if (!Array.isArray(rawMuted)) return null;
19443
+ return {
19444
+ v: 1,
19445
+ pause,
19446
+ muted: PHONE_NOTIFICATION_CATEGORIES.filter((category) => rawMuted.includes(category))
19447
+ };
19448
+ }
19449
+ /** Whether a notification of `category` may go to a phone with `prefs` at `nowMs` (D-3). */
19450
+ function notificationAllowed(prefs, category, nowMs) {
19451
+ if (prefs === null) return true;
19452
+ if (category === "test") return true;
19453
+ if (prefs.pause !== null && (prefs.pause.until === null || Date.parse(prefs.pause.until) > nowMs)) return false;
19454
+ if (category === "summary") return true;
19455
+ return !prefs.muted.includes(category);
19456
+ }
19457
+ //#endregion
19458
+ //#region src/connector-pairing.ts
19459
+ const CONNECTOR_PAIR_SCHEME = "overdeck-connector";
19460
+ const CONNECTOR_PAIR_LINK_VERSION = 1;
19461
+ /** Everything before the fragment. Single slash after the colon. */
19462
+ const CONNECTOR_PAIR_LINK_PREFIX = `${CONNECTOR_PAIR_SCHEME}:/pair#`;
19463
+ /** Longest machine name (after trim) the string carries in `n=` (PAN-5069 FR-8). */
19464
+ const CONNECTOR_PAIR_MACHINE_LABEL_MAX = 64;
19465
+ /**
19466
+ * `overdeck-connector:/pair#v=1&e=<environmentId>&k=<machineKeyHex>&c=<code>[&n=<machineLabel>]`; throws on a malformed input.
19467
+ * The label is trimmed, cut to 64 characters and percent-encoded with `'` as `%27`, so the string is safe inside single shell quotes.
19468
+ */
19469
+ function buildConnectorPairLink(input) {
19470
+ if (!PHONE_PAIR_ENVIRONMENT_ID_RE.test(input.environmentId)) throw new Error("environmentId must be a lowercase UUID v4");
19471
+ if (!PHONE_PAIR_MACHINE_KEY_RE.test(input.machineKeyHex)) throw new Error("machineKeyHex must be 64 lowercase hex characters");
19472
+ if (!PHONE_PAIR_CODE_RE.test(input.code)) throw new Error("code must be an odp_ pairing code");
19473
+ const link = `${CONNECTOR_PAIR_LINK_PREFIX}v=1&e=${input.environmentId}&k=${input.machineKeyHex}&c=${input.code}`;
19474
+ const label = input.machineLabel?.trim().slice(0, 64) ?? "";
19475
+ return label === "" ? link : `${link}&n=${encodeURIComponent(label).replace(/'/g, "%27")}`;
19476
+ }
19477
+ /**
19478
+ * The inverse of `buildConnectorPairLink`: the string's fields, or null unless every required part is well formed.
19479
+ * Surrounding whitespace is ignored. A missing, empty or over-long `n` only leaves `machineLabel` out; it never makes the parse fail.
19480
+ */
19481
+ function parseConnectorPairLink(text) {
19482
+ const link = text.trim();
19483
+ if (!link.startsWith(CONNECTOR_PAIR_LINK_PREFIX)) return null;
19484
+ const params = new URLSearchParams(link.slice(CONNECTOR_PAIR_LINK_PREFIX.length));
19485
+ const environmentId = params.get("e");
19486
+ const machineKeyHex = params.get("k");
19487
+ const code = params.get("c");
19488
+ if (params.get("v") !== String(1)) return null;
19489
+ if (environmentId === null || !PHONE_PAIR_ENVIRONMENT_ID_RE.test(environmentId)) return null;
19490
+ if (machineKeyHex === null || !PHONE_PAIR_MACHINE_KEY_RE.test(machineKeyHex)) return null;
19491
+ if (code === null || !PHONE_PAIR_CODE_RE.test(code)) return null;
19492
+ const machineLabel = params.get("n")?.trim() ?? "";
19493
+ if (machineLabel === "" || machineLabel.length > 64) return {
19494
+ environmentId,
19495
+ machineKeyHex,
19496
+ code
19497
+ };
19498
+ return {
19499
+ environmentId,
19500
+ machineKeyHex,
19501
+ code,
19502
+ machineLabel
19503
+ };
19504
+ }
19505
+ //#endregion
18282
19506
  //#region src/fleet-versions.ts
18283
19507
  const FleetInstallMode = effect.Schema.Literals([
18284
19508
  "npm-global",
@@ -18363,6 +19587,269 @@ const MachineVersionsReportSchema = effect.Schema.Struct({
18363
19587
  job: effect.Schema.NullOr(FleetUpdateJobSchema)
18364
19588
  });
18365
19589
  //#endregion
19590
+ //#region src/sharing-wire.ts
19591
+ const SHARED_WIRE_VERSION = 1;
19592
+ const SHARED_SCOPE_KINDS = ["conversation"];
19593
+ const SHARED_CHANNELS = [
19594
+ "control",
19595
+ "conversation",
19596
+ "drafts",
19597
+ "terminal",
19598
+ "presence"
19599
+ ];
19600
+ /** The longest data-channel message: 32,768 UTF-16 code units, at most 96 KiB of UTF-8. Longer envelopes are fragmented. */
19601
+ const SHARE_MAX_MESSAGE_CHARS = 32768;
19602
+ /** The longest encoded envelope ever sent or reassembled. */
19603
+ const SHARE_MAX_ENVELOPE_CHARS = 32 * 1024 * 1024;
19604
+ /** The longest envelope a host reassembles from a viewer on `control` or `drafts` (NFR-3). */
19605
+ const SHARE_MAX_INBOUND_ENVELOPE_CHARS = 65536;
19606
+ /** The longest shared prompt or draft, in UTF-16 code units (D-11). */
19607
+ const SHARED_PROMPT_MAX_CHARS = 8e3;
19608
+ /**
19609
+ * The longest single message a fragment can be: JSON escaping can turn each of a slice's
19610
+ * SHARE_MAX_MESSAGE_CHARS code units into six (`\u0000`), plus the chunk header.
19611
+ */
19612
+ const MAX_FRAGMENT_MESSAGE_CHARS = SHARE_MAX_MESSAGE_CHARS * 6 + 256;
19613
+ const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
19614
+ const isPositiveInteger = (value) => typeof value === "number" && Number.isSafeInteger(value) && value > 0;
19615
+ const isNonNegativeInteger = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
19616
+ /** Copies only the allow-listed fields. Never spreads the input and never sets `author`. */
19617
+ function toSharedMessage(message) {
19618
+ const shared = {
19619
+ id: message.id,
19620
+ role: message.role,
19621
+ text: message.text,
19622
+ createdAt: message.createdAt
19623
+ };
19624
+ if (typeof message.turnId === "string") shared.turnId = message.turnId;
19625
+ if (typeof message.completedAt === "string") shared.completedAt = message.completedAt;
19626
+ if (typeof message.streaming === "boolean") shared.streaming = message.streaming;
19627
+ if (typeof message.sequence === "number" && Number.isFinite(message.sequence)) shared.sequence = message.sequence;
19628
+ return shared;
19629
+ }
19630
+ /**
19631
+ * `null` when a shared prompt may be delivered; the refusal reason otherwise (D-9). A leading `/`, `!`
19632
+ * or `#` would reach a composer command, a shell command or a memory note, so it is refused.
19633
+ */
19634
+ function sharedPromptRefusal(text) {
19635
+ const trimmed = text.trim();
19636
+ if (trimmed.length === 0) return "invalid_prompt";
19637
+ if (text.length > 8e3) return "too_long";
19638
+ const first = trimmed[0];
19639
+ return first === "/" || first === "!" || first === "#" ? "invalid_prompt" : null;
19640
+ }
19641
+ /** A host → viewer DraftPayload rebuilt from its known keys, or `null` when `value` is not one. */
19642
+ function readDraftPayload(value) {
19643
+ if (!isRecord(value)) return null;
19644
+ const { authorGithubId, authorLogin, text, updatedAt } = value;
19645
+ if (!isPositiveInteger(authorGithubId)) return null;
19646
+ if (typeof authorLogin !== "string") return null;
19647
+ if (typeof text !== "string" || text.length > 8e3) return null;
19648
+ if (typeof updatedAt !== "number" || !Number.isFinite(updatedAt)) return null;
19649
+ return {
19650
+ authorGithubId,
19651
+ authorLogin,
19652
+ text,
19653
+ updatedAt
19654
+ };
19655
+ }
19656
+ /** A new envelope with exactly the six envelope keys, or `null` when `value` is not one. */
19657
+ function decodeEnvelope(value) {
19658
+ if (!isRecord(value)) return null;
19659
+ const { v, ch, streamId, seq, t } = value;
19660
+ if (!isPositiveInteger(v)) return null;
19661
+ if (typeof ch !== "string" || !SHARED_CHANNELS.includes(ch)) return null;
19662
+ if (typeof streamId !== "string" || streamId.length === 0) return null;
19663
+ if (!isPositiveInteger(seq)) return null;
19664
+ if (typeof t !== "number" || !Number.isFinite(t)) return null;
19665
+ if (!Object.prototype.hasOwnProperty.call(value, "payload")) return null;
19666
+ return {
19667
+ v,
19668
+ ch,
19669
+ streamId,
19670
+ seq,
19671
+ t,
19672
+ payload: value.payload
19673
+ };
19674
+ }
19675
+ /**
19676
+ * Encodes one envelope as the data-channel messages to send in order: one message, or `count`
19677
+ * fragments when the encoded envelope is longer than SHARE_MAX_MESSAGE_CHARS. Slicing can split a
19678
+ * UTF-16 surrogate pair across fragments; the reader joins the slices before parsing, so the pair is
19679
+ * whole again. Throws RangeError when the encoded envelope is longer than SHARE_MAX_ENVELOPE_CHARS.
19680
+ */
19681
+ function encodeSharedMessage(envelope, chunkId) {
19682
+ const text = JSON.stringify(envelope);
19683
+ if (text.length > 33554432) throw new RangeError("shared envelope too large");
19684
+ if (text.length <= 32768) return [text];
19685
+ const count = Math.ceil(text.length / SHARE_MAX_MESSAGE_CHARS);
19686
+ const parts = [];
19687
+ for (let index = 0; index < count; index++) {
19688
+ const data = text.slice(index * SHARE_MAX_MESSAGE_CHARS, (index + 1) * SHARE_MAX_MESSAGE_CHARS);
19689
+ parts.push(JSON.stringify({
19690
+ v: 1,
19691
+ chunk: {
19692
+ id: chunkId,
19693
+ index,
19694
+ count
19695
+ },
19696
+ data
19697
+ }));
19698
+ }
19699
+ return parts;
19700
+ }
19701
+ /**
19702
+ * Reads one channel's messages in arrival order and reassembles fragmented envelopes. One reader per
19703
+ * channel. `maxEnvelopeChars` caps what one envelope may grow to; a host reading a viewer passes
19704
+ * SHARE_MAX_INBOUND_ENVELOPE_CHARS so one viewer cannot make it buffer megabytes.
19705
+ */
19706
+ var SharedChannelReader = class {
19707
+ partial = null;
19708
+ constructor(maxEnvelopeChars = SHARE_MAX_ENVELOPE_CHARS) {
19709
+ this.maxEnvelopeChars = maxEnvelopeChars;
19710
+ }
19711
+ read(text) {
19712
+ if (text.length > Math.max(this.maxEnvelopeChars, MAX_FRAGMENT_MESSAGE_CHARS)) return {
19713
+ kind: "invalid",
19714
+ reason: "too_large"
19715
+ };
19716
+ let value;
19717
+ try {
19718
+ value = JSON.parse(text);
19719
+ } catch {
19720
+ return {
19721
+ kind: "invalid",
19722
+ reason: "not_json"
19723
+ };
19724
+ }
19725
+ if (isRecord(value) && Object.prototype.hasOwnProperty.call(value, "chunk")) return this.readFragment(value);
19726
+ if (text.length > this.maxEnvelopeChars) return {
19727
+ kind: "invalid",
19728
+ reason: "too_large"
19729
+ };
19730
+ return decoded(value);
19731
+ }
19732
+ readFragment(value) {
19733
+ const { chunk, data } = value;
19734
+ if (!isRecord(chunk) || typeof data !== "string") return {
19735
+ kind: "invalid",
19736
+ reason: "not_envelope"
19737
+ };
19738
+ const { id, index, count } = chunk;
19739
+ if (typeof id !== "number" || !Number.isFinite(id) || !isNonNegativeInteger(index) || !isNonNegativeInteger(count) || index >= count) return {
19740
+ kind: "invalid",
19741
+ reason: "not_envelope"
19742
+ };
19743
+ if (count * 32768 > this.maxEnvelopeChars + 32768 || data.length > 32768) {
19744
+ this.partial = null;
19745
+ return {
19746
+ kind: "invalid",
19747
+ reason: "too_large"
19748
+ };
19749
+ }
19750
+ const partial = this.partial;
19751
+ if (partial === null) {
19752
+ if (index !== 0) return {
19753
+ kind: "invalid",
19754
+ reason: "chunk_out_of_order"
19755
+ };
19756
+ this.partial = {
19757
+ id,
19758
+ count,
19759
+ parts: [data]
19760
+ };
19761
+ } else {
19762
+ if (id !== partial.id || count !== partial.count || index !== partial.parts.length) {
19763
+ this.partial = null;
19764
+ return {
19765
+ kind: "invalid",
19766
+ reason: "chunk_out_of_order"
19767
+ };
19768
+ }
19769
+ partial.parts.push(data);
19770
+ }
19771
+ const current = this.partial;
19772
+ if (current === null || current.parts.length < current.count) return { kind: "pending" };
19773
+ this.partial = null;
19774
+ const text = current.parts.join("");
19775
+ if (text.length > this.maxEnvelopeChars) return {
19776
+ kind: "invalid",
19777
+ reason: "too_large"
19778
+ };
19779
+ let joined;
19780
+ try {
19781
+ joined = JSON.parse(text);
19782
+ } catch {
19783
+ return {
19784
+ kind: "invalid",
19785
+ reason: "not_json"
19786
+ };
19787
+ }
19788
+ return decoded(joined);
19789
+ }
19790
+ };
19791
+ function decoded(value) {
19792
+ const envelope = decodeEnvelope(value);
19793
+ return envelope === null ? {
19794
+ kind: "invalid",
19795
+ reason: "not_envelope"
19796
+ } : {
19797
+ kind: "envelope",
19798
+ envelope
19799
+ };
19800
+ }
19801
+ /** Detects `seq` gaps per channel and stream. A gap is reported once; tracking resumes after it. */
19802
+ var SeqTracker = class {
19803
+ expected = /* @__PURE__ */ new Map();
19804
+ observe(ch, streamId, seq) {
19805
+ const key = `${ch}\n${streamId}`;
19806
+ const expected = this.expected.get(key) ?? 1;
19807
+ this.expected.set(key, seq + 1);
19808
+ return seq === expected ? { ok: true } : {
19809
+ ok: false,
19810
+ expected,
19811
+ got: seq
19812
+ };
19813
+ }
19814
+ };
19815
+ /** Agrees on `min(local.v, remote.v)` when the remote hello is well formed and both sides support the shared scope. */
19816
+ function negotiateHello(local, remote) {
19817
+ if (!isRecord(remote)) return {
19818
+ ok: false,
19819
+ code: "invalid_hello"
19820
+ };
19821
+ const { v, scopeKinds, scope } = remote;
19822
+ if (!isPositiveInteger(v)) return {
19823
+ ok: false,
19824
+ code: "invalid_hello"
19825
+ };
19826
+ if (!Array.isArray(scopeKinds) || !scopeKinds.every((kind) => typeof kind === "string")) return {
19827
+ ok: false,
19828
+ code: "invalid_hello"
19829
+ };
19830
+ if (!isRecord(scope) || typeof scope.kind !== "string" || typeof scope.conversationId !== "string") return {
19831
+ ok: false,
19832
+ code: "invalid_hello"
19833
+ };
19834
+ const agreed = Math.min(local.v, v);
19835
+ if (agreed < 1) return {
19836
+ ok: false,
19837
+ code: "version_unsupported"
19838
+ };
19839
+ if (!scopeKinds.includes(local.scope.kind) || !local.scopeKinds.includes(scope.kind)) return {
19840
+ ok: false,
19841
+ code: "scope_kind_unsupported"
19842
+ };
19843
+ if (scope.kind !== local.scope.kind || scope.conversationId !== local.scope.conversationId) return {
19844
+ ok: false,
19845
+ code: "invalid_hello"
19846
+ };
19847
+ return {
19848
+ ok: true,
19849
+ v: agreed
19850
+ };
19851
+ }
19852
+ //#endregion
18366
19853
  //#region src/color-theme.ts
18367
19854
  const TERMINAL_PALETTE_KEYS = [
18368
19855
  "background",
@@ -18682,6 +20169,10 @@ function presetToCron(preset) {
18682
20169
  //#endregion
18683
20170
  exports.ACP_BEHAVIOR = ACP_BEHAVIOR;
18684
20171
  exports.ACP_CAPABILITIES = ACP_CAPABILITIES;
20172
+ exports.ACTIVITY_COUNT_MAX = ACTIVITY_COUNT_MAX;
20173
+ exports.ACTIVITY_PUSH_RATE_PER_MINUTE = ACTIVITY_PUSH_RATE_PER_MINUTE;
20174
+ exports.ACTIVITY_REFRESH_MS = ACTIVITY_REFRESH_MS;
20175
+ exports.ACTIVITY_STALE_MS = ACTIVITY_STALE_MS;
18685
20176
  exports.AGENT_ROLES = AGENT_ROLES;
18686
20177
  exports.APPROVAL_TTL_MS = APPROVAL_TTL_MS;
18687
20178
  exports.Activity = Activity;
@@ -18764,6 +20255,12 @@ exports.COMPANION_TERMINAL_OPEN_BODY_KEYS = COMPANION_TERMINAL_OPEN_BODY_KEYS;
18764
20255
  exports.COMPOSER_COMMAND_INSERT_OVERRIDES = COMPOSER_COMMAND_INSERT_OVERRIDES;
18765
20256
  exports.COMPOSER_COMMAND_MANIFEST = COMPOSER_COMMAND_MANIFEST;
18766
20257
  exports.COMPOSER_COMMAND_VARIANTS = COMPOSER_COMMAND_VARIANTS;
20258
+ exports.CONNECTOR_LIMIT = CONNECTOR_LIMIT;
20259
+ exports.CONNECTOR_LIMIT_MESSAGE = CONNECTOR_LIMIT_MESSAGE;
20260
+ exports.CONNECTOR_PAIR_LINK_PREFIX = CONNECTOR_PAIR_LINK_PREFIX;
20261
+ exports.CONNECTOR_PAIR_LINK_VERSION = CONNECTOR_PAIR_LINK_VERSION;
20262
+ exports.CONNECTOR_PAIR_MACHINE_LABEL_MAX = CONNECTOR_PAIR_MACHINE_LABEL_MAX;
20263
+ exports.CONNECTOR_PAIR_SCHEME = CONNECTOR_PAIR_SCHEME;
18767
20264
  exports.CONNECT_CLOSE_CODES = CONNECT_CLOSE_CODES;
18768
20265
  exports.CONNECT_PROTOCOL_VERSION = CONNECT_PROTOCOL_VERSION;
18769
20266
  exports.CONTEXT_LAYER_KINDS = CONTEXT_LAYER_KINDS;
@@ -18815,6 +20312,7 @@ exports.CostEventRecordedEvent = CostEventRecordedEvent;
18815
20312
  exports.DEFAULT_EFFORT = DEFAULT_EFFORT;
18816
20313
  exports.DEFAULT_MAX_MEMORY_OBSERVATIONS_PER_ISSUE = DEFAULT_MAX_MEMORY_OBSERVATIONS_PER_ISSUE;
18817
20314
  exports.DEFAULT_MAX_TURN_DIFF_SUMMARIES_PER_AGENT = DEFAULT_MAX_TURN_DIFF_SUMMARIES_PER_AGENT;
20315
+ exports.DEFAULT_PHONE_NOTIFICATION_PREFERENCES = DEFAULT_PHONE_NOTIFICATION_PREFERENCES;
18818
20316
  exports.DashboardLifecycleCompletedEvent = DashboardLifecycleCompletedEvent;
18819
20317
  exports.DashboardLifecycleFailedEvent = DashboardLifecycleFailedEvent;
18820
20318
  exports.DashboardLifecycleStartedEvent = DashboardLifecycleStartedEvent;
@@ -19027,6 +20525,13 @@ exports.OrderBookLane = OrderBookLane;
19027
20525
  exports.OrderBookPosture = OrderBookPosture;
19028
20526
  exports.OrderBookSettings = OrderBookSettings;
19029
20527
  exports.OrderBookStatus = OrderBookStatus;
20528
+ exports.PHONE_APP_SCHEME = PHONE_APP_SCHEME;
20529
+ exports.PHONE_NOTIFICATION_CATEGORIES = PHONE_NOTIFICATION_CATEGORIES;
20530
+ exports.PHONE_PAIR_CODE_RE = PHONE_PAIR_CODE_RE;
20531
+ exports.PHONE_PAIR_ENVIRONMENT_ID_RE = PHONE_PAIR_ENVIRONMENT_ID_RE;
20532
+ exports.PHONE_PAIR_LINK_PREFIX = PHONE_PAIR_LINK_PREFIX;
20533
+ exports.PHONE_PAIR_LINK_VERSION = PHONE_PAIR_LINK_VERSION;
20534
+ exports.PHONE_PAIR_MACHINE_KEY_RE = PHONE_PAIR_MACHINE_KEY_RE;
19030
20535
  exports.PIPELINE_MEMBERSHIP_LOADING_CODE = PIPELINE_MEMBERSHIP_LOADING_CODE;
19031
20536
  exports.PRIME_AGENT_BEHAVIOR = PRIME_AGENT_BEHAVIOR;
19032
20537
  exports.PRIME_AGENT_CAPABILITIES = PRIME_AGENT_CAPABILITIES;
@@ -19100,6 +20605,7 @@ exports.RestartGateKind = RestartGateKind;
19100
20605
  exports.RestartGateOutcome = RestartGateOutcome;
19101
20606
  exports.RestartGateRequest = RestartGateRequest;
19102
20607
  exports.RestartGateSnapshot = RestartGateSnapshot;
20608
+ exports.RestartHold = RestartHold;
19103
20609
  exports.ReviewApprovedEvent = ReviewApprovedEvent;
19104
20610
  exports.ReviewCoordinatorDiedEvent = ReviewCoordinatorDiedEvent;
19105
20611
  exports.ReviewCoordinatorStartedEvent = ReviewCoordinatorStartedEvent;
@@ -19115,6 +20621,13 @@ exports.Role = Role;
19115
20621
  exports.RouteKind = RouteKind;
19116
20622
  exports.RouteSource = RouteSource;
19117
20623
  exports.SCHEDULE_PRESET_DAYS = SCHEDULE_PRESET_DAYS;
20624
+ exports.SHARED_CHANNELS = SHARED_CHANNELS;
20625
+ exports.SHARED_PROMPT_MAX_CHARS = SHARED_PROMPT_MAX_CHARS;
20626
+ exports.SHARED_SCOPE_KINDS = SHARED_SCOPE_KINDS;
20627
+ exports.SHARED_WIRE_VERSION = SHARED_WIRE_VERSION;
20628
+ exports.SHARE_MAX_ENVELOPE_CHARS = SHARE_MAX_ENVELOPE_CHARS;
20629
+ exports.SHARE_MAX_INBOUND_ENVELOPE_CHARS = SHARE_MAX_INBOUND_ENVELOPE_CHARS;
20630
+ exports.SHARE_MAX_MESSAGE_CHARS = SHARE_MAX_MESSAGE_CHARS;
19118
20631
  exports.SINGLETON_AGENT_IDS = SINGLETON_AGENT_IDS;
19119
20632
  exports.SSH_HELPER_PROTOCOL = SSH_HELPER_PROTOCOL;
19120
20633
  exports.SSH_MACHINE_ERROR_CODES = SSH_MACHINE_ERROR_CODES;
@@ -19132,6 +20645,7 @@ exports.ScopedRef = ScopedRef;
19132
20645
  exports.ScopedTerminalRef = ScopedTerminalRef;
19133
20646
  exports.SearchConversationsRpc = SearchConversationsRpc;
19134
20647
  exports.SendTerminalInputRpc = SendTerminalInputRpc;
20648
+ exports.SeqTracker = SeqTracker;
19135
20649
  exports.SequenceNumber = SequenceNumber;
19136
20650
  exports.ServiceHealthSnapshot = ServiceHealthSnapshot;
19137
20651
  exports.ServiceHealthStatus = ServiceHealthStatus;
@@ -19143,6 +20657,7 @@ exports.SessionsFeedFacetsSnapshot = SessionsFeedFacetsSnapshot;
19143
20657
  exports.SessionsFeedRowSnapshot = SessionsFeedRowSnapshot;
19144
20658
  exports.SessionsFeedSource = SessionsFeedSource;
19145
20659
  exports.ShadowInferenceUpdateEvent = ShadowInferenceUpdateEvent;
20660
+ exports.SharedChannelReader = SharedChannelReader;
19146
20661
  exports.ShellOpenInBrowserRpc = ShellOpenInBrowserRpc;
19147
20662
  exports.ShellOpenInEditorRpc = ShellOpenInEditorRpc;
19148
20663
  exports.SpecialistCompletedEvent = SpecialistCompletedEvent;
@@ -19175,6 +20690,7 @@ exports.SystemHeartbeatEvent = SystemHeartbeatEvent;
19175
20690
  exports.TELEMETRY_CLI_VERBS = TELEMETRY_CLI_VERBS;
19176
20691
  exports.TELEMETRY_EVENT_CATALOG = TELEMETRY_EVENT_CATALOG;
19177
20692
  exports.TELEMETRY_EVENT_NAMES = TELEMETRY_EVENT_NAMES;
20693
+ exports.TELEMETRY_INSTALL_KINDS = TELEMETRY_INSTALL_KINDS;
19178
20694
  exports.TELEMETRY_PROPERTY_DOMAINS = TELEMETRY_PROPERTY_DOMAINS;
19179
20695
  exports.TERMINAL_BACKEND_NAMES = TERMINAL_BACKEND_NAMES;
19180
20696
  exports.TOOL_BODY_INLINE_MAX_BYTES = TOOL_BODY_INLINE_MAX_BYTES;
@@ -19215,20 +20731,28 @@ exports.applyEvents = applyEvents;
19215
20731
  exports.applyIssueDelta = applyIssueDelta;
19216
20732
  exports.bucketQuotaPoints = bucketQuotaPoints;
19217
20733
  exports.bucketQuotaRemaining = bucketQuotaRemaining;
20734
+ exports.bucketRecoveryMs = bucketRecoveryMs;
20735
+ exports.bucketRelayBytes = bucketRelayBytes;
20736
+ exports.bucketRequestStatus = bucketRequestStatus;
20737
+ exports.buildConnectorPairLink = buildConnectorPairLink;
20738
+ exports.buildPhonePairLink = buildPhonePairLink;
19218
20739
  exports.builtinFor = builtinFor;
19219
20740
  exports.canonicalPullRequestUrl = canonicalPullRequestUrl;
20741
+ exports.clientRouteOf = clientRouteOf;
19220
20742
  exports.companionTerminalKindFor = companionTerminalKindFor;
19221
20743
  exports.compareEffort = compareEffort;
19222
20744
  exports.compareFleetBinaries = compareFleetBinaries;
19223
20745
  exports.compareIssueIds = compareIssueIds;
19224
20746
  exports.compareTimelineKeys = compareTimelineKeys;
19225
20747
  exports.createIssueDelta = createIssueDelta;
20748
+ exports.decodeEnvelope = decodeEnvelope;
19226
20749
  exports.decodeFlywheelDerivedStatus = decodeFlywheelDerivedStatus;
19227
20750
  exports.decodeFlywheelStats = decodeFlywheelStats;
19228
20751
  exports.decodeTimelineCursor = decodeTimelineCursor;
19229
20752
  exports.deriveProjectCi = deriveProjectCi;
19230
20753
  exports.effectiveTerminalPalette = effectiveTerminalPalette;
19231
20754
  exports.encodeFlywheelStats = encodeFlywheelStats;
20755
+ exports.encodeSharedMessage = encodeSharedMessage;
19232
20756
  exports.encodeTimelineCursor = encodeTimelineCursor;
19233
20757
  exports.formatMachineLoad = formatMachineLoad;
19234
20758
  exports.formatMachineProfile = formatMachineProfile;
@@ -19253,26 +20777,35 @@ exports.isTerminalBackendName = isTerminalBackendName;
19253
20777
  exports.isTerminalTurnDiffSummaryStatus = isTerminalTurnDiffSummaryStatus;
19254
20778
  exports.laneActivityOf = laneActivityOf;
19255
20779
  exports.linkedConversationName = linkedConversationName;
20780
+ exports.negotiateHello = negotiateHello;
19256
20781
  exports.normalizeChannelReplyPayload = normalizeChannelReplyPayload;
19257
20782
  exports.normalizeColorTheme = normalizeColorTheme;
19258
20783
  exports.normalizeHarnessName = normalizeHarnessName;
20784
+ exports.notificationAllowed = notificationAllowed;
19259
20785
  exports.omitTurnDiffSummariesForAgent = omitTurnDiffSummariesForAgent;
19260
20786
  exports.overdeckInstallCommand = overdeckInstallCommand;
19261
20787
  exports.paneAgentKey = paneAgentKey;
20788
+ exports.parseConnectorPairLink = parseConnectorPairLink;
19262
20789
  exports.parseLinkedConversationName = parseLinkedConversationName;
20790
+ exports.parsePhoneNotificationPreferences = parsePhoneNotificationPreferences;
20791
+ exports.parsePhonePairLink = parsePhonePairLink;
19263
20792
  exports.parsePullRequestRef = parsePullRequestRef;
19264
20793
  exports.parseTrackerIssueUrl = parseTrackerIssueUrl;
20794
+ exports.presenceForPaneState = presenceForPaneState;
19265
20795
  exports.presetToCron = presetToCron;
19266
20796
  exports.projectLegacySystemHealthSummary = projectLegacySystemHealthSummary;
20797
+ exports.readDraftPayload = readDraftPayload;
19267
20798
  exports.readableForeground = readableForeground;
19268
20799
  exports.repoFromRemoteUrl = repoFromRemoteUrl;
19269
20800
  exports.resolveEffectivePullRequest = resolveEffectivePullRequest;
19270
20801
  exports.resolveTrackerIssueId = resolveTrackerIssueId;
20802
+ exports.sharedPromptRefusal = sharedPromptRefusal;
19271
20803
  exports.slugifyThemeId = slugifyThemeId;
19272
20804
  exports.syncSnapshot = syncSnapshot;
19273
20805
  exports.timelineKeyOfMessage = timelineKeyOfMessage;
19274
20806
  exports.timelineKeyOfWork = timelineKeyOfWork;
19275
20807
  exports.toOpaqueHex = toOpaqueHex;
20808
+ exports.toSharedMessage = toSharedMessage;
19276
20809
  exports.trimMemoryObservations = trimMemoryObservations;
19277
20810
  exports.trimTurnDiffSummaries = trimTurnDiffSummaries;
19278
20811
  exports.withPaneLivenessAlias = withPaneLivenessAlias;