@synap-core/cli 1.11.0 → 1.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -198
- package/dist/build-info.json +6 -0
- package/dist/commands/agent-run.js +3 -2
- package/dist/commands/agent-run.js.map +1 -1
- package/dist/commands/agents.d.ts +33 -17
- package/dist/commands/agents.js +203 -237
- package/dist/commands/agents.js.map +1 -1
- package/dist/commands/app.d.ts +143 -0
- package/dist/commands/app.js +523 -0
- package/dist/commands/app.js.map +1 -0
- package/dist/commands/automate.d.ts +21 -0
- package/dist/commands/automate.js +42 -0
- package/dist/commands/automate.js.map +1 -0
- package/dist/commands/automation-schema.test.d.ts +16 -0
- package/dist/commands/automation-schema.test.js +77 -0
- package/dist/commands/automation-schema.test.js.map +1 -0
- package/dist/commands/automation.d.ts +12 -0
- package/dist/commands/automation.js +80 -35
- package/dist/commands/automation.js.map +1 -1
- package/dist/commands/bridge-setup.d.ts +14 -1
- package/dist/commands/bridge-setup.js +392 -128
- package/dist/commands/bridge-setup.js.map +1 -1
- package/dist/commands/cap-connections.d.ts +4 -4
- package/dist/commands/cap-connections.js +14 -14
- package/dist/commands/cap-connections.js.map +1 -1
- package/dist/commands/capability.d.ts +2 -0
- package/dist/commands/capability.js +218 -168
- package/dist/commands/capability.js.map +1 -1
- package/dist/commands/catalog.d.ts +275 -0
- package/dist/commands/catalog.js +481 -0
- package/dist/commands/catalog.js.map +1 -0
- package/dist/commands/cell.d.ts +155 -8
- package/dist/commands/cell.js +416 -40
- package/dist/commands/cell.js.map +1 -1
- package/dist/commands/centrality.js +1 -13
- package/dist/commands/centrality.js.map +1 -1
- package/dist/commands/connect.d.ts +38 -13
- package/dist/commands/connect.js +68 -167
- package/dist/commands/connect.js.map +1 -1
- package/dist/commands/connections.d.ts +3 -2
- package/dist/commands/connections.js +95 -25
- package/dist/commands/connections.js.map +1 -1
- package/dist/commands/context.js +7 -1
- package/dist/commands/context.js.map +1 -1
- package/dist/commands/data-extra.d.ts +34 -0
- package/dist/commands/data-extra.js +193 -23
- package/dist/commands/data-extra.js.map +1 -1
- package/dist/commands/data.d.ts +120 -2
- package/dist/commands/data.js +293 -20
- package/dist/commands/data.js.map +1 -1
- package/dist/commands/diagnose.d.ts +66 -4
- package/dist/commands/diagnose.js +285 -28
- package/dist/commands/diagnose.js.map +1 -1
- package/dist/commands/doc.d.ts +11 -4
- package/dist/commands/doc.js +39 -14
- package/dist/commands/doc.js.map +1 -1
- package/dist/commands/doctor.d.ts +112 -3
- package/dist/commands/doctor.js +657 -32
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/explain.js +5 -5
- package/dist/commands/explain.js.map +1 -1
- package/dist/commands/import.d.ts +368 -13
- package/dist/commands/import.js +1064 -54
- package/dist/commands/import.js.map +1 -1
- package/dist/commands/init.d.ts +20 -9
- package/dist/commands/init.js +433 -973
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/keys.d.ts +1 -0
- package/dist/commands/keys.js +15 -2
- package/dist/commands/keys.js.map +1 -1
- package/dist/commands/knowledge.d.ts +22 -6
- package/dist/commands/knowledge.js +117 -55
- package/dist/commands/knowledge.js.map +1 -1
- package/dist/commands/lens.d.ts +37 -1
- package/dist/commands/lens.js +192 -71
- package/dist/commands/lens.js.map +1 -1
- package/dist/commands/market-authoring.d.ts +29 -2
- package/dist/commands/market-authoring.js +348 -7
- package/dist/commands/market-authoring.js.map +1 -1
- package/dist/commands/market-official.d.ts +58 -0
- package/dist/commands/market-official.js +84 -0
- package/dist/commands/market-official.js.map +1 -0
- package/dist/commands/market.d.ts +400 -16
- package/dist/commands/market.js +1802 -146
- package/dist/commands/market.js.map +1 -1
- package/dist/commands/mcp.d.ts +60 -25
- package/dist/commands/mcp.js +251 -64
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/open.d.ts +39 -9
- package/dist/commands/open.js +80 -25
- package/dist/commands/open.js.map +1 -1
- package/dist/commands/playbook.d.ts +42 -0
- package/dist/commands/playbook.js +162 -0
- package/dist/commands/playbook.js.map +1 -0
- package/dist/commands/pod.js +1 -1
- package/dist/commands/pod.js.map +1 -1
- package/dist/commands/pods.d.ts +5 -0
- package/dist/commands/pods.js +97 -116
- package/dist/commands/pods.js.map +1 -1
- package/dist/commands/proposals-actions.d.ts +62 -0
- package/dist/commands/proposals-actions.js +143 -8
- package/dist/commands/proposals-actions.js.map +1 -1
- package/dist/commands/proposals-await.d.ts +68 -0
- package/dist/commands/proposals-await.js +248 -0
- package/dist/commands/proposals-await.js.map +1 -0
- package/dist/commands/proton-setup.d.ts +73 -0
- package/dist/commands/proton-setup.js +577 -0
- package/dist/commands/proton-setup.js.map +1 -0
- package/dist/commands/providers.d.ts +23 -0
- package/dist/commands/providers.js +126 -1
- package/dist/commands/providers.js.map +1 -1
- package/dist/commands/raycast.js +6 -2
- package/dist/commands/raycast.js.map +1 -1
- package/dist/commands/rule.d.ts +150 -0
- package/dist/commands/rule.js +447 -0
- package/dist/commands/rule.js.map +1 -0
- package/dist/commands/session-wait.d.ts +111 -0
- package/dist/commands/session-wait.js +209 -0
- package/dist/commands/session-wait.js.map +1 -0
- package/dist/commands/sessions.d.ts +52 -0
- package/dist/commands/sessions.js +478 -58
- package/dist/commands/sessions.js.map +1 -1
- package/dist/commands/skill-manage.d.ts +21 -0
- package/dist/commands/skill-manage.js +136 -19
- package/dist/commands/skill-manage.js.map +1 -1
- package/dist/commands/skills.js +16 -0
- package/dist/commands/skills.js.map +1 -1
- package/dist/commands/status.d.ts +1 -4
- package/dist/commands/status.js +5 -34
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/statusline.backoff.test.d.ts +13 -0
- package/dist/commands/statusline.backoff.test.js +100 -0
- package/dist/commands/statusline.backoff.test.js.map +1 -0
- package/dist/commands/statusline.js +16 -9
- package/dist/commands/statusline.js.map +1 -1
- package/dist/commands/sync-status.d.ts +12 -0
- package/dist/commands/sync-status.js +125 -0
- package/dist/commands/sync-status.js.map +1 -0
- package/dist/commands/templates-retire.d.ts +34 -0
- package/dist/commands/templates-retire.js +192 -0
- package/dist/commands/templates-retire.js.map +1 -0
- package/dist/commands/tools.js +6 -21
- package/dist/commands/tools.js.map +1 -1
- package/dist/commands/tracks.d.ts +51 -0
- package/dist/commands/tracks.js +291 -0
- package/dist/commands/tracks.js.map +1 -0
- package/dist/commands/update.d.ts +3 -11
- package/dist/commands/update.js +5 -134
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/upload.d.ts +41 -3
- package/dist/commands/upload.js +120 -18
- package/dist/commands/upload.js.map +1 -1
- package/dist/commands/vendor.d.ts +28 -0
- package/dist/commands/vendor.js +110 -0
- package/dist/commands/vendor.js.map +1 -0
- package/dist/commands/versions.js +6 -0
- package/dist/commands/versions.js.map +1 -1
- package/dist/commands/view.js +10 -5
- package/dist/commands/view.js.map +1 -1
- package/dist/commands/whoami.d.ts +23 -3
- package/dist/commands/whoami.js +169 -23
- package/dist/commands/whoami.js.map +1 -1
- package/dist/commands/worker.d.ts +122 -0
- package/dist/commands/worker.js +435 -0
- package/dist/commands/worker.js.map +1 -0
- package/dist/commands/worker.test.d.ts +1 -0
- package/dist/commands/worker.test.js +116 -0
- package/dist/commands/worker.test.js.map +1 -0
- package/dist/commands/workspace-ops.d.ts +35 -0
- package/dist/commands/workspace-ops.js +153 -0
- package/dist/commands/workspace-ops.js.map +1 -0
- package/dist/index.d.ts +6 -6
- package/dist/index.js +900 -180
- package/dist/index.js.map +1 -1
- package/dist/lib/agent-connections.d.ts +31 -0
- package/dist/lib/agent-connections.js +33 -0
- package/dist/lib/agent-connections.js.map +1 -0
- package/dist/lib/agent-detect.d.ts +27 -0
- package/dist/lib/agent-detect.js +71 -0
- package/dist/lib/agent-detect.js.map +1 -0
- package/dist/lib/agent-door.d.ts +138 -0
- package/dist/lib/agent-door.js +426 -0
- package/dist/lib/agent-door.js.map +1 -0
- package/dist/lib/agents-config.d.ts +2 -0
- package/dist/lib/agents-config.js +4 -9
- package/dist/lib/agents-config.js.map +1 -1
- package/dist/lib/approval-poll.d.ts +31 -2
- package/dist/lib/approval-poll.js +20 -7
- package/dist/lib/approval-poll.js.map +1 -1
- package/dist/lib/atomic-file.d.ts +48 -0
- package/dist/lib/atomic-file.js +129 -0
- package/dist/lib/atomic-file.js.map +1 -0
- package/dist/lib/auth.d.ts +14 -9
- package/dist/lib/auth.js +44 -61
- package/dist/lib/auth.js.map +1 -1
- package/dist/lib/batch-approval.d.ts +85 -0
- package/dist/lib/batch-approval.js +170 -0
- package/dist/lib/batch-approval.js.map +1 -0
- package/dist/lib/capture-lane.d.ts +6 -5
- package/dist/lib/capture-lane.js +6 -5
- package/dist/lib/capture-lane.js.map +1 -1
- package/dist/lib/capture-structure.d.ts +230 -11
- package/dist/lib/capture-structure.js +251 -13
- package/dist/lib/capture-structure.js.map +1 -1
- package/dist/lib/catalog-templates.d.ts +59 -0
- package/dist/lib/catalog-templates.js +126 -0
- package/dist/lib/catalog-templates.js.map +1 -0
- package/dist/lib/cli-build.d.ts +19 -0
- package/dist/lib/cli-build.js +37 -0
- package/dist/lib/cli-build.js.map +1 -0
- package/dist/lib/conversation-headers.d.ts +18 -0
- package/dist/lib/conversation-headers.js +32 -0
- package/dist/lib/conversation-headers.js.map +1 -0
- package/dist/lib/cp-packages.d.ts +167 -11
- package/dist/lib/cp-packages.js +253 -21
- package/dist/lib/cp-packages.js.map +1 -1
- package/dist/lib/credential-class.d.ts +117 -0
- package/dist/lib/credential-class.js +116 -0
- package/dist/lib/credential-class.js.map +1 -0
- package/dist/lib/describe-lens.d.ts +35 -0
- package/dist/lib/describe-lens.js +40 -0
- package/dist/lib/describe-lens.js.map +1 -1
- package/dist/lib/device-connect.d.ts +125 -0
- package/dist/lib/device-connect.js +256 -0
- package/dist/lib/device-connect.js.map +1 -0
- package/dist/lib/directory-lens.d.ts +99 -0
- package/dist/lib/directory-lens.js +187 -0
- package/dist/lib/directory-lens.js.map +1 -0
- package/dist/lib/exporter-coverage.d.ts +71 -0
- package/dist/lib/exporter-coverage.js +97 -0
- package/dist/lib/exporter-coverage.js.map +1 -0
- package/dist/lib/hub-client.d.ts +29 -8
- package/dist/lib/hub-client.js +328 -55
- package/dist/lib/hub-client.js.map +1 -1
- package/dist/lib/init-connect.d.ts +41 -0
- package/dist/lib/init-connect.js +75 -0
- package/dist/lib/init-connect.js.map +1 -0
- package/dist/lib/init-exit.d.ts +24 -0
- package/dist/lib/init-exit.js +41 -0
- package/dist/lib/init-exit.js.map +1 -0
- package/dist/lib/init-flow.d.ts +25 -0
- package/dist/lib/init-flow.js +40 -0
- package/dist/lib/init-flow.js.map +1 -0
- package/dist/lib/init-handoff.d.ts +16 -0
- package/dist/lib/init-handoff.js +19 -0
- package/dist/lib/init-handoff.js.map +1 -0
- package/dist/lib/init-output.d.ts +18 -0
- package/dist/lib/init-output.js +43 -0
- package/dist/lib/init-output.js.map +1 -0
- package/dist/lib/init-pod.d.ts +45 -0
- package/dist/lib/init-pod.js +36 -0
- package/dist/lib/init-pod.js.map +1 -0
- package/dist/lib/installed.d.ts +210 -11
- package/dist/lib/installed.js +234 -36
- package/dist/lib/installed.js.map +1 -1
- package/dist/lib/key-approval.d.ts +57 -0
- package/dist/lib/key-approval.js +117 -0
- package/dist/lib/key-approval.js.map +1 -0
- package/dist/lib/key-diagnosis.d.ts +56 -0
- package/dist/lib/key-diagnosis.js +227 -0
- package/dist/lib/key-diagnosis.js.map +1 -0
- package/dist/lib/key-doctor.d.ts +136 -0
- package/dist/lib/key-doctor.js +286 -0
- package/dist/lib/key-doctor.js.map +1 -0
- package/dist/lib/key-locations.d.ts +120 -0
- package/dist/lib/key-locations.js +326 -0
- package/dist/lib/key-locations.js.map +1 -0
- package/dist/lib/key-source.d.ts +66 -0
- package/dist/lib/key-source.js +106 -0
- package/dist/lib/key-source.js.map +1 -0
- package/dist/lib/key-state.d.ts +70 -0
- package/dist/lib/key-state.js +115 -0
- package/dist/lib/key-state.js.map +1 -0
- package/dist/lib/kind-package.d.ts +181 -0
- package/dist/lib/kind-package.js +679 -0
- package/dist/lib/kind-package.js.map +1 -0
- package/dist/lib/knowledge-title.d.ts +24 -0
- package/dist/lib/knowledge-title.js +46 -0
- package/dist/lib/knowledge-title.js.map +1 -0
- package/dist/lib/knowledge-title.test.d.ts +1 -0
- package/dist/lib/knowledge-title.test.js +34 -0
- package/dist/lib/knowledge-title.test.js.map +1 -0
- package/dist/lib/machine-instance.d.ts +64 -0
- package/dist/lib/machine-instance.js +142 -0
- package/dist/lib/machine-instance.js.map +1 -0
- package/dist/lib/mcp-bridge.d.ts +42 -0
- package/dist/lib/mcp-bridge.js +147 -0
- package/dist/lib/mcp-bridge.js.map +1 -0
- package/dist/lib/mcp-bridge.test.d.ts +1 -0
- package/dist/lib/mcp-bridge.test.js +90 -0
- package/dist/lib/mcp-bridge.test.js.map +1 -0
- package/dist/lib/mcp-call.d.ts +30 -0
- package/dist/lib/mcp-call.js +107 -0
- package/dist/lib/mcp-call.js.map +1 -0
- package/dist/lib/mcp-snippets.d.ts +53 -0
- package/dist/lib/mcp-snippets.js +82 -0
- package/dist/lib/mcp-snippets.js.map +1 -0
- package/dist/lib/next-steps.d.ts +8 -0
- package/dist/lib/next-steps.js +31 -1
- package/dist/lib/next-steps.js.map +1 -1
- package/dist/lib/package-wire.d.ts +179 -0
- package/dist/lib/package-wire.js +68 -0
- package/dist/lib/package-wire.js.map +1 -0
- package/dist/lib/pair-link.d.ts +38 -0
- package/dist/lib/pair-link.js +68 -0
- package/dist/lib/pair-link.js.map +1 -0
- package/dist/lib/pod-wide.d.ts +40 -0
- package/dist/lib/pod-wide.js +46 -0
- package/dist/lib/pod-wide.js.map +1 -0
- package/dist/lib/pod.d.ts +66 -112
- package/dist/lib/pod.js +134 -412
- package/dist/lib/pod.js.map +1 -1
- package/dist/lib/project-ref.d.ts +9 -3
- package/dist/lib/project-ref.js +10 -4
- package/dist/lib/project-ref.js.map +1 -1
- package/dist/lib/review-credential.d.ts +119 -0
- package/dist/lib/review-credential.js +147 -0
- package/dist/lib/review-credential.js.map +1 -0
- package/dist/lib/safe-open.d.ts +49 -0
- package/dist/lib/safe-open.js +119 -0
- package/dist/lib/safe-open.js.map +1 -0
- package/dist/lib/session-lens.d.ts +40 -1
- package/dist/lib/session-lens.js +54 -4
- package/dist/lib/session-lens.js.map +1 -1
- package/dist/lib/superwhisper-import.d.ts +8 -0
- package/dist/lib/superwhisper-import.js +14 -7
- package/dist/lib/superwhisper-import.js.map +1 -1
- package/dist/lib/superwhisper-title.test.d.ts +1 -0
- package/dist/lib/superwhisper-title.test.js +18 -0
- package/dist/lib/superwhisper-title.test.js.map +1 -0
- package/dist/lib/targets.d.ts +134 -10
- package/dist/lib/targets.js +962 -258
- package/dist/lib/targets.js.map +1 -1
- package/dist/lib/template-file.d.ts +4 -0
- package/dist/lib/template-file.js.map +1 -1
- package/dist/lib/template-lifecycle.d.ts +217 -0
- package/dist/lib/template-lifecycle.js +433 -0
- package/dist/lib/template-lifecycle.js.map +1 -0
- package/dist/lib/template-steps.d.ts +88 -0
- package/dist/lib/template-steps.js +118 -0
- package/dist/lib/template-steps.js.map +1 -0
- package/dist/lib/time-ago.d.ts +2 -0
- package/dist/lib/time-ago.js +15 -0
- package/dist/lib/time-ago.js.map +1 -0
- package/dist/utils/logger.js +5 -2
- package/dist/utils/logger.js.map +1 -1
- package/package.json +23 -17
- package/skills/README.md +12 -10
- package/skills/agent-os/SKILL.md +214 -99
- package/skills/manifest.json +1 -1
- package/skills/onboard/SKILL.md +55 -26
- package/skills/synap/README.md +5 -8
- package/skills/synap/SKILL.md +1086 -283
- package/skills/synap/_order.txt +7 -0
- package/skills/synap/_skill.yaml +1 -1
- package/skills/synap/automations.md +15 -0
- package/skills/synap/capture.md +5 -0
- package/skills/synap/cli-operations.md +24 -18
- package/skills/synap/concepts.md +28 -0
- package/skills/synap/content-os.md +10 -1
- package/skills/synap/creative-loop.md +15 -10
- package/skills/synap/crm.md +21 -52
- package/skills/synap/document-embeds.md +141 -47
- package/skills/synap/escalation-ladder.md +20 -10
- package/skills/synap/focus-sessions.md +47 -21
- package/skills/synap/from-intent.md +142 -0
- package/skills/synap/governance-rules.md +4 -4
- package/skills/synap/governance.md +10 -7
- package/skills/synap/hand-off.md +33 -0
- package/skills/synap/inline-patterns.md +15 -7
- package/skills/synap/lenses.md +33 -15
- package/skills/synap/linking.md +41 -40
- package/skills/synap/mcp-remote-servers.md +64 -0
- package/skills/synap/mental-model.md +17 -15
- package/skills/synap/operating-mode-rules.md +1 -1
- package/skills/synap/processes.md +118 -0
- package/skills/synap/quick-reference.md +5 -1
- package/skills/synap/reading.md +3 -1
- package/skills/synap/reflexes.md +12 -42
- package/skills/synap/viewframe-cells.md +38 -5
- package/skills/synap/work-flow.md +1 -1
- package/skills/synap/work-model.md +96 -0
- package/skills/synap/worked-examples.md +4 -5
- package/skills/synap/workspace-design.md +14 -10
- package/skills/synap/writes.md +97 -24
- package/skills/synap/writing-titles.md +63 -0
- package/skills/synap-app/SKILL.md +2 -2
- package/skills/synap-app/_skill.yaml +1 -1
- package/skills/synap-app/install-commands.md +1 -1
- package/skills/synap-design/SKILL.md +474 -0
- package/skills/synap-design/_order.txt +4 -0
- package/skills/synap-design/_skill.yaml +21 -0
- package/skills/synap-design/loop.md +134 -0
- package/skills/synap-design/overview.md +44 -0
- package/skills/synap-design/principles.md +130 -0
- package/skills/synap-design/system.md +133 -0
- package/skills/synap-market/SKILL.md +306 -16
- package/skills/synap-market/_skill.yaml +1 -1
- package/skills/synap-market/author-and-publish.md +145 -8
- package/skills/synap-market/governance-and-catalog.md +7 -0
- package/skills/synap-market/install.md +79 -1
- package/skills/synap-market/overview.md +74 -6
- package/skills/synap-schema/SKILL.md +172 -10
- package/skills/synap-schema/_order.txt +2 -0
- package/skills/synap-schema/_skill.yaml +4 -2
- package/skills/synap-schema/common-mistakes.md +4 -2
- package/skills/synap-schema/discover-profiles.md +1 -1
- package/skills/synap-schema/entity-scope.md +15 -3
- package/skills/synap-schema/extend-first.md +29 -0
- package/skills/synap-schema/extend-vs-create.md +1 -1
- package/skills/synap-schema/intent-vocabulary-ssot.md +111 -0
- package/skills/synap-schema/property-types.md +1 -1
- package/skills/synap-schema/relations.md +1 -1
- package/skills/synap-ui/SKILL.md +19 -12
- package/skills/synap-ui/_skill.yaml +1 -1
- package/skills/synap-ui/ai-companion.md +1 -1
- package/skills/synap-ui/arranging-bento.md +2 -0
- package/skills/synap-ui/bento-layouts.md +10 -10
- package/skills/synap-ui/bento-recipes.md +313 -543
- package/skills/synap-ui/four-builds.md +5 -0
- package/skills/synap-ui/view-types.md +2 -2
- package/skills/synap-ui/widget-catalog.md +22 -278
- package/templates/automations/bookmark-enrichment.automation.json +290 -13
- package/templates/automations/url-bookmark-capture.automation.json +73 -11
- package/templates/skills/authoring-playbooks/SKILL.md +6 -3
- package/templates/skills/authoring-playbooks/reference/stages-contract.md +15 -0
- package/templates/skills/authoring-playbooks/reference/worked-example.md +3 -0
- package/dist/commands/infra.d.ts +0 -21
- package/dist/commands/infra.js +0 -262
- package/dist/commands/infra.js.map +0 -1
- package/dist/commands/template.d.ts +0 -42
- package/dist/commands/template.js +0 -191
- package/dist/commands/template.js.map +0 -1
- package/dist/lib/browser-auth.d.ts +0 -35
- package/dist/lib/browser-auth.js +0 -170
- package/dist/lib/browser-auth.js.map +0 -1
- package/dist/lib/openclaw.d.ts +0 -32
- package/dist/lib/openclaw.js +0 -164
- package/dist/lib/openclaw.js.map +0 -1
- package/dist/lib/seed.d.ts +0 -13
- package/dist/lib/seed.js +0 -135
- package/dist/lib/seed.js.map +0 -1
- package/node_modules/@synap/hub-rest-client/dist/index.cjs +0 -1261
- package/node_modules/@synap/hub-rest-client/dist/index.d.cts +0 -1647
- package/node_modules/@synap/hub-rest-client/dist/index.d.ts +0 -1647
- package/node_modules/@synap/hub-rest-client/dist/index.js +0 -1231
- package/node_modules/@synap/hub-rest-client/package.json +0 -45
- package/node_modules/@synap/hub-rest-client/src/client.ts +0 -1631
- package/node_modules/@synap/hub-rest-client/src/errors.ts +0 -30
- package/node_modules/@synap/hub-rest-client/src/index.ts +0 -153
- package/node_modules/@synap/hub-rest-client/src/setup.ts +0 -133
- package/node_modules/@synap/hub-rest-client/src/types.ts +0 -1299
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The agents step of `synap init`: approve every key in one step FIRST, then
|
|
3
|
+
* install each agent, one line per agent ("✓ Codex connected"). An install's
|
|
4
|
+
* own output is shown only when it failed.
|
|
5
|
+
*
|
|
6
|
+
* "connected" is printed only after `confirm` read back the key the install
|
|
7
|
+
* wrote and the pod said it works (`confirmSurfaceKey`). A pod "no" prints the
|
|
8
|
+
* doctor's diagnosis; a check that could not run prints "? … could not
|
|
9
|
+
* confirm". Either way the agent counts as not connected.
|
|
10
|
+
*
|
|
11
|
+
* The approve, install and confirm doors are injected so the order and the
|
|
12
|
+
* per-agent outcome are testable without a pod.
|
|
13
|
+
*/
|
|
14
|
+
import type { TargetName } from "./targets.js";
|
|
15
|
+
import type { BatchApprovalResult } from "./batch-approval.js";
|
|
16
|
+
import type { SetupCheck } from "./key-doctor.js";
|
|
17
|
+
export interface InstallOutcome {
|
|
18
|
+
ok: boolean;
|
|
19
|
+
/** What the installer printed; replayed only on failure. */
|
|
20
|
+
output: string;
|
|
21
|
+
error?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ConnectAgentsDeps<T extends TargetName> {
|
|
24
|
+
approve: (targets: readonly T[]) => Promise<BatchApprovalResult>;
|
|
25
|
+
install: (target: T) => Promise<InstallOutcome>;
|
|
26
|
+
/** Read back what the install wrote and ask the pod (`confirmSurfaceKey`). */
|
|
27
|
+
confirm: (target: T) => Promise<SetupCheck>;
|
|
28
|
+
labelOf: (target: T) => string;
|
|
29
|
+
}
|
|
30
|
+
export interface ConnectAgentsResult<T extends TargetName> {
|
|
31
|
+
connected: T[];
|
|
32
|
+
notApproved: T[];
|
|
33
|
+
failed: T[];
|
|
34
|
+
}
|
|
35
|
+
export declare function retryCommand(target: TargetName): string;
|
|
36
|
+
/**
|
|
37
|
+
* The ONE place a setup prints "<Agent> connected": only for a confirmed key.
|
|
38
|
+
* Returns whether the agent counts as connected.
|
|
39
|
+
*/
|
|
40
|
+
export declare function reportSetupCheck(label: string, check: SetupCheck, connectedLine?: string): boolean;
|
|
41
|
+
export declare function connectAgents<T extends TargetName>(picked: readonly T[], deps: ConnectAgentsDeps<T>): Promise<ConnectAgentsResult<T>>;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The agents step of `synap init`: approve every key in one step FIRST, then
|
|
3
|
+
* install each agent, one line per agent ("✓ Codex connected"). An install's
|
|
4
|
+
* own output is shown only when it failed.
|
|
5
|
+
*
|
|
6
|
+
* "connected" is printed only after `confirm` read back the key the install
|
|
7
|
+
* wrote and the pod said it works (`confirmSurfaceKey`). A pod "no" prints the
|
|
8
|
+
* doctor's diagnosis; a check that could not run prints "? … could not
|
|
9
|
+
* confirm". Either way the agent counts as not connected.
|
|
10
|
+
*
|
|
11
|
+
* The approve, install and confirm doors are injected so the order and the
|
|
12
|
+
* per-agent outcome are testable without a pod.
|
|
13
|
+
*/
|
|
14
|
+
import chalk from "chalk";
|
|
15
|
+
import { log } from "../utils/logger.js";
|
|
16
|
+
export function retryCommand(target) {
|
|
17
|
+
return chalk.cyan(`synap connect --target=${target}`);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The ONE place a setup prints "<Agent> connected": only for a confirmed key.
|
|
21
|
+
* Returns whether the agent counts as connected.
|
|
22
|
+
*/
|
|
23
|
+
export function reportSetupCheck(label, check, connectedLine = `${label} connected`) {
|
|
24
|
+
if (check.verdict === "active") {
|
|
25
|
+
log.success(connectedLine);
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
if (check.verdict === "unchecked") {
|
|
29
|
+
log.success(`${label} set up — not checked: ${check.reason}`);
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
if (check.verdict === "unconfirmed") {
|
|
33
|
+
// A failed check, not a dead key: "?" as the doctor prints it. Still not
|
|
34
|
+
// counted as connected, so a script's exit code sees it.
|
|
35
|
+
console.error(chalk.yellow(` ? ${label} set up — could not confirm: ${check.reason}`));
|
|
36
|
+
log.hint("→ synap doctor");
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
log.warn(`${check.title} — not connected.`);
|
|
40
|
+
if (check.command)
|
|
41
|
+
log.hint(`→ ${check.command}`);
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
export async function connectAgents(picked, deps) {
|
|
45
|
+
const result = { connected: [], notApproved: [], failed: [] };
|
|
46
|
+
if (picked.length === 0)
|
|
47
|
+
return result;
|
|
48
|
+
const { notApproved, reasons } = await deps.approve(picked);
|
|
49
|
+
for (const target of picked) {
|
|
50
|
+
const label = deps.labelOf(target);
|
|
51
|
+
if (notApproved.includes(target)) {
|
|
52
|
+
log.warn(`${label} wasn't approved. Retry: ${retryCommand(target)}`);
|
|
53
|
+
const why = reasons[target];
|
|
54
|
+
if (why)
|
|
55
|
+
log.dim(why);
|
|
56
|
+
result.notApproved.push(target);
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
const outcome = await deps.install(target);
|
|
60
|
+
if (!outcome.ok) {
|
|
61
|
+
if (outcome.output)
|
|
62
|
+
process.stdout.write(outcome.output);
|
|
63
|
+
const why = outcome.error ? `: ${outcome.error.replace(/\.$/, "")}.` : ".";
|
|
64
|
+
log.warn(`${label} wasn't connected${why} Retry: ${retryCommand(target)}`);
|
|
65
|
+
result.failed.push(target);
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (reportSetupCheck(label, await deps.confirm(target)))
|
|
69
|
+
result.connected.push(target);
|
|
70
|
+
else
|
|
71
|
+
result.failed.push(target);
|
|
72
|
+
}
|
|
73
|
+
return result;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=init-connect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":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AW,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YAC3E,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC3B,SAAS;QACX,CAAC;QACD,IAAI,gBAAgB,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAAE,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;;YAClF,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `synap init` exit codes: ONE table, read by init and by its --help text,
|
|
3
|
+
* so a script can tell "no pod" from "cancelled" from "no agent connected".
|
|
4
|
+
*/
|
|
5
|
+
export declare const INIT_EXIT: {
|
|
6
|
+
readonly ok: 0;
|
|
7
|
+
readonly usage: 2;
|
|
8
|
+
readonly noPod: 3;
|
|
9
|
+
readonly cancelled: 4;
|
|
10
|
+
readonly noKey: 5;
|
|
11
|
+
readonly noAgent: 6;
|
|
12
|
+
};
|
|
13
|
+
export type InitExitCode = (typeof INIT_EXIT)[keyof typeof INIT_EXIT];
|
|
14
|
+
export declare const INIT_EXIT_HELP: string;
|
|
15
|
+
/**
|
|
16
|
+
* A setup step that cannot continue: init prints `message` (unless the step
|
|
17
|
+
* already `shown` it in its own words), puts it in the `--json` summary, and
|
|
18
|
+
* exits with `code`.
|
|
19
|
+
*/
|
|
20
|
+
export declare class InitExit extends Error {
|
|
21
|
+
readonly code: InitExitCode;
|
|
22
|
+
readonly shown: boolean;
|
|
23
|
+
constructor(code: InitExitCode, message: string, shown?: boolean);
|
|
24
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `synap init` exit codes: ONE table, read by init and by its --help text,
|
|
3
|
+
* so a script can tell "no pod" from "cancelled" from "no agent connected".
|
|
4
|
+
*/
|
|
5
|
+
export const INIT_EXIT = {
|
|
6
|
+
ok: 0,
|
|
7
|
+
usage: 2,
|
|
8
|
+
noPod: 3,
|
|
9
|
+
cancelled: 4,
|
|
10
|
+
noKey: 5,
|
|
11
|
+
noAgent: 6,
|
|
12
|
+
};
|
|
13
|
+
const MEANING = {
|
|
14
|
+
ok: "at least one agent connected",
|
|
15
|
+
usage: "not a terminal, or a bad flag (pass --pod-url and --agents)",
|
|
16
|
+
noPod: "no pod found, created or reachable",
|
|
17
|
+
cancelled: "cancelled",
|
|
18
|
+
noKey: "could not get your key for the pod (pass --api-key)",
|
|
19
|
+
noAgent: "the pod is ready but no agent was connected",
|
|
20
|
+
};
|
|
21
|
+
export const INIT_EXIT_HELP = "\nExit codes:\n" +
|
|
22
|
+
Object.keys(INIT_EXIT)
|
|
23
|
+
.map((k) => ` ${INIT_EXIT[k]} ${MEANING[k]}`)
|
|
24
|
+
.join("\n") +
|
|
25
|
+
"\n";
|
|
26
|
+
/**
|
|
27
|
+
* A setup step that cannot continue: init prints `message` (unless the step
|
|
28
|
+
* already `shown` it in its own words), puts it in the `--json` summary, and
|
|
29
|
+
* exits with `code`.
|
|
30
|
+
*/
|
|
31
|
+
export class InitExit extends Error {
|
|
32
|
+
code;
|
|
33
|
+
shown;
|
|
34
|
+
constructor(code, message, shown = false) {
|
|
35
|
+
super(message);
|
|
36
|
+
this.code = code;
|
|
37
|
+
this.shown = shown;
|
|
38
|
+
this.name = "InitExit";
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=init-exit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-exit.js","sourceRoot":"","sources":["../../src/lib/init-exit.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,EAAE,EAAE,CAAC;IACL,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,SAAS,EAAE,CAAC;IACZ,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,CAAC;CACF,CAAC;AAIX,MAAM,OAAO,GAA2C;IACtD,EAAE,EAAE,8BAA8B;IAClC,KAAK,EAAE,6DAA6D;IACpE,KAAK,EAAE,oCAAoC;IAC3C,SAAS,EAAE,WAAW;IACtB,KAAK,EAAE,qDAAqD;IAC5D,OAAO,EAAE,6CAA6C;CACvD,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GACzB,iBAAiB;IAChB,MAAM,CAAC,IAAI,CAAC,SAAS,CAAmC;SACtD,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;SAC9C,IAAI,CAAC,IAAI,CAAC;IACb,IAAI,CAAC;AAEP;;;;GAIG;AACH,MAAM,OAAO,QAAS,SAAQ,KAAK;IAEtB;IAEA;IAHX,YACW,IAAkB,EAC3B,OAAe,EACN,QAAQ,KAAK;QAEtB,KAAK,CAAC,OAAO,CAAC,CAAC;QAJN,SAAI,GAAJ,IAAI,CAAc;QAElB,UAAK,GAAL,KAAK,CAAQ;QAGtB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `synap init` decisions that don't need a terminal: how the first key for a
|
|
3
|
+
* pod is offered. Pure, so they can be
|
|
4
|
+
* tested without spawning the CLI.
|
|
5
|
+
*/
|
|
6
|
+
/** A pod Synap hosts (`*.synap.live`): never on this machine, never has a .env. */
|
|
7
|
+
export declare function isManagedPod(podUrl: string): boolean;
|
|
8
|
+
export type KeyChoice = "device" | "paste";
|
|
9
|
+
/**
|
|
10
|
+
* How to get the first key for a pod, in order. Connecting this computer first
|
|
11
|
+
* (the pod's device flow: a code approved on any device, on self-hosted and
|
|
12
|
+
* managed pods alike); pasting a key is the advanced way. The PROVISIONING_TOKEN
|
|
13
|
+
* is never offered: it is bootstrap-only on the pod (D9) and stops minting keys
|
|
14
|
+
* once the pod has an owner. A pod that cannot run the device flow (too old) is
|
|
15
|
+
* not offered it again; after a denied or expired code it is offered as a retry.
|
|
16
|
+
*/
|
|
17
|
+
export declare function keyChoices(input: {
|
|
18
|
+
managed: boolean;
|
|
19
|
+
deviceTried: boolean;
|
|
20
|
+
deviceAvailable: boolean;
|
|
21
|
+
}): Array<{
|
|
22
|
+
title: string;
|
|
23
|
+
description: string;
|
|
24
|
+
value: KeyChoice;
|
|
25
|
+
}>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `synap init` decisions that don't need a terminal: how the first key for a
|
|
3
|
+
* pod is offered. Pure, so they can be
|
|
4
|
+
* tested without spawning the CLI.
|
|
5
|
+
*/
|
|
6
|
+
/** A pod Synap hosts (`*.synap.live`): never on this machine, never has a .env. */
|
|
7
|
+
export function isManagedPod(podUrl) {
|
|
8
|
+
try {
|
|
9
|
+
const host = new URL(podUrl).hostname;
|
|
10
|
+
return host === "synap.live" || host.endsWith(".synap.live");
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* How to get the first key for a pod, in order. Connecting this computer first
|
|
18
|
+
* (the pod's device flow: a code approved on any device, on self-hosted and
|
|
19
|
+
* managed pods alike); pasting a key is the advanced way. The PROVISIONING_TOKEN
|
|
20
|
+
* is never offered: it is bootstrap-only on the pod (D9) and stops minting keys
|
|
21
|
+
* once the pod has an owner. A pod that cannot run the device flow (too old) is
|
|
22
|
+
* not offered it again; after a denied or expired code it is offered as a retry.
|
|
23
|
+
*/
|
|
24
|
+
export function keyChoices(input) {
|
|
25
|
+
const choices = [];
|
|
26
|
+
if (input.deviceAvailable) {
|
|
27
|
+
choices.push({
|
|
28
|
+
title: input.deviceTried ? "Connect this computer again (new code)" : "Connect this computer (recommended)",
|
|
29
|
+
description: "Gives you a link and a code. Approve it from any device.",
|
|
30
|
+
value: "device",
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
choices.push({
|
|
34
|
+
title: "Advanced: paste an API key",
|
|
35
|
+
description: "From your pod: Settings → API keys",
|
|
36
|
+
value: "paste",
|
|
37
|
+
});
|
|
38
|
+
return choices;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=init-flow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-flow.js","sourceRoot":"","sources":["../../src/lib/init-flow.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,mFAAmF;AACnF,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC;QACtC,OAAO,IAAI,KAAK,YAAY,IAAI,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;IAC/D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAID;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CAAC,KAA2E;IAKpG,MAAM,OAAO,GAAoE,EAAE,CAAC;IACpF,IAAI,KAAK,CAAC,eAAe,EAAE,CAAC;QAC1B,OAAO,CAAC,IAAI,CAAC;YACX,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,wCAAwC,CAAC,CAAC,CAAC,qCAAqC;YAC3G,WAAW,EAAE,0DAA0D;YACvE,KAAK,EAAE,QAAQ;SAChB,CAAC,CAAC;IACL,CAAC;IACD,OAAO,CAAC,IAAI,CAAC;QACX,KAAK,EAAE,4BAA4B;QACnC,WAAW,EAAE,oCAAoC;QACjD,KAAK,EAAE,OAAO;KACf,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The last thing `synap init` prints: one real task to hand the agent, verbatim.
|
|
3
|
+
*
|
|
4
|
+
* The first prompt exercises the whole loop — the agent works in a session,
|
|
5
|
+
* saves what it finds, then ASKS the person (the question lands on their phone)
|
|
6
|
+
* and resumes on the answer.
|
|
7
|
+
*/
|
|
8
|
+
export interface Handoff {
|
|
9
|
+
/** The agent to open, e.g. "Claude Code". */
|
|
10
|
+
agentLabel: string;
|
|
11
|
+
/** The prompt to paste into the agent, verbatim. */
|
|
12
|
+
prompt: string;
|
|
13
|
+
/** Two shorter follow-ups. */
|
|
14
|
+
more: string[];
|
|
15
|
+
}
|
|
16
|
+
export declare function buildHandoff(connectedLabels: readonly string[]): Handoff;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The last thing `synap init` prints: one real task to hand the agent, verbatim.
|
|
3
|
+
*
|
|
4
|
+
* The first prompt exercises the whole loop — the agent works in a session,
|
|
5
|
+
* saves what it finds, then ASKS the person (the question lands on their phone)
|
|
6
|
+
* and resumes on the answer.
|
|
7
|
+
*/
|
|
8
|
+
export function buildHandoff(connectedLabels) {
|
|
9
|
+
return {
|
|
10
|
+
agentLabel: connectedLabels[0] ?? "your agent",
|
|
11
|
+
prompt: "Use Synap. Research 10 competitors to <your product>, save them, " +
|
|
12
|
+
"and ask me which 3 to contact.",
|
|
13
|
+
more: [
|
|
14
|
+
"Use Synap. Draft a short outreach email to the 3 I picked, and ask me before sending.",
|
|
15
|
+
"Use Synap. Find duplicate contacts in my CRM and ask me which to merge.",
|
|
16
|
+
],
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=init-handoff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-handoff.js","sourceRoot":"","sources":["../../src/lib/init-handoff.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAWH,MAAM,UAAU,YAAY,CAAC,eAAkC;IAC7D,OAAO;QACL,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC,IAAI,YAAY;QAC9C,MAAM,EACJ,mEAAmE;YACnE,gCAAgC;QAClC,IAAI,EAAE;YACJ,uFAAuF;YACvF,yEAAyE;SAC1E;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal plumbing for `synap init`: collapse a step's output to one line
|
|
3
|
+
* unless it fails, and keep stdout clean for `--json`.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Run `fn` with everything it writes to stdout/stderr held back. Returns the
|
|
7
|
+
* held output so the caller can replay it only when the step failed.
|
|
8
|
+
*/
|
|
9
|
+
export declare function withHeldOutput<T>(fn: () => Promise<T>): Promise<{
|
|
10
|
+
value?: T;
|
|
11
|
+
error?: unknown;
|
|
12
|
+
held: string;
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* For `--json`: send every human line to stderr for the rest of the run and
|
|
16
|
+
* return the one writer that still reaches stdout, for the JSON summary.
|
|
17
|
+
*/
|
|
18
|
+
export declare function reserveStdoutForJson(): (text: string) => void;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal plumbing for `synap init`: collapse a step's output to one line
|
|
3
|
+
* unless it fails, and keep stdout clean for `--json`.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Run `fn` with everything it writes to stdout/stderr held back. Returns the
|
|
7
|
+
* held output so the caller can replay it only when the step failed.
|
|
8
|
+
*/
|
|
9
|
+
export async function withHeldOutput(fn) {
|
|
10
|
+
const chunks = [];
|
|
11
|
+
const outWrite = process.stdout.write;
|
|
12
|
+
const errWrite = process.stderr.write;
|
|
13
|
+
const hold = ((chunk, ...rest) => {
|
|
14
|
+
chunks.push(typeof chunk === "string" ? chunk : Buffer.from(chunk).toString());
|
|
15
|
+
const cb = rest.find((r) => typeof r === "function");
|
|
16
|
+
cb?.();
|
|
17
|
+
return true;
|
|
18
|
+
});
|
|
19
|
+
process.stdout.write = hold;
|
|
20
|
+
process.stderr.write = hold;
|
|
21
|
+
try {
|
|
22
|
+
return { value: await fn(), held: chunks.join("") };
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
return { error, held: chunks.join("") };
|
|
26
|
+
}
|
|
27
|
+
finally {
|
|
28
|
+
process.stdout.write = outWrite;
|
|
29
|
+
process.stderr.write = errWrite;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* For `--json`: send every human line to stderr for the rest of the run and
|
|
34
|
+
* return the one writer that still reaches stdout, for the JSON summary.
|
|
35
|
+
*/
|
|
36
|
+
export function reserveStdoutForJson() {
|
|
37
|
+
const outWrite = process.stdout.write.bind(process.stdout);
|
|
38
|
+
process.stdout.write = process.stderr.write.bind(process.stderr);
|
|
39
|
+
return (text) => {
|
|
40
|
+
outWrite(text);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=init-output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-output.js","sourceRoot":"","sources":["../../src/lib/init-output.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAI,EAAoB;IAC1D,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;IACtC,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;IACtC,MAAM,IAAI,GAAG,CAAC,CAAC,KAA0B,EAAE,GAAG,IAAe,EAAE,EAAE;QAC/D,MAAM,CAAC,IAAI,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC/E,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,UAAU,CAA6B,CAAC;QACjF,EAAE,EAAE,EAAE,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC,CAAU,CAAC;IACZ,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC;IAC5B,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC;IAC5B,IAAI,CAAC;QACH,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;IACtD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;IAC1C,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,QAAQ,CAAC;QAChC,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,QAAQ,CAAC;IAClC,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB;IAClC,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3D,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAU,CAAC;IAC1E,OAAO,CAAC,IAAI,EAAE,EAAE;QACd,QAAQ,CAAC,IAAI,CAAC,CAAC;IACjB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `synap init` with no pod: create one in the browser and continue here.
|
|
3
|
+
*
|
|
4
|
+
* Before this, init exited with code 2 and a help box when it found no pod,
|
|
5
|
+
* so its own "create one" branch (`waitForPodCallback`) was unreachable. This
|
|
6
|
+
* is that branch, reachable: open the provision page, wait for the callback,
|
|
7
|
+
* then wait until the new pod answers `/health` — a pod that is still booting
|
|
8
|
+
* is "starting", not "failed".
|
|
9
|
+
*
|
|
10
|
+
* Deps are injected so the flow is testable without a browser or a network.
|
|
11
|
+
*/
|
|
12
|
+
export interface CreatePodDeps {
|
|
13
|
+
/** Opens synap.live's provision page and resolves with the new pod's URL. */
|
|
14
|
+
waitForPodCallback: () => Promise<{
|
|
15
|
+
podUrl: string;
|
|
16
|
+
} | null>;
|
|
17
|
+
checkPodHealth: (podUrl: string) => Promise<{
|
|
18
|
+
healthy: boolean;
|
|
19
|
+
}>;
|
|
20
|
+
sleep?: (ms: number) => Promise<void>;
|
|
21
|
+
now?: () => number;
|
|
22
|
+
}
|
|
23
|
+
export type CreatePodResult = {
|
|
24
|
+
ok: true;
|
|
25
|
+
podUrl: string;
|
|
26
|
+
}
|
|
27
|
+
/** The browser flow timed out or was closed — nothing was created that we know of. */
|
|
28
|
+
| {
|
|
29
|
+
ok: false;
|
|
30
|
+
reason: "cancelled";
|
|
31
|
+
}
|
|
32
|
+
/** The pod exists but did not answer in time. Resume with `synap init --pod-url`. */
|
|
33
|
+
| {
|
|
34
|
+
ok: false;
|
|
35
|
+
reason: "not-reachable";
|
|
36
|
+
podUrl: string;
|
|
37
|
+
};
|
|
38
|
+
export declare function waitUntilReachable(podUrl: string, deps: Pick<CreatePodDeps, "checkPodHealth" | "sleep" | "now">, opts?: {
|
|
39
|
+
timeoutMs?: number;
|
|
40
|
+
intervalMs?: number;
|
|
41
|
+
}): Promise<boolean>;
|
|
42
|
+
export declare function createPodInBrowser(deps: CreatePodDeps, opts?: {
|
|
43
|
+
timeoutMs?: number;
|
|
44
|
+
intervalMs?: number;
|
|
45
|
+
}): Promise<CreatePodResult>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `synap init` with no pod: create one in the browser and continue here.
|
|
3
|
+
*
|
|
4
|
+
* Before this, init exited with code 2 and a help box when it found no pod,
|
|
5
|
+
* so its own "create one" branch (`waitForPodCallback`) was unreachable. This
|
|
6
|
+
* is that branch, reachable: open the provision page, wait for the callback,
|
|
7
|
+
* then wait until the new pod answers `/health` — a pod that is still booting
|
|
8
|
+
* is "starting", not "failed".
|
|
9
|
+
*
|
|
10
|
+
* Deps are injected so the flow is testable without a browser or a network.
|
|
11
|
+
*/
|
|
12
|
+
const defaultSleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
13
|
+
export async function waitUntilReachable(podUrl, deps, opts = {}) {
|
|
14
|
+
const sleep = deps.sleep ?? defaultSleep;
|
|
15
|
+
const now = deps.now ?? Date.now;
|
|
16
|
+
const timeoutMs = opts.timeoutMs ?? 300_000;
|
|
17
|
+
const intervalMs = opts.intervalMs ?? 5_000;
|
|
18
|
+
const deadline = now() + timeoutMs;
|
|
19
|
+
for (;;) {
|
|
20
|
+
if ((await deps.checkPodHealth(podUrl)).healthy)
|
|
21
|
+
return true;
|
|
22
|
+
if (now() >= deadline)
|
|
23
|
+
return false;
|
|
24
|
+
await sleep(intervalMs);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export async function createPodInBrowser(deps, opts = {}) {
|
|
28
|
+
const created = await deps.waitForPodCallback();
|
|
29
|
+
if (!created?.podUrl)
|
|
30
|
+
return { ok: false, reason: "cancelled" };
|
|
31
|
+
const reachable = await waitUntilReachable(created.podUrl, deps, opts);
|
|
32
|
+
return reachable
|
|
33
|
+
? { ok: true, podUrl: created.podUrl }
|
|
34
|
+
: { ok: false, reason: "not-reachable", podUrl: created.podUrl };
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=init-pod.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-pod.js","sourceRoot":"","sources":["../../src/lib/init-pod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAiBH,MAAM,YAAY,GAAG,CAAC,EAAU,EAAE,EAA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