@cursor/july 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +290 -0
- package/LICENSE.md +3 -0
- package/README.md +1233 -0
- package/dist/ab.d.ts +290 -0
- package/dist/ab.d.ts.map +1 -0
- package/dist/ab.js +386 -0
- package/dist/bin/agent-serve.d.ts +15 -0
- package/dist/bin/agent-serve.d.ts.map +1 -0
- package/dist/bin/agent-serve.js +754 -0
- package/dist/channels/github/api.d.ts +101 -0
- package/dist/channels/github/api.d.ts.map +1 -0
- package/dist/channels/github/api.js +229 -0
- package/dist/channels/github/auth.d.ts +67 -0
- package/dist/channels/github/auth.d.ts.map +1 -0
- package/dist/channels/github/auth.js +239 -0
- package/dist/channels/github/binding.d.ts +73 -0
- package/dist/channels/github/binding.d.ts.map +1 -0
- package/dist/channels/github/binding.js +114 -0
- package/dist/channels/github/defaults.d.ts +24 -0
- package/dist/channels/github/defaults.d.ts.map +1 -0
- package/dist/channels/github/defaults.js +100 -0
- package/dist/channels/github/events.d.ts +18 -0
- package/dist/channels/github/events.d.ts.map +1 -0
- package/dist/channels/github/events.js +59 -0
- package/dist/channels/github/forward.d.ts +137 -0
- package/dist/channels/github/forward.d.ts.map +1 -0
- package/dist/channels/github/forward.js +271 -0
- package/dist/channels/github/github-channel.d.ts +127 -0
- package/dist/channels/github/github-channel.d.ts.map +1 -0
- package/dist/channels/github/github-channel.js +1688 -0
- package/dist/channels/github/index.d.ts +52 -0
- package/dist/channels/github/index.d.ts.map +1 -0
- package/dist/channels/github/index.js +51 -0
- package/dist/channels/github/replay.d.ts +115 -0
- package/dist/channels/github/replay.d.ts.map +1 -0
- package/dist/channels/github/replay.js +282 -0
- package/dist/channels/github/state.d.ts +26 -0
- package/dist/channels/github/state.d.ts.map +1 -0
- package/dist/channels/github/state.js +50 -0
- package/dist/channels/github/types.d.ts +385 -0
- package/dist/channels/github/types.d.ts.map +1 -0
- package/dist/channels/github/types.js +1 -0
- package/dist/channels/slack/api.d.ts +117 -0
- package/dist/channels/slack/api.d.ts.map +1 -0
- package/dist/channels/slack/api.js +437 -0
- package/dist/channels/slack/approvals.d.ts +32 -0
- package/dist/channels/slack/approvals.d.ts.map +1 -0
- package/dist/channels/slack/approvals.js +157 -0
- package/dist/channels/slack/assistant.d.ts +23 -0
- package/dist/channels/slack/assistant.d.ts.map +1 -0
- package/dist/channels/slack/assistant.js +67 -0
- package/dist/channels/slack/auth.d.ts +40 -0
- package/dist/channels/slack/auth.d.ts.map +1 -0
- package/dist/channels/slack/auth.js +71 -0
- package/dist/channels/slack/channel-watch.d.ts +46 -0
- package/dist/channels/slack/channel-watch.d.ts.map +1 -0
- package/dist/channels/slack/channel-watch.js +180 -0
- package/dist/channels/slack/constants.d.ts +17 -0
- package/dist/channels/slack/constants.d.ts.map +1 -0
- package/dist/channels/slack/constants.js +27 -0
- package/dist/channels/slack/credentials.d.ts +35 -0
- package/dist/channels/slack/credentials.d.ts.map +1 -0
- package/dist/channels/slack/credentials.js +88 -0
- package/dist/channels/slack/cursor-account.d.ts +76 -0
- package/dist/channels/slack/cursor-account.d.ts.map +1 -0
- package/dist/channels/slack/cursor-account.js +88 -0
- package/dist/channels/slack/defaults.d.ts +32 -0
- package/dist/channels/slack/defaults.d.ts.map +1 -0
- package/dist/channels/slack/defaults.js +380 -0
- package/dist/channels/slack/dispatch.d.ts +43 -0
- package/dist/channels/slack/dispatch.d.ts.map +1 -0
- package/dist/channels/slack/dispatch.js +185 -0
- package/dist/channels/slack/doctor.d.ts +24 -0
- package/dist/channels/slack/doctor.d.ts.map +1 -0
- package/dist/channels/slack/doctor.js +115 -0
- package/dist/channels/slack/event-id-dedupe.d.ts +10 -0
- package/dist/channels/slack/event-id-dedupe.d.ts.map +1 -0
- package/dist/channels/slack/event-id-dedupe.js +23 -0
- package/dist/channels/slack/inbound.d.ts +41 -0
- package/dist/channels/slack/inbound.d.ts.map +1 -0
- package/dist/channels/slack/inbound.js +166 -0
- package/dist/channels/slack/index.d.ts +45 -0
- package/dist/channels/slack/index.d.ts.map +1 -0
- package/dist/channels/slack/index.js +44 -0
- package/dist/channels/slack/init.d.ts +32 -0
- package/dist/channels/slack/init.d.ts.map +1 -0
- package/dist/channels/slack/init.js +82 -0
- package/dist/channels/slack/interactive.d.ts +19 -0
- package/dist/channels/slack/interactive.d.ts.map +1 -0
- package/dist/channels/slack/interactive.js +142 -0
- package/dist/channels/slack/links.d.ts +10 -0
- package/dist/channels/slack/links.d.ts.map +1 -0
- package/dist/channels/slack/links.js +19 -0
- package/dist/channels/slack/live-delivery.d.ts +75 -0
- package/dist/channels/slack/live-delivery.d.ts.map +1 -0
- package/dist/channels/slack/live-delivery.js +143 -0
- package/dist/channels/slack/log.d.ts +25 -0
- package/dist/channels/slack/log.d.ts.map +1 -0
- package/dist/channels/slack/log.js +47 -0
- package/dist/channels/slack/manifest.d.ts +57 -0
- package/dist/channels/slack/manifest.d.ts.map +1 -0
- package/dist/channels/slack/manifest.js +110 -0
- package/dist/channels/slack/pr-ref.d.ts +18 -0
- package/dist/channels/slack/pr-ref.d.ts.map +1 -0
- package/dist/channels/slack/pr-ref.js +36 -0
- package/dist/channels/slack/setup.d.ts +14 -0
- package/dist/channels/slack/setup.d.ts.map +1 -0
- package/dist/channels/slack/setup.js +86 -0
- package/dist/channels/slack/slack-channel.d.ts +15 -0
- package/dist/channels/slack/slack-channel.d.ts.map +1 -0
- package/dist/channels/slack/slack-channel.js +281 -0
- package/dist/channels/slack/socket-mode.d.ts +26 -0
- package/dist/channels/slack/socket-mode.d.ts.map +1 -0
- package/dist/channels/slack/socket-mode.js +116 -0
- package/dist/channels/slack/stream.d.ts +26 -0
- package/dist/channels/slack/stream.d.ts.map +1 -0
- package/dist/channels/slack/stream.js +39 -0
- package/dist/channels/slack/tool-approval-events.d.ts +33 -0
- package/dist/channels/slack/tool-approval-events.d.ts.map +1 -0
- package/dist/channels/slack/tool-approval-events.js +129 -0
- package/dist/channels/slack/types.d.ts +326 -0
- package/dist/channels/slack/types.d.ts.map +1 -0
- package/dist/channels/slack/types.js +4 -0
- package/dist/channels.d.ts +116 -0
- package/dist/channels.d.ts.map +1 -0
- package/dist/channels.js +294 -0
- package/dist/connections.d.ts +75 -0
- package/dist/connections.d.ts.map +1 -0
- package/dist/connections.js +75 -0
- package/dist/docs/404.html +22 -0
- package/dist/docs/ab.html +87 -0
- package/dist/docs/assets/ab.md.COdXkces.js +63 -0
- package/dist/docs/assets/ab.md.COdXkces.lean.js +1 -0
- package/dist/docs/assets/app.DqfFEmJd.js +1 -0
- package/dist/docs/assets/building-with-agents.md.CJCtZCyi.js +13 -0
- package/dist/docs/assets/building-with-agents.md.CJCtZCyi.lean.js +1 -0
- package/dist/docs/assets/chunks/@localSearchIndexroot.CcVk1uKq.js +1 -0
- package/dist/docs/assets/chunks/VPLocalSearchBox.BaLEdS15.js +9 -0
- package/dist/docs/assets/chunks/framework.CAZyNGu9.js +19 -0
- package/dist/docs/assets/chunks/theme.CZRvu_0q.js +2 -0
- package/dist/docs/assets/concepts.md.Cfb9b-k1.js +4 -0
- package/dist/docs/assets/concepts.md.Cfb9b-k1.lean.js +1 -0
- package/dist/docs/assets/deployment.md.Dx1TYNk5.js +14 -0
- package/dist/docs/assets/deployment.md.Dx1TYNk5.lean.js +1 -0
- package/dist/docs/assets/evals.md.DPZ_MAnI.js +85 -0
- package/dist/docs/assets/evals.md.DPZ_MAnI.lean.js +1 -0
- package/dist/docs/assets/guides_agent-to-agent.md.CrtrsySy.js +10 -0
- package/dist/docs/assets/guides_agent-to-agent.md.CrtrsySy.lean.js +1 -0
- package/dist/docs/assets/guides_cloud-runtime.md.CYlNMTNp.js +9 -0
- package/dist/docs/assets/guides_cloud-runtime.md.CYlNMTNp.lean.js +1 -0
- package/dist/docs/assets/guides_github.md.DwbKhCeS.js +20 -0
- package/dist/docs/assets/guides_github.md.DwbKhCeS.lean.js +1 -0
- package/dist/docs/assets/guides_human-in-the-loop.md.Dvuctx7s.js +28 -0
- package/dist/docs/assets/guides_human-in-the-loop.md.Dvuctx7s.lean.js +1 -0
- package/dist/docs/assets/guides_slack.md.bv41fHfW.js +37 -0
- package/dist/docs/assets/guides_slack.md.bv41fHfW.lean.js +1 -0
- package/dist/docs/assets/guides_webhooks.md.hFTik3lf.js +50 -0
- package/dist/docs/assets/guides_webhooks.md.hFTik3lf.lean.js +1 -0
- package/dist/docs/assets/hillclimbing.md.DHNast08.js +4 -0
- package/dist/docs/assets/hillclimbing.md.DHNast08.lean.js +1 -0
- package/dist/docs/assets/index.md.BPKcj5AI.js +20 -0
- package/dist/docs/assets/index.md.BPKcj5AI.lean.js +1 -0
- package/dist/docs/assets/inter-italic-cyrillic-ext.r48I6akx.woff2 +0 -0
- package/dist/docs/assets/inter-italic-cyrillic.By2_1cv3.woff2 +0 -0
- package/dist/docs/assets/inter-italic-greek-ext.1u6EdAuj.woff2 +0 -0
- package/dist/docs/assets/inter-italic-greek.DJ8dCoTZ.woff2 +0 -0
- package/dist/docs/assets/inter-italic-latin-ext.CN1xVJS-.woff2 +0 -0
- package/dist/docs/assets/inter-italic-latin.C2AdPX0b.woff2 +0 -0
- package/dist/docs/assets/inter-italic-vietnamese.BSbpV94h.woff2 +0 -0
- package/dist/docs/assets/inter-roman-cyrillic-ext.BBPuwvHQ.woff2 +0 -0
- package/dist/docs/assets/inter-roman-cyrillic.C5lxZ8CY.woff2 +0 -0
- package/dist/docs/assets/inter-roman-greek-ext.CqjqNYQ-.woff2 +0 -0
- package/dist/docs/assets/inter-roman-greek.BBVDIX6e.woff2 +0 -0
- package/dist/docs/assets/inter-roman-latin-ext.4ZJIpNVo.woff2 +0 -0
- package/dist/docs/assets/inter-roman-latin.Di8DUHzh.woff2 +0 -0
- package/dist/docs/assets/inter-roman-vietnamese.BjW4sHH5.woff2 +0 -0
- package/dist/docs/assets/quickstart.md.tVPiGK_L.js +35 -0
- package/dist/docs/assets/quickstart.md.tVPiGK_L.lean.js +1 -0
- package/dist/docs/assets/reference_agent-config.md.Bpd7HQwf.js +34 -0
- package/dist/docs/assets/reference_agent-config.md.Bpd7HQwf.lean.js +1 -0
- package/dist/docs/assets/reference_channels.md.D7JTR03W.js +53 -0
- package/dist/docs/assets/reference_channels.md.D7JTR03W.lean.js +1 -0
- package/dist/docs/assets/reference_cli.md.DA730zCu.js +33 -0
- package/dist/docs/assets/reference_cli.md.DA730zCu.lean.js +1 -0
- package/dist/docs/assets/reference_connections.md.C3vNH_DE.js +26 -0
- package/dist/docs/assets/reference_connections.md.C3vNH_DE.lean.js +1 -0
- package/dist/docs/assets/reference_hooks.md.BCEc3MyM.js +12 -0
- package/dist/docs/assets/reference_hooks.md.BCEc3MyM.lean.js +1 -0
- package/dist/docs/assets/reference_http-api.md.DBAahtdz.js +11 -0
- package/dist/docs/assets/reference_http-api.md.DBAahtdz.lean.js +1 -0
- package/dist/docs/assets/reference_instructions.md.BC05LEQ8.js +12 -0
- package/dist/docs/assets/reference_instructions.md.BC05LEQ8.lean.js +1 -0
- package/dist/docs/assets/reference_playground.md.CPZhfYaO.js +1 -0
- package/dist/docs/assets/reference_playground.md.CPZhfYaO.lean.js +1 -0
- package/dist/docs/assets/reference_project-layout.md.Bd_CKtNS.js +31 -0
- package/dist/docs/assets/reference_project-layout.md.Bd_CKtNS.lean.js +1 -0
- package/dist/docs/assets/reference_schedules.md.D7qijxLk.js +82 -0
- package/dist/docs/assets/reference_schedules.md.D7qijxLk.lean.js +1 -0
- package/dist/docs/assets/reference_sessions.md.DdjWabnN.js +8 -0
- package/dist/docs/assets/reference_sessions.md.DdjWabnN.lean.js +1 -0
- package/dist/docs/assets/reference_skills.md.VQnlBT3Q.js +15 -0
- package/dist/docs/assets/reference_skills.md.VQnlBT3Q.lean.js +1 -0
- package/dist/docs/assets/reference_subagents.md.CIRAVcPK.js +10 -0
- package/dist/docs/assets/reference_subagents.md.CIRAVcPK.lean.js +1 -0
- package/dist/docs/assets/reference_tools.md.DF5kwlt0.js +46 -0
- package/dist/docs/assets/reference_tools.md.DF5kwlt0.lean.js +1 -0
- package/dist/docs/assets/scaffolding-agents.md.CyYfWGdc.js +1 -0
- package/dist/docs/assets/scaffolding-agents.md.CyYfWGdc.lean.js +1 -0
- package/dist/docs/assets/style.Bj-IXa5W.css +1 -0
- package/dist/docs/assets/troubleshooting.md.DkovjS7h.js +1 -0
- package/dist/docs/assets/troubleshooting.md.DkovjS7h.lean.js +1 -0
- package/dist/docs/building-with-agents.html +37 -0
- package/dist/docs/concepts.html +28 -0
- package/dist/docs/deployment.html +38 -0
- package/dist/docs/evals.html +109 -0
- package/dist/docs/guides/agent-to-agent.html +34 -0
- package/dist/docs/guides/cloud-runtime.html +33 -0
- package/dist/docs/guides/github.html +44 -0
- package/dist/docs/guides/human-in-the-loop.html +52 -0
- package/dist/docs/guides/slack.html +61 -0
- package/dist/docs/guides/webhooks.html +74 -0
- package/dist/docs/hashmap.json +1 -0
- package/dist/docs/hillclimbing.html +28 -0
- package/dist/docs/index.html +44 -0
- package/dist/docs/quickstart.html +59 -0
- package/dist/docs/reference/agent-config.html +58 -0
- package/dist/docs/reference/channels.html +77 -0
- package/dist/docs/reference/cli.html +57 -0
- package/dist/docs/reference/connections.html +50 -0
- package/dist/docs/reference/hooks.html +36 -0
- package/dist/docs/reference/http-api.html +35 -0
- package/dist/docs/reference/instructions.html +36 -0
- package/dist/docs/reference/playground.html +25 -0
- package/dist/docs/reference/project-layout.html +55 -0
- package/dist/docs/reference/schedules.html +106 -0
- package/dist/docs/reference/sessions.html +32 -0
- package/dist/docs/reference/skills.html +39 -0
- package/dist/docs/reference/subagents.html +34 -0
- package/dist/docs/reference/tools.html +70 -0
- package/dist/docs/scaffolding-agents.html +25 -0
- package/dist/docs/troubleshooting.html +25 -0
- package/dist/docs/vp-icons.css +0 -0
- package/dist/evals.d.ts +312 -0
- package/dist/evals.d.ts.map +1 -0
- package/dist/evals.js +254 -0
- package/dist/hooks.d.ts +23 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +23 -0
- package/dist/index.d.ts +71 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +101 -0
- package/dist/internal/ab-collector.d.ts +42 -0
- package/dist/internal/ab-collector.d.ts.map +1 -0
- package/dist/internal/ab-collector.js +153 -0
- package/dist/internal/ab-fold.d.ts +36 -0
- package/dist/internal/ab-fold.d.ts.map +1 -0
- package/dist/internal/ab-fold.js +171 -0
- package/dist/internal/ab-snapshot.d.ts +70 -0
- package/dist/internal/ab-snapshot.d.ts.map +1 -0
- package/dist/internal/ab-snapshot.js +208 -0
- package/dist/internal/approval-gate.d.ts +34 -0
- package/dist/internal/approval-gate.d.ts.map +1 -0
- package/dist/internal/approval-gate.js +85 -0
- package/dist/internal/auth.d.ts +8 -0
- package/dist/internal/auth.d.ts.map +1 -0
- package/dist/internal/auth.js +27 -0
- package/dist/internal/authored-alias-hooks.d.ts +31 -0
- package/dist/internal/authored-alias-hooks.d.ts.map +1 -0
- package/dist/internal/authored-alias-hooks.js +43 -0
- package/dist/internal/authored-loaders.d.ts +25 -0
- package/dist/internal/authored-loaders.d.ts.map +1 -0
- package/dist/internal/authored-loaders.js +129 -0
- package/dist/internal/bounded-int.d.ts +11 -0
- package/dist/internal/bounded-int.d.ts.map +1 -0
- package/dist/internal/bounded-int.js +13 -0
- package/dist/internal/brand.d.ts +6 -0
- package/dist/internal/brand.d.ts.map +1 -0
- package/dist/internal/brand.js +17 -0
- package/dist/internal/chat-client.d.ts +19 -0
- package/dist/internal/chat-client.d.ts.map +1 -0
- package/dist/internal/chat-client.js +327 -0
- package/dist/internal/cli-ax.d.ts +58 -0
- package/dist/internal/cli-ax.d.ts.map +1 -0
- package/dist/internal/cli-ax.js +345 -0
- package/dist/internal/cli-cursor.d.ts +20 -0
- package/dist/internal/cli-cursor.d.ts.map +1 -0
- package/dist/internal/cli-cursor.js +227 -0
- package/dist/internal/cli-github.d.ts +47 -0
- package/dist/internal/cli-github.d.ts.map +1 -0
- package/dist/internal/cli-github.js +644 -0
- package/dist/internal/cli-slack.d.ts +18 -0
- package/dist/internal/cli-slack.d.ts.map +1 -0
- package/dist/internal/cli-slack.js +144 -0
- package/dist/internal/cloud-merge.d.ts +23 -0
- package/dist/internal/cloud-merge.d.ts.map +1 -0
- package/dist/internal/cloud-merge.js +28 -0
- package/dist/internal/cron.d.ts +17 -0
- package/dist/internal/cron.d.ts.map +1 -0
- package/dist/internal/cron.js +60 -0
- package/dist/internal/cursor/account-mcp.d.ts +95 -0
- package/dist/internal/cursor/account-mcp.d.ts.map +1 -0
- package/dist/internal/cursor/account-mcp.js +342 -0
- package/dist/internal/cursor/backend-client.d.ts +118 -0
- package/dist/internal/cursor/backend-client.d.ts.map +1 -0
- package/dist/internal/cursor/backend-client.js +477 -0
- package/dist/internal/cursor/credentials.d.ts +112 -0
- package/dist/internal/cursor/credentials.d.ts.map +1 -0
- package/dist/internal/cursor/credentials.js +329 -0
- package/dist/internal/cursor-event-relay.d.ts +111 -0
- package/dist/internal/cursor-event-relay.d.ts.map +1 -0
- package/dist/internal/cursor-event-relay.js +181 -0
- package/dist/internal/cursor-relay-core.d.ts +113 -0
- package/dist/internal/cursor-relay-core.d.ts.map +1 -0
- package/dist/internal/cursor-relay-core.js +364 -0
- package/dist/internal/cursor-slack-relay.d.ts +94 -0
- package/dist/internal/cursor-slack-relay.d.ts.map +1 -0
- package/dist/internal/cursor-slack-relay.js +171 -0
- package/dist/internal/describe-error.d.ts +3 -0
- package/dist/internal/describe-error.d.ts.map +1 -0
- package/dist/internal/describe-error.js +4 -0
- package/dist/internal/dev-mode.d.ts +13 -0
- package/dist/internal/dev-mode.d.ts.map +1 -0
- package/dist/internal/dev-mode.js +17 -0
- package/dist/internal/discovery.d.ts +55 -0
- package/dist/internal/discovery.d.ts.map +1 -0
- package/dist/internal/discovery.js +1427 -0
- package/dist/internal/distribution.d.ts +47 -0
- package/dist/internal/distribution.d.ts.map +1 -0
- package/dist/internal/distribution.js +82 -0
- package/dist/internal/docs-site.d.ts +28 -0
- package/dist/internal/docs-site.d.ts.map +1 -0
- package/dist/internal/docs-site.js +169 -0
- package/dist/internal/duration.d.ts +8 -0
- package/dist/internal/duration.d.ts.map +1 -0
- package/dist/internal/duration.js +35 -0
- package/dist/internal/eval-run-store.d.ts +81 -0
- package/dist/internal/eval-run-store.d.ts.map +1 -0
- package/dist/internal/eval-run-store.js +396 -0
- package/dist/internal/eval-runner.d.ts +76 -0
- package/dist/internal/eval-runner.d.ts.map +1 -0
- package/dist/internal/eval-runner.js +336 -0
- package/dist/internal/event-log.d.ts +51 -0
- package/dist/internal/event-log.d.ts.map +1 -0
- package/dist/internal/event-log.js +167 -0
- package/dist/internal/event-mapper.d.ts +46 -0
- package/dist/internal/event-mapper.d.ts.map +1 -0
- package/dist/internal/event-mapper.js +226 -0
- package/dist/internal/frontmatter.d.ts +12 -0
- package/dist/internal/frontmatter.d.ts.map +1 -0
- package/dist/internal/frontmatter.js +61 -0
- package/dist/internal/github-fanout.d.ts +32 -0
- package/dist/internal/github-fanout.d.ts.map +1 -0
- package/dist/internal/github-fanout.js +122 -0
- package/dist/internal/handleAgentServeTrigger.d.ts +59 -0
- package/dist/internal/handleAgentServeTrigger.d.ts.map +1 -0
- package/dist/internal/handleAgentServeTrigger.js +115 -0
- package/dist/internal/host-platforms.d.ts +40 -0
- package/dist/internal/host-platforms.d.ts.map +1 -0
- package/dist/internal/host-platforms.js +113 -0
- package/dist/internal/http-channel.d.ts +54 -0
- package/dist/internal/http-channel.d.ts.map +1 -0
- package/dist/internal/http-channel.js +382 -0
- package/dist/internal/ids.d.ts +19 -0
- package/dist/internal/ids.d.ts.map +1 -0
- package/dist/internal/ids.js +34 -0
- package/dist/internal/init-project.d.ts +22 -0
- package/dist/internal/init-project.d.ts.map +1 -0
- package/dist/internal/init-project.js +125 -0
- package/dist/internal/json-dir-store.d.ts +32 -0
- package/dist/internal/json-dir-store.d.ts.map +1 -0
- package/dist/internal/json-dir-store.js +100 -0
- package/dist/internal/json-schema.d.ts +18 -0
- package/dist/internal/json-schema.d.ts.map +1 -0
- package/dist/internal/json-schema.js +53 -0
- package/dist/internal/log-ring.d.ts +23 -0
- package/dist/internal/log-ring.d.ts.map +1 -0
- package/dist/internal/log-ring.js +42 -0
- package/dist/internal/map-pool.d.ts +6 -0
- package/dist/internal/map-pool.d.ts.map +1 -0
- package/dist/internal/map-pool.js +41 -0
- package/dist/internal/mcp-endpoint.d.ts +59 -0
- package/dist/internal/mcp-endpoint.d.ts.map +1 -0
- package/dist/internal/mcp-endpoint.js +355 -0
- package/dist/internal/mcp-host.d.ts +28 -0
- package/dist/internal/mcp-host.d.ts.map +1 -0
- package/dist/internal/mcp-host.js +162 -0
- package/dist/internal/net.d.ts +5 -0
- package/dist/internal/net.d.ts.map +1 -0
- package/dist/internal/net.js +30 -0
- package/dist/internal/peer-connections.d.ts +44 -0
- package/dist/internal/peer-connections.d.ts.map +1 -0
- package/dist/internal/peer-connections.js +67 -0
- package/dist/internal/playground/static.d.ts +35 -0
- package/dist/internal/playground/static.d.ts.map +1 -0
- package/dist/internal/playground/static.js +162 -0
- package/dist/internal/playground/toolchain.d.ts +57 -0
- package/dist/internal/playground/toolchain.d.ts.map +1 -0
- package/dist/internal/playground/toolchain.js +226 -0
- package/dist/internal/reminder-runner.d.ts +62 -0
- package/dist/internal/reminder-runner.d.ts.map +1 -0
- package/dist/internal/reminder-runner.js +582 -0
- package/dist/internal/reminder-schedule.d.ts +22 -0
- package/dist/internal/reminder-schedule.d.ts.map +1 -0
- package/dist/internal/reminder-schedule.js +82 -0
- package/dist/internal/reminder-store.d.ts +58 -0
- package/dist/internal/reminder-store.d.ts.map +1 -0
- package/dist/internal/reminder-store.js +106 -0
- package/dist/internal/resolved-connections.d.ts +41 -0
- package/dist/internal/resolved-connections.d.ts.map +1 -0
- package/dist/internal/resolved-connections.js +73 -0
- package/dist/internal/review-comments.d.ts +50 -0
- package/dist/internal/review-comments.d.ts.map +1 -0
- package/dist/internal/review-comments.js +194 -0
- package/dist/internal/router.d.ts +33 -0
- package/dist/internal/router.d.ts.map +1 -0
- package/dist/internal/router.js +93 -0
- package/dist/internal/run-client.d.ts +49 -0
- package/dist/internal/run-client.d.ts.map +1 -0
- package/dist/internal/run-client.js +208 -0
- package/dist/internal/schedule-runner.d.ts +31 -0
- package/dist/internal/schedule-runner.d.ts.map +1 -0
- package/dist/internal/schedule-runner.js +126 -0
- package/dist/internal/sdk-runner.d.ts +41 -0
- package/dist/internal/sdk-runner.d.ts.map +1 -0
- package/dist/internal/sdk-runner.js +221 -0
- package/dist/internal/server.d.ts +25 -0
- package/dist/internal/server.d.ts.map +1 -0
- package/dist/internal/server.js +1374 -0
- package/dist/internal/session-engine.d.ts +287 -0
- package/dist/internal/session-engine.d.ts.map +1 -0
- package/dist/internal/session-engine.js +1377 -0
- package/dist/internal/session-store.d.ts +29 -0
- package/dist/internal/session-store.d.ts.map +1 -0
- package/dist/internal/session-store.js +140 -0
- package/dist/internal/session-urls.d.ts +10 -0
- package/dist/internal/session-urls.d.ts.map +1 -0
- package/dist/internal/session-urls.js +25 -0
- package/dist/internal/stream-progress.d.ts +14 -0
- package/dist/internal/stream-progress.d.ts.map +1 -0
- package/dist/internal/stream-progress.js +195 -0
- package/dist/internal/tool-result.d.ts +20 -0
- package/dist/internal/tool-result.d.ts.map +1 -0
- package/dist/internal/tool-result.js +45 -0
- package/dist/internal/trajectory.d.ts +56 -0
- package/dist/internal/trajectory.d.ts.map +1 -0
- package/dist/internal/trajectory.js +248 -0
- package/dist/internal/workspace.d.ts +42 -0
- package/dist/internal/workspace.d.ts.map +1 -0
- package/dist/internal/workspace.js +199 -0
- package/dist/playground/assets/cursor-icons-outline-oY2V_mvK.woff2 +0 -0
- package/dist/playground/assets/index-1K-hG-7p.css +1 -0
- package/dist/playground/assets/index-FlWjhg3x.js +79 -0
- package/dist/playground/index.html +17 -0
- package/dist/reminders.d.ts +23 -0
- package/dist/reminders.d.ts.map +1 -0
- package/dist/reminders.js +22 -0
- package/dist/schedules.d.ts +23 -0
- package/dist/schedules.d.ts.map +1 -0
- package/dist/schedules.js +26 -0
- package/dist/skills.d.ts +22 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/skills.js +22 -0
- package/dist/tools.d.ts +92 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +68 -0
- package/dist/types.d.ts +1609 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +80 -0
- package/docs/README.md +174 -0
- package/docs/ab.md +355 -0
- package/docs/building-with-agents.md +129 -0
- package/docs/concepts.md +177 -0
- package/docs/deployment.md +218 -0
- package/docs/evals.md +383 -0
- package/docs/guides/agent-to-agent.md +118 -0
- package/docs/guides/cloud-runtime.md +122 -0
- package/docs/guides/github.md +172 -0
- package/docs/guides/human-in-the-loop.md +131 -0
- package/docs/guides/slack.md +245 -0
- package/docs/guides/webhooks.md +201 -0
- package/docs/hillclimbing.md +93 -0
- package/docs/quickstart.md +183 -0
- package/docs/reference/agent-config.md +154 -0
- package/docs/reference/channels.md +206 -0
- package/docs/reference/cli.md +257 -0
- package/docs/reference/connections.md +137 -0
- package/docs/reference/hooks.md +74 -0
- package/docs/reference/http-api.md +219 -0
- package/docs/reference/instructions.md +77 -0
- package/docs/reference/playground.md +67 -0
- package/docs/reference/project-layout.md +119 -0
- package/docs/reference/schedules.md +220 -0
- package/docs/reference/sessions.md +165 -0
- package/docs/reference/skills.md +79 -0
- package/docs/reference/subagents.md +74 -0
- package/docs/reference/tools.md +203 -0
- package/docs/scaffolding-agents.md +113 -0
- package/docs/troubleshooting.md +95 -0
- package/package.json +185 -0
- package/skills/ab/SKILL.md +139 -0
- package/skills/create-agent/SKILL.md +219 -0
- package/skills/debug/SKILL.md +71 -0
- package/skills/evals/SKILL.md +217 -0
- package/skills/framework-map/SKILL.md +142 -0
- package/skills/github/SKILL.md +144 -0
- package/skills/hillclimb/SKILL.md +162 -0
- package/skills/setup-slack/SKILL.md +180 -0
- package/src/ab.ts +675 -0
- package/src/bin/agent-serve.ts +949 -0
- package/src/channels/github/api.ts +374 -0
- package/src/channels/github/auth.ts +275 -0
- package/src/channels/github/binding.ts +223 -0
- package/src/channels/github/defaults.ts +111 -0
- package/src/channels/github/events.ts +72 -0
- package/src/channels/github/forward.ts +381 -0
- package/src/channels/github/github-channel.ts +2270 -0
- package/src/channels/github/index.ts +52 -0
- package/src/channels/github/replay.ts +387 -0
- package/src/channels/github/state.ts +95 -0
- package/src/channels/github/types.ts +490 -0
- package/src/channels/slack/api.ts +580 -0
- package/src/channels/slack/approvals.ts +198 -0
- package/src/channels/slack/assistant.ts +76 -0
- package/src/channels/slack/auth.ts +112 -0
- package/src/channels/slack/channel-watch.ts +219 -0
- package/src/channels/slack/constants.ts +30 -0
- package/src/channels/slack/credentials.ts +90 -0
- package/src/channels/slack/cursor-account.ts +166 -0
- package/src/channels/slack/defaults.ts +450 -0
- package/src/channels/slack/dispatch.ts +293 -0
- package/src/channels/slack/doctor.ts +135 -0
- package/src/channels/slack/event-id-dedupe.ts +30 -0
- package/src/channels/slack/inbound.ts +219 -0
- package/src/channels/slack/index.ts +45 -0
- package/src/channels/slack/init.ts +133 -0
- package/src/channels/slack/interactive.ts +194 -0
- package/src/channels/slack/links.ts +23 -0
- package/src/channels/slack/live-delivery.ts +201 -0
- package/src/channels/slack/log.ts +83 -0
- package/src/channels/slack/manifest.ts +179 -0
- package/src/channels/slack/pr-ref.ts +50 -0
- package/src/channels/slack/setup.ts +97 -0
- package/src/channels/slack/slack-channel.ts +374 -0
- package/src/channels/slack/socket-mode.ts +154 -0
- package/src/channels/slack/stream.ts +63 -0
- package/src/channels/slack/tool-approval-events.ts +136 -0
- package/src/channels/slack/types.ts +349 -0
- package/src/channels.ts +385 -0
- package/src/connections.ts +89 -0
- package/src/evals.ts +501 -0
- package/src/hooks.ts +33 -0
- package/src/index.ts +184 -0
- package/src/internal/ab-collector.ts +210 -0
- package/src/internal/ab-fold.ts +228 -0
- package/src/internal/ab-snapshot.ts +335 -0
- package/src/internal/approval-gate.ts +115 -0
- package/src/internal/auth.ts +39 -0
- package/src/internal/authored-alias-hooks.ts +69 -0
- package/src/internal/authored-loaders.ts +138 -0
- package/src/internal/bounded-int.ts +27 -0
- package/src/internal/brand.ts +29 -0
- package/src/internal/chat-client.ts +407 -0
- package/src/internal/cli-ax.ts +474 -0
- package/src/internal/cli-cursor.ts +275 -0
- package/src/internal/cli-github.ts +849 -0
- package/src/internal/cli-slack.ts +175 -0
- package/src/internal/cloud-merge.ts +41 -0
- package/src/internal/cron.ts +78 -0
- package/src/internal/cursor/account-mcp.ts +472 -0
- package/src/internal/cursor/backend-client.ts +614 -0
- package/src/internal/cursor/credentials.ts +401 -0
- package/src/internal/cursor-event-relay.ts +281 -0
- package/src/internal/cursor-relay-core.ts +444 -0
- package/src/internal/cursor-slack-relay.ts +242 -0
- package/src/internal/describe-error.ts +4 -0
- package/src/internal/dev-mode.ts +20 -0
- package/src/internal/discovery.ts +1709 -0
- package/src/internal/distribution.ts +97 -0
- package/src/internal/docs-site.ts +191 -0
- package/src/internal/duration.ts +39 -0
- package/src/internal/eval-run-store.ts +519 -0
- package/src/internal/eval-runner.ts +522 -0
- package/src/internal/event-log.ts +175 -0
- package/src/internal/event-mapper.ts +272 -0
- package/src/internal/frontmatter.ts +77 -0
- package/src/internal/github-fanout.ts +159 -0
- package/src/internal/handleAgentServeTrigger.ts +156 -0
- package/src/internal/host-platforms.ts +144 -0
- package/src/internal/http-channel.ts +546 -0
- package/src/internal/ids.ts +44 -0
- package/src/internal/init-project.ts +165 -0
- package/src/internal/json-dir-store.ts +109 -0
- package/src/internal/json-schema.ts +69 -0
- package/src/internal/log-ring.ts +59 -0
- package/src/internal/map-pool.ts +32 -0
- package/src/internal/mcp-endpoint.ts +518 -0
- package/src/internal/mcp-host.ts +211 -0
- package/src/internal/net.ts +31 -0
- package/src/internal/peer-connections.ts +100 -0
- package/src/internal/playground/static.ts +189 -0
- package/src/internal/playground/toolchain.ts +277 -0
- package/src/internal/reminder-runner.ts +756 -0
- package/src/internal/reminder-schedule.ts +106 -0
- package/src/internal/reminder-store.ts +145 -0
- package/src/internal/resolved-connections.ts +145 -0
- package/src/internal/review-comments.ts +268 -0
- package/src/internal/router.ts +145 -0
- package/src/internal/run-client.ts +320 -0
- package/src/internal/schedule-runner.ts +161 -0
- package/src/internal/sdk-runner.ts +315 -0
- package/src/internal/server.ts +1737 -0
- package/src/internal/session-engine.ts +1810 -0
- package/src/internal/session-store.ts +147 -0
- package/src/internal/session-urls.ts +40 -0
- package/src/internal/stream-progress.ts +254 -0
- package/src/internal/tool-result.ts +54 -0
- package/src/internal/trajectory.ts +306 -0
- package/src/internal/workspace.ts +223 -0
- package/src/reminders.ts +35 -0
- package/src/schedules.ts +37 -0
- package/src/skills.ts +27 -0
- package/src/tools.ts +127 -0
- package/src/types.ts +1848 -0
|
@@ -0,0 +1,754 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* agent-serve CLI.
|
|
4
|
+
*
|
|
5
|
+
* agent-serve serve [--dir .] [--port 3000] [--host 127.0.0.1] [--dev]
|
|
6
|
+
* agent-serve chat [--url http://127.0.0.1:3000] [--message "..."] [--json]
|
|
7
|
+
* agent-serve run [--dir .] [--message "..."] [--json|--text]
|
|
8
|
+
* agent-serve trajectory --events <file.ndjson>
|
|
9
|
+
* agent-serve init [dir]
|
|
10
|
+
* agent-serve eval [--dir .] [evalId...]
|
|
11
|
+
* agent-serve validate [--dir .]
|
|
12
|
+
* agent-serve slack <subcommand>
|
|
13
|
+
*/
|
|
14
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
import { readFile } from "node:fs/promises";
|
|
24
|
+
import { resolve } from "node:path";
|
|
25
|
+
import { parseArgs } from "node:util";
|
|
26
|
+
import { formatDiagnostics, projectInfo, resolveAgentMounts, serve, } from "../index.js";
|
|
27
|
+
import { registerAuthoredModuleLoaders } from "../internal/authored-loaders.js";
|
|
28
|
+
import { runChat } from "../internal/chat-client.js";
|
|
29
|
+
import { cmdCall, cmdEval, cmdInit, cmdRun, cmdTrajectory, } from "../internal/cli-ax.js";
|
|
30
|
+
import { CLI_COMMAND_NAME as CLI } from "../internal/distribution.js";
|
|
31
|
+
import { runSession } from "../internal/run-client.js";
|
|
32
|
+
import { formatTrajectoryText } from "../internal/trajectory.js";
|
|
33
|
+
const HELP = `${CLI} — serve a filesystem-defined Cursor agent over channels
|
|
34
|
+
|
|
35
|
+
Usage:
|
|
36
|
+
${CLI} serve [--dir <path>] [--port <n>] [--host <host>] [--dev]
|
|
37
|
+
[--mode single|multi] [--api-key <key>] [--no-schedules]
|
|
38
|
+
[--public-url <url>]
|
|
39
|
+
[--cursor-events --repo <owner/name>]...
|
|
40
|
+
${CLI} chat [--url <baseUrl>] [--message <text>] [--json] [--text]
|
|
41
|
+
${CLI} run [--dir <path>] [--message <text>]... [--url <baseUrl>]
|
|
42
|
+
[--session <id>] [--continuation-token <t>]
|
|
43
|
+
[--events <file.ndjson>] [--no-events] [--text]
|
|
44
|
+
[--timeout-ms <n>] [--no-stream]
|
|
45
|
+
${CLI} trajectory --events <file.ndjson> [--text]
|
|
46
|
+
${CLI} call <tool> [--input <json>] [--dir <path> | --url <baseUrl>]
|
|
47
|
+
[--session <id>] [--slug <slug>]
|
|
48
|
+
${CLI} init [dir]
|
|
49
|
+
${CLI} eval [--dir <path>] [evalId...] [--list] [--json]
|
|
50
|
+
[--tag <tag>]... [--verbose] [--timeout-ms <n>]
|
|
51
|
+
[--no-stream]
|
|
52
|
+
${CLI} info [--dir <path>] [--json]
|
|
53
|
+
${CLI} validate [--dir <path>]
|
|
54
|
+
${CLI} login [--api-key <key>] [--key-name <name>]
|
|
55
|
+
${CLI} logout
|
|
56
|
+
${CLI} whoami [--json]
|
|
57
|
+
${CLI} slack <subcommand> …
|
|
58
|
+
${CLI} github <subcommand> …
|
|
59
|
+
|
|
60
|
+
Commands:
|
|
61
|
+
serve Serve agents under /<slug>/... (index at /). On a TTY, press
|
|
62
|
+
Enter to restart (reloads agent code + Vite HMR child).
|
|
63
|
+
chat Talk to a running server (streams the reply). --json prints a trajectory.
|
|
64
|
+
run One-shot create→test loop: ephemeral server + JSON trajectory.
|
|
65
|
+
Writes a single events.ndjson trace (visualize in the playground).
|
|
66
|
+
Streams tool calls and reply text to stderr when stderr is a TTY.
|
|
67
|
+
trajectory Summarize an events.ndjson file into a trajectory.
|
|
68
|
+
call Call an authored server tool deterministically (no model turn)
|
|
69
|
+
via POST /v1/tools/:toolName. --session runs it inside an
|
|
70
|
+
existing session and records it on that session's event stream.
|
|
71
|
+
init Scaffold a project, or print the coding-agent setup guide (no args).
|
|
72
|
+
eval Run filesystem evals under evals/**/*.eval.ts (streams on a TTY).
|
|
73
|
+
Pass evalId args to select: one datapoint (weather/nyc), a whole
|
|
74
|
+
file (weather → all cases in that file), several of either, or
|
|
75
|
+
omit to run all.
|
|
76
|
+
info Print the discovered agent surface (tools, skills, channels, ...).
|
|
77
|
+
validate Check the project(s) and exit non-zero on error diagnostics.
|
|
78
|
+
login Sign the host in to Cursor: browser sign-in mints a named,
|
|
79
|
+
dashboard-revocable API key (only the key is stored). It powers
|
|
80
|
+
inference, cloud runtime, and cursorAccount MCP connections.
|
|
81
|
+
logout Remove the stored Cursor credentials.
|
|
82
|
+
whoami Show which Cursor account powers this host (and why).
|
|
83
|
+
slack Slack channel pack: init, manifests, doctor (see slack help).
|
|
84
|
+
github GitHub webhook pack: forward live deliveries, events, doctor
|
|
85
|
+
(wraps \`gh webhook forward\`; see github help).
|
|
86
|
+
|
|
87
|
+
Agent loop:
|
|
88
|
+
${CLI} validate --dir .
|
|
89
|
+
${CLI} info --dir . --json
|
|
90
|
+
${CLI} run --dir . --message "..."
|
|
91
|
+
${CLI} eval --dir .
|
|
92
|
+
|
|
93
|
+
Options:
|
|
94
|
+
--dir Project root (defaults to the current directory).
|
|
95
|
+
--port Port to listen on (default 3000).
|
|
96
|
+
--host Host to bind (default 127.0.0.1).
|
|
97
|
+
--mode serve: "multi" (default, slugged /<dir>/v1/*) or "single"
|
|
98
|
+
(unslugged /v1/*). Multi also exposes host /v1/health for
|
|
99
|
+
ALB/ECS checks; use single when one agent is the whole host.
|
|
100
|
+
--dev Dev mode: mounts POST /v1/dev/schedules/:scheduleId and
|
|
101
|
+
disables the cron runner (dispatch schedules by hand).
|
|
102
|
+
--api-key Cursor API key (defaults to CURSOR_API_KEY, then the
|
|
103
|
+
stored \`${CLI} login\` credential).
|
|
104
|
+
--key-name login: label for the minted API key (defaults to
|
|
105
|
+
"${CLI} (<hostname>)").
|
|
106
|
+
--state-root Durable state directory (default <dir>/.agent-serve). Put it
|
|
107
|
+
outside any repository whose rules should not reach the agent.
|
|
108
|
+
--bearer-token serve: require this bearer token on API routes. chat/run/eval:
|
|
109
|
+
send it as the Authorization bearer.
|
|
110
|
+
--allow-anonymous serve: admit all HTTP callers (allowAll). For demos behind a
|
|
111
|
+
trusted network only; mutually exclusive with --bearer-token.
|
|
112
|
+
--public-url serve: base URL where this host is reachable from outside
|
|
113
|
+
(e.g. https://agent-serve.example.com). Required for peer
|
|
114
|
+
connections (defineConnection({ agent })) on cloud-runtime
|
|
115
|
+
turns; local turns always use loopback.
|
|
116
|
+
--no-schedules Disable the cron runner outside dev mode.
|
|
117
|
+
--no-playground Disable the bundled web playground at /playground (also skips
|
|
118
|
+
auto-build / HMR).
|
|
119
|
+
--no-docs Disable the documentation site at /docs (also skips its
|
|
120
|
+
auto-build).
|
|
121
|
+
--url chat/run/eval: base URL of a running agent (skip local host).
|
|
122
|
+
--message chat/run: user message (repeatable for run).
|
|
123
|
+
--input call: JSON object of tool arguments (default {}).
|
|
124
|
+
--messages-file JSON array of strings (run).
|
|
125
|
+
--session Existing session id for a follow-up turn.
|
|
126
|
+
--continuation-token Token from a prior run/chat response.
|
|
127
|
+
--events run: write NDJSON trace to this path (default
|
|
128
|
+
<dir>/.agent-serve/traces/<sessionId>.ndjson).
|
|
129
|
+
trajectory: read this file.
|
|
130
|
+
--no-events run: do not write a trace file.
|
|
131
|
+
--slug Agent slug when --dir mounts multiple agents.
|
|
132
|
+
--timeout-ms Abort a hung turn after N milliseconds.
|
|
133
|
+
--tag eval: only run cases with this tag (repeatable).
|
|
134
|
+
--list eval: print discovered cases without running.
|
|
135
|
+
--verbose eval: stream t.log lines and reply snippets.
|
|
136
|
+
--no-stream run/eval: silence live progress on stderr (JSON still prints).
|
|
137
|
+
--json JSON output (info/chat/eval/github; run defaults to JSON).
|
|
138
|
+
--no-color chat: force plain output.
|
|
139
|
+
--cursor-events serve: pull SCM webhook events from /v0/scm-events. The
|
|
140
|
+
stream is read as your Cursor user, so serve requires
|
|
141
|
+
sign-in (\`${CLI} login\` / CURSOR_API_KEY) and --repo.
|
|
142
|
+
Offset under <state-root>/cursor-events/.
|
|
143
|
+
CURSOR_API_BASE_URL overrides.
|
|
144
|
+
--repo serve --cursor-events: repo to subscribe to (repeatable).
|
|
145
|
+
github forward: owner/repo to forward from (inferred from
|
|
146
|
+
the git remote when omitted; last wins).
|
|
147
|
+
--org github forward: organization login (org-level hooks).
|
|
148
|
+
--channel github: select one channel id when several are declared.
|
|
149
|
+
--secret github forward: webhook signing secret (defaults to
|
|
150
|
+
GITHUB_WEBHOOK_SECRET). github: --events overrides the
|
|
151
|
+
derived webhook event list.
|
|
152
|
+
--install github: install the cli/gh-webhook extension if missing.
|
|
153
|
+
--action github replay: event action (e.g. opened, synchronize).
|
|
154
|
+
--conclusion github replay: CI conclusion (check_run/suite/status).
|
|
155
|
+
--comment github replay: comment body for comment events.
|
|
156
|
+
--context github replay: commit-status context.
|
|
157
|
+
--dry-run github replay: print synthesized payloads, don't POST.
|
|
158
|
+
--out github replay: write synthesized payloads as fixtures.
|
|
159
|
+
`;
|
|
160
|
+
function main(argv) {
|
|
161
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
162
|
+
var _a, _b, _c, _d, _e, _f;
|
|
163
|
+
var _g, _h, _j, _k, _l, _m;
|
|
164
|
+
const [command, ...rest] = argv;
|
|
165
|
+
if (command === undefined ||
|
|
166
|
+
command === "help" ||
|
|
167
|
+
command === "--help" ||
|
|
168
|
+
command === "-h") {
|
|
169
|
+
process.stdout.write(HELP);
|
|
170
|
+
return command === undefined ? 1 : 0;
|
|
171
|
+
}
|
|
172
|
+
const { values, positionals } = parseArgs({
|
|
173
|
+
args: rest,
|
|
174
|
+
allowPositionals: true,
|
|
175
|
+
options: {
|
|
176
|
+
dir: { type: "string", default: "." },
|
|
177
|
+
port: { type: "string" },
|
|
178
|
+
host: { type: "string" },
|
|
179
|
+
mode: { type: "string" },
|
|
180
|
+
dev: { type: "boolean", default: false },
|
|
181
|
+
"api-key": { type: "string" },
|
|
182
|
+
"key-name": { type: "string" },
|
|
183
|
+
"state-root": { type: "string" },
|
|
184
|
+
"bearer-token": { type: "string" },
|
|
185
|
+
"allow-anonymous": { type: "boolean", default: false },
|
|
186
|
+
"no-schedules": { type: "boolean", default: false },
|
|
187
|
+
"no-playground": { type: "boolean", default: false },
|
|
188
|
+
"no-docs": { type: "boolean", default: false },
|
|
189
|
+
url: { type: "string" },
|
|
190
|
+
message: { type: "string", multiple: true },
|
|
191
|
+
input: { type: "string" },
|
|
192
|
+
"messages-file": { type: "string" },
|
|
193
|
+
"session-id": { type: "string" },
|
|
194
|
+
session: { type: "string" },
|
|
195
|
+
"continuation-token": { type: "string" },
|
|
196
|
+
events: { type: "string" },
|
|
197
|
+
"no-events": { type: "boolean", default: false },
|
|
198
|
+
slug: { type: "string" },
|
|
199
|
+
"timeout-ms": { type: "string" },
|
|
200
|
+
tag: { type: "string", multiple: true },
|
|
201
|
+
list: { type: "boolean", default: false },
|
|
202
|
+
verbose: { type: "boolean", default: false },
|
|
203
|
+
text: { type: "boolean", default: false },
|
|
204
|
+
"no-color": { type: "boolean", default: false },
|
|
205
|
+
"no-stream": { type: "boolean", default: false },
|
|
206
|
+
json: { type: "boolean", default: false },
|
|
207
|
+
name: { type: "string" },
|
|
208
|
+
env: { type: "string" },
|
|
209
|
+
"public-url": { type: "string" },
|
|
210
|
+
"mount-path": { type: "string" },
|
|
211
|
+
"base-url": { type: "string" },
|
|
212
|
+
print: { type: "boolean", default: false },
|
|
213
|
+
transport: { type: "string" },
|
|
214
|
+
prefix: { type: "string" },
|
|
215
|
+
"no-prefix": { type: "boolean", default: false },
|
|
216
|
+
"channel-posts": { type: "boolean", default: false },
|
|
217
|
+
repo: { type: "string", multiple: true },
|
|
218
|
+
org: { type: "string" },
|
|
219
|
+
"cursor-events": { type: "boolean", default: false },
|
|
220
|
+
secret: { type: "string" },
|
|
221
|
+
channel: { type: "string" },
|
|
222
|
+
install: { type: "boolean", default: false },
|
|
223
|
+
action: { type: "string" },
|
|
224
|
+
conclusion: { type: "string" },
|
|
225
|
+
context: { type: "string" },
|
|
226
|
+
comment: { type: "string" },
|
|
227
|
+
"dry-run": { type: "boolean", default: false },
|
|
228
|
+
out: { type: "string" },
|
|
229
|
+
},
|
|
230
|
+
});
|
|
231
|
+
const dir = (_g = values.dir) !== null && _g !== void 0 ? _g : ".";
|
|
232
|
+
switch (command) {
|
|
233
|
+
case "slack": {
|
|
234
|
+
const { cmdSlack } = yield import("../internal/cli-slack.js");
|
|
235
|
+
const env = values.env === "dev" || values.env === "prod" || values.env === "both"
|
|
236
|
+
? values.env
|
|
237
|
+
: undefined;
|
|
238
|
+
return cmdSlack(positionals[0], {
|
|
239
|
+
dir,
|
|
240
|
+
name: values.name,
|
|
241
|
+
env,
|
|
242
|
+
json: values.json,
|
|
243
|
+
print: values.print,
|
|
244
|
+
prefix: values.prefix,
|
|
245
|
+
noPrefix: values["no-prefix"],
|
|
246
|
+
channelPosts: values["channel-posts"],
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
case "github": {
|
|
250
|
+
const port = values.port === undefined
|
|
251
|
+
? undefined
|
|
252
|
+
: Number.parseInt(values.port, 10);
|
|
253
|
+
if (port !== undefined &&
|
|
254
|
+
(Number.isNaN(port) || port < 0 || port > 65535)) {
|
|
255
|
+
process.stderr.write(`invalid --port: ${values.port}\n`);
|
|
256
|
+
return 1;
|
|
257
|
+
}
|
|
258
|
+
const { cmdGithub } = yield import("../internal/cli-github.js");
|
|
259
|
+
return cmdGithub(positionals[0], {
|
|
260
|
+
dir,
|
|
261
|
+
slug: values.slug,
|
|
262
|
+
channel: values.channel,
|
|
263
|
+
host: values.host,
|
|
264
|
+
port,
|
|
265
|
+
url: values.url,
|
|
266
|
+
events: values.events,
|
|
267
|
+
// `--repo` is repeatable for `serve --cursor-events`; the github
|
|
268
|
+
// subcommands target a single repo, so the last one wins.
|
|
269
|
+
repo: (_a = values.repo) === null || _a === void 0 ? void 0 : _a.at(-1),
|
|
270
|
+
org: values.org,
|
|
271
|
+
secret: values.secret,
|
|
272
|
+
install: values.install,
|
|
273
|
+
json: values.json,
|
|
274
|
+
prUrl: positionals[1],
|
|
275
|
+
action: values.action,
|
|
276
|
+
conclusion: values.conclusion,
|
|
277
|
+
context: values.context,
|
|
278
|
+
comment: values.comment,
|
|
279
|
+
dryRun: values["dry-run"],
|
|
280
|
+
out: values.out,
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
case "init": {
|
|
284
|
+
return cmdInit({
|
|
285
|
+
dir,
|
|
286
|
+
initTarget: positionals[0],
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
case "login": {
|
|
290
|
+
const { cmdLogin } = yield import("../internal/cli-cursor.js");
|
|
291
|
+
return cmdLogin({
|
|
292
|
+
apiKey: values["api-key"],
|
|
293
|
+
keyName: values["key-name"],
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
case "logout": {
|
|
297
|
+
const { cmdLogout } = yield import("../internal/cli-cursor.js");
|
|
298
|
+
return cmdLogout();
|
|
299
|
+
}
|
|
300
|
+
case "whoami": {
|
|
301
|
+
const { cmdWhoami } = yield import("../internal/cli-cursor.js");
|
|
302
|
+
return cmdWhoami({ json: values.json });
|
|
303
|
+
}
|
|
304
|
+
case "run": {
|
|
305
|
+
const messages = yield loadMessages(values.message, values["messages-file"]);
|
|
306
|
+
return cmdRun(axFromOptions({
|
|
307
|
+
dir,
|
|
308
|
+
messages,
|
|
309
|
+
sessionId: (_h = values["session-id"]) !== null && _h !== void 0 ? _h : values.session,
|
|
310
|
+
continuationToken: values["continuation-token"],
|
|
311
|
+
events: values["no-events"]
|
|
312
|
+
? false
|
|
313
|
+
: values.events === undefined
|
|
314
|
+
? true
|
|
315
|
+
: values.events,
|
|
316
|
+
text: values.text,
|
|
317
|
+
url: values.url,
|
|
318
|
+
slug: values.slug,
|
|
319
|
+
bearerToken: values["bearer-token"],
|
|
320
|
+
stateRoot: values["state-root"],
|
|
321
|
+
timeoutMs: parseTimeoutMs(values["timeout-ms"]),
|
|
322
|
+
stream: values["no-stream"] ? false : undefined,
|
|
323
|
+
}));
|
|
324
|
+
}
|
|
325
|
+
case "call": {
|
|
326
|
+
return cmdCall(axFromOptions({
|
|
327
|
+
dir,
|
|
328
|
+
toolName: positionals[0],
|
|
329
|
+
toolInput: values.input,
|
|
330
|
+
sessionId: (_j = values["session-id"]) !== null && _j !== void 0 ? _j : values.session,
|
|
331
|
+
url: values.url,
|
|
332
|
+
slug: values.slug,
|
|
333
|
+
bearerToken: values["bearer-token"],
|
|
334
|
+
stateRoot: values["state-root"],
|
|
335
|
+
}));
|
|
336
|
+
}
|
|
337
|
+
case "trajectory": {
|
|
338
|
+
if (values.events === undefined) {
|
|
339
|
+
process.stderr.write("trajectory requires --events <file.ndjson>\n");
|
|
340
|
+
return 1;
|
|
341
|
+
}
|
|
342
|
+
return cmdTrajectory(axFromOptions({
|
|
343
|
+
dir,
|
|
344
|
+
events: values.events,
|
|
345
|
+
text: values.text,
|
|
346
|
+
}));
|
|
347
|
+
}
|
|
348
|
+
case "eval": {
|
|
349
|
+
return cmdEval(axFromOptions({
|
|
350
|
+
dir,
|
|
351
|
+
evalIds: positionals,
|
|
352
|
+
list: values.list,
|
|
353
|
+
verbose: values.verbose,
|
|
354
|
+
json: values.json,
|
|
355
|
+
tags: values.tag,
|
|
356
|
+
url: values.url,
|
|
357
|
+
slug: values.slug,
|
|
358
|
+
bearerToken: values["bearer-token"],
|
|
359
|
+
stateRoot: values["state-root"],
|
|
360
|
+
timeoutMs: parseTimeoutMs(values["timeout-ms"]),
|
|
361
|
+
stream: values["no-stream"] ? false : undefined,
|
|
362
|
+
}));
|
|
363
|
+
}
|
|
364
|
+
case "chat": {
|
|
365
|
+
if (values.json) {
|
|
366
|
+
return chatJson({
|
|
367
|
+
baseUrl: (_k = values.url) !== null && _k !== void 0 ? _k : "http://127.0.0.1:3000",
|
|
368
|
+
message: (_b = values.message) === null || _b === void 0 ? void 0 : _b[0],
|
|
369
|
+
bearerToken: values["bearer-token"],
|
|
370
|
+
text: values.text,
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
yield runChat(Object.assign(Object.assign(Object.assign({ baseUrl: (_l = values.url) !== null && _l !== void 0 ? _l : "http://127.0.0.1:3000" }, (((_c = values.message) === null || _c === void 0 ? void 0 : _c[0]) === undefined
|
|
374
|
+
? {}
|
|
375
|
+
: { message: values.message[0] })), (values["bearer-token"] === undefined
|
|
376
|
+
? {}
|
|
377
|
+
: { bearerToken: values["bearer-token"] })), (values["no-color"] ? { noColor: true } : {})));
|
|
378
|
+
return 0;
|
|
379
|
+
}
|
|
380
|
+
case "validate": {
|
|
381
|
+
const mounts = yield loadMounts(dir);
|
|
382
|
+
let hasError = false;
|
|
383
|
+
for (const { slug, project } of mounts) {
|
|
384
|
+
const label = slug === "" ? project.name : `${slug} (${project.name})`;
|
|
385
|
+
if (project.diagnostics.length === 0) {
|
|
386
|
+
process.stdout.write(`ok: ${label} has no diagnostics\n`);
|
|
387
|
+
continue;
|
|
388
|
+
}
|
|
389
|
+
process.stdout.write(`${label}:\n${formatDiagnostics(project.diagnostics)}\n`);
|
|
390
|
+
hasError || (hasError = project.diagnostics.some((d) => d.severity === "error"));
|
|
391
|
+
}
|
|
392
|
+
return hasError ? 1 : 0;
|
|
393
|
+
}
|
|
394
|
+
case "info": {
|
|
395
|
+
const mounts = yield loadMounts(dir);
|
|
396
|
+
if (values.json) {
|
|
397
|
+
const payload = mounts.length === 1 && ((_d = mounts[0]) === null || _d === void 0 ? void 0 : _d.slug) === ""
|
|
398
|
+
? projectInfo(mounts[0].project)
|
|
399
|
+
: {
|
|
400
|
+
agents: mounts.map(({ slug, project }) => (Object.assign({ slug }, projectInfo(project)))),
|
|
401
|
+
};
|
|
402
|
+
process.stdout.write(`${JSON.stringify(payload, null, 2)}\n`);
|
|
403
|
+
return 0;
|
|
404
|
+
}
|
|
405
|
+
if (mounts.length > 1 || ((_e = mounts[0]) === null || _e === void 0 ? void 0 : _e.slug) !== "") {
|
|
406
|
+
process.stdout.write(`${mounts.length} agents under ${dir}:\n\n`);
|
|
407
|
+
for (const { slug, project } of mounts) {
|
|
408
|
+
const info = projectInfo(project);
|
|
409
|
+
process.stdout.write(` /${slug} — ${info.name} (${formatModel(info.model)}, ${info.tools.length} tools, ${info.channels.length} channels)\n`);
|
|
410
|
+
}
|
|
411
|
+
const anyError = mounts.some((m) => m.project.diagnostics.some((d) => d.severity === "error"));
|
|
412
|
+
return anyError ? 1 : 0;
|
|
413
|
+
}
|
|
414
|
+
const project = (_f = mounts[0]) === null || _f === void 0 ? void 0 : _f.project;
|
|
415
|
+
const info = projectInfo(project);
|
|
416
|
+
const lines = [];
|
|
417
|
+
lines.push(`agent: ${info.name}`);
|
|
418
|
+
lines.push(`model: ${formatModel(info.model)}`);
|
|
419
|
+
lines.push(`mcp: ${info.mcp.path} (${info.mcp.tools.join(", ")})`);
|
|
420
|
+
if (info.instructions !== undefined) {
|
|
421
|
+
lines.push(`instructions: ${info.instructions.chars} chars`);
|
|
422
|
+
}
|
|
423
|
+
lines.push(section("tools", info.tools.map((t) => `${t.name} — ${t.description}`)));
|
|
424
|
+
lines.push(section("skills", info.skills.map((s) => `${s.name} — ${s.description}`)));
|
|
425
|
+
lines.push(section("MCP connections", info.connections.map((c) => `${c.name} — ${c.transport}`)));
|
|
426
|
+
lines.push(section("subagents", info.subagents.map((s) => { var _a; return `${s.name} — ${(_a = s.description) !== null && _a !== void 0 ? _a : ""}`; })));
|
|
427
|
+
lines.push(section("channels", info.channels.map((c) => `${c.id}: ${c.routes.map((r) => `${r.method} ${r.url}`).join(", ") ||
|
|
428
|
+
"(events only)"}`)));
|
|
429
|
+
lines.push(section("schedules", info.schedules.map((s) => `${s.name} (${s.cron}, ${s.kind})`)));
|
|
430
|
+
lines.push(section("hooks", info.hooks));
|
|
431
|
+
if (info.diagnostics.length > 0) {
|
|
432
|
+
lines.push(`\ndiagnostics:\n${formatDiagnostics(info.diagnostics)}`);
|
|
433
|
+
}
|
|
434
|
+
process.stdout.write(`${lines.filter((line) => line !== "").join("\n")}\n`);
|
|
435
|
+
return info.diagnostics.some((d) => d.severity === "error") ? 1 : 0;
|
|
436
|
+
}
|
|
437
|
+
case "serve": {
|
|
438
|
+
const port = values.port === undefined ? 3000 : Number.parseInt(values.port, 10);
|
|
439
|
+
if (Number.isNaN(port) || port < 0 || port > 65535) {
|
|
440
|
+
process.stderr.write(`invalid --port: ${values.port}\n`);
|
|
441
|
+
return 1;
|
|
442
|
+
}
|
|
443
|
+
if (values["allow-anonymous"] === true &&
|
|
444
|
+
values["bearer-token"] !== undefined) {
|
|
445
|
+
process.stderr.write("--allow-anonymous and --bearer-token are mutually exclusive\n");
|
|
446
|
+
return 1;
|
|
447
|
+
}
|
|
448
|
+
const mode = values.mode;
|
|
449
|
+
if (mode !== undefined && mode !== "single" && mode !== "multi") {
|
|
450
|
+
process.stderr.write(`invalid --mode: ${mode} (expected "single" or "multi")\n`);
|
|
451
|
+
return 1;
|
|
452
|
+
}
|
|
453
|
+
const serveOptions = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ port }, (values.host === undefined ? {} : { host: values.host })), (mode === undefined ? {} : { mode: mode })), { dev: values.dev }), (values["api-key"] === undefined
|
|
454
|
+
? {}
|
|
455
|
+
: { apiKey: values["api-key"] })), (values["state-root"] === undefined
|
|
456
|
+
? {}
|
|
457
|
+
: { stateRoot: values["state-root"] })), (values["bearer-token"] === undefined
|
|
458
|
+
? {}
|
|
459
|
+
: { authToken: values["bearer-token"] })), (values["allow-anonymous"] ? { allowAnonymous: true } : {})), (values["no-schedules"] ? { schedules: false } : {})), (values["no-playground"] ? { playground: false } : {})), (values["no-docs"] ? { docs: false } : {})), (values["public-url"] === undefined
|
|
460
|
+
? {}
|
|
461
|
+
: { publicUrl: values["public-url"] })), (values["cursor-events"]
|
|
462
|
+
? { cursorEvents: { repos: (_m = values.repo) !== null && _m !== void 0 ? _m : [] } }
|
|
463
|
+
: {}));
|
|
464
|
+
const enterToRestart = process.stdin.isTTY === true;
|
|
465
|
+
const bannerOpts = {
|
|
466
|
+
noPlayground: values["no-playground"] === true,
|
|
467
|
+
dev: values.dev === true,
|
|
468
|
+
bearerToken: values["bearer-token"] !== undefined,
|
|
469
|
+
noSchedules: values["no-schedules"] === true,
|
|
470
|
+
};
|
|
471
|
+
const start = () => __awaiter(this, void 0, void 0, function* () {
|
|
472
|
+
const next = yield serve(dir, serveOptions);
|
|
473
|
+
printServeBanner(next, bannerOpts);
|
|
474
|
+
if (enterToRestart) {
|
|
475
|
+
process.stdout.write(" press Enter to restart\n");
|
|
476
|
+
}
|
|
477
|
+
return next;
|
|
478
|
+
});
|
|
479
|
+
let handle = yield start();
|
|
480
|
+
let closing = false;
|
|
481
|
+
let restarting = false;
|
|
482
|
+
yield new Promise((resolve) => {
|
|
483
|
+
const shutdown = () => {
|
|
484
|
+
if (closing) {
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
closing = true;
|
|
488
|
+
process.stdout.write("\nshutting down (draining running turns)\n");
|
|
489
|
+
void handle.close().finally(resolve);
|
|
490
|
+
};
|
|
491
|
+
process.on("SIGINT", shutdown);
|
|
492
|
+
process.on("SIGTERM", shutdown);
|
|
493
|
+
if (!enterToRestart) {
|
|
494
|
+
return;
|
|
495
|
+
}
|
|
496
|
+
process.stdin.resume();
|
|
497
|
+
process.stdin.on("data", (chunk) => {
|
|
498
|
+
const text = typeof chunk === "string" ? chunk : chunk.toString("utf8");
|
|
499
|
+
if (!isEnterOnly(text) || closing || restarting) {
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
502
|
+
restarting = true;
|
|
503
|
+
process.stdout.write("\nrestarting…\n");
|
|
504
|
+
void handle
|
|
505
|
+
.close()
|
|
506
|
+
.then(start)
|
|
507
|
+
.then((next) => {
|
|
508
|
+
handle = next;
|
|
509
|
+
})
|
|
510
|
+
.catch((error) => {
|
|
511
|
+
var _a;
|
|
512
|
+
process.stderr.write(`[agent-serve] restart failed: ${error instanceof Error
|
|
513
|
+
? ((_a = error.stack) !== null && _a !== void 0 ? _a : error.message)
|
|
514
|
+
: String(error)}\n`);
|
|
515
|
+
closing = true;
|
|
516
|
+
resolve();
|
|
517
|
+
})
|
|
518
|
+
.finally(() => {
|
|
519
|
+
restarting = false;
|
|
520
|
+
});
|
|
521
|
+
});
|
|
522
|
+
});
|
|
523
|
+
return 0;
|
|
524
|
+
}
|
|
525
|
+
default: {
|
|
526
|
+
process.stderr.write(`Unknown command "${command}"\n\n${HELP}`);
|
|
527
|
+
return 1;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
function axFromOptions(partial) {
|
|
533
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ dir: partial.dir }, (partial.cwd === undefined ? {} : { cwd: partial.cwd })), (partial.slug === undefined ? {} : { slug: partial.slug })), (partial.bearerToken === undefined
|
|
534
|
+
? {}
|
|
535
|
+
: { bearerToken: partial.bearerToken })), (partial.stateRoot === undefined
|
|
536
|
+
? {}
|
|
537
|
+
: { stateRoot: partial.stateRoot })), (partial.messages === undefined ? {} : { messages: partial.messages })), (partial.sessionId === undefined
|
|
538
|
+
? {}
|
|
539
|
+
: { sessionId: partial.sessionId })), (partial.continuationToken === undefined
|
|
540
|
+
? {}
|
|
541
|
+
: { continuationToken: partial.continuationToken })), (partial.timeoutMs === undefined
|
|
542
|
+
? {}
|
|
543
|
+
: { timeoutMs: partial.timeoutMs })), (partial.events === undefined ? {} : { events: partial.events })), (partial.text === undefined ? {} : { text: partial.text })), (partial.json === undefined ? {} : { json: partial.json })), (partial.list === undefined ? {} : { list: partial.list })), (partial.verbose === undefined ? {} : { verbose: partial.verbose })), (partial.tags === undefined ? {} : { tags: partial.tags })), (partial.evalIds === undefined ? {} : { evalIds: partial.evalIds })), (partial.initTarget === undefined
|
|
544
|
+
? {}
|
|
545
|
+
: { initTarget: partial.initTarget })), (partial.toolName === undefined ? {} : { toolName: partial.toolName })), (partial.toolInput === undefined
|
|
546
|
+
? {}
|
|
547
|
+
: { toolInput: partial.toolInput })), (partial.url === undefined ? {} : { url: partial.url })), (partial.stream === undefined ? {} : { stream: partial.stream }));
|
|
548
|
+
}
|
|
549
|
+
function loadMessages(messages, messagesFile) {
|
|
550
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
551
|
+
const out = [];
|
|
552
|
+
if (messagesFile !== undefined) {
|
|
553
|
+
const raw = yield readFile(resolve(messagesFile), "utf8");
|
|
554
|
+
const parsed = JSON.parse(raw);
|
|
555
|
+
if (!Array.isArray(parsed)) {
|
|
556
|
+
throw new Error("--messages-file must be a JSON array of strings");
|
|
557
|
+
}
|
|
558
|
+
for (const item of parsed) {
|
|
559
|
+
if (typeof item !== "string") {
|
|
560
|
+
throw new Error("--messages-file entries must be strings");
|
|
561
|
+
}
|
|
562
|
+
out.push(item);
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
if (messages !== undefined) {
|
|
566
|
+
out.push(...messages);
|
|
567
|
+
}
|
|
568
|
+
return out;
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
function parseTimeoutMs(value) {
|
|
572
|
+
if (value === undefined) {
|
|
573
|
+
return undefined;
|
|
574
|
+
}
|
|
575
|
+
const n = Number.parseInt(value, 10);
|
|
576
|
+
if (Number.isNaN(n) || n <= 0) {
|
|
577
|
+
throw new Error(`invalid --timeout-ms: ${value}`);
|
|
578
|
+
}
|
|
579
|
+
return n;
|
|
580
|
+
}
|
|
581
|
+
function chatJson(args) {
|
|
582
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
583
|
+
var _a;
|
|
584
|
+
if (args.message === undefined) {
|
|
585
|
+
process.stderr.write("chat --json requires --message\n");
|
|
586
|
+
return 2;
|
|
587
|
+
}
|
|
588
|
+
const result = yield runSession(Object.assign({ baseUrl: args.baseUrl, messages: [args.message] }, (args.bearerToken === undefined
|
|
589
|
+
? {}
|
|
590
|
+
: { bearerToken: args.bearerToken })));
|
|
591
|
+
if (args.text) {
|
|
592
|
+
process.stdout.write(formatTrajectoryText(result.trajectory));
|
|
593
|
+
}
|
|
594
|
+
else {
|
|
595
|
+
console.log(JSON.stringify({
|
|
596
|
+
ok: result.ok,
|
|
597
|
+
sessionId: result.sessionId,
|
|
598
|
+
continuationToken: (_a = result.continuationToken) !== null && _a !== void 0 ? _a : null,
|
|
599
|
+
trajectory: result.trajectory,
|
|
600
|
+
}, null, 2));
|
|
601
|
+
}
|
|
602
|
+
return result.ok ? 0 : 1;
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
/**
|
|
606
|
+
* Load mounts the same way `serve` does (multi-agent layout by default).
|
|
607
|
+
*/
|
|
608
|
+
function loadMounts(dir) {
|
|
609
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
610
|
+
return resolveAgentMounts(dir);
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
function section(title, items) {
|
|
614
|
+
if (items.length === 0) {
|
|
615
|
+
return "";
|
|
616
|
+
}
|
|
617
|
+
return `${title}:\n${items.map((item) => ` - ${item}`).join("\n")}`;
|
|
618
|
+
}
|
|
619
|
+
function isEnterOnly(text) {
|
|
620
|
+
return text.length > 0 && [...text].every((ch) => ch === "\n" || ch === "\r");
|
|
621
|
+
}
|
|
622
|
+
function printServeBanner(handle, opts) {
|
|
623
|
+
var _a;
|
|
624
|
+
const multi = handle.agents.length > 1 || ((_a = handle.agents[0]) === null || _a === void 0 ? void 0 : _a.slug) !== "";
|
|
625
|
+
if (multi) {
|
|
626
|
+
process.stdout.write(`${handle.agents.length} agents listening on ${handle.url}\n`);
|
|
627
|
+
if (!opts.noPlayground) {
|
|
628
|
+
process.stdout.write(` index: ${handle.url}/\n`);
|
|
629
|
+
}
|
|
630
|
+
for (const agent of handle.agents) {
|
|
631
|
+
const info = projectInfo(agent.project);
|
|
632
|
+
const suffix = opts.noPlayground
|
|
633
|
+
? `${agent.url}/v1/session`
|
|
634
|
+
: `${agent.url}/playground`;
|
|
635
|
+
process.stdout.write(` /${agent.slug} ${info.name} — ${suffix}\n`);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
else {
|
|
639
|
+
const info = projectInfo(handle.project);
|
|
640
|
+
process.stdout.write(`${info.name} listening on ${handle.url}\n`);
|
|
641
|
+
if (!opts.noPlayground) {
|
|
642
|
+
process.stdout.write(` playground: ${handle.url}/playground\n`);
|
|
643
|
+
}
|
|
644
|
+
process.stdout.write(` POST ${handle.url}/v1/session\n`);
|
|
645
|
+
process.stdout.write(` GET ${handle.url}/v1/session/:sessionId/stream\n`);
|
|
646
|
+
for (const channel of info.channels) {
|
|
647
|
+
if (channel.id === "http") {
|
|
648
|
+
continue;
|
|
649
|
+
}
|
|
650
|
+
for (const route of channel.routes) {
|
|
651
|
+
process.stdout.write(` ${route.method} ${handle.url}${route.url}\n`);
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
if (info.schedules.length > 0) {
|
|
655
|
+
const scheduleMode = opts.dev
|
|
656
|
+
? "dev mode: dispatch with POST /v1/dev/schedules/:scheduleId"
|
|
657
|
+
: opts.noSchedules
|
|
658
|
+
? "disabled"
|
|
659
|
+
: "running on cron cadence (UTC)";
|
|
660
|
+
process.stdout.write(` schedules: ${info.schedules.map((s) => s.name).join(", ")} — ${scheduleMode}\n`);
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
if (handle.playgroundDevUrl !== undefined) {
|
|
664
|
+
process.stdout.write(` playground (HMR): ${handle.playgroundDevUrl}\n`);
|
|
665
|
+
}
|
|
666
|
+
if (handle.docsUrl !== undefined) {
|
|
667
|
+
process.stdout.write(` docs: ${handle.docsUrl}\n`);
|
|
668
|
+
}
|
|
669
|
+
if (opts.bearerToken) {
|
|
670
|
+
process.stdout.write(" auth: bearer token required on API routes (playground has a token field)\n");
|
|
671
|
+
}
|
|
672
|
+
if (opts.dev &&
|
|
673
|
+
(process.env.GITHUB_WEBHOOK_SECRET === undefined ||
|
|
674
|
+
process.env.GITHUB_WEBHOOK_SECRET === "") &&
|
|
675
|
+
handle.agents.some((agent) => projectInfo(agent.project).channels.some((c) => c.kind === "github"))) {
|
|
676
|
+
process.stdout.write(` github: dev accepts unsigned loopback deliveries (${CLI} github forward works without a secret; set GITHUB_WEBHOOK_SECRET to verify signatures)\n`);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
function formatModel(model) {
|
|
680
|
+
if (model === undefined) {
|
|
681
|
+
return "(unset)";
|
|
682
|
+
}
|
|
683
|
+
if (typeof model === "string") {
|
|
684
|
+
return model;
|
|
685
|
+
}
|
|
686
|
+
return JSON.stringify(model);
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* The Cursor SDK's Connect/HTTP2 client sometimes emits uncaught stream
|
|
690
|
+
* or TLS errors (notably `NGHTTP2_FRAME_SIZE_ERROR` on large shell/tool
|
|
691
|
+
* payloads, and mid-handshake socket disconnects) outside the promise
|
|
692
|
+
* `run.wait()` returns. Without a listener the unhandled rejection exits
|
|
693
|
+
* the whole agent-serve process with code 1. Swallow those transport
|
|
694
|
+
* failures so turns can fail cleanly and the server stays up.
|
|
695
|
+
*/
|
|
696
|
+
function installTransportErrorGuards() {
|
|
697
|
+
const isTransportNoise = (reason) => {
|
|
698
|
+
var _a;
|
|
699
|
+
const message = reason instanceof Error
|
|
700
|
+
? `${reason.message}\n${(_a = reason.stack) !== null && _a !== void 0 ? _a : ""}`
|
|
701
|
+
: String(reason);
|
|
702
|
+
const code = reason !== null &&
|
|
703
|
+
typeof reason === "object" &&
|
|
704
|
+
"code" in reason &&
|
|
705
|
+
typeof reason.code === "string"
|
|
706
|
+
? reason.code
|
|
707
|
+
: undefined;
|
|
708
|
+
return (code === "ERR_HTTP2_STREAM_ERROR" ||
|
|
709
|
+
code === "ECONNRESET" ||
|
|
710
|
+
code === "ECONNREFUSED" ||
|
|
711
|
+
code === "EPIPE" ||
|
|
712
|
+
code === "ETIMEDOUT" ||
|
|
713
|
+
code === "ENOTFOUND" ||
|
|
714
|
+
code === "EAI_AGAIN" ||
|
|
715
|
+
message.includes("NGHTTP2_FRAME_SIZE_ERROR") ||
|
|
716
|
+
message.includes("Stream closed with error code") ||
|
|
717
|
+
message.includes("Client network socket disconnected before secure TLS connection was established") ||
|
|
718
|
+
message.includes("socket hang up") ||
|
|
719
|
+
message.includes("other side closed"));
|
|
720
|
+
};
|
|
721
|
+
const log = (label, reason) => {
|
|
722
|
+
const text = reason instanceof Error ? reason.message : String(reason);
|
|
723
|
+
process.stderr.write(`[agent-serve] ${label} (server stays up): ${text.slice(0, 400)}\n`);
|
|
724
|
+
};
|
|
725
|
+
process.on("unhandledRejection", (reason) => {
|
|
726
|
+
if (isTransportNoise(reason)) {
|
|
727
|
+
log("swallowed unhandledRejection", reason);
|
|
728
|
+
return;
|
|
729
|
+
}
|
|
730
|
+
log("unhandledRejection", reason);
|
|
731
|
+
});
|
|
732
|
+
process.on("uncaughtException", (error) => {
|
|
733
|
+
var _a;
|
|
734
|
+
if (isTransportNoise(error)) {
|
|
735
|
+
log("swallowed uncaughtException", error);
|
|
736
|
+
return;
|
|
737
|
+
}
|
|
738
|
+
process.stderr.write(`[agent-serve] uncaughtException: ${(_a = error.stack) !== null && _a !== void 0 ? _a : error.message}\n`);
|
|
739
|
+
process.exit(1);
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
installTransportErrorGuards();
|
|
743
|
+
// Authored agent files are TypeScript imported at runtime; install the tsx
|
|
744
|
+
// loader (and the framework import aliases on compiled runs) before any
|
|
745
|
+
// command touches a project.
|
|
746
|
+
registerAuthoredModuleLoaders()
|
|
747
|
+
.then(() => main(process.argv.slice(2)))
|
|
748
|
+
.then((code) => {
|
|
749
|
+
// Ephemeral run/eval can leave SDK/HTTP handles open; force exit.
|
|
750
|
+
process.exit(code);
|
|
751
|
+
}, (error) => {
|
|
752
|
+
process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
|
|
753
|
+
process.exit(1);
|
|
754
|
+
});
|