@cursor/july 0.1.107 → 0.1.108
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 +10 -5
- package/dist/bin/agent-serve.js +30 -8
- package/dist/channels/github/github-channel.js +8 -5
- package/dist/channels/github/types.d.ts +5 -1
- package/dist/channels/github/types.d.ts.map +1 -1
- package/dist/channels/origin/origin-channel.d.ts.map +1 -1
- package/dist/channels/origin/origin-channel.js +27 -13
- package/dist/channels/origin/types.d.ts +5 -1
- package/dist/channels/origin/types.d.ts.map +1 -1
- package/dist/channels.d.ts +45 -0
- package/dist/channels.d.ts.map +1 -1
- package/dist/channels.js +106 -7
- package/dist/connections.d.ts +2 -1
- package/dist/connections.d.ts.map +1 -1
- package/dist/connections.js +2 -1
- package/dist/docs/404.html +2 -2
- package/dist/docs/ab.html +4 -4
- package/dist/docs/assets/{app.CtuckIiL.js → app.BASKM3M4.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.BHZYsNVi.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.Bkkhnu8K.js → VPLocalSearchBox.BOKxlYGP.js} +1 -1
- package/dist/docs/assets/chunks/{theme.DhpIe0Pa.js → theme.DbDZW-zb.js} +2 -2
- package/dist/docs/assets/{deployment.md.MFPKqsqI.js → deployment.md.JenwuCCB.js} +4 -4
- package/dist/docs/assets/{deployment.md.MFPKqsqI.lean.js → deployment.md.JenwuCCB.lean.js} +1 -1
- package/dist/docs/assets/{evals.md.CbMoebP1.js → evals.md.C1ekS3k2.js} +1 -1
- package/dist/docs/assets/guides_cloud-agents.md.BsloyHdY.js +9 -0
- package/dist/docs/assets/{guides_cloud-agents.md.DS8RIjwx.lean.js → guides_cloud-agents.md.BsloyHdY.lean.js} +1 -1
- package/dist/docs/assets/{guides_github.md.c0gdGJ-D.js → guides_github.md.BH33UEBJ.js} +1 -1
- package/dist/docs/assets/{guides_grokbot-agents.md.DVqdhBKb.js → guides_grokbot-agents.md.DyV-WArv.js} +1 -1
- package/dist/docs/assets/guides_improve.md.BGVk32bK.js +14 -0
- package/dist/docs/assets/guides_improve.md.BGVk32bK.lean.js +1 -0
- package/dist/docs/assets/{guides_slack.md.9oHPye9o.js → guides_slack.md.D4RVMM4G.js} +3 -3
- package/dist/docs/assets/{guides_slack.md.9oHPye9o.lean.js → guides_slack.md.D4RVMM4G.lean.js} +1 -1
- package/dist/docs/assets/index.md.BjH1w2ZW.js +5 -0
- package/dist/docs/assets/{reference_agent-config.md.CHNpiyp4.js → reference_agent-config.md.CvoL6pof.js} +1 -1
- package/dist/docs/assets/{reference_cli.md.Dm67hd2D.js → reference_cli.md.Ca26u0Es.js} +6 -6
- package/dist/docs/assets/{reference_cli.md.Dm67hd2D.lean.js → reference_cli.md.Ca26u0Es.lean.js} +1 -1
- package/dist/docs/assets/{reference_connections.md.Di6jJAXF.js → reference_connections.md.BojkC6c5.js} +1 -1
- package/dist/docs/assets/{reference_extensions.md.CGmMLblt.js → reference_extensions.md.CPWt00ds.js} +1 -1
- package/dist/docs/assets/{scaffolding-agents.md.em43xlY1.js → scaffolding-agents.md.Kctn3OVb.js} +1 -1
- package/dist/docs/assets/{skills_create-agent.md.BVoWPcan.js → skills_create-agent.md.Q3h6Je-e.js} +1 -1
- package/dist/docs/assets/{skills_debug.md.CDbPhHfg.js → skills_debug.md.CVjCXMFF.js} +1 -1
- package/dist/docs/assets/{skills_debug.md.CDbPhHfg.lean.js → skills_debug.md.CVjCXMFF.lean.js} +1 -1
- package/dist/docs/assets/{skills_evals.md.723kpUmA.js → skills_evals.md.BhovOvrl.js} +1 -1
- package/dist/docs/assets/skills_framework-map.md.D-tFZhFS.js +1 -0
- package/dist/docs/assets/{skills_framework-map.md.haibFyoB.lean.js → skills_framework-map.md.D-tFZhFS.lean.js} +1 -1
- package/dist/docs/assets/{skills_github.md.D0JahM8c.js → skills_github.md.hgFX_oKY.js} +1 -1
- package/dist/docs/assets/troubleshooting.md.CYEAO9bM.js +1 -0
- package/dist/docs/building-with-agents.html +4 -4
- package/dist/docs/concepts.html +4 -4
- package/dist/docs/deployment.html +7 -7
- package/dist/docs/deployment.md +7 -2
- package/dist/docs/evals.html +6 -6
- package/dist/docs/evals.md +3 -2
- package/dist/docs/guides/agent-to-agent.html +4 -4
- package/dist/docs/guides/cloud-agents.html +6 -6
- package/dist/docs/guides/cloud-agents.md +4 -3
- package/dist/docs/guides/convert-automation.html +4 -4
- package/dist/docs/guides/github.html +5 -5
- package/dist/docs/guides/github.md +2 -1
- package/dist/docs/guides/grokbot-agents.html +6 -6
- package/dist/docs/guides/grokbot-agents.md +2 -2
- package/dist/docs/guides/human-in-the-loop.html +4 -4
- package/dist/docs/guides/improve.html +40 -0
- package/dist/docs/guides/improve.md +91 -0
- package/dist/docs/guides/mcp-oauth.html +4 -4
- package/dist/docs/guides/opentelemetry.html +5 -5
- package/dist/docs/guides/slack.html +6 -6
- package/dist/docs/guides/slack.md +2 -1
- package/dist/docs/guides/webhooks.html +4 -4
- package/dist/docs/hashmap.json +1 -1
- package/dist/docs/hillclimbing.html +4 -4
- package/dist/docs/index.html +6 -6
- package/dist/docs/index.md +4 -0
- package/dist/docs/llms-full.txt +158 -33
- package/dist/docs/llms.txt +1 -0
- package/dist/docs/quickstart.html +4 -4
- package/dist/docs/reference/agent-config.html +6 -6
- package/dist/docs/reference/agent-config.md +5 -2
- package/dist/docs/reference/artifacts.html +4 -4
- package/dist/docs/reference/channels.html +4 -4
- package/dist/docs/reference/cli.html +10 -10
- package/dist/docs/reference/cli.md +18 -11
- package/dist/docs/reference/connections.html +6 -6
- package/dist/docs/reference/connections.md +2 -1
- package/dist/docs/reference/extensions.html +6 -6
- package/dist/docs/reference/extensions.md +2 -0
- package/dist/docs/reference/hooks.html +4 -4
- package/dist/docs/reference/http-api.html +4 -4
- package/dist/docs/reference/instructions.html +4 -4
- package/dist/docs/reference/playground.html +4 -4
- package/dist/docs/reference/project-layout.html +4 -4
- package/dist/docs/reference/prompt.html +4 -4
- package/dist/docs/reference/result.html +4 -4
- package/dist/docs/reference/schedules.html +4 -4
- package/dist/docs/reference/sessions.html +4 -4
- package/dist/docs/reference/skills.html +4 -4
- package/dist/docs/reference/subagents.html +4 -4
- package/dist/docs/reference/tools.html +4 -4
- package/dist/docs/scaffolding-agents.html +5 -5
- package/dist/docs/scaffolding-agents.md +2 -1
- package/dist/docs/skills/ab.html +4 -4
- package/dist/docs/skills/create-agent.html +6 -6
- package/dist/docs/skills/create-agent.md +1 -1
- package/dist/docs/skills/debug.html +5 -5
- package/dist/docs/skills/debug.md +1 -1
- package/dist/docs/skills/evals.html +6 -6
- package/dist/docs/skills/evals.md +1 -1
- package/dist/docs/skills/framework-map.html +5 -5
- package/dist/docs/skills/framework-map.md +4 -2
- package/dist/docs/skills/github.html +6 -6
- package/dist/docs/skills/github.md +1 -1
- package/dist/docs/skills/hillclimb.html +4 -4
- package/dist/docs/skills/index.html +4 -4
- package/dist/docs/skills/mcp-auth.html +4 -4
- package/dist/docs/skills/otel.html +4 -4
- package/dist/docs/skills/setup-slack.html +4 -4
- package/dist/docs/storage.html +4 -4
- package/dist/docs/templates/agentic-owners.html +4 -4
- package/dist/docs/templates/agents-md.html +4 -4
- package/dist/docs/templates/code-wiki.html +4 -4
- package/dist/docs/templates/demo.html +4 -4
- package/dist/docs/templates/grokbot-agents.html +4 -4
- package/dist/docs/templates/pr-autofixer.html +4 -4
- package/dist/docs/templates/security-help.html +4 -4
- package/dist/docs/templates/security-reviewer.html +4 -4
- package/dist/docs/templates/triage.html +4 -4
- package/dist/docs/troubleshooting.html +5 -5
- package/dist/docs/troubleshooting.md +1 -1
- package/dist/extensions/improve/extension.d.ts +46 -0
- package/dist/extensions/improve/extension.d.ts.map +1 -0
- package/dist/extensions/improve/extension.js +41 -0
- package/dist/extensions/improve/skills/yourself.d.ts +4 -0
- package/dist/extensions/improve/skills/yourself.d.ts.map +1 -0
- package/dist/extensions/improve/skills/yourself.js +43 -0
- package/dist/internal/builtin-tools/artifacts.d.ts.map +1 -1
- package/dist/internal/builtin-tools/artifacts.js +2 -3
- package/dist/internal/channel-route-dispatch.d.ts +13 -0
- package/dist/internal/channel-route-dispatch.d.ts.map +1 -0
- package/dist/internal/channel-route-dispatch.js +62 -0
- package/dist/internal/channel-state.d.ts +17 -0
- package/dist/internal/channel-state.d.ts.map +1 -0
- package/dist/internal/channel-state.js +78 -0
- package/dist/internal/cli-ax.d.ts +7 -0
- package/dist/internal/cli-ax.d.ts.map +1 -1
- package/dist/internal/cli-ax.js +99 -1
- package/dist/internal/cli-cursor.d.ts.map +1 -1
- package/dist/internal/cli-cursor.js +2 -0
- package/dist/internal/cli-deploy.d.ts.map +1 -1
- package/dist/internal/cli-deploy.js +38 -14
- package/dist/internal/cli-mcp-oauth.d.ts.map +1 -1
- package/dist/internal/cli-mcp-oauth.js +15 -0
- package/dist/internal/cli-mcp.d.ts.map +1 -1
- package/dist/internal/cli-mcp.js +12 -0
- package/dist/internal/cli-slack.d.ts.map +1 -1
- package/dist/internal/cli-slack.js +8 -2
- package/dist/internal/cursor/credentials.d.ts +8 -2
- package/dist/internal/cursor/credentials.d.ts.map +1 -1
- package/dist/internal/cursor/credentials.js +27 -5
- package/dist/internal/deploy-client.d.ts +27 -0
- package/dist/internal/deploy-client.d.ts.map +1 -1
- package/dist/internal/deploy-client.js +32 -0
- package/dist/internal/deploy-manifest.d.ts +23 -0
- package/dist/internal/deploy-manifest.d.ts.map +1 -1
- package/dist/internal/deploy-manifest.js +84 -1
- package/dist/internal/describe-error.d.ts +1 -0
- package/dist/internal/describe-error.d.ts.map +1 -1
- package/dist/internal/describe-error.js +25 -0
- package/dist/internal/guest-network.d.ts +4 -10
- package/dist/internal/guest-network.d.ts.map +1 -1
- package/dist/internal/guest-network.js +42 -26
- package/dist/internal/hosted-admission-adapter.d.ts +2 -0
- package/dist/internal/hosted-admission-adapter.d.ts.map +1 -1
- package/dist/internal/hosted-catch-protocol.d.ts +51 -0
- package/dist/internal/hosted-catch-protocol.d.ts.map +1 -0
- package/dist/internal/hosted-catch-protocol.js +103 -0
- package/dist/internal/hosted-catch.d.ts +40 -0
- package/dist/internal/hosted-catch.d.ts.map +1 -0
- package/dist/internal/hosted-catch.js +149 -0
- package/dist/internal/hosted-delivery-protocol.d.ts +41 -0
- package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -1
- package/dist/internal/hosted-delivery-protocol.js +249 -0
- package/dist/internal/hosted-delivery.d.ts +10 -1
- package/dist/internal/hosted-delivery.d.ts.map +1 -1
- package/dist/internal/hosted-delivery.js +100 -22
- package/dist/internal/hosted-execution-diag.d.ts +4 -1
- package/dist/internal/hosted-execution-diag.d.ts.map +1 -1
- package/dist/internal/hosted-execution-diag.js +13 -4
- package/dist/internal/hosted-execution-flush.d.ts +3 -0
- package/dist/internal/hosted-execution-flush.d.ts.map +1 -1
- package/dist/internal/hosted-execution-flush.js +2 -4
- package/dist/internal/http-control-plane-session.d.ts +30 -0
- package/dist/internal/http-control-plane-session.d.ts.map +1 -0
- package/dist/internal/http-control-plane-session.js +83 -0
- package/dist/internal/legacy-command-guard.d.ts +22 -0
- package/dist/internal/legacy-command-guard.d.ts.map +1 -0
- package/dist/internal/legacy-command-guard.js +51 -0
- package/dist/internal/platform-timers.d.ts +7 -0
- package/dist/internal/platform-timers.d.ts.map +1 -1
- package/dist/internal/platform-timers.js +139 -0
- package/dist/internal/reminder-control-plane-protocol.d.ts +2 -0
- package/dist/internal/reminder-control-plane-protocol.d.ts.map +1 -1
- package/dist/internal/reminder-control-plane-protocol.js +9 -2
- package/dist/internal/reminder-runner.d.ts +8 -0
- package/dist/internal/reminder-runner.d.ts.map +1 -1
- package/dist/internal/reminder-runner.js +36 -9
- package/dist/internal/resolve-prod-target.d.ts +2 -0
- package/dist/internal/resolve-prod-target.d.ts.map +1 -1
- package/dist/internal/resolve-prod-target.js +13 -0
- package/dist/internal/sdk-runner.d.ts.map +1 -1
- package/dist/internal/sdk-runner.js +4 -3
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +57 -56
- package/dist/internal/session-engine.d.ts +2 -6
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +95 -67
- package/dist/playground/assets/{index-Bq2HpEQB.js → index-BMDqAeXu.js} +28 -28
- package/dist/playground/assets/index-LUgJoWdL.css +1 -0
- package/dist/playground/index.html +2 -2
- package/dist/storage-backends/cursor-hosted.d.ts +6 -0
- package/dist/storage-backends/cursor-hosted.d.ts.map +1 -1
- package/dist/storage-backends/cursor-hosted.js +29 -1
- package/dist/types.d.ts +33 -5
- package/dist/types.d.ts.map +1 -1
- package/docs/README.md +4 -0
- package/docs/deployment.md +7 -2
- package/docs/evals.md +3 -2
- package/docs/guides/cloud-agents.md +4 -3
- package/docs/guides/github.md +2 -1
- package/docs/guides/grokbot-agents.md +2 -2
- package/docs/guides/improve.md +96 -0
- package/docs/guides/slack.md +2 -1
- package/docs/reference/agent-config.md +5 -2
- package/docs/reference/cli.md +18 -11
- package/docs/reference/connections.md +2 -1
- package/docs/reference/extensions.md +2 -0
- package/docs/scaffolding-agents.md +2 -1
- package/docs/troubleshooting.md +1 -1
- package/package.json +8 -1
- package/skills/create-agent/SKILL.md +1 -1
- package/skills/debug/SKILL.md +1 -1
- package/skills/evals/SKILL.md +1 -1
- package/skills/framework-map/SKILL.md +4 -2
- package/skills/github/SKILL.md +1 -1
- package/src/bin/agent-serve.ts +27 -2
- package/src/channels/github/github-channel.ts +8 -8
- package/src/channels/github/types.ts +5 -0
- package/src/channels/origin/origin-channel.ts +29 -13
- package/src/channels/origin/types.ts +5 -0
- package/src/channels.ts +157 -10
- package/src/connections.ts +2 -1
- package/src/extensions/improve/extension.ts +70 -0
- package/src/extensions/improve/skills/yourself.ts +50 -0
- package/src/internal/builtin-tools/artifacts.ts +2 -3
- package/src/internal/channel-route-dispatch.ts +66 -0
- package/src/internal/channel-state.ts +96 -0
- package/src/internal/cli-ax.ts +110 -1
- package/src/internal/cli-cursor.ts +4 -1
- package/src/internal/cli-deploy.ts +50 -10
- package/src/internal/cli-mcp-oauth.ts +18 -0
- package/src/internal/cli-mcp.ts +11 -0
- package/src/internal/cli-slack.ts +15 -2
- package/src/internal/cursor/credentials.ts +35 -7
- package/src/internal/deploy-client.ts +54 -0
- package/src/internal/deploy-manifest.ts +115 -1
- package/src/internal/describe-error.ts +28 -0
- package/src/internal/guest-network.ts +43 -29
- package/src/internal/hosted-admission-adapter.ts +2 -0
- package/src/internal/hosted-catch-protocol.ts +130 -0
- package/src/internal/hosted-catch.ts +192 -0
- package/src/internal/hosted-delivery-protocol.ts +387 -0
- package/src/internal/hosted-delivery.ts +155 -22
- package/src/internal/hosted-execution-diag.ts +21 -3
- package/src/internal/hosted-execution-flush.ts +6 -3
- package/src/internal/http-control-plane-session.ts +104 -0
- package/src/internal/legacy-command-guard.ts +59 -0
- package/src/internal/platform-timers.ts +191 -0
- package/src/internal/reminder-control-plane-protocol.ts +15 -2
- package/src/internal/reminder-runner.ts +60 -9
- package/src/internal/resolve-prod-target.ts +15 -0
- package/src/internal/sdk-runner.ts +2 -1
- package/src/internal/server.ts +89 -79
- package/src/internal/session-engine.ts +141 -83
- package/src/storage-backends/cursor-hosted.ts +40 -1
- package/src/types.ts +39 -6
- package/dist/docs/assets/chunks/@localSearchIndexroot.DXXZxiMv.js +0 -1
- package/dist/docs/assets/guides_cloud-agents.md.DS8RIjwx.js +0 -9
- package/dist/docs/assets/index.md.BW_6tOgR.js +0 -5
- package/dist/docs/assets/skills_framework-map.md.haibFyoB.js +0 -1
- package/dist/docs/assets/troubleshooting.md.Cus_YZga.js +0 -1
- package/dist/playground/assets/index-CZKKNlmb.css +0 -1
- /package/dist/docs/assets/{evals.md.CbMoebP1.lean.js → evals.md.C1ekS3k2.lean.js} +0 -0
- /package/dist/docs/assets/{guides_github.md.c0gdGJ-D.lean.js → guides_github.md.BH33UEBJ.lean.js} +0 -0
- /package/dist/docs/assets/{guides_grokbot-agents.md.DVqdhBKb.lean.js → guides_grokbot-agents.md.DyV-WArv.lean.js} +0 -0
- /package/dist/docs/assets/{index.md.BW_6tOgR.lean.js → index.md.BjH1w2ZW.lean.js} +0 -0
- /package/dist/docs/assets/{reference_agent-config.md.CHNpiyp4.lean.js → reference_agent-config.md.CvoL6pof.lean.js} +0 -0
- /package/dist/docs/assets/{reference_connections.md.Di6jJAXF.lean.js → reference_connections.md.BojkC6c5.lean.js} +0 -0
- /package/dist/docs/assets/{reference_extensions.md.CGmMLblt.lean.js → reference_extensions.md.CPWt00ds.lean.js} +0 -0
- /package/dist/docs/assets/{scaffolding-agents.md.em43xlY1.lean.js → scaffolding-agents.md.Kctn3OVb.lean.js} +0 -0
- /package/dist/docs/assets/{skills_create-agent.md.BVoWPcan.lean.js → skills_create-agent.md.Q3h6Je-e.lean.js} +0 -0
- /package/dist/docs/assets/{skills_evals.md.723kpUmA.lean.js → skills_evals.md.BhovOvrl.lean.js} +0 -0
- /package/dist/docs/assets/{skills_github.md.D0JahM8c.lean.js → skills_github.md.hgFX_oKY.lean.js} +0 -0
- /package/dist/docs/assets/{troubleshooting.md.Cus_YZga.lean.js → troubleshooting.md.CYEAO9bM.lean.js} +0 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Catch ingress wire contract, July copy. The control plane keeps a
|
|
3
|
+
* byte-identical copy of these constants in
|
|
4
|
+
* `backend/packages/server-shared/src/agentServe/agentSdkCatch.ts`; a
|
|
5
|
+
* backend drift test compares the two as text. Neither package imports the
|
|
6
|
+
* other.
|
|
7
|
+
*
|
|
8
|
+
* A caught request is one hosted admission whose `eventType` is
|
|
9
|
+
* {@link AGENT_SDK_CATCH_EVENT_TYPE} and whose `payload` is a
|
|
10
|
+
* {@link CatchRequestEnvelope}: the HTTP request the control plane
|
|
11
|
+
* accepted on a manifest-declared route after verifying the deployment's
|
|
12
|
+
* secret. July replays it into the authored route handler; the control
|
|
13
|
+
* plane never runs channel code.
|
|
14
|
+
*/
|
|
15
|
+
export declare const AGENT_SDK_CATCH_ENVELOPE_VERSION = 1;
|
|
16
|
+
export declare const AGENT_SDK_CATCH_EVENT_TYPE = "http.request";
|
|
17
|
+
export declare const AGENT_SDK_CUSTOM_CHANNEL_KIND = "custom";
|
|
18
|
+
export declare const AGENT_SDK_SESSION_EVENT_TYPE = "agentsdk.session";
|
|
19
|
+
export declare const AGENT_SDK_HTTP_CHANNEL_ID = "http";
|
|
20
|
+
export declare const AGENT_SDK_HTTP_CHANNEL_KIND = "http";
|
|
21
|
+
export declare const AGENT_SDK_SESSION_RESUME_KEY_PREFIX = "cont:session:";
|
|
22
|
+
export declare const AGENT_SDK_CATCH_MAX_BODY_BYTES: number;
|
|
23
|
+
export declare const AGENT_SDK_CATCH_ROUTE_METHODS: readonly ["GET", "POST", "PUT", "PATCH", "DELETE"];
|
|
24
|
+
export type CatchRouteMethod = (typeof AGENT_SDK_CATCH_ROUTE_METHODS)[number];
|
|
25
|
+
export type CatchRequestEnvelope = {
|
|
26
|
+
v: 1;
|
|
27
|
+
method: CatchRouteMethod;
|
|
28
|
+
/** Channel-relative path, e.g. `/webhook`. */
|
|
29
|
+
path: string;
|
|
30
|
+
/** Raw query string without the leading `?`; empty when absent. */
|
|
31
|
+
query: string;
|
|
32
|
+
/** Lowercased header names. */
|
|
33
|
+
headers: Record<string, string>;
|
|
34
|
+
body: {
|
|
35
|
+
encoding: "utf8" | "base64";
|
|
36
|
+
data: string;
|
|
37
|
+
} | null;
|
|
38
|
+
receivedAt: string;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Mailbox key the control plane stamps on an explicit `ses_…` resume. The
|
|
42
|
+
* suffix is the CP session id the hosted execution also names, so the
|
|
43
|
+
* engine can recognise the key as "this existing session" rather than a
|
|
44
|
+
* new continuation identity.
|
|
45
|
+
*/
|
|
46
|
+
export declare function hostedSessionResumeKey(sessionPublicId: string): string;
|
|
47
|
+
/** Strict parse of a claim-checked catch envelope; anything else is undefined. */
|
|
48
|
+
export declare function parseCatchRequestEnvelope(value: unknown): CatchRequestEnvelope | undefined;
|
|
49
|
+
/** Raw request bytes from an envelope body; empty for a null body. */
|
|
50
|
+
export declare function decodeCatchBody(body: CatchRequestEnvelope["body"]): Buffer;
|
|
51
|
+
//# sourceMappingURL=hosted-catch-protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosted-catch-protocol.d.ts","sourceRoot":"","sources":["../../src/internal/hosted-catch-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,gCAAgC,IAAI,CAAC;AAClD,eAAO,MAAM,0BAA0B,iBAAiB,CAAC;AACzD,eAAO,MAAM,6BAA6B,WAAW,CAAC;AACtD,eAAO,MAAM,4BAA4B,qBAAqB,CAAC;AAC/D,eAAO,MAAM,yBAAyB,SAAS,CAAC;AAChD,eAAO,MAAM,2BAA2B,SAAS,CAAC;AAClD,eAAO,MAAM,mCAAmC,kBAAkB,CAAC;AACnE,eAAO,MAAM,8BAA8B,EAAE,MAAmB,CAAC;AAEjE,eAAO,MAAM,6BAA6B,YACxC,KAAK,EACL,MAAM,EACN,KAAK,EACL,OAAO,EACP,QAAQ,CACA,CAAC;AACX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,6BAA6B,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9E,MAAM,MAAM,oBAAoB,GAAG;IACjC,CAAC,EAAE,CAAC,CAAC;IACL,MAAM,EAAE,gBAAgB,CAAC;IACzB,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC3D,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAEtE;AAqBD,kFAAkF;AAClF,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,OAAO,GACb,oBAAoB,GAAG,SAAS,CA2ClC;AAED,sEAAsE;AACtE,wBAAgB,eAAe,CAAC,IAAI,EAAE,oBAAoB,CAAC,MAAM,CAAC,GAAG,MAAM,CAK1E"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Catch ingress wire contract, July copy. The control plane keeps a
|
|
3
|
+
* byte-identical copy of these constants in
|
|
4
|
+
* `backend/packages/server-shared/src/agentServe/agentSdkCatch.ts`; a
|
|
5
|
+
* backend drift test compares the two as text. Neither package imports the
|
|
6
|
+
* other.
|
|
7
|
+
*
|
|
8
|
+
* A caught request is one hosted admission whose `eventType` is
|
|
9
|
+
* {@link AGENT_SDK_CATCH_EVENT_TYPE} and whose `payload` is a
|
|
10
|
+
* {@link CatchRequestEnvelope}: the HTTP request the control plane
|
|
11
|
+
* accepted on a manifest-declared route after verifying the deployment's
|
|
12
|
+
* secret. July replays it into the authored route handler; the control
|
|
13
|
+
* plane never runs channel code.
|
|
14
|
+
*/
|
|
15
|
+
export const AGENT_SDK_CATCH_ENVELOPE_VERSION = 1;
|
|
16
|
+
export const AGENT_SDK_CATCH_EVENT_TYPE = "http.request";
|
|
17
|
+
export const AGENT_SDK_CUSTOM_CHANNEL_KIND = "custom";
|
|
18
|
+
export const AGENT_SDK_SESSION_EVENT_TYPE = "agentsdk.session";
|
|
19
|
+
export const AGENT_SDK_HTTP_CHANNEL_ID = "http";
|
|
20
|
+
export const AGENT_SDK_HTTP_CHANNEL_KIND = "http";
|
|
21
|
+
export const AGENT_SDK_SESSION_RESUME_KEY_PREFIX = "cont:session:";
|
|
22
|
+
export const AGENT_SDK_CATCH_MAX_BODY_BYTES = 256 * 1024;
|
|
23
|
+
export const AGENT_SDK_CATCH_ROUTE_METHODS = [
|
|
24
|
+
"GET",
|
|
25
|
+
"POST",
|
|
26
|
+
"PUT",
|
|
27
|
+
"PATCH",
|
|
28
|
+
"DELETE",
|
|
29
|
+
];
|
|
30
|
+
/**
|
|
31
|
+
* Mailbox key the control plane stamps on an explicit `ses_…` resume. The
|
|
32
|
+
* suffix is the CP session id the hosted execution also names, so the
|
|
33
|
+
* engine can recognise the key as "this existing session" rather than a
|
|
34
|
+
* new continuation identity.
|
|
35
|
+
*/
|
|
36
|
+
export function hostedSessionResumeKey(sessionPublicId) {
|
|
37
|
+
return `${AGENT_SDK_SESSION_RESUME_KEY_PREFIX}${sessionPublicId}`;
|
|
38
|
+
}
|
|
39
|
+
const ENVELOPE_KEYS = new Set([
|
|
40
|
+
"v",
|
|
41
|
+
"method",
|
|
42
|
+
"path",
|
|
43
|
+
"query",
|
|
44
|
+
"headers",
|
|
45
|
+
"body",
|
|
46
|
+
"receivedAt",
|
|
47
|
+
]);
|
|
48
|
+
const METHODS = new Set(AGENT_SDK_CATCH_ROUTE_METHODS);
|
|
49
|
+
const MAX_PATH_CHARS = 1024;
|
|
50
|
+
const MAX_QUERY_CHARS = 4096;
|
|
51
|
+
const MAX_HEADER_COUNT = 64;
|
|
52
|
+
const MAX_HEADER_BYTES = 16 * 1024;
|
|
53
|
+
function isRecord(value) {
|
|
54
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
55
|
+
}
|
|
56
|
+
/** Strict parse of a claim-checked catch envelope; anything else is undefined. */
|
|
57
|
+
export function parseCatchRequestEnvelope(value) {
|
|
58
|
+
if (!isRecord(value)) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
if (Object.keys(value).some((key) => !ENVELOPE_KEYS.has(key)) ||
|
|
62
|
+
value.v !== AGENT_SDK_CATCH_ENVELOPE_VERSION ||
|
|
63
|
+
typeof value.method !== "string" ||
|
|
64
|
+
!METHODS.has(value.method) ||
|
|
65
|
+
typeof value.path !== "string" ||
|
|
66
|
+
!value.path.startsWith("/") ||
|
|
67
|
+
value.path.length > MAX_PATH_CHARS ||
|
|
68
|
+
typeof value.query !== "string" ||
|
|
69
|
+
value.query.length > MAX_QUERY_CHARS ||
|
|
70
|
+
typeof value.receivedAt !== "string" ||
|
|
71
|
+
!isRecord(value.headers)) {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
const entries = Object.entries(value.headers);
|
|
75
|
+
if (entries.length > MAX_HEADER_COUNT) {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
let headerBytes = 0;
|
|
79
|
+
for (const [name, headerValue] of entries) {
|
|
80
|
+
if (typeof headerValue !== "string" || name !== name.toLowerCase()) {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
headerBytes += name.length + headerValue.length;
|
|
84
|
+
}
|
|
85
|
+
if (headerBytes > MAX_HEADER_BYTES) {
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
if (value.body !== null) {
|
|
89
|
+
if (!isRecord(value.body) ||
|
|
90
|
+
(value.body.encoding !== "utf8" && value.body.encoding !== "base64") ||
|
|
91
|
+
typeof value.body.data !== "string") {
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return value;
|
|
96
|
+
}
|
|
97
|
+
/** Raw request bytes from an envelope body; empty for a null body. */
|
|
98
|
+
export function decodeCatchBody(body) {
|
|
99
|
+
if (body === null) {
|
|
100
|
+
return Buffer.alloc(0);
|
|
101
|
+
}
|
|
102
|
+
return Buffer.from(body.data, body.encoding);
|
|
103
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hosted admission for caught HTTP requests.
|
|
3
|
+
*
|
|
4
|
+
* The control plane accepted a request on one of this channel's declared
|
|
5
|
+
* routes, verified the deployment's secret, and claim-checked the request
|
|
6
|
+
* as a {@link CatchRequestEnvelope}. Admission replays that request into
|
|
7
|
+
* the authored route handler exactly as the local router would have
|
|
8
|
+
* (same route table, same Zod schema gate), with the control plane as the
|
|
9
|
+
* authenticated principal. A captured `send()` becomes the pending send;
|
|
10
|
+
* a handler that answers without sending is a `skip`.
|
|
11
|
+
*/
|
|
12
|
+
import type { AuthContext, ChannelDefinition, ChannelHandlerArgs, ChannelRoute } from "../types.js";
|
|
13
|
+
import { type CatchRequestEnvelope } from "./hosted-catch-protocol.js";
|
|
14
|
+
/** Header a replayed request carries so handlers can dedupe on delivery. */
|
|
15
|
+
export declare const CATCH_DELIVERY_ID_HEADER = "x-agent-sdk-delivery-id";
|
|
16
|
+
/**
|
|
17
|
+
* Principal for a replayed request. The deployment secret was checked by
|
|
18
|
+
* the control plane before compute existed; the channel's own auth chain
|
|
19
|
+
* does not run again in the VM.
|
|
20
|
+
*/
|
|
21
|
+
export declare const CATCH_AUTH_CONTEXT: AuthContext;
|
|
22
|
+
export declare function catchRequestFromEnvelope(input: {
|
|
23
|
+
channelId: string;
|
|
24
|
+
deliveryId: string;
|
|
25
|
+
envelope: CatchRequestEnvelope;
|
|
26
|
+
}): Request;
|
|
27
|
+
export declare function replayCatchRequest(input: {
|
|
28
|
+
channelId: string;
|
|
29
|
+
deliveryId: string;
|
|
30
|
+
routes: readonly ChannelRoute[];
|
|
31
|
+
payload: unknown;
|
|
32
|
+
args: ChannelHandlerArgs;
|
|
33
|
+
}): Promise<Response>;
|
|
34
|
+
/**
|
|
35
|
+
* Attach catch admission to an authored channel. Provider packs attach
|
|
36
|
+
* their own adapter afterwards and replace this one; the control plane
|
|
37
|
+
* never sends `http.request` to a pack kind in any case.
|
|
38
|
+
*/
|
|
39
|
+
export declare function attachCatchAdmission(definition: ChannelDefinition<unknown>, routes: readonly ChannelRoute[]): void;
|
|
40
|
+
//# sourceMappingURL=hosted-catch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosted-catch.d.ts","sourceRoot":"","sources":["../../src/internal/hosted-catch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,EACb,MAAM,aAAa,CAAC;AAUrB,OAAO,EAGL,KAAK,oBAAoB,EAG1B,MAAM,4BAA4B,CAAC;AAIpC,4EAA4E;AAC5E,eAAO,MAAM,wBAAwB,4BAA4B,CAAC;AAIlE;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,WAIhC,CAAC;AAIF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,oBAAoB,CAAC;CAChC,GAAG,OAAO,CAgBV;AAED,wBAAsB,kBAAkB,CAAC,KAAK,EAAE;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,SAAS,YAAY,EAAE,CAAC;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,kBAAkB,CAAC;CAC1B,GAAG,OAAO,CAAC,QAAQ,CAAC,CAkFpB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,iBAAiB,CAAC,OAAO,CAAC,EACtC,MAAM,EAAE,SAAS,YAAY,EAAE,GAC9B,IAAI,CAgBN"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hosted admission for caught HTTP requests.
|
|
3
|
+
*
|
|
4
|
+
* The control plane accepted a request on one of this channel's declared
|
|
5
|
+
* routes, verified the deployment's secret, and claim-checked the request
|
|
6
|
+
* as a {@link CatchRequestEnvelope}. Admission replays that request into
|
|
7
|
+
* the authored route handler exactly as the local router would have
|
|
8
|
+
* (same route table, same Zod schema gate), with the control plane as the
|
|
9
|
+
* authenticated principal. A captured `send()` becomes the pending send;
|
|
10
|
+
* a handler that answers without sending is a `skip`.
|
|
11
|
+
*/
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
import { acknowledgeTurn, dispatchOutcome, skipped, tagOutcome, } from "./channel-dispatch.js";
|
|
22
|
+
import { invokeChannelRoute } from "./channel-route-dispatch.js";
|
|
23
|
+
import { DeferredChannelSessionError } from "./deferred-channel-session.js";
|
|
24
|
+
import { attachHostedAdmissionAdapter } from "./hosted-admission-adapter.js";
|
|
25
|
+
import { AGENT_SDK_CATCH_EVENT_TYPE, AGENT_SDK_CUSTOM_CHANNEL_KIND, decodeCatchBody, parseCatchRequestEnvelope, } from "./hosted-catch-protocol.js";
|
|
26
|
+
import { errorResponse } from "./http-channel.js";
|
|
27
|
+
import { Router } from "./router.js";
|
|
28
|
+
/** Header a replayed request carries so handlers can dedupe on delivery. */
|
|
29
|
+
export const CATCH_DELIVERY_ID_HEADER = "x-agent-sdk-delivery-id";
|
|
30
|
+
/** Placeholder origin for replayed requests; handlers see a well-formed URL. */
|
|
31
|
+
const CATCH_REQUEST_ORIGIN = "http://agent-sdk.hosted";
|
|
32
|
+
/**
|
|
33
|
+
* Principal for a replayed request. The deployment secret was checked by
|
|
34
|
+
* the control plane before compute existed; the channel's own auth chain
|
|
35
|
+
* does not run again in the VM.
|
|
36
|
+
*/
|
|
37
|
+
export const CATCH_AUTH_CONTEXT = {
|
|
38
|
+
authenticator: "control-plane-catch",
|
|
39
|
+
principalId: "agent-sdk:catch",
|
|
40
|
+
principalType: "runtime",
|
|
41
|
+
};
|
|
42
|
+
const BODYLESS_METHODS = new Set(["GET", "HEAD"]);
|
|
43
|
+
export function catchRequestFromEnvelope(input) {
|
|
44
|
+
const { envelope } = input;
|
|
45
|
+
const url = `${CATCH_REQUEST_ORIGIN}/v1/channels/${input.channelId}${envelope.path}${envelope.query === "" ? "" : `?${envelope.query}`}`;
|
|
46
|
+
const headers = new Headers(envelope.headers);
|
|
47
|
+
headers.set(CATCH_DELIVERY_ID_HEADER, input.deliveryId);
|
|
48
|
+
const body = decodeCatchBody(envelope.body);
|
|
49
|
+
return new Request(url, {
|
|
50
|
+
method: envelope.method,
|
|
51
|
+
headers,
|
|
52
|
+
body: body.length === 0 || BODYLESS_METHODS.has(envelope.method)
|
|
53
|
+
? undefined
|
|
54
|
+
: new Uint8Array(body),
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
export function replayCatchRequest(input) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
const envelope = parseCatchRequestEnvelope(input.payload);
|
|
60
|
+
if (envelope === undefined) {
|
|
61
|
+
return errorResponse(400, "invalid_catch_envelope", "Expected a supported Agent SDK catch request envelope.");
|
|
62
|
+
}
|
|
63
|
+
const router = new Router();
|
|
64
|
+
for (const route of input.routes) {
|
|
65
|
+
router.add({
|
|
66
|
+
method: route.method,
|
|
67
|
+
pattern: route.path,
|
|
68
|
+
auth: "none",
|
|
69
|
+
handler: () => errorResponse(500, "unreachable", "unreachable"),
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
const matched = router.match(envelope.method, envelope.path);
|
|
73
|
+
const route = input.routes.find((candidate) => candidate.method === (matched === null || matched === void 0 ? void 0 : matched.route.method) &&
|
|
74
|
+
candidate.path === matched.route.pattern);
|
|
75
|
+
if (matched === undefined || route === undefined) {
|
|
76
|
+
// The control plane routes from the same pinned manifest this VM was
|
|
77
|
+
// frozen from; a miss here is drift, not a caller error.
|
|
78
|
+
return errorResponse(404, "route_not_declared", `No ${envelope.method} ${envelope.path} route is mounted on channel "${input.channelId}".`);
|
|
79
|
+
}
|
|
80
|
+
const request = catchRequestFromEnvelope({
|
|
81
|
+
channelId: input.channelId,
|
|
82
|
+
deliveryId: input.deliveryId,
|
|
83
|
+
envelope,
|
|
84
|
+
});
|
|
85
|
+
let response;
|
|
86
|
+
try {
|
|
87
|
+
response = yield invokeChannelRoute({
|
|
88
|
+
route,
|
|
89
|
+
request,
|
|
90
|
+
handlerArgs: Object.assign(Object.assign({}, input.args), { params: matched.params, auth: CATCH_AUTH_CONTEXT }),
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
// `return Response.json({ sessionId: session.id })` after `send()` is
|
|
95
|
+
// the ordinary local webhook shape. Hosted, `send()` is captured and the
|
|
96
|
+
// handle is deferred, so reading `.id` throws — but nobody reads this
|
|
97
|
+
// handler's HTTP reply hosted; the captured send is the outcome.
|
|
98
|
+
if (error instanceof DeferredChannelSessionError) {
|
|
99
|
+
return acknowledgeTurn();
|
|
100
|
+
}
|
|
101
|
+
throw error;
|
|
102
|
+
}
|
|
103
|
+
// A 2xx the handler did not tag and in which nothing was captured means
|
|
104
|
+
// it handled the request itself (acknowledged, ignored, replied). There is
|
|
105
|
+
// nothing to execute: report skip instead of failing the delivery.
|
|
106
|
+
if (response.ok && dispatchOutcome(response) === undefined) {
|
|
107
|
+
return tagOutcome(response, "skip");
|
|
108
|
+
}
|
|
109
|
+
// A 4xx is the handler rejecting the sender (bad signature on a
|
|
110
|
+
// handler-verified `publicEndpoint()` route, schema mismatch, unknown
|
|
111
|
+
// event). The sender already has its 202; retrying the delivery cannot
|
|
112
|
+
// change the verdict, so report a cheap skip that lets the control plane
|
|
113
|
+
// discard the compute instead of failing and retrying the activity.
|
|
114
|
+
if (response.status >= 400 && response.status < 500) {
|
|
115
|
+
// Logged so a probed public route or a misconfigured provider secret is
|
|
116
|
+
// distinguishable from a benign "nothing to do" skip in the guest logs;
|
|
117
|
+
// the wire outcome to the control plane is still `skip`.
|
|
118
|
+
console.info(`[agent-sdk] catch replay rejected by handler deliveryId=${input.deliveryId} channelId=${input.channelId} route=${envelope.method} ${route.path} status=${String(response.status)}`);
|
|
119
|
+
return skipped(`handler rejected the request (${response.status})`, {
|
|
120
|
+
status: response.status,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
return response;
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Attach catch admission to an authored channel. Provider packs attach
|
|
128
|
+
* their own adapter afterwards and replace this one; the control plane
|
|
129
|
+
* never sends `http.request` to a pack kind in any case.
|
|
130
|
+
*/
|
|
131
|
+
export function attachCatchAdmission(definition, routes) {
|
|
132
|
+
var _a;
|
|
133
|
+
var _b;
|
|
134
|
+
attachHostedAdmissionAdapter(definition, {
|
|
135
|
+
kind: (_b = (_a = definition.meta) === null || _a === void 0 ? void 0 : _a.kind) !== null && _b !== void 0 ? _b : AGENT_SDK_CUSTOM_CHANNEL_KIND,
|
|
136
|
+
dispatch: ({ channelId, eventType, payload, deliveryId, args }) => {
|
|
137
|
+
if (eventType !== AGENT_SDK_CATCH_EVENT_TYPE) {
|
|
138
|
+
return Promise.resolve(skipped("not a caught http request"));
|
|
139
|
+
}
|
|
140
|
+
return replayCatchRequest({
|
|
141
|
+
channelId: channelId !== null && channelId !== void 0 ? channelId : "channel",
|
|
142
|
+
deliveryId,
|
|
143
|
+
routes,
|
|
144
|
+
payload,
|
|
145
|
+
args,
|
|
146
|
+
});
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
}
|
|
@@ -5,10 +5,23 @@ export declare const HOSTED_EXECUTION_PATH = "/v1/internal/hosted-execution";
|
|
|
5
5
|
export declare const HOSTED_GUEST_RETRY_TRANSIENT = "transient";
|
|
6
6
|
export declare const HOSTED_GUEST_RETRY_TERMINAL = "terminal";
|
|
7
7
|
export type HostedGuestRetryDisposition = typeof HOSTED_GUEST_RETRY_TRANSIENT | typeof HOSTED_GUEST_RETRY_TERMINAL;
|
|
8
|
+
export declare const HOSTED_FAILURE_CLASSIFICATION_VERSION = 1;
|
|
9
|
+
export type HostedFailureDomain = "configuration" | "protocol" | "platform" | "agent" | "dependency" | "cancellation" | "unknown";
|
|
10
|
+
export type HostedFailureSource = "tas" | "factory" | "anyrun" | "engine" | "agent";
|
|
11
|
+
export type HostedFailureClassification = {
|
|
12
|
+
v: typeof HOSTED_FAILURE_CLASSIFICATION_VERSION;
|
|
13
|
+
domain: HostedFailureDomain;
|
|
14
|
+
source: HostedFailureSource;
|
|
15
|
+
};
|
|
16
|
+
export type HostedFailureCode = "agent_admission_threw" | "agent_dependency_failed" | "background_dispatch_failed" | "bound_secrets_not_consumed" | "channel_dispatch_failed" | "channel_kind_mismatch" | "channel_not_found" | "channel_outcome_missing" | "forbidden" | "guest_connect_stalled" | "guest_network_unavailable" | "hosted_admission_session_mismatch" | "hosted_admission_unavailable" | "hosted_deferred_session_unusable" | "hosted_local_send_rejected" | "hosted_send_limit_exceeded" | "internal_error" | "invalid_hosted_admission" | "invalid_hosted_execution" | "invalid_request" | "method_not_allowed" | "not_found" | "session_busy" | "turn_cancelled" | "turn_failed" | "unauthorized" | "v2_identity_conflict";
|
|
17
|
+
export declare const HOSTED_FAILURE_CLASSIFICATIONS: Record<HostedFailureCode, Omit<HostedFailureClassification, "v">>;
|
|
18
|
+
export declare function hostedFailureClassification(code: string): HostedFailureClassification;
|
|
19
|
+
export declare function parseHostedFailureClassification(value: unknown): HostedFailureClassification | undefined;
|
|
8
20
|
export type HostedGuestError = {
|
|
9
21
|
ok: false;
|
|
10
22
|
error: string;
|
|
11
23
|
retry: HostedGuestRetryDisposition;
|
|
24
|
+
classification: HostedFailureClassification;
|
|
12
25
|
message?: string;
|
|
13
26
|
turnStatus?: string;
|
|
14
27
|
};
|
|
@@ -47,6 +60,29 @@ export type HostedReminderFirePayload = {
|
|
|
47
60
|
reminderId: string;
|
|
48
61
|
fireCount: number;
|
|
49
62
|
};
|
|
63
|
+
/** Protocol v1 immutable fire descriptor (architecture v2 CP path). */
|
|
64
|
+
export type HostedReminderFireDescriptorPayload = {
|
|
65
|
+
protocolVersion: 1;
|
|
66
|
+
id: string;
|
|
67
|
+
fireCount: number;
|
|
68
|
+
generation: number;
|
|
69
|
+
purpose: string;
|
|
70
|
+
channelId: string;
|
|
71
|
+
continuationToken: string;
|
|
72
|
+
target?: Record<string, unknown>;
|
|
73
|
+
scheduleKind: "every" | "cron" | "delay" | "at";
|
|
74
|
+
scheduleValue: string;
|
|
75
|
+
intervalMs?: number;
|
|
76
|
+
prompt?: string;
|
|
77
|
+
handler?: string;
|
|
78
|
+
args?: Record<string, unknown>;
|
|
79
|
+
hasRunHandler: boolean;
|
|
80
|
+
hasUntilFn: boolean;
|
|
81
|
+
untilPrompt?: string;
|
|
82
|
+
busyPolicy: "skipIfBusy" | "queueBehindTurn";
|
|
83
|
+
nextFireAtMs: number;
|
|
84
|
+
claimedAtMs: number;
|
|
85
|
+
};
|
|
50
86
|
export type HostedAdmissionManagedAutomation = {
|
|
51
87
|
automationUuid: string;
|
|
52
88
|
mcpServerNames: string[];
|
|
@@ -105,5 +141,10 @@ export declare function isHostedReminderAdmission(delivery: HostedAdmission): bo
|
|
|
105
141
|
* payload. Rejects unknown keys and non-integer fireCount.
|
|
106
142
|
*/
|
|
107
143
|
export declare function parseHostedReminderFirePayload(value: unknown): HostedReminderFirePayload | undefined;
|
|
144
|
+
/**
|
|
145
|
+
* Parse the immutable CP fire descriptor. Rejects unknown keys, non-enum
|
|
146
|
+
* schedule/busy values, and non-JSON-safe optional object fields.
|
|
147
|
+
*/
|
|
148
|
+
export declare function parseHostedReminderFireDescriptorPayload(value: unknown): HostedReminderFireDescriptorPayload | undefined;
|
|
108
149
|
export declare function parseHostedAdmissionOutcome(value: unknown): HostedAdmissionOutcome | undefined;
|
|
109
150
|
//# sourceMappingURL=hosted-delivery-protocol.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-delivery-protocol.d.ts","sourceRoot":"","sources":["../../src/internal/hosted-delivery-protocol.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gCAAgC,IAAI,CAAC;AAClD,eAAO,MAAM,sBAAsB,gCAAgC,CAAC;AACpE,eAAO,MAAM,qBAAqB,kCAAkC,CAAC;AACrE,eAAO,MAAM,qBAAqB,kCAAkC,CAAC;AACrE,eAAO,MAAM,4BAA4B,cAAc,CAAC;AACxD,eAAO,MAAM,2BAA2B,aAAa,CAAC;AAEtD,MAAM,MAAM,2BAA2B,GACnC,OAAO,4BAA4B,GACnC,OAAO,2BAA2B,CAAC;AAEvC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,KAAK,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,2BAA2B,CAAC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,2BAA2B,CAAC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,QAAQ,
|
|
1
|
+
{"version":3,"file":"hosted-delivery-protocol.d.ts","sourceRoot":"","sources":["../../src/internal/hosted-delivery-protocol.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gCAAgC,IAAI,CAAC;AAClD,eAAO,MAAM,sBAAsB,gCAAgC,CAAC;AACpE,eAAO,MAAM,qBAAqB,kCAAkC,CAAC;AACrE,eAAO,MAAM,qBAAqB,kCAAkC,CAAC;AACrE,eAAO,MAAM,4BAA4B,cAAc,CAAC;AACxD,eAAO,MAAM,2BAA2B,aAAa,CAAC;AAEtD,MAAM,MAAM,2BAA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