openmeld 0.3.232 → 0.3.234

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.
Files changed (110) hide show
  1. package/dist/{add-me-membership-ChntsjGm.js → add-me-membership-CmHUjDvu.js} +2 -2
  2. package/dist/{add-me-membership-ChntsjGm.js.map → add-me-membership-CmHUjDvu.js.map} +1 -1
  3. package/dist/{agents-DruPcNSg.js → agents-CNW1dony.js} +9 -9
  4. package/dist/{agents-DruPcNSg.js.map → agents-CNW1dony.js.map} +1 -1
  5. package/dist/{api-client-foundation-CDj_9Rks.js → api-client-foundation-BHjffwwr.js} +1 -1
  6. package/dist/{api-client-foundation-EZpFLGVC.js → api-client-foundation-D6zHrrGV.js} +3 -3
  7. package/dist/{api-client-foundation-EZpFLGVC.js.map → api-client-foundation-D6zHrrGV.js.map} +1 -1
  8. package/dist/auth-session-CCLabxRT.js +4 -0
  9. package/dist/{auth-session-DhSHCYvl.js → auth-session-CjxqNKvh.js} +4 -4
  10. package/dist/{auth-session-DhSHCYvl.js.map → auth-session-CjxqNKvh.js.map} +1 -1
  11. package/dist/{channel-tvFZSSVr.js → channel-BW2_rI6u.js} +4 -4
  12. package/dist/{channel-tvFZSSVr.js.map → channel-BW2_rI6u.js.map} +1 -1
  13. package/dist/{cli-binary-manifest-Bjf6T7Ef.js → cli-binary-manifest-ETxqCzfS.js} +8 -1
  14. package/dist/cli-binary-manifest-ETxqCzfS.js.map +1 -0
  15. package/dist/{command-0yoZa1GT.js → command-9Iorb5GA.js} +16 -16
  16. package/dist/{command-0yoZa1GT.js.map → command-9Iorb5GA.js.map} +1 -1
  17. package/dist/{computer-connection-CoBDorh6.js → computer-connection-LX1R7jD0.js} +2 -2
  18. package/dist/{computer-connection-CoBDorh6.js.map → computer-connection-LX1R7jD0.js.map} +1 -1
  19. package/dist/{computer-connection-review-Dy7p1LXZ.js → computer-connection-review-CeOHkloT.js} +5 -5
  20. package/dist/{computer-connection-review-Dy7p1LXZ.js.map → computer-connection-review-CeOHkloT.js.map} +1 -1
  21. package/dist/{computer-disconnect-4Ks_DVXV.js → computer-disconnect-CXDO8zgT.js} +7 -7
  22. package/dist/{computer-disconnect-4Ks_DVXV.js.map → computer-disconnect-CXDO8zgT.js.map} +1 -1
  23. package/dist/{computer-setup-continuation-ZcQb7MvI.js → computer-setup-continuation-XgvjM0jF.js} +3 -3
  24. package/dist/{computer-setup-continuation-ZcQb7MvI.js.map → computer-setup-continuation-XgvjM0jF.js.map} +1 -1
  25. package/dist/{context-BPIoofMa.js → context-D3GnSqg8.js} +3 -3
  26. package/dist/{context-BPIoofMa.js.map → context-D3GnSqg8.js.map} +1 -1
  27. package/dist/{control-plane-rTE2rHZ5.js → control-plane-QqGL-jtT.js} +2 -2
  28. package/dist/{control-plane-rTE2rHZ5.js.map → control-plane-QqGL-jtT.js.map} +1 -1
  29. package/dist/{daemon-device-id-DDazRZUV.js → daemon-device-id-OMqh2F9_.js} +5 -5
  30. package/dist/{daemon-device-id-DDazRZUV.js.map → daemon-device-id-OMqh2F9_.js.map} +1 -1
  31. package/dist/{daemon-lifecycle-journal-CRxQL9m6.js → daemon-lifecycle-journal-Dq8W9V9C.js} +6 -6
  32. package/dist/{daemon-lifecycle-journal-CRxQL9m6.js.map → daemon-lifecycle-journal-Dq8W9V9C.js.map} +1 -1
  33. package/dist/{daemon-service-runtime-BTzL0w6s.js → daemon-service-runtime-B-x4bBKx.js} +4 -4
  34. package/dist/{daemon-service-runtime-BTzL0w6s.js.map → daemon-service-runtime-B-x4bBKx.js.map} +1 -1
  35. package/dist/{daemon-service-update-coordinator-BDs0p4bA.js → daemon-service-update-coordinator-Brv_30Kn.js} +20 -18
  36. package/dist/{daemon-service-update-coordinator-BDs0p4bA.js.map → daemon-service-update-coordinator-Brv_30Kn.js.map} +1 -1
  37. package/dist/{dispatch-owned-runtime-CK2YJ2Oo.js → dispatch-owned-runtime-Czq270vy.js} +52 -619
  38. package/dist/dispatch-owned-runtime-Czq270vy.js.map +1 -0
  39. package/dist/{dist-Bw6OBFYo.js → dist-CJL7LE-y.js} +203 -362
  40. package/dist/dist-CJL7LE-y.js.map +1 -0
  41. package/dist/{dist--TaSMxQz.js → dist-Ccpvj1tf.js} +3 -3
  42. package/dist/{dist--TaSMxQz.js.map → dist-Ccpvj1tf.js.map} +1 -1
  43. package/dist/{dist-B12upl5l.js → dist-MpN-h8da.js} +1 -1
  44. package/dist/{elapsed-time-C3nfbdd9.js → elapsed-time-BSphCejK.js} +6 -6
  45. package/dist/{elapsed-time-C3nfbdd9.js.map → elapsed-time-BSphCejK.js.map} +1 -1
  46. package/dist/{entry-De__5RVq.js → entry-CDablKgv.js} +7 -7
  47. package/dist/{entry-De__5RVq.js.map → entry-CDablKgv.js.map} +1 -1
  48. package/dist/{installation-inventory-Bq8iZfSa.js → installation-inventory-CRnah3Xf.js} +3 -3
  49. package/dist/{installation-inventory-Bq8iZfSa.js.map → installation-inventory-CRnah3Xf.js.map} +1 -1
  50. package/dist/{installer-C7iSAOSz.js → installer-BYBrLBth.js} +2 -2
  51. package/dist/{installer-C7iSAOSz.js.map → installer-BYBrLBth.js.map} +1 -1
  52. package/dist/{local-components-DleLEzSU.js → local-components-DJiMS67S.js} +36 -3
  53. package/dist/local-components-DJiMS67S.js.map +1 -0
  54. package/dist/{meta-api-BpwJWE22.js → meta-api-ClHCkzZB.js} +4 -4
  55. package/dist/{meta-api-BpwJWE22.js.map → meta-api-ClHCkzZB.js.map} +1 -1
  56. package/dist/{openmeld-C0OSZJtn.js → openmeld-Yz7J0OaB.js} +32 -32
  57. package/dist/{openmeld-C0OSZJtn.js.map → openmeld-Yz7J0OaB.js.map} +1 -1
  58. package/dist/openmeld-dev-environment-DwdvL7jg.js +24 -0
  59. package/dist/openmeld-dev-environment-DwdvL7jg.js.map +1 -0
  60. package/dist/openmeld-dev.js +1 -19
  61. package/dist/openmeld-dev.js.map +1 -1
  62. package/dist/{openmeld-maintenance-worker-DY90mkWW.js → openmeld-maintenance-worker-CVjbc-dv.js} +9 -9
  63. package/dist/{openmeld-maintenance-worker-DY90mkWW.js.map → openmeld-maintenance-worker-CVjbc-dv.js.map} +1 -1
  64. package/dist/{openmeld-tools-update-join-DgzNuaDy.js → openmeld-tools-update-join-Em7DfQt6.js} +4 -4
  65. package/dist/{openmeld-tools-update-join-DgzNuaDy.js.map → openmeld-tools-update-join-Em7DfQt6.js.map} +1 -1
  66. package/dist/{openmeld-tools-update-process-frame-DbEZ3fEh.js → openmeld-tools-update-process-frame-Csy2XKUf.js} +1 -1
  67. package/dist/{openmeld-tools-update-process-frame-BtFKp70p.js → openmeld-tools-update-process-frame-YLOS82E3.js} +2 -2
  68. package/dist/{openmeld-tools-update-process-frame-BtFKp70p.js.map → openmeld-tools-update-process-frame-YLOS82E3.js.map} +1 -1
  69. package/dist/openmeld.js +5 -5
  70. package/dist/{prepare-provider-runtime-BGdfbFyZ.js → prepare-provider-runtime-Bf2GBijn.js} +537 -213
  71. package/dist/prepare-provider-runtime-Bf2GBijn.js.map +1 -0
  72. package/dist/{prepare-session-executor-CA1gq8dR.js → prepare-session-executor-D8Vbyoq4.js} +19 -19
  73. package/dist/{prepare-session-executor-CA1gq8dR.js.map → prepare-session-executor-D8Vbyoq4.js.map} +1 -1
  74. package/dist/{process-channel-C1wRGUmk.js → process-channel-CTPL81j6.js} +2 -2
  75. package/dist/{process-channel-C1wRGUmk.js.map → process-channel-CTPL81j6.js.map} +1 -1
  76. package/dist/{runtime-DFlEdls4.js → runtime-aUrBNKSl.js} +7860 -7249
  77. package/dist/runtime-aUrBNKSl.js.map +1 -0
  78. package/dist/{runtime-agent-controller-reporting-submission-C_xD2A-P.js → runtime-agent-controller-reporting-submission-BJY9cLyh.js} +146 -70
  79. package/dist/runtime-agent-controller-reporting-submission-BJY9cLyh.js.map +1 -0
  80. package/dist/{runtime-transport-DH8Ks-AU.js → runtime-transport-DyBmX7ds.js} +569 -30
  81. package/dist/runtime-transport-DyBmX7ds.js.map +1 -0
  82. package/dist/{service-KHA_Yv8q.js → service-CMNaJrvV.js} +105 -39
  83. package/dist/service-CMNaJrvV.js.map +1 -0
  84. package/dist/{service-account-authorization-BHWs8cRP.js → service-account-authorization-CdyvPbvg.js} +2 -2
  85. package/dist/{service-account-authorization-BHWs8cRP.js.map → service-account-authorization-CdyvPbvg.js.map} +1 -1
  86. package/dist/{service-account-control-BcHjpVid.js → service-account-control-jnKTjLAR.js} +9 -9
  87. package/dist/{service-account-control-BcHjpVid.js.map → service-account-control-jnKTjLAR.js.map} +1 -1
  88. package/dist/{service-control-capabilities-B4433dGT.js → service-control-capabilities-CRsFO-Jf.js} +3 -3
  89. package/dist/{service-control-capabilities-B4433dGT.js.map → service-control-capabilities-CRsFO-Jf.js.map} +1 -1
  90. package/dist/{service-control-capabilities-DTKD2-o0.js → service-control-capabilities-DpJNUd1S.js} +1 -1
  91. package/dist/{state-iJqU2XWw.js → state-CON1kJsS.js} +2 -2
  92. package/dist/{state-iJqU2XWw.js.map → state-CON1kJsS.js.map} +1 -1
  93. package/dist/{runtime-reporting-health-state-_bvJcV1y.js → updates-api-BpWiCpAo.js} +378 -209
  94. package/dist/updates-api-BpWiCpAo.js.map +1 -0
  95. package/dist/{upgrade-DlBDEvs4.js → upgrade-Bdh732dG.js} +8 -8
  96. package/dist/{upgrade-DlBDEvs4.js.map → upgrade-Bdh732dG.js.map} +1 -1
  97. package/dist/upgrade-frLu7pCB.js +4 -0
  98. package/package.json +13 -13
  99. package/dist/auth-session-BOG3gV2K2.js +0 -4
  100. package/dist/cli-binary-manifest-Bjf6T7Ef.js.map +0 -1
  101. package/dist/dispatch-owned-runtime-CK2YJ2Oo.js.map +0 -1
  102. package/dist/dist-Bw6OBFYo.js.map +0 -1
  103. package/dist/local-components-DleLEzSU.js.map +0 -1
  104. package/dist/prepare-provider-runtime-BGdfbFyZ.js.map +0 -1
  105. package/dist/runtime-DFlEdls4.js.map +0 -1
  106. package/dist/runtime-agent-controller-reporting-submission-C_xD2A-P.js.map +0 -1
  107. package/dist/runtime-reporting-health-state-_bvJcV1y.js.map +0 -1
  108. package/dist/runtime-transport-DH8Ks-AU.js.map +0 -1
  109. package/dist/service-KHA_Yv8q.js.map +0 -1
  110. package/dist/upgrade-CuzsgsKh.js +0 -4
@@ -1 +1 @@
1
- {"version":3,"file":"elapsed-time-C3nfbdd9.js","names":["packageJson","assertNever"],"sources":["../src/runtime/agent-overview-payload.ts","../src/runtime/dual-view-guide.ts","../src/runtime/dual-view-guide-display.ts","../src/runtime/dual-view-guide-error.ts","../src/command-contracts/helpers.ts","../src/agents/builtin-selection-contract.ts","../src/auth/login-request-contract.ts","../src/command-contracts/service-control-target.ts","../src/runtime/cli-version.ts","../src/skills/target-selection-contract.ts","../src/space/add-members-progress-contract.ts","../src/space/member-selection-contract.ts","../src/ui/root-entry-catalog.ts","../src/command-contracts/registry.ts","../src/runtime/dual-view-guide-catalog.ts","../src/runtime/interaction.ts","../src/local-service/maintenance/openmeld-tools-update-operation.ts","../src/system/local-service-install-attention.ts","../src/ui/elapsed-time.ts"],"sourcesContent":["import {\n formatInlineOpenMeldCliCommands,\n formatOpenMeldCliCommands,\n formatOpenMeldCliLine,\n} from \"./cli-entry-command\";\n\ntype AgentOverviewHumanActionRequired =\n | boolean\n | {\n possible: boolean;\n steps: string[];\n };\n\ntype AgentOverviewPayload = {\n summary: string;\n commands: string[];\n notes: string[];\n humanActionRequired: AgentOverviewHumanActionRequired;\n};\n\nexport function formatAgentOverviewPayload<T extends AgentOverviewPayload>(\n payload: T\n): T {\n return {\n ...payload,\n summary: formatInlineOpenMeldCliCommands(payload.summary),\n commands: formatOpenMeldCliCommands(payload.commands),\n notes: payload.notes.map((note) => formatOpenMeldCliLine(note)),\n humanActionRequired: formatHumanActionRequired(payload.humanActionRequired),\n };\n}\n\nfunction formatHumanActionRequired(\n humanActionRequired: AgentOverviewHumanActionRequired\n): AgentOverviewHumanActionRequired {\n if (typeof humanActionRequired === \"boolean\") {\n return humanActionRequired;\n }\n\n return {\n ...humanActionRequired,\n steps: formatOpenMeldCliCommands(humanActionRequired.steps),\n };\n}\n","export type DualViewGuideInput = {\n summary: string;\n humanSteps: string[];\n agentRequiredArgs?: string[];\n agentOptionalArgs?: string[];\n agentCommands?: string[];\n notes?: string[];\n};\n\nfunction appendSection(\n lines: string[],\n title: string,\n items: string[] | undefined\n): void {\n if (!items || items.length === 0) {\n return;\n }\n lines.push(title);\n for (const item of items) {\n lines.push(` ${item}`);\n }\n}\n\nexport function buildDualViewGuideLines(input: DualViewGuideInput): string[] {\n const lines = [input.summary, \"\", \"[FOR HUMAN OPERATORS]\"];\n\n for (const [index, step] of input.humanSteps.entries()) {\n lines.push(`${index + 1}) ${step}`);\n }\n\n lines.push(\"\", \"[FOR AGENTS]\");\n appendSection(lines, \"required arguments:\", input.agentRequiredArgs);\n appendSection(lines, \"optional arguments:\", input.agentOptionalArgs);\n appendSection(lines, \"commands:\", input.agentCommands);\n appendSection(lines, \"notes:\", input.notes);\n\n return lines;\n}\n\nexport function buildDualViewGuideMessage(input: DualViewGuideInput): string {\n return buildDualViewGuideLines(input).join(\"\\n\");\n}\n","import {\n formatOpenMeldCliLine,\n formatOpenMeldCliTextBlock,\n} from \"./cli-entry-command\";\nimport type { DualViewGuideInput } from \"./dual-view-guide\";\n\nexport function formatDualViewGuideForDisplay(\n input: DualViewGuideInput\n): DualViewGuideInput {\n return {\n summary: formatOpenMeldCliTextBlock(input.summary),\n humanSteps: input.humanSteps.map((item) => formatOpenMeldCliLine(item)),\n ...(input.agentRequiredArgs\n ? {\n agentRequiredArgs: input.agentRequiredArgs.map((item) =>\n formatOpenMeldCliLine(item)\n ),\n }\n : {}),\n ...(input.agentOptionalArgs\n ? {\n agentOptionalArgs: input.agentOptionalArgs.map((item) =>\n formatOpenMeldCliLine(item)\n ),\n }\n : {}),\n ...(input.agentCommands\n ? {\n agentCommands: input.agentCommands.map((item) =>\n formatOpenMeldCliLine(item)\n ),\n }\n : {}),\n ...(input.notes\n ? {\n notes: input.notes.map((item) => formatOpenMeldCliTextBlock(item)),\n }\n : {}),\n };\n}\n","import {\n buildDualViewGuideMessage,\n type DualViewGuideInput,\n} from \"./dual-view-guide\";\nimport { formatDualViewGuideForDisplay } from \"./dual-view-guide-display\";\n\nexport type DualViewGuideErrorInput = {\n code: string;\n guide: DualViewGuideInput;\n hints?: string[];\n};\n\nexport class DualViewGuideError extends Error {\n readonly code: string;\n readonly guide: DualViewGuideInput;\n readonly hints: string[];\n\n constructor(input: DualViewGuideErrorInput) {\n super(\n buildDualViewGuideMessage(formatDualViewGuideForDisplay(input.guide))\n );\n this.name = \"DualViewGuideError\";\n this.code = input.code;\n this.guide = input.guide;\n this.hints = input.hints ?? [];\n }\n}\n","import { formatAgentOverviewPayload } from \"../runtime/agent-overview-payload\";\nimport { DualViewGuideError } from \"../runtime/dual-view-guide-error\";\nimport type {\n CommandAgentOverviewContract,\n CommandContractFieldResolver,\n CommandContractRenderContext,\n CommandGuideScenarioContract,\n} from \"./types\";\n\ntype CommandContractError = Error & {\n code: string;\n};\n\nexport function createCommandContractError(\n code: string,\n message: string\n): CommandContractError {\n const error = new Error(message) as CommandContractError;\n error.code = code;\n return error;\n}\n\nexport function buildAgentOverviewFromContract<\n TContext extends CommandContractRenderContext,\n>(input: {\n context: TContext;\n overview: CommandAgentOverviewContract<TContext>;\n}): {\n commands: string[];\n humanActionRequired: CommandAgentOverviewContract<TContext>[\"humanActionRequired\"];\n notes: string[];\n optionalArguments: string[];\n requiredArguments: string[];\n stages: string[];\n summary: string;\n} & Record<string, unknown> {\n const pattern = input.overview.pattern;\n return formatAgentOverviewPayload({\n ...(resolveContractField(input.overview.extraPayload, input.context) ?? {}),\n commands:\n resolveContractField(input.overview.commands, input.context) ??\n pattern?.buildCommands(input.context) ??\n [],\n humanActionRequired: input.overview.humanActionRequired,\n notes: resolveContractField(input.overview.notes, input.context) ?? [],\n optionalArguments:\n resolveContractField(input.overview.optionalArguments, input.context) ??\n pattern?.buildOptionalArguments?.(input.context) ??\n [],\n requiredArguments:\n resolveContractField(input.overview.requiredArguments, input.context) ??\n pattern?.buildRequiredArguments?.(input.context) ??\n [],\n stages: resolveContractField(input.overview.stages, input.context) ?? [],\n summary: resolveContractField(input.overview.summary, input.context) ?? \"\",\n });\n}\n\nexport function createGuideErrorFromContract<\n TContext extends CommandContractRenderContext,\n>(input: {\n context: TContext;\n guideScenario: CommandGuideScenarioContract<TContext>;\n}): DualViewGuideError {\n const pattern = input.guideScenario.pattern;\n return new DualViewGuideError({\n code: input.guideScenario.code,\n guide: {\n summary:\n resolveContractField(input.guideScenario.summary, input.context) ?? \"\",\n humanSteps:\n resolveContractField(input.guideScenario.humanSteps, input.context) ??\n [],\n agentRequiredArgs:\n resolveContractField(\n input.guideScenario.requiredArguments,\n input.context\n ) ??\n pattern?.buildRequiredArguments?.(input.context) ??\n [],\n agentOptionalArgs:\n resolveContractField(\n input.guideScenario.optionalArguments,\n input.context\n ) ??\n pattern?.buildOptionalArguments?.(input.context) ??\n [],\n agentCommands:\n resolveContractField(input.guideScenario.commands, input.context) ??\n pattern?.buildCommands(input.context) ??\n [],\n notes:\n resolveContractField(input.guideScenario.notes, input.context) ?? [],\n },\n hints:\n resolveContractField(input.guideScenario.hints, input.context) ??\n pattern?.buildHints?.(input.context) ??\n pattern?.buildCommands(input.context) ??\n [],\n });\n}\n\nfunction resolveContractField<\n TContext extends CommandContractRenderContext,\n TValue,\n>(\n value: CommandContractFieldResolver<TContext, TValue> | undefined,\n context: TContext\n): TValue | undefined {\n if (typeof value === \"function\") {\n return (value as (context: TContext) => TValue)(context);\n }\n return value;\n}\n","import type { Command } from \"commander\";\n\nexport type BuiltinAgentSelectionCommand = \"disable\" | \"enable\" | \"repair\";\n\nexport type BuiltinAgentSelectionDescriptor = {\n allOptionDescription: string;\n agentOptionDescription: string;\n command: BuiltinAgentSelectionCommand;\n supportsInstallSelection: boolean;\n};\n\ntype BuiltinAgentSelectionCommandInput = {\n agentIds?: string[];\n all?: boolean;\n command: BuiltinAgentSelectionCommand;\n includeViewFlag?: boolean;\n installId?: string;\n};\n\ntype BuiltinAgentSelectionValidationInput = {\n all?: boolean;\n command: BuiltinAgentSelectionCommand;\n explicitIds: string[];\n explicitInstallId: string | null;\n};\n\nconst BUILTIN_AGENT_SELECTION_REQUIRED_ARGUMENT =\n \"one selection mode: --all | --agent <id...>\";\nconst BUILTIN_AGENT_SELECTION_INSTALL_ARGUMENT =\n \"--install <install-id> with one --agent <id>\";\nconst BUILTIN_AGENT_SELECTION_CONFLICT_ERROR =\n \"use either --all or --agent <id...>, not both\";\nconst BUILTIN_AGENT_SELECTION_MISSING_ERROR =\n \"provide --all or --agent <id...>\";\nconst BUILTIN_AGENT_SELECTION_INSTALL_CONSTRAINT_ERROR =\n \"use --install only with one --agent <id>\";\nconst BUILTIN_AGENT_SELECTION_INSTALL_OPTION_DESCRIPTION =\n \"Choose the exact detected install OpenMeld should use for one builtin agent\";\n\nconst BUILTIN_AGENT_SELECTION_DESCRIPTORS = {\n disable: {\n allOptionDescription: \"Disable all connected agents\",\n agentOptionDescription: \"Disable specific connected agent IDs\",\n command: \"disable\",\n supportsInstallSelection: false,\n },\n enable: {\n allOptionDescription:\n \"Enable every detected agent OpenMeld can use on this computer\",\n agentOptionDescription:\n \"Enable specific agent IDs (built-in ID or custom target ID)\",\n command: \"enable\",\n supportsInstallSelection: true,\n },\n repair: {\n allOptionDescription: \"Repair every connected agent that needs repair\",\n agentOptionDescription: \"Repair specific connected agent IDs\",\n command: \"repair\",\n supportsInstallSelection: true,\n },\n} as const satisfies Record<\n BuiltinAgentSelectionCommand,\n BuiltinAgentSelectionDescriptor\n>;\n\nexport function getBuiltinAgentSelectionDescriptor(\n command: BuiltinAgentSelectionCommand\n): BuiltinAgentSelectionDescriptor {\n return BUILTIN_AGENT_SELECTION_DESCRIPTORS[command];\n}\n\nexport function registerBuiltinAgentSelectionOptions(input: {\n command: Command;\n selectionCommand: BuiltinAgentSelectionCommand;\n}): Command {\n const descriptor = getBuiltinAgentSelectionDescriptor(input.selectionCommand);\n input.command.option(\"--agent <agent...>\", descriptor.agentOptionDescription);\n if (descriptor.supportsInstallSelection) {\n input.command.option(\n \"--install <install-id>\",\n BUILTIN_AGENT_SELECTION_INSTALL_OPTION_DESCRIPTION\n );\n }\n input.command.option(\"--all\", descriptor.allOptionDescription);\n return input.command;\n}\n\nexport function getBuiltinAgentSelectionRequiredArguments(\n _command: BuiltinAgentSelectionCommand\n): string[] {\n return [BUILTIN_AGENT_SELECTION_REQUIRED_ARGUMENT];\n}\n\nexport function getBuiltinAgentSelectionOptionalArguments(\n command: BuiltinAgentSelectionCommand\n): string[] {\n return getBuiltinAgentSelectionDescriptor(command).supportsInstallSelection\n ? [BUILTIN_AGENT_SELECTION_INSTALL_ARGUMENT]\n : [];\n}\n\nexport function buildBuiltinAgentSelectionCommand(\n input: BuiltinAgentSelectionCommandInput\n): string {\n const descriptor = getBuiltinAgentSelectionDescriptor(input.command);\n const tokens = [\"openmeld\", \"agents\", input.command];\n if (input.all) {\n tokens.push(\"--all\");\n } else if (input.agentIds && input.agentIds.length > 0) {\n tokens.push(\"--agent\", ...input.agentIds);\n } else {\n throw new Error(\n `builtin agent selection command requires --all or --agent for ${input.command}`\n );\n }\n\n if (input.installId) {\n if (!descriptor.supportsInstallSelection) {\n throw new Error(\n `builtin agent selection command does not support --install for ${input.command}`\n );\n }\n tokens.push(\"--install\", input.installId);\n }\n\n if (input.includeViewFlag) {\n tokens.push(\"--view\", \"agent\");\n }\n return tokens.join(\" \");\n}\n\nexport function buildBuiltinAgentSelectionExamples(input: {\n command: BuiltinAgentSelectionCommand;\n includeViewFlag?: boolean;\n}): string[] {\n const descriptor = getBuiltinAgentSelectionDescriptor(input.command);\n const commands = [\n buildBuiltinAgentSelectionCommand({\n all: true,\n command: input.command,\n includeViewFlag: input.includeViewFlag,\n }),\n buildBuiltinAgentSelectionCommand({\n agentIds: [\"<id...>\"],\n command: input.command,\n includeViewFlag: input.includeViewFlag,\n }),\n ];\n if (descriptor.supportsInstallSelection) {\n commands.push(\n buildBuiltinAgentSelectionCommand({\n agentIds: [\"<id>\"],\n command: input.command,\n includeViewFlag: input.includeViewFlag,\n installId: \"<install-id>\",\n })\n );\n }\n return commands;\n}\n\nexport function validateBuiltinAgentSelectionInput(\n input: BuiltinAgentSelectionValidationInput\n): void {\n const descriptor = getBuiltinAgentSelectionDescriptor(input.command);\n if (input.all && input.explicitIds.length > 0) {\n throw new Error(\n `agents.config_invalid: ${BUILTIN_AGENT_SELECTION_CONFLICT_ERROR}`\n );\n }\n if (!(input.all || input.explicitIds.length > 0)) {\n throw new Error(\n `agents.${input.command}_invalid: ${BUILTIN_AGENT_SELECTION_MISSING_ERROR}`\n );\n }\n if (\n input.explicitInstallId &&\n (!descriptor.supportsInstallSelection ||\n input.all ||\n input.explicitIds.length !== 1)\n ) {\n throw new Error(\n `agents.${input.command}_invalid: ${BUILTIN_AGENT_SELECTION_INSTALL_CONSTRAINT_ERROR}`\n );\n }\n}\n","import type { Command } from \"commander\";\nimport type { CommandPatternContract } from \"../command-contracts/types\";\n\nexport type AuthLoginRequestRenderContext = {\n includeViewFlag?: boolean;\n};\n\nconst AUTH_LOGIN_REQUIRED_ARGUMENTS = [\n \"one explicit automation path: --ott <token> | --method device\",\n \"when using --method ott: --ott <token>\",\n] as const;\n\nconst AUTH_LOGIN_OPTIONAL_ARGUMENTS = [\n \"--method <device|ott>\",\n \"--ott <token>\",\n \"--auth-url <url>\",\n \"--client-id <id>\",\n \"--no-open\",\n] as const;\n\nexport const AUTH_LOGIN_REQUEST_PATTERN_CONTRACT: CommandPatternContract<AuthLoginRequestRenderContext> =\n {\n buildCommands: (context) =>\n buildAuthLoginRequestExamples({\n includeViewFlag: context.includeViewFlag,\n }),\n buildHints: () => buildAuthLoginRequestHints(),\n buildOptionalArguments: () => [...AUTH_LOGIN_OPTIONAL_ARGUMENTS],\n buildRequiredArguments: () => [...AUTH_LOGIN_REQUIRED_ARGUMENTS],\n };\n\nexport function registerAuthLoginRequestOptions(command: Command): Command {\n return command\n .option(\n \"--auth-url <url>\",\n \"OpenMeld auth URL (CLI > OPENMELD_AUTH_URL > default)\"\n )\n .option(\n \"--client-id <id>\",\n \"OAuth device client_id (CLI > OPENMELD_AUTH_CLIENT_ID > built-in default)\"\n )\n .option(\"--method <mode>\", \"Sign-in method: device|ott\")\n .option(\"--ott <token>\", \"One-time sign-in token\")\n .option(\"--no-open\", \"Do not auto-open the verification URL in browser\");\n}\n\nexport function getAuthLoginRequestRequiredArguments(): string[] {\n return [...AUTH_LOGIN_REQUIRED_ARGUMENTS];\n}\n\nexport function getAuthLoginRequestOptionalArguments(): string[] {\n return [...AUTH_LOGIN_OPTIONAL_ARGUMENTS];\n}\n\nexport function buildAuthLoginRequestExamples(input?: {\n includeViewFlag?: boolean;\n}): string[] {\n return [\n buildAuthLoginRequestCommand({\n command: \"login\",\n includeViewFlag: input?.includeViewFlag,\n ott: \"<token>\",\n }),\n buildAuthLoginRequestCommand({\n command: \"login\",\n includeViewFlag: input?.includeViewFlag,\n method: \"device\",\n noOpen: true,\n }),\n buildAuthLoginRequestCommand({\n command: \"auth status\",\n includeViewFlag: input?.includeViewFlag,\n }),\n ];\n}\n\nexport function buildAuthLoginRequestHints(): string[] {\n return buildAuthLoginRequestExamples();\n}\n\nfunction buildAuthLoginRequestCommand(input: {\n command: \"auth status\" | \"login\";\n includeViewFlag?: boolean;\n method?: \"device\" | \"ott\";\n noOpen?: boolean;\n ott?: string;\n}): string {\n const tokens = [\"openmeld\", ...input.command.split(\" \")];\n if (input.method) {\n tokens.push(\"--method\", input.method);\n }\n if (input.ott) {\n tokens.push(\"--ott\", input.ott);\n }\n if (input.noOpen) {\n tokens.push(\"--no-open\");\n }\n if (input.includeViewFlag) {\n tokens.push(\"--view\", \"agent\");\n }\n return tokens.join(\" \");\n}\n","import type { Command } from \"commander\";\nimport { createCommandContractError } from \"./helpers\";\nimport type {\n CommandContractRenderContext,\n CommandPatternContract,\n} from \"./types\";\n\nexport type DaemonControlTargetCommand = \"cancel\" | \"interrupt\";\n\ntype DaemonControlTargetRenderContext = CommandContractRenderContext;\n\nconst DAEMON_CONTROL_TARGET_REQUIRED_ARGUMENT =\n \"exactly one of --dispatch <id> or --task <id>\";\nconst DAEMON_CONTROL_TARGET_OPTIONAL_ARGUMENT = \"--reason <text>\";\nconst DAEMON_CONTROL_TARGET_ERROR =\n \"exactly one of --dispatch or --task is required\";\n\nexport function getDaemonControlTargetPatternContract(\n command: DaemonControlTargetCommand\n): CommandPatternContract<DaemonControlTargetRenderContext> {\n return {\n buildCommands: (context) =>\n buildDaemonControlTargetExamples({\n command,\n includeViewFlag: context.includeViewFlag,\n }),\n buildHints: () =>\n buildDaemonControlTargetExamples({\n command,\n }),\n buildOptionalArguments: () => [DAEMON_CONTROL_TARGET_OPTIONAL_ARGUMENT],\n buildRequiredArguments: () => [DAEMON_CONTROL_TARGET_REQUIRED_ARGUMENT],\n };\n}\n\nexport function registerDaemonControlTargetOptions(input: {\n command: Command;\n}): Command {\n return input.command\n .option(\"--dispatch <id>\", \"Dispatch ID\")\n .option(\"--task <id>\", \"Task ID (debug fallback)\")\n .option(\"--reason <text>\", `Optional ${input.command.name()} reason`);\n}\n\nexport function buildDaemonControlTargetExamples(input: {\n command: DaemonControlTargetCommand;\n includeViewFlag?: boolean;\n}): string[] {\n return [\n buildDaemonControlTargetCommand({\n command: input.command,\n dispatch: \"<id>\",\n includeViewFlag: input.includeViewFlag,\n }),\n buildDaemonControlTargetCommand({\n command: input.command,\n task: \"<id>\",\n includeViewFlag: input.includeViewFlag,\n }),\n ];\n}\n\nexport function getDaemonControlTargetRequiredArguments(): string[] {\n return [DAEMON_CONTROL_TARGET_REQUIRED_ARGUMENT];\n}\n\nexport function getDaemonControlTargetOptionalArguments(): string[] {\n return [DAEMON_CONTROL_TARGET_OPTIONAL_ARGUMENT];\n}\n\nexport function validateDaemonControlTargetInput(input: {\n dispatch?: string;\n task?: string;\n}): {\n dispatch: string | null;\n task: string | null;\n} {\n const dispatch = normalizeOptionalText(input.dispatch);\n const task = normalizeOptionalText(input.task);\n if ((dispatch && task) || !(dispatch || task)) {\n throw createCommandContractError(\n \"daemon.control.invalid_target_selector\",\n DAEMON_CONTROL_TARGET_ERROR\n );\n }\n return {\n dispatch,\n task,\n };\n}\n\nfunction buildDaemonControlTargetCommand(input: {\n command: DaemonControlTargetCommand;\n dispatch?: string;\n includeViewFlag?: boolean;\n task?: string;\n}): string {\n const tokens = [\"openmeld\", \"service\", input.command];\n if (input.dispatch) {\n tokens.push(\"--dispatch\", input.dispatch);\n } else if (input.task) {\n tokens.push(\"--task\", input.task);\n } else {\n throw new Error(\"daemon control target command requires a selector\");\n }\n if (input.includeViewFlag) {\n tokens.push(\"--view\", \"agent\");\n }\n return tokens.join(\" \");\n}\n\nfunction normalizeOptionalText(value: string | undefined): string | null {\n const normalized = String(value ?? \"\").trim();\n return normalized.length > 0 ? normalized : null;\n}\n","import packageJson from \"../../package.json\";\nimport { OPENMELD_VERSION } from \"./version\";\n\ntype CliPackageJson = {\n version: string;\n openMeldReleaseDate?: string;\n};\n\nexport type CliVersionInfo = {\n version: string;\n releaseDate: string | null;\n releaseDateLabel: string | null;\n summary: string;\n};\n\nconst PACKAGE_JSON = packageJson as CliPackageJson;\nconst ISO_RELEASE_DATE_RE = /^(\\d{4})-(\\d{2})-(\\d{2})$/u;\n\nexport function getCliVersionInfo(): CliVersionInfo {\n const version = OPENMELD_VERSION;\n const releaseDate = normalizeReleaseDate(PACKAGE_JSON.openMeldReleaseDate);\n const releaseDateLabel = releaseDate\n ? formatCliReleaseDateLabel(releaseDate)\n : null;\n\n return {\n version,\n releaseDate,\n releaseDateLabel,\n summary: formatCliVersionSummary({\n version,\n releaseDateLabel,\n }),\n };\n}\n\nexport function formatCliVersionSummary(input?: {\n version: string;\n releaseDateLabel: string | null;\n}): string {\n const versionInfo = input ?? getCliVersionInfo();\n if (!versionInfo.releaseDateLabel) {\n return `Current version: ${versionInfo.version}`;\n }\n return `Current version: ${versionInfo.version} • ${versionInfo.releaseDateLabel}`;\n}\n\nfunction normalizeReleaseDate(value: string | undefined): string | null {\n const normalized = String(value ?? \"\").trim();\n if (!ISO_RELEASE_DATE_RE.test(normalized)) {\n return null;\n }\n return normalized;\n}\n\nfunction formatCliReleaseDateLabel(releaseDate: string): string {\n const match = releaseDate.match(ISO_RELEASE_DATE_RE);\n if (!match) {\n return releaseDate;\n }\n return `${match[2]}-${match[3]}`;\n}\n","import type { Command } from \"commander\";\nimport { createCommandContractError } from \"../command-contracts/helpers\";\nimport type {\n CommandContractRenderContext,\n CommandPatternContract,\n} from \"../command-contracts/types\";\n\nexport type SkillsTargetSelectionCommand = \"ensure\" | \"install\" | \"uninstall\";\n\ntype SkillsTargetSelectionDescriptor = {\n actionLabel: string;\n command: SkillsTargetSelectionCommand;\n supportsGuideSelection: boolean;\n};\n\ntype SkillsTargetSelectionValidationInput = {\n all?: boolean;\n command: SkillsTargetSelectionCommand;\n explicitAgentIds: string[];\n explicitDir: string | null;\n guide?: boolean;\n};\n\ntype SkillsTargetSelectionRenderContext = CommandContractRenderContext;\n\nconst SKILLS_TARGET_SELECTION_DESCRIPTORS = {\n ensure: {\n actionLabel: \"Install or update\",\n command: \"ensure\",\n supportsGuideSelection: true,\n },\n install: {\n actionLabel: \"Install\",\n command: \"install\",\n supportsGuideSelection: true,\n },\n uninstall: {\n actionLabel: \"Uninstall\",\n command: \"uninstall\",\n supportsGuideSelection: false,\n },\n} as const satisfies Record<\n SkillsTargetSelectionCommand,\n SkillsTargetSelectionDescriptor\n>;\n\nconst SKILLS_TARGET_SELECTION_REQUIRED_ARGUMENTS = {\n ensure: [\n \"one target selector: --all | --agent <id...> | --dir <absolute-path> | --guide\",\n ],\n install: [\n \"one target selector: --all | --agent <id...> | --dir <absolute-path> | --guide\",\n ],\n uninstall: [\n \"one target selector: --all | --agent <id...> | --dir <absolute-path>\",\n ],\n} as const satisfies Record<SkillsTargetSelectionCommand, string[]>;\n\nconst SKILLS_TARGET_SELECTION_OPTIONAL_ARGUMENTS = {\n ensure: [],\n install: [],\n uninstall: [\"--dry-run\", \"--allow-external-targets\"],\n} as const satisfies Record<SkillsTargetSelectionCommand, string[]>;\n\nconst SKILLS_TARGET_SELECTION_ERRORS = {\n ensure: {\n conflict:\n \"use exactly one of --all, --agent <id...>, --dir <absolute-path>, or --guide\",\n missing:\n \"provide exactly one of --all, --agent <id...>, --dir <absolute-path>, or --guide\",\n },\n install: {\n conflict:\n \"use exactly one of --all, --agent <id...>, --dir <absolute-path>, or --guide\",\n missing:\n \"provide exactly one of --all, --agent <id...>, --dir <absolute-path>, or --guide\",\n },\n uninstall: {\n conflict:\n \"use exactly one of --all, --agent <id...>, or --dir <absolute-path>\",\n missing:\n \"provide exactly one of --all, --agent <id...>, or --dir <absolute-path>\",\n },\n} as const;\n\nexport function getSkillsTargetSelectionPatternContract(\n command: SkillsTargetSelectionCommand\n): CommandPatternContract<SkillsTargetSelectionRenderContext> {\n return {\n buildCommands: (context) =>\n buildSkillsTargetSelectionExamples({\n command,\n includeViewFlag: context.includeViewFlag,\n agentExampleArg: context.agentExampleArg,\n }),\n buildHints: (context) =>\n buildSkillsTargetSelectionHints({\n command,\n agentExampleArg: context.agentExampleArg,\n }),\n buildOptionalArguments: () =>\n getSkillsTargetSelectionOptionalArguments(command),\n buildRequiredArguments: () =>\n getSkillsTargetSelectionRequiredArguments(command),\n };\n}\n\nexport function registerSkillsTargetSelectionOptions(input: {\n command: Command;\n selectionCommand: SkillsTargetSelectionCommand;\n agentExampleArg: string;\n}): Command {\n const descriptor = getSkillsTargetSelectionDescriptor(input.selectionCommand);\n input.command.option(\n \"--all\",\n `${descriptor.actionLabel} skills for all detected local agents`\n );\n input.command.option(\n \"--agent <agent...>\",\n `${descriptor.actionLabel} skills for specific agent ids (for example: ${input.agentExampleArg})`\n );\n input.command.option(\n \"--dir <path>\",\n `${descriptor.actionLabel} skills ${\n input.selectionCommand === \"install\" ? \"into\" : \"from\"\n } a specific custom skills directory`\n );\n if (descriptor.supportsGuideSelection) {\n input.command.option(\"--guide\", \"Show manual installation guide only\");\n }\n return input.command;\n}\n\nexport function getSkillsTargetSelectionRequiredArguments(\n command: SkillsTargetSelectionCommand\n): string[] {\n return [...SKILLS_TARGET_SELECTION_REQUIRED_ARGUMENTS[command]];\n}\n\nexport function getSkillsTargetSelectionOptionalArguments(\n command: SkillsTargetSelectionCommand\n): string[] {\n return [...SKILLS_TARGET_SELECTION_OPTIONAL_ARGUMENTS[command]];\n}\n\nexport function buildSkillsTargetSelectionExamples(input: {\n agentExampleArg?: string;\n command: SkillsTargetSelectionCommand;\n includeViewFlag?: boolean;\n}): string[] {\n const commands = [\n buildSkillsTargetSelectionCommand({\n all: true,\n command: input.command,\n includeViewFlag: input.includeViewFlag,\n }),\n buildSkillsTargetSelectionCommand({\n agentIds: [normalizeAgentExampleArg(input.agentExampleArg)],\n command: input.command,\n includeViewFlag: input.includeViewFlag,\n }),\n buildSkillsTargetSelectionCommand({\n command: input.command,\n dir: \"<absolute-path>\",\n includeViewFlag: input.includeViewFlag,\n }),\n ];\n if (input.command === \"install\" || input.command === \"ensure\") {\n commands.push(\n buildSkillsTargetSelectionCommand({\n command: input.command,\n guide: true,\n includeViewFlag: input.includeViewFlag,\n })\n );\n } else {\n commands.push(\n buildSkillsTargetSelectionCommand({\n all: true,\n command: \"uninstall\",\n dryRun: true,\n includeViewFlag: input.includeViewFlag,\n })\n );\n }\n return commands;\n}\n\nexport function buildSkillsTargetSelectionHints(input: {\n agentExampleArg?: string;\n command: SkillsTargetSelectionCommand;\n}): string[] {\n return buildSkillsTargetSelectionExamples({\n command: input.command,\n agentExampleArg: input.agentExampleArg,\n });\n}\n\nexport function buildSkillsTargetSelectionCommand(input: {\n agentIds?: string[];\n all?: boolean;\n allowExternalTargets?: boolean;\n command: SkillsTargetSelectionCommand;\n dir?: string;\n dryRun?: boolean;\n guide?: boolean;\n includeViewFlag?: boolean;\n}): string {\n const descriptor = getSkillsTargetSelectionDescriptor(input.command);\n const tokens = [\"openmeld\", \"skills\", input.command];\n if (input.all) {\n tokens.push(\"--all\");\n } else if (input.agentIds && input.agentIds.length > 0) {\n tokens.push(\"--agent\", ...input.agentIds);\n } else if (input.dir) {\n tokens.push(\"--dir\", input.dir);\n } else if (input.guide) {\n if (!descriptor.supportsGuideSelection) {\n throw new Error(\n \"skills target selection command does not support --guide\"\n );\n }\n tokens.push(\"--guide\");\n } else {\n throw new Error(\n `skills target selection command requires one selector for ${input.command}`\n );\n }\n\n if (input.dryRun) {\n tokens.push(\"--dry-run\");\n }\n if (input.allowExternalTargets) {\n tokens.push(\"--allow-external-targets\");\n }\n if (input.includeViewFlag) {\n tokens.push(\"--view\", \"agent\");\n }\n return tokens.join(\" \");\n}\n\nexport function validateSkillsTargetSelectionInput(\n input: SkillsTargetSelectionValidationInput\n): void {\n const guide =\n getSkillsTargetSelectionDescriptor(input.command).supportsGuideSelection &&\n input.guide === true;\n const selectedModeCount = countSelectedModes({\n agentCount: input.explicitAgentIds.length,\n all: input.all,\n dir: input.explicitDir,\n guide,\n });\n if (selectedModeCount > 1) {\n throw createCommandContractError(\n `skills.${input.command}_invalid`,\n SKILLS_TARGET_SELECTION_ERRORS[input.command].conflict\n );\n }\n if (selectedModeCount === 0) {\n throw createCommandContractError(\n `skills.${input.command}_invalid`,\n SKILLS_TARGET_SELECTION_ERRORS[input.command].missing\n );\n }\n}\n\nfunction countSelectedModes(input: {\n agentCount: number;\n all?: boolean;\n dir: string | null;\n guide: boolean;\n}): number {\n return (\n (input.all ? 1 : 0) +\n (input.agentCount > 0 ? 1 : 0) +\n (input.dir ? 1 : 0) +\n (input.guide ? 1 : 0)\n );\n}\n\nfunction getSkillsTargetSelectionDescriptor(\n command: SkillsTargetSelectionCommand\n): SkillsTargetSelectionDescriptor {\n return SKILLS_TARGET_SELECTION_DESCRIPTORS[command];\n}\n\nfunction normalizeAgentExampleArg(value: string | undefined): string {\n const normalized = String(value ?? \"\").trim();\n return normalized.length > 0 ? normalized : \"<id...>\";\n}\n","export const SPACE_ADD_MEMBERS_PROGRESS_HEARTBEAT_MS = 5000;\n\nexport type SpaceAddMembersProgressStage =\n | \"resolve_candidates\"\n | \"check_local_wake_readiness\"\n | \"plan_local_wake_participation\"\n | \"confirm_local_wake_bindings\"\n | \"add_members\"\n | \"record_join_notices\";\n\nexport type SpaceAddMembersProgressOwner =\n | \"cli\"\n | \"local_runtime\"\n | \"local_participation\"\n | \"core\"\n | \"space\";\n\nexport type SpaceAddMembersProgressFactSource =\n | \"profile_store\"\n | \"space_membership_api\"\n | \"local_agent_registry\"\n | \"agent_controller_report_projection\"\n | \"local_readiness_diagnostics\"\n | \"local_participation_plan\"\n | \"agent_profile_binding_api\"\n | \"space_membership_api_write\"\n | \"space_membership_projection\"\n | \"space_signal_api_write\";\n\nexport type SpaceAddMembersProgressPhaseContract = {\n stage: SpaceAddMembersProgressStage;\n phase: string;\n owner: SpaceAddMembersProgressOwner;\n waitingFor: string;\n factSource: SpaceAddMembersProgressFactSource;\n summary: string;\n};\n\nexport const SPACE_ADD_MEMBERS_PROGRESS_PHASES = [\n {\n stage: \"resolve_candidates\",\n phase: \"read_profiles\",\n owner: \"cli\",\n waitingFor: \"active profile identities eligible for this Space operation\",\n factSource: \"profile_store\",\n summary:\n \"Reading active local profile identities for this Space operation.\",\n },\n {\n stage: \"resolve_candidates\",\n phase: \"read_space_members\",\n owner: \"space\",\n waitingFor: \"current Space membership snapshot\",\n factSource: \"space_membership_api\",\n summary: \"Reading current Space membership before selecting profiles.\",\n },\n {\n stage: \"resolve_candidates\",\n phase: \"read_local_targets\",\n owner: \"local_runtime\",\n waitingFor: \"local agent controller state on this computer\",\n factSource: \"local_agent_registry\",\n summary: \"Reading local agent controller state for candidate profiles.\",\n },\n {\n stage: \"resolve_candidates\",\n phase: \"read_local_targets_wait\",\n owner: \"local_runtime\",\n waitingFor: \"local agent controller state on this computer\",\n factSource: \"local_agent_registry\",\n summary:\n \"Still reading local agent controller state for candidate profiles.\",\n },\n {\n stage: \"resolve_candidates\",\n phase: \"read_agent_controller_report\",\n owner: \"core\",\n waitingFor: \"Agent Profile execution target projection\",\n factSource: \"agent_controller_report_projection\",\n summary: \"Reading the Agent Profile execution target projection.\",\n },\n {\n stage: \"resolve_candidates\",\n phase: \"read_agent_controller_report_wait\",\n owner: \"core\",\n waitingFor: \"Agent Profile execution target projection\",\n factSource: \"agent_controller_report_projection\",\n summary: \"Still reading the Agent Profile execution target projection.\",\n },\n {\n stage: \"resolve_candidates\",\n phase: \"read_profile_readiness\",\n owner: \"local_participation\",\n waitingFor: \"local Wake participation diagnostics for candidate profiles\",\n factSource: \"local_readiness_diagnostics\",\n summary:\n \"Reading local Wake participation diagnostics for candidate profiles.\",\n },\n {\n stage: \"resolve_candidates\",\n phase: \"read_profile_readiness_wait\",\n owner: \"local_participation\",\n waitingFor: \"local Wake participation diagnostics for candidate profiles\",\n factSource: \"local_readiness_diagnostics\",\n summary:\n \"Still reading local Wake participation diagnostics for candidate profiles.\",\n },\n {\n stage: \"check_local_wake_readiness\",\n phase: \"start\",\n owner: \"local_participation\",\n waitingFor: \"selected profiles local Wake participation check\",\n factSource: \"local_readiness_diagnostics\",\n summary:\n \"Checking whether selected agent profiles can wake from this computer.\",\n },\n {\n stage: \"check_local_wake_readiness\",\n phase: \"read_local_targets\",\n owner: \"local_runtime\",\n waitingFor: \"local agent controller state on this computer\",\n factSource: \"local_agent_registry\",\n summary:\n \"Reading local agent controller state before checking selected profiles.\",\n },\n {\n stage: \"check_local_wake_readiness\",\n phase: \"read_local_targets_wait\",\n owner: \"local_runtime\",\n waitingFor: \"local agent controller state on this computer\",\n factSource: \"local_agent_registry\",\n summary:\n \"Still reading local agent controller state before checking selected profiles.\",\n },\n {\n stage: \"check_local_wake_readiness\",\n phase: \"read_profile_readiness\",\n owner: \"local_participation\",\n waitingFor: \"local Wake participation diagnostics for selected profiles\",\n factSource: \"local_readiness_diagnostics\",\n summary:\n \"Reading local Wake participation diagnostics for selected profiles.\",\n },\n {\n stage: \"check_local_wake_readiness\",\n phase: \"read_profile_readiness_wait\",\n owner: \"local_participation\",\n waitingFor: \"local Wake participation diagnostics for selected profiles\",\n factSource: \"local_readiness_diagnostics\",\n summary:\n \"Still reading local Wake participation diagnostics for selected profiles.\",\n },\n {\n stage: \"plan_local_wake_participation\",\n phase: \"plan\",\n owner: \"local_participation\",\n waitingFor: \"local participation plan for selected profiles\",\n factSource: \"local_participation_plan\",\n summary: \"Planning local Wake participation work for selected profiles.\",\n },\n {\n stage: \"confirm_local_wake_bindings\",\n phase: \"start\",\n owner: \"local_participation\",\n waitingFor: \"formal Binding confirmation for ready local profiles\",\n factSource: \"agent_profile_binding_api\",\n summary:\n \"Confirming available local agent profiles have Wake bindings before adding them.\",\n },\n {\n stage: \"confirm_local_wake_bindings\",\n phase: \"profile_binding_sync\",\n owner: \"local_participation\",\n waitingFor:\n \"local runtime evidence submission and Agent Profile Binding write\",\n factSource: \"agent_profile_binding_api\",\n summary:\n \"Submitting local runtime evidence and writing the Agent Profile Binding.\",\n },\n {\n stage: \"confirm_local_wake_bindings\",\n phase: \"profile_binding_sync_wait\",\n owner: \"local_participation\",\n waitingFor:\n \"local runtime evidence submission and Agent Profile Binding write\",\n factSource: \"agent_profile_binding_api\",\n summary:\n \"Still submitting local runtime evidence and writing the Agent Profile Binding.\",\n },\n {\n stage: \"confirm_local_wake_bindings\",\n phase: \"profile_binding_confirmed\",\n owner: \"core\",\n waitingFor:\n \"Core execution readiness projection after Binding confirmation\",\n factSource: \"agent_profile_binding_api\",\n summary:\n \"Local participation Binding is confirmed; this is not a final Wake outcome.\",\n },\n {\n stage: \"confirm_local_wake_bindings\",\n phase: \"profile_binding_not_confirmed\",\n owner: \"core\",\n waitingFor:\n \"Core execution readiness projection after Binding confirmation\",\n factSource: \"agent_profile_binding_api\",\n summary:\n \"Local participation Binding was not confirmed; membership can continue with diagnostics.\",\n },\n {\n stage: \"add_members\",\n phase: \"write_membership\",\n owner: \"space\",\n waitingFor: \"Space membership write\",\n factSource: \"space_membership_api_write\",\n summary: \"Adding selected profiles to the Space.\",\n },\n {\n stage: \"add_members\",\n phase: \"confirm_membership_projection\",\n owner: \"space\",\n waitingFor: \"Space membership and Wake availability projection\",\n factSource: \"space_membership_projection\",\n summary:\n \"Confirming the Space can see newly added wakeable members before returning.\",\n },\n {\n stage: \"record_join_notices\",\n phase: \"write_join_notices\",\n owner: \"space\",\n waitingFor: \"visible Space join notice signals\",\n factSource: \"space_signal_api_write\",\n summary: \"Recording visible join notices for newly added members.\",\n },\n] as const satisfies readonly SpaceAddMembersProgressPhaseContract[];\n\nexport const SPACE_ADD_MEMBERS_PROGRESS_OVERVIEW_STAGES =\n SPACE_ADD_MEMBERS_PROGRESS_PHASES.map(\n (phase) => `${phase.stage}/${phase.phase}`\n );\n\nexport const SPACE_ADD_MEMBERS_AGENT_OVERVIEW_STAGES = [\n \"check_arguments\",\n \"authenticate\",\n \"check_profile\",\n \"resolve_target\",\n \"add_members/write_membership\",\n \"record_join_notices/write_join_notices\",\n] as const;\n\nexport function resolveSpaceAddMembersProgressPhase(input: {\n stage: SpaceAddMembersProgressStage;\n phase: string;\n}): SpaceAddMembersProgressPhaseContract {\n const contract = SPACE_ADD_MEMBERS_PROGRESS_PHASES.find(\n (phase) => phase.stage === input.stage && phase.phase === input.phase\n );\n if (!contract) {\n throw new Error(\n `unknown space add-members progress phase: ${input.stage}/${input.phase}`\n );\n }\n return contract;\n}\n","import type { Command } from \"commander\";\nimport { createCommandContractError } from \"../command-contracts/helpers\";\nimport type {\n CommandContractRenderContext,\n CommandPatternContract,\n} from \"../command-contracts/types\";\nimport { formatProfileAwareOpenMeldCliCommand } from \"../runtime/cli-entry-command\";\n\nexport type SpaceMemberSelectionCommand =\n | \"add-agents\"\n | \"add-human-profiles\"\n | \"add-members\"\n | \"remove-members\";\n\ntype SpaceMemberSelectionRenderContext = CommandContractRenderContext;\n\nconst SPACE_MEMBER_SELECTION_REQUIRED_ARGUMENT = [\n \"<space-id>\",\n \"one selection mode: <selector-option> <selector-operand> | --all\",\n] as const;\nconst SPACE_MEMBER_SELECTION_OPTIONAL_ARGUMENTS = [\n \"--password <value>\",\n \"parent option: openmeld space --gateway-url <url>\",\n \"--profile <profile-id>\",\n] as const;\nconst SPACE_MEMBER_SELECTION_CONFLICT_ERRORS = {\n \"add-agents\":\n \"`openmeld space add-agents`: use either --agent-profile <agent-profile-id...> or --all, not both\",\n \"add-human-profiles\":\n \"`openmeld space add-human-profiles`: use either --human-profile <human-profile-id...> or --all, not both\",\n \"add-members\":\n \"`openmeld space add-members`: use either --member <profile-id...> or --all, not both\",\n \"remove-members\":\n \"`openmeld space remove-members`: use either --member <profile-id...> or --all, not both\",\n} as const;\nconst SPACE_MEMBER_SELECTION_MISSING_ERRORS = {\n \"add-agents\":\n \"`openmeld space add-agents` requires --agent-profile <agent-profile-id...> or --all in non-interactive mode\",\n \"add-human-profiles\":\n \"`openmeld space add-human-profiles` requires --human-profile <human-profile-id...> or --all in non-interactive mode\",\n \"add-members\":\n \"`openmeld space add-members` requires --member <profile-id...> or --all in non-interactive mode\",\n \"remove-members\":\n \"`openmeld space remove-members` requires --member <profile-id...> or --all in non-interactive mode\",\n} as const;\n\nexport function getSpaceMemberSelectionPatternContract(\n command: SpaceMemberSelectionCommand\n): CommandPatternContract<SpaceMemberSelectionRenderContext> {\n const selector = getSpaceMemberSelectionSelector(command);\n return {\n buildCommands: (context) =>\n buildSpaceMemberSelectionExamples({\n command,\n includeViewFlag: context.includeViewFlag,\n profileId: context.profileId,\n }),\n buildHints: (context) =>\n buildSpaceMemberSelectionExamples({\n command,\n includeViewFlag: context.includeViewFlag,\n profileId: context.profileId,\n }),\n buildOptionalArguments: () => [\n ...SPACE_MEMBER_SELECTION_OPTIONAL_ARGUMENTS,\n ],\n buildRequiredArguments: () =>\n SPACE_MEMBER_SELECTION_REQUIRED_ARGUMENT.map((argument) =>\n argument\n .replace(\"<selector-option>\", selector.option)\n .replace(\"<selector-operand>\", selector.operand)\n ),\n };\n}\n\nexport function registerSpaceMemberSelectionOptions(input: {\n command: Command;\n selectionCommand: SpaceMemberSelectionCommand;\n}): Command {\n const selector = getSpaceMemberSelectionSelector(input.selectionCommand);\n return input.command\n .option(\n `${selector.option} ${selector.operand}`,\n `${selector.label} id(s) to ${selector.action} (single or multiple)`\n )\n .option(\"--all\", selector.allDescription);\n}\n\nexport function buildSpaceMemberSelectionExamples(input: {\n command: SpaceMemberSelectionCommand;\n includeViewFlag?: boolean;\n profileId?: string | null;\n}): string[] {\n const selector = getSpaceMemberSelectionSelector(input.command);\n return [\n buildSpaceMemberSelectionCommand({\n command: input.command,\n includeViewFlag: input.includeViewFlag,\n memberIds: [selector.operand],\n profileId: input.profileId,\n }),\n buildSpaceMemberSelectionCommand({\n all: true,\n command: input.command,\n includeViewFlag: input.includeViewFlag,\n profileId: input.profileId,\n }),\n ];\n}\n\nexport function validateSpaceMemberSelectionInput(input: {\n all: boolean;\n command: SpaceMemberSelectionCommand;\n explicitMemberIds: string[];\n}): void {\n if (input.all && input.explicitMemberIds.length > 0) {\n throw createCommandContractError(\n `space.${input.command}.selector_invalid`,\n SPACE_MEMBER_SELECTION_CONFLICT_ERRORS[input.command]\n );\n }\n if (!(input.all || input.explicitMemberIds.length > 0)) {\n throw createCommandContractError(\n `space.${input.command}.selector_missing`,\n SPACE_MEMBER_SELECTION_MISSING_ERRORS[input.command]\n );\n }\n}\n\nfunction buildSpaceMemberSelectionCommand(input: {\n all?: boolean;\n command: SpaceMemberSelectionCommand;\n includeViewFlag?: boolean;\n memberIds?: string[];\n profileId?: string | null;\n}): string {\n const tokens = [\"openmeld\", \"space\", input.command, \"<space-id>\"];\n if (input.all) {\n tokens.push(\"--all\");\n } else if (input.memberIds && input.memberIds.length > 0) {\n tokens.push(\n getSpaceMemberSelectionSelector(input.command).option,\n ...input.memberIds\n );\n } else {\n throw new Error(\"space member selection command requires a selector\");\n }\n if (input.includeViewFlag) {\n return formatProfileAwareOpenMeldCliCommand(tokens.join(\" \"), {\n profileId: input.profileId ?? \"<profile-id>\",\n resolvedView: \"agent\",\n });\n }\n return tokens.join(\" \");\n}\n\nfunction getSpaceMemberSelectionSelector(\n command: SpaceMemberSelectionCommand\n): {\n action: string;\n allDescription: string;\n label: string;\n option: \"--agent-profile\" | \"--human-profile\" | \"--member\";\n operand:\n | \"<agent-profile-id...>\"\n | \"<human-profile-id...>\"\n | \"<profile-id...>\";\n} {\n switch (command) {\n case \"add-agents\":\n return {\n action: \"add\",\n allDescription:\n \"Add all eligible Agent Profiles that are not yet in this space\",\n label: \"Agent Profile\",\n option: \"--agent-profile\",\n operand: \"<agent-profile-id...>\",\n };\n case \"add-human-profiles\":\n return {\n action: \"add\",\n allDescription:\n \"Add all eligible Human Profiles that are not yet in this space\",\n label: \"Human Profile\",\n option: \"--human-profile\",\n operand: \"<human-profile-id...>\",\n };\n case \"add-members\":\n return {\n action: \"add\",\n allDescription:\n \"Add all eligible profiles that are not yet in this space\",\n label: \"Profile\",\n option: \"--member\",\n operand: \"<profile-id...>\",\n };\n case \"remove-members\":\n return {\n action: \"remove\",\n allDescription: \"Remove all eligible members that are currently active\",\n label: \"Profile\",\n option: \"--member\",\n operand: \"<profile-id...>\",\n };\n default:\n assertNever(command);\n }\n}\n\nfunction assertNever(value: never): never {\n throw new Error(\n `unexpected space member selection command: ${String(value)}`\n );\n}\n","export const ROOT_ENTRY_START_COMMAND = \"openmeld start\";\n\nexport const ROOT_ENTRY_COMMANDS = [\n {\n command: \"openmeld setup\",\n description: \"Set up this computer for Space Wake\",\n },\n {\n command: \"openmeld start\",\n description: \"Initialize your identity\",\n },\n {\n command: \"openmeld auth\",\n description: \"Sign in, sign out, and inspect auth state\",\n },\n {\n command: \"openmeld profiles\",\n description: \"Manage OpenMeld profiles\",\n },\n {\n command: \"openmeld agents\",\n description: \"Manage OpenMeld agent targets and bindings\",\n },\n {\n command: \"openmeld computer\",\n description: \"Name this computer in OpenMeld\",\n },\n {\n command: \"openmeld view human|agent\",\n description: \"Switch default view mode\",\n },\n {\n command: \"openmeld space\",\n description: \"Create, join, and configure spaces\",\n },\n {\n command: \"openmeld routines\",\n description: \"Manage scheduled Center Agent Routines\",\n },\n {\n command: \"openmeld skills\",\n description: \"Install or list OpenMeld skills\",\n },\n {\n command: \"openmeld service\",\n description: \"Manage OpenMeld background service\",\n },\n {\n command: \"openmeld whoami\",\n description: \"Show your current identity\",\n },\n {\n command: \"openmeld doctor\",\n description: \"Check local setup and connectivity\",\n },\n {\n command: \"openmeld upgrade\",\n description: \"Upgrade OpenMeld CLI when a new version is available\",\n },\n {\n command: \"openmeld reset\",\n description: \"Reset local OpenMeld state and reinitialize baseline files\",\n },\n {\n command: \"openmeld help (-h, --help)\",\n description: \"Show help for a command\",\n },\n] as const;\n","import {\n buildBuiltinAgentSelectionExamples,\n getBuiltinAgentSelectionOptionalArguments,\n getBuiltinAgentSelectionRequiredArguments,\n} from \"../agents/builtin-selection-contract\";\nimport { AUTH_LOGIN_REQUEST_PATTERN_CONTRACT } from \"../auth/login-request-contract\";\nimport { getDaemonControlTargetPatternContract } from \"../command-contracts/service-control-target\";\nimport type { CommandEntryName } from \"../command-entry-checks/types\";\nimport { getCliVersionInfo } from \"../runtime/cli-version\";\nimport { getSkillsTargetSelectionPatternContract } from \"../skills/target-selection-contract\";\nimport { SPACE_ADD_MEMBERS_AGENT_OVERVIEW_STAGES } from \"../space/add-members-progress-contract\";\nimport { getSpaceMemberSelectionPatternContract } from \"../space/member-selection-contract\";\nimport { ROOT_ENTRY_COMMANDS } from \"../ui/root-entry-catalog\";\nimport type {\n CommandContractRenderContext,\n CommandEntryContract,\n} from \"./types\";\n\ntype CommandContractRegistryContext = CommandContractRenderContext & {\n knownAgentIds?: string[];\n skills?: Array<{\n name: string;\n relativePath: string;\n }>;\n storeDir?: string;\n summary?: string;\n};\n\ntype SkillsContractContext = CommandContractRenderContext & {\n knownAgentIds?: string[];\n skills?: Array<{\n name: string;\n relativePath: string;\n }>;\n storeDir?: string;\n};\n\nfunction buildSpaceAddProfilesContract(input: {\n command: \"add-agents\" | \"add-human-profiles\" | \"add-members\";\n entryName:\n | \"space.add-agents\"\n | \"space.add-human-profiles\"\n | \"space.add-members\";\n humanChoiceText: string;\n summary: string;\n requiredSummary: string;\n}): CommandEntryContract<CommandContractRegistryContext> {\n return {\n agentOverview: {\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [\n \"space is single-select; profiles support one or many selections.\",\n \"already-joined profiles are skipped automatically.\",\n \"Space membership is separate from Agent Profile readiness.\",\n ],\n pattern: getSpaceMemberSelectionPatternContract(input.command),\n stages: [...SPACE_ADD_MEMBERS_AGENT_OVERVIEW_STAGES],\n summary: input.summary,\n },\n buildHints: (context) =>\n getSpaceMemberSelectionPatternContract(input.command).buildHints?.({\n ...context,\n includeViewFlag: true,\n profileId: context.profileId ?? \"<profile-id>\",\n }) ?? [],\n entryName: input.entryName,\n guideScenarios: {\n required: {\n code: `space.${input.command.replaceAll(\"-\", \"_\")}.arguments.required`,\n humanSteps: [\n \"openmeld view human\",\n `openmeld space ${input.command}`,\n input.humanChoiceText,\n ],\n notes: [\n \"space is single-select; profiles support one or many selections.\",\n \"already-joined profiles are skipped automatically.\",\n \"Adding a profile to a Space does not prove Agent Profile readiness.\",\n ],\n pattern: getSpaceMemberSelectionPatternContract(input.command),\n summary: (context: { summary?: string }) =>\n context.summary ?? input.requiredSummary,\n },\n },\n };\n}\n\nconst COMMAND_ENTRY_CONTRACTS: Partial<\n Record<CommandEntryName, CommandEntryContract<CommandContractRegistryContext>>\n> = {\n root: {\n agentOverview: {\n commands: () => ROOT_ENTRY_COMMANDS.map((item) => item.command),\n extraPayload: () => ({ cli: getCliVersionInfo() }),\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [\n \"Human view renders the branded banner; agent view receives this structured root overview.\",\n ],\n optionalArguments: [],\n requiredArguments: [],\n stages: [\n \"Recommend the first onboarding command.\",\n \"List the top-level OpenMeld commands available from the root entry.\",\n \"Return the currently installed CLI version and release date.\",\n ],\n summary:\n \"Show the OpenMeld root entry menu, recommend `openmeld start`, and expose the current CLI release metadata.\",\n },\n entryName: \"root\",\n },\n view: {\n agentOverview: {\n commands: [\n \"openmeld view --view agent\",\n \"openmeld view agent --profile <profile-id> --view agent\",\n \"openmeld view auto --profile <profile-id> --view agent\",\n ],\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [\n \"Saving a default view requires an active OpenMeld profile or an explicit `--profile`.\",\n ],\n optionalArguments: [\"[mode]\", \"--profile <id-or-name>\"],\n requiredArguments: [],\n stages: [\n \"Read the current default view when no new mode is provided.\",\n \"Resolve the target OpenMeld profile when saving a new default view.\",\n \"Return the current or updated default view.\",\n ],\n summary:\n \"Inspect or save the default OpenMeld view mode for the current or explicit OpenMeld profile.\",\n },\n entryName: \"view\",\n },\n \"agents.disable\": {\n agentOverview: {\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [],\n optionalArguments: () =>\n getBuiltinAgentSelectionOptionalArguments(\"disable\"),\n requiredArguments: () =>\n getBuiltinAgentSelectionRequiredArguments(\"disable\"),\n stages: [],\n summary: \"\",\n commands: ({ includeViewFlag = false }) =>\n buildBuiltinAgentSelectionExamples({\n command: \"disable\",\n includeViewFlag,\n }),\n },\n buildHints: () =>\n buildBuiltinAgentSelectionExamples({ command: \"disable\" }),\n entryName: \"agents.disable\",\n },\n \"agents.enable\": {\n agentOverview: {\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [],\n optionalArguments: () =>\n getBuiltinAgentSelectionOptionalArguments(\"enable\"),\n requiredArguments: () =>\n getBuiltinAgentSelectionRequiredArguments(\"enable\"),\n stages: [],\n summary: \"\",\n commands: ({ includeViewFlag = false }) =>\n buildBuiltinAgentSelectionExamples({\n command: \"enable\",\n includeViewFlag,\n }),\n },\n buildHints: () => buildBuiltinAgentSelectionExamples({ command: \"enable\" }),\n entryName: \"agents.enable\",\n },\n \"agents.repair\": {\n agentOverview: {\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [],\n optionalArguments: () =>\n getBuiltinAgentSelectionOptionalArguments(\"repair\"),\n requiredArguments: () =>\n getBuiltinAgentSelectionRequiredArguments(\"repair\"),\n stages: [],\n summary: \"\",\n commands: ({ includeViewFlag = false }) =>\n buildBuiltinAgentSelectionExamples({\n command: \"repair\",\n includeViewFlag,\n }),\n },\n buildHints: () => buildBuiltinAgentSelectionExamples({ command: \"repair\" }),\n entryName: \"agents.repair\",\n },\n \"auth.menu\": {\n agentOverview: {\n commands: [\n \"openmeld auth status --view agent\",\n \"openmeld login --view agent --ott <token>\",\n \"openmeld logout --view agent\",\n ],\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [\n \"Agent view does not open the human interactive auth menu.\",\n \"Prefer explicit auth subcommands to keep automation deterministic.\",\n ],\n optionalArguments: [],\n requiredArguments: [],\n stages: [\n \"Inspect current local auth session state.\",\n \"Choose an explicit sign-in, sign-out, or status command.\",\n \"Read the structured auth result or follow-up guidance.\",\n ],\n summary:\n \"Inspect or change the local OpenMeld authentication session with explicit non-interactive auth subcommands.\",\n },\n entryName: \"auth.menu\",\n },\n \"auth.login\": {\n agentOverview: {\n humanActionRequired: {\n possible: true,\n steps: [\n \"If no one-time token is available, ask a human to open the OpenMeld auth page in a browser.\",\n \"Ask the human to generate a one-time token or approve the device sign-in request.\",\n \"Retry the same sign-in command with the returned token when using OTT.\",\n ],\n },\n notes: [\n \"One-time token sign-in is the preferred automation path in agent view.\",\n \"When using device flow in agent view, keep browser opening disabled and ask a human to finish approval in the browser.\",\n ],\n pattern: AUTH_LOGIN_REQUEST_PATTERN_CONTRACT,\n stages: [\n \"Resolve the explicit sign-in method for agent view.\",\n \"Request a device flow or verify a one-time token.\",\n \"Persist the local auth session and return success details.\",\n ],\n summary:\n \"Establish a local OpenMeld sign-in session with an explicit sign-in method and deterministic machine-readable guidance.\",\n },\n buildHints: () =>\n AUTH_LOGIN_REQUEST_PATTERN_CONTRACT.buildHints?.({}) ?? [],\n entryName: \"auth.login\",\n guideScenarios: {\n required: {\n code: \"auth.login.arguments.required\",\n humanSteps: [\"openmeld view human\", \"openmeld auth\", \"Select: Sign in\"],\n pattern: AUTH_LOGIN_REQUEST_PATTERN_CONTRACT,\n summary: (context: { summary?: string }) =>\n `openmeld auth login: ${context.summary ?? \"\"}`,\n },\n },\n },\n \"auth.logout\": {\n agentOverview: {\n commands: [\n \"openmeld logout --view agent\",\n \"openmeld auth status --view agent\",\n ],\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [\n \"Sign-out only affects your local OpenMeld installation.\",\n \"Sign-out does not delete cloud OpenMeld profiles or affect other OpenMeld installations on this device.\",\n ],\n optionalArguments: [],\n requiredArguments: [],\n stages: [\n \"Load the current local sign-in session.\",\n \"Best-effort stop OpenMeld Service for your local OpenMeld installation.\",\n \"Clear the saved selected-profile pointers for your local OpenMeld installation.\",\n \"Remove the saved local sign-in session if it exists.\",\n \"Return the final sign-out state.\",\n ],\n summary:\n \"Clear the current local OpenMeld sign-in session and clean up your local OpenMeld service and profile state on this device.\",\n },\n entryName: \"auth.logout\",\n },\n \"auth.status\": {\n agentOverview: {\n commands: [\n \"openmeld auth status --view agent\",\n \"openmeld login --view agent --ott <token>\",\n ],\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [\"Status is read-only in agent view.\"],\n optionalArguments: [],\n requiredArguments: [],\n stages: [\n \"Load the local auth session.\",\n \"Validate remote auth state when possible.\",\n \"Return machine-readable auth session details.\",\n ],\n summary:\n \"Inspect the current OpenMeld authentication session without changing any local auth state.\",\n },\n entryName: \"auth.status\",\n },\n doctor: {\n agentOverview: {\n commands: [\n \"openmeld doctor --view agent\",\n \"openmeld doctor --repair --view agent\",\n \"openmeld whoami --view agent\",\n ],\n humanActionRequired: {\n possible: true,\n steps: [\n \"If auth is missing or expired, ask a human to complete `openmeld login`.\",\n \"If doctor reports device or gateway issues, ask a human to inspect the failing subsystem before retrying.\",\n ],\n },\n notes: [\n \"Doctor emits a sequence of `doctor.check.*` records instead of one summary payload.\",\n \"Read every failing check before deciding whether human intervention is required.\",\n ],\n optionalArguments: [\n \"--profile <id-or-name>\",\n \"--base-url <url>\",\n \"--repair\",\n ],\n requiredArguments: [],\n stages: [\n \"Inspect sign-in and OpenMeld profile readiness.\",\n \"Probe gateway connectivity and gateway chain health.\",\n \"Check local agent setup and emit structured pass/fail lines.\",\n ],\n summary:\n \"Run OpenMeld diagnostics and stream structured check results for profile, gateway, connectivity, and local agent readiness.\",\n },\n entryName: \"doctor\",\n },\n \"repair.local-state\": {\n agentOverview: {\n commands: [\n \"openmeld repair local-state --view agent\",\n \"openmeld whoami --view agent\",\n ],\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [\n \"Repair local-state only affects your local OpenMeld installation and does not require sign-in.\",\n ],\n optionalArguments: [],\n requiredArguments: [],\n stages: [\n \"Inspect local OpenMeld storage versions and known legacy paths.\",\n \"Apply safe migrations and cleanup tasks.\",\n \"Return the final local-state alignment report.\",\n ],\n summary:\n \"Run the local OpenMeld data alignment and cleanup routine for your OpenMeld installation.\",\n },\n entryName: \"repair.local-state\",\n },\n \"service.install\": {\n agentOverview: {\n commands: [\n \"openmeld service install --view agent\",\n \"openmeld service start --view agent\",\n ],\n humanActionRequired: false,\n notes: [\n \"Install does not automatically start the service; use `openmeld service start --view agent` next.\",\n ],\n optionalArguments: [],\n requiredArguments: [],\n stages: [\n \"Prepare OpenMeld Service files for this CLI version.\",\n \"Persist installation metadata.\",\n \"Return installation state and local reply readiness.\",\n ],\n summary:\n \"Install OpenMeld Service runtime files for this OpenMeld installation.\",\n },\n entryName: \"service.install\",\n },\n \"service.menu\": {\n agentOverview: {\n commands: [\n \"openmeld service --view agent\",\n \"openmeld service status --view agent\",\n \"openmeld service snapshot --view agent\",\n \"openmeld service interrupt --dispatch <id> --view agent\",\n \"openmeld service cancel --dispatch <id> --view agent\",\n \"openmeld service start --view agent\",\n \"openmeld service stop --view agent\",\n \"openmeld service install --view agent\",\n \"openmeld service repair --view agent\",\n \"openmeld service uninstall --view agent\",\n ],\n humanActionRequired: false,\n notes: [\n \"Agent view does not open the human interactive service menu.\",\n \"Prefer explicit subcommands to keep automation deterministic.\",\n ],\n optionalArguments: [],\n requiredArguments: [],\n stages: [\n \"Inspect service installation and runtime state.\",\n \"Choose an explicit lifecycle command.\",\n \"Execute the requested OpenMeld Service task and read the structured result.\",\n ],\n summary:\n \"Manage the OpenMeld Service lifecycle on this device with explicit non-interactive commands.\",\n },\n entryName: \"service.menu\",\n },\n \"service.reinstall\": {\n agentOverview: {\n commands: [\n \"openmeld service repair --view agent\",\n \"openmeld service repair --force --view agent\",\n \"openmeld service status --view agent\",\n ],\n humanActionRequired: false,\n notes: [\n \"Use `--force` only when graceful drain times out and you accept possible in-flight task loss.\",\n ],\n optionalArguments: [\"--force\"],\n requiredArguments: [],\n stages: [\n \"Drain and tear down the current service safely.\",\n \"Repair OpenMeld Service files for this CLI version.\",\n \"Restart or report the service outcome.\",\n ],\n summary:\n \"Repair OpenMeld Service, preserving runtime data and optionally restarting it.\",\n },\n entryName: \"service.reinstall\",\n },\n \"service.run\": {\n agentOverview: {\n commands: [\n \"openmeld service start --view agent\",\n \"openmeld service start --mode foreground --view agent\",\n \"openmeld service status --view agent\",\n ],\n humanActionRequired: false,\n notes: [\n \"Background mode is the default and recommended mode.\",\n \"A selected OpenMeld profile is not required; use `--profile` only as an optional override.\",\n \"Use foreground mode when you need direct startup logs for debugging.\",\n ],\n optionalArguments: [\n \"--mode background|foreground\",\n \"--profile <id-or-name>\",\n \"--gateway-url <url>\",\n \"--device-id <id>\",\n \"--heartbeat-ms <n>\",\n ],\n requiredArguments: [],\n stages: [\n \"Validate local service installation and OpenMeld auth readiness.\",\n \"Resolve runtime mode and local service hygiene.\",\n \"Start the daemon and return runtime status.\",\n ],\n summary:\n \"Start OpenMeld Service with an explicit start mode and the existing OpenMeld sign-in context.\",\n },\n entryName: \"service.run\",\n },\n \"service.snapshot\": {\n agentOverview: {\n commands: [\n \"openmeld service snapshot --view agent\",\n \"openmeld service status --view agent\",\n ],\n humanActionRequired: false,\n notes: [\n \"Snapshot capture is read-only and does not modify OpenMeld Service state.\",\n ],\n optionalArguments: [\"--profile <id-or-name>\"],\n requiredArguments: [],\n stages: [\n \"Read the current local OpenMeld service status snapshot.\",\n \"Copy current runtime logs, state, and data into a lane-scoped evidence directory.\",\n \"Return the saved evidence path for follow-up debugging.\",\n ],\n summary:\n \"Capture a point-in-time OpenMeld Service evidence snapshot for the current lane.\",\n },\n entryName: \"service.snapshot\",\n },\n \"service.status\": {\n agentOverview: {\n commands: [\n \"openmeld service status --view agent\",\n \"openmeld service start --view agent\",\n \"openmeld service repair --view agent\",\n ],\n humanActionRequired: false,\n notes: [\n \"Status is read-only in agent view and does not change OpenMeld Service.\",\n \"Agent view emits daemon.status.local_result first with local service evidence, then daemon.status.result with full readiness diagnostics.\",\n ],\n optionalArguments: [\"--profile <id-or-name>\"],\n requiredArguments: [],\n stages: [\n \"Read installed service state and runtime state.\",\n \"Return fast local service evidence as daemon.status.local_result.\",\n \"Project local device readiness, gateway checks, route observation, and cleanup anomalies.\",\n \"Return full structured status and reply readiness as daemon.status.result.\",\n ],\n summary:\n \"Inspect local OpenMeld service installation, runtime state, readiness, and cleanup signals without changing state.\",\n },\n entryName: \"service.status\",\n },\n \"service.stop\": {\n agentOverview: {\n commands: [\n \"openmeld service stop --view agent\",\n \"openmeld service stop --force --view agent\",\n \"openmeld service status --view agent\",\n ],\n humanActionRequired: false,\n notes: [\n \"Use `--force` only when the service does not stop cleanly with the default graceful stop.\",\n ],\n optionalArguments: [\"--force\", \"--profile <id-or-name>\"],\n requiredArguments: [],\n stages: [\n \"Read the current local runtime state.\",\n \"Stop the active service process or managed service.\",\n \"Return the final stop result or not-running status.\",\n ],\n summary: \"Stop OpenMeld Service or the system-managed service instance.\",\n },\n entryName: \"service.stop\",\n },\n \"service.uninstall\": {\n agentOverview: {\n commands: [\n \"openmeld service uninstall --view agent\",\n \"openmeld service install --view agent\",\n ],\n humanActionRequired: false,\n notes: [\n \"Future OpenMeld startup checks will strongly recommend repairing OpenMeld Service after uninstall.\",\n ],\n optionalArguments: [],\n requiredArguments: [],\n stages: [\n \"Stop service processes when needed.\",\n \"Remove local service runtime assets and install metadata.\",\n \"Return uninstall state and next startup guidance.\",\n ],\n summary:\n \"Remove OpenMeld Service runtime files and clear local service state on this device.\",\n },\n entryName: \"service.uninstall\",\n },\n \"service.cancel\": {\n agentOverview: {\n humanActionRequired: false,\n notes: [\n \"`--dispatch` is the primary selector; `--task` is a debug-only backdoor.\",\n \"Cancel validates only local daemon runtime availability; it does not require OpenMeld sign-in or a selected OpenMeld profile.\",\n ],\n pattern: getDaemonControlTargetPatternContract(\"cancel\"),\n stages: [\n \"Resolve the local daemon control target.\",\n \"Send the cancel request through the local daemon control-plane.\",\n \"Return the accepted or rejected control result.\",\n ],\n summary:\n \"Send a cancel request to one inflight OpenMeld Service task on this device.\",\n },\n buildHints: () =>\n getDaemonControlTargetPatternContract(\"cancel\").buildHints?.({}) ?? [],\n entryName: \"service.cancel\",\n },\n \"service.interrupt\": {\n agentOverview: {\n humanActionRequired: false,\n notes: [\n \"`--dispatch` is the primary selector; `--task` is a debug-only backdoor.\",\n \"Interrupt validates only local daemon runtime availability; it does not require OpenMeld sign-in or a selected OpenMeld profile.\",\n ],\n pattern: getDaemonControlTargetPatternContract(\"interrupt\"),\n stages: [\n \"Resolve the local daemon control target.\",\n \"Send the interrupt request through the local daemon control-plane.\",\n \"Return the accepted or rejected control result.\",\n ],\n summary:\n \"Send an interrupt request to one inflight OpenMeld Service task on this device.\",\n },\n buildHints: () =>\n getDaemonControlTargetPatternContract(\"interrupt\").buildHints?.({}) ?? [],\n entryName: \"service.interrupt\",\n },\n reset: {\n agentOverview: {\n commands: [\"openmeld reset --yes --view agent\", \"openmeld start\"],\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [],\n optionalArguments: [\"--yes\"],\n requiredArguments: [],\n stages: [\n \"Confirm the destructive reset intent.\",\n \"Tear down the local OpenMeld service and remove lane data.\",\n \"Rebootstrap baseline OpenMeld files and bundled skills.\",\n ],\n summary:\n \"Destructively reset your local OpenMeld data, rebuild baseline files, and reinstall bundled OpenMeld skills.\",\n },\n entryName: \"reset\",\n },\n \"skills.install\": {\n agentOverview: {\n humanActionRequired: false,\n notes: (context: SkillsContractContext) => [\n \"Agent view requires explicit target selection for install.\",\n ...buildSkillsSharedNotes(context),\n ],\n pattern: getSkillsTargetSelectionPatternContract(\"install\"),\n stages: [\n \"Resolve explicit install targets.\",\n \"Install OpenMeld-managed skills into each target.\",\n \"Return install summary and tracked target state.\",\n ],\n summary:\n \"Install OpenMeld skills into known agent skills directories or a custom skills directory.\",\n },\n buildHints: (context: SkillsContractContext) =>\n getSkillsTargetSelectionPatternContract(\"install\").buildHints?.(\n context\n ) ?? [],\n entryName: \"skills.install\",\n guideScenarios: {\n required: {\n code: \"skills.install.arguments.required\",\n hints: (context: SkillsContractContext) =>\n getSkillsTargetSelectionPatternContract(\"install\").buildHints?.(\n context\n ) ?? [],\n humanSteps: [\"openmeld view human\", \"openmeld skills\"],\n notes: [\n \"Agent view does not open the interactive skills target picker.\",\n ],\n pattern: getSkillsTargetSelectionPatternContract(\"install\"),\n summary:\n \"openmeld skills install requires explicit target selection in agent/non-interactive mode.\",\n },\n },\n },\n \"skills.ensure\": {\n agentOverview: {\n humanActionRequired: false,\n notes: (context: SkillsContractContext) => [\n \"Agent view requires explicit target selection for ensure.\",\n \"Use ensure when you want one scoped command that installs or updates OpenMeld skills for the selected targets.\",\n ...buildSkillsSharedNotes(context),\n ],\n pattern: getSkillsTargetSelectionPatternContract(\"ensure\"),\n stages: [\n \"Resolve explicit ensure targets.\",\n \"Install or update OpenMeld-managed skills for each selected target.\",\n \"Return install and tracked target state.\",\n ],\n summary:\n \"Install or update OpenMeld skills for known agent skills directories or a custom skills directory.\",\n },\n buildHints: (context: SkillsContractContext) =>\n getSkillsTargetSelectionPatternContract(\"ensure\").buildHints?.(context) ??\n [],\n entryName: \"skills.ensure\",\n guideScenarios: {\n required: {\n code: \"skills.ensure.arguments.required\",\n hints: (context: SkillsContractContext) =>\n getSkillsTargetSelectionPatternContract(\"ensure\").buildHints?.(\n context\n ) ?? [],\n humanSteps: [\"openmeld view human\", \"openmeld skills\"],\n notes: [\n \"Agent view does not open the interactive skills target picker.\",\n ],\n pattern: getSkillsTargetSelectionPatternContract(\"ensure\"),\n summary:\n \"openmeld skills ensure requires explicit target selection in agent/non-interactive mode.\",\n },\n },\n },\n uninstall: {\n agentOverview: {\n commands: [\n \"openmeld uninstall --view agent --yes --keep-skills --keep-auth-tokens\",\n \"openmeld uninstall --view agent --yes --remove-skills --remove-auth-tokens\",\n ],\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [\n \"Uninstall removes the currently selected local OpenMeld installation by default.\",\n \"CLI self-removal is always a manual final step.\",\n ],\n optionalArguments: [\n \"--yes\",\n \"--keep-skills\",\n \"--remove-skills\",\n \"--keep-auth-tokens\",\n \"--remove-auth-tokens\",\n ],\n requiredArguments: [],\n stages: [\n \"Resolve uninstall scope and cleanup choices.\",\n \"Stop local OpenMeld service state and remove your local OpenMeld data.\",\n \"Return the final manual CLI removal command.\",\n ],\n summary:\n \"Remove your local OpenMeld data, optionally clear OpenMeld-managed skills and sign-in tokens, and return the final manual CLI removal step.\",\n },\n entryName: \"uninstall\",\n },\n upgrade: {\n agentOverview: {\n commands: [\n \"openmeld upgrade --check --view agent\",\n \"openmeld upgrade --yes --view agent\",\n \"openmeld reset --yes --view agent\",\n ],\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [\n \"Agent view requires explicit `--yes` before installing updates.\",\n \"When local version metadata is missing, reset your local OpenMeld data before retrying upgrade.\",\n ],\n optionalArguments: [\"--check\", \"--yes\"],\n requiredArguments: [],\n stages: [\n \"Read local version metadata and compare with npm latest.\",\n \"Confirm downgrade safety and explicit installation intent.\",\n \"Install the latest CLI version and update OpenMeld Service when needed.\",\n ],\n summary:\n \"Inspect OpenMeld CLI version state and, when explicitly approved, install the latest safe CLI version.\",\n },\n entryName: \"upgrade\",\n },\n whoami: {\n agentOverview: {\n commands: [\n \"openmeld whoami --view agent\",\n \"openmeld whoami --profile <profile-id> --view agent\",\n \"openmeld auth status --view agent\",\n ],\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [\n \"Whoami is read-only and does not change profile selection unless the process already has one resolved.\",\n ],\n optionalArguments: [\"--profile <id-or-name>\"],\n requiredArguments: [],\n stages: [\n \"Read auth session status.\",\n \"Resolve the explicit or current OpenMeld profile.\",\n \"Return auth, profile, and runtime context payloads.\",\n ],\n summary:\n \"Inspect the current OpenMeld auth session, selected OpenMeld profile, and agent runtime context in one structured response sequence.\",\n },\n entryName: \"whoami\",\n },\n \"skills.menu\": {\n buildHints: (context: SkillsContractContext) => [\n \"openmeld skills list\",\n \"openmeld skills check\",\n \"openmeld skills update\",\n ...(getSkillsTargetSelectionPatternContract(\"ensure\").buildHints?.(\n context\n ) ?? []),\n ...(getSkillsTargetSelectionPatternContract(\"install\").buildHints?.(\n context\n ) ?? []),\n ...(getSkillsTargetSelectionPatternContract(\"uninstall\").buildHints?.(\n context\n ) ?? []),\n ],\n entryName: \"skills.menu\",\n },\n \"skills.uninstall\": {\n agentOverview: {\n humanActionRequired: false,\n notes: (context: SkillsContractContext) => [\n \"Agent view requires explicit target selection for uninstall.\",\n ...buildSkillsSharedNotes(context),\n ],\n pattern: getSkillsTargetSelectionPatternContract(\"uninstall\"),\n stages: [\n \"Resolve explicit uninstall targets.\",\n \"Audit whether targets are inside this OpenMeld installation.\",\n \"Remove OpenMeld-managed skills and update tracked state.\",\n ],\n summary:\n \"Remove OpenMeld-managed skills from known or custom targets with explicit target selection.\",\n },\n buildHints: (context: SkillsContractContext) =>\n getSkillsTargetSelectionPatternContract(\"uninstall\").buildHints?.(\n context\n ) ?? [],\n entryName: \"skills.uninstall\",\n guideScenarios: {\n required: {\n code: \"skills.uninstall.arguments.required\",\n hints: (context: SkillsContractContext) =>\n getSkillsTargetSelectionPatternContract(\"uninstall\").buildHints?.(\n context\n ) ?? [],\n humanSteps: [\"openmeld view human\", \"openmeld skills\"],\n notes: [\n \"Agent view does not open the interactive skills target picker.\",\n ],\n pattern: getSkillsTargetSelectionPatternContract(\"uninstall\"),\n summary:\n \"openmeld skills uninstall requires explicit target selection in agent/non-interactive mode.\",\n },\n },\n },\n \"space.add-agents\": buildSpaceAddProfilesContract({\n command: \"add-agents\",\n entryName: \"space.add-agents\",\n humanChoiceText:\n \"Choose one space, then select one or more Agent Profiles.\",\n requiredSummary:\n \"openmeld space add-agents in agent/non-interactive mode requires explicit space and Agent Profile arguments.\",\n summary:\n \"Use `openmeld space add-agents --profile <profile-id> <space-id> --agent-profile <agent-profile-id...> --view agent` with explicit acting profile, Space ID, and Agent Profile selection.\",\n }),\n \"space.add-me\": {\n agentOverview: {\n commands: ({ includeViewFlag = false }) => [\n `openmeld space add-me <space-url-or-id> --project-folder <path>${includeViewFlag ? \" --view agent\" : \"\"}`,\n ],\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [\n \"`--profile <human-profile-id>` selects the Human Profile used as the signed-in user's acting identity; it is not the Agent Profile being added.\",\n \"`--project-folder` is the preferred option name.\",\n \"`--workspace-path`, `--working-directory`, and `--cwd` are accepted aliases for `--project-folder`.\",\n \"Space membership does not prove Wake readiness.\",\n 'Typical use case: the user sends a Space URL and says, \"add yourself to this Space using the current project folder.\"',\n ],\n optionalArguments: [\n \"--profile <human-profile-id>\",\n \"--project-folder <path>\",\n \"--workspace-path <path>\",\n \"--working-directory <path>\",\n \"--cwd <path>\",\n \"--agent-controller-permission-mode <permission-mode>\",\n \"--details\",\n \"--json\",\n ],\n requiredArguments: [\"<space-url-or-id>\"],\n stages: [\n \"Parse the Space URL or Space ID and optional profileId.\",\n \"Detect the current agent controller, or use the Human Profile path when no supported agent controller is present.\",\n \"For agents, create or reuse the current Agent Profile Binding and set the Project folder.\",\n \"Add the Human Profile or Agent Profile to the Space through the normal membership write path.\",\n ],\n summary:\n \"Add the current Human Profile or current local agent to a Space with one command.\",\n },\n buildHints: () => [\n \"openmeld space add-me <space-url-or-id> --project-folder <path> --view agent\",\n \"Aliases accepted for Project folder: --workspace-path, --working-directory, --cwd.\",\n \"Space membership does not prove Wake readiness.\",\n ],\n entryName: \"space.add-me\",\n guideScenarios: {\n required: {\n code: \"space.add_me.arguments.required\",\n commands: ({ includeViewFlag = false }) => [\n `openmeld space add-me <space-url-or-id> --project-folder <path>${includeViewFlag ? \" --view agent\" : \"\"}`,\n ],\n hints: () => [\n \"Use --project-folder for the current project directory. The aliases --workspace-path, --working-directory, and --cwd are accepted.\",\n \"Space membership does not prove Wake readiness.\",\n ],\n humanSteps: [\n \"openmeld view human\",\n \"openmeld space add-me <space-url-or-id>\",\n ],\n notes: [\n 'Typical use case: the user sends a Space URL and says, \"add yourself to this Space using the current project folder.\"',\n \"The command accepts a full Space URL such as /o/<org-slug>/spaces/<space-id>?profileId=<human-profile-id>.\",\n ],\n optionalArguments: [\n \"--profile <human-profile-id>\",\n \"--project-folder <path>\",\n \"--workspace-path <path>\",\n \"--working-directory <path>\",\n \"--cwd <path>\",\n \"--agent-controller-permission-mode <permission-mode>\",\n \"--details\",\n \"--json\",\n ],\n requiredArguments: [\"<space-url-or-id>\"],\n summary:\n \"openmeld space add-me requires a Space URL or Space ID. Agents should use `openmeld space add-me <space-url-or-id> --project-folder <path> --view agent`.\",\n },\n },\n },\n \"space.add-human-profiles\": buildSpaceAddProfilesContract({\n command: \"add-human-profiles\",\n entryName: \"space.add-human-profiles\",\n humanChoiceText:\n \"Choose one space, then select one or more Human Profiles.\",\n requiredSummary:\n \"openmeld space add-human-profiles in agent/non-interactive mode requires explicit space and Human Profile arguments.\",\n summary:\n \"Use `openmeld space add-human-profiles --profile <profile-id> <space-id> --human-profile <human-profile-id...> --view agent` with explicit acting profile, Space ID, and Human Profile selection.\",\n }),\n \"space.add-members\": buildSpaceAddProfilesContract({\n command: \"add-members\",\n entryName: \"space.add-members\",\n humanChoiceText: \"Choose one space, then select one or more profiles.\",\n requiredSummary:\n \"openmeld space add-members in agent/non-interactive mode requires explicit space and member arguments.\",\n summary:\n \"Use `openmeld space add-members --profile <profile-id> <space-id> --member <profile-id...> --view agent` with explicit acting profile, Space ID, and member selection.\",\n }),\n \"space.remove-members\": {\n agentOverview: {\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [\n \"remove-members only manages existing members of the current space.\",\n \"the current profile and the space creator are never removable through this command.\",\n ],\n pattern: getSpaceMemberSelectionPatternContract(\"remove-members\"),\n stages: [\n \"check_arguments\",\n \"authenticate\",\n \"check_profile\",\n \"resolve_target\",\n \"remove_members\",\n ],\n summary:\n \"Use `openmeld space remove-members --profile <profile-id> <space-id> --member <profile-id...> --view agent` with explicit acting profile, Space ID, and member selection.\",\n },\n buildHints: (context) =>\n getSpaceMemberSelectionPatternContract(\"remove-members\").buildHints?.({\n ...context,\n includeViewFlag: true,\n profileId: context.profileId ?? \"<profile-id>\",\n }) ?? [],\n entryName: \"space.remove-members\",\n guideScenarios: {\n required: {\n code: \"space.remove_members.arguments.required\",\n humanSteps: [\n \"openmeld view human\",\n \"openmeld space remove-members\",\n \"Choose one space, then select one or more members to remove.\",\n ],\n notes: [\n \"remove-members only manages existing members of the current space.\",\n \"the current profile and the space creator are never removable through this command.\",\n ],\n pattern: getSpaceMemberSelectionPatternContract(\"remove-members\"),\n summary: (context: { summary?: string }) =>\n context.summary ??\n \"openmeld space remove-members in agent/non-interactive mode requires explicit space and member arguments.\",\n },\n },\n },\n};\n\nexport function getCommandEntryContract(\n entryName: CommandEntryName\n): CommandEntryContract<CommandContractRegistryContext> | null {\n return COMMAND_ENTRY_CONTRACTS[entryName] ?? null;\n}\n\nexport function getCommandHintsFromContract<\n TContext extends CommandContractRenderContext,\n>(input: { context: TContext; entryName: CommandEntryName }): string[] | null {\n const contract = getCommandEntryContract(input.entryName);\n if (!contract?.buildHints) {\n return null;\n }\n return contract.buildHints(input.context);\n}\n\nfunction buildSkillsSharedNotes(context: SkillsContractContext): string[] {\n const notes: string[] = [];\n if (context.storeDir) {\n notes.push(`OpenMeld skills store: ${context.storeDir}`);\n }\n if (context.knownAgentIds) {\n notes.push(\n `known agent ids: ${\n context.knownAgentIds.length > 0\n ? context.knownAgentIds.join(\", \")\n : \"none detected\"\n }`\n );\n }\n if (context.skills) {\n notes.push(\n `local OpenMeld skills: ${\n context.skills.length > 0\n ? context.skills\n .map((skill) => `${skill.name} (${skill.relativePath})`)\n .join(\", \")\n : \"none\"\n }`\n );\n }\n return notes;\n}\n","import { buildAgentFacingPublicationModeGuideLines } from \"@openmeld/space-mesh\";\nimport { createGuideErrorFromContract } from \"../command-contracts/helpers\";\nimport {\n getCommandEntryContract,\n getCommandHintsFromContract,\n} from \"../command-contracts/registry\";\nimport { DualViewGuideError } from \"./dual-view-guide-error\";\n\ntype SpaceTargetCommand =\n | \"access\"\n | \"join\"\n | \"watch\"\n | \"contract\"\n | \"status\"\n | \"guide\"\n | \"delete\";\ntype SpaceSubcommandTarget = \"send\" | \"history\" | \"thread\" | \"password\";\ntype ProfileAction = \"set\" | \"delete\" | \"show\" | \"update\";\ntype SpaceAliasCommand = \"send\" | \"tail\";\ntype UpgradeConfirmationScenario = \"outdated\" | \"check_failed\";\nconst SPACE_GATEWAY_PARENT_OPTION_TEXT =\n \"parent option: openmeld space --gateway-url <url>\";\nconst SPACE_CONTRACT_SET_USAGE =\n \"openmeld space [--gateway-url <url>] contract set [--profile <profile-id>] <space-id> [--dispatch-policy <mention_only|listen_all>] [--publication-mode <collaboration|transparent>] [--allowed-actions <post_message,post_status,stay_silent>] [--result-archive-mode <none|space_reply_only|all_final_results>] [--entry-brief <default|none>] [--dispatch-brief <default|none>] [--json] [--password <value>]\";\nconst SPACE_PUBLICATION_SET_USAGE =\n \"openmeld space [--gateway-url <url>] publication set [--profile <profile-id>] <space-id> <collaboration|transparent> --password <space-password> [--json]\";\nconst SPACE_HISTORY_USAGE =\n \"openmeld space [--gateway-url <url>] history [--profile <profile-id>] <space-id> [--limit <n>] [--after-signal <signal-id>] [--around-signal <signal-id> --before <n> --after <n>] [--from-profile <profile-id>] [--kind <text|status|system_notice>] [--json] [--password <value>]\";\nexport type ProfileActionGuideExamples = {\n controllerRefExample?: string;\n transportModeExample?: string;\n};\n\nexport function createStartAgentIdentityGuideError(summary?: string) {\n return new DualViewGuideError({\n code: \"start.agent.identity.required\",\n guide: {\n summary:\n summary ??\n \"openmeld start in agent view requires explicit agent profile selection or creation arguments.\",\n humanSteps: [\"openmeld view human\", \"openmeld start\"],\n agentRequiredArgs: [\n \"--profile-id <existing-agent-profile-id> or --profile <existing-agent-profile-id|name>\",\n \"or --kind agent --profile-name <name> (create; profile ID issued by OpenMeld)\",\n ],\n agentOptionalArgs: [\"--gateway-url <url>\"],\n agentCommands: [\n \"openmeld start --view agent --profile-id <existing-agent-profile-id>\",\n \"openmeld start --view agent --profile <existing-agent-profile-id-or-name>\",\n \"openmeld start --view agent --kind agent --profile-name <new-agent-profile-name>\",\n \"openmeld setup --view agent\",\n \"openmeld profiles create <new-agent-profile-name> --kind agent --view agent\",\n \"openmeld profiles list --view agent\",\n \"openmeld space create --profile <agent-profile-id> --name <space-name> --view agent\",\n \"openmeld space join --profile <agent-profile-id> <space-id> --view agent\",\n ],\n notes: [\n \"openmeld start in agent view selects or creates an Agent Profile and returns Space commands. Run `openmeld setup --view agent` when this computer needs local service or agent setup.\",\n \"creating profiles never accepts custom profile IDs; IDs are issued by OpenMeld auth.\",\n \"if a human is operating this terminal, switch to human view first.\",\n ],\n },\n hints: [\n \"openmeld view human\",\n \"openmeld start --view agent --profile-id <existing-agent-profile-id>\",\n \"openmeld start --view agent --kind agent --profile-name <new-agent-profile-name>\",\n \"openmeld setup --view agent\",\n \"openmeld space create --profile <agent-profile-id> --name <space-name> --view agent\",\n ],\n });\n}\n\nexport function createSpaceMenuGuideError() {\n return new DualViewGuideError({\n code: \"space.menu.interactive.required\",\n guide: {\n summary: \"openmeld space menu is interactive in human view only.\",\n humanSteps: [\"openmeld view human\", \"openmeld space\"],\n agentCommands: [\n \"openmeld space [--gateway-url <url>] list [--profile <profile-id>] [--limit <n>] [--json]\",\n \"openmeld space [--gateway-url <url>] create [--profile <profile-id>] --name <name> --visibility <public|private> [--guide <text>] [--password <value>] [--join|--no-join] [--output text|ndjson]\",\n \"openmeld space [--gateway-url <url>] join [--profile <profile-id>] <space-id> [--password <value>] [--local-echo|--no-local-echo] [--history-limit <n>] [--role <text>] [--mention-alias <token>] [--output text|ndjson]\",\n \"openmeld space [--gateway-url <url>] watch [--profile <profile-id>] <space-id> [--password <value>] [--history-limit <n>] [--output text|ndjson]\",\n \"openmeld space [--gateway-url <url>] link <space-id> [--signal <signal-id>] [--thread-root-signal <signal-id>] --view agent\",\n \"openmeld space [--gateway-url <url>] access [--profile <profile-id>] <space-url-or-id> [--json] [--password <value>]\",\n \"openmeld space [--gateway-url <url>] send [--profile <profile-id>] <space-id> [<text...>|--stdin|--text-file <path>] [--file <path>...] [--plain] [--password <value>]\",\n SPACE_HISTORY_USAGE,\n \"openmeld space [--gateway-url <url>] contract [--profile <profile-id>] <space-id> [--json] [--password <value>]\",\n SPACE_CONTRACT_SET_USAGE,\n SPACE_PUBLICATION_SET_USAGE,\n \"openmeld space [--gateway-url <url>] status [--profile <profile-id>] <space-id> [--json] [--password <value>]\",\n \"openmeld space [--gateway-url <url>] updates [--profile <profile-id>] <space-id> --after-signal <signal-id> [--limit <n>] [--json] [--password <value>]\",\n \"openmeld space [--gateway-url <url>] result [--profile <profile-id>] <space-id> (--dispatch <dispatch-id>|--result-ref <result-ref>) [--json] [--password <value>]\",\n \"openmeld space [--gateway-url <url>] guide [--profile <profile-id>] <space-id> [--json] [--password <value>]\",\n \"openmeld space [--gateway-url <url>] guide set [--profile <profile-id>] <space-id> <text...> [--json] [--password <value>]\",\n \"openmeld space [--gateway-url <url>] guide clear [--profile <profile-id>] <space-id> [--json] [--password <value>]\",\n \"openmeld space [--gateway-url <url>] add-agents [--profile <profile-id>] <space-id> (--agent-profile <agent-profile-id...>|--all) [--password <value>]\",\n \"openmeld space [--gateway-url <url>] add-human-profiles [--profile <profile-id>] <space-id> (--human-profile <human-profile-id...>|--all) [--password <value>]\",\n \"openmeld space [--gateway-url <url>] add-members [--profile <profile-id>] <space-id> (--member <profile-id...>|--all) [--password <value>]\",\n \"openmeld space [--gateway-url <url>] remove-members [--profile <profile-id>] <space-id> (--member <profile-id...>|--all) [--password <value>]\",\n \"openmeld space [--gateway-url <url>] leave [--profile <profile-id>] <space-id> [--password <value>]\",\n \"openmeld space [--gateway-url <url>] delete [--profile <profile-id>] <space-id> [--password <value>]\",\n \"openmeld space [--gateway-url <url>] password [--profile <profile-id>] <space-id> (--password <value>|--clear)\",\n ],\n notes: [\n \"Use explicit subcommands in agent view; do not rely on menu.\",\n \"Gateway overrides stay on the parent command: `openmeld space --gateway-url <url> <subcommand> ...`.\",\n ],\n },\n hints: [\n \"openmeld space list --profile <profile-id>\",\n \"openmeld space create --profile <profile-id> --name spaceship\",\n \"openmeld space join --profile <profile-id> <space-id>\",\n \"openmeld space watch --profile <profile-id> <space-id>\",\n ],\n });\n}\n\nexport function createSpaceContractSetGuideError(summary?: string) {\n return new DualViewGuideError({\n code: \"space.contract.set.arguments.required\",\n guide: {\n summary:\n summary ??\n \"openmeld space contract set needs an explicit space ID and at least one patch field in agent view.\",\n humanSteps: [\n \"openmeld view human\",\n \"openmeld space contract set <space-id>\",\n \"Follow the guided contract editor.\",\n ],\n agentRequiredArgs: [\"<space-id>\", \"at least one patch field\"],\n agentOptionalArgs: [\n \"--dispatch-policy <mention_only|listen_all>\",\n \"--publication-mode <collaboration|transparent>\",\n \"--allowed-actions <post_message,post_status,stay_silent>\",\n \"--result-archive-mode <none|space_reply_only|all_final_results>\",\n \"--entry-brief <default|none>\",\n \"--dispatch-brief <default|none>\",\n \"--json\",\n \"--password <value>\",\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n agentCommands: [SPACE_CONTRACT_SET_USAGE],\n notes: [\n \"agent view must send explicit patch fields; it does not open the interactive editor.\",\n \"patch writes only the fields you provide.\",\n ],\n },\n });\n}\n\nexport function createSpacePublicationSetGuideError(summary?: string) {\n return new DualViewGuideError({\n code: \"space.publication.set.arguments.required\",\n guide: {\n summary:\n summary ??\n \"openmeld space publication set needs an explicit space ID, mode, and Space password.\",\n humanSteps: [\n \"openmeld view human\",\n \"openmeld space publication set <space-id> <collaboration|transparent> --password <space-password>\",\n ],\n agentRequiredArgs: [\n \"<space-id>\",\n \"<collaboration|transparent>\",\n \"--password <space-password>\",\n ],\n agentOptionalArgs: [\n \"--json\",\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <owner-profile-id>\",\n ],\n agentCommands: [SPACE_PUBLICATION_SET_USAGE],\n notes: buildAgentFacingPublicationModeGuideLines(),\n },\n });\n}\n\nexport function createSpaceCreateGuideError(summary?: string) {\n return new DualViewGuideError({\n code: \"space.create.arguments.required\",\n guide: {\n summary:\n summary ??\n \"openmeld space create requires explicit --name and --visibility public|private in agent/non-interactive mode.\",\n humanSteps: [\n \"openmeld view human\",\n \"openmeld space\",\n 'Select \"Create a space\".',\n ],\n agentRequiredArgs: [\"--name <name>\", \"--visibility <public|private>\"],\n agentOptionalArgs: [\n \"--guide <text>\",\n \"--password <value>\",\n \"--join|--no-join\",\n \"--output <text|ndjson>\",\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n agentCommands: [\n \"openmeld space [--gateway-url <url>] create [--profile <profile-id>] --name <name> --visibility <public|private> [--guide <text>] [--password <value>] [--join|--no-join] [--output text|ndjson]\",\n \"openmeld space [--gateway-url <url>] list [--profile <profile-id>] [--limit <n>] [--json]\",\n \"openmeld space [--gateway-url <url>] join [--profile <profile-id>] <space-id> [--password <value>] [--local-echo|--no-local-echo] [--history-limit <n>] [--role <text>] [--mention-alias <token>] [--output text|ndjson]\",\n ],\n notes: [\n \"Agent view does not prompt for missing space names or organization visibility.\",\n \"Use explicit arguments so create can stay deterministic.\",\n ],\n },\n hints: [\n \"openmeld space create --profile <profile-id> --name <space-name> --visibility private --view agent\",\n \"openmeld space list --profile <profile-id> --view agent\",\n ],\n });\n}\n\nexport function createSpaceAddMembersGuideError(\n summary?: string,\n entryName:\n | \"space.add-agents\"\n | \"space.add-human-profiles\"\n | \"space.add-members\" = \"space.add-members\"\n) {\n return createGuideErrorFromContract({\n context: {\n includeViewFlag: true,\n profileId: \"<profile-id>\",\n summary: summary ?? getSpaceAddProfilesDefaultRequiredSummary(entryName),\n },\n guideScenario: getRequiredCommandGuideScenario(entryName),\n });\n}\n\nfunction getSpaceAddProfilesDefaultRequiredSummary(\n entryName:\n | \"space.add-agents\"\n | \"space.add-human-profiles\"\n | \"space.add-members\"\n): string {\n switch (entryName) {\n case \"space.add-agents\":\n return \"openmeld space add-agents in agent/non-interactive mode requires explicit space and Agent Profile arguments.\";\n case \"space.add-human-profiles\":\n return \"openmeld space add-human-profiles in agent/non-interactive mode requires explicit space and Human Profile arguments.\";\n case \"space.add-members\":\n return \"openmeld space add-members in agent/non-interactive mode requires explicit space and member arguments.\";\n default:\n assertNever(entryName);\n }\n}\n\nfunction assertNever(value: never): never {\n throw new Error(`unexpected value: ${String(value)}`);\n}\n\nexport function createSpaceRemoveMembersGuideError(summary?: string) {\n return createGuideErrorFromContract({\n context: {\n includeViewFlag: true,\n profileId: \"<profile-id>\",\n summary:\n summary ??\n \"openmeld space remove-members in agent/non-interactive mode requires explicit space and member arguments.\",\n },\n guideScenario: getRequiredCommandGuideScenario(\"space.remove-members\"),\n });\n}\n\nexport function createSpaceLeaveGuideError(summary?: string) {\n return new DualViewGuideError({\n code: \"space.leave.arguments.required\",\n guide: {\n summary:\n summary ??\n \"openmeld space leave in agent/non-interactive mode requires explicit space argument.\",\n humanSteps: [\n \"openmeld view human\",\n \"openmeld space leave\",\n \"Choose one space, then confirm leaving it.\",\n ],\n agentRequiredArgs: [\"<space-id>\"],\n agentOptionalArgs: [\n \"--profile <profile-id>\",\n \"--password <value>\",\n \"--view <agent|human|auto>\",\n ],\n agentCommands: [\n \"openmeld space leave <space-id> --profile <profile-id> --view agent\",\n \"openmeld space list --profile <profile-id> --view agent\",\n ],\n notes: [\n \"leave only removes the current profile from the space.\",\n \"the space creator cannot leave; delete the space instead when only the creator remains.\",\n ],\n },\n hints: [\n \"openmeld space leave <space-id> --profile <profile-id> --view agent\",\n ],\n });\n}\n\nexport function createSpaceTargetGuideError(command: SpaceTargetCommand) {\n const optionalArgsByCommand: Record<SpaceTargetCommand, string[]> = {\n access: [\n \"--json\",\n \"--password <value>\",\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n join: [\n \"--password <value>\",\n \"--local-echo|--no-local-echo\",\n \"--history-limit <n>\",\n \"--role <text>\",\n \"--mention-alias <token>\",\n \"--output <text|ndjson>\",\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n watch: [\n \"--password <value>\",\n \"--history-limit <n>\",\n \"--output <text|ndjson>\",\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n contract: [\n \"--json\",\n \"--password <value>\",\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n status: [\n \"--json\",\n \"--password <value>\",\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n guide: [\n \"--json\",\n \"--password <value>\",\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n delete: [\n \"--password <value>\",\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n };\n\n const commandSignaturesByCommand: Record<SpaceTargetCommand, string[]> = {\n access: [\n \"openmeld space [--gateway-url <url>] access [--profile <profile-id>] <space-url-or-id> [--json] [--password <value>]\",\n ],\n join: [\n \"openmeld space [--gateway-url <url>] join [--profile <profile-id>] <space-id> [--password <value>] [--local-echo|--no-local-echo] [--history-limit <n>] [--role <text>] [--mention-alias <token>] [--output text|ndjson]\",\n ],\n watch: [\n \"openmeld space [--gateway-url <url>] watch [--profile <profile-id>] <space-id> [--password <value>] [--history-limit <n>] [--output text|ndjson]\",\n ],\n contract: [\n \"openmeld space [--gateway-url <url>] contract [--profile <profile-id>] <space-id> [--json] [--password <value>]\",\n ],\n status: [\n \"openmeld space [--gateway-url <url>] status [--profile <profile-id>] <space-id> [--json] [--password <value>]\",\n ],\n guide: [\n \"openmeld space [--gateway-url <url>] guide [--profile <profile-id>] <space-id> [--json] [--password <value>]\",\n \"openmeld space [--gateway-url <url>] guide set [--profile <profile-id>] <space-id> <text...> [--json] [--password <value>]\",\n \"openmeld space [--gateway-url <url>] guide clear [--profile <profile-id>] <space-id> [--json] [--password <value>]\",\n ],\n delete: [\n \"openmeld space [--gateway-url <url>] delete [--profile <profile-id>] <space-id> [--password <value>]\",\n ],\n };\n\n return new DualViewGuideError({\n code: `space.${command}.target.required`,\n guide: {\n summary: `openmeld space ${command} requires explicit space target in agent view.`,\n humanSteps: [\"openmeld view human\", \"openmeld space\"],\n agentRequiredArgs: [\n `<space-id> (required positional argument for openmeld space ${command})`,\n ],\n agentOptionalArgs: optionalArgsByCommand[command],\n agentCommands: commandSignaturesByCommand[command],\n },\n });\n}\n\nexport function createSpaceUpdatesGuideError(summary?: string) {\n return new DualViewGuideError({\n code: \"space.updates.arguments.required\",\n guide: {\n summary:\n summary ??\n \"openmeld space updates needs an explicit space ID and --after-signal anchor in agent view.\",\n humanSteps: [\"openmeld view human\", \"openmeld space\"],\n agentRequiredArgs: [\"<space-id>\", \"--after-signal <signal-id>\"],\n agentOptionalArgs: [\n \"--limit <n>\",\n \"--json\",\n \"--password <value>\",\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n agentCommands: [\n \"openmeld space [--gateway-url <url>] updates [--profile <profile-id>] <space-id> --after-signal <signal-id> [--limit <n>] [--json] [--password <value>]\",\n ],\n notes: [\n \"updates reads only formal post-anchor public signals.\",\n \"use --json for machine consumption in agent view.\",\n ],\n },\n });\n}\n\nexport function createSpaceResultGuideError(summary?: string) {\n return new DualViewGuideError({\n code: \"space.result.arguments.required\",\n guide: {\n summary:\n summary ??\n \"openmeld space result needs an explicit space ID and exactly one selector in agent view.\",\n humanSteps: [\"openmeld view human\", \"openmeld space\"],\n agentRequiredArgs: [\n \"<space-id>\",\n \"one selector: --dispatch <dispatch-id> | --result-ref <result-ref>\",\n ],\n agentOptionalArgs: [\n \"--json\",\n \"--password <value>\",\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n agentCommands: [\n \"openmeld space [--gateway-url <url>] result [--profile <profile-id>] <space-id> --dispatch <dispatch-id> [--json] [--password <value>]\",\n \"openmeld space [--gateway-url <url>] result [--profile <profile-id>] <space-id> --result-ref <result-ref> [--json] [--password <value>]\",\n ],\n notes: [\n \"exactly one selector is required.\",\n \"lookups stay scoped to the current space.\",\n ],\n },\n });\n}\n\nexport function createSpaceDeleteHumanApprovalGuideError(summary?: string) {\n return new DualViewGuideError({\n code: \"space.delete.human_approval_required\",\n guide: {\n summary:\n summary ??\n \"space delete requires owner human confirmation in an interactive terminal.\",\n humanSteps: [\n \"Use a human TTY session with the owner account.\",\n \"Run: openmeld view human\",\n \"Run: openmeld space delete <space-id>\",\n \"Confirm deletion when prompted.\",\n ],\n agentRequiredArgs: [\n \"You cannot delete directly in agent mode/non-interactive sessions.\",\n ],\n agentOptionalArgs: [\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n agentCommands: [\n \"openmeld view human\",\n \"openmeld space [--gateway-url <url>] delete [--profile <profile-id>] <space-id>\",\n ],\n notes: [\n \"For agent-created spaces, the owner's human session must approve deletion.\",\n \"Future enhancement may support web/email approval flow.\",\n ],\n },\n hints: [\"openmeld view human\", \"openmeld space delete <space-id>\"],\n });\n}\n\nexport function createSpaceSubcommandTargetGuideError(\n command: SpaceSubcommandTarget\n) {\n const requiredArgsByCommand: Record<SpaceSubcommandTarget, string[]> = {\n send: [\"<space-id>\", \"message text and/or --file <path>\"],\n history: [\"<space-id>\"],\n thread: [\"<space-id>\", \"<thread-id>\"],\n password: [\"<space-id>\", \"one action: --password <value> | --clear\"],\n };\n const optionalArgsByCommand: Record<SpaceSubcommandTarget, string[]> = {\n send: [\n \"--file <path> (repeatable, max 10)\",\n \"--text-file <path>\",\n \"--password <value>\",\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n history: [\n \"--limit <n>\",\n \"--after-signal <signal-id>\",\n \"--around-signal <signal-id>\",\n \"--before <n>\",\n \"--after <n>\",\n \"--from-profile <profile-id>\",\n \"--kind <text|status|system_notice>\",\n \"--json\",\n \"--password <value>\",\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n thread: [\n \"--password <value>\",\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n password: [SPACE_GATEWAY_PARENT_OPTION_TEXT, \"--profile <profile-id>\"],\n };\n const commandByCommand: Record<SpaceSubcommandTarget, string> = {\n send: \"openmeld space [--gateway-url <url>] send [--profile <profile-id>] <space-id> [<text...>|--stdin|--text-file <path>] [--file <path>...] [--plain] [--password <value>]\",\n history: SPACE_HISTORY_USAGE,\n thread:\n \"openmeld space [--gateway-url <url>] thread [--profile <profile-id>] <space-id> <thread-id> [--password <value>]\",\n password:\n \"openmeld space [--gateway-url <url>] password [--profile <profile-id>] <space-id> (--password <value>|--clear)\",\n };\n const summaryByCommand: Record<SpaceSubcommandTarget, string> = {\n send: \"openmeld space send requires explicit positional arguments in agent view.\",\n history:\n \"openmeld space history requires explicit positional arguments in agent view.\",\n thread:\n \"openmeld space thread requires a space ID and a thread ID in agent view.\",\n password:\n \"openmeld space password needs a space ID and one action (--password or --clear) in agent view.\",\n };\n const humanStepsByCommand: Record<SpaceSubcommandTarget, string[]> = {\n send: [\"openmeld view human\", \"openmeld space\"],\n history: [\"openmeld view human\", \"openmeld space\"],\n thread: [\"openmeld view human\", \"openmeld space\"],\n password: [\n \"openmeld view human\",\n \"openmeld space\",\n 'Select \"Configure a space\" -> \"Password\" and pick the target space by name',\n ],\n };\n\n return new DualViewGuideError({\n code: `space.${command}.arguments.required`,\n guide: {\n summary: summaryByCommand[command],\n humanSteps: humanStepsByCommand[command],\n agentRequiredArgs: requiredArgsByCommand[command],\n agentOptionalArgs: optionalArgsByCommand[command],\n agentCommands: [\n \"openmeld space [--gateway-url <url>] list [--profile <profile-id>] [--limit <n>] [--json]\",\n commandByCommand[command],\n \"openmeld space [--gateway-url <url>] join [--profile <profile-id>] <space-id> [--history-limit <n>] [--output text|ndjson]\",\n ],\n },\n });\n}\n\nexport function createSpaceProfileRequiredGuideError() {\n return new DualViewGuideError({\n code: \"space.profile.required\",\n guide: {\n summary:\n \"No selected OpenMeld profile is available for this command in the current OpenMeld CLI context.\",\n humanSteps: [\n \"If this is an interactive human terminal: run `openmeld whoami`, confirm the current profile, then retry.\",\n \"If no usable profile exists yet, create one first.\",\n ],\n agentRequiredArgs: [\n \"--profile <profile-id> when no selected profile exists\",\n ],\n agentOptionalArgs: [\"--view <auto|human|agent>\"],\n agentCommands: [\n \"openmeld profiles list --view agent\",\n \"openmeld profiles create <profile-name> --kind agent --view agent\",\n \"openmeld profiles set <profile-id> --view agent\",\n \"openmeld whoami --profile <profile-id> --view agent\",\n \"openmeld space create --profile <profile-id> --name <space-name> --view agent\",\n \"openmeld space join --profile <profile-id> <space-id> --view agent\",\n ],\n notes: [\n \"This error is about the selected OpenMeld profile state, not the sign-in state.\",\n \"In non-TTY/isolated sessions, always pass --profile explicitly.\",\n ],\n },\n hints: [\n \"openmeld profiles create <profile-name> --kind agent --view agent\",\n \"openmeld profiles set <profile-id> --view agent\",\n \"openmeld space create --profile <profile-id> --name <space-name> --view agent\",\n ],\n });\n}\n\nexport function createSpaceAgentProfileOnlyGuideError(input: {\n profileId: string;\n profileKind: string;\n}) {\n return new DualViewGuideError({\n code: \"space.profile.agent_only\",\n guide: {\n summary: `this Space operation requires an Agent Profile (received ${input.profileKind}:${input.profileId}).`,\n humanSteps: [\n \"Use a Human Profile when acting for the user.\",\n \"Use an Agent Profile only when the operation needs an AI teammate identity.\",\n ],\n agentRequiredArgs: [\"--profile <agent-profile-id>\"],\n agentOptionalArgs: [\"--view <agent|human|auto>\"],\n agentCommands: [\n \"openmeld profiles list --view agent\",\n \"openmeld profiles set <agent-profile-id> --view agent\",\n \"openmeld space join <space-id> --profile <agent-profile-id> --view agent\",\n \"openmeld space send <space-id> [<text...>|--stdin|--text-file <path>] [--file <path>...] --profile <agent-profile-id> --view agent\",\n ],\n notes: [\n \"First run `openmeld profiles list --view agent` to find an agent profile ID.\",\n \"Then rerun the space command with `--profile <agent-profile-id>`.\",\n \"`--view agent` controls output format. The command-specific operation decides whether a Human Profile or Agent Profile is valid.\",\n ],\n },\n hints: [\n \"openmeld profiles list --view agent\",\n \"openmeld profiles set <agent-profile-id> --view agent\",\n \"openmeld view human\",\n ],\n });\n}\n\nexport function createSpaceUnsupportedProfileKindGuideError(input: {\n profileId: string;\n profileKind: string;\n}) {\n return new DualViewGuideError({\n code: \"space.profile.unsupported_kind\",\n guide: {\n summary: `Space commands require a human or agent profile (received ${input.profileKind}:${input.profileId}).`,\n humanSteps: [\n \"Choose a human profile when you are acting for the user.\",\n \"Choose an agent profile when that agent identity should speak, be added, or be woken in the Space.\",\n ],\n agentRequiredArgs: [\"--profile <human-or-agent-profile-id>\"],\n agentOptionalArgs: [\"--view <agent|human|auto>\"],\n agentCommands: [\n \"openmeld profiles list --view agent\",\n \"openmeld space list --profile <profile-id> --view agent\",\n \"openmeld space history <space-id> --profile <profile-id> --kind text --limit 20 --view agent\",\n ],\n notes: [\n \"`--view agent` controls machine-readable output. It does not require the acting identity to be an Agent Profile.\",\n \"System profiles are internal and cannot be used as the acting identity for Space commands.\",\n ],\n },\n hints: [\n \"openmeld profiles list --view agent\",\n \"openmeld space list --profile <profile-id> --view agent\",\n ],\n });\n}\n\nexport function createSpaceAddMembersCurrentProfileGuideError(input: {\n profileId: string;\n}) {\n return new DualViewGuideError({\n code: \"space.add_members.current_profile_join_required\",\n guide: {\n summary:\n \"Current profile joins a space with `openmeld space join`, not `add-members`.\",\n humanSteps: [\n \"Stay on the current profile and join the Space directly.\",\n \"Use add-members only for other profiles you want to bring with you.\",\n ],\n agentRequiredArgs: [\"<space-id>\", `--profile ${input.profileId}`],\n agentOptionalArgs: [\"--view <agent|human|auto>\"],\n agentCommands: [\n `openmeld space join <space-id> --profile ${input.profileId} --view agent`,\n `openmeld space send <space-id> \"hello\" --profile ${input.profileId} --view agent`,\n ],\n notes: [\n \"add-members is only for additional profiles, not the profile that is currently acting.\",\n ],\n },\n hints: [\n `openmeld space join <space-id> --profile ${input.profileId} --view agent`,\n ],\n });\n}\n\nexport function createSpaceRemoveMembersCurrentProfileGuideError(input: {\n profileId: string;\n}) {\n return new DualViewGuideError({\n code: \"space.remove_members.current_profile_forbidden\",\n guide: {\n summary:\n \"Current profile cannot remove itself from a space with `remove-members`. Use `openmeld space leave` instead.\",\n humanSteps: [\n \"Use `openmeld space leave` when the current profile should exit the space.\",\n \"Use `remove-members` only for other members.\",\n \"If you need a different cleanup action, switch to another owned profile first.\",\n ],\n agentRequiredArgs: [\"<space-id>\", `--profile ${input.profileId}`],\n agentOptionalArgs: [\"--view <agent|human|auto>\"],\n agentCommands: [\n `openmeld space leave <space-id> --profile ${input.profileId} --view agent`,\n `openmeld space history <space-id> --profile ${input.profileId} --kind text --limit 20 --view agent`,\n ],\n notes: [\n \"self-removal is blocked for remove-members; leave is the self-exit command.\",\n ],\n },\n hints: [\n `openmeld space leave <space-id> --profile ${input.profileId} --view agent`,\n ],\n });\n}\n\nexport function createSpaceLeaveCreatorGuideError(input: {\n spaceId?: string;\n message?: string;\n}) {\n const spaceArg = input.spaceId?.trim() || \"<space-id>\";\n return new DualViewGuideError({\n code: \"space.leave.creator_forbidden\",\n guide: {\n summary:\n input.message ??\n \"The space creator cannot leave this space. Delete the space instead when only you remain.\",\n humanSteps: [\n \"If you are done with the space and only you remain, delete the space.\",\n \"If other members still need it, keep the creator profile in the space.\",\n ],\n agentRequiredArgs: [\"<space-id>\", \"--profile <creator-profile-id>\"],\n agentOptionalArgs: [\"--view <agent|human|auto>\"],\n agentCommands: [\n `openmeld space delete ${spaceArg} --profile <creator-profile-id> --view human`,\n `openmeld space status ${spaceArg} --profile <creator-profile-id> --view agent`,\n ],\n notes: [\n \"Core is the authority for creator leave checks; CLI only presents the result.\",\n ],\n },\n hints: [\n `openmeld space delete ${spaceArg} --profile <creator-profile-id> --view human`,\n ],\n });\n}\n\nexport function createSpaceRemoveMembersCreatorGuideError(input?: {\n profileId?: string;\n}) {\n const creatorProfileId = input?.profileId?.trim();\n return new DualViewGuideError({\n code: \"space.remove_members.creator_forbidden\",\n guide: {\n summary: \"The space creator cannot be removed from this space.\",\n humanSteps: [\n \"Remove other members instead of the space creator.\",\n \"If the goal is to retire the space, delete the space from a human owner session.\",\n ],\n agentRequiredArgs: [\"<space-id>\"],\n agentOptionalArgs: [\n \"--member <other-profile-id...>\",\n \"--all\",\n \"--profile <profile-id>\",\n ],\n agentCommands: [\n \"openmeld space remove-members <space-id> --profile <profile-id> --member <other-profile-id> --view agent\",\n \"openmeld view human\",\n \"openmeld space delete <space-id>\",\n ],\n notes: [\n ...(creatorProfileId\n ? [`blocked creator profile: ${creatorProfileId}`]\n : []),\n ],\n },\n hints: [\n \"openmeld space remove-members <space-id> --profile <profile-id> --member <other-profile-id> --view agent\",\n \"openmeld view human\",\n \"openmeld space delete <space-id>\",\n ],\n });\n}\n\nexport function createSpaceSendInputRequiredGuideError() {\n return new DualViewGuideError({\n code: \"send.input.required\",\n guide: {\n summary:\n \"openmeld space send requires message text or at least one --file <path>.\",\n humanSteps: [\n 'Use quick text: openmeld space send <space-id> \"hello\"',\n \"Or pipe stdin: echo 'hello' | openmeld space send <space-id> --stdin\",\n \"Or read message text from a file: openmeld space send <space-id> --text-file /tmp/message.txt\",\n \"Or share a file without filler text: openmeld space send <space-id> --file /tmp/launch-brief.pdf\",\n ],\n agentRequiredArgs: [\"exactly one input source\"],\n agentOptionalArgs: [\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n agentCommands: [\n 'openmeld space send --profile <profile-id> <space-id> \"hello\"',\n \"cat /tmp/message.txt | openmeld space send --profile <profile-id> <space-id> --stdin\",\n \"openmeld space send --profile <profile-id> <space-id> --text-file /tmp/message.txt\",\n \"openmeld space send --profile <profile-id> <space-id> --file /tmp/launch-brief.pdf\",\n 'openmeld space send --profile <profile-id> <space-id> --wake <agent-profile-id> \"Please review.\"',\n ],\n notes: [\n \"Prefer --stdin/--text-file for multiline or shell-sensitive message text.\",\n \"Use repeatable --file options to share up to 10 Space Files with or without message text.\",\n \"Text is always literal. Use --wake, --reference, or --mention with full Profile IDs for recipients; --plain asserts there are none.\",\n ],\n },\n });\n}\n\nexport function createSpaceSendInputConflictGuideError() {\n return new DualViewGuideError({\n code: \"send.input.conflict\",\n guide: {\n summary:\n \"openmeld space send received conflicting message text sources. Use only one of: <text...>, --stdin, --text-file <path>.\",\n humanSteps: [\n \"Pick only one source per command.\",\n \"Remove extra input flags and retry.\",\n ],\n agentRequiredArgs: [\"exactly one input source\"],\n agentCommands: [\n 'openmeld space send --profile <profile-id> <space-id> \"hello\"',\n \"openmeld space send --profile <profile-id> <space-id> --stdin\",\n \"openmeld space send --profile <profile-id> <space-id> --text-file /tmp/message.txt\",\n 'openmeld space send --profile <profile-id> <space-id> --wake <agent-profile-id> \"Please review.\"',\n ],\n notes: [\n \"Do not combine positional text with --stdin or --text-file.\",\n \"A --file attachment may be combined with any one message text source.\",\n \"Text is always literal. Use --wake, --reference, or --mention with full Profile IDs for recipients; --plain asserts there are none.\",\n ],\n },\n });\n}\n\nexport function createSpaceSendInputFileReadFailedGuideError(\n path: string,\n reason: string\n) {\n return new DualViewGuideError({\n code: \"send.input.file_read_failed\",\n guide: {\n summary: `failed to read send input file: ${path}`,\n humanSteps: [\n \"Check file path and permissions.\",\n \"Retry with a readable UTF-8 text file.\",\n ],\n agentRequiredArgs: [\"--text-file <path> must exist and be readable\"],\n agentCommands: [\n \"ls -l <path>\",\n \"cat <path>\",\n \"openmeld space send --profile <profile-id> <space-id> --text-file <path>\",\n ],\n notes: [`read error: ${reason}`],\n },\n });\n}\n\nexport function createSpaceSendInputEmptyGuideError() {\n return new DualViewGuideError({\n code: \"send.input.empty\",\n guide: {\n summary: \"send input is empty after normalization.\",\n humanSteps: [\n \"Provide non-empty text.\",\n \"For stdin/file mode, ensure content is not blank.\",\n ],\n agentRequiredArgs: [\"non-empty message text\"],\n agentCommands: [\n 'openmeld space send --profile <profile-id> <space-id> \"hello\"',\n \"echo 'hello' | openmeld space send --profile <profile-id> <space-id> --stdin\",\n ],\n },\n });\n}\n\nexport function createProfileMenuGuideError() {\n return new DualViewGuideError({\n code: \"profile.menu.interactive.required\",\n guide: {\n summary: \"openmeld profiles menu is interactive in human view only.\",\n humanSteps: [\"openmeld view human\", \"openmeld profile\"],\n agentRequiredArgs: [\n \"set: <profile-id> (or --profile <id>)\",\n \"delete: <profile-id> (or --profile <id>)\",\n \"delete in non-interactive mode: --force\",\n ],\n agentOptionalArgs: [\"--view <auto|human|agent>\"],\n agentCommands: [\n \"openmeld profiles create <profileName> --kind agent [--name <profileName>]\",\n \"openmeld start --view human\",\n \"openmeld profiles list | openmeld profiles ls\",\n \"openmeld profiles show <profile-id> [--profile <id>]\",\n \"openmeld profiles set <profile-id> [--profile <id>]\",\n \"openmeld profiles update <profile-id> [--profile <id>] [--name <profileName>] [--workspace-mode <openmeld-managed|custom>] [--workspace-path <path>]\",\n \"openmeld profiles delete <profile-id> [--profile <id>] --force\",\n ],\n },\n hints: [\n \"openmeld view human\",\n \"openmeld profile\",\n \"openmeld profiles list\",\n \"openmeld profiles set <profile>\",\n ],\n });\n}\n\nexport function createProfileCreateGuideError(summary: string) {\n return new DualViewGuideError({\n code: \"profile.create.arguments.required\",\n guide: {\n summary: `openmeld profiles create: ${summary}`,\n humanSteps: [\n \"openmeld view human\",\n \"openmeld profile\",\n \"Select: Create profile -> Profile kind (Human or Agent) -> Profile name\",\n ],\n agentRequiredArgs: [\n \"--kind agent\",\n \"<profileName> (positional) or --name <profileName>\",\n ],\n agentOptionalArgs: [\"--view <auto|human|agent>\"],\n agentCommands: [\n \"openmeld profiles create <profileName> --kind agent --view agent\",\n \"openmeld profiles list --view agent\",\n \"openmeld profiles set <profile-id> --view agent\",\n \"openmeld whoami --profile <profile-id> --view agent\",\n \"openmeld space create --profile <profile-id> --name <space-name> --view agent\",\n \"openmeld space join --profile <profile-id> <space-id> --view agent\",\n ],\n notes: [\n \"agent view can only create agent profiles for the current authenticated owner.\",\n \"to create a human profile, switch to human view first.\",\n \"created profiles always include ownerUserId from the authenticated session.\",\n ],\n },\n });\n}\n\nexport function createProfileActionGuideError(\n action: ProfileAction,\n summary: string,\n _examples?: ProfileActionGuideExamples\n) {\n const requiredArgsByAction: Record<ProfileAction, string[]> = {\n show: [\"<profile-id> (positional) or --profile <id>\"],\n set: [\"<profile-id> (positional) or --profile <id>\"],\n delete: [\n \"<profile-id> (positional) or --profile <id>\",\n \"--force (required in non-interactive mode)\",\n ],\n update: [\n \"<profile-id> (positional) or --profile <id>\",\n \"at least one update field: --name or --workspace-mode\",\n ],\n };\n\n const commandByAction: Record<ProfileAction, string> = {\n show: \"openmeld profiles show <profile-id> [--profile <id>] [--view <auto|human|agent>]\",\n set: \"openmeld profiles set <profile-id> [--profile <id>] [--view <auto|human|agent>]\",\n delete:\n \"openmeld profiles delete <profile-id> [--profile <id>] --force [--view <auto|human|agent>]\",\n update:\n \"openmeld profiles update <profile-id> [--profile <id>] [--name <profileName>] [--workspace-mode <openmeld-managed|custom>] [--workspace-path <path>] [--view <auto|human|agent>]\",\n };\n\n return new DualViewGuideError({\n code: `profile.${action}.arguments.required`,\n guide: {\n summary: `openmeld profiles ${action}: ${summary}`,\n humanSteps: [\"openmeld view human\", \"openmeld profile\"],\n agentRequiredArgs: requiredArgsByAction[action],\n agentOptionalArgs: [\"--view <auto|human|agent>\"],\n agentCommands: [\n commandByAction[action],\n \"openmeld profiles list\",\n \"openmeld start --view human\",\n \"openmeld start --kind agent --profile-id <existing-agent-profile-id>\",\n \"openmeld start --kind agent --profile-name <new-agent-profile-name>\",\n ],\n },\n });\n}\n\nexport function createSkillsMenuGuideError(input: {\n storeDir: string;\n knownAgentIds: string[];\n agentExampleArg?: string;\n skills: Array<{\n id: string;\n name: string;\n relativePath: string;\n absolutePath: string;\n }>;\n}) {\n const agentExampleArg = normalizeGuideExample(\n input.agentExampleArg,\n \"<id...>\"\n );\n const notes = [`OpenMeld skills store: ${input.storeDir}`];\n if (input.knownAgentIds.length > 0) {\n notes.push(`known agent ids: ${input.knownAgentIds.join(\", \")}`);\n } else {\n notes.push(\"known agent ids: none detected\");\n }\n\n if (input.skills.length > 0) {\n notes.push(\"local OpenMeld skills:\");\n for (const skill of input.skills) {\n notes.push(` - ${skill.name} (${skill.relativePath})`);\n }\n } else {\n notes.push(\"local OpenMeld skills: none\");\n }\n\n return new DualViewGuideError({\n code: \"skills.menu.interactive.required\",\n guide: {\n summary: \"openmeld skills menu is interactive in human view only.\",\n humanSteps: [\"openmeld view human\", \"openmeld skills\"],\n agentCommands:\n getCommandHintsFromContract({\n context: {\n agentExampleArg,\n knownAgentIds: input.knownAgentIds,\n skills: input.skills.map((skill) => ({\n name: skill.name,\n relativePath: skill.relativePath,\n })),\n storeDir: input.storeDir,\n },\n entryName: \"skills.menu\",\n }) ?? [],\n notes,\n },\n hints: [\n \"openmeld view human\",\n \"openmeld skills\",\n \"openmeld skills list\",\n \"openmeld skills check\",\n \"openmeld skills update\",\n \"openmeld skills install --all\",\n ],\n });\n}\n\nexport function createSkillsActionGuideError(input: {\n action: \"ensure\" | \"install\" | \"uninstall\";\n agentExampleArg?: string;\n}) {\n return createGuideErrorFromContract({\n context: {\n agentExampleArg: normalizeGuideExample(input.agentExampleArg, \"<id...>\"),\n },\n guideScenario: getRequiredCommandGuideScenario(`skills.${input.action}`),\n });\n}\n\nfunction normalizeGuideExample(\n value: string | undefined,\n fallback: string\n): string {\n const normalized = String(value ?? \"\").trim();\n return normalized.length > 0 ? normalized : fallback;\n}\n\nexport function createSpaceAliasTargetGuideError(command: SpaceAliasCommand) {\n const requiredArgsByCommand: Record<SpaceAliasCommand, string[]> = {\n send: [\"--space <space-id>\", \"message text and/or --file <path>\"],\n tail: [\"--space <space-id>\"],\n };\n const optionalArgsByCommand: Record<SpaceAliasCommand, string[]> = {\n send: [\n \"--profile <id>\",\n \"--base-url <url>\",\n \"--password <value>\",\n \"--stdin\",\n \"--text-file <path>\",\n \"--file <path> (repeatable, max 10)\",\n ],\n tail: [\n \"--profile <id>\",\n \"--base-url <url>\",\n \"--password <value>\",\n \"--limit <n>\",\n \"--json\",\n ],\n };\n const commandByAlias: Record<SpaceAliasCommand, string> = {\n send: \"openmeld send [<text...>|--stdin|--text-file <path>] [--file <path>...] --space <space-id> [--plain] [--password <value>] [--profile <id>] [--base-url <url>]\",\n tail: \"openmeld tail --space <space-id> [--limit <n>] [--after-signal <signal-id>] [--around-signal <signal-id> --before <n> --after <n>] [--from-profile <profile-id>] [--kind <text|status|system_notice>] [--json] [--password <value>] [--profile <id>] [--base-url <url>]\",\n };\n const preferredCommand: Record<SpaceAliasCommand, string> = {\n send: \"openmeld space [--gateway-url <url>] send [--profile <profile-id>] <space-id> [<text...>|--stdin|--text-file <path>] [--file <path>...] [--plain] [--password <value>]\",\n tail: SPACE_HISTORY_USAGE,\n };\n\n return new DualViewGuideError({\n code: `space.${command}.alias.target.required`,\n guide: {\n summary: `openmeld ${command} requires explicit --space argument in agent view.`,\n humanSteps: [\"openmeld view human\", \"openmeld space\"],\n agentRequiredArgs: requiredArgsByCommand[command],\n agentOptionalArgs: optionalArgsByCommand[command],\n agentCommands: [commandByAlias[command], preferredCommand[command]],\n notes: [\"Alias command detected. Prefer `openmeld space ...` commands.\"],\n },\n });\n}\n\nexport function createResetConfirmationGuideError() {\n return new DualViewGuideError({\n code: \"reset.confirmation.required\",\n guide: {\n summary:\n \"openmeld reset in agent view requires explicit confirmation flag.\",\n humanSteps: [\"openmeld view human\", \"openmeld reset\"],\n agentRequiredArgs: [\"--yes\"],\n agentCommands: [\"openmeld reset --yes\"],\n notes: [\n \"`openmeld reset` is destructive. Keep `--yes` explicit in agent view.\",\n ],\n },\n hints: [\"openmeld reset --yes\"],\n });\n}\n\nexport function createUpgradeConfirmationGuideError(\n scenario: UpgradeConfirmationScenario\n) {\n const summary =\n scenario === \"outdated\"\n ? \"openmeld upgrade in agent view requires --yes before installing updates.\"\n : \"openmeld upgrade in agent view requires --yes when version check fails.\";\n\n const notes =\n scenario === \"outdated\"\n ? [\n \"Use `openmeld upgrade --check` to inspect versions without installing.\",\n ]\n : [\n \"Use `openmeld upgrade --check` to inspect status first.\",\n \"When check fails, install requires explicit `--yes` in agent view.\",\n ];\n\n return new DualViewGuideError({\n code: `upgrade.confirmation.required.${scenario}`,\n guide: {\n summary,\n humanSteps: [\"openmeld view human\", \"openmeld upgrade\"],\n agentRequiredArgs: [\"--yes\"],\n agentOptionalArgs: [\"--check\"],\n agentCommands: [\"openmeld upgrade --yes\", \"openmeld upgrade --check\"],\n notes,\n },\n hints: [\"openmeld upgrade --yes\", \"openmeld upgrade --check\"],\n });\n}\n\nexport function createStartAuthenticationGuideError() {\n return new DualViewGuideError({\n code: \"start.auth.required\",\n guide: {\n summary:\n \"openmeld start requires sign-in before OpenMeld profile selection.\",\n humanSteps: [\"openmeld view human\", \"openmeld login\", \"openmeld start\"],\n agentCommands: [\n \"openmeld auth status --view agent\",\n \"openmeld login --view agent --method ott --ott <token>\",\n \"openmeld start --view agent\",\n ],\n notes: [\n \"If a human is operating this terminal, switch to human view first.\",\n ],\n },\n hints: [\"openmeld login\", \"openmeld auth status\", \"openmeld start\"],\n });\n}\n\nexport function createAuthLoginGuideError(summary: string) {\n return createGuideErrorFromContract({\n context: {\n includeViewFlag: true,\n summary,\n },\n guideScenario: getRequiredCommandGuideScenario(\"auth.login\"),\n });\n}\n\nfunction getRequiredCommandGuideScenario(\n entryName:\n | \"auth.login\"\n | \"skills.ensure\"\n | \"skills.install\"\n | \"skills.uninstall\"\n | \"space.add-agents\"\n | \"space.add-human-profiles\"\n | \"space.add-members\"\n | \"space.remove-members\"\n) {\n const contract = getCommandEntryContract(entryName);\n const guideScenario = contract?.guideScenarios?.required;\n if (!guideScenario) {\n throw new Error(`missing required guide scenario for ${entryName}`);\n }\n return guideScenario;\n}\n\nexport function createDoctorFailedGuideError() {\n return new DualViewGuideError({\n code: \"doctor.summary.failed\",\n guide: {\n summary: \"openmeld doctor detected one or more failed checks.\",\n humanSteps: [\"openmeld view human\", \"openmeld doctor\"],\n agentOptionalArgs: [\"--profile <id>\", \"--gateway-url <url>\"],\n agentCommands: [\n \"openmeld doctor --view agent [--profile <id>] [--gateway-url <url>]\",\n \"openmeld whoami --view agent\",\n \"openmeld auth status --view agent\",\n ],\n notes: [\n \"Inspect preceding `doctor.check.fail` outputs for exact failure details.\",\n ],\n },\n });\n}\n","import type { RuntimeContext } from \"./types\";\n\nexport function canUseInteractivePrompts(context: RuntimeContext): boolean {\n return context.resolvedView === \"human\" && context.interactive;\n}\n","import type {\n DaemonServiceUpdateJob,\n OpenMeldToolsUpdateAttempt,\n OpenMeldToolsUpdateFailureCode,\n OpenMeldToolsUpdateOperation,\n} from \"@openmeld/schemas/types\";\nimport type { OpenMeldPathResolutionInput } from \"../../config/paths\";\nimport {\n readLastDaemonServiceUpdate,\n readPendingDaemonServiceUpdate,\n} from \"../lifecycle/daemon-service-update-state\";\nimport {\n readLastOpenMeldToolsUpdateAttempt,\n readPendingOpenMeldToolsUpdateAttempt,\n} from \"./openmeld-tools-update-attempt-state\";\nimport { resolvePersistedOpenMeldToolsUpdateFailure } from \"./openmeld-tools-update-failure\";\n\nconst TERMINAL_VISIBILITY_MS = 24 * 60 * 60 * 1000;\n\nexport type OpenMeldToolsUpdateOperationProjection = {\n failureCode: OpenMeldToolsUpdateFailureCode | null;\n operation: OpenMeldToolsUpdateOperation;\n};\n\nexport async function resolveOpenMeldToolsUpdateOperation(\n pathInput: OpenMeldPathResolutionInput = {},\n nowMs = Date.now()\n): Promise<OpenMeldToolsUpdateOperation | null> {\n const projection = await resolveOpenMeldToolsUpdateOperationProjection(\n pathInput,\n nowMs\n );\n return projection?.operation ?? null;\n}\n\nexport async function resolveOpenMeldToolsUpdateOperationProjection(\n pathInput: OpenMeldPathResolutionInput = {},\n nowMs = Date.now()\n): Promise<OpenMeldToolsUpdateOperationProjection | null> {\n const [servicePending, toolsPending] = await Promise.all([\n readPendingDaemonServiceUpdate(pathInput),\n readPendingOpenMeldToolsUpdateAttempt(pathInput),\n ]);\n if (servicePending) {\n return projectServiceJob(servicePending);\n }\n if (toolsPending) {\n return projectToolsAttempt(toolsPending);\n }\n\n const [serviceLast, toolsLast] = await Promise.all([\n readLastDaemonServiceUpdate(pathInput),\n readLastOpenMeldToolsUpdateAttempt(pathInput),\n ]);\n const candidates = [\n ...(serviceLast ? [projectServiceJob(serviceLast)] : []),\n ...(toolsLast ? [projectToolsAttempt(toolsLast)] : []),\n ]\n .filter((candidate) => isRecentTerminal(candidate.operation, nowMs))\n .sort(\n (a, b) =>\n Date.parse(b.operation.updatedAt) - Date.parse(a.operation.updatedAt)\n );\n return candidates[0] ?? null;\n}\n\nfunction projectToolsAttempt(\n attempt: OpenMeldToolsUpdateAttempt\n): OpenMeldToolsUpdateOperationProjection {\n const terminalFailure =\n attempt.operation.phase === \"needs_help\" ||\n attempt.operation.phase === \"restored\";\n return {\n failureCode: terminalFailure\n ? (resolvePersistedOpenMeldToolsUpdateFailure(attempt.errorMessage) ??\n \"cli.update.failed\")\n : null,\n operation: attempt.operation,\n };\n}\n\nfunction projectServiceJob(\n job: DaemonServiceUpdateJob\n): OpenMeldToolsUpdateOperationProjection {\n return {\n failureCode:\n job.phase === \"needs_help\" || job.phase === \"restored\"\n ? \"cli.update.service_alignment_failed\"\n : null,\n operation: {\n operationId: job.jobId,\n phase: job.phase,\n requestSource: job.requestSource,\n requestedAt: job.requestedAt,\n ...(job.targetCliVersion\n ? { targetCliVersion: job.targetCliVersion }\n : {}),\n ...(job.targetServiceVersion\n ? { targetServiceVersion: job.targetServiceVersion }\n : {}),\n targetVersion: job.targetVersion,\n updatedAt: job.updatedAt,\n urgency: job.urgency,\n },\n };\n}\n\nfunction isRecentTerminal(\n operation: OpenMeldToolsUpdateOperation,\n nowMs: number\n): boolean {\n if (\n operation.phase !== \"updated\" &&\n operation.phase !== \"restored\" &&\n operation.phase !== \"needs_help\"\n ) {\n return false;\n }\n const updatedAtMs = Date.parse(operation.updatedAt);\n return (\n Number.isFinite(updatedAtMs) &&\n nowMs >= updatedAtMs &&\n nowMs - updatedAtMs <= TERMINAL_VISIBILITY_MS\n );\n}\n","import { isCancel, select } from \"@clack/prompts\";\nimport {\n formatInlineOpenMeldCliCommands,\n formatOpenMeldCliCommand,\n} from \"../runtime/cli-entry-command\";\n\nexport const DAEMON_INSTALL_DECISION_CHOICE = {\n install: \"install\",\n notNow: \"not_now\",\n} as const;\n\nexport type DaemonInstallDecisionKind = \"missing\" | \"outdated\";\n\nexport type DaemonInstallDecisionChoice =\n | (typeof DAEMON_INSTALL_DECISION_CHOICE)[keyof typeof DAEMON_INSTALL_DECISION_CHOICE]\n | \"cancelled\";\n\ntype DaemonVersionInput = {\n installedVersion?: string;\n expectedVersion: string;\n};\n\ntype DaemonInstallDecisionPromptConfig = {\n message: string;\n initialValue: (typeof DAEMON_INSTALL_DECISION_CHOICE)[\"install\"];\n options: Array<{\n value:\n | (typeof DAEMON_INSTALL_DECISION_CHOICE)[\"install\"]\n | (typeof DAEMON_INSTALL_DECISION_CHOICE)[\"notNow\"];\n label: string;\n hint?: string;\n }>;\n};\n\nconst DAEMON_INSTALL_COMMAND = \"openmeld service install\";\nconst DAEMON_REPAIR_COMMAND = \"openmeld service repair\";\nconst DAEMON_UPGRADE_COMMAND = \"openmeld upgrade\";\nconst DAEMON_AUTO_INSTALL_ALWAYS_FLAG = \"`--service-auto-install always`\";\nconst DAEMON_DECISION_RECOMMENDED_HINT = \"Recommended\";\n\nconst DAEMON_INSTALL_DECISION_COPY = {\n missing: {\n question: \"OpenMeld Service is missing. Install it now?\",\n explanation: \"Without it, this computer can't receive local Wake work.\",\n primaryLabel: \"Yes, install it for me\",\n deferred:\n \"OpenMeld Service is still missing. Install it later with `openmeld service install` so this computer can receive local Wake work.\",\n failed:\n \"OpenMeld Service could not be installed. Run `openmeld service install` so this computer can receive local Wake work.\",\n },\n outdated: {\n question: \"OpenMeld Service update required. Update it now?\",\n explanation:\n \"This service artifact is not compatible with current local Wake execution.\",\n primaryLabel: \"Yes, update it for me\",\n deferred:\n \"OpenMeld Service update skipped. Run `openmeld service update` before using local Wake work.\",\n failed: \"OpenMeld Service was not updated. Run `openmeld service update`.\",\n },\n} as const satisfies Record<\n DaemonInstallDecisionKind,\n {\n question: string;\n explanation: string;\n primaryLabel: string;\n deferred: string;\n failed: string;\n }\n>;\n\nexport function buildDaemonInstallDecisionPromptConfig(input: {\n kind: DaemonInstallDecisionKind;\n installedVersion?: string;\n expectedVersion?: string;\n}): DaemonInstallDecisionPromptConfig {\n const copy = DAEMON_INSTALL_DECISION_COPY[input.kind];\n const detailLine =\n input.kind === \"outdated\" &&\n typeof input.installedVersion === \"string\" &&\n typeof input.expectedVersion === \"string\"\n ? `Installed v${input.installedVersion}, expected v${input.expectedVersion}.`\n : null;\n return {\n message: [copy.question, copy.explanation, detailLine]\n .filter((line) => typeof line === \"string\" && line.length > 0)\n .join(\"\\n\"),\n initialValue: DAEMON_INSTALL_DECISION_CHOICE.install,\n options: [\n {\n value: DAEMON_INSTALL_DECISION_CHOICE.install,\n label: copy.primaryLabel,\n hint: DAEMON_DECISION_RECOMMENDED_HINT,\n },\n {\n value: DAEMON_INSTALL_DECISION_CHOICE.notNow,\n label: \"Not now\",\n },\n ],\n };\n}\n\nexport async function promptForDaemonInstallDecision(input: {\n kind: DaemonInstallDecisionKind;\n installedVersion?: string;\n expectedVersion?: string;\n}): Promise<DaemonInstallDecisionChoice> {\n const choice = await select(buildDaemonInstallDecisionPromptConfig(input));\n if (isCancel(choice)) {\n return \"cancelled\";\n }\n return choice === DAEMON_INSTALL_DECISION_CHOICE.install\n ? DAEMON_INSTALL_DECISION_CHOICE.install\n : DAEMON_INSTALL_DECISION_CHOICE.notNow;\n}\n\nexport async function runDaemonInstallDecisionPrompt(input: {\n kind: DaemonInstallDecisionKind;\n installedVersion?: string;\n expectedVersion?: string;\n emitLine: (text: string) => Promise<void> | void;\n installService: () => Promise<void>;\n}): Promise<\"install\" | \"not_now\" | \"cancelled\" | \"failed\"> {\n const decision = await promptForDaemonInstallDecision({\n kind: input.kind,\n installedVersion: input.installedVersion,\n expectedVersion: input.expectedVersion,\n });\n if (decision === DAEMON_INSTALL_DECISION_CHOICE.install) {\n try {\n await input.installService();\n return \"install\";\n } catch {\n await input.emitLine(formatDaemonInstallFailedMessage(input.kind));\n return \"failed\";\n }\n }\n\n if (decision === \"cancelled\") {\n return \"cancelled\";\n }\n\n await input.emitLine(formatDaemonInstallDeferredMessage(input.kind));\n return decision;\n}\n\nexport function formatDaemonInstallDeferredMessage(\n kind: DaemonInstallDecisionKind\n): string {\n return formatInlineOpenMeldCliCommands(\n DAEMON_INSTALL_DECISION_COPY[kind].deferred\n );\n}\n\nexport function formatDaemonInstallFailedMessage(\n kind: DaemonInstallDecisionKind\n): string {\n return formatInlineOpenMeldCliCommands(\n DAEMON_INSTALL_DECISION_COPY[kind].failed\n );\n}\n\nexport function formatDaemonServiceMissingRecommendation(): string {\n return \"OpenMeld Service is not installed yet. Install it so this computer can receive local Wake work.\";\n}\n\nexport function formatDaemonServiceInstallRecommendationNextStep(): string {\n return `Run \\`${formatOpenMeldCliCommand(DAEMON_INSTALL_COMMAND)}\\` now, or re-run command with ${DAEMON_AUTO_INSTALL_ALWAYS_FLAG}.`;\n}\n\nexport function formatDaemonServiceMissingStatus(): string {\n return \"Not installed yet.\";\n}\n\nexport function formatDaemonServiceMissingMeaning(): string {\n return \"Missing — install OpenMeld Service before this computer can receive local Wake work.\";\n}\n\nexport function formatDaemonServiceMissingAction(): string {\n return `Run \\`${formatOpenMeldCliCommand(DAEMON_INSTALL_COMMAND)}\\` to set it up.`;\n}\n\nexport function formatDaemonServiceMissingRunStepOne(): string {\n return `\\`${formatOpenMeldCliCommand(DAEMON_INSTALL_COMMAND)}\\``;\n}\n\nexport function formatDaemonServiceMissingRunStepTwo(): string {\n return `\\`${formatOpenMeldCliCommand(\"openmeld service start\")}\\``;\n}\n\nexport function formatDaemonServiceOutdatedRecommendation(\n input: DaemonVersionInput\n): string {\n const installedVersion = input.installedVersion ?? \"unknown\";\n return `OpenMeld Service version differs from this CLI (installed v${installedVersion}, CLI v${input.expectedVersion}). This is diagnostic unless service compatibility fails.`;\n}\n\nexport function formatDaemonServiceOutdatedStatus(\n input: DaemonVersionInput\n): string {\n const installedVersion = input.installedVersion ?? \"unknown\";\n return `Version differs from this CLI (installed v${installedVersion}, CLI v${input.expectedVersion}).`;\n}\n\nexport function formatDaemonServiceDowngradeBlockedRecommendation(\n input: DaemonVersionInput\n): string {\n if (input.installedVersion) {\n return `OpenMeld Service is already newer (installed v${input.installedVersion}, current CLI v${input.expectedVersion}). OpenMeld will not downgrade it automatically. Run \\`${formatOpenMeldCliCommand(DAEMON_UPGRADE_COMMAND)}\\`.`;\n }\n return `OpenMeld Service is already newer than this CLI. OpenMeld will not downgrade it automatically. Run \\`${formatOpenMeldCliCommand(DAEMON_UPGRADE_COMMAND)}\\`.`;\n}\n\nexport function getDaemonDowngradeBlockedTitle(): string {\n return \"⛔ OpenMeld Service Downgrade Blocked\";\n}\n\nexport function formatDaemonDowngradeBlockedNextStep(): string {\n return `Run \\`${formatOpenMeldCliCommand(DAEMON_UPGRADE_COMMAND)}\\`.`;\n}\n\nexport function formatDaemonStartupRepairNotice(): string {\n return `Run \\`${formatOpenMeldCliCommand(DAEMON_REPAIR_COMMAND)}\\` to repair it now.`;\n}\n","export const MIN_VISIBLE_ELAPSED_TIME_MS = 100;\n\nexport function resolveElapsedTimeMs(\n startedAtMs: number,\n currentTimeMs = Date.now()\n): number {\n return Math.max(0, currentTimeMs - startedAtMs);\n}\n\nexport function formatElapsedTime(durationMs: number): string {\n const seconds = durationMs / 1000;\n return seconds < 10 ? `${seconds.toFixed(1)}s` : `${Math.round(seconds)}s`;\n}\n"],"mappings":";;;;;;;;;;AAoBA,SAAgB,2BACd,SACG;CACH,OAAO;EACL,GAAG;EACH,SAAS,gCAAgC,QAAQ,OAAO;EACxD,UAAU,0BAA0B,QAAQ,QAAQ;EACpD,OAAO,QAAQ,MAAM,KAAK,SAAS,sBAAsB,IAAI,CAAC;EAC9D,qBAAqB,0BAA0B,QAAQ,mBAAmB;CAC5E;AACF;AAEA,SAAS,0BACP,qBACkC;CAClC,IAAI,OAAO,wBAAwB,WACjC,OAAO;CAGT,OAAO;EACL,GAAG;EACH,OAAO,0BAA0B,oBAAoB,KAAK;CAC5D;AACF;;;AClCA,SAAS,cACP,OACA,OACA,OACM;CACN,IAAI,CAAC,SAAS,MAAM,WAAW,GAC7B;CAEF,MAAM,KAAK,KAAK;CAChB,KAAK,MAAM,QAAQ,OACjB,MAAM,KAAK,KAAK,MAAM;AAE1B;AAEA,SAAgB,wBAAwB,OAAqC;CAC3E,MAAM,QAAQ;EAAC,MAAM;EAAS;EAAI;CAAuB;CAEzD,KAAK,MAAM,CAAC,OAAO,SAAS,MAAM,WAAW,QAAQ,GACnD,MAAM,KAAK,GAAG,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AC/C,GAAG,MAAM,SACX;MAEA,MAAM,IAAI,MAAM,oDAAoD;CAEtE,IAAI,MAAM,iBACR,OAAO,qCAAqC,OAAO,KAAK,GAAG,GAAG;EAC5D,WAAW,MAAM,aAAa;EAC9B,cAAc;CAChB,CAAC;CAEH,OAAO,OAAO,KAAK,GAAG;AACxB;AAEA,SAAS,gCACP,SAUA;CACA,QAAQ,SAAR;EACE,KAAK,cACH,OAAO;GACL,QAAQ;GACR,gBACE;GACF,OAAO;GACP,QAAQ;GACR,SAAS;EACX;EACF,KAAK,sBACH,OAAO;GACL,QAAQ;GACR,gBACE;GACF,OAAO;GACP,QAAQ;GACR,SAAS;EACX;EACF,KAAK,eACH,OAAO;GACL,QAAQ;GACR,gBACE;GACF,OAAO;GACP,QAAQ;GACR,SAAS;EACX;EACF,KAAK,kBACH,OAAO;GACL,QAAQ;GACR,gBAAgB;GAChB,OAAO;GACP,QAAQ;GACR,SAAS;EACX;EACF,SACE,cAAY,OAAO;CACvB;AACF;AAEA,SAASC,cAAY,OAAqB;CACxC,MAAM,IAAI,MACR,8CAA8C,OAAO,KAAK,GAC5D;AACF;;;ACrNA,MAAa,2BAA2B;AAExC,MAAa,sBAAsB;CACjC;EACE,SAAS;EACT,aAAa;CACf;CACA;EACE,SAAS;EACT,aAAa;CACf;CACA;EACE,SAAS;EACT,aAAa;CACf;CACA;EACE,SAAS;EACT,aAAa;CACf;CACA;EACE,SAAS;EACT,aAAa;CACf;CACA;EACE,SAAS;EACT,aAAa;CACf;CACA;EACE,SAAS;EACT,aAAa;CACf;CACA;EACE,SAAS;EACT,aAAa;CACf;CACA;EACE,SAAS;EACT,aAAa;CACf;CACA;EACE,SAAS;EACT,aAAa;CACf;CACA;EACE,SAAS;EACT,aAAa;CACf;CACA;EACE,SAAS;EACT,aAAa;CACf;CACA;EACE,SAAS;EACT,aAAa;CACf;CACA;EACE,SAAS;EACT,aAAa;CACf;CACA;EACE,SAAS;EACT,aAAa;CACf;CACA;EACE,SAAS;EAC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;IACN;IACA;IACA;GACF;GACA,SACE;EACJ;EACA,kBACE,oCAAoC,aAAa,CAAC,CAAC,KAAK,CAAC;EAC3D,WAAW;EACX,gBAAgB,EACd,UAAU;GACR,MAAM;GACN,YAAY;IAAC;IAAuB;IAAiB;GAAiB;GACtE,SAAS;GACT,UAAU,YACR,wBAAwB,QAAQ,WAAW;EAC/C,EACF;CACF;CACA,eAAe;EACb,eAAe;GACb,UAAU,CACR,gCACA,mCACF;GACA,qBAAqB;IACnB,UAAU;IACV,OAAO,CAAC;GACV;GACA,OAAO,CACL,2DACA,yGACF;GACA,mBAAmB,CAAC;GACpB,mBAAmB,CAAC;GACpB,QAAQ;IACN;IACA;IACA;IACA;IACA;GACF;GACA,SACE;EACJ;EACA,WAAW;CACb;CACA,eAAe;EACb,eAAe;GACb,UAAU,CACR,qCACA,2CACF;GACA,qBAAqB;IACnB,UAAU;IACV,OAAO,CAAC;GACV;GACA,OAAO,CAAC,oCAAoC;GAC5C,mBAAmB,CAAC;GACpB,mBAAmB,CAAC;GACpB,QAAQ;IACN;IACA;IACA;GACF;GACA,SACE;EACJ;EACA,WAAW;CACb;CACA,QAAQ;EACN,eAAe;GACb,UAAU;IACR;IACA;IACA;GACF;GACA,qBAAqB;IACnB,UAAU;IACV,OAAO,CACL,4EACA,2GACF;GACF;GACA,OAAO,CACL,uFACA,kFACF;GACA,mBAAmB;IACjB;IACA;IACA;GACF;GACA,mBAAmB,CAAC;GACpB,QAAQ;IACN;IACA;IACA;GACF;GACA,SACE;EACJ;EACA,WAAW;CACb;CACA,sBAAsB;EACpB,eAAe;GACb,UAAU,CACR,4CACA,8BACF;GACA,qBAAqB;IACnB,UAAU;IACV,OAAO,CAAC;GACV;GACA,OAAO,CACL,gGACF;GACA,mBAAmB,CAAC;GACpB,mBAAmB,CAAC;GACpB,QAAQ;IACN;IACA;IACA;GACF;GACA,SACE;EACJ;EACA,WAAW;CACb;CACA,mBAAmB;EACjB,eAAe;GACb,UAAU,CACR,yCACA,qCACF;GACA,qBAAqB;GACrB,OAAO,CACL,mGACF;GACA,mBAAmB,CAAC;GACpB,mBAAmB,CAAC;GACpB,QAAQ;IACN;IACA;IACA;GACF;GACA,SACE;EACJ;EACA,WAAW;CACb;CACA,gBAAgB;EACd,eAAe;GACb,UAAU;IACR;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF;GACA,qBAAqB;GACrB,OAAO,CACL,gEACA,+DACF;GACA,mBAAmB,CAAC;GACpB,mBAAmB,CAAC;GACpB,QAAQ;IACN;IACA;IACA;GACF;GACA,SACE;EACJ;EACA,WAAW;CACb;CACA,qBAAqB;EACnB,eAAe;GACb,UAAU;IACR;IACA;IACA;GACF;GACA,qBAAqB;GACrB,OAAO,CACL,+FACF;GACA,mBAAmB,CAAC,SAAS;GAC7B,mBAAmB,CAAC;GACpB,QAAQ;IACN;IACA;IACA;GACF;GACA,SACE;EACJ;EACA,WAAW;CACb;CACA,eAAe;EACb,eAAe;GACb,UAAU;IACR;IACA;IACA;GACF;GACA,qBAAqB;GACrB,OAAO;IACL;IACA;IACA;GACF;GACA,mBAAmB;IACjB;IACA;IACA;IACA;IACA;GACF;GACA,mBAAmB,CAAC;GACpB,QAAQ;IACN;IACA;IACA;GACF;GACA,SACE;EACJ;EACA,WAAW;CACb;CACA,oBAAoB;EAClB,eAAe;GACb,UAAU,CACR,0CACA,sCACF;GACA,qBAAqB;GACrB,OAAO,CACL,2EACF;GACA,mBAAmB,CAAC,wBAAwB;GAC5C,mBAAmB,CAAC;GACpB,QAAQ;IACN;IACA;IACA;GACF;GACA,SACE;EACJ;EACA,WAAW;CACb;CACA,kBAAkB;EAChB,eAAe;GACb,UAAU;IACR;IACA;IACA;GACF;GACA,qBAAqB;GACrB,OAAO,CACL,2EACA,2IACF;GACA,mBAAmB,CAAC,wBAAwB;GAC5C,mBAAmB,CAAC;GACpB,QAAQ;IACN;IACA;IACA;IACA;GACF;GACA,SACE;EACJ;EACA,WAAW;CACb;CACA,gBAAgB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;GACA,mBAAmB;IACjB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF;GACA,mBAAmB,CAAC,mBAAmB;GACvC,QAAQ;IACN;IACA;IACA;IACA;GACF;GACA,SACE;EACJ;EACA,kBAAkB;GAChB;GACA;GACA;EACF;EACA,WAAW;EACX,gBAAgB,EACd,UAAU;GACR,MAAM;GACN,WAAW,EAAE,kBAAkB,YAAY,CACzC,kEAAkE,kBAAkB,kBAAkB,IACxG;GACA,aAAa,CACX,sIACA,iDACF;GACA,YAAY,CACV,uBACA,yCACF;GACA,OAAO,CACL,2HACA,4GACF;GACA,mBAAmB;IACjB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF;GACA,mBAAmB,CAAC,mBAAmB;GACvC,SACE;EACJ,EACF;CACF;CACA,4BAA4B,8BAA8B;EACxD,SAAS;EACT,WAAW;EACX,iBACE;EACF,iBACE;EACF,SACE;CACJ,CAAC;CACD,qBAAqB,8BAA8B;EACjD,SAAS;EACT,WAAW;EACX,iBAAiB;EACjB,iBACE;EACF,SACE;CACJ,CAAC;CACD,wBAAwB;EACtB,eAAe;GACb,qBAAqB;IACnB,UAAU;IACV,OAAO,CAAC;GACV;GACA,OAAO,CACL,sEACA,qFACF;GACA,SAAS,uCAAuC,gBAAgB;GAChE,QAAQ;IACN;IACA;IACA;IACA;IACA;GACF;GACA,SACE;EACJ;EACA,aAAa,YACX,uCAAuC,gBAAgB,CAAC,CAAC,aAAa;GACpE,GAAG;GACH,iBAAiB;GACjB,WAAW,QAAQ,aAAa;EAClC,CAAC,KAAK,CAAC;EACT,WAAW;EACX,gBAAgB,EACd,UAAU;GACR,MAAM;GACN,YAAY;IACV;IACA;IACA;GACF;GACA,OAAO,CACL,sEACA,qFACF;GACA,SAAS,uCAAuC,gBAAgB;GAChE,UAAU,YACR,QAAQ,WACR;EACJ,EACF;CACF;AACF;AAEA,SAAgB,wBACd,WAC6D;CAC7D,OAAO,wBAAwB,cAAc;AAC/C;AAEA,SAAgB,4BAE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AO;GACL;GACA;GACA;GACA;EACF;CACF,CAAC;AACH;AAEA,SAAgB,iCAAiC,SAAkB;CACjE,OAAO,IAAI,mBAAmB;EAC5B,MAAM;EACN,OAAO;GACL,SACE,WACA;GACF,YAAY;IACV;IACA;IACA;GACF;GACA,mBAAmB,CAAC,cAAc,0BAA0B;GAC5D,mBAAmB;IACjB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF;GACA,eAAe,CAAC,wBAAwB;GACxC,OAAO,CACL,wFACA,2CACF;EACF;CACF,CAAC;AACH;AAEA,SAAgB,oCAAoC,SAAkB;CACpE,OAAO,IAAI,mBAAmB;EAC5B,MAAM;EACN,OAAO;GACL,SACE,WACA;GACF,YAAY,CACV,uBACA,mGACF;GACA,mBAAmB;IACjB;IACA;IACA;GACF;GACA,mBAAmB;IACjB;IACA;IACA;GACF;GACA,eAAe,CAAC,2BAA2B;GAC3C,OAAO,0CAA0C;EACnD;CACF,CAAC;AACH;AAEA,SAAgB,4BAA4B,SAAkB;CAC5D,OAAO,IAAI,mBAAmB;EAC5B,MAAM;EACN,OAAO;GACL,SACE,WACA;GACF,YAAY;IACV;IACA;IACA;GACF;GACA,mBAAmB,CAAC,iBAAiB,+BAA+B;GACpE,mBAAmB;IACjB;IACA;IACA;IACA;IACA;IACA;GACF;GACA,eAAe;IACb;IACA;IACA;GACF;GACA,OAAO,CACL,kFACA,0DACF;EACF;EACA,OAAO,CACL,sGACA,yDACF;CACF,CAAC;AACH;AAEA,SAAgB,gCACd,SACA,YAG0B,qBAC1B;CACA,OAAO,6BAA6B;EAClC,SAAS;GACP,iBAAiB;GACjB,WAAW;GACX,SAAS,WAAW,0CAA0C,SAAS;EACzE;EACA,eAAe,gCAAgC,SAAS;CAC1D,CAAC;AACH;AAEA,SAAS,0CACP,WAIQ;CACR,QAAQ,WAAR;EACE,KAAK,oBACH,OAAO;EACT,KAAK,4BACH,OAAO;EACT,KAAK,qBACH,OAAO;EACT,SACE,YAAY,SAAS;CACzB;AACF;AAEA,SAAS,YAAY,OAAqB;CACxC,MAAM,IAAI,MAAM,qBAAqB,OAAO,KAAK,GAAG;AACtD;AAEA,SAAgB,mCAAmC,SAAkB;CACnE,OAAO,6BAA6B;EAClC,SAAS;GACP,iBAAiB;GACjB,WAAW;GACX,SACE,WACA;EACJ;EACA,eAAe,gCAAgC,sBAAsB;CACvE,CAAC;AACH;AAEA,SAAgB,2BAA2B,SAAkB;CAC3D,OAAO,IAAI,mBAAmB;EAC5B,MAAM;EACN,OAAO;GACL,SACE,WACA;GACF,YAAY;IACV;IACA;IACA;GACF;GACA,mBAAmB,CAAC,YAAY;GAChC,mBAAmB;IACjB;IACA;IACA;GACF;GACA,eAAe,CACb,uEACA,yDACF;GACA,OAAO,CACL,0DACA,yFACF;EACF;EACA,OAAO,CACL,qEACF;CACF,CAAC;AACH;AAEA,SAAgB,4BAA4B,SAA6B;CACvE,MAAM,wBAA8D;EAClE,QAAQ;GACN;GACA;GACA;GACA;EACF;EACA,MAAM;GACJ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF;EACA,OAAO;GACL;GACA;GACA;GACA;GACA;EACF;EACA,UAAU;GACR;GACA;GACA;GACA;EACF;EACA,QAAQ;GACN;GACA;GACA;GACA;EACF;EACA,OAAO;GACL;GACA;GACA;GACA;EACF;EACA,QAAQ;GACN;GACA;GACA;EACF;CACF;CA4BA,OAAO,IAAI,mBAAmB;EAC5B,MAAM,SAAS,QAAQ;EACvB,OAAO;GACL,SAAS,kBAAkB,QAAQ;GACnC,YAAY,CAAC,uBAAuB,gBAAgB;GACpD,mBAAmB,CACjB,+DAA+D,QAAQ,EACzE;GACA,mBAAmB,sBAAsB;GACzC,eAAe;IAlCjB,QAAQ,CACN,sHACF;IACA,MAAM,CACJ,0NACF;IACA,OAAO,CACL,kJACF;IACA,UAAU,CACR,iHACF;IACA,QAAQ,CACN,+GACF;IACA,OAAO;KACL;KACA;KACA;IACF;IACA,QAAQ,CACN,sGACF;GAY0C,EAAE;EAC5C;CACF,CAAC;AACH;AAEA,SAAgB,6BAA6B,SAAkB;CAC7D,OAAO,IAAI,mBAAmB;EAC5B,MAAM;EACN,OAAO;GACL,SACE,WACA;GACF,YAAY,CAAC,uBAAuB,gBAAgB;GACpD,mBAAmB,CAAC,cAAc,4BAA4B;GAC9D,mBAAmB;IACjB;IACA;IACA;IACA;IACA;GACF;GACA,eAAe,CACb,yJACF;GACA,OAAO,CACL,yDACA,mDACF;EACF;CACF,CAAC;AACH;AAEA,SAAgB,4BAA4B,SAAkB;CAC5D,OAAO,IAAI,mBAAmB;EAC5B,MAAM;EACN,OAAO;GACL,SACE,WACA;GACF,YAAY,CAAC,uBAAuB,gBAAgB;GACpD,mBAAmB,CACjB,cACA,oEACF;GACA,mBAAmB;IACjB;IACA;IACA;IACA;GACF;GACA,eAAe,CACb,0IACA,yIACF;GACA,OAAO,CACL,qCACA,2CACF;EACF;CACF,CAAC;AACH;AAEA,SAAgB,yCAAyC,SAAkB;CACzE,OAAO,IAAI,mBAAmB;EAC5B,MAAM;EACN,OAAO;GACL,SACE,WACA;GACF,YAAY;IACV;IACA;IACA;IACA;GACF;GACA,mBAAmB,CACjB,oEACF;GACA,mBAAmB,CACjB,kCACA,wBACF;GACA,eAAe,CACb,uBACA,iFACF;GACA,OAAO,CACL,8EACA,yDACF;EACF;EACA,OAAO,CAAC,uBAAuB,kCAAkC;CACnE,CAAC;AACH;AAEA,SAAgB,sCACd,SACA;CACA,MAAM,wBAAiE;EACrE,MAAM,CAAC,cAAc,mCAAmC;EACxD,SAAS,CAAC,YAAY;EACtB,QAAQ,CAAC,cAAc,aAAa;EACpC,UAAU,CAAC,cAAc,0CAA0C;CACrE;CACA,MAAM,wBAAiE;EACrE,MAAM;GACJ;GACA;GACA;GACA;GACA;EACF;EACA,SAAS;GACP;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF;EACA,QAAQ;GACN;GACA;GACA;EACF;EACA,UAAU,CAAC,kCAAkC,wB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IAC/C,CAAC,CACP;EACF;EACA,OAAO;GACL;GACA;GACA;EACF;CACF,CAAC;AACH;AAEA,SAAgB,yCAAyC;CACvD,OAAO,IAAI,mBAAmB;EAC5B,MAAM;EACN,OAAO;GACL,SACE;GACF,YAAY;IACV;IACA;IACA;IACA;GACF;GACA,mBAAmB,CAAC,0BAA0B;GAC9C,mBAAmB,CACjB,kCACA,wBACF;GACA,eAAe;IACb;IACA;IACA;IACA;IACA;GACF;GACA,OAAO;IACL;IACA;IACA;GACF;EACF;CACF,CAAC;AACH;AAEA,SAAgB,yCAAyC;CACvD,OAAO,IAAI,mBAAmB;EAC5B,MAAM;EACN,OAAO;GACL,SACE;GACF,YAAY,CACV,qCACA,qCACF;GACA,mBAAmB,CAAC,0BAA0B;GAC9C,eAAe;IACb;IACA;IACA;IACA;GACF;GACA,OAAO;IACL;IACA;IACA;GACF;EACF;CACF,CAAC;AACH;AAEA,SAAgB,6CACd,MACA,QACA;CACA,OAAO,IAAI,mBAAmB;EAC5B,MAAM;EACN,OAAO;GACL,SAAS,mCAAmC;GAC5C,YAAY,CACV,oCACA,wCACF;GACA,mBAAmB,CAAC,+CAA+C;GACnE,eAAe;IACb;IACA;IACA;GACF;GACA,OAAO,CAAC,eAAe,QAAQ;EACjC;CACF,CAAC;AACH;AAEA,SAAgB,sCAAsC;CACpD,OAAO,IAAI,mBAAmB;EAC5B,MAAM;EACN,OAAO;GACL,SAAS;GACT,YAAY,CACV,2BACA,mDACF;GACA,mBAAmB,CAAC,wBAAwB;GAC5C,eAAe,CACb,mEACA,8EACF;EACF;CACF,CAAC;AACH;AAEA,SAAgB,8BAA8B;CAC5C,OAAO,IAAI,mBAAmB;EAC5B,MAAM;EACN,OAAO;GACL,SAAS;GACT,YAAY,CAAC,uBAAuB,kBAAkB;GACtD,mBAAmB;IACjB;IACA;IACA;GACF;GACA,mBAAmB,CAAC,2BAA2B;GAC/C,eAAe;IACb;IACA;IACA;IACA;IACA;IACA;IACA;GACF;EACF;EACA,O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A,SAAgB,2CAAmD;CACjE,OAAO;AACT;AAMA,SAAgB,mCAA2C;CACzD,OAAO;AACT;AAEA,SAAgB,oCAA4C;CAC1D,OAAO;AACT;AAEA,SAAgB,mCAA2C;CACzD,OAAO,SAAS,yBAAyB,sBAAsB,EAAE;AACnE;AAEA,SAAgB,uCAA+C;CAC7D,OAAO,KAAK,yBAAyB,sBAAsB,EAAE;AAC/D;AAEA,SAAgB,uCAA+C;CAC7D,OAAO,KAAK,yBAAyB,wBAAwB,EAAE;AACjE;AAgBA,SAAgB,kDACd,OACQ;CACR,IAAI,MAAM,kBACR,OAAO,iDAAiD,MAAM,iBAAiB,iBAAiB,MAAM,gBAAgB,yDAAyD,yBAAyB,sBAAsB,EAAE;CAElO,OAAO,wGAAwG,yBAAyB,sBAAsB,EAAE;AAClK;AAEA,SAAgB,iCAAyC;CACvD,OAAO;AACT;AAEA,SAAgB,uCAA+C;CAC7D,OAAO,SAAS,yBAAyB,sBAAsB,EAAE;AACnE;;;ACxNA,SAAgB,qBACd,aACA,gBAAgB,KAAK,IAAI,GACjB;CACR,OAAO,KAAK,IAAI,GAAG,gBAAgB,WAAW;AAChD;AAEA,SAAgB,kBAAkB,YAA4B;CAC5D,MAAM,UAAU,aAAa;CAC7B,OAAO,UAAU,KAAK,GAAG,QAAQ,QAAQ,CAAC,EAAE,KAAK,GAAG,KAAK,MAAM,OAAO,EAAE;AAC1E"}
1
+ {"version":3,"file":"elapsed-time-BSphCejK.js","names":["packageJson","assertNever"],"sources":["../src/runtime/agent-overview-payload.ts","../src/runtime/dual-view-guide.ts","../src/runtime/dual-view-guide-display.ts","../src/runtime/dual-view-guide-error.ts","../src/command-contracts/helpers.ts","../src/agents/builtin-selection-contract.ts","../src/auth/login-request-contract.ts","../src/command-contracts/service-control-target.ts","../src/runtime/cli-version.ts","../src/skills/target-selection-contract.ts","../src/space/add-members-progress-contract.ts","../src/space/member-selection-contract.ts","../src/ui/root-entry-catalog.ts","../src/command-contracts/registry.ts","../src/runtime/dual-view-guide-catalog.ts","../src/runtime/interaction.ts","../src/local-service/maintenance/openmeld-tools-update-operation.ts","../src/system/local-service-install-attention.ts","../src/ui/elapsed-time.ts"],"sourcesContent":["import {\n formatInlineOpenMeldCliCommands,\n formatOpenMeldCliCommands,\n formatOpenMeldCliLine,\n} from \"./cli-entry-command\";\n\ntype AgentOverviewHumanActionRequired =\n | boolean\n | {\n possible: boolean;\n steps: string[];\n };\n\ntype AgentOverviewPayload = {\n summary: string;\n commands: string[];\n notes: string[];\n humanActionRequired: AgentOverviewHumanActionRequired;\n};\n\nexport function formatAgentOverviewPayload<T extends AgentOverviewPayload>(\n payload: T\n): T {\n return {\n ...payload,\n summary: formatInlineOpenMeldCliCommands(payload.summary),\n commands: formatOpenMeldCliCommands(payload.commands),\n notes: payload.notes.map((note) => formatOpenMeldCliLine(note)),\n humanActionRequired: formatHumanActionRequired(payload.humanActionRequired),\n };\n}\n\nfunction formatHumanActionRequired(\n humanActionRequired: AgentOverviewHumanActionRequired\n): AgentOverviewHumanActionRequired {\n if (typeof humanActionRequired === \"boolean\") {\n return humanActionRequired;\n }\n\n return {\n ...humanActionRequired,\n steps: formatOpenMeldCliCommands(humanActionRequired.steps),\n };\n}\n","export type DualViewGuideInput = {\n summary: string;\n humanSteps: string[];\n agentRequiredArgs?: string[];\n agentOptionalArgs?: string[];\n agentCommands?: string[];\n notes?: string[];\n};\n\nfunction appendSection(\n lines: string[],\n title: string,\n items: string[] | undefined\n): void {\n if (!items || items.length === 0) {\n return;\n }\n lines.push(title);\n for (const item of items) {\n lines.push(` ${item}`);\n }\n}\n\nexport function buildDualViewGuideLines(input: DualViewGuideInput): string[] {\n const lines = [input.summary, \"\", \"[FOR HUMAN OPERATORS]\"];\n\n for (const [index, step] of input.humanSteps.entries()) {\n lines.push(`${index + 1}) ${step}`);\n }\n\n lines.push(\"\", \"[FOR AGENTS]\");\n appendSection(lines, \"required arguments:\", input.agentRequiredArgs);\n appendSection(lines, \"optional arguments:\", input.agentOptionalArgs);\n appendSection(lines, \"commands:\", input.agentCommands);\n appendSection(lines, \"notes:\", input.notes);\n\n return lines;\n}\n\nexport function buildDualViewGuideMessage(input: DualViewGuideInput): string {\n return buildDualViewGuideLines(input).join(\"\\n\");\n}\n","import {\n formatOpenMeldCliLine,\n formatOpenMeldCliTextBlock,\n} from \"./cli-entry-command\";\nimport type { DualViewGuideInput } from \"./dual-view-guide\";\n\nexport function formatDualViewGuideForDisplay(\n input: DualViewGuideInput\n): DualViewGuideInput {\n return {\n summary: formatOpenMeldCliTextBlock(input.summary),\n humanSteps: input.humanSteps.map((item) => formatOpenMeldCliLine(item)),\n ...(input.agentRequiredArgs\n ? {\n agentRequiredArgs: input.agentRequiredArgs.map((item) =>\n formatOpenMeldCliLine(item)\n ),\n }\n : {}),\n ...(input.agentOptionalArgs\n ? {\n agentOptionalArgs: input.agentOptionalArgs.map((item) =>\n formatOpenMeldCliLine(item)\n ),\n }\n : {}),\n ...(input.agentCommands\n ? {\n agentCommands: input.agentCommands.map((item) =>\n formatOpenMeldCliLine(item)\n ),\n }\n : {}),\n ...(input.notes\n ? {\n notes: input.notes.map((item) => formatOpenMeldCliTextBlock(item)),\n }\n : {}),\n };\n}\n","import {\n buildDualViewGuideMessage,\n type DualViewGuideInput,\n} from \"./dual-view-guide\";\nimport { formatDualViewGuideForDisplay } from \"./dual-view-guide-display\";\n\nexport type DualViewGuideErrorInput = {\n code: string;\n guide: DualViewGuideInput;\n hints?: string[];\n};\n\nexport class DualViewGuideError extends Error {\n readonly code: string;\n readonly guide: DualViewGuideInput;\n readonly hints: string[];\n\n constructor(input: DualViewGuideErrorInput) {\n super(\n buildDualViewGuideMessage(formatDualViewGuideForDisplay(input.guide))\n );\n this.name = \"DualViewGuideError\";\n this.code = input.code;\n this.guide = input.guide;\n this.hints = input.hints ?? [];\n }\n}\n","import { formatAgentOverviewPayload } from \"../runtime/agent-overview-payload\";\nimport { DualViewGuideError } from \"../runtime/dual-view-guide-error\";\nimport type {\n CommandAgentOverviewContract,\n CommandContractFieldResolver,\n CommandContractRenderContext,\n CommandGuideScenarioContract,\n} from \"./types\";\n\ntype CommandContractError = Error & {\n code: string;\n};\n\nexport function createCommandContractError(\n code: string,\n message: string\n): CommandContractError {\n const error = new Error(message) as CommandContractError;\n error.code = code;\n return error;\n}\n\nexport function buildAgentOverviewFromContract<\n TContext extends CommandContractRenderContext,\n>(input: {\n context: TContext;\n overview: CommandAgentOverviewContract<TContext>;\n}): {\n commands: string[];\n humanActionRequired: CommandAgentOverviewContract<TContext>[\"humanActionRequired\"];\n notes: string[];\n optionalArguments: string[];\n requiredArguments: string[];\n stages: string[];\n summary: string;\n} & Record<string, unknown> {\n const pattern = input.overview.pattern;\n return formatAgentOverviewPayload({\n ...(resolveContractField(input.overview.extraPayload, input.context) ?? {}),\n commands:\n resolveContractField(input.overview.commands, input.context) ??\n pattern?.buildCommands(input.context) ??\n [],\n humanActionRequired: input.overview.humanActionRequired,\n notes: resolveContractField(input.overview.notes, input.context) ?? [],\n optionalArguments:\n resolveContractField(input.overview.optionalArguments, input.context) ??\n pattern?.buildOptionalArguments?.(input.context) ??\n [],\n requiredArguments:\n resolveContractField(input.overview.requiredArguments, input.context) ??\n pattern?.buildRequiredArguments?.(input.context) ??\n [],\n stages: resolveContractField(input.overview.stages, input.context) ?? [],\n summary: resolveContractField(input.overview.summary, input.context) ?? \"\",\n });\n}\n\nexport function createGuideErrorFromContract<\n TContext extends CommandContractRenderContext,\n>(input: {\n context: TContext;\n guideScenario: CommandGuideScenarioContract<TContext>;\n}): DualViewGuideError {\n const pattern = input.guideScenario.pattern;\n return new DualViewGuideError({\n code: input.guideScenario.code,\n guide: {\n summary:\n resolveContractField(input.guideScenario.summary, input.context) ?? \"\",\n humanSteps:\n resolveContractField(input.guideScenario.humanSteps, input.context) ??\n [],\n agentRequiredArgs:\n resolveContractField(\n input.guideScenario.requiredArguments,\n input.context\n ) ??\n pattern?.buildRequiredArguments?.(input.context) ??\n [],\n agentOptionalArgs:\n resolveContractField(\n input.guideScenario.optionalArguments,\n input.context\n ) ??\n pattern?.buildOptionalArguments?.(input.context) ??\n [],\n agentCommands:\n resolveContractField(input.guideScenario.commands, input.context) ??\n pattern?.buildCommands(input.context) ??\n [],\n notes:\n resolveContractField(input.guideScenario.notes, input.context) ?? [],\n },\n hints:\n resolveContractField(input.guideScenario.hints, input.context) ??\n pattern?.buildHints?.(input.context) ??\n pattern?.buildCommands(input.context) ??\n [],\n });\n}\n\nfunction resolveContractField<\n TContext extends CommandContractRenderContext,\n TValue,\n>(\n value: CommandContractFieldResolver<TContext, TValue> | undefined,\n context: TContext\n): TValue | undefined {\n if (typeof value === \"function\") {\n return (value as (context: TContext) => TValue)(context);\n }\n return value;\n}\n","import type { Command } from \"commander\";\n\nexport type BuiltinAgentSelectionCommand = \"disable\" | \"enable\" | \"repair\";\n\nexport type BuiltinAgentSelectionDescriptor = {\n allOptionDescription: string;\n agentOptionDescription: string;\n command: BuiltinAgentSelectionCommand;\n supportsInstallSelection: boolean;\n};\n\ntype BuiltinAgentSelectionCommandInput = {\n agentIds?: string[];\n all?: boolean;\n command: BuiltinAgentSelectionCommand;\n includeViewFlag?: boolean;\n installId?: string;\n};\n\ntype BuiltinAgentSelectionValidationInput = {\n all?: boolean;\n command: BuiltinAgentSelectionCommand;\n explicitIds: string[];\n explicitInstallId: string | null;\n};\n\nconst BUILTIN_AGENT_SELECTION_REQUIRED_ARGUMENT =\n \"one selection mode: --all | --agent <id...>\";\nconst BUILTIN_AGENT_SELECTION_INSTALL_ARGUMENT =\n \"--install <install-id> with one --agent <id>\";\nconst BUILTIN_AGENT_SELECTION_CONFLICT_ERROR =\n \"use either --all or --agent <id...>, not both\";\nconst BUILTIN_AGENT_SELECTION_MISSING_ERROR =\n \"provide --all or --agent <id...>\";\nconst BUILTIN_AGENT_SELECTION_INSTALL_CONSTRAINT_ERROR =\n \"use --install only with one --agent <id>\";\nconst BUILTIN_AGENT_SELECTION_INSTALL_OPTION_DESCRIPTION =\n \"Choose the exact detected install OpenMeld should use for one builtin agent\";\n\nconst BUILTIN_AGENT_SELECTION_DESCRIPTORS = {\n disable: {\n allOptionDescription: \"Disable all connected agents\",\n agentOptionDescription: \"Disable specific connected agent IDs\",\n command: \"disable\",\n supportsInstallSelection: false,\n },\n enable: {\n allOptionDescription:\n \"Enable every detected agent OpenMeld can use on this computer\",\n agentOptionDescription:\n \"Enable specific agent IDs (built-in ID or custom target ID)\",\n command: \"enable\",\n supportsInstallSelection: true,\n },\n repair: {\n allOptionDescription: \"Repair every connected agent that needs repair\",\n agentOptionDescription: \"Repair specific connected agent IDs\",\n command: \"repair\",\n supportsInstallSelection: true,\n },\n} as const satisfies Record<\n BuiltinAgentSelectionCommand,\n BuiltinAgentSelectionDescriptor\n>;\n\nexport function getBuiltinAgentSelectionDescriptor(\n command: BuiltinAgentSelectionCommand\n): BuiltinAgentSelectionDescriptor {\n return BUILTIN_AGENT_SELECTION_DESCRIPTORS[command];\n}\n\nexport function registerBuiltinAgentSelectionOptions(input: {\n command: Command;\n selectionCommand: BuiltinAgentSelectionCommand;\n}): Command {\n const descriptor = getBuiltinAgentSelectionDescriptor(input.selectionCommand);\n input.command.option(\"--agent <agent...>\", descriptor.agentOptionDescription);\n if (descriptor.supportsInstallSelection) {\n input.command.option(\n \"--install <install-id>\",\n BUILTIN_AGENT_SELECTION_INSTALL_OPTION_DESCRIPTION\n );\n }\n input.command.option(\"--all\", descriptor.allOptionDescription);\n return input.command;\n}\n\nexport function getBuiltinAgentSelectionRequiredArguments(\n _command: BuiltinAgentSelectionCommand\n): string[] {\n return [BUILTIN_AGENT_SELECTION_REQUIRED_ARGUMENT];\n}\n\nexport function getBuiltinAgentSelectionOptionalArguments(\n command: BuiltinAgentSelectionCommand\n): string[] {\n return getBuiltinAgentSelectionDescriptor(command).supportsInstallSelection\n ? [BUILTIN_AGENT_SELECTION_INSTALL_ARGUMENT]\n : [];\n}\n\nexport function buildBuiltinAgentSelectionCommand(\n input: BuiltinAgentSelectionCommandInput\n): string {\n const descriptor = getBuiltinAgentSelectionDescriptor(input.command);\n const tokens = [\"openmeld\", \"agents\", input.command];\n if (input.all) {\n tokens.push(\"--all\");\n } else if (input.agentIds && input.agentIds.length > 0) {\n tokens.push(\"--agent\", ...input.agentIds);\n } else {\n throw new Error(\n `builtin agent selection command requires --all or --agent for ${input.command}`\n );\n }\n\n if (input.installId) {\n if (!descriptor.supportsInstallSelection) {\n throw new Error(\n `builtin agent selection command does not support --install for ${input.command}`\n );\n }\n tokens.push(\"--install\", input.installId);\n }\n\n if (input.includeViewFlag) {\n tokens.push(\"--view\", \"agent\");\n }\n return tokens.join(\" \");\n}\n\nexport function buildBuiltinAgentSelectionExamples(input: {\n command: BuiltinAgentSelectionCommand;\n includeViewFlag?: boolean;\n}): string[] {\n const descriptor = getBuiltinAgentSelectionDescriptor(input.command);\n const commands = [\n buildBuiltinAgentSelectionCommand({\n all: true,\n command: input.command,\n includeViewFlag: input.includeViewFlag,\n }),\n buildBuiltinAgentSelectionCommand({\n agentIds: [\"<id...>\"],\n command: input.command,\n includeViewFlag: input.includeViewFlag,\n }),\n ];\n if (descriptor.supportsInstallSelection) {\n commands.push(\n buildBuiltinAgentSelectionCommand({\n agentIds: [\"<id>\"],\n command: input.command,\n includeViewFlag: input.includeViewFlag,\n installId: \"<install-id>\",\n })\n );\n }\n return commands;\n}\n\nexport function validateBuiltinAgentSelectionInput(\n input: BuiltinAgentSelectionValidationInput\n): void {\n const descriptor = getBuiltinAgentSelectionDescriptor(input.command);\n if (input.all && input.explicitIds.length > 0) {\n throw new Error(\n `agents.config_invalid: ${BUILTIN_AGENT_SELECTION_CONFLICT_ERROR}`\n );\n }\n if (!(input.all || input.explicitIds.length > 0)) {\n throw new Error(\n `agents.${input.command}_invalid: ${BUILTIN_AGENT_SELECTION_MISSING_ERROR}`\n );\n }\n if (\n input.explicitInstallId &&\n (!descriptor.supportsInstallSelection ||\n input.all ||\n input.explicitIds.length !== 1)\n ) {\n throw new Error(\n `agents.${input.command}_invalid: ${BUILTIN_AGENT_SELECTION_INSTALL_CONSTRAINT_ERROR}`\n );\n }\n}\n","import type { Command } from \"commander\";\nimport type { CommandPatternContract } from \"../command-contracts/types\";\n\nexport type AuthLoginRequestRenderContext = {\n includeViewFlag?: boolean;\n};\n\nconst AUTH_LOGIN_REQUIRED_ARGUMENTS = [\n \"one explicit automation path: --ott <token> | --method device\",\n \"when using --method ott: --ott <token>\",\n] as const;\n\nconst AUTH_LOGIN_OPTIONAL_ARGUMENTS = [\n \"--method <device|ott>\",\n \"--ott <token>\",\n \"--auth-url <url>\",\n \"--client-id <id>\",\n \"--no-open\",\n] as const;\n\nexport const AUTH_LOGIN_REQUEST_PATTERN_CONTRACT: CommandPatternContract<AuthLoginRequestRenderContext> =\n {\n buildCommands: (context) =>\n buildAuthLoginRequestExamples({\n includeViewFlag: context.includeViewFlag,\n }),\n buildHints: () => buildAuthLoginRequestHints(),\n buildOptionalArguments: () => [...AUTH_LOGIN_OPTIONAL_ARGUMENTS],\n buildRequiredArguments: () => [...AUTH_LOGIN_REQUIRED_ARGUMENTS],\n };\n\nexport function registerAuthLoginRequestOptions(command: Command): Command {\n return command\n .option(\n \"--auth-url <url>\",\n \"OpenMeld auth URL (CLI > OPENMELD_AUTH_URL > default)\"\n )\n .option(\n \"--client-id <id>\",\n \"OAuth device client_id (CLI > OPENMELD_AUTH_CLIENT_ID > built-in default)\"\n )\n .option(\"--method <mode>\", \"Sign-in method: device|ott\")\n .option(\"--ott <token>\", \"One-time sign-in token\")\n .option(\"--no-open\", \"Do not auto-open the verification URL in browser\");\n}\n\nexport function getAuthLoginRequestRequiredArguments(): string[] {\n return [...AUTH_LOGIN_REQUIRED_ARGUMENTS];\n}\n\nexport function getAuthLoginRequestOptionalArguments(): string[] {\n return [...AUTH_LOGIN_OPTIONAL_ARGUMENTS];\n}\n\nexport function buildAuthLoginRequestExamples(input?: {\n includeViewFlag?: boolean;\n}): string[] {\n return [\n buildAuthLoginRequestCommand({\n command: \"login\",\n includeViewFlag: input?.includeViewFlag,\n ott: \"<token>\",\n }),\n buildAuthLoginRequestCommand({\n command: \"login\",\n includeViewFlag: input?.includeViewFlag,\n method: \"device\",\n noOpen: true,\n }),\n buildAuthLoginRequestCommand({\n command: \"auth status\",\n includeViewFlag: input?.includeViewFlag,\n }),\n ];\n}\n\nexport function buildAuthLoginRequestHints(): string[] {\n return buildAuthLoginRequestExamples();\n}\n\nfunction buildAuthLoginRequestCommand(input: {\n command: \"auth status\" | \"login\";\n includeViewFlag?: boolean;\n method?: \"device\" | \"ott\";\n noOpen?: boolean;\n ott?: string;\n}): string {\n const tokens = [\"openmeld\", ...input.command.split(\" \")];\n if (input.method) {\n tokens.push(\"--method\", input.method);\n }\n if (input.ott) {\n tokens.push(\"--ott\", input.ott);\n }\n if (input.noOpen) {\n tokens.push(\"--no-open\");\n }\n if (input.includeViewFlag) {\n tokens.push(\"--view\", \"agent\");\n }\n return tokens.join(\" \");\n}\n","import type { Command } from \"commander\";\nimport { createCommandContractError } from \"./helpers\";\nimport type {\n CommandContractRenderContext,\n CommandPatternContract,\n} from \"./types\";\n\nexport type DaemonControlTargetCommand = \"cancel\" | \"interrupt\";\n\ntype DaemonControlTargetRenderContext = CommandContractRenderContext;\n\nconst DAEMON_CONTROL_TARGET_REQUIRED_ARGUMENT =\n \"exactly one of --dispatch <id> or --task <id>\";\nconst DAEMON_CONTROL_TARGET_OPTIONAL_ARGUMENT = \"--reason <text>\";\nconst DAEMON_CONTROL_TARGET_ERROR =\n \"exactly one of --dispatch or --task is required\";\n\nexport function getDaemonControlTargetPatternContract(\n command: DaemonControlTargetCommand\n): CommandPatternContract<DaemonControlTargetRenderContext> {\n return {\n buildCommands: (context) =>\n buildDaemonControlTargetExamples({\n command,\n includeViewFlag: context.includeViewFlag,\n }),\n buildHints: () =>\n buildDaemonControlTargetExamples({\n command,\n }),\n buildOptionalArguments: () => [DAEMON_CONTROL_TARGET_OPTIONAL_ARGUMENT],\n buildRequiredArguments: () => [DAEMON_CONTROL_TARGET_REQUIRED_ARGUMENT],\n };\n}\n\nexport function registerDaemonControlTargetOptions(input: {\n command: Command;\n}): Command {\n return input.command\n .option(\"--dispatch <id>\", \"Dispatch ID\")\n .option(\"--task <id>\", \"Task ID (debug fallback)\")\n .option(\"--reason <text>\", `Optional ${input.command.name()} reason`);\n}\n\nexport function buildDaemonControlTargetExamples(input: {\n command: DaemonControlTargetCommand;\n includeViewFlag?: boolean;\n}): string[] {\n return [\n buildDaemonControlTargetCommand({\n command: input.command,\n dispatch: \"<id>\",\n includeViewFlag: input.includeViewFlag,\n }),\n buildDaemonControlTargetCommand({\n command: input.command,\n task: \"<id>\",\n includeViewFlag: input.includeViewFlag,\n }),\n ];\n}\n\nexport function getDaemonControlTargetRequiredArguments(): string[] {\n return [DAEMON_CONTROL_TARGET_REQUIRED_ARGUMENT];\n}\n\nexport function getDaemonControlTargetOptionalArguments(): string[] {\n return [DAEMON_CONTROL_TARGET_OPTIONAL_ARGUMENT];\n}\n\nexport function validateDaemonControlTargetInput(input: {\n dispatch?: string;\n task?: string;\n}): {\n dispatch: string | null;\n task: string | null;\n} {\n const dispatch = normalizeOptionalText(input.dispatch);\n const task = normalizeOptionalText(input.task);\n if ((dispatch && task) || !(dispatch || task)) {\n throw createCommandContractError(\n \"daemon.control.invalid_target_selector\",\n DAEMON_CONTROL_TARGET_ERROR\n );\n }\n return {\n dispatch,\n task,\n };\n}\n\nfunction buildDaemonControlTargetCommand(input: {\n command: DaemonControlTargetCommand;\n dispatch?: string;\n includeViewFlag?: boolean;\n task?: string;\n}): string {\n const tokens = [\"openmeld\", \"service\", input.command];\n if (input.dispatch) {\n tokens.push(\"--dispatch\", input.dispatch);\n } else if (input.task) {\n tokens.push(\"--task\", input.task);\n } else {\n throw new Error(\"daemon control target command requires a selector\");\n }\n if (input.includeViewFlag) {\n tokens.push(\"--view\", \"agent\");\n }\n return tokens.join(\" \");\n}\n\nfunction normalizeOptionalText(value: string | undefined): string | null {\n const normalized = String(value ?? \"\").trim();\n return normalized.length > 0 ? normalized : null;\n}\n","import packageJson from \"../../package.json\";\nimport { OPENMELD_VERSION } from \"./version\";\n\ntype CliPackageJson = {\n version: string;\n openMeldReleaseDate?: string;\n};\n\nexport type CliVersionInfo = {\n version: string;\n releaseDate: string | null;\n releaseDateLabel: string | null;\n summary: string;\n};\n\nconst PACKAGE_JSON = packageJson as CliPackageJson;\nconst ISO_RELEASE_DATE_RE = /^(\\d{4})-(\\d{2})-(\\d{2})$/u;\n\nexport function getCliVersionInfo(): CliVersionInfo {\n const version = OPENMELD_VERSION;\n const releaseDate = normalizeReleaseDate(PACKAGE_JSON.openMeldReleaseDate);\n const releaseDateLabel = releaseDate\n ? formatCliReleaseDateLabel(releaseDate)\n : null;\n\n return {\n version,\n releaseDate,\n releaseDateLabel,\n summary: formatCliVersionSummary({\n version,\n releaseDateLabel,\n }),\n };\n}\n\nexport function formatCliVersionSummary(input?: {\n version: string;\n releaseDateLabel: string | null;\n}): string {\n const versionInfo = input ?? getCliVersionInfo();\n if (!versionInfo.releaseDateLabel) {\n return `Current version: ${versionInfo.version}`;\n }\n return `Current version: ${versionInfo.version} • ${versionInfo.releaseDateLabel}`;\n}\n\nfunction normalizeReleaseDate(value: string | undefined): string | null {\n const normalized = String(value ?? \"\").trim();\n if (!ISO_RELEASE_DATE_RE.test(normalized)) {\n return null;\n }\n return normalized;\n}\n\nfunction formatCliReleaseDateLabel(releaseDate: string): string {\n const match = releaseDate.match(ISO_RELEASE_DATE_RE);\n if (!match) {\n return releaseDate;\n }\n return `${match[2]}-${match[3]}`;\n}\n","import type { Command } from \"commander\";\nimport { createCommandContractError } from \"../command-contracts/helpers\";\nimport type {\n CommandContractRenderContext,\n CommandPatternContract,\n} from \"../command-contracts/types\";\n\nexport type SkillsTargetSelectionCommand = \"ensure\" | \"install\" | \"uninstall\";\n\ntype SkillsTargetSelectionDescriptor = {\n actionLabel: string;\n command: SkillsTargetSelectionCommand;\n supportsGuideSelection: boolean;\n};\n\ntype SkillsTargetSelectionValidationInput = {\n all?: boolean;\n command: SkillsTargetSelectionCommand;\n explicitAgentIds: string[];\n explicitDir: string | null;\n guide?: boolean;\n};\n\ntype SkillsTargetSelectionRenderContext = CommandContractRenderContext;\n\nconst SKILLS_TARGET_SELECTION_DESCRIPTORS = {\n ensure: {\n actionLabel: \"Install or update\",\n command: \"ensure\",\n supportsGuideSelection: true,\n },\n install: {\n actionLabel: \"Install\",\n command: \"install\",\n supportsGuideSelection: true,\n },\n uninstall: {\n actionLabel: \"Uninstall\",\n command: \"uninstall\",\n supportsGuideSelection: false,\n },\n} as const satisfies Record<\n SkillsTargetSelectionCommand,\n SkillsTargetSelectionDescriptor\n>;\n\nconst SKILLS_TARGET_SELECTION_REQUIRED_ARGUMENTS = {\n ensure: [\n \"one target selector: --all | --agent <id...> | --dir <absolute-path> | --guide\",\n ],\n install: [\n \"one target selector: --all | --agent <id...> | --dir <absolute-path> | --guide\",\n ],\n uninstall: [\n \"one target selector: --all | --agent <id...> | --dir <absolute-path>\",\n ],\n} as const satisfies Record<SkillsTargetSelectionCommand, string[]>;\n\nconst SKILLS_TARGET_SELECTION_OPTIONAL_ARGUMENTS = {\n ensure: [],\n install: [],\n uninstall: [\"--dry-run\", \"--allow-external-targets\"],\n} as const satisfies Record<SkillsTargetSelectionCommand, string[]>;\n\nconst SKILLS_TARGET_SELECTION_ERRORS = {\n ensure: {\n conflict:\n \"use exactly one of --all, --agent <id...>, --dir <absolute-path>, or --guide\",\n missing:\n \"provide exactly one of --all, --agent <id...>, --dir <absolute-path>, or --guide\",\n },\n install: {\n conflict:\n \"use exactly one of --all, --agent <id...>, --dir <absolute-path>, or --guide\",\n missing:\n \"provide exactly one of --all, --agent <id...>, --dir <absolute-path>, or --guide\",\n },\n uninstall: {\n conflict:\n \"use exactly one of --all, --agent <id...>, or --dir <absolute-path>\",\n missing:\n \"provide exactly one of --all, --agent <id...>, or --dir <absolute-path>\",\n },\n} as const;\n\nexport function getSkillsTargetSelectionPatternContract(\n command: SkillsTargetSelectionCommand\n): CommandPatternContract<SkillsTargetSelectionRenderContext> {\n return {\n buildCommands: (context) =>\n buildSkillsTargetSelectionExamples({\n command,\n includeViewFlag: context.includeViewFlag,\n agentExampleArg: context.agentExampleArg,\n }),\n buildHints: (context) =>\n buildSkillsTargetSelectionHints({\n command,\n agentExampleArg: context.agentExampleArg,\n }),\n buildOptionalArguments: () =>\n getSkillsTargetSelectionOptionalArguments(command),\n buildRequiredArguments: () =>\n getSkillsTargetSelectionRequiredArguments(command),\n };\n}\n\nexport function registerSkillsTargetSelectionOptions(input: {\n command: Command;\n selectionCommand: SkillsTargetSelectionCommand;\n agentExampleArg: string;\n}): Command {\n const descriptor = getSkillsTargetSelectionDescriptor(input.selectionCommand);\n input.command.option(\n \"--all\",\n `${descriptor.actionLabel} skills for all detected local agents`\n );\n input.command.option(\n \"--agent <agent...>\",\n `${descriptor.actionLabel} skills for specific agent ids (for example: ${input.agentExampleArg})`\n );\n input.command.option(\n \"--dir <path>\",\n `${descriptor.actionLabel} skills ${\n input.selectionCommand === \"install\" ? \"into\" : \"from\"\n } a specific custom skills directory`\n );\n if (descriptor.supportsGuideSelection) {\n input.command.option(\"--guide\", \"Show manual installation guide only\");\n }\n return input.command;\n}\n\nexport function getSkillsTargetSelectionRequiredArguments(\n command: SkillsTargetSelectionCommand\n): string[] {\n return [...SKILLS_TARGET_SELECTION_REQUIRED_ARGUMENTS[command]];\n}\n\nexport function getSkillsTargetSelectionOptionalArguments(\n command: SkillsTargetSelectionCommand\n): string[] {\n return [...SKILLS_TARGET_SELECTION_OPTIONAL_ARGUMENTS[command]];\n}\n\nexport function buildSkillsTargetSelectionExamples(input: {\n agentExampleArg?: string;\n command: SkillsTargetSelectionCommand;\n includeViewFlag?: boolean;\n}): string[] {\n const commands = [\n buildSkillsTargetSelectionCommand({\n all: true,\n command: input.command,\n includeViewFlag: input.includeViewFlag,\n }),\n buildSkillsTargetSelectionCommand({\n agentIds: [normalizeAgentExampleArg(input.agentExampleArg)],\n command: input.command,\n includeViewFlag: input.includeViewFlag,\n }),\n buildSkillsTargetSelectionCommand({\n command: input.command,\n dir: \"<absolute-path>\",\n includeViewFlag: input.includeViewFlag,\n }),\n ];\n if (input.command === \"install\" || input.command === \"ensure\") {\n commands.push(\n buildSkillsTargetSelectionCommand({\n command: input.command,\n guide: true,\n includeViewFlag: input.includeViewFlag,\n })\n );\n } else {\n commands.push(\n buildSkillsTargetSelectionCommand({\n all: true,\n command: \"uninstall\",\n dryRun: true,\n includeViewFlag: input.includeViewFlag,\n })\n );\n }\n return commands;\n}\n\nexport function buildSkillsTargetSelectionHints(input: {\n agentExampleArg?: string;\n command: SkillsTargetSelectionCommand;\n}): string[] {\n return buildSkillsTargetSelectionExamples({\n command: input.command,\n agentExampleArg: input.agentExampleArg,\n });\n}\n\nexport function buildSkillsTargetSelectionCommand(input: {\n agentIds?: string[];\n all?: boolean;\n allowExternalTargets?: boolean;\n command: SkillsTargetSelectionCommand;\n dir?: string;\n dryRun?: boolean;\n guide?: boolean;\n includeViewFlag?: boolean;\n}): string {\n const descriptor = getSkillsTargetSelectionDescriptor(input.command);\n const tokens = [\"openmeld\", \"skills\", input.command];\n if (input.all) {\n tokens.push(\"--all\");\n } else if (input.agentIds && input.agentIds.length > 0) {\n tokens.push(\"--agent\", ...input.agentIds);\n } else if (input.dir) {\n tokens.push(\"--dir\", input.dir);\n } else if (input.guide) {\n if (!descriptor.supportsGuideSelection) {\n throw new Error(\n \"skills target selection command does not support --guide\"\n );\n }\n tokens.push(\"--guide\");\n } else {\n throw new Error(\n `skills target selection command requires one selector for ${input.command}`\n );\n }\n\n if (input.dryRun) {\n tokens.push(\"--dry-run\");\n }\n if (input.allowExternalTargets) {\n tokens.push(\"--allow-external-targets\");\n }\n if (input.includeViewFlag) {\n tokens.push(\"--view\", \"agent\");\n }\n return tokens.join(\" \");\n}\n\nexport function validateSkillsTargetSelectionInput(\n input: SkillsTargetSelectionValidationInput\n): void {\n const guide =\n getSkillsTargetSelectionDescriptor(input.command).supportsGuideSelection &&\n input.guide === true;\n const selectedModeCount = countSelectedModes({\n agentCount: input.explicitAgentIds.length,\n all: input.all,\n dir: input.explicitDir,\n guide,\n });\n if (selectedModeCount > 1) {\n throw createCommandContractError(\n `skills.${input.command}_invalid`,\n SKILLS_TARGET_SELECTION_ERRORS[input.command].conflict\n );\n }\n if (selectedModeCount === 0) {\n throw createCommandContractError(\n `skills.${input.command}_invalid`,\n SKILLS_TARGET_SELECTION_ERRORS[input.command].missing\n );\n }\n}\n\nfunction countSelectedModes(input: {\n agentCount: number;\n all?: boolean;\n dir: string | null;\n guide: boolean;\n}): number {\n return (\n (input.all ? 1 : 0) +\n (input.agentCount > 0 ? 1 : 0) +\n (input.dir ? 1 : 0) +\n (input.guide ? 1 : 0)\n );\n}\n\nfunction getSkillsTargetSelectionDescriptor(\n command: SkillsTargetSelectionCommand\n): SkillsTargetSelectionDescriptor {\n return SKILLS_TARGET_SELECTION_DESCRIPTORS[command];\n}\n\nfunction normalizeAgentExampleArg(value: string | undefined): string {\n const normalized = String(value ?? \"\").trim();\n return normalized.length > 0 ? normalized : \"<id...>\";\n}\n","export const SPACE_ADD_MEMBERS_PROGRESS_HEARTBEAT_MS = 5000;\n\nexport type SpaceAddMembersProgressStage =\n | \"resolve_candidates\"\n | \"check_local_wake_readiness\"\n | \"plan_local_wake_participation\"\n | \"confirm_local_wake_bindings\"\n | \"add_members\"\n | \"record_join_notices\";\n\nexport type SpaceAddMembersProgressOwner =\n | \"cli\"\n | \"local_runtime\"\n | \"local_participation\"\n | \"core\"\n | \"space\";\n\nexport type SpaceAddMembersProgressFactSource =\n | \"profile_store\"\n | \"space_membership_api\"\n | \"local_agent_registry\"\n | \"agent_controller_report_projection\"\n | \"local_readiness_diagnostics\"\n | \"local_participation_plan\"\n | \"agent_profile_binding_api\"\n | \"space_membership_api_write\"\n | \"space_membership_projection\"\n | \"space_signal_api_write\";\n\nexport type SpaceAddMembersProgressPhaseContract = {\n stage: SpaceAddMembersProgressStage;\n phase: string;\n owner: SpaceAddMembersProgressOwner;\n waitingFor: string;\n factSource: SpaceAddMembersProgressFactSource;\n summary: string;\n};\n\nexport const SPACE_ADD_MEMBERS_PROGRESS_PHASES = [\n {\n stage: \"resolve_candidates\",\n phase: \"read_profiles\",\n owner: \"cli\",\n waitingFor: \"active profile identities eligible for this Space operation\",\n factSource: \"profile_store\",\n summary:\n \"Reading active local profile identities for this Space operation.\",\n },\n {\n stage: \"resolve_candidates\",\n phase: \"read_space_members\",\n owner: \"space\",\n waitingFor: \"current Space membership snapshot\",\n factSource: \"space_membership_api\",\n summary: \"Reading current Space membership before selecting profiles.\",\n },\n {\n stage: \"resolve_candidates\",\n phase: \"read_local_targets\",\n owner: \"local_runtime\",\n waitingFor: \"local agent controller state on this computer\",\n factSource: \"local_agent_registry\",\n summary: \"Reading local agent controller state for candidate profiles.\",\n },\n {\n stage: \"resolve_candidates\",\n phase: \"read_local_targets_wait\",\n owner: \"local_runtime\",\n waitingFor: \"local agent controller state on this computer\",\n factSource: \"local_agent_registry\",\n summary:\n \"Still reading local agent controller state for candidate profiles.\",\n },\n {\n stage: \"resolve_candidates\",\n phase: \"read_agent_controller_report\",\n owner: \"core\",\n waitingFor: \"Agent Profile execution target projection\",\n factSource: \"agent_controller_report_projection\",\n summary: \"Reading the Agent Profile execution target projection.\",\n },\n {\n stage: \"resolve_candidates\",\n phase: \"read_agent_controller_report_wait\",\n owner: \"core\",\n waitingFor: \"Agent Profile execution target projection\",\n factSource: \"agent_controller_report_projection\",\n summary: \"Still reading the Agent Profile execution target projection.\",\n },\n {\n stage: \"resolve_candidates\",\n phase: \"read_profile_readiness\",\n owner: \"local_participation\",\n waitingFor: \"local Wake participation diagnostics for candidate profiles\",\n factSource: \"local_readiness_diagnostics\",\n summary:\n \"Reading local Wake participation diagnostics for candidate profiles.\",\n },\n {\n stage: \"resolve_candidates\",\n phase: \"read_profile_readiness_wait\",\n owner: \"local_participation\",\n waitingFor: \"local Wake participation diagnostics for candidate profiles\",\n factSource: \"local_readiness_diagnostics\",\n summary:\n \"Still reading local Wake participation diagnostics for candidate profiles.\",\n },\n {\n stage: \"check_local_wake_readiness\",\n phase: \"start\",\n owner: \"local_participation\",\n waitingFor: \"selected profiles local Wake participation check\",\n factSource: \"local_readiness_diagnostics\",\n summary:\n \"Checking whether selected agent profiles can wake from this computer.\",\n },\n {\n stage: \"check_local_wake_readiness\",\n phase: \"read_local_targets\",\n owner: \"local_runtime\",\n waitingFor: \"local agent controller state on this computer\",\n factSource: \"local_agent_registry\",\n summary:\n \"Reading local agent controller state before checking selected profiles.\",\n },\n {\n stage: \"check_local_wake_readiness\",\n phase: \"read_local_targets_wait\",\n owner: \"local_runtime\",\n waitingFor: \"local agent controller state on this computer\",\n factSource: \"local_agent_registry\",\n summary:\n \"Still reading local agent controller state before checking selected profiles.\",\n },\n {\n stage: \"check_local_wake_readiness\",\n phase: \"read_profile_readiness\",\n owner: \"local_participation\",\n waitingFor: \"local Wake participation diagnostics for selected profiles\",\n factSource: \"local_readiness_diagnostics\",\n summary:\n \"Reading local Wake participation diagnostics for selected profiles.\",\n },\n {\n stage: \"check_local_wake_readiness\",\n phase: \"read_profile_readiness_wait\",\n owner: \"local_participation\",\n waitingFor: \"local Wake participation diagnostics for selected profiles\",\n factSource: \"local_readiness_diagnostics\",\n summary:\n \"Still reading local Wake participation diagnostics for selected profiles.\",\n },\n {\n stage: \"plan_local_wake_participation\",\n phase: \"plan\",\n owner: \"local_participation\",\n waitingFor: \"local participation plan for selected profiles\",\n factSource: \"local_participation_plan\",\n summary: \"Planning local Wake participation work for selected profiles.\",\n },\n {\n stage: \"confirm_local_wake_bindings\",\n phase: \"start\",\n owner: \"local_participation\",\n waitingFor: \"formal Binding confirmation for ready local profiles\",\n factSource: \"agent_profile_binding_api\",\n summary:\n \"Confirming available local agent profiles have Wake bindings before adding them.\",\n },\n {\n stage: \"confirm_local_wake_bindings\",\n phase: \"profile_binding_sync\",\n owner: \"local_participation\",\n waitingFor:\n \"local runtime evidence submission and Agent Profile Binding write\",\n factSource: \"agent_profile_binding_api\",\n summary:\n \"Submitting local runtime evidence and writing the Agent Profile Binding.\",\n },\n {\n stage: \"confirm_local_wake_bindings\",\n phase: \"profile_binding_sync_wait\",\n owner: \"local_participation\",\n waitingFor:\n \"local runtime evidence submission and Agent Profile Binding write\",\n factSource: \"agent_profile_binding_api\",\n summary:\n \"Still submitting local runtime evidence and writing the Agent Profile Binding.\",\n },\n {\n stage: \"confirm_local_wake_bindings\",\n phase: \"profile_binding_confirmed\",\n owner: \"core\",\n waitingFor:\n \"Core execution readiness projection after Binding confirmation\",\n factSource: \"agent_profile_binding_api\",\n summary:\n \"Local participation Binding is confirmed; this is not a final Wake outcome.\",\n },\n {\n stage: \"confirm_local_wake_bindings\",\n phase: \"profile_binding_not_confirmed\",\n owner: \"core\",\n waitingFor:\n \"Core execution readiness projection after Binding confirmation\",\n factSource: \"agent_profile_binding_api\",\n summary:\n \"Local participation Binding was not confirmed; membership can continue with diagnostics.\",\n },\n {\n stage: \"add_members\",\n phase: \"write_membership\",\n owner: \"space\",\n waitingFor: \"Space membership write\",\n factSource: \"space_membership_api_write\",\n summary: \"Adding selected profiles to the Space.\",\n },\n {\n stage: \"add_members\",\n phase: \"confirm_membership_projection\",\n owner: \"space\",\n waitingFor: \"Space membership and Wake availability projection\",\n factSource: \"space_membership_projection\",\n summary:\n \"Confirming the Space can see newly added wakeable members before returning.\",\n },\n {\n stage: \"record_join_notices\",\n phase: \"write_join_notices\",\n owner: \"space\",\n waitingFor: \"visible Space join notice signals\",\n factSource: \"space_signal_api_write\",\n summary: \"Recording visible join notices for newly added members.\",\n },\n] as const satisfies readonly SpaceAddMembersProgressPhaseContract[];\n\nexport const SPACE_ADD_MEMBERS_PROGRESS_OVERVIEW_STAGES =\n SPACE_ADD_MEMBERS_PROGRESS_PHASES.map(\n (phase) => `${phase.stage}/${phase.phase}`\n );\n\nexport const SPACE_ADD_MEMBERS_AGENT_OVERVIEW_STAGES = [\n \"check_arguments\",\n \"authenticate\",\n \"check_profile\",\n \"resolve_target\",\n \"add_members/write_membership\",\n \"record_join_notices/write_join_notices\",\n] as const;\n\nexport function resolveSpaceAddMembersProgressPhase(input: {\n stage: SpaceAddMembersProgressStage;\n phase: string;\n}): SpaceAddMembersProgressPhaseContract {\n const contract = SPACE_ADD_MEMBERS_PROGRESS_PHASES.find(\n (phase) => phase.stage === input.stage && phase.phase === input.phase\n );\n if (!contract) {\n throw new Error(\n `unknown space add-members progress phase: ${input.stage}/${input.phase}`\n );\n }\n return contract;\n}\n","import type { Command } from \"commander\";\nimport { createCommandContractError } from \"../command-contracts/helpers\";\nimport type {\n CommandContractRenderContext,\n CommandPatternContract,\n} from \"../command-contracts/types\";\nimport { formatProfileAwareOpenMeldCliCommand } from \"../runtime/cli-entry-command\";\n\nexport type SpaceMemberSelectionCommand =\n | \"add-agents\"\n | \"add-human-profiles\"\n | \"add-members\"\n | \"remove-members\";\n\ntype SpaceMemberSelectionRenderContext = CommandContractRenderContext;\n\nconst SPACE_MEMBER_SELECTION_REQUIRED_ARGUMENT = [\n \"<space-id>\",\n \"one selection mode: <selector-option> <selector-operand> | --all\",\n] as const;\nconst SPACE_MEMBER_SELECTION_OPTIONAL_ARGUMENTS = [\n \"--password <value>\",\n \"parent option: openmeld space --gateway-url <url>\",\n \"--profile <profile-id>\",\n] as const;\nconst SPACE_MEMBER_SELECTION_CONFLICT_ERRORS = {\n \"add-agents\":\n \"`openmeld space add-agents`: use either --agent-profile <agent-profile-id...> or --all, not both\",\n \"add-human-profiles\":\n \"`openmeld space add-human-profiles`: use either --human-profile <human-profile-id...> or --all, not both\",\n \"add-members\":\n \"`openmeld space add-members`: use either --member <profile-id...> or --all, not both\",\n \"remove-members\":\n \"`openmeld space remove-members`: use either --member <profile-id...> or --all, not both\",\n} as const;\nconst SPACE_MEMBER_SELECTION_MISSING_ERRORS = {\n \"add-agents\":\n \"`openmeld space add-agents` requires --agent-profile <agent-profile-id...> or --all in non-interactive mode\",\n \"add-human-profiles\":\n \"`openmeld space add-human-profiles` requires --human-profile <human-profile-id...> or --all in non-interactive mode\",\n \"add-members\":\n \"`openmeld space add-members` requires --member <profile-id...> or --all in non-interactive mode\",\n \"remove-members\":\n \"`openmeld space remove-members` requires --member <profile-id...> or --all in non-interactive mode\",\n} as const;\n\nexport function getSpaceMemberSelectionPatternContract(\n command: SpaceMemberSelectionCommand\n): CommandPatternContract<SpaceMemberSelectionRenderContext> {\n const selector = getSpaceMemberSelectionSelector(command);\n return {\n buildCommands: (context) =>\n buildSpaceMemberSelectionExamples({\n command,\n includeViewFlag: context.includeViewFlag,\n profileId: context.profileId,\n }),\n buildHints: (context) =>\n buildSpaceMemberSelectionExamples({\n command,\n includeViewFlag: context.includeViewFlag,\n profileId: context.profileId,\n }),\n buildOptionalArguments: () => [\n ...SPACE_MEMBER_SELECTION_OPTIONAL_ARGUMENTS,\n ],\n buildRequiredArguments: () =>\n SPACE_MEMBER_SELECTION_REQUIRED_ARGUMENT.map((argument) =>\n argument\n .replace(\"<selector-option>\", selector.option)\n .replace(\"<selector-operand>\", selector.operand)\n ),\n };\n}\n\nexport function registerSpaceMemberSelectionOptions(input: {\n command: Command;\n selectionCommand: SpaceMemberSelectionCommand;\n}): Command {\n const selector = getSpaceMemberSelectionSelector(input.selectionCommand);\n return input.command\n .option(\n `${selector.option} ${selector.operand}`,\n `${selector.label} id(s) to ${selector.action} (single or multiple)`\n )\n .option(\"--all\", selector.allDescription);\n}\n\nexport function buildSpaceMemberSelectionExamples(input: {\n command: SpaceMemberSelectionCommand;\n includeViewFlag?: boolean;\n profileId?: string | null;\n}): string[] {\n const selector = getSpaceMemberSelectionSelector(input.command);\n return [\n buildSpaceMemberSelectionCommand({\n command: input.command,\n includeViewFlag: input.includeViewFlag,\n memberIds: [selector.operand],\n profileId: input.profileId,\n }),\n buildSpaceMemberSelectionCommand({\n all: true,\n command: input.command,\n includeViewFlag: input.includeViewFlag,\n profileId: input.profileId,\n }),\n ];\n}\n\nexport function validateSpaceMemberSelectionInput(input: {\n all: boolean;\n command: SpaceMemberSelectionCommand;\n explicitMemberIds: string[];\n}): void {\n if (input.all && input.explicitMemberIds.length > 0) {\n throw createCommandContractError(\n `space.${input.command}.selector_invalid`,\n SPACE_MEMBER_SELECTION_CONFLICT_ERRORS[input.command]\n );\n }\n if (!(input.all || input.explicitMemberIds.length > 0)) {\n throw createCommandContractError(\n `space.${input.command}.selector_missing`,\n SPACE_MEMBER_SELECTION_MISSING_ERRORS[input.command]\n );\n }\n}\n\nfunction buildSpaceMemberSelectionCommand(input: {\n all?: boolean;\n command: SpaceMemberSelectionCommand;\n includeViewFlag?: boolean;\n memberIds?: string[];\n profileId?: string | null;\n}): string {\n const tokens = [\"openmeld\", \"space\", input.command, \"<space-id>\"];\n if (input.all) {\n tokens.push(\"--all\");\n } else if (input.memberIds && input.memberIds.length > 0) {\n tokens.push(\n getSpaceMemberSelectionSelector(input.command).option,\n ...input.memberIds\n );\n } else {\n throw new Error(\"space member selection command requires a selector\");\n }\n if (input.includeViewFlag) {\n return formatProfileAwareOpenMeldCliCommand(tokens.join(\" \"), {\n profileId: input.profileId ?? \"<profile-id>\",\n resolvedView: \"agent\",\n });\n }\n return tokens.join(\" \");\n}\n\nfunction getSpaceMemberSelectionSelector(\n command: SpaceMemberSelectionCommand\n): {\n action: string;\n allDescription: string;\n label: string;\n option: \"--agent-profile\" | \"--human-profile\" | \"--member\";\n operand:\n | \"<agent-profile-id...>\"\n | \"<human-profile-id...>\"\n | \"<profile-id...>\";\n} {\n switch (command) {\n case \"add-agents\":\n return {\n action: \"add\",\n allDescription:\n \"Add all eligible Agent Profiles that are not yet in this space\",\n label: \"Agent Profile\",\n option: \"--agent-profile\",\n operand: \"<agent-profile-id...>\",\n };\n case \"add-human-profiles\":\n return {\n action: \"add\",\n allDescription:\n \"Add all eligible Human Profiles that are not yet in this space\",\n label: \"Human Profile\",\n option: \"--human-profile\",\n operand: \"<human-profile-id...>\",\n };\n case \"add-members\":\n return {\n action: \"add\",\n allDescription:\n \"Add all eligible profiles that are not yet in this space\",\n label: \"Profile\",\n option: \"--member\",\n operand: \"<profile-id...>\",\n };\n case \"remove-members\":\n return {\n action: \"remove\",\n allDescription: \"Remove all eligible members that are currently active\",\n label: \"Profile\",\n option: \"--member\",\n operand: \"<profile-id...>\",\n };\n default:\n assertNever(command);\n }\n}\n\nfunction assertNever(value: never): never {\n throw new Error(\n `unexpected space member selection command: ${String(value)}`\n );\n}\n","export const ROOT_ENTRY_START_COMMAND = \"openmeld start\";\n\nexport const ROOT_ENTRY_COMMANDS = [\n {\n command: \"openmeld setup\",\n description: \"Set up this computer for Space Wake\",\n },\n {\n command: \"openmeld start\",\n description: \"Initialize your identity\",\n },\n {\n command: \"openmeld auth\",\n description: \"Sign in, sign out, and inspect auth state\",\n },\n {\n command: \"openmeld profiles\",\n description: \"Manage OpenMeld profiles\",\n },\n {\n command: \"openmeld agents\",\n description: \"Manage OpenMeld agent targets and bindings\",\n },\n {\n command: \"openmeld computer\",\n description: \"Name this computer in OpenMeld\",\n },\n {\n command: \"openmeld view human|agent\",\n description: \"Switch default view mode\",\n },\n {\n command: \"openmeld space\",\n description: \"Create, join, and configure spaces\",\n },\n {\n command: \"openmeld routines\",\n description: \"Manage scheduled Center Agent Routines\",\n },\n {\n command: \"openmeld skills\",\n description: \"Install or list OpenMeld skills\",\n },\n {\n command: \"openmeld service\",\n description: \"Manage OpenMeld background service\",\n },\n {\n command: \"openmeld whoami\",\n description: \"Show your current identity\",\n },\n {\n command: \"openmeld doctor\",\n description: \"Check local setup and connectivity\",\n },\n {\n command: \"openmeld upgrade\",\n description: \"Upgrade OpenMeld CLI when a new version is available\",\n },\n {\n command: \"openmeld reset\",\n description: \"Reset local OpenMeld state and reinitialize baseline files\",\n },\n {\n command: \"openmeld help (-h, --help)\",\n description: \"Show help for a command\",\n },\n] as const;\n","import {\n buildBuiltinAgentSelectionExamples,\n getBuiltinAgentSelectionOptionalArguments,\n getBuiltinAgentSelectionRequiredArguments,\n} from \"../agents/builtin-selection-contract\";\nimport { AUTH_LOGIN_REQUEST_PATTERN_CONTRACT } from \"../auth/login-request-contract\";\nimport { getDaemonControlTargetPatternContract } from \"../command-contracts/service-control-target\";\nimport type { CommandEntryName } from \"../command-entry-checks/types\";\nimport { getCliVersionInfo } from \"../runtime/cli-version\";\nimport { getSkillsTargetSelectionPatternContract } from \"../skills/target-selection-contract\";\nimport { SPACE_ADD_MEMBERS_AGENT_OVERVIEW_STAGES } from \"../space/add-members-progress-contract\";\nimport { getSpaceMemberSelectionPatternContract } from \"../space/member-selection-contract\";\nimport { ROOT_ENTRY_COMMANDS } from \"../ui/root-entry-catalog\";\nimport type {\n CommandContractRenderContext,\n CommandEntryContract,\n} from \"./types\";\n\ntype CommandContractRegistryContext = CommandContractRenderContext & {\n knownAgentIds?: string[];\n skills?: Array<{\n name: string;\n relativePath: string;\n }>;\n storeDir?: string;\n summary?: string;\n};\n\ntype SkillsContractContext = CommandContractRenderContext & {\n knownAgentIds?: string[];\n skills?: Array<{\n name: string;\n relativePath: string;\n }>;\n storeDir?: string;\n};\n\nfunction buildSpaceAddProfilesContract(input: {\n command: \"add-agents\" | \"add-human-profiles\" | \"add-members\";\n entryName:\n | \"space.add-agents\"\n | \"space.add-human-profiles\"\n | \"space.add-members\";\n humanChoiceText: string;\n summary: string;\n requiredSummary: string;\n}): CommandEntryContract<CommandContractRegistryContext> {\n return {\n agentOverview: {\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [\n \"space is single-select; profiles support one or many selections.\",\n \"already-joined profiles are skipped automatically.\",\n \"Space membership is separate from Agent Profile readiness.\",\n ],\n pattern: getSpaceMemberSelectionPatternContract(input.command),\n stages: [...SPACE_ADD_MEMBERS_AGENT_OVERVIEW_STAGES],\n summary: input.summary,\n },\n buildHints: (context) =>\n getSpaceMemberSelectionPatternContract(input.command).buildHints?.({\n ...context,\n includeViewFlag: true,\n profileId: context.profileId ?? \"<profile-id>\",\n }) ?? [],\n entryName: input.entryName,\n guideScenarios: {\n required: {\n code: `space.${input.command.replaceAll(\"-\", \"_\")}.arguments.required`,\n humanSteps: [\n \"openmeld view human\",\n `openmeld space ${input.command}`,\n input.humanChoiceText,\n ],\n notes: [\n \"space is single-select; profiles support one or many selections.\",\n \"already-joined profiles are skipped automatically.\",\n \"Adding a profile to a Space does not prove Agent Profile readiness.\",\n ],\n pattern: getSpaceMemberSelectionPatternContract(input.command),\n summary: (context: { summary?: string }) =>\n context.summary ?? input.requiredSummary,\n },\n },\n };\n}\n\nconst COMMAND_ENTRY_CONTRACTS: Partial<\n Record<CommandEntryName, CommandEntryContract<CommandContractRegistryContext>>\n> = {\n root: {\n agentOverview: {\n commands: () => ROOT_ENTRY_COMMANDS.map((item) => item.command),\n extraPayload: () => ({ cli: getCliVersionInfo() }),\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [\n \"Human view renders the branded banner; agent view receives this structured root overview.\",\n ],\n optionalArguments: [],\n requiredArguments: [],\n stages: [\n \"Recommend the first onboarding command.\",\n \"List the top-level OpenMeld commands available from the root entry.\",\n \"Return the currently installed CLI version and release date.\",\n ],\n summary:\n \"Show the OpenMeld root entry menu, recommend `openmeld start`, and expose the current CLI release metadata.\",\n },\n entryName: \"root\",\n },\n view: {\n agentOverview: {\n commands: [\n \"openmeld view --view agent\",\n \"openmeld view agent --profile <profile-id> --view agent\",\n \"openmeld view auto --profile <profile-id> --view agent\",\n ],\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [\n \"Saving a default view requires an active OpenMeld profile or an explicit `--profile`.\",\n ],\n optionalArguments: [\"[mode]\", \"--profile <id-or-name>\"],\n requiredArguments: [],\n stages: [\n \"Read the current default view when no new mode is provided.\",\n \"Resolve the target OpenMeld profile when saving a new default view.\",\n \"Return the current or updated default view.\",\n ],\n summary:\n \"Inspect or save the default OpenMeld view mode for the current or explicit OpenMeld profile.\",\n },\n entryName: \"view\",\n },\n \"agents.disable\": {\n agentOverview: {\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [],\n optionalArguments: () =>\n getBuiltinAgentSelectionOptionalArguments(\"disable\"),\n requiredArguments: () =>\n getBuiltinAgentSelectionRequiredArguments(\"disable\"),\n stages: [],\n summary: \"\",\n commands: ({ includeViewFlag = false }) =>\n buildBuiltinAgentSelectionExamples({\n command: \"disable\",\n includeViewFlag,\n }),\n },\n buildHints: () =>\n buildBuiltinAgentSelectionExamples({ command: \"disable\" }),\n entryName: \"agents.disable\",\n },\n \"agents.enable\": {\n agentOverview: {\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [],\n optionalArguments: () =>\n getBuiltinAgentSelectionOptionalArguments(\"enable\"),\n requiredArguments: () =>\n getBuiltinAgentSelectionRequiredArguments(\"enable\"),\n stages: [],\n summary: \"\",\n commands: ({ includeViewFlag = false }) =>\n buildBuiltinAgentSelectionExamples({\n command: \"enable\",\n includeViewFlag,\n }),\n },\n buildHints: () => buildBuiltinAgentSelectionExamples({ command: \"enable\" }),\n entryName: \"agents.enable\",\n },\n \"agents.repair\": {\n agentOverview: {\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [],\n optionalArguments: () =>\n getBuiltinAgentSelectionOptionalArguments(\"repair\"),\n requiredArguments: () =>\n getBuiltinAgentSelectionRequiredArguments(\"repair\"),\n stages: [],\n summary: \"\",\n commands: ({ includeViewFlag = false }) =>\n buildBuiltinAgentSelectionExamples({\n command: \"repair\",\n includeViewFlag,\n }),\n },\n buildHints: () => buildBuiltinAgentSelectionExamples({ command: \"repair\" }),\n entryName: \"agents.repair\",\n },\n \"auth.menu\": {\n agentOverview: {\n commands: [\n \"openmeld auth status --view agent\",\n \"openmeld login --view agent --ott <token>\",\n \"openmeld logout --view agent\",\n ],\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [\n \"Agent view does not open the human interactive auth menu.\",\n \"Prefer explicit auth subcommands to keep automation deterministic.\",\n ],\n optionalArguments: [],\n requiredArguments: [],\n stages: [\n \"Inspect current local auth session state.\",\n \"Choose an explicit sign-in, sign-out, or status command.\",\n \"Read the structured auth result or follow-up guidance.\",\n ],\n summary:\n \"Inspect or change the local OpenMeld authentication session with explicit non-interactive auth subcommands.\",\n },\n entryName: \"auth.menu\",\n },\n \"auth.login\": {\n agentOverview: {\n humanActionRequired: {\n possible: true,\n steps: [\n \"If no one-time token is available, ask a human to open the OpenMeld auth page in a browser.\",\n \"Ask the human to generate a one-time token or approve the device sign-in request.\",\n \"Retry the same sign-in command with the returned token when using OTT.\",\n ],\n },\n notes: [\n \"One-time token sign-in is the preferred automation path in agent view.\",\n \"When using device flow in agent view, keep browser opening disabled and ask a human to finish approval in the browser.\",\n ],\n pattern: AUTH_LOGIN_REQUEST_PATTERN_CONTRACT,\n stages: [\n \"Resolve the explicit sign-in method for agent view.\",\n \"Request a device flow or verify a one-time token.\",\n \"Persist the local auth session and return success details.\",\n ],\n summary:\n \"Establish a local OpenMeld sign-in session with an explicit sign-in method and deterministic machine-readable guidance.\",\n },\n buildHints: () =>\n AUTH_LOGIN_REQUEST_PATTERN_CONTRACT.buildHints?.({}) ?? [],\n entryName: \"auth.login\",\n guideScenarios: {\n required: {\n code: \"auth.login.arguments.required\",\n humanSteps: [\"openmeld view human\", \"openmeld auth\", \"Select: Sign in\"],\n pattern: AUTH_LOGIN_REQUEST_PATTERN_CONTRACT,\n summary: (context: { summary?: string }) =>\n `openmeld auth login: ${context.summary ?? \"\"}`,\n },\n },\n },\n \"auth.logout\": {\n agentOverview: {\n commands: [\n \"openmeld logout --view agent\",\n \"openmeld auth status --view agent\",\n ],\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [\n \"Sign-out only affects your local OpenMeld installation.\",\n \"Sign-out does not delete cloud OpenMeld profiles or affect other OpenMeld installations on this device.\",\n ],\n optionalArguments: [],\n requiredArguments: [],\n stages: [\n \"Load the current local sign-in session.\",\n \"Best-effort stop OpenMeld Service for your local OpenMeld installation.\",\n \"Clear the saved selected-profile pointers for your local OpenMeld installation.\",\n \"Remove the saved local sign-in session if it exists.\",\n \"Return the final sign-out state.\",\n ],\n summary:\n \"Clear the current local OpenMeld sign-in session and clean up your local OpenMeld service and profile state on this device.\",\n },\n entryName: \"auth.logout\",\n },\n \"auth.status\": {\n agentOverview: {\n commands: [\n \"openmeld auth status --view agent\",\n \"openmeld login --view agent --ott <token>\",\n ],\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [\"Status is read-only in agent view.\"],\n optionalArguments: [],\n requiredArguments: [],\n stages: [\n \"Load the local auth session.\",\n \"Validate remote auth state when possible.\",\n \"Return machine-readable auth session details.\",\n ],\n summary:\n \"Inspect the current OpenMeld authentication session without changing any local auth state.\",\n },\n entryName: \"auth.status\",\n },\n doctor: {\n agentOverview: {\n commands: [\n \"openmeld doctor --view agent\",\n \"openmeld doctor --repair --view agent\",\n \"openmeld whoami --view agent\",\n ],\n humanActionRequired: {\n possible: true,\n steps: [\n \"If auth is missing or expired, ask a human to complete `openmeld login`.\",\n \"If doctor reports device or gateway issues, ask a human to inspect the failing subsystem before retrying.\",\n ],\n },\n notes: [\n \"Doctor emits a sequence of `doctor.check.*` records instead of one summary payload.\",\n \"Read every failing check before deciding whether human intervention is required.\",\n ],\n optionalArguments: [\n \"--profile <id-or-name>\",\n \"--base-url <url>\",\n \"--repair\",\n ],\n requiredArguments: [],\n stages: [\n \"Inspect sign-in and OpenMeld profile readiness.\",\n \"Probe gateway connectivity and gateway chain health.\",\n \"Check local agent setup and emit structured pass/fail lines.\",\n ],\n summary:\n \"Run OpenMeld diagnostics and stream structured check results for profile, gateway, connectivity, and local agent readiness.\",\n },\n entryName: \"doctor\",\n },\n \"repair.local-state\": {\n agentOverview: {\n commands: [\n \"openmeld repair local-state --view agent\",\n \"openmeld whoami --view agent\",\n ],\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [\n \"Repair local-state only affects your local OpenMeld installation and does not require sign-in.\",\n ],\n optionalArguments: [],\n requiredArguments: [],\n stages: [\n \"Inspect local OpenMeld storage versions and known legacy paths.\",\n \"Apply safe migrations and cleanup tasks.\",\n \"Return the final local-state alignment report.\",\n ],\n summary:\n \"Run the local OpenMeld data alignment and cleanup routine for your OpenMeld installation.\",\n },\n entryName: \"repair.local-state\",\n },\n \"service.install\": {\n agentOverview: {\n commands: [\n \"openmeld service install --view agent\",\n \"openmeld service start --view agent\",\n ],\n humanActionRequired: false,\n notes: [\n \"Install does not automatically start the service; use `openmeld service start --view agent` next.\",\n ],\n optionalArguments: [],\n requiredArguments: [],\n stages: [\n \"Prepare OpenMeld Service files for this CLI version.\",\n \"Persist installation metadata.\",\n \"Return installation state and local reply readiness.\",\n ],\n summary:\n \"Install OpenMeld Service runtime files for this OpenMeld installation.\",\n },\n entryName: \"service.install\",\n },\n \"service.menu\": {\n agentOverview: {\n commands: [\n \"openmeld service --view agent\",\n \"openmeld service status --view agent\",\n \"openmeld service snapshot --view agent\",\n \"openmeld service interrupt --dispatch <id> --view agent\",\n \"openmeld service cancel --dispatch <id> --view agent\",\n \"openmeld service start --view agent\",\n \"openmeld service stop --view agent\",\n \"openmeld service install --view agent\",\n \"openmeld service repair --view agent\",\n \"openmeld service uninstall --view agent\",\n ],\n humanActionRequired: false,\n notes: [\n \"Agent view does not open the human interactive service menu.\",\n \"Prefer explicit subcommands to keep automation deterministic.\",\n ],\n optionalArguments: [],\n requiredArguments: [],\n stages: [\n \"Inspect service installation and runtime state.\",\n \"Choose an explicit lifecycle command.\",\n \"Execute the requested OpenMeld Service task and read the structured result.\",\n ],\n summary:\n \"Manage the OpenMeld Service lifecycle on this device with explicit non-interactive commands.\",\n },\n entryName: \"service.menu\",\n },\n \"service.reinstall\": {\n agentOverview: {\n commands: [\n \"openmeld service repair --view agent\",\n \"openmeld service repair --force --view agent\",\n \"openmeld service status --view agent\",\n ],\n humanActionRequired: false,\n notes: [\n \"Use `--force` only when graceful drain times out and you accept possible in-flight task loss.\",\n ],\n optionalArguments: [\"--force\"],\n requiredArguments: [],\n stages: [\n \"Drain and tear down the current service safely.\",\n \"Repair OpenMeld Service files for this CLI version.\",\n \"Restart or report the service outcome.\",\n ],\n summary:\n \"Repair OpenMeld Service, preserving runtime data and optionally restarting it.\",\n },\n entryName: \"service.reinstall\",\n },\n \"service.run\": {\n agentOverview: {\n commands: [\n \"openmeld service start --view agent\",\n \"openmeld service start --mode foreground --view agent\",\n \"openmeld service status --view agent\",\n ],\n humanActionRequired: false,\n notes: [\n \"Background mode is the default and recommended mode.\",\n \"A selected OpenMeld profile is not required; use `--profile` only as an optional override.\",\n \"Use foreground mode when you need direct startup logs for debugging.\",\n ],\n optionalArguments: [\n \"--mode background|foreground\",\n \"--profile <id-or-name>\",\n \"--gateway-url <url>\",\n \"--device-id <id>\",\n \"--heartbeat-ms <n>\",\n ],\n requiredArguments: [],\n stages: [\n \"Validate local service installation and OpenMeld auth readiness.\",\n \"Resolve runtime mode and local service hygiene.\",\n \"Start the daemon and return runtime status.\",\n ],\n summary:\n \"Start OpenMeld Service with an explicit start mode and the existing OpenMeld sign-in context.\",\n },\n entryName: \"service.run\",\n },\n \"service.snapshot\": {\n agentOverview: {\n commands: [\n \"openmeld service snapshot --view agent\",\n \"openmeld service status --view agent\",\n ],\n humanActionRequired: false,\n notes: [\n \"Snapshot capture is read-only and does not modify OpenMeld Service state.\",\n ],\n optionalArguments: [\"--profile <id-or-name>\"],\n requiredArguments: [],\n stages: [\n \"Read the current local OpenMeld service status snapshot.\",\n \"Copy current runtime logs, state, and data into a lane-scoped evidence directory.\",\n \"Return the saved evidence path for follow-up debugging.\",\n ],\n summary:\n \"Capture a point-in-time OpenMeld Service evidence snapshot for the current lane.\",\n },\n entryName: \"service.snapshot\",\n },\n \"service.status\": {\n agentOverview: {\n commands: [\n \"openmeld service status --view agent\",\n \"openmeld service start --view agent\",\n \"openmeld service repair --view agent\",\n ],\n humanActionRequired: false,\n notes: [\n \"Status is read-only in agent view and does not change OpenMeld Service.\",\n \"Agent view emits daemon.status.local_result first with local service evidence, then daemon.status.result with full readiness diagnostics.\",\n ],\n optionalArguments: [\"--profile <id-or-name>\"],\n requiredArguments: [],\n stages: [\n \"Read installed service state and runtime state.\",\n \"Return fast local service evidence as daemon.status.local_result.\",\n \"Project local device readiness, gateway checks, route observation, and cleanup anomalies.\",\n \"Return full structured status and reply readiness as daemon.status.result.\",\n ],\n summary:\n \"Inspect local OpenMeld service installation, runtime state, readiness, and cleanup signals without changing state.\",\n },\n entryName: \"service.status\",\n },\n \"service.stop\": {\n agentOverview: {\n commands: [\n \"openmeld service stop --view agent\",\n \"openmeld service stop --force --view agent\",\n \"openmeld service status --view agent\",\n ],\n humanActionRequired: false,\n notes: [\n \"Use `--force` only when the service does not stop cleanly with the default graceful stop.\",\n ],\n optionalArguments: [\"--force\", \"--profile <id-or-name>\"],\n requiredArguments: [],\n stages: [\n \"Read the current local runtime state.\",\n \"Stop the active service process or managed service.\",\n \"Return the final stop result or not-running status.\",\n ],\n summary: \"Stop OpenMeld Service or the system-managed service instance.\",\n },\n entryName: \"service.stop\",\n },\n \"service.uninstall\": {\n agentOverview: {\n commands: [\n \"openmeld service uninstall --view agent\",\n \"openmeld service install --view agent\",\n ],\n humanActionRequired: false,\n notes: [\n \"Future OpenMeld startup checks will strongly recommend repairing OpenMeld Service after uninstall.\",\n ],\n optionalArguments: [],\n requiredArguments: [],\n stages: [\n \"Stop service processes when needed.\",\n \"Remove local service runtime assets and install metadata.\",\n \"Return uninstall state and next startup guidance.\",\n ],\n summary:\n \"Remove OpenMeld Service runtime files and clear local service state on this device.\",\n },\n entryName: \"service.uninstall\",\n },\n \"service.cancel\": {\n agentOverview: {\n humanActionRequired: false,\n notes: [\n \"`--dispatch` is the primary selector; `--task` is a debug-only backdoor.\",\n \"Cancel validates only local daemon runtime availability; it does not require OpenMeld sign-in or a selected OpenMeld profile.\",\n ],\n pattern: getDaemonControlTargetPatternContract(\"cancel\"),\n stages: [\n \"Resolve the local daemon control target.\",\n \"Send the cancel request through the local daemon control-plane.\",\n \"Return the accepted or rejected control result.\",\n ],\n summary:\n \"Send a cancel request to one inflight OpenMeld Service task on this device.\",\n },\n buildHints: () =>\n getDaemonControlTargetPatternContract(\"cancel\").buildHints?.({}) ?? [],\n entryName: \"service.cancel\",\n },\n \"service.interrupt\": {\n agentOverview: {\n humanActionRequired: false,\n notes: [\n \"`--dispatch` is the primary selector; `--task` is a debug-only backdoor.\",\n \"Interrupt validates only local daemon runtime availability; it does not require OpenMeld sign-in or a selected OpenMeld profile.\",\n ],\n pattern: getDaemonControlTargetPatternContract(\"interrupt\"),\n stages: [\n \"Resolve the local daemon control target.\",\n \"Send the interrupt request through the local daemon control-plane.\",\n \"Return the accepted or rejected control result.\",\n ],\n summary:\n \"Send an interrupt request to one inflight OpenMeld Service task on this device.\",\n },\n buildHints: () =>\n getDaemonControlTargetPatternContract(\"interrupt\").buildHints?.({}) ?? [],\n entryName: \"service.interrupt\",\n },\n reset: {\n agentOverview: {\n commands: [\"openmeld reset --yes --view agent\", \"openmeld start\"],\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [],\n optionalArguments: [\"--yes\"],\n requiredArguments: [],\n stages: [\n \"Confirm the destructive reset intent.\",\n \"Tear down the local OpenMeld service and remove lane data.\",\n \"Rebootstrap baseline OpenMeld files and bundled skills.\",\n ],\n summary:\n \"Destructively reset your local OpenMeld data, rebuild baseline files, and reinstall bundled OpenMeld skills.\",\n },\n entryName: \"reset\",\n },\n \"skills.install\": {\n agentOverview: {\n humanActionRequired: false,\n notes: (context: SkillsContractContext) => [\n \"Agent view requires explicit target selection for install.\",\n ...buildSkillsSharedNotes(context),\n ],\n pattern: getSkillsTargetSelectionPatternContract(\"install\"),\n stages: [\n \"Resolve explicit install targets.\",\n \"Install OpenMeld-managed skills into each target.\",\n \"Return install summary and tracked target state.\",\n ],\n summary:\n \"Install OpenMeld skills into known agent skills directories or a custom skills directory.\",\n },\n buildHints: (context: SkillsContractContext) =>\n getSkillsTargetSelectionPatternContract(\"install\").buildHints?.(\n context\n ) ?? [],\n entryName: \"skills.install\",\n guideScenarios: {\n required: {\n code: \"skills.install.arguments.required\",\n hints: (context: SkillsContractContext) =>\n getSkillsTargetSelectionPatternContract(\"install\").buildHints?.(\n context\n ) ?? [],\n humanSteps: [\"openmeld view human\", \"openmeld skills\"],\n notes: [\n \"Agent view does not open the interactive skills target picker.\",\n ],\n pattern: getSkillsTargetSelectionPatternContract(\"install\"),\n summary:\n \"openmeld skills install requires explicit target selection in agent/non-interactive mode.\",\n },\n },\n },\n \"skills.ensure\": {\n agentOverview: {\n humanActionRequired: false,\n notes: (context: SkillsContractContext) => [\n \"Agent view requires explicit target selection for ensure.\",\n \"Use ensure when you want one scoped command that installs or updates OpenMeld skills for the selected targets.\",\n ...buildSkillsSharedNotes(context),\n ],\n pattern: getSkillsTargetSelectionPatternContract(\"ensure\"),\n stages: [\n \"Resolve explicit ensure targets.\",\n \"Install or update OpenMeld-managed skills for each selected target.\",\n \"Return install and tracked target state.\",\n ],\n summary:\n \"Install or update OpenMeld skills for known agent skills directories or a custom skills directory.\",\n },\n buildHints: (context: SkillsContractContext) =>\n getSkillsTargetSelectionPatternContract(\"ensure\").buildHints?.(context) ??\n [],\n entryName: \"skills.ensure\",\n guideScenarios: {\n required: {\n code: \"skills.ensure.arguments.required\",\n hints: (context: SkillsContractContext) =>\n getSkillsTargetSelectionPatternContract(\"ensure\").buildHints?.(\n context\n ) ?? [],\n humanSteps: [\"openmeld view human\", \"openmeld skills\"],\n notes: [\n \"Agent view does not open the interactive skills target picker.\",\n ],\n pattern: getSkillsTargetSelectionPatternContract(\"ensure\"),\n summary:\n \"openmeld skills ensure requires explicit target selection in agent/non-interactive mode.\",\n },\n },\n },\n uninstall: {\n agentOverview: {\n commands: [\n \"openmeld uninstall --view agent --yes --keep-skills --keep-auth-tokens\",\n \"openmeld uninstall --view agent --yes --remove-skills --remove-auth-tokens\",\n ],\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [\n \"Uninstall removes the currently selected local OpenMeld installation by default.\",\n \"CLI self-removal is always a manual final step.\",\n ],\n optionalArguments: [\n \"--yes\",\n \"--keep-skills\",\n \"--remove-skills\",\n \"--keep-auth-tokens\",\n \"--remove-auth-tokens\",\n ],\n requiredArguments: [],\n stages: [\n \"Resolve uninstall scope and cleanup choices.\",\n \"Stop local OpenMeld service state and remove your local OpenMeld data.\",\n \"Return the final manual CLI removal command.\",\n ],\n summary:\n \"Remove your local OpenMeld data, optionally clear OpenMeld-managed skills and sign-in tokens, and return the final manual CLI removal step.\",\n },\n entryName: \"uninstall\",\n },\n upgrade: {\n agentOverview: {\n commands: [\n \"openmeld upgrade --check --view agent\",\n \"openmeld upgrade --yes --view agent\",\n \"openmeld reset --yes --view agent\",\n ],\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [\n \"Agent view requires explicit `--yes` before installing updates.\",\n \"When local version metadata is missing, reset your local OpenMeld data before retrying upgrade.\",\n ],\n optionalArguments: [\"--check\", \"--yes\"],\n requiredArguments: [],\n stages: [\n \"Read local version metadata and compare with npm latest.\",\n \"Confirm downgrade safety and explicit installation intent.\",\n \"Install the latest CLI version and update OpenMeld Service when needed.\",\n ],\n summary:\n \"Inspect OpenMeld CLI version state and, when explicitly approved, install the latest safe CLI version.\",\n },\n entryName: \"upgrade\",\n },\n whoami: {\n agentOverview: {\n commands: [\n \"openmeld whoami --view agent\",\n \"openmeld whoami --profile <profile-id> --view agent\",\n \"openmeld auth status --view agent\",\n ],\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [\n \"Whoami is read-only and does not change profile selection unless the process already has one resolved.\",\n ],\n optionalArguments: [\"--profile <id-or-name>\"],\n requiredArguments: [],\n stages: [\n \"Read auth session status.\",\n \"Resolve the explicit or current OpenMeld profile.\",\n \"Return auth, profile, and runtime context payloads.\",\n ],\n summary:\n \"Inspect the current OpenMeld auth session, selected OpenMeld profile, and agent runtime context in one structured response sequence.\",\n },\n entryName: \"whoami\",\n },\n \"skills.menu\": {\n buildHints: (context: SkillsContractContext) => [\n \"openmeld skills list\",\n \"openmeld skills check\",\n \"openmeld skills update\",\n ...(getSkillsTargetSelectionPatternContract(\"ensure\").buildHints?.(\n context\n ) ?? []),\n ...(getSkillsTargetSelectionPatternContract(\"install\").buildHints?.(\n context\n ) ?? []),\n ...(getSkillsTargetSelectionPatternContract(\"uninstall\").buildHints?.(\n context\n ) ?? []),\n ],\n entryName: \"skills.menu\",\n },\n \"skills.uninstall\": {\n agentOverview: {\n humanActionRequired: false,\n notes: (context: SkillsContractContext) => [\n \"Agent view requires explicit target selection for uninstall.\",\n ...buildSkillsSharedNotes(context),\n ],\n pattern: getSkillsTargetSelectionPatternContract(\"uninstall\"),\n stages: [\n \"Resolve explicit uninstall targets.\",\n \"Audit whether targets are inside this OpenMeld installation.\",\n \"Remove OpenMeld-managed skills and update tracked state.\",\n ],\n summary:\n \"Remove OpenMeld-managed skills from known or custom targets with explicit target selection.\",\n },\n buildHints: (context: SkillsContractContext) =>\n getSkillsTargetSelectionPatternContract(\"uninstall\").buildHints?.(\n context\n ) ?? [],\n entryName: \"skills.uninstall\",\n guideScenarios: {\n required: {\n code: \"skills.uninstall.arguments.required\",\n hints: (context: SkillsContractContext) =>\n getSkillsTargetSelectionPatternContract(\"uninstall\").buildHints?.(\n context\n ) ?? [],\n humanSteps: [\"openmeld view human\", \"openmeld skills\"],\n notes: [\n \"Agent view does not open the interactive skills target picker.\",\n ],\n pattern: getSkillsTargetSelectionPatternContract(\"uninstall\"),\n summary:\n \"openmeld skills uninstall requires explicit target selection in agent/non-interactive mode.\",\n },\n },\n },\n \"space.add-agents\": buildSpaceAddProfilesContract({\n command: \"add-agents\",\n entryName: \"space.add-agents\",\n humanChoiceText:\n \"Choose one space, then select one or more Agent Profiles.\",\n requiredSummary:\n \"openmeld space add-agents in agent/non-interactive mode requires explicit space and Agent Profile arguments.\",\n summary:\n \"Use `openmeld space add-agents --profile <profile-id> <space-id> --agent-profile <agent-profile-id...> --view agent` with explicit acting profile, Space ID, and Agent Profile selection.\",\n }),\n \"space.add-me\": {\n agentOverview: {\n commands: ({ includeViewFlag = false }) => [\n `openmeld space add-me <space-url-or-id> --project-folder <path>${includeViewFlag ? \" --view agent\" : \"\"}`,\n ],\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [\n \"`--profile <human-profile-id>` selects the Human Profile used as the signed-in user's acting identity; it is not the Agent Profile being added.\",\n \"`--project-folder` is the preferred option name.\",\n \"`--workspace-path`, `--working-directory`, and `--cwd` are accepted aliases for `--project-folder`.\",\n \"Space membership does not prove Wake readiness.\",\n 'Typical use case: the user sends a Space URL and says, \"add yourself to this Space using the current project folder.\"',\n ],\n optionalArguments: [\n \"--profile <human-profile-id>\",\n \"--project-folder <path>\",\n \"--workspace-path <path>\",\n \"--working-directory <path>\",\n \"--cwd <path>\",\n \"--agent-controller-permission-mode <permission-mode>\",\n \"--details\",\n \"--json\",\n ],\n requiredArguments: [\"<space-url-or-id>\"],\n stages: [\n \"Parse the Space URL or Space ID and optional profileId.\",\n \"Detect the current agent controller, or use the Human Profile path when no supported agent controller is present.\",\n \"For agents, create or reuse the current Agent Profile Binding and set the Project folder.\",\n \"Add the Human Profile or Agent Profile to the Space through the normal membership write path.\",\n ],\n summary:\n \"Add the current Human Profile or current local agent to a Space with one command.\",\n },\n buildHints: () => [\n \"openmeld space add-me <space-url-or-id> --project-folder <path> --view agent\",\n \"Aliases accepted for Project folder: --workspace-path, --working-directory, --cwd.\",\n \"Space membership does not prove Wake readiness.\",\n ],\n entryName: \"space.add-me\",\n guideScenarios: {\n required: {\n code: \"space.add_me.arguments.required\",\n commands: ({ includeViewFlag = false }) => [\n `openmeld space add-me <space-url-or-id> --project-folder <path>${includeViewFlag ? \" --view agent\" : \"\"}`,\n ],\n hints: () => [\n \"Use --project-folder for the current project directory. The aliases --workspace-path, --working-directory, and --cwd are accepted.\",\n \"Space membership does not prove Wake readiness.\",\n ],\n humanSteps: [\n \"openmeld view human\",\n \"openmeld space add-me <space-url-or-id>\",\n ],\n notes: [\n 'Typical use case: the user sends a Space URL and says, \"add yourself to this Space using the current project folder.\"',\n \"The command accepts a full Space URL such as /o/<org-slug>/spaces/<space-id>?profileId=<human-profile-id>.\",\n ],\n optionalArguments: [\n \"--profile <human-profile-id>\",\n \"--project-folder <path>\",\n \"--workspace-path <path>\",\n \"--working-directory <path>\",\n \"--cwd <path>\",\n \"--agent-controller-permission-mode <permission-mode>\",\n \"--details\",\n \"--json\",\n ],\n requiredArguments: [\"<space-url-or-id>\"],\n summary:\n \"openmeld space add-me requires a Space URL or Space ID. Agents should use `openmeld space add-me <space-url-or-id> --project-folder <path> --view agent`.\",\n },\n },\n },\n \"space.add-human-profiles\": buildSpaceAddProfilesContract({\n command: \"add-human-profiles\",\n entryName: \"space.add-human-profiles\",\n humanChoiceText:\n \"Choose one space, then select one or more Human Profiles.\",\n requiredSummary:\n \"openmeld space add-human-profiles in agent/non-interactive mode requires explicit space and Human Profile arguments.\",\n summary:\n \"Use `openmeld space add-human-profiles --profile <profile-id> <space-id> --human-profile <human-profile-id...> --view agent` with explicit acting profile, Space ID, and Human Profile selection.\",\n }),\n \"space.add-members\": buildSpaceAddProfilesContract({\n command: \"add-members\",\n entryName: \"space.add-members\",\n humanChoiceText: \"Choose one space, then select one or more profiles.\",\n requiredSummary:\n \"openmeld space add-members in agent/non-interactive mode requires explicit space and member arguments.\",\n summary:\n \"Use `openmeld space add-members --profile <profile-id> <space-id> --member <profile-id...> --view agent` with explicit acting profile, Space ID, and member selection.\",\n }),\n \"space.remove-members\": {\n agentOverview: {\n humanActionRequired: {\n possible: false,\n steps: [],\n },\n notes: [\n \"remove-members only manages existing members of the current space.\",\n \"the current profile and the space creator are never removable through this command.\",\n ],\n pattern: getSpaceMemberSelectionPatternContract(\"remove-members\"),\n stages: [\n \"check_arguments\",\n \"authenticate\",\n \"check_profile\",\n \"resolve_target\",\n \"remove_members\",\n ],\n summary:\n \"Use `openmeld space remove-members --profile <profile-id> <space-id> --member <profile-id...> --view agent` with explicit acting profile, Space ID, and member selection.\",\n },\n buildHints: (context) =>\n getSpaceMemberSelectionPatternContract(\"remove-members\").buildHints?.({\n ...context,\n includeViewFlag: true,\n profileId: context.profileId ?? \"<profile-id>\",\n }) ?? [],\n entryName: \"space.remove-members\",\n guideScenarios: {\n required: {\n code: \"space.remove_members.arguments.required\",\n humanSteps: [\n \"openmeld view human\",\n \"openmeld space remove-members\",\n \"Choose one space, then select one or more members to remove.\",\n ],\n notes: [\n \"remove-members only manages existing members of the current space.\",\n \"the current profile and the space creator are never removable through this command.\",\n ],\n pattern: getSpaceMemberSelectionPatternContract(\"remove-members\"),\n summary: (context: { summary?: string }) =>\n context.summary ??\n \"openmeld space remove-members in agent/non-interactive mode requires explicit space and member arguments.\",\n },\n },\n },\n};\n\nexport function getCommandEntryContract(\n entryName: CommandEntryName\n): CommandEntryContract<CommandContractRegistryContext> | null {\n return COMMAND_ENTRY_CONTRACTS[entryName] ?? null;\n}\n\nexport function getCommandHintsFromContract<\n TContext extends CommandContractRenderContext,\n>(input: { context: TContext; entryName: CommandEntryName }): string[] | null {\n const contract = getCommandEntryContract(input.entryName);\n if (!contract?.buildHints) {\n return null;\n }\n return contract.buildHints(input.context);\n}\n\nfunction buildSkillsSharedNotes(context: SkillsContractContext): string[] {\n const notes: string[] = [];\n if (context.storeDir) {\n notes.push(`OpenMeld skills store: ${context.storeDir}`);\n }\n if (context.knownAgentIds) {\n notes.push(\n `known agent ids: ${\n context.knownAgentIds.length > 0\n ? context.knownAgentIds.join(\", \")\n : \"none detected\"\n }`\n );\n }\n if (context.skills) {\n notes.push(\n `local OpenMeld skills: ${\n context.skills.length > 0\n ? context.skills\n .map((skill) => `${skill.name} (${skill.relativePath})`)\n .join(\", \")\n : \"none\"\n }`\n );\n }\n return notes;\n}\n","import { buildAgentFacingPublicationModeGuideLines } from \"@openmeld/space-mesh\";\nimport { createGuideErrorFromContract } from \"../command-contracts/helpers\";\nimport {\n getCommandEntryContract,\n getCommandHintsFromContract,\n} from \"../command-contracts/registry\";\nimport { DualViewGuideError } from \"./dual-view-guide-error\";\n\ntype SpaceTargetCommand =\n | \"access\"\n | \"join\"\n | \"watch\"\n | \"contract\"\n | \"status\"\n | \"guide\"\n | \"delete\";\ntype SpaceSubcommandTarget = \"send\" | \"history\" | \"thread\" | \"password\";\ntype ProfileAction = \"set\" | \"delete\" | \"show\" | \"update\";\ntype SpaceAliasCommand = \"send\" | \"tail\";\ntype UpgradeConfirmationScenario = \"outdated\" | \"check_failed\";\nconst SPACE_GATEWAY_PARENT_OPTION_TEXT =\n \"parent option: openmeld space --gateway-url <url>\";\nconst SPACE_CONTRACT_SET_USAGE =\n \"openmeld space [--gateway-url <url>] contract set [--profile <profile-id>] <space-id> [--dispatch-policy <mention_only|listen_all>] [--publication-mode <collaboration|transparent>] [--allowed-actions <post_message,post_status,stay_silent>] [--result-archive-mode <none|space_reply_only|all_final_results>] [--entry-brief <default|none>] [--dispatch-brief <default|none>] [--json] [--password <value>]\";\nconst SPACE_PUBLICATION_SET_USAGE =\n \"openmeld space [--gateway-url <url>] publication set [--profile <profile-id>] <space-id> <collaboration|transparent> --password <space-password> [--json]\";\nconst SPACE_HISTORY_USAGE =\n \"openmeld space [--gateway-url <url>] history [--profile <profile-id>] <space-id> [--limit <n>] [--after-signal <signal-id>] [--around-signal <signal-id> --before <n> --after <n>] [--from-profile <profile-id>] [--kind <text|status|system_notice>] [--json] [--password <value>]\";\nexport type ProfileActionGuideExamples = {\n controllerRefExample?: string;\n transportModeExample?: string;\n};\n\nexport function createStartAgentIdentityGuideError(summary?: string) {\n return new DualViewGuideError({\n code: \"start.agent.identity.required\",\n guide: {\n summary:\n summary ??\n \"openmeld start in agent view requires explicit agent profile selection or creation arguments.\",\n humanSteps: [\"openmeld view human\", \"openmeld start\"],\n agentRequiredArgs: [\n \"--profile-id <existing-agent-profile-id> or --profile <existing-agent-profile-id|name>\",\n \"or --kind agent --profile-name <name> (create; profile ID issued by OpenMeld)\",\n ],\n agentOptionalArgs: [\"--gateway-url <url>\"],\n agentCommands: [\n \"openmeld start --view agent --profile-id <existing-agent-profile-id>\",\n \"openmeld start --view agent --profile <existing-agent-profile-id-or-name>\",\n \"openmeld start --view agent --kind agent --profile-name <new-agent-profile-name>\",\n \"openmeld setup --view agent\",\n \"openmeld profiles create <new-agent-profile-name> --kind agent --view agent\",\n \"openmeld profiles list --view agent\",\n \"openmeld space create --profile <agent-profile-id> --name <space-name> --view agent\",\n \"openmeld space join --profile <agent-profile-id> <space-id> --view agent\",\n ],\n notes: [\n \"openmeld start in agent view selects or creates an Agent Profile and returns Space commands. Run `openmeld setup --view agent` when this computer needs local service or agent setup.\",\n \"creating profiles never accepts custom profile IDs; IDs are issued by OpenMeld auth.\",\n \"if a human is operating this terminal, switch to human view first.\",\n ],\n },\n hints: [\n \"openmeld view human\",\n \"openmeld start --view agent --profile-id <existing-agent-profile-id>\",\n \"openmeld start --view agent --kind agent --profile-name <new-agent-profile-name>\",\n \"openmeld setup --view agent\",\n \"openmeld space create --profile <agent-profile-id> --name <space-name> --view agent\",\n ],\n });\n}\n\nexport function createSpaceMenuGuideError() {\n return new DualViewGuideError({\n code: \"space.menu.interactive.required\",\n guide: {\n summary: \"openmeld space menu is interactive in human view only.\",\n humanSteps: [\"openmeld view human\", \"openmeld space\"],\n agentCommands: [\n \"openmeld space [--gateway-url <url>] list [--profile <profile-id>] [--limit <n>] [--json]\",\n \"openmeld space [--gateway-url <url>] create [--profile <profile-id>] --name <name> --visibility <public|private> [--guide <text>] [--password <value>] [--join|--no-join] [--output text|ndjson]\",\n \"openmeld space [--gateway-url <url>] join [--profile <profile-id>] <space-id> [--password <value>] [--local-echo|--no-local-echo] [--history-limit <n>] [--role <text>] [--mention-alias <token>] [--output text|ndjson]\",\n \"openmeld space [--gateway-url <url>] watch [--profile <profile-id>] <space-id> [--password <value>] [--history-limit <n>] [--output text|ndjson]\",\n \"openmeld space [--gateway-url <url>] link <space-id> [--signal <signal-id>] [--thread-root-signal <signal-id>] --view agent\",\n \"openmeld space [--gateway-url <url>] access [--profile <profile-id>] <space-url-or-id> [--json] [--password <value>]\",\n \"openmeld space [--gateway-url <url>] send [--profile <profile-id>] <space-id> [<text...>|--stdin|--text-file <path>] [--file <path>...] [--plain] [--password <value>]\",\n SPACE_HISTORY_USAGE,\n \"openmeld space [--gateway-url <url>] contract [--profile <profile-id>] <space-id> [--json] [--password <value>]\",\n SPACE_CONTRACT_SET_USAGE,\n SPACE_PUBLICATION_SET_USAGE,\n \"openmeld space [--gateway-url <url>] status [--profile <profile-id>] <space-id> [--json] [--password <value>]\",\n \"openmeld space [--gateway-url <url>] updates [--profile <profile-id>] <space-id> --after-signal <signal-id> [--limit <n>] [--json] [--password <value>]\",\n \"openmeld space [--gateway-url <url>] result [--profile <profile-id>] <space-id> (--dispatch <dispatch-id>|--result-ref <result-ref>) [--json] [--password <value>]\",\n \"openmeld space [--gateway-url <url>] guide [--profile <profile-id>] <space-id> [--json] [--password <value>]\",\n \"openmeld space [--gateway-url <url>] guide set [--profile <profile-id>] <space-id> <text...> [--json] [--password <value>]\",\n \"openmeld space [--gateway-url <url>] guide clear [--profile <profile-id>] <space-id> [--json] [--password <value>]\",\n \"openmeld space [--gateway-url <url>] add-agents [--profile <profile-id>] <space-id> (--agent-profile <agent-profile-id...>|--all) [--password <value>]\",\n \"openmeld space [--gateway-url <url>] add-human-profiles [--profile <profile-id>] <space-id> (--human-profile <human-profile-id...>|--all) [--password <value>]\",\n \"openmeld space [--gateway-url <url>] add-members [--profile <profile-id>] <space-id> (--member <profile-id...>|--all) [--password <value>]\",\n \"openmeld space [--gateway-url <url>] remove-members [--profile <profile-id>] <space-id> (--member <profile-id...>|--all) [--password <value>]\",\n \"openmeld space [--gateway-url <url>] leave [--profile <profile-id>] <space-id> [--password <value>]\",\n \"openmeld space [--gateway-url <url>] delete [--profile <profile-id>] <space-id> [--password <value>]\",\n \"openmeld space [--gateway-url <url>] password [--profile <profile-id>] <space-id> (--password <value>|--clear)\",\n ],\n notes: [\n \"Use explicit subcommands in agent view; do not rely on menu.\",\n \"Gateway overrides stay on the parent command: `openmeld space --gateway-url <url> <subcommand> ...`.\",\n ],\n },\n hints: [\n \"openmeld space list --profile <profile-id>\",\n \"openmeld space create --profile <profile-id> --name spaceship\",\n \"openmeld space join --profile <profile-id> <space-id>\",\n \"openmeld space watch --profile <profile-id> <space-id>\",\n ],\n });\n}\n\nexport function createSpaceContractSetGuideError(summary?: string) {\n return new DualViewGuideError({\n code: \"space.contract.set.arguments.required\",\n guide: {\n summary:\n summary ??\n \"openmeld space contract set needs an explicit space ID and at least one patch field in agent view.\",\n humanSteps: [\n \"openmeld view human\",\n \"openmeld space contract set <space-id>\",\n \"Follow the guided contract editor.\",\n ],\n agentRequiredArgs: [\"<space-id>\", \"at least one patch field\"],\n agentOptionalArgs: [\n \"--dispatch-policy <mention_only|listen_all>\",\n \"--publication-mode <collaboration|transparent>\",\n \"--allowed-actions <post_message,post_status,stay_silent>\",\n \"--result-archive-mode <none|space_reply_only|all_final_results>\",\n \"--entry-brief <default|none>\",\n \"--dispatch-brief <default|none>\",\n \"--json\",\n \"--password <value>\",\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n agentCommands: [SPACE_CONTRACT_SET_USAGE],\n notes: [\n \"agent view must send explicit patch fields; it does not open the interactive editor.\",\n \"patch writes only the fields you provide.\",\n ],\n },\n });\n}\n\nexport function createSpacePublicationSetGuideError(summary?: string) {\n return new DualViewGuideError({\n code: \"space.publication.set.arguments.required\",\n guide: {\n summary:\n summary ??\n \"openmeld space publication set needs an explicit space ID, mode, and Space password.\",\n humanSteps: [\n \"openmeld view human\",\n \"openmeld space publication set <space-id> <collaboration|transparent> --password <space-password>\",\n ],\n agentRequiredArgs: [\n \"<space-id>\",\n \"<collaboration|transparent>\",\n \"--password <space-password>\",\n ],\n agentOptionalArgs: [\n \"--json\",\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <owner-profile-id>\",\n ],\n agentCommands: [SPACE_PUBLICATION_SET_USAGE],\n notes: buildAgentFacingPublicationModeGuideLines(),\n },\n });\n}\n\nexport function createSpaceCreateGuideError(summary?: string) {\n return new DualViewGuideError({\n code: \"space.create.arguments.required\",\n guide: {\n summary:\n summary ??\n \"openmeld space create requires explicit --name and --visibility public|private in agent/non-interactive mode.\",\n humanSteps: [\n \"openmeld view human\",\n \"openmeld space\",\n 'Select \"Create a space\".',\n ],\n agentRequiredArgs: [\"--name <name>\", \"--visibility <public|private>\"],\n agentOptionalArgs: [\n \"--guide <text>\",\n \"--password <value>\",\n \"--join|--no-join\",\n \"--output <text|ndjson>\",\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n agentCommands: [\n \"openmeld space [--gateway-url <url>] create [--profile <profile-id>] --name <name> --visibility <public|private> [--guide <text>] [--password <value>] [--join|--no-join] [--output text|ndjson]\",\n \"openmeld space [--gateway-url <url>] list [--profile <profile-id>] [--limit <n>] [--json]\",\n \"openmeld space [--gateway-url <url>] join [--profile <profile-id>] <space-id> [--password <value>] [--local-echo|--no-local-echo] [--history-limit <n>] [--role <text>] [--mention-alias <token>] [--output text|ndjson]\",\n ],\n notes: [\n \"Agent view does not prompt for missing space names or organization visibility.\",\n \"Use explicit arguments so create can stay deterministic.\",\n ],\n },\n hints: [\n \"openmeld space create --profile <profile-id> --name <space-name> --visibility private --view agent\",\n \"openmeld space list --profile <profile-id> --view agent\",\n ],\n });\n}\n\nexport function createSpaceAddMembersGuideError(\n summary?: string,\n entryName:\n | \"space.add-agents\"\n | \"space.add-human-profiles\"\n | \"space.add-members\" = \"space.add-members\"\n) {\n return createGuideErrorFromContract({\n context: {\n includeViewFlag: true,\n profileId: \"<profile-id>\",\n summary: summary ?? getSpaceAddProfilesDefaultRequiredSummary(entryName),\n },\n guideScenario: getRequiredCommandGuideScenario(entryName),\n });\n}\n\nfunction getSpaceAddProfilesDefaultRequiredSummary(\n entryName:\n | \"space.add-agents\"\n | \"space.add-human-profiles\"\n | \"space.add-members\"\n): string {\n switch (entryName) {\n case \"space.add-agents\":\n return \"openmeld space add-agents in agent/non-interactive mode requires explicit space and Agent Profile arguments.\";\n case \"space.add-human-profiles\":\n return \"openmeld space add-human-profiles in agent/non-interactive mode requires explicit space and Human Profile arguments.\";\n case \"space.add-members\":\n return \"openmeld space add-members in agent/non-interactive mode requires explicit space and member arguments.\";\n default:\n assertNever(entryName);\n }\n}\n\nfunction assertNever(value: never): never {\n throw new Error(`unexpected value: ${String(value)}`);\n}\n\nexport function createSpaceRemoveMembersGuideError(summary?: string) {\n return createGuideErrorFromContract({\n context: {\n includeViewFlag: true,\n profileId: \"<profile-id>\",\n summary:\n summary ??\n \"openmeld space remove-members in agent/non-interactive mode requires explicit space and member arguments.\",\n },\n guideScenario: getRequiredCommandGuideScenario(\"space.remove-members\"),\n });\n}\n\nexport function createSpaceLeaveGuideError(summary?: string) {\n return new DualViewGuideError({\n code: \"space.leave.arguments.required\",\n guide: {\n summary:\n summary ??\n \"openmeld space leave in agent/non-interactive mode requires explicit space argument.\",\n humanSteps: [\n \"openmeld view human\",\n \"openmeld space leave\",\n \"Choose one space, then confirm leaving it.\",\n ],\n agentRequiredArgs: [\"<space-id>\"],\n agentOptionalArgs: [\n \"--profile <profile-id>\",\n \"--password <value>\",\n \"--view <agent|human|auto>\",\n ],\n agentCommands: [\n \"openmeld space leave <space-id> --profile <profile-id> --view agent\",\n \"openmeld space list --profile <profile-id> --view agent\",\n ],\n notes: [\n \"leave only removes the current profile from the space.\",\n \"the space creator cannot leave; delete the space instead when only the creator remains.\",\n ],\n },\n hints: [\n \"openmeld space leave <space-id> --profile <profile-id> --view agent\",\n ],\n });\n}\n\nexport function createSpaceTargetGuideError(command: SpaceTargetCommand) {\n const optionalArgsByCommand: Record<SpaceTargetCommand, string[]> = {\n access: [\n \"--json\",\n \"--password <value>\",\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n join: [\n \"--password <value>\",\n \"--local-echo|--no-local-echo\",\n \"--history-limit <n>\",\n \"--role <text>\",\n \"--mention-alias <token>\",\n \"--output <text|ndjson>\",\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n watch: [\n \"--password <value>\",\n \"--history-limit <n>\",\n \"--output <text|ndjson>\",\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n contract: [\n \"--json\",\n \"--password <value>\",\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n status: [\n \"--json\",\n \"--password <value>\",\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n guide: [\n \"--json\",\n \"--password <value>\",\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n delete: [\n \"--password <value>\",\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n };\n\n const commandSignaturesByCommand: Record<SpaceTargetCommand, string[]> = {\n access: [\n \"openmeld space [--gateway-url <url>] access [--profile <profile-id>] <space-url-or-id> [--json] [--password <value>]\",\n ],\n join: [\n \"openmeld space [--gateway-url <url>] join [--profile <profile-id>] <space-id> [--password <value>] [--local-echo|--no-local-echo] [--history-limit <n>] [--role <text>] [--mention-alias <token>] [--output text|ndjson]\",\n ],\n watch: [\n \"openmeld space [--gateway-url <url>] watch [--profile <profile-id>] <space-id> [--password <value>] [--history-limit <n>] [--output text|ndjson]\",\n ],\n contract: [\n \"openmeld space [--gateway-url <url>] contract [--profile <profile-id>] <space-id> [--json] [--password <value>]\",\n ],\n status: [\n \"openmeld space [--gateway-url <url>] status [--profile <profile-id>] <space-id> [--json] [--password <value>]\",\n ],\n guide: [\n \"openmeld space [--gateway-url <url>] guide [--profile <profile-id>] <space-id> [--json] [--password <value>]\",\n \"openmeld space [--gateway-url <url>] guide set [--profile <profile-id>] <space-id> <text...> [--json] [--password <value>]\",\n \"openmeld space [--gateway-url <url>] guide clear [--profile <profile-id>] <space-id> [--json] [--password <value>]\",\n ],\n delete: [\n \"openmeld space [--gateway-url <url>] delete [--profile <profile-id>] <space-id> [--password <value>]\",\n ],\n };\n\n return new DualViewGuideError({\n code: `space.${command}.target.required`,\n guide: {\n summary: `openmeld space ${command} requires explicit space target in agent view.`,\n humanSteps: [\"openmeld view human\", \"openmeld space\"],\n agentRequiredArgs: [\n `<space-id> (required positional argument for openmeld space ${command})`,\n ],\n agentOptionalArgs: optionalArgsByCommand[command],\n agentCommands: commandSignaturesByCommand[command],\n },\n });\n}\n\nexport function createSpaceUpdatesGuideError(summary?: string) {\n return new DualViewGuideError({\n code: \"space.updates.arguments.required\",\n guide: {\n summary:\n summary ??\n \"openmeld space updates needs an explicit space ID and --after-signal anchor in agent view.\",\n humanSteps: [\"openmeld view human\", \"openmeld space\"],\n agentRequiredArgs: [\"<space-id>\", \"--after-signal <signal-id>\"],\n agentOptionalArgs: [\n \"--limit <n>\",\n \"--json\",\n \"--password <value>\",\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n agentCommands: [\n \"openmeld space [--gateway-url <url>] updates [--profile <profile-id>] <space-id> --after-signal <signal-id> [--limit <n>] [--json] [--password <value>]\",\n ],\n notes: [\n \"updates reads only formal post-anchor public signals.\",\n \"use --json for machine consumption in agent view.\",\n ],\n },\n });\n}\n\nexport function createSpaceResultGuideError(summary?: string) {\n return new DualViewGuideError({\n code: \"space.result.arguments.required\",\n guide: {\n summary:\n summary ??\n \"openmeld space result needs an explicit space ID and exactly one selector in agent view.\",\n humanSteps: [\"openmeld view human\", \"openmeld space\"],\n agentRequiredArgs: [\n \"<space-id>\",\n \"one selector: --dispatch <dispatch-id> | --result-ref <result-ref>\",\n ],\n agentOptionalArgs: [\n \"--json\",\n \"--password <value>\",\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n agentCommands: [\n \"openmeld space [--gateway-url <url>] result [--profile <profile-id>] <space-id> --dispatch <dispatch-id> [--json] [--password <value>]\",\n \"openmeld space [--gateway-url <url>] result [--profile <profile-id>] <space-id> --result-ref <result-ref> [--json] [--password <value>]\",\n ],\n notes: [\n \"exactly one selector is required.\",\n \"lookups stay scoped to the current space.\",\n ],\n },\n });\n}\n\nexport function createSpaceDeleteHumanApprovalGuideError(summary?: string) {\n return new DualViewGuideError({\n code: \"space.delete.human_approval_required\",\n guide: {\n summary:\n summary ??\n \"space delete requires owner human confirmation in an interactive terminal.\",\n humanSteps: [\n \"Use a human TTY session with the owner account.\",\n \"Run: openmeld view human\",\n \"Run: openmeld space delete <space-id>\",\n \"Confirm deletion when prompted.\",\n ],\n agentRequiredArgs: [\n \"You cannot delete directly in agent mode/non-interactive sessions.\",\n ],\n agentOptionalArgs: [\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n agentCommands: [\n \"openmeld view human\",\n \"openmeld space [--gateway-url <url>] delete [--profile <profile-id>] <space-id>\",\n ],\n notes: [\n \"For agent-created spaces, the owner's human session must approve deletion.\",\n \"Future enhancement may support web/email approval flow.\",\n ],\n },\n hints: [\"openmeld view human\", \"openmeld space delete <space-id>\"],\n });\n}\n\nexport function createSpaceSubcommandTargetGuideError(\n command: SpaceSubcommandTarget\n) {\n const requiredArgsByCommand: Record<SpaceSubcommandTarget, string[]> = {\n send: [\"<space-id>\", \"message text and/or --file <path>\"],\n history: [\"<space-id>\"],\n thread: [\"<space-id>\", \"<thread-id>\"],\n password: [\"<space-id>\", \"one action: --password <value> | --clear\"],\n };\n const optionalArgsByCommand: Record<SpaceSubcommandTarget, string[]> = {\n send: [\n \"--file <path> (repeatable, max 10)\",\n \"--text-file <path>\",\n \"--password <value>\",\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n history: [\n \"--limit <n>\",\n \"--after-signal <signal-id>\",\n \"--around-signal <signal-id>\",\n \"--before <n>\",\n \"--after <n>\",\n \"--from-profile <profile-id>\",\n \"--kind <text|status|system_notice>\",\n \"--json\",\n \"--password <value>\",\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n thread: [\n \"--password <value>\",\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n password: [SPACE_GATEWAY_PARENT_OPTION_TEXT, \"--profile <profile-id>\"],\n };\n const commandByCommand: Record<SpaceSubcommandTarget, string> = {\n send: \"openmeld space [--gateway-url <url>] send [--profile <profile-id>] <space-id> [<text...>|--stdin|--text-file <path>] [--file <path>...] [--plain] [--password <value>]\",\n history: SPACE_HISTORY_USAGE,\n thread:\n \"openmeld space [--gateway-url <url>] thread [--profile <profile-id>] <space-id> <thread-id> [--password <value>]\",\n password:\n \"openmeld space [--gateway-url <url>] password [--profile <profile-id>] <space-id> (--password <value>|--clear)\",\n };\n const summaryByCommand: Record<SpaceSubcommandTarget, string> = {\n send: \"openmeld space send requires explicit positional arguments in agent view.\",\n history:\n \"openmeld space history requires explicit positional arguments in agent view.\",\n thread:\n \"openmeld space thread requires a space ID and a thread ID in agent view.\",\n password:\n \"openmeld space password needs a space ID and one action (--password or --clear) in agent view.\",\n };\n const humanStepsByCommand: Record<SpaceSubcommandTarget, string[]> = {\n send: [\"openmeld view human\", \"openmeld space\"],\n history: [\"openmeld view human\", \"openmeld space\"],\n thread: [\"openmeld view human\", \"openmeld space\"],\n password: [\n \"openmeld view human\",\n \"openmeld space\",\n 'Select \"Configure a space\" -> \"Password\" and pick the target space by name',\n ],\n };\n\n return new DualViewGuideError({\n code: `space.${command}.arguments.required`,\n guide: {\n summary: summaryByCommand[command],\n humanSteps: humanStepsByCommand[command],\n agentRequiredArgs: requiredArgsByCommand[command],\n agentOptionalArgs: optionalArgsByCommand[command],\n agentCommands: [\n \"openmeld space [--gateway-url <url>] list [--profile <profile-id>] [--limit <n>] [--json]\",\n commandByCommand[command],\n \"openmeld space [--gateway-url <url>] join [--profile <profile-id>] <space-id> [--history-limit <n>] [--output text|ndjson]\",\n ],\n },\n });\n}\n\nexport function createSpaceProfileRequiredGuideError() {\n return new DualViewGuideError({\n code: \"space.profile.required\",\n guide: {\n summary:\n \"No selected OpenMeld profile is available for this command in the current OpenMeld CLI context.\",\n humanSteps: [\n \"If this is an interactive human terminal: run `openmeld whoami`, confirm the current profile, then retry.\",\n \"If no usable profile exists yet, create one first.\",\n ],\n agentRequiredArgs: [\n \"--profile <profile-id> when no selected profile exists\",\n ],\n agentOptionalArgs: [\"--view <auto|human|agent>\"],\n agentCommands: [\n \"openmeld profiles list --view agent\",\n \"openmeld profiles create <profile-name> --kind agent --view agent\",\n \"openmeld profiles set <profile-id> --view agent\",\n \"openmeld whoami --profile <profile-id> --view agent\",\n \"openmeld space create --profile <profile-id> --name <space-name> --view agent\",\n \"openmeld space join --profile <profile-id> <space-id> --view agent\",\n ],\n notes: [\n \"This error is about the selected OpenMeld profile state, not the sign-in state.\",\n \"In non-TTY/isolated sessions, always pass --profile explicitly.\",\n ],\n },\n hints: [\n \"openmeld profiles create <profile-name> --kind agent --view agent\",\n \"openmeld profiles set <profile-id> --view agent\",\n \"openmeld space create --profile <profile-id> --name <space-name> --view agent\",\n ],\n });\n}\n\nexport function createSpaceAgentProfileOnlyGuideError(input: {\n profileId: string;\n profileKind: string;\n}) {\n return new DualViewGuideError({\n code: \"space.profile.agent_only\",\n guide: {\n summary: `this Space operation requires an Agent Profile (received ${input.profileKind}:${input.profileId}).`,\n humanSteps: [\n \"Use a Human Profile when acting for the user.\",\n \"Use an Agent Profile only when the operation needs an AI teammate identity.\",\n ],\n agentRequiredArgs: [\"--profile <agent-profile-id>\"],\n agentOptionalArgs: [\"--view <agent|human|auto>\"],\n agentCommands: [\n \"openmeld profiles list --view agent\",\n \"openmeld profiles set <agent-profile-id> --view agent\",\n \"openmeld space join <space-id> --profile <agent-profile-id> --view agent\",\n \"openmeld space send <space-id> [<text...>|--stdin|--text-file <path>] [--file <path>...] --profile <agent-profile-id> --view agent\",\n ],\n notes: [\n \"First run `openmeld profiles list --view agent` to find an agent profile ID.\",\n \"Then rerun the space command with `--profile <agent-profile-id>`.\",\n \"`--view agent` controls output format. The command-specific operation decides whether a Human Profile or Agent Profile is valid.\",\n ],\n },\n hints: [\n \"openmeld profiles list --view agent\",\n \"openmeld profiles set <agent-profile-id> --view agent\",\n \"openmeld view human\",\n ],\n });\n}\n\nexport function createSpaceUnsupportedProfileKindGuideError(input: {\n profileId: string;\n profileKind: string;\n}) {\n return new DualViewGuideError({\n code: \"space.profile.unsupported_kind\",\n guide: {\n summary: `Space commands require a human or agent profile (received ${input.profileKind}:${input.profileId}).`,\n humanSteps: [\n \"Choose a human profile when you are acting for the user.\",\n \"Choose an agent profile when that agent identity should speak, be added, or be woken in the Space.\",\n ],\n agentRequiredArgs: [\"--profile <human-or-agent-profile-id>\"],\n agentOptionalArgs: [\"--view <agent|human|auto>\"],\n agentCommands: [\n \"openmeld profiles list --view agent\",\n \"openmeld space list --profile <profile-id> --view agent\",\n \"openmeld space history <space-id> --profile <profile-id> --kind text --limit 20 --view agent\",\n ],\n notes: [\n \"`--view agent` controls machine-readable output. It does not require the acting identity to be an Agent Profile.\",\n \"System profiles are internal and cannot be used as the acting identity for Space commands.\",\n ],\n },\n hints: [\n \"openmeld profiles list --view agent\",\n \"openmeld space list --profile <profile-id> --view agent\",\n ],\n });\n}\n\nexport function createSpaceAddMembersCurrentProfileGuideError(input: {\n profileId: string;\n}) {\n return new DualViewGuideError({\n code: \"space.add_members.current_profile_join_required\",\n guide: {\n summary:\n \"Current profile joins a space with `openmeld space join`, not `add-members`.\",\n humanSteps: [\n \"Stay on the current profile and join the Space directly.\",\n \"Use add-members only for other profiles you want to bring with you.\",\n ],\n agentRequiredArgs: [\"<space-id>\", `--profile ${input.profileId}`],\n agentOptionalArgs: [\"--view <agent|human|auto>\"],\n agentCommands: [\n `openmeld space join <space-id> --profile ${input.profileId} --view agent`,\n `openmeld space send <space-id> \"hello\" --profile ${input.profileId} --view agent`,\n ],\n notes: [\n \"add-members is only for additional profiles, not the profile that is currently acting.\",\n ],\n },\n hints: [\n `openmeld space join <space-id> --profile ${input.profileId} --view agent`,\n ],\n });\n}\n\nexport function createSpaceRemoveMembersCurrentProfileGuideError(input: {\n profileId: string;\n}) {\n return new DualViewGuideError({\n code: \"space.remove_members.current_profile_forbidden\",\n guide: {\n summary:\n \"Current profile cannot remove itself from a space with `remove-members`. Use `openmeld space leave` instead.\",\n humanSteps: [\n \"Use `openmeld space leave` when the current profile should exit the space.\",\n \"Use `remove-members` only for other members.\",\n \"If you need a different cleanup action, switch to another owned profile first.\",\n ],\n agentRequiredArgs: [\"<space-id>\", `--profile ${input.profileId}`],\n agentOptionalArgs: [\"--view <agent|human|auto>\"],\n agentCommands: [\n `openmeld space leave <space-id> --profile ${input.profileId} --view agent`,\n `openmeld space history <space-id> --profile ${input.profileId} --kind text --limit 20 --view agent`,\n ],\n notes: [\n \"self-removal is blocked for remove-members; leave is the self-exit command.\",\n ],\n },\n hints: [\n `openmeld space leave <space-id> --profile ${input.profileId} --view agent`,\n ],\n });\n}\n\nexport function createSpaceLeaveCreatorGuideError(input: {\n spaceId?: string;\n message?: string;\n}) {\n const spaceArg = input.spaceId?.trim() || \"<space-id>\";\n return new DualViewGuideError({\n code: \"space.leave.creator_forbidden\",\n guide: {\n summary:\n input.message ??\n \"The space creator cannot leave this space. Delete the space instead when only you remain.\",\n humanSteps: [\n \"If you are done with the space and only you remain, delete the space.\",\n \"If other members still need it, keep the creator profile in the space.\",\n ],\n agentRequiredArgs: [\"<space-id>\", \"--profile <creator-profile-id>\"],\n agentOptionalArgs: [\"--view <agent|human|auto>\"],\n agentCommands: [\n `openmeld space delete ${spaceArg} --profile <creator-profile-id> --view human`,\n `openmeld space status ${spaceArg} --profile <creator-profile-id> --view agent`,\n ],\n notes: [\n \"Core is the authority for creator leave checks; CLI only presents the result.\",\n ],\n },\n hints: [\n `openmeld space delete ${spaceArg} --profile <creator-profile-id> --view human`,\n ],\n });\n}\n\nexport function createSpaceRemoveMembersCreatorGuideError(input?: {\n profileId?: string;\n}) {\n const creatorProfileId = input?.profileId?.trim();\n return new DualViewGuideError({\n code: \"space.remove_members.creator_forbidden\",\n guide: {\n summary: \"The space creator cannot be removed from this space.\",\n humanSteps: [\n \"Remove other members instead of the space creator.\",\n \"If the goal is to retire the space, delete the space from a human owner session.\",\n ],\n agentRequiredArgs: [\"<space-id>\"],\n agentOptionalArgs: [\n \"--member <other-profile-id...>\",\n \"--all\",\n \"--profile <profile-id>\",\n ],\n agentCommands: [\n \"openmeld space remove-members <space-id> --profile <profile-id> --member <other-profile-id> --view agent\",\n \"openmeld view human\",\n \"openmeld space delete <space-id>\",\n ],\n notes: [\n ...(creatorProfileId\n ? [`blocked creator profile: ${creatorProfileId}`]\n : []),\n ],\n },\n hints: [\n \"openmeld space remove-members <space-id> --profile <profile-id> --member <other-profile-id> --view agent\",\n \"openmeld view human\",\n \"openmeld space delete <space-id>\",\n ],\n });\n}\n\nexport function createSpaceSendInputRequiredGuideError() {\n return new DualViewGuideError({\n code: \"send.input.required\",\n guide: {\n summary:\n \"openmeld space send requires message text or at least one --file <path>.\",\n humanSteps: [\n 'Use quick text: openmeld space send <space-id> \"hello\"',\n \"Or pipe stdin: echo 'hello' | openmeld space send <space-id> --stdin\",\n \"Or read message text from a file: openmeld space send <space-id> --text-file /tmp/message.txt\",\n \"Or share a file without filler text: openmeld space send <space-id> --file /tmp/launch-brief.pdf\",\n ],\n agentRequiredArgs: [\"exactly one input source\"],\n agentOptionalArgs: [\n SPACE_GATEWAY_PARENT_OPTION_TEXT,\n \"--profile <profile-id>\",\n ],\n agentCommands: [\n 'openmeld space send --profile <profile-id> <space-id> \"hello\"',\n \"cat /tmp/message.txt | openmeld space send --profile <profile-id> <space-id> --stdin\",\n \"openmeld space send --profile <profile-id> <space-id> --text-file /tmp/message.txt\",\n \"openmeld space send --profile <profile-id> <space-id> --file /tmp/launch-brief.pdf\",\n 'openmeld space send --profile <profile-id> <space-id> --wake <agent-profile-id> \"Please review.\"',\n ],\n notes: [\n \"Prefer --stdin/--text-file for multiline or shell-sensitive message text.\",\n \"Use repeatable --file options to share up to 10 Space Files with or without message text.\",\n \"Text is always literal. Use --wake, --reference, or --mention with full Profile IDs for recipients; --plain asserts there are none.\",\n ],\n },\n });\n}\n\nexport function createSpaceSendInputConflictGuideError() {\n return new DualViewGuideError({\n code: \"send.input.conflict\",\n guide: {\n summary:\n \"openmeld space send received conflicting message text sources. Use only one of: <text...>, --stdin, --text-file <path>.\",\n humanSteps: [\n \"Pick only one source per command.\",\n \"Remove extra input flags and retry.\",\n ],\n agentRequiredArgs: [\"exactly one input source\"],\n agentCommands: [\n 'openmeld space send --profile <profile-id> <space-id> \"hello\"',\n \"openmeld space send --profile <profile-id> <space-id> --stdin\",\n \"openmeld space send --profile <profile-id> <space-id> --text-file /tmp/message.txt\",\n 'openmeld space send --profile <profile-id> <space-id> --wake <agent-profile-id> \"Please review.\"',\n ],\n notes: [\n \"Do not combine positional text with --stdin or --text-file.\",\n \"A --file attachment may be combined with any one message text source.\",\n \"Text is always literal. Use --wake, --reference, or --mention with full Profile IDs for recipients; --plain asserts there are none.\",\n ],\n },\n });\n}\n\nexport function createSpaceSendInputFileReadFailedGuideError(\n path: string,\n reason: string\n) {\n return new DualViewGuideError({\n code: \"send.input.file_read_failed\",\n guide: {\n summary: `failed to read send input file: ${path}`,\n humanSteps: [\n \"Check file path and permissions.\",\n \"Retry with a readable UTF-8 text file.\",\n ],\n agentRequiredArgs: [\"--text-file <path> must exist and be readable\"],\n agentCommands: [\n \"ls -l <path>\",\n \"cat <path>\",\n \"openmeld space send --profile <profile-id> <space-id> --text-file <path>\",\n ],\n notes: [`read error: ${reason}`],\n },\n });\n}\n\nexport function createSpaceSendInputEmptyGuideError() {\n return new DualViewGuideError({\n code: \"send.input.empty\",\n guide: {\n summary: \"send input is empty after normalization.\",\n humanSteps: [\n \"Provide non-empty text.\",\n \"For stdin/file mode, ensure content is not blank.\",\n ],\n agentRequiredArgs: [\"non-empty message text\"],\n agentCommands: [\n 'openmeld space send --profile <profile-id> <space-id> \"hello\"',\n \"echo 'hello' | openmeld space send --profile <profile-id> <space-id> --stdin\",\n ],\n },\n });\n}\n\nexport function createProfileMenuGuideError() {\n return new DualViewGuideError({\n code: \"profile.menu.interactive.required\",\n guide: {\n summary: \"openmeld profiles menu is interactive in human view only.\",\n humanSteps: [\"openmeld view human\", \"openmeld profile\"],\n agentRequiredArgs: [\n \"set: <profile-id> (or --profile <id>)\",\n \"delete: <profile-id> (or --profile <id>)\",\n \"delete in non-interactive mode: --force\",\n ],\n agentOptionalArgs: [\"--view <auto|human|agent>\"],\n agentCommands: [\n \"openmeld profiles create <profileName> --kind agent [--name <profileName>]\",\n \"openmeld start --view human\",\n \"openmeld profiles list | openmeld profiles ls\",\n \"openmeld profiles show <profile-id> [--profile <id>]\",\n \"openmeld profiles set <profile-id> [--profile <id>]\",\n \"openmeld profiles update <profile-id> [--profile <id>] [--name <profileName>] [--workspace-mode <openmeld-managed|custom>] [--workspace-path <path>]\",\n \"openmeld profiles delete <profile-id> [--profile <id>] --force\",\n ],\n },\n hints: [\n \"openmeld view human\",\n \"openmeld profile\",\n \"openmeld profiles list\",\n \"openmeld profiles set <profile>\",\n ],\n });\n}\n\nexport function createProfileCreateGuideError(summary: string) {\n return new DualViewGuideError({\n code: \"profile.create.arguments.required\",\n guide: {\n summary: `openmeld profiles create: ${summary}`,\n humanSteps: [\n \"openmeld view human\",\n \"openmeld profile\",\n \"Select: Create profile -> Profile kind (Human or Agent) -> Profile name\",\n ],\n agentRequiredArgs: [\n \"--kind agent\",\n \"<profileName> (positional) or --name <profileName>\",\n ],\n agentOptionalArgs: [\"--view <auto|human|agent>\"],\n agentCommands: [\n \"openmeld profiles create <profileName> --kind agent --view agent\",\n \"openmeld profiles list --view agent\",\n \"openmeld profiles set <profile-id> --view agent\",\n \"openmeld whoami --profile <profile-id> --view agent\",\n \"openmeld space create --profile <profile-id> --name <space-name> --view agent\",\n \"openmeld space join --profile <profile-id> <space-id> --view agent\",\n ],\n notes: [\n \"agent view can only create agent profiles for the current authenticated owner.\",\n \"to create a human profile, switch to human view first.\",\n \"created profiles always include ownerUserId from the authenticated session.\",\n ],\n },\n });\n}\n\nexport function createProfileActionGuideError(\n action: ProfileAction,\n summary: string,\n _examples?: ProfileActionGuideExamples\n) {\n const requiredArgsByAction: Record<ProfileAction, string[]> = {\n show: [\"<profile-id> (positional) or --profile <id>\"],\n set: [\"<profile-id> (positional) or --profile <id>\"],\n delete: [\n \"<profile-id> (positional) or --profile <id>\",\n \"--force (required in non-interactive mode)\",\n ],\n update: [\n \"<profile-id> (positional) or --profile <id>\",\n \"at least one update field: --name or --workspace-mode\",\n ],\n };\n\n const commandByAction: Record<ProfileAction, string> = {\n show: \"openmeld profiles show <profile-id> [--profile <id>] [--view <auto|human|agent>]\",\n set: \"openmeld profiles set <profile-id> [--profile <id>] [--view <auto|human|agent>]\",\n delete:\n \"openmeld profiles delete <profile-id> [--profile <id>] --force [--view <auto|human|agent>]\",\n update:\n \"openmeld profiles update <profile-id> [--profile <id>] [--name <profileName>] [--workspace-mode <openmeld-managed|custom>] [--workspace-path <path>] [--view <auto|human|agent>]\",\n };\n\n return new DualViewGuideError({\n code: `profile.${action}.arguments.required`,\n guide: {\n summary: `openmeld profiles ${action}: ${summary}`,\n humanSteps: [\"openmeld view human\", \"openmeld profile\"],\n agentRequiredArgs: requiredArgsByAction[action],\n agentOptionalArgs: [\"--view <auto|human|agent>\"],\n agentCommands: [\n commandByAction[action],\n \"openmeld profiles list\",\n \"openmeld start --view human\",\n \"openmeld start --kind agent --profile-id <existing-agent-profile-id>\",\n \"openmeld start --kind agent --profile-name <new-agent-profile-name>\",\n ],\n },\n });\n}\n\nexport function createSkillsMenuGuideError(input: {\n storeDir: string;\n knownAgentIds: string[];\n agentExampleArg?: string;\n skills: Array<{\n id: string;\n name: string;\n relativePath: string;\n absolutePath: string;\n }>;\n}) {\n const agentExampleArg = normalizeGuideExample(\n input.agentExampleArg,\n \"<id...>\"\n );\n const notes = [`OpenMeld skills store: ${input.storeDir}`];\n if (input.knownAgentIds.length > 0) {\n notes.push(`known agent ids: ${input.knownAgentIds.join(\", \")}`);\n } else {\n notes.push(\"known agent ids: none detected\");\n }\n\n if (input.skills.length > 0) {\n notes.push(\"local OpenMeld skills:\");\n for (const skill of input.skills) {\n notes.push(` - ${skill.name} (${skill.relativePath})`);\n }\n } else {\n notes.push(\"local OpenMeld skills: none\");\n }\n\n return new DualViewGuideError({\n code: \"skills.menu.interactive.required\",\n guide: {\n summary: \"openmeld skills menu is interactive in human view only.\",\n humanSteps: [\"openmeld view human\", \"openmeld skills\"],\n agentCommands:\n getCommandHintsFromContract({\n context: {\n agentExampleArg,\n knownAgentIds: input.knownAgentIds,\n skills: input.skills.map((skill) => ({\n name: skill.name,\n relativePath: skill.relativePath,\n })),\n storeDir: input.storeDir,\n },\n entryName: \"skills.menu\",\n }) ?? [],\n notes,\n },\n hints: [\n \"openmeld view human\",\n \"openmeld skills\",\n \"openmeld skills list\",\n \"openmeld skills check\",\n \"openmeld skills update\",\n \"openmeld skills install --all\",\n ],\n });\n}\n\nexport function createSkillsActionGuideError(input: {\n action: \"ensure\" | \"install\" | \"uninstall\";\n agentExampleArg?: string;\n}) {\n return createGuideErrorFromContract({\n context: {\n agentExampleArg: normalizeGuideExample(input.agentExampleArg, \"<id...>\"),\n },\n guideScenario: getRequiredCommandGuideScenario(`skills.${input.action}`),\n });\n}\n\nfunction normalizeGuideExample(\n value: string | undefined,\n fallback: string\n): string {\n const normalized = String(value ?? \"\").trim();\n return normalized.length > 0 ? normalized : fallback;\n}\n\nexport function createSpaceAliasTargetGuideError(command: SpaceAliasCommand) {\n const requiredArgsByCommand: Record<SpaceAliasCommand, string[]> = {\n send: [\"--space <space-id>\", \"message text and/or --file <path>\"],\n tail: [\"--space <space-id>\"],\n };\n const optionalArgsByCommand: Record<SpaceAliasCommand, string[]> = {\n send: [\n \"--profile <id>\",\n \"--base-url <url>\",\n \"--password <value>\",\n \"--stdin\",\n \"--text-file <path>\",\n \"--file <path> (repeatable, max 10)\",\n ],\n tail: [\n \"--profile <id>\",\n \"--base-url <url>\",\n \"--password <value>\",\n \"--limit <n>\",\n \"--json\",\n ],\n };\n const commandByAlias: Record<SpaceAliasCommand, string> = {\n send: \"openmeld send [<text...>|--stdin|--text-file <path>] [--file <path>...] --space <space-id> [--plain] [--password <value>] [--profile <id>] [--base-url <url>]\",\n tail: \"openmeld tail --space <space-id> [--limit <n>] [--after-signal <signal-id>] [--around-signal <signal-id> --before <n> --after <n>] [--from-profile <profile-id>] [--kind <text|status|system_notice>] [--json] [--password <value>] [--profile <id>] [--base-url <url>]\",\n };\n const preferredCommand: Record<SpaceAliasCommand, string> = {\n send: \"openmeld space [--gateway-url <url>] send [--profile <profile-id>] <space-id> [<text...>|--stdin|--text-file <path>] [--file <path>...] [--plain] [--password <value>]\",\n tail: SPACE_HISTORY_USAGE,\n };\n\n return new DualViewGuideError({\n code: `space.${command}.alias.target.required`,\n guide: {\n summary: `openmeld ${command} requires explicit --space argument in agent view.`,\n humanSteps: [\"openmeld view human\", \"openmeld space\"],\n agentRequiredArgs: requiredArgsByCommand[command],\n agentOptionalArgs: optionalArgsByCommand[command],\n agentCommands: [commandByAlias[command], preferredCommand[command]],\n notes: [\"Alias command detected. Prefer `openmeld space ...` commands.\"],\n },\n });\n}\n\nexport function createResetConfirmationGuideError() {\n return new DualViewGuideError({\n code: \"reset.confirmation.required\",\n guide: {\n summary:\n \"openmeld reset in agent view requires explicit confirmation flag.\",\n humanSteps: [\"openmeld view human\", \"openmeld reset\"],\n agentRequiredArgs: [\"--yes\"],\n agentCommands: [\"openmeld reset --yes\"],\n notes: [\n \"`openmeld reset` is destructive. Keep `--yes` explicit in agent view.\",\n ],\n },\n hints: [\"openmeld reset --yes\"],\n });\n}\n\nexport function createUpgradeConfirmationGuideError(\n scenario: UpgradeConfirmationScenario\n) {\n const summary =\n scenario === \"outdated\"\n ? \"openmeld upgrade in agent view requires --yes before installing updates.\"\n : \"openmeld upgrade in agent view requires --yes when version check fails.\";\n\n const notes =\n scenario === \"outdated\"\n ? [\n \"Use `openmeld upgrade --check` to inspect versions without installing.\",\n ]\n : [\n \"Use `openmeld upgrade --check` to inspect status first.\",\n \"When check fails, install requires explicit `--yes` in agent view.\",\n ];\n\n return new DualViewGuideError({\n code: `upgrade.confirmation.required.${scenario}`,\n guide: {\n summary,\n humanSteps: [\"openmeld view human\", \"openmeld upgrade\"],\n agentRequiredArgs: [\"--yes\"],\n agentOptionalArgs: [\"--check\"],\n agentCommands: [\"openmeld upgrade --yes\", \"openmeld upgrade --check\"],\n notes,\n },\n hints: [\"openmeld upgrade --yes\", \"openmeld upgrade --check\"],\n });\n}\n\nexport function createStartAuthenticationGuideError() {\n return new DualViewGuideError({\n code: \"start.auth.required\",\n guide: {\n summary:\n \"openmeld start requires sign-in before OpenMeld profile selection.\",\n humanSteps: [\"openmeld view human\", \"openmeld login\", \"openmeld start\"],\n agentCommands: [\n \"openmeld auth status --view agent\",\n \"openmeld login --view agent --method ott --ott <token>\",\n \"openmeld start --view agent\",\n ],\n notes: [\n \"If a human is operating this terminal, switch to human view first.\",\n ],\n },\n hints: [\"openmeld login\", \"openmeld auth status\", \"openmeld start\"],\n });\n}\n\nexport function createAuthLoginGuideError(summary: string) {\n return createGuideErrorFromContract({\n context: {\n includeViewFlag: true,\n summary,\n },\n guideScenario: getRequiredCommandGuideScenario(\"auth.login\"),\n });\n}\n\nfunction getRequiredCommandGuideScenario(\n entryName:\n | \"auth.login\"\n | \"skills.ensure\"\n | \"skills.install\"\n | \"skills.uninstall\"\n | \"space.add-agents\"\n | \"space.add-human-profiles\"\n | \"space.add-members\"\n | \"space.remove-members\"\n) {\n const contract = getCommandEntryContract(entryName);\n const guideScenario = contract?.guideScenarios?.required;\n if (!guideScenario) {\n throw new Error(`missing required guide scenario for ${entryName}`);\n }\n return guideScenario;\n}\n\nexport function createDoctorFailedGuideError() {\n return new DualViewGuideError({\n code: \"doctor.summary.failed\",\n guide: {\n summary: \"openmeld doctor detected one or more failed checks.\",\n humanSteps: [\"openmeld view human\", \"openmeld doctor\"],\n agentOptionalArgs: [\"--profile <id>\", \"--gateway-url <url>\"],\n agentCommands: [\n \"openmeld doctor --view agent [--profile <id>] [--gateway-url <url>]\",\n \"openmeld whoami --view agent\",\n \"openmeld auth status --view agent\",\n ],\n notes: [\n \"Inspect preceding `doctor.check.fail` outputs for exact failure details.\",\n ],\n },\n });\n}\n","import type { RuntimeContext } from \"./types\";\n\nexport function canUseInteractivePrompts(context: RuntimeContext): boolean {\n return context.resolvedView === \"human\" && context.interactive;\n}\n","import type {\n DaemonServiceUpdateJob,\n OpenMeldToolsUpdateAttempt,\n OpenMeldToolsUpdateFailureCode,\n OpenMeldToolsUpdateOperation,\n} from \"@openmeld/schemas/types\";\nimport type { OpenMeldPathResolutionInput } from \"../../config/paths\";\nimport {\n readLastDaemonServiceUpdate,\n readPendingDaemonServiceUpdate,\n} from \"../lifecycle/daemon-service-update-state\";\nimport {\n readLastOpenMeldToolsUpdateAttempt,\n readPendingOpenMeldToolsUpdateAttempt,\n} from \"./openmeld-tools-update-attempt-state\";\nimport { resolvePersistedOpenMeldToolsUpdateFailure } from \"./openmeld-tools-update-failure\";\n\nconst TERMINAL_VISIBILITY_MS = 24 * 60 * 60 * 1000;\n\nexport type OpenMeldToolsUpdateOperationProjection = {\n failureCode: OpenMeldToolsUpdateFailureCode | null;\n operation: OpenMeldToolsUpdateOperation;\n};\n\nexport async function resolveOpenMeldToolsUpdateOperation(\n pathInput: OpenMeldPathResolutionInput = {},\n nowMs = Date.now()\n): Promise<OpenMeldToolsUpdateOperation | null> {\n const projection = await resolveOpenMeldToolsUpdateOperationProjection(\n pathInput,\n nowMs\n );\n return projection?.operation ?? null;\n}\n\nexport async function resolveOpenMeldToolsUpdateOperationProjection(\n pathInput: OpenMeldPathResolutionInput = {},\n nowMs = Date.now()\n): Promise<OpenMeldToolsUpdateOperationProjection | null> {\n const [servicePending, toolsPending] = await Promise.all([\n readPendingDaemonServiceUpdate(pathInput),\n readPendingOpenMeldToolsUpdateAttempt(pathInput),\n ]);\n if (servicePending) {\n return projectServiceJob(servicePending);\n }\n if (toolsPending) {\n return projectToolsAttempt(toolsPending);\n }\n\n const [serviceLast, toolsLast] = await Promise.all([\n readLastDaemonServiceUpdate(pathInput),\n readLastOpenMeldToolsUpdateAttempt(pathInput),\n ]);\n const candidates = [\n ...(serviceLast ? [projectServiceJob(serviceLast)] : []),\n ...(toolsLast ? [projectToolsAttempt(toolsLast)] : []),\n ]\n .filter((candidate) => isRecentTerminal(candidate.operation, nowMs))\n .sort(\n (a, b) =>\n Date.parse(b.operation.updatedAt) - Date.parse(a.operation.updatedAt)\n );\n return candidates[0] ?? null;\n}\n\nfunction projectToolsAttempt(\n attempt: OpenMeldToolsUpdateAttempt\n): OpenMeldToolsUpdateOperationProjection {\n const terminalFailure =\n attempt.operation.phase === \"needs_help\" ||\n attempt.operation.phase === \"restored\";\n return {\n failureCode: terminalFailure\n ? (resolvePersistedOpenMeldToolsUpdateFailure(attempt.errorMessage) ??\n \"cli.update.failed\")\n : null,\n operation: attempt.operation,\n };\n}\n\nfunction projectServiceJob(\n job: DaemonServiceUpdateJob\n): OpenMeldToolsUpdateOperationProjection {\n return {\n failureCode:\n job.phase === \"needs_help\" || job.phase === \"restored\"\n ? \"cli.update.service_alignment_failed\"\n : null,\n operation: {\n operationId: job.jobId,\n phase: job.phase,\n requestSource: job.requestSource,\n requestedAt: job.requestedAt,\n ...(job.targetCliVersion\n ? { targetCliVersion: job.targetCliVersion }\n : {}),\n ...(job.targetServiceVersion\n ? { targetServiceVersion: job.targetServiceVersion }\n : {}),\n targetVersion: job.targetVersion,\n updatedAt: job.updatedAt,\n urgency: job.urgency,\n },\n };\n}\n\nfunction isRecentTerminal(\n operation: OpenMeldToolsUpdateOperation,\n nowMs: number\n): boolean {\n if (\n operation.phase !== \"updated\" &&\n operation.phase !== \"restored\" &&\n operation.phase !== \"needs_help\"\n ) {\n return false;\n }\n const updatedAtMs = Date.parse(operation.updatedAt);\n return (\n Number.isFinite(updatedAtMs) &&\n nowMs >= updatedAtMs &&\n nowMs - updatedAtMs <= TERMINAL_VISIBILITY_MS\n );\n}\n","import { isCancel, select } from \"@clack/prompts\";\nimport {\n formatInlineOpenMeldCliCommands,\n formatOpenMeldCliCommand,\n} from \"../runtime/cli-entry-command\";\n\nexport const DAEMON_INSTALL_DECISION_CHOICE = {\n install: \"install\",\n notNow: \"not_now\",\n} as const;\n\nexport type DaemonInstallDecisionKind = \"missing\" | \"outdated\";\n\nexport type DaemonInstallDecisionChoice =\n | (typeof DAEMON_INSTALL_DECISION_CHOICE)[keyof typeof DAEMON_INSTALL_DECISION_CHOICE]\n | \"cancelled\";\n\ntype DaemonVersionInput = {\n installedVersion?: string;\n expectedVersion: string;\n};\n\ntype DaemonInstallDecisionPromptConfig = {\n message: string;\n initialValue: (typeof DAEMON_INSTALL_DECISION_CHOICE)[\"install\"];\n options: Array<{\n value:\n | (typeof DAEMON_INSTALL_DECISION_CHOICE)[\"install\"]\n | (typeof DAEMON_INSTALL_DECISION_CHOICE)[\"notNow\"];\n label: string;\n hint?: string;\n }>;\n};\n\nconst DAEMON_INSTALL_COMMAND = \"openmeld service install\";\nconst DAEMON_REPAIR_COMMAND = \"openmeld service repair\";\nconst DAEMON_UPGRADE_COMMAND = \"openmeld upgrade\";\nconst DAEMON_AUTO_INSTALL_ALWAYS_FLAG = \"`--service-auto-install always`\";\nconst DAEMON_DECISION_RECOMMENDED_HINT = \"Recommended\";\n\nconst DAEMON_INSTALL_DECISION_COPY = {\n missing: {\n question: \"OpenMeld Service is missing. Install it now?\",\n explanation: \"Without it, this computer can't receive local Wake work.\",\n primaryLabel: \"Yes, install it for me\",\n deferred:\n \"OpenMeld Service is still missing. Install it later with `openmeld service install` so this computer can receive local Wake work.\",\n failed:\n \"OpenMeld Service could not be installed. Run `openmeld service install` so this computer can receive local Wake work.\",\n },\n outdated: {\n question: \"OpenMeld Service update required. Update it now?\",\n explanation:\n \"This service artifact is not compatible with current local Wake execution.\",\n primaryLabel: \"Yes, update it for me\",\n deferred:\n \"OpenMeld Service update skipped. Run `openmeld service update` before using local Wake work.\",\n failed: \"OpenMeld Service was not updated. Run `openmeld service update`.\",\n },\n} as const satisfies Record<\n DaemonInstallDecisionKind,\n {\n question: string;\n explanation: string;\n primaryLabel: string;\n deferred: string;\n failed: string;\n }\n>;\n\nexport function buildDaemonInstallDecisionPromptConfig(input: {\n kind: DaemonInstallDecisionKind;\n installedVersion?: string;\n expectedVersion?: string;\n}): DaemonInstallDecisionPromptConfig {\n const copy = DAEMON_INSTALL_DECISION_COPY[input.kind];\n const detailLine =\n input.kind === \"outdated\" &&\n typeof input.installedVersion === \"string\" &&\n typeof input.expectedVersion === \"string\"\n ? `Installed v${input.installedVersion}, expected v${input.expectedVersion}.`\n : null;\n return {\n message: [copy.question, copy.explanation, detailLine]\n .filter((line) => typeof line === \"string\" && line.length > 0)\n .join(\"\\n\"),\n initialValue: DAEMON_INSTALL_DECISION_CHOICE.install,\n options: [\n {\n value: DAEMON_INSTALL_DECISION_CHOICE.install,\n label: copy.primaryLabel,\n hint: DAEMON_DECISION_RECOMMENDED_HINT,\n },\n {\n value: DAEMON_INSTALL_DECISION_CHOICE.notNow,\n label: \"Not now\",\n },\n ],\n };\n}\n\nexport async function promptForDaemonInstallDecision(input: {\n kind: DaemonInstallDecisionKind;\n installedVersion?: string;\n expectedVersion?: string;\n}): Promise<DaemonInstallDecisionChoice> {\n const choice = await select(buildDaemonInstallDecisionPromptConfig(input));\n if (isCancel(choice)) {\n return \"cancelled\";\n }\n return choice === DAEMON_INSTALL_DECISION_CHOICE.install\n ? DAEMON_INSTALL_DECISION_CHOICE.install\n : DAEMON_INSTALL_DECISION_CHOICE.notNow;\n}\n\nexport async function runDaemonInstallDecisionPrompt(input: {\n kind: DaemonInstallDecisionKind;\n installedVersion?: string;\n expectedVersion?: string;\n emitLine: (text: string) => Promise<void> | void;\n installService: () => Promise<void>;\n}): Promise<\"install\" | \"not_now\" | \"cancelled\" | \"failed\"> {\n const decision = await promptForDaemonInstallDecision({\n kind: input.kind,\n installedVersion: input.installedVersion,\n expectedVersion: input.expectedVersion,\n });\n if (decision === DAEMON_INSTALL_DECISION_CHOICE.install) {\n try {\n await input.installService();\n return \"install\";\n } catch {\n await input.emitLine(formatDaemonInstallFailedMessage(input.kind));\n return \"failed\";\n }\n }\n\n if (decision === \"cancelled\") {\n return \"cancelled\";\n }\n\n await input.emitLine(formatDaemonInstallDeferredMessage(input.kind));\n return decision;\n}\n\nexport function formatDaemonInstallDeferredMessage(\n kind: DaemonInstallDecisionKind\n): string {\n return formatInlineOpenMeldCliCommands(\n DAEMON_INSTALL_DECISION_COPY[kind].deferred\n );\n}\n\nexport function formatDaemonInstallFailedMessage(\n kind: DaemonInstallDecisionKind\n): string {\n return formatInlineOpenMeldCliCommands(\n DAEMON_INSTALL_DECISION_COPY[kind].failed\n );\n}\n\nexport function formatDaemonServiceMissingRecommendation(): string {\n return \"OpenMeld Service is not installed yet. Install it so this computer can receive local Wake work.\";\n}\n\nexport function formatDaemonServiceInstallRecommendationNextStep(): string {\n return `Run \\`${formatOpenMeldCliCommand(DAEMON_INSTALL_COMMAND)}\\` now, or re-run command with ${DAEMON_AUTO_INSTALL_ALWAYS_FLAG}.`;\n}\n\nexport function formatDaemonServiceMissingStatus(): string {\n return \"Not installed yet.\";\n}\n\nexport function formatDaemonServiceMissingMeaning(): string {\n return \"Missing — install OpenMeld Service before this computer can receive local Wake work.\";\n}\n\nexport function formatDaemonServiceMissingAction(): string {\n return `Run \\`${formatOpenMeldCliCommand(DAEMON_INSTALL_COMMAND)}\\` to set it up.`;\n}\n\nexport function formatDaemonServiceMissingRunStepOne(): string {\n return `\\`${formatOpenMeldCliCommand(DAEMON_INSTALL_COMMAND)}\\``;\n}\n\nexport function formatDaemonServiceMissingRunStepTwo(): string {\n return `\\`${formatOpenMeldCliCommand(\"openmeld service start\")}\\``;\n}\n\nexport function formatDaemonServiceOutdatedRecommendation(\n input: DaemonVersionInput\n): string {\n const installedVersion = input.installedVersion ?? \"unknown\";\n return `OpenMeld Service version differs from this CLI (installed v${installedVersion}, CLI v${input.expectedVersion}). This is diagnostic unless service compatibility fails.`;\n}\n\nexport function formatDaemonServiceOutdatedStatus(\n input: DaemonVersionInput\n): string {\n const installedVersion = input.installedVersion ?? \"unknown\";\n return `Version differs from this CLI (installed v${installedVersion}, CLI v${input.expectedVersion}).`;\n}\n\nexport function formatDaemonServiceDowngradeBlockedRecommendation(\n input: DaemonVersionInput\n): string {\n if (input.installedVersion) {\n return `OpenMeld Service is already newer (installed v${input.installedVersion}, current CLI v${input.expectedVersion}). OpenMeld will not downgrade it automatically. Run \\`${formatOpenMeldCliCommand(DAEMON_UPGRADE_COMMAND)}\\`.`;\n }\n return `OpenMeld Service is already newer than this CLI. OpenMeld will not downgrade it automatically. Run \\`${formatOpenMeldCliCommand(DAEMON_UPGRADE_COMMAND)}\\`.`;\n}\n\nexport function getDaemonDowngradeBlockedTitle(): string {\n return \"⛔ OpenMeld Service Downgrade Blocked\";\n}\n\nexport function formatDaemonDowngradeBlockedNextStep(): string {\n return `Run \\`${formatOpenMeldCliCommand(DAEMON_UPGRADE_COMMAND)}\\`.`;\n}\n\nexport function formatDaemonStartupRepairNotice(): string {\n return `Run \\`${formatOpenMeldCliCommand(DAEMON_REPAIR_COMMAND)}\\` to repair it now.`;\n}\n","export const MIN_VISIBLE_ELAPSED_TIME_MS = 100;\n\nexport function resolveElapsedTimeMs(\n startedAtMs: number,\n currentTimeMs = Date.now()\n): number {\n return Math.max(0, currentTimeMs - startedAtMs);\n}\n\nexport function formatElapsedTime(durationMs: number): string {\n const seconds = durationMs / 1000;\n return seconds < 10 ? `${seconds.toFixed(1)}s` : `${Math.round(seconds)}s`;\n}\n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;CACX;CACA;EACE,OAAO;EACP,OAAO;EACP,OAAO;EACP,YAAY;EACZ,YAAY;EACZ,SACE;CACJ;CACA;EACE,OAAO;EACP,OAAO;EACP,OAAO;EACP,YAAY;EACZ,YAAY;EACZ,SACE;CACJ;CACA;EACE,OAAO;EACP,OAAO;EACP,OAAO;EACP,YAAY;EACZ,YAAY;EACZ,SACE;CACJ;CACA;EACE,OAAO;EACP,OAAO;EACP,OAAO;EACP,YAAY;EACZ,YAAY;EACZ,SACE;CACJ;CACA;EACE,OAAO;EACP,OAAO;EACP,OAAO;EACP,YAAY;EACZ,YAAY;EACZ,SACE;CACJ;CACA;EACE,OAAO;EACP,OAAO;EACP,OAAO;EACP,YAAY;EACZ,YAAY;EACZ,SACE;CACJ;CACA;EACE,OAAO;EACP,OAAO;EACP,OAAO;EACP,YAAY;EACZ,YAAY;EACZ,SACE;CACJ;CACA;EACE,OAAO;EACP,OAAO;EACP,OAAO;EACP,YAAY;EACZ,YAAY;EACZ,SAAS;CACX;CACA;EACE,OAAO;EACP,OAAO;EACP,OAAO;EACP,YAAY;EACZ,YAAY;EACZ,SACE;CACJ;CACA;EACE,OAAO;EACP,OAAO;EACP,OAAO;EACP,YACE;EACF,YAAY;EACZ,SACE;CACJ;CACA;EACE,OAAO;EACP,OAAO;EACP,OAAO;EACP,YACE;EACF,YAAY;EACZ,SACE;CACJ;CACA;EACE,OAAO;EACP,OAAO;EACP,OAAO;EACP,YACE;EACF,YAAY;EACZ,SACE;CACJ;CACA;EACE,OAAO;EACP,OAAO;EACP,OAAO;EACP,YACE;EACF,YAAY;EACZ,SACE;CACJ;CACA;EACE,OAAO;EACP,OAAO;EACP,OAAO;EACP,YAAY;EACZ,YAAY;EACZ,SAAS;CACX;CACA;EACE,OAAO;EACP,OAAO;EACP,OAAO;EACP,YAAY;EACZ,YAAY;EACZ,SACE;CACJ;CACA;EACE,OAAO;EACP,OAAO;EACP,OAAO;EACP,YAAY;EACZ,YAAY;EACZ,SAAS;CACX;AACF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;GACR,gBAAgB;GAChB,OAAO;GACP,QAAQ;GACR,SAAS;EACX;EACF,SACE,cAAY,OAAO;CACvB;AACF;AAEA,SAASC,cAAY,OAAqB;CACxC,MAAM,IAAI,MACR,8CAA8C,OAAO,KAAK,GAC5D;AACF;;;ACrNA,MAAa,2BAA2B;AAExC,MAAa,sBAAsB;CACjC;EACE,SAAS;EACT,aAAa;CACf;CACA;EACE,SAAS;EACT,aAAa;CACf;CACA;EACE,SAAS;EACT,aAAa;CACf;CACA;EACE,SAAS;EACT,aAAa;CACf;CACA;EACE,SAAS;EACT,aAAa;CACf;CACA;EACE,SAAS;EACT,aAAa;CACf;CACA;EACE,SAAS;EACT,aAAa;CACf;CACA;EACE,SAAS;EACT,aAAa;CACf;CACA;EACE,SAAS;EACT,aAAa;CACf;CACA;EACE,SAAS;EACT,aAAa;CACf;CACA;EACE,SAAS;EACT,aAAa;CACf;CACA;EACE,SAAS;EACT,aAAa;CACf;CACA;EACE,SAAS;EACT,aAAa;CACf;CACA;EACE,SAAS;EACT,aAAa;CACf;CACA;EACE,SAAS;EACT,aAAa;CACf;CACA;EACE,SAAS;EACT,aAAa;CACf;AACF;;;AC9BA,SAAS,8BAA8B,OASkB;CACvD,OAAO;EACL,eAAe;GACb,qBAAqB;IACnB,UAAU;IACV,OAAO,CAAC;GACV;GACA,OAAO;IACL;IACA;IACA;GACF;GACA,SAAS,uCAAuC,MAAM,OAAO;GAC7D,QAAQ,CAAC,GAAG,uCAAuC;GACnD,SAAS,MAAM;EACjB;EACA,aAAa,YACX,uCAAuC,MAAM,OAAO,CAAC,CAAC,aAAa;GACjE,GAAG;GACH,iBAAiB;GACjB,WAAW,QAAQ,aAAa;EAClC,CAAC,KAAK,CAAC;EACT,WAAW,MAAM;EACjB,gBAAgB,EACd,UAAU;GACR,MAAM,SAAS,MAAM,QAAQ,WAAW,KAAK,GAAG,EAAE;GAClD,YAAY;IACV;IACA,kBAAkB,MAAM;IACxB,MAAM;GACR;GACA,OAAO;IACL;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SAAS,CAAC;EAC1E,WAAW;CACb;CACA,iBAAiB;EACf,eAAe;GACb,qBAAqB;IACnB,UAAU;IACV,OAAO,CAAC;GACV;GACA,OAAO,CAAC;GACR,yBACE,0CAA0C,QAAQ;GACpD,yBACE,0CAA0C,QAAQ;GACpD,QAAQ,CAAC;GACT,SAAS;GACT,WAAW,EAAE,kBAAkB,YAC7B,mCAAmC;IACjC,SAAS;IACT;GACF,CAAC;EACL;EACA,kBAAkB,mCAAmC,EAAE,SAAS,SAAS,CAAC;EAC1E,WAAW;CACb;CACA,aAAa;EACX,eAAe;GACb,UAAU;IACR;IACA;IACA;GACF;GACA,qBAAqB;IACnB,UAAU;IACV,OAAO,CAAC;GACV;GACA,OAAO,CACL,6DACA,oEACF;GACA,mBAAmB,CAAC;GACpB,mBAAmB,CAAC;GACpB,QAAQ;IACN;IACA;IACA;GACF;GACA,SACE;EACJ;EACA,WAAW;CACb;CACA,cAAc;EACZ,eAAe;GACb,qBAAqB;IACnB,UAAU;IACV,OAAO;KACL;KACA;KACA;IACF;GACF;GACA,OAAO,CACL,0EACA,wHACF;GACA,SAAS;GACT,QAAQ;IACN;IACA;IACA;GACF;GACA,SACE;EACJ;EACA,kBACE,oCAAoC,aAAa,CAAC,CAAC,KAAK,CAAC;EAC3D,WAAW;EACX,gBAAgB,EACd,UAAU;GACR,MAAM;GACN,YAAY;IAAC;IAAuB;IAAiB;GAAiB;GACtE,SAAS;GACT,UAAU,YACR,wBAAwB,QAAQ,WAAW;EAC/C,EACF;CACF;CACA,eAAe;EACb,eAAe;GACb,UAAU,CACR,gCACA,mCACF;GACA,qBAAqB;IACnB,UAAU;IACV,OAAO,CAAC;GACV;GACA,OAAO,CACL,2DACA,yGACF;GACA,mBAAmB,CAAC;GACpB,mBAAmB,CAAC;GACpB,QAAQ;IACN;IACA;IACA;IACA;IACA;GACF;GACA,SACE;EACJ;EACA,WAAW;CACb;CACA,eAAe;EACb,eAAe;GACb,UAAU,CACR,qCACA,2CACF;GACA,qBAAqB;IACnB,UAAU;IACV,OAAO,CAAC;GACV;GACA,OAAO,CAAC,oCAAoC;GAC5C,mBAAmB,CAAC;GACpB,mBAAmB,CAAC;GACpB,QAAQ;IACN;IACA;IACA;GACF;GACA,SACE;EACJ;EACA,WAAW;CACb;CACA,QAAQ;EACN,eAAe;GACb,UAAU;IACR;IACA;IACA;GACF;GACA,qBAAqB;IACnB,UAAU;IACV,OAAO,CACL,4EACA,2GACF;GACF;GACA,OAAO,CACL,uFACA,kFACF;GACA,mBAAmB;IACjB;IACA;IACA;GACF;GACA,mBAAmB,CAAC;GACpB,QAAQ;IACN;IACA;IACA;GACF;GACA,SACE;EACJ;EACA,WAAW;CACb;CACA,sBAAsB;EACpB,eAAe;GACb,UAAU,CACR,4CACA,8BACF;GACA,qBAAqB;IACnB,UAAU;IACV,OAAO,CAAC;GACV;GACA,OAAO,CACL,gGACF;GACA,mBAAmB,CAAC;GACpB,mBAAmB,CAAC;GACpB,QAAQ;IACN;IACA;IACA;GACF;GACA,SACE;EACJ;EACA,WAAW;CACb;CACA,mBAAmB;EACjB,eAAe;GACb,UAAU,CACR,yCACA,qCACF;GACA,qBAAqB;GACrB,OAAO,CACL,mGACF;GACA,mBAAmB,CAAC;GACpB,mBAAmB,CAAC;GACpB,QAAQ;IACN;IACA;IACA;GACF;GACA,SACE;EACJ;EACA,WAAW;CACb;CACA,gBAAgB;EACd,eAAe;GACb,UAAU;IACR;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF;GACA,qBAAqB;GACrB,OAAO,CACL,gEACA,+DACF;GACA,mBAAmB,CAAC;GACpB,mBAAmB,CAAC;GACpB,QAAQ;IACN;IACA;IACA;GACF;GACA,SACE;EACJ;EACA,WAAW;CACb;CACA,qBAAqB;EACnB,eAAe;GACb,UAAU;IACR;IACA;IACA;GACF;GACA,qBAAqB;GACrB,OAAO,CACL,+FACF;GACA,mBAAmB,CAAC,SAAS;GAC7B,mBAAmB,CAAC;GACpB,QAAQ;IACN;IACA;IACA;GACF;GACA,SACE;EACJ;EACA,WAAW;CACb;CACA,eAAe;EACb,eAAe;GACb,UAAU;IACR;IACA;IACA;GACF;GACA,qBAAqB;GACrB,OAAO;IACL;IACA;IACA;GACF;GACA,mBAAmB;IACjB;IACA;IACA;IACA;IACA;GACF;GACA,mBAAmB,CAAC;GACpB,QAAQ;IACN;IACA;IACA;GACF;GACA,SACE;EACJ;EACA,WAAW;CACb;CACA,oBAAoB;EAClB,eAAe;GACb,UAAU,CACR,0CACA,sCACF;GACA,qBAAqB;GACrB,OAAO,CACL,2EACF;GACA,mBAAmB,CAAC,wBAAwB;GAC5C,mBAAmB,CAAC;GACpB,QAAQ;IACN;IACA;IACA;GACF;GACA,SACE;EACJ;EACA,WAAW;CACb;CACA,kBAAkB;EAChB,eAAe;GACb,UAAU;IACR;IACA;IACA;GACF;GACA,qBAAqB;GACrB,OAAO,CACL,2EACA,2IACF;GACA,mBAAmB,CAAC,wBAAwB;GAC5C,mBAAmB,CAAC;GACpB,QAAQ;IACN;IACA;IACA;IACA;GACF;GACA,SACE;EACJ;EACA,WAAW;CACb;CACA,gBAAgB;EACd,eAAe;GACb,UAAU;IACR;IACA;IACA;GACF;GACA,qBAAqB;GACrB,OAAO,CACL,2FACF;GACA,mBAAmB,CAAC,WAAW,wBAAwB;GACvD,mBAAmB,CAAC;GACpB,QAAQ;IACN;IACA;IACA;GACF;GACA,SAAS;EACX;EACA,WAAW;CACb;CACA,qBAAqB;EACnB,eAAe;GACb,UAAU,CACR,2CACA,uCACF;GACA,qBAAqB;GACrB,OAAO,CACL,oGACF;GACA,mBAAmB,CAAC;GACpB,mBAAmB,CAAC;GACpB,QAAQ;IACN;IACA;IACA;GACF;GACA,SACE;EACJ;EACA,WAAW;CACb;CACA,kBAAkB;EAChB,eAAe;GACb,qBAAqB;GACrB,OAAO,CACL,4EACA,+HACF;GACA,SAAS,sCAAsC,QAAQ;GACvD,QAAQ;IACN;IACA;IACA;GACF;GACA,SACE;EACJ;E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ACtE,CAAC;EACH,WAAW;EACX,gBAAgB,EACd,UAAU;GACR,MAAM;GACN,QAAQ,YACN,wCAAwC,QAAQ,CAAC,CAAC,aAChD,OACF,KAAK,CAAC;GACR,YAAY,CAAC,uBAAuB,iBAAiB;GACrD,OAAO,CACL,gEACF;GACA,SAAS,wCAAwC,QAAQ;GACzD,SACE;EACJ,EACF;CACF;CACA,WAAW;EACT,eAAe;GACb,UAAU,CACR,0EACA,4EACF;GACA,qBAAqB;IACnB,UAAU;IACV,OAAO,CAAC;GACV;GACA,OAAO,CACL,oFACA,iDACF;GACA,mBAAmB;IACjB;IACA;IACA;IACA;IACA;GACF;GACA,mBAAmB,CAAC;GACpB,QAAQ;IACN;IACA;IACA;GACF;GACA,SACE;EACJ;EACA,WAAW;CACb;CACA,SAAS;EACP,eAAe;GACb,UAAU;IACR;IACA;IACA;GACF;GACA,qBAAqB;IACnB,UAAU;IACV,OAAO,CAAC;GACV;GACA,OAAO,CACL,mEACA,iGACF;GACA,mBAAmB,CAAC,WAAW,OAAO;GACtC,mBAAmB,CAAC;GACpB,QAAQ;IACN;IACA;IACA;GACF;GACA,SACE;EACJ;EACA,WAAW;CACb;CACA,QAAQ;EACN,eAAe;GACb,UAAU;IACR;IACA;IACA;GACF;GACA,qBAAqB;IACnB,UAAU;IACV,OAAO,CAAC;GACV;GACA,OAAO,CACL,wGACF;GACA,mBAAmB,CAAC,wBAAwB;GAC5C,mBAAmB,CAAC;GACpB,QAAQ;IACN;IACA;IACA;GACF;GACA,SACE;EACJ;EACA,WAAW;CACb;CACA,eAAe;EACb,aAAa,YAAmC;GAC9C;GACA;GACA;GACA,GAAI,wCAAwC,QAAQ,CAAC,CAAC,aACpD,OACF,KAAK,CAAC;GACN,GAAI,wCAAwC,SAAS,CAAC,CAAC,aACrD,OACF,KAAK,CAAC;GACN,GAAI,wCAAwC,WAAW,CAAC,CAAC,aACvD,OACF,KAAK,CAAC;EACR;EACA,WAAW;CACb;CACA,oBAAoB;EAClB,eAAe;GACb,qBAAqB;GACrB,QAAQ,YAAmC,CACzC,gEACA,GAAG,uBAAuB,OAAO,CACnC;GACA,SAAS,wCAAwC,WAAW;GAC5D,QAAQ;IACN;IACA;IACA;GACF;GACA,SACE;EACJ;EACA,aAAa,YACX,wCAAwC,WAAW,CAAC,CAAC,aACnD,OACF,KAAK,CAAC;EACR,WAAW;EACX,gBAAgB,EACd,UAAU;GACR,MAAM;GACN,QAAQ,YACN,wCAAwC,WAAW,CAAC,CAAC,aACnD,OACF,KAAK,CAAC;GACR,YAAY,CAAC,uBAAuB,iBAAiB;GACrD,OAAO,CACL,gEACF;GACA,SAAS,wCAAwC,WAAW;GAC5D,SACE;EACJ,EACF;CACF;CACA,oBAAoB,8BAA8B;EAChD,SAAS;EACT,WAAW;EACX,iBACE;EACF,iBACE;EACF,SACE;CACJ,CAAC;CACD,gBAAgB;EACd,eAAe;GACb,WAAW,EAAE,kBAAkB,YAAY,CACzC,kEAAkE,kBAAkB,kBAAkB,IACxG;GACA,qBAAqB;IACnB,UAAU;IACV,OAAO,CAAC;GACV;GACA,OAAO;IACL;IACA;IACA;IACA;IACA;GACF;GACA,mBAAmB;IACjB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF;GACA,mBAAmB,CAAC,mBAAmB;GACvC,QAAQ;IACN;IACA;IACA;IACA;GACF;GACA,SACE;EACJ;EACA,kBAAkB;GAChB;GACA;GACA;EACF;EACA,WAAW;EACX,gBAAgB,EACd,UAAU;GACR,MAAM;GACN,WAAW,EAAE,kBAAkB,YAAY,CACzC,kEAAkE,kBAAkB,kBAAkB,IACxG;GACA,aAAa,CACX,sIACA,iDACF;GACA,YAAY,CACV,uBACA,yCACF;GACA,OAAO,CACL,2HACA,4GACF;GACA,mBAAmB;IACjB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF;GACA,mBAAmB,CAAC,mBAAmB;GACvC,SACE;EACJ,EACF;CACF;CACA,4BAA4B,8BAA8B;EACxD,SAAS;EACT,WAAW;EACX,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;ACxgCA,MAAM,mCACJ;AACF,MAAM,2BACJ;AACF,MAAM,8BACJ;AACF,MAAM,sBACJ;AAMF,SAAgB,mCAAmC,SAAkB;CACnE,OAAO,IAAI,mBAAmB;EAC5B,MAAM;EACN,OAAO;GACL,SACE,WACA;GACF,YAAY,CAAC,uBAAuB,gBAAgB;GACpD,mBAAmB,CACjB,0FACA,+EACF;GACA,mBAAmB,CAAC,qBAAqB;GACzC,eAAe;IACb;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF;GACA,OAAO;IACL;IACA;IACA;GACF;EACF;EACA,OAAO;GACL;GACA;GACA;GACA;GACA;EACF;CACF,CAAC;AACH;AAEA,SAAgB,4BAA4B;CAC1C,OAAO,IAAI,mBAAmB;EAC5B,MAAM;EACN,OAAO;GACL,SAAS;GACT,YAAY,CAAC,uBAAuB,gBAAgB;GACpD,eAAe;IACb;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF;GACA,OAAO,CACL,gEACA,sGACF;EACF;EACA,OAAO;GACL;GACA;GACA;GACA;EACF;CACF,CAAC;AACH;AAEA,SAAgB,iCAAiC,SAAkB;CACjE,OAAO,IAAI,mBAAmB;EAC5B,MAAM;EACN,OAAO;GACL,SACE,WACA;GACF,YAAY;IACV;IACA;IACA;GACF;GACA,mBAAmB,CAAC,cAAc,0BAA0B;GAC5D,mBAAmB;IACjB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF;GACA,eAAe,CAAC,wBAAwB;GACxC,OAAO,CACL,wFACA,2CACF;EACF;CACF,CAAC;AACH;AAEA,SAAgB,oCAAoC,SAAkB;CACpE,OAAO,IAAI,mBAAmB;EAC5B,MAAM;EACN,OAAO;GACL,SACE,WACA;GACF,YAAY,CACV,uBACA,mGACF;GACA,mBAAmB;IACjB;IACA;IACA;GACF;GACA,mBAAmB;IACjB;IACA;IACA;GAC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AAgB,4BAA4B,SAA6B;CACvE,MAAM,wBAA8D;EAClE,QAAQ;GACN;GACA;GACA;GACA;EACF;EACA,MAAM;GACJ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF;EACA,OAAO;GACL;GACA;GACA;GACA;GACA;EACF;EACA,UAAU;GACR;GACA;GACA;GACA;EACF;EACA,QAAQ;GACN;GACA;GACA;GACA;EACF;EACA,OAAO;GACL;GACA;GACA;GACA;EACF;EACA,QAAQ;GACN;GACA;GACA;EACF;CACF;CA4BA,OAAO,IAAI,mBAAmB;EAC5B,MAAM,SAAS,QAAQ;EACvB,OAAO;GACL,SAAS,kBAAkB,QAAQ;GACnC,YAAY,CAAC,uBAAuB,gBAAgB;GACpD,mBAAmB,CACjB,+DAA+D,QAAQ,EACzE;GACA,mBAAmB,sBAAsB;GACzC,eAAe;IAlCjB,QAAQ,CACN,sHACF;IACA,MAAM,CACJ,0NACF;IACA,OAAO,CACL,kJACF;IACA,UAAU,CACR,iHACF;IACA,QAAQ,CACN,+GACF;IACA,OAAO;KACL;KACA;KACA;IACF;IACA,QAAQ,CACN,sGACF;GAY0C,EAAE;EAC5C;CACF,CAAC;AACH;AAEA,SAAgB,6BAA6B,SAAkB;CAC7D,OAAO,IAAI,mBAAmB;EAC5B,MAAM;EACN,OAAO;GACL,SACE,WACA;GACF,YAAY,CAAC,uBAAuB,gBAAgB;GACpD,mBAAmB,CAAC,cAAc,4BAA4B;GAC9D,mBAAmB;IACjB;IACA;IACA;IACA;IACA;GACF;GACA,eAAe,CACb,yJACF;GACA,OAAO,CACL,yDACA,mDACF;EACF;CACF,CAAC;AACH;AAEA,SAAgB,4BAA4B,SAAkB;CAC5D,OAAO,IAAI,mBAAmB;EAC5B,MAAM;EACN,OAAO;GACL,SACE,WACA;GACF,YAAY,CAAC,uBAAuB,gBAAgB;GACpD,mBAAmB,CACjB,cACA,oEACF;GACA,mBAAmB;IACjB;IACA;IACA;IACA;GACF;GACA,eAAe,CACb,0IACA,yIACF;GAC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