@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
|
@@ -9,10 +9,144 @@ export type HostedGuestRetryDisposition =
|
|
|
9
9
|
| typeof HOSTED_GUEST_RETRY_TRANSIENT
|
|
10
10
|
| typeof HOSTED_GUEST_RETRY_TERMINAL;
|
|
11
11
|
|
|
12
|
+
export const HOSTED_FAILURE_CLASSIFICATION_VERSION = 1;
|
|
13
|
+
|
|
14
|
+
export type HostedFailureDomain =
|
|
15
|
+
| "configuration"
|
|
16
|
+
| "protocol"
|
|
17
|
+
| "platform"
|
|
18
|
+
| "agent"
|
|
19
|
+
| "dependency"
|
|
20
|
+
| "cancellation"
|
|
21
|
+
| "unknown";
|
|
22
|
+
|
|
23
|
+
export type HostedFailureSource =
|
|
24
|
+
| "tas"
|
|
25
|
+
| "factory"
|
|
26
|
+
| "anyrun"
|
|
27
|
+
| "engine"
|
|
28
|
+
| "agent";
|
|
29
|
+
|
|
30
|
+
export type HostedFailureClassification = {
|
|
31
|
+
v: typeof HOSTED_FAILURE_CLASSIFICATION_VERSION;
|
|
32
|
+
domain: HostedFailureDomain;
|
|
33
|
+
source: HostedFailureSource;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const HOSTED_FAILURE_DOMAINS = new Set<HostedFailureDomain>([
|
|
37
|
+
"configuration",
|
|
38
|
+
"protocol",
|
|
39
|
+
"platform",
|
|
40
|
+
"agent",
|
|
41
|
+
"dependency",
|
|
42
|
+
"cancellation",
|
|
43
|
+
"unknown",
|
|
44
|
+
]);
|
|
45
|
+
const HOSTED_FAILURE_SOURCES = new Set<HostedFailureSource>([
|
|
46
|
+
"tas",
|
|
47
|
+
"factory",
|
|
48
|
+
"anyrun",
|
|
49
|
+
"engine",
|
|
50
|
+
"agent",
|
|
51
|
+
]);
|
|
52
|
+
|
|
53
|
+
export type HostedFailureCode =
|
|
54
|
+
| "agent_admission_threw"
|
|
55
|
+
| "agent_dependency_failed"
|
|
56
|
+
| "background_dispatch_failed"
|
|
57
|
+
| "bound_secrets_not_consumed"
|
|
58
|
+
| "channel_dispatch_failed"
|
|
59
|
+
| "channel_kind_mismatch"
|
|
60
|
+
| "channel_not_found"
|
|
61
|
+
| "channel_outcome_missing"
|
|
62
|
+
| "forbidden"
|
|
63
|
+
| "guest_connect_stalled"
|
|
64
|
+
| "guest_network_unavailable"
|
|
65
|
+
| "hosted_admission_session_mismatch"
|
|
66
|
+
| "hosted_admission_unavailable"
|
|
67
|
+
| "hosted_deferred_session_unusable"
|
|
68
|
+
| "hosted_local_send_rejected"
|
|
69
|
+
| "hosted_send_limit_exceeded"
|
|
70
|
+
| "internal_error"
|
|
71
|
+
| "invalid_hosted_admission"
|
|
72
|
+
| "invalid_hosted_execution"
|
|
73
|
+
| "invalid_request"
|
|
74
|
+
| "method_not_allowed"
|
|
75
|
+
| "not_found"
|
|
76
|
+
| "session_busy"
|
|
77
|
+
| "turn_cancelled"
|
|
78
|
+
| "turn_failed"
|
|
79
|
+
| "unauthorized"
|
|
80
|
+
| "v2_identity_conflict";
|
|
81
|
+
|
|
82
|
+
export const HOSTED_FAILURE_CLASSIFICATIONS: Record<
|
|
83
|
+
HostedFailureCode,
|
|
84
|
+
Omit<HostedFailureClassification, "v">
|
|
85
|
+
> = {
|
|
86
|
+
agent_admission_threw: { domain: "agent", source: "agent" },
|
|
87
|
+
agent_dependency_failed: { domain: "dependency", source: "factory" },
|
|
88
|
+
background_dispatch_failed: { domain: "agent", source: "agent" },
|
|
89
|
+
bound_secrets_not_consumed: { domain: "platform", source: "engine" },
|
|
90
|
+
channel_dispatch_failed: { domain: "agent", source: "agent" },
|
|
91
|
+
channel_kind_mismatch: { domain: "configuration", source: "engine" },
|
|
92
|
+
channel_not_found: { domain: "configuration", source: "engine" },
|
|
93
|
+
channel_outcome_missing: { domain: "protocol", source: "agent" },
|
|
94
|
+
forbidden: { domain: "configuration", source: "engine" },
|
|
95
|
+
guest_connect_stalled: { domain: "platform", source: "engine" },
|
|
96
|
+
guest_network_unavailable: { domain: "platform", source: "anyrun" },
|
|
97
|
+
hosted_admission_session_mismatch: { domain: "protocol", source: "engine" },
|
|
98
|
+
hosted_admission_unavailable: { domain: "platform", source: "engine" },
|
|
99
|
+
hosted_deferred_session_unusable: { domain: "agent", source: "agent" },
|
|
100
|
+
hosted_local_send_rejected: { domain: "agent", source: "agent" },
|
|
101
|
+
hosted_send_limit_exceeded: { domain: "agent", source: "agent" },
|
|
102
|
+
internal_error: { domain: "unknown", source: "engine" },
|
|
103
|
+
invalid_hosted_admission: { domain: "protocol", source: "engine" },
|
|
104
|
+
invalid_hosted_execution: { domain: "protocol", source: "engine" },
|
|
105
|
+
invalid_request: { domain: "protocol", source: "engine" },
|
|
106
|
+
method_not_allowed: { domain: "protocol", source: "engine" },
|
|
107
|
+
not_found: { domain: "protocol", source: "engine" },
|
|
108
|
+
session_busy: { domain: "platform", source: "engine" },
|
|
109
|
+
turn_cancelled: { domain: "cancellation", source: "agent" },
|
|
110
|
+
turn_failed: { domain: "agent", source: "agent" },
|
|
111
|
+
unauthorized: { domain: "configuration", source: "engine" },
|
|
112
|
+
v2_identity_conflict: { domain: "protocol", source: "engine" },
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export function hostedFailureClassification(
|
|
116
|
+
code: string
|
|
117
|
+
): HostedFailureClassification {
|
|
118
|
+
const known = HOSTED_FAILURE_CLASSIFICATIONS[code as HostedFailureCode];
|
|
119
|
+
return {
|
|
120
|
+
v: HOSTED_FAILURE_CLASSIFICATION_VERSION,
|
|
121
|
+
domain: known?.domain ?? "unknown",
|
|
122
|
+
source: known?.source ?? "engine",
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function parseHostedFailureClassification(
|
|
127
|
+
value: unknown
|
|
128
|
+
): HostedFailureClassification | undefined {
|
|
129
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
130
|
+
return undefined;
|
|
131
|
+
}
|
|
132
|
+
const body = value as Record<string, unknown>;
|
|
133
|
+
if (
|
|
134
|
+
body.v !== HOSTED_FAILURE_CLASSIFICATION_VERSION ||
|
|
135
|
+
typeof body.domain !== "string" ||
|
|
136
|
+
!HOSTED_FAILURE_DOMAINS.has(body.domain as HostedFailureDomain) ||
|
|
137
|
+
typeof body.source !== "string" ||
|
|
138
|
+
!HOSTED_FAILURE_SOURCES.has(body.source as HostedFailureSource)
|
|
139
|
+
) {
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
|
142
|
+
return body as HostedFailureClassification;
|
|
143
|
+
}
|
|
144
|
+
|
|
12
145
|
export type HostedGuestError = {
|
|
13
146
|
ok: false;
|
|
14
147
|
error: string;
|
|
15
148
|
retry: HostedGuestRetryDisposition;
|
|
149
|
+
classification: HostedFailureClassification;
|
|
16
150
|
message?: string;
|
|
17
151
|
turnStatus?: string;
|
|
18
152
|
};
|
|
@@ -33,6 +167,7 @@ export function hostedGuestErrorResponse(input: {
|
|
|
33
167
|
ok: false,
|
|
34
168
|
error: input.error,
|
|
35
169
|
retry: input.retry,
|
|
170
|
+
classification: hostedFailureClassification(input.error),
|
|
36
171
|
message: input.message,
|
|
37
172
|
turnStatus: input.turnStatus,
|
|
38
173
|
};
|
|
@@ -66,6 +201,30 @@ export type HostedReminderFirePayload = {
|
|
|
66
201
|
fireCount: number;
|
|
67
202
|
};
|
|
68
203
|
|
|
204
|
+
/** Protocol v1 immutable fire descriptor (architecture v2 CP path). */
|
|
205
|
+
export type HostedReminderFireDescriptorPayload = {
|
|
206
|
+
protocolVersion: 1;
|
|
207
|
+
id: string;
|
|
208
|
+
fireCount: number;
|
|
209
|
+
generation: number;
|
|
210
|
+
purpose: string;
|
|
211
|
+
channelId: string;
|
|
212
|
+
continuationToken: string;
|
|
213
|
+
target?: Record<string, unknown>;
|
|
214
|
+
scheduleKind: "every" | "cron" | "delay" | "at";
|
|
215
|
+
scheduleValue: string;
|
|
216
|
+
intervalMs?: number;
|
|
217
|
+
prompt?: string;
|
|
218
|
+
handler?: string;
|
|
219
|
+
args?: Record<string, unknown>;
|
|
220
|
+
hasRunHandler: boolean;
|
|
221
|
+
hasUntilFn: boolean;
|
|
222
|
+
untilPrompt?: string;
|
|
223
|
+
busyPolicy: "skipIfBusy" | "queueBehindTurn";
|
|
224
|
+
nextFireAtMs: number;
|
|
225
|
+
claimedAtMs: number;
|
|
226
|
+
};
|
|
227
|
+
|
|
69
228
|
export type HostedAdmissionManagedAutomation = {
|
|
70
229
|
automationUuid: string;
|
|
71
230
|
mcpServerNames: string[];
|
|
@@ -267,6 +426,234 @@ export function parseHostedReminderFirePayload(
|
|
|
267
426
|
};
|
|
268
427
|
}
|
|
269
428
|
|
|
429
|
+
const HOSTED_REMINDER_FIRE_DESCRIPTOR_KEYS = new Set([
|
|
430
|
+
"protocolVersion",
|
|
431
|
+
"id",
|
|
432
|
+
"fireCount",
|
|
433
|
+
"generation",
|
|
434
|
+
"purpose",
|
|
435
|
+
"channelId",
|
|
436
|
+
"continuationToken",
|
|
437
|
+
"target",
|
|
438
|
+
"scheduleKind",
|
|
439
|
+
"scheduleValue",
|
|
440
|
+
"intervalMs",
|
|
441
|
+
"prompt",
|
|
442
|
+
"handler",
|
|
443
|
+
"args",
|
|
444
|
+
"hasRunHandler",
|
|
445
|
+
"hasUntilFn",
|
|
446
|
+
"untilPrompt",
|
|
447
|
+
"busyPolicy",
|
|
448
|
+
"nextFireAtMs",
|
|
449
|
+
"claimedAtMs",
|
|
450
|
+
]);
|
|
451
|
+
|
|
452
|
+
const HOSTED_REMINDER_SCHEDULE_KINDS = new Set([
|
|
453
|
+
"every",
|
|
454
|
+
"cron",
|
|
455
|
+
"delay",
|
|
456
|
+
"at",
|
|
457
|
+
]);
|
|
458
|
+
const HOSTED_REMINDER_BUSY_POLICIES = new Set([
|
|
459
|
+
"skipIfBusy",
|
|
460
|
+
"queueBehindTurn",
|
|
461
|
+
]);
|
|
462
|
+
|
|
463
|
+
const HOSTED_REMINDER_JSON_MAX_DEPTH = 8;
|
|
464
|
+
|
|
465
|
+
/** Reject non-JSON values (NaN/Infinity/undefined/bigint/function/symbol). */
|
|
466
|
+
function isJsonSafeValue(value: unknown, depth: number): boolean {
|
|
467
|
+
if (depth > HOSTED_REMINDER_JSON_MAX_DEPTH) {
|
|
468
|
+
return false;
|
|
469
|
+
}
|
|
470
|
+
if (value === null) {
|
|
471
|
+
return true;
|
|
472
|
+
}
|
|
473
|
+
const type = typeof value;
|
|
474
|
+
if (type === "string" || type === "boolean") {
|
|
475
|
+
return true;
|
|
476
|
+
}
|
|
477
|
+
if (type === "number") {
|
|
478
|
+
return Number.isFinite(value);
|
|
479
|
+
}
|
|
480
|
+
if (type !== "object") {
|
|
481
|
+
return false;
|
|
482
|
+
}
|
|
483
|
+
if (Array.isArray(value)) {
|
|
484
|
+
return value.every((entry) => isJsonSafeValue(entry, depth + 1));
|
|
485
|
+
}
|
|
486
|
+
const proto = Object.getPrototypeOf(value);
|
|
487
|
+
if (proto !== Object.prototype && proto !== null) {
|
|
488
|
+
return false;
|
|
489
|
+
}
|
|
490
|
+
for (const entry of Object.values(value as Record<string, unknown>)) {
|
|
491
|
+
if (!isJsonSafeValue(entry, depth + 1)) {
|
|
492
|
+
return false;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
return true;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
function parseOptionalJsonObjectField(
|
|
499
|
+
value: unknown,
|
|
500
|
+
maxBytes: number
|
|
501
|
+
): Record<string, unknown> | undefined {
|
|
502
|
+
if (value === undefined) {
|
|
503
|
+
return undefined;
|
|
504
|
+
}
|
|
505
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
506
|
+
return undefined;
|
|
507
|
+
}
|
|
508
|
+
if (!isJsonSafeValue(value, 0)) {
|
|
509
|
+
return undefined;
|
|
510
|
+
}
|
|
511
|
+
try {
|
|
512
|
+
const encoded = JSON.stringify(value);
|
|
513
|
+
if (
|
|
514
|
+
encoded === undefined ||
|
|
515
|
+
Buffer.byteLength(encoded, "utf8") > maxBytes
|
|
516
|
+
) {
|
|
517
|
+
return undefined;
|
|
518
|
+
}
|
|
519
|
+
const roundTrip = JSON.parse(encoded) as unknown;
|
|
520
|
+
if (
|
|
521
|
+
typeof roundTrip !== "object" ||
|
|
522
|
+
roundTrip === null ||
|
|
523
|
+
Array.isArray(roundTrip)
|
|
524
|
+
) {
|
|
525
|
+
return undefined;
|
|
526
|
+
}
|
|
527
|
+
return roundTrip as Record<string, unknown>;
|
|
528
|
+
} catch {
|
|
529
|
+
return undefined;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* Parse the immutable CP fire descriptor. Rejects unknown keys, non-enum
|
|
535
|
+
* schedule/busy values, and non-JSON-safe optional object fields.
|
|
536
|
+
*/
|
|
537
|
+
export function parseHostedReminderFireDescriptorPayload(
|
|
538
|
+
value: unknown
|
|
539
|
+
): HostedReminderFireDescriptorPayload | undefined {
|
|
540
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
541
|
+
return undefined;
|
|
542
|
+
}
|
|
543
|
+
const body = value as Record<string, unknown>;
|
|
544
|
+
if (
|
|
545
|
+
Object.keys(body).some(
|
|
546
|
+
(key) => !HOSTED_REMINDER_FIRE_DESCRIPTOR_KEYS.has(key)
|
|
547
|
+
)
|
|
548
|
+
) {
|
|
549
|
+
return undefined;
|
|
550
|
+
}
|
|
551
|
+
if (
|
|
552
|
+
body.protocolVersion !== 1 ||
|
|
553
|
+
typeof body.id !== "string" ||
|
|
554
|
+
body.id.length === 0 ||
|
|
555
|
+
body.id.length > 128 ||
|
|
556
|
+
typeof body.fireCount !== "number" ||
|
|
557
|
+
!Number.isInteger(body.fireCount) ||
|
|
558
|
+
body.fireCount < 0 ||
|
|
559
|
+
typeof body.generation !== "number" ||
|
|
560
|
+
!Number.isInteger(body.generation) ||
|
|
561
|
+
body.generation < 0 ||
|
|
562
|
+
typeof body.purpose !== "string" ||
|
|
563
|
+
body.purpose.length === 0 ||
|
|
564
|
+
body.purpose.length > 512 ||
|
|
565
|
+
typeof body.channelId !== "string" ||
|
|
566
|
+
body.channelId.length === 0 ||
|
|
567
|
+
body.channelId.length > 128 ||
|
|
568
|
+
typeof body.continuationToken !== "string" ||
|
|
569
|
+
body.continuationToken.length === 0 ||
|
|
570
|
+
body.continuationToken.length > 512 ||
|
|
571
|
+
typeof body.scheduleKind !== "string" ||
|
|
572
|
+
!HOSTED_REMINDER_SCHEDULE_KINDS.has(body.scheduleKind) ||
|
|
573
|
+
typeof body.scheduleValue !== "string" ||
|
|
574
|
+
body.scheduleValue.length === 0 ||
|
|
575
|
+
body.scheduleValue.length > 512 ||
|
|
576
|
+
typeof body.hasRunHandler !== "boolean" ||
|
|
577
|
+
typeof body.hasUntilFn !== "boolean" ||
|
|
578
|
+
typeof body.busyPolicy !== "string" ||
|
|
579
|
+
!HOSTED_REMINDER_BUSY_POLICIES.has(body.busyPolicy) ||
|
|
580
|
+
typeof body.nextFireAtMs !== "number" ||
|
|
581
|
+
!Number.isFinite(body.nextFireAtMs) ||
|
|
582
|
+
typeof body.claimedAtMs !== "number" ||
|
|
583
|
+
!Number.isFinite(body.claimedAtMs) ||
|
|
584
|
+
!Number.isInteger(body.claimedAtMs) ||
|
|
585
|
+
body.claimedAtMs < 0
|
|
586
|
+
) {
|
|
587
|
+
return undefined;
|
|
588
|
+
}
|
|
589
|
+
if (body.intervalMs !== undefined) {
|
|
590
|
+
if (
|
|
591
|
+
typeof body.intervalMs !== "number" ||
|
|
592
|
+
!Number.isFinite(body.intervalMs) ||
|
|
593
|
+
!Number.isInteger(body.intervalMs) ||
|
|
594
|
+
body.intervalMs <= 0
|
|
595
|
+
) {
|
|
596
|
+
return undefined;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
if (body.prompt !== undefined) {
|
|
600
|
+
if (typeof body.prompt !== "string" || body.prompt.length > 8192) {
|
|
601
|
+
return undefined;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
if (body.handler !== undefined) {
|
|
605
|
+
if (
|
|
606
|
+
typeof body.handler !== "string" ||
|
|
607
|
+
body.handler.length === 0 ||
|
|
608
|
+
body.handler.length > 128
|
|
609
|
+
) {
|
|
610
|
+
return undefined;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
if (body.untilPrompt !== undefined) {
|
|
614
|
+
if (
|
|
615
|
+
typeof body.untilPrompt !== "string" ||
|
|
616
|
+
body.untilPrompt.length > 8192
|
|
617
|
+
) {
|
|
618
|
+
return undefined;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
const target = parseOptionalJsonObjectField(body.target, 16 * 1024);
|
|
622
|
+
if (body.target !== undefined && target === undefined) {
|
|
623
|
+
return undefined;
|
|
624
|
+
}
|
|
625
|
+
const args = parseOptionalJsonObjectField(body.args, 32 * 1024);
|
|
626
|
+
if (body.args !== undefined && args === undefined) {
|
|
627
|
+
return undefined;
|
|
628
|
+
}
|
|
629
|
+
return {
|
|
630
|
+
protocolVersion: 1,
|
|
631
|
+
id: body.id,
|
|
632
|
+
fireCount: body.fireCount,
|
|
633
|
+
generation: body.generation,
|
|
634
|
+
purpose: body.purpose,
|
|
635
|
+
channelId: body.channelId,
|
|
636
|
+
continuationToken: body.continuationToken,
|
|
637
|
+
...(target === undefined ? {} : { target }),
|
|
638
|
+
scheduleKind:
|
|
639
|
+
body.scheduleKind as HostedReminderFireDescriptorPayload["scheduleKind"],
|
|
640
|
+
scheduleValue: body.scheduleValue,
|
|
641
|
+
...(body.intervalMs === undefined ? {} : { intervalMs: body.intervalMs }),
|
|
642
|
+
...(body.prompt === undefined ? {} : { prompt: body.prompt }),
|
|
643
|
+
...(body.handler === undefined ? {} : { handler: body.handler }),
|
|
644
|
+
...(args === undefined ? {} : { args }),
|
|
645
|
+
hasRunHandler: body.hasRunHandler,
|
|
646
|
+
hasUntilFn: body.hasUntilFn,
|
|
647
|
+
...(body.untilPrompt === undefined
|
|
648
|
+
? {}
|
|
649
|
+
: { untilPrompt: body.untilPrompt }),
|
|
650
|
+
busyPolicy:
|
|
651
|
+
body.busyPolicy as HostedReminderFireDescriptorPayload["busyPolicy"],
|
|
652
|
+
nextFireAtMs: body.nextFireAtMs,
|
|
653
|
+
claimedAtMs: body.claimedAtMs,
|
|
654
|
+
};
|
|
655
|
+
}
|
|
656
|
+
|
|
270
657
|
export function parseHostedAdmissionOutcome(
|
|
271
658
|
value: unknown
|
|
272
659
|
): HostedAdmissionOutcome | undefined {
|