@claxedo/agent-runtime-contract 0.8.0 → 0.10.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.
Files changed (65) hide show
  1. package/README.md +27 -9
  2. package/dist/agent-runtime-event.d.ts +975 -0
  3. package/dist/availability.d.ts +3 -4
  4. package/dist/background-work.d.ts +10 -0
  5. package/dist/claims.d.ts +2 -0
  6. package/dist/connections.d.ts +66 -1
  7. package/dist/content.d.ts +72 -15
  8. package/dist/credential-broker-errors.d.ts +4 -0
  9. package/dist/custom-provider-headers.d.ts +12 -0
  10. package/dist/d1-bookmarks.d.ts +39 -0
  11. package/dist/daemon-ownership-snapshot.d.ts +40 -0
  12. package/dist/diagnostics.d.ts +24 -0
  13. package/dist/elicitation-pattern-worker.d.ts +6 -0
  14. package/dist/elicitation-pattern-worker.mjs +17 -0
  15. package/dist/elicitation-validation.d.ts +23 -0
  16. package/dist/elicitation.d.ts +51 -0
  17. package/dist/errors.d.ts +8 -1
  18. package/dist/event-cursor.d.ts +19 -0
  19. package/dist/events.d.ts +146 -216
  20. package/dist/files.d.ts +2 -0
  21. package/dist/first-turn-error.d.ts +12 -0
  22. package/dist/goals.d.ts +28 -0
  23. package/dist/harness-permission-modes.d.ts +76 -0
  24. package/dist/harness-table.d.ts +66 -4
  25. package/dist/harnesses.d.ts +19 -1
  26. package/dist/ids.d.ts +4 -0
  27. package/dist/index.d.ts +46 -1
  28. package/dist/index.mjs +2814 -95
  29. package/dist/mcp-app.d.ts +24 -0
  30. package/dist/message-page.d.ts +101 -0
  31. package/dist/permissions.d.ts +47 -0
  32. package/dist/pi-providers.d.ts +36 -0
  33. package/dist/prompt-title.d.ts +2 -0
  34. package/dist/provider-projection.d.ts +166 -0
  35. package/dist/raw-harness-event.d.ts +7 -0
  36. package/dist/recovery/actions.d.ts +20 -0
  37. package/dist/recovery/budgets.d.ts +16 -0
  38. package/dist/recovery/facts.d.ts +37 -0
  39. package/dist/recovery/operations.d.ts +66 -0
  40. package/dist/recovery/outcomes.d.ts +48 -0
  41. package/dist/recovery/payload-line.d.ts +19 -0
  42. package/dist/recovery/postconditions.d.ts +18 -0
  43. package/dist/recovery/requests.d.ts +44 -0
  44. package/dist/recovery/targets.d.ts +55 -0
  45. package/dist/recovery/validation.d.ts +9 -0
  46. package/dist/runtime-content.d.ts +34 -0
  47. package/dist/session-handoff.d.ts +4 -0
  48. package/dist/session-titles.d.ts +14 -0
  49. package/dist/sessions.d.ts +183 -5
  50. package/dist/stream-heartbeat.d.ts +11 -0
  51. package/dist/subagents.d.ts +92 -0
  52. package/dist/tool-header.d.ts +13 -0
  53. package/dist/tool-names.d.ts +5 -0
  54. package/dist/transcript-notice.d.ts +28 -0
  55. package/dist/turn-account.d.ts +26 -0
  56. package/dist/turn-error-classes.d.ts +10 -0
  57. package/dist/turn-fold.d.ts +111 -0
  58. package/dist/turn-fold.mjs +414 -0
  59. package/dist/turn-message-ids.d.ts +16 -0
  60. package/dist/turn-outline.d.ts +37 -0
  61. package/dist/turn-page.d.ts +58 -0
  62. package/dist/usage-streams.d.ts +19 -0
  63. package/dist/vendor-body.d.ts +31 -0
  64. package/dist/vendor-providers.d.ts +11 -0
  65. package/package.json +17 -3
@@ -1,3 +1,13 @@
1
+ /**
2
+ * Where a harness's session runs on a cloud workspace. A `session-host`
3
+ * harness runs in the session's own Durable Object, which holds the owner's
4
+ * credential itself; a `workspace-runtime` harness runs inside the sandbox,
5
+ * which never holds a secret and reaches the vendor through a placeholder.
6
+ * The control plane places a session by this when it reserves it, and the
7
+ * sandbox runtime refuses to host a `session-host` harness, so neither side
8
+ * can run a harness where its credential cannot follow.
9
+ */
10
+ export type CloudHarnessHost = "session-host" | "workspace-runtime";
1
11
  export declare const AGENT_HARNESS_DEFINITIONS: readonly [{
2
12
  readonly key: "claude";
3
13
  readonly id: "claude";
@@ -5,6 +15,7 @@ export declare const AGENT_HARNESS_DEFINITIONS: readonly [{
5
15
  readonly label: "Claude";
6
16
  readonly authEnv: "ANTHROPIC_API_KEY";
7
17
  readonly authSlot: "anthropic";
18
+ readonly cloudHost: "workspace-runtime";
8
19
  }, {
9
20
  readonly key: "codex";
10
21
  readonly id: "codex";
@@ -12,6 +23,7 @@ export declare const AGENT_HARNESS_DEFINITIONS: readonly [{
12
23
  readonly label: "Codex";
13
24
  readonly authEnv: "OPENAI_API_KEY";
14
25
  readonly authSlot: "openai";
26
+ readonly cloudHost: "workspace-runtime";
15
27
  }, {
16
28
  readonly key: "cursor";
17
29
  readonly id: "cursor";
@@ -19,6 +31,7 @@ export declare const AGENT_HARNESS_DEFINITIONS: readonly [{
19
31
  readonly label: "Cursor";
20
32
  readonly authEnv: "CURSOR_API_KEY";
21
33
  readonly authSlot: "cursor";
34
+ readonly cloudHost: "workspace-runtime";
22
35
  }, {
23
36
  readonly key: "pi";
24
37
  readonly id: "pi";
@@ -26,6 +39,7 @@ export declare const AGENT_HARNESS_DEFINITIONS: readonly [{
26
39
  readonly label: "Pi";
27
40
  readonly authEnv: null;
28
41
  readonly authSlot: null;
42
+ readonly cloudHost: "session-host";
29
43
  }, {
30
44
  readonly key: "opencode";
31
45
  readonly id: "opencode";
@@ -33,7 +47,10 @@ export declare const AGENT_HARNESS_DEFINITIONS: readonly [{
33
47
  readonly label: "OpenCode";
34
48
  readonly authEnv: null;
35
49
  readonly authSlot: null;
50
+ readonly cloudHost: "workspace-runtime";
36
51
  }];
52
+ /** A connection's agent runs inside the sandbox, as does any harness the table does not name. */
53
+ export declare function cloudHarnessHost(harnessId: string): CloudHarnessHost;
37
54
  export declare const AGENT_HARNESS_IDS: readonly ["claude", "codex", "cursor", "pi", "opencode"];
38
55
  export declare const AGENT_HARNESS_ACCESSES: readonly ["connection", "native"];
39
56
  export declare const AGENT_HARNESS_KEYS: ("claude" | "codex" | "cursor" | "opencode" | "pi")[];
@@ -41,7 +58,7 @@ export type AgentHarnessId = (typeof AGENT_HARNESS_IDS)[number];
41
58
  export type AgentHarnessAccess = (typeof AGENT_HARNESS_ACCESSES)[number];
42
59
  export type AgentHarnessKey = (typeof AGENT_HARNESS_KEYS)[number];
43
60
  export type NativeHarnessId = AgentHarnessId;
44
- /** The native harnesses driven through `SdkRuntimeDriver`; `opencode` is composed by `@claxedo/workspace-runtime/opencode` instead. */
61
+ /** The native harnesses driven through `SdkRuntimeDriver`; `opencode` is composed by `@claxedo/harness/opencode-sdk` instead. */
45
62
  export type NativeSdkHarnessId = Extract<AgentHarnessId, "claude" | "codex" | "cursor" | "pi">;
46
63
  /**
47
64
  * A harness identity's id field: one of the finite built-in ids, or a
@@ -72,6 +89,7 @@ export declare function harnessKey(input: {
72
89
  id: SessionHarnessId;
73
90
  access: AgentHarnessAccess;
74
91
  }): string | undefined;
92
+ export declare function sameSessionHarness(a: SessionHarness, b: SessionHarness): boolean;
75
93
  export declare function normalizeHarnessIdentity(input: unknown): {
76
94
  id: SessionHarnessId;
77
95
  access: AgentHarnessAccess;
package/dist/ids.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export type Clock = () => number;
2
+ export type CreateId = (prefix?: string) => string;
3
+ export declare const systemClock: Clock;
4
+ export declare function createSequentialIdFactory(seed?: number): CreateId;
package/dist/index.d.ts CHANGED
@@ -1,19 +1,64 @@
1
- export declare const AGENT_RUNTIME_CONTRACT_VERSION = 1;
1
+ export declare const AGENT_RUNTIME_CONTRACT_VERSION = 2;
2
2
  export * from "./availability";
3
3
  export * from "./capabilities";
4
4
  export * from "./claims";
5
5
  export * from "./connections";
6
6
  export * from "./content";
7
+ export * from "./transcript-notice";
7
8
  export * from "./credential-broker-errors";
9
+ export * from "./elicitation";
10
+ export * from "./elicitation-validation";
8
11
  export * from "./errors";
9
12
  export * from "./events";
10
13
  export * from "./files";
14
+ export * from "./goals";
11
15
  export * from "./harness-effort";
16
+ export * from "./harness-permission-modes";
12
17
  export * from "./harness-table";
13
18
  export * from "./harnesses";
19
+ export * from "./permissions";
20
+ export * from "./custom-provider-headers";
21
+ export * from "./pi-providers";
22
+ export * from "./vendor-providers";
23
+ export * from "./prompt-title";
24
+ export * from "./provider-projection";
14
25
  export * from "./question-answers";
26
+ export { type RecoveryGeneration, EXECUTION_FACTS, CLEANUP_FACTS, PERSISTENCE_FACTS, type ExecutionFact, type CleanupFact, type PersistenceFact, type RecoveryFactEvidence, type RecoveryFacts, parseRecoveryFacts, } from "./recovery/facts";
27
+ export { DAEMON_OWNERSHIP_SNAPSHOT_FILE, daemonOwnershipSnapshotPath, type DaemonOwnershipRow, isDaemonOwnershipSnapshot, } from "./daemon-ownership-snapshot";
28
+ export { RECOVERY_TARGET_SCOPES, type RecoveryTargetScope, type RecoveryTurnTarget, type RecoverySessionTarget, type RecoveryHarnessTarget, type RecoveryMachineTarget, type RecoveryTarget, normalizeRecoveryTarget, recoveryTargetsMatch, parseRecoveryTarget, recoveryScopeKey, recoveryTargetSessionId, } from "./recovery/targets";
29
+ export { RECOVERY_ACTIONS, type RecoveryAction, RECOVERY_MUTATING_ACTIONS, type RecoveryMutatingAction, RECOVERY_READ_ACTIONS, type RecoveryReadAction, isMutatingRecoveryAction, RECOVERY_ACTION_SCOPES, } from "./recovery/actions";
30
+ export { releasedDrainOperationId, type RecoveryRequest, type RecoveryIntent, normalizeRecoveryIntent, recoveryIntentEquals, parseRecoveryRequest, } from "./recovery/requests";
31
+ export { RECOVERY_OPERATION_STATES, type RecoveryOperationState, RECOVERY_PHASES, type RecoveryPhase, type RecoveryReceipt, type RecoveryNextAction, RECOVERY_ERROR_CODES, type RecoveryErrorCode, type RecoveryError, type RecoveryOperation, RECOVERY_OPERATION_RETENTION_MS, finalizeRecoveryOperation, parseRecoveryError, parseRecoveryOperation, } from "./recovery/operations";
32
+ export { type RecoveryScopePreview, type RecoveryRefusal, type RecoveryOutcome, parseRecoveryRefusal, serializeRecoveryOutcome, parseRecoveryOutcome, isRecoveryOutcome, } from "./recovery/outcomes";
33
+ export { type RecoveryBudgets, DEFAULT_RECOVERY_BUDGETS, capChildBudget, } from "./recovery/budgets";
34
+ export { recoveryPostconditionHolds, turnStopped, } from "./recovery/postconditions";
35
+ export { RECOVERY_PAYLOAD_PREFIX, readRecoveryPayloadLine, } from "./recovery/payload-line";
36
+ export { RECOVERY_CONTRACT_ERROR_CODES, type RecoveryContractErrorCode, RecoveryContractError, } from "./recovery/validation";
15
37
  export * from "./session-group";
38
+ export * from "./session-handoff";
39
+ export * from "./session-titles";
16
40
  export * from "./sessions";
41
+ export * from "./subagents";
42
+ export * from "./background-work";
43
+ export * from "./tool-header";
44
+ export * from "./mcp-app";
45
+ export * from "./turn-outline";
46
+ export * from "./turn-page";
17
47
  export * from "./tool-names";
48
+ export * from "./turn-account";
49
+ export * from "./turn-error-classes";
50
+ export * from "./first-turn-error";
51
+ export * from "./vendor-body";
52
+ export * from "./message-page";
18
53
  export * from "./usage-windows";
19
54
  export * from "./values";
55
+ export * from "./agent-runtime-event";
56
+ export * from "./diagnostics";
57
+ export * from "./event-cursor";
58
+ export * from "./d1-bookmarks";
59
+ export * from "./ids";
60
+ export * from "./raw-harness-event";
61
+ export * from "./runtime-content";
62
+ export * from "./stream-heartbeat";
63
+ export * from "./turn-message-ids";
64
+ export * from "./usage-streams";