@superdurable/dex-agents 0.4.0 → 0.5.0

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 (132) hide show
  1. package/README.md +506 -52
  2. package/dist/src/agent-context-compaction.d.ts +1 -1
  3. package/dist/src/agent-framework-runner.d.ts +122 -11
  4. package/dist/src/agent-framework-runner.js +4 -0
  5. package/dist/src/agent-framework-runner.js.map +1 -1
  6. package/dist/src/agent-local-directory-media-store.d.ts +111 -0
  7. package/dist/src/agent-local-directory-media-store.js +417 -0
  8. package/dist/src/agent-local-directory-media-store.js.map +1 -0
  9. package/dist/src/agent-media.d.ts +279 -0
  10. package/dist/src/agent-media.js +457 -0
  11. package/dist/src/agent-media.js.map +1 -0
  12. package/dist/src/agent-session-codecs.d.ts +3 -1
  13. package/dist/src/agent-session-codecs.js +45 -4
  14. package/dist/src/agent-session-codecs.js.map +1 -1
  15. package/dist/src/agent-session-failure.d.ts +4 -2
  16. package/dist/src/agent-session-failure.js +6 -2
  17. package/dist/src/agent-session-failure.js.map +1 -1
  18. package/dist/src/agent-session-flow-graph.d.ts +46 -0
  19. package/dist/src/agent-session-flow-graph.js +51 -0
  20. package/dist/src/agent-session-flow-graph.js.map +1 -1
  21. package/dist/src/agent-session-flow.d.ts +5 -3
  22. package/dist/src/agent-session-flow.js +10 -1
  23. package/dist/src/agent-session-flow.js.map +1 -1
  24. package/dist/src/agent-session-start.d.ts +1 -1
  25. package/dist/src/agent-session-start.js +2 -2
  26. package/dist/src/agent-session-start.js.map +1 -1
  27. package/dist/src/agent-session-steps.d.ts +2 -0
  28. package/dist/src/agent-session-steps.js +52 -3
  29. package/dist/src/agent-session-steps.js.map +1 -1
  30. package/dist/src/agent-session-tracer.js +1 -1
  31. package/dist/src/agent-session-tracer.js.map +1 -1
  32. package/dist/src/agent-session-transitions.d.ts +2 -0
  33. package/dist/src/agent-session-transitions.js +21 -1
  34. package/dist/src/agent-session-transitions.js.map +1 -1
  35. package/dist/src/agent-session-values.d.ts +76 -1
  36. package/dist/src/agent-session-values.js.map +1 -1
  37. package/dist/src/agent-session-wait-steps.js +14 -2
  38. package/dist/src/agent-session-wait-steps.js.map +1 -1
  39. package/dist/src/ai-sdk/ai-sdk-model-client.d.ts +15 -3
  40. package/dist/src/ai-sdk/ai-sdk-model-client.js +36 -7
  41. package/dist/src/ai-sdk/ai-sdk-model-client.js.map +1 -1
  42. package/dist/src/ai-sdk/index.d.ts +1 -1
  43. package/dist/src/ai-sdk/index.js +1 -1
  44. package/dist/src/ai-sdk/index.js.map +1 -1
  45. package/dist/src/{stepwise → builtin-loop}/agent-definition.d.ts +120 -5
  46. package/dist/src/builtin-loop/agent-definition.js.map +1 -0
  47. package/dist/src/builtin-loop/builtin-agent-session-flow.d.ts +69 -0
  48. package/dist/src/{stepwise/stepwise-agent-session-flow.js → builtin-loop/builtin-agent-session-flow.js} +15 -9
  49. package/dist/src/builtin-loop/builtin-agent-session-flow.js.map +1 -0
  50. package/dist/src/{stepwise/stepwise-agent-runner.d.ts → builtin-loop/builtin-loop-agent-runner.d.ts} +72 -14
  51. package/dist/src/{stepwise/stepwise-agent-runner.js → builtin-loop/builtin-loop-agent-runner.js} +284 -41
  52. package/dist/src/builtin-loop/builtin-loop-agent-runner.js.map +1 -0
  53. package/dist/src/{stepwise/stepwise-input-items.d.ts → builtin-loop/builtin-loop-input-items.d.ts} +7 -3
  54. package/dist/src/{stepwise/stepwise-input-items.js → builtin-loop/builtin-loop-input-items.js} +57 -10
  55. package/dist/src/builtin-loop/builtin-loop-input-items.js.map +1 -0
  56. package/dist/src/builtin-loop/function-tool.d.ts +282 -0
  57. package/dist/src/{stepwise → builtin-loop}/function-tool.js +63 -3
  58. package/dist/src/builtin-loop/function-tool.js.map +1 -0
  59. package/dist/src/builtin-loop/index.d.ts +8 -0
  60. package/dist/src/builtin-loop/index.js +13 -0
  61. package/dist/src/builtin-loop/index.js.map +1 -0
  62. package/dist/src/builtin-loop/json-schema-validation.js.map +1 -0
  63. package/dist/src/{stepwise → builtin-loop}/model-client.d.ts +36 -7
  64. package/dist/src/builtin-loop/model-client.js.map +1 -0
  65. package/dist/src/{stepwise → builtin-loop}/scripted-model-client.d.ts +8 -5
  66. package/dist/src/{stepwise → builtin-loop}/scripted-model-client.js +8 -5
  67. package/dist/src/builtin-loop/scripted-model-client.js.map +1 -0
  68. package/dist/src/{stepwise → builtin-loop}/tool-source.d.ts +2 -2
  69. package/dist/src/builtin-loop/tool-source.js.map +1 -0
  70. package/dist/src/connectors/connector-input-schema.js +1 -1
  71. package/dist/src/connectors/connector-input-schema.js.map +1 -1
  72. package/dist/src/connectors/connector-step-context.d.ts +19 -2
  73. package/dist/src/connectors/connector-step-context.js +61 -5
  74. package/dist/src/connectors/connector-step-context.js.map +1 -1
  75. package/dist/src/connectors/connector-tool-source.d.ts +61 -13
  76. package/dist/src/connectors/connector-tool-source.js +111 -24
  77. package/dist/src/connectors/connector-tool-source.js.map +1 -1
  78. package/dist/src/index.d.ts +6 -4
  79. package/dist/src/index.js +3 -1
  80. package/dist/src/index.js.map +1 -1
  81. package/dist/src/mcp/index.d.ts +1 -0
  82. package/dist/src/mcp/index.js +1 -0
  83. package/dist/src/mcp/index.js.map +1 -1
  84. package/dist/src/mcp/mcp-dex-conventions.d.ts +57 -0
  85. package/dist/src/mcp/mcp-dex-conventions.js +90 -0
  86. package/dist/src/mcp/mcp-dex-conventions.js.map +1 -0
  87. package/dist/src/mcp/mcp-image-content.d.ts +20 -0
  88. package/dist/src/mcp/mcp-image-content.js +82 -0
  89. package/dist/src/mcp/mcp-image-content.js.map +1 -0
  90. package/dist/src/mcp/mcp-tool-source.d.ts +178 -17
  91. package/dist/src/mcp/mcp-tool-source.js +237 -34
  92. package/dist/src/mcp/mcp-tool-source.js.map +1 -1
  93. package/dist/src/s3/index.d.ts +1 -0
  94. package/dist/src/s3/index.js +9 -0
  95. package/dist/src/s3/index.js.map +1 -0
  96. package/dist/src/s3/s3-media-store.d.ts +138 -0
  97. package/dist/src/s3/s3-media-store.js +255 -0
  98. package/dist/src/s3/s3-media-store.js.map +1 -0
  99. package/dist/src/stepwise/index.d.ts +41 -8
  100. package/dist/src/stepwise/index.js +35 -5
  101. package/dist/src/stepwise/index.js.map +1 -1
  102. package/dist/src/testing/agent-session-test-client.d.ts +6 -3
  103. package/dist/src/testing/agent-session-test-client.js +10 -3
  104. package/dist/src/testing/agent-session-test-client.js.map +1 -1
  105. package/dist/src/testing/scripted-model-client.d.ts +1 -1
  106. package/dist/src/testing/scripted-model-client.js +2 -2
  107. package/dist/src/testing/scripted-model-client.js.map +1 -1
  108. package/dist/src/tool-source-router.d.ts +3 -3
  109. package/dist/src/tool-source-router.js +2 -2
  110. package/dist/src/ui-stream/agent-event-json.d.ts +2 -1
  111. package/dist/src/ui-stream/agent-event-json.js +3 -1
  112. package/dist/src/ui-stream/agent-event-json.js.map +1 -1
  113. package/dist/src/ui-stream/agent-ui-messages.d.ts +11 -3
  114. package/dist/src/ui-stream/agent-ui-messages.js +29 -5
  115. package/dist/src/ui-stream/agent-ui-messages.js.map +1 -1
  116. package/package.json +16 -3
  117. package/dist/src/stepwise/agent-definition.js.map +0 -1
  118. package/dist/src/stepwise/function-tool.d.ts +0 -130
  119. package/dist/src/stepwise/function-tool.js.map +0 -1
  120. package/dist/src/stepwise/json-schema-validation.js.map +0 -1
  121. package/dist/src/stepwise/model-client.js.map +0 -1
  122. package/dist/src/stepwise/scripted-model-client.js.map +0 -1
  123. package/dist/src/stepwise/stepwise-agent-runner.js.map +0 -1
  124. package/dist/src/stepwise/stepwise-agent-session-flow.d.ts +0 -35
  125. package/dist/src/stepwise/stepwise-agent-session-flow.js.map +0 -1
  126. package/dist/src/stepwise/stepwise-input-items.js.map +0 -1
  127. package/dist/src/stepwise/tool-source.js.map +0 -1
  128. /package/dist/src/{stepwise → builtin-loop}/agent-definition.js +0 -0
  129. /package/dist/src/{stepwise → builtin-loop}/json-schema-validation.d.ts +0 -0
  130. /package/dist/src/{stepwise → builtin-loop}/json-schema-validation.js +0 -0
  131. /package/dist/src/{stepwise → builtin-loop}/model-client.js +0 -0
  132. /package/dist/src/{stepwise → builtin-loop}/tool-source.js +0 -0
@@ -1,13 +1,21 @@
1
- import type { AgentUsage } from "../agent-session-values.js";
1
+ import type { AgentImageReference, AgentUsage } from "../agent-session-values.js";
2
2
  /**
3
3
  * User text in a model input, stored for a user message and for Dex notes such as the turn-failure note.
4
- * Wire shape: `{"type":"user_text","text"}`.
4
+ * Wire shape: `{"type":"user_text","text"}`, plus `"images"` when the message has images.
5
5
  */
6
6
  export interface ModelUserTextItem {
7
7
  /** Discriminator. Wire field: `type`. */
8
8
  readonly type: "user_text";
9
9
  /** The text. Wire field: `text`. */
10
10
  readonly text: string;
11
+ /**
12
+ * The images of a user message, after the text, in order. The item holds references only; the request's
13
+ * {@link ModelRequest.imageBytes} holds their bytes. Omitted or empty for a message without images and for every
14
+ * note Dex adds. Wire field: `images`, a list of snake_case image references, written only when non-empty.
15
+ *
16
+ * @since 0.5.0
17
+ */
18
+ readonly images?: readonly AgentImageReference[];
11
19
  }
12
20
  /** One tool call of a model response, in provider-neutral form. */
13
21
  export interface ModelToolCall {
@@ -44,7 +52,8 @@ export interface ModelOutputItem {
44
52
  }
45
53
  /**
46
54
  * The result of one tool call in a model input, in provider-neutral form.
47
- * Wire shape: `{"type":"tool_result","tool_call_id","tool_name","output"}`.
55
+ * Wire shape: `{"type":"tool_result","tool_call_id","tool_name","output"}`, plus `"images"` when the tool returned
56
+ * images.
48
57
  */
49
58
  export interface ModelToolResultItem {
50
59
  /** Discriminator. Wire field: `type`. */
@@ -55,9 +64,17 @@ export interface ModelToolResultItem {
55
64
  readonly toolName: string;
56
65
  /** Model-visible result text, from `describeToolCallOutcome`. Wire field: `output`. */
57
66
  readonly output: string;
67
+ /**
68
+ * The images the tool returned with {@link output}, from `AgentToolCall.images`, in order. The item holds
69
+ * references only; the request's {@link ModelRequest.imageBytes} holds their bytes. Wire field: `images`, written
70
+ * only when non-empty.
71
+ *
72
+ * @since 0.5.0
73
+ */
74
+ readonly images?: readonly AgentImageReference[];
58
75
  }
59
76
  /**
60
- * One item of a model input. The Stepwise runner stores each one as the `framework_item` of an
77
+ * One item of a model input. The built-in loop runner stores each one as the `framework_item` of an
61
78
  * `AgentMessage`, as snake_case JSON.
62
79
  */
63
80
  export type ModelInputItem = ModelUserTextItem | ModelOutputItem | ModelToolResultItem;
@@ -99,7 +116,7 @@ export interface ModelRequestMetadata {
99
116
  /** One-based attempt of the `RunModel` Step. */
100
117
  readonly attempt: number;
101
118
  }
102
- /** One model call, built by the Stepwise runner from committed session state only. */
119
+ /** One model call, built by the built-in loop runner from committed session state only. */
103
120
  export interface ModelRequest {
104
121
  /** System instructions for this call. */
105
122
  readonly instructions: string;
@@ -115,6 +132,14 @@ export interface ModelRequest {
115
132
  readonly metadata: ModelRequestMetadata;
116
133
  /** Signal aborted when Dex cancels the attempt; pass it to the provider request. */
117
134
  readonly cancellationSignal: AbortSignal;
135
+ /**
136
+ * The bytes of every image of {@link inputItems}, keyed by `AgentImageReference.sha256`. The runner reads them
137
+ * from its media store right before `callModel`, so a client never reads a store. Omitted when the input has no
138
+ * images, and in the requests passed to `estimateInputTokens`, which count each image without its bytes.
139
+ *
140
+ * @since 0.5.0
141
+ */
142
+ readonly imageBytes?: ReadonlyMap<string, Uint8Array>;
118
143
  }
119
144
  /** Result of one model call. */
120
145
  export interface ModelResponse {
@@ -131,7 +156,7 @@ export interface ModelResponse {
131
156
  /** Provider finish reason, such as `"stop"` or `"tool-calls"`. */
132
157
  readonly finishReason: string;
133
158
  }
134
- /** Receives the live text of one model call; the Stepwise runner forwards it to `AgentEvents`. */
159
+ /** Receives the live text of one model call; the built-in loop runner forwards it to `AgentEvents`. */
135
160
  export interface ModelOutputWriter {
136
161
  /**
137
162
  * Writes visible text as a `text_delta` event.
@@ -145,7 +170,7 @@ export interface ModelOutputWriter {
145
170
  writeReasoningDelta(text: string): void;
146
171
  }
147
172
  /**
148
- * Makes one model call for the Stepwise runner.
173
+ * Makes one model call for the built-in loop runner.
149
174
  *
150
175
  * Use `createAiSdkModelClient` from `@superdurable/dex-agents/ai-sdk` for any AI SDK provider, or
151
176
  * implement this interface for another model API. Every client follows these rules:
@@ -158,6 +183,10 @@ export interface ModelOutputWriter {
158
183
  * thinking signatures or encrypted reasoning, from display text.
159
184
  * - Dex-authored items, {@link ModelUserTextItem} and {@link ModelToolResultItem}, are converted at call
160
185
  * time. An item from another provider or API is replayed as its text and tool calls.
186
+ * - Images. A user text or tool result item may carry `images`. A client that sends images converts each one to
187
+ * the provider's image part, with its bytes from {@link ModelRequest.imageBytes}, and throws when they are
188
+ * missing. A client that ignores `images` shows the model the text only. The runner sends images only when it
189
+ * has a media store; see `BuiltinLoopAgentRunner`.
161
190
  *
162
191
  * @example
163
192
  * ```ts
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-client.js","sourceRoot":"","sources":["../../../src/builtin-loop/model-client.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,EAAE;AACF,kDAAkD;AAClD,mEAAmE;AACnE,+CAA+C;AAC/C,EAAE;AACF,0DAA0D"}
@@ -29,12 +29,12 @@ export interface ScriptedModelReply {
29
29
  /** The script: a function from the whole request to the reply. */
30
30
  export type ScriptedModelResponder = (request: ModelRequest) => ScriptedModelReply | Promise<ScriptedModelReply>;
31
31
  /**
32
- * A Stepwise {@link ModelClient} that answers every model call from a script, for demos and tests without a
32
+ * A built-in agent loop {@link ModelClient} that answers every model call from a script, for demos and tests without a
33
33
  * model key. It mirrors the Python core's `ScriptedModelClient`.
34
34
  *
35
- * Use it as `AgentDefinition.model` to run a Stepwise agent with no provider account: a local demo
35
+ * Use it as `AgentDefinition.model` to run a built-in loop agent with no provider account: a local demo
36
36
  * mode of an application, a tutorial, or an integration test. It is a supported part of
37
- * `@superdurable/dex-agents/stepwise` and needs no optional peer. `@superdurable/dex-agents/testing`
37
+ * `@superdurable/dex-agents/builtin-loop` and needs no optional peer. `@superdurable/dex-agents/testing`
38
38
  * exports the same class.
39
39
  *
40
40
  * The script is a function of the whole {@link ModelRequest}, so it can read the user text, with
@@ -50,7 +50,7 @@ export type ScriptedModelResponder = (request: ModelRequest) => ScriptedModelRep
50
50
  * ScriptedModelClient.toolResults(request).length > 0
51
51
  * ? { text: "done" }
52
52
  * : { toolCalls: [{ toolName: "lookup_order", arguments: { order_id: "7" } }] });
53
- * const flow = createStepwiseAgentSessionFlow(
53
+ * const flow = createBuiltinAgentSessionFlow(
54
54
  * { name: "demo", instructions: "Help.", model, tools: [lookupOrder] }, "DemoAgent");
55
55
  * ```
56
56
  */
@@ -92,8 +92,11 @@ export declare class ScriptedModelClient implements ModelClient {
92
92
  static userTexts(request: ModelRequest): string[];
93
93
  /**
94
94
  * Returns the tool results after the last user item of a request.
95
+ *
96
+ * A continuation message from `decideTurnContinuation` is a user item too. After one, this returns only the
97
+ * results that follow it, so a script that decides from these results must also read the earlier ones itself.
95
98
  * @param request - The request.
96
- * @returns The current turn's tool results, oldest first.
99
+ * @returns The tool results after the last user item, oldest first.
97
100
  */
98
101
  static toolResults(request: ModelRequest): ModelToolResultItem[];
99
102
  }
@@ -13,12 +13,12 @@ export const scriptedModelApi = "scripted";
13
13
  /** Default number of latest requests {@link ScriptedModelClient.requests} keeps. */
14
14
  export const defaultMaxRecordedRequests = 100;
15
15
  /**
16
- * A Stepwise {@link ModelClient} that answers every model call from a script, for demos and tests without a
16
+ * A built-in agent loop {@link ModelClient} that answers every model call from a script, for demos and tests without a
17
17
  * model key. It mirrors the Python core's `ScriptedModelClient`.
18
18
  *
19
- * Use it as `AgentDefinition.model` to run a Stepwise agent with no provider account: a local demo
19
+ * Use it as `AgentDefinition.model` to run a built-in loop agent with no provider account: a local demo
20
20
  * mode of an application, a tutorial, or an integration test. It is a supported part of
21
- * `@superdurable/dex-agents/stepwise` and needs no optional peer. `@superdurable/dex-agents/testing`
21
+ * `@superdurable/dex-agents/builtin-loop` and needs no optional peer. `@superdurable/dex-agents/testing`
22
22
  * exports the same class.
23
23
  *
24
24
  * The script is a function of the whole {@link ModelRequest}, so it can read the user text, with
@@ -34,7 +34,7 @@ export const defaultMaxRecordedRequests = 100;
34
34
  * ScriptedModelClient.toolResults(request).length > 0
35
35
  * ? { text: "done" }
36
36
  * : { toolCalls: [{ toolName: "lookup_order", arguments: { order_id: "7" } }] });
37
- * const flow = createStepwiseAgentSessionFlow(
37
+ * const flow = createBuiltinAgentSessionFlow(
38
38
  * { name: "demo", instructions: "Help.", model, tools: [lookupOrder] }, "DemoAgent");
39
39
  * ```
40
40
  */
@@ -127,8 +127,11 @@ export class ScriptedModelClient {
127
127
  }
128
128
  /**
129
129
  * Returns the tool results after the last user item of a request.
130
+ *
131
+ * A continuation message from `decideTurnContinuation` is a user item too. After one, this returns only the
132
+ * results that follow it, so a script that decides from these results must also read the earlier ones itself.
130
133
  * @param request - The request.
131
- * @returns The current turn's tool results, oldest first.
134
+ * @returns The tool results after the last user item, oldest first.
132
135
  */
133
136
  static toolResults(request) {
134
137
  let results = [];
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scripted-model-client.js","sourceRoot":"","sources":["../../../src/builtin-loop/scripted-model-client.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,EAAE;AACF,kDAAkD;AAClD,mEAAmE;AACnE,+CAA+C;AAC/C,EAAE;AACF,0DAA0D;AAG1D,OAAO,EAAE,iCAAiC,EAAE,MAAM,6BAA6B,CAAC;AAWhF,0FAA0F;AAC1F,MAAM,CAAC,MAAM,qBAAqB,GAAG,cAAc,CAAC;AACpD,qFAAqF;AACrF,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAAC;AAE3C,oFAAoF;AACpF,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,CAAC;AA2B9C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,OAAO,mBAAmB;IAaX;IAZF,gBAAgB,GAAmB,EAAE,CAAC;IACtC,mBAAmB,CAAS;I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AO,GAAG,EAAE,CAAC;YACf,CAAC;iBAAM,IAAI,IAAI,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;gBACvC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACrB,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAED,SAAS,kBAAkB,CACzB,IAAuC,EACvC,IAAmB,EACnB,SAAmC;IAEnC,OAAO;QACL,IAAI,EAAE,cAAc;QACpB,QAAQ,EAAE,qBAAqB;QAC/B,GAAG,EAAE,gBAAgB;QACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;QAC1B,IAAI;QACJ,SAAS;KACV,CAAC;AACJ,CAAC"}
@@ -16,7 +16,7 @@ export interface SourceToolDefinition {
16
16
  readonly inputSchema: Readonly<Record<string, unknown>>;
17
17
  }
18
18
  /**
19
- * Tools that a Stepwise agent lists at run time, such as an MCP server's tools, run one tool Step per call.
19
+ * Tools that a built-in loop agent lists at run time, such as an MCP server's tools, run one tool Step per call.
20
20
  *
21
21
  * Put a source in `AgentDefinition.toolSources`. `McpToolSource` from `@superdurable/dex-agents/mcp`
22
22
  * implements it. In every `RunModel` of a chat or executing turn, the runner awaits {@link listTools} and
@@ -39,7 +39,7 @@ export interface SourceToolDefinition {
39
39
  * @example
40
40
  * ```ts
41
41
  * const tools = new McpToolSource([{ name: "files", transport: "stdio", command: "mcp-files" }]);
42
- * const flow = createStepwiseAgentSessionFlow(
42
+ * const flow = createBuiltinAgentSessionFlow(
43
43
  * { name: "files", instructions: "You manage reports.", model, toolSources: [tools] },
44
44
  * "FilesAgent",
45
45
  * );
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-source.js","sourceRoot":"","sources":["../../../src/builtin-loop/tool-source.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,EAAE;AACF,kDAAkD;AAClD,mEAAmE;AACnE,+CAA+C;AAC/C,EAAE;AACF,0DAA0D"}
@@ -6,7 +6,7 @@
6
6
  //
7
7
  // SPDX-License-Identifier: LicenseRef-Sustainable-Use-1.0
8
8
  // Checks the JSON Schema subset of Connector `inputSchema` values with the Python core's messages.
9
- import { serializeJsonWithSpacedSeparators } from "../stepwise/json-schema-validation.js";
9
+ import { serializeJsonWithSpacedSeparators } from "../builtin-loop/json-schema-validation.js";
10
10
  // Keywords that constrain a value; an unlisted keyword refuses the tool, so nothing is unchecked.
11
11
  const checkedKeywords = new Set([
12
12
  "type",
@@ -1 +1 @@
1
- {"version":3,"file":"connector-input-schema.js","sourceRoot":"","sources":["../../../src/connectors/connector-input-schema.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,EAAE;AACF,kDAAkD;AAClD,mEAAmE;AACnE,+CAA+C;AAC/C,EAAE;AACF,0DAA0D;AAE1D,mGAAmG;AAEnG,OAAO,EAAE,iCAAiC,EAAE,MAAM,uCAAuC,CAAC;AAI1F,kGAAkG;AAClG,MAAM,eAAe,GAAwB,IAAI,GAAG,CAAC;IACnD,MAAM;IACN,YAAY;IACZ,UAAU;IACV,sBAAsB;IACtB,OAAO;IACP,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;IACP,SAAS;IACT,SAAS;CACV,CAAC,CAAC;AACH,kGAAkG;AAClG,MAAM,kBAAkB,GAAwB,IAAI,GAAG,CAAC;IACtD,aAAa;IACb,OAAO;IACP,QAAQ;IACR,iBAAiB;IACjB,SAAS;IACT,SAAS;IACT,KAAK;IACL,UAAU;CACX,CAAC,CAAC;AACH,MAAM,SAAS,GAAwB,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;AACtH,MAAM,iBAAiB,GAAG,UAAU,CAAC;AAErC;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAAkB;IAC1D,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,QAAQ,EAAE,CAAC;QA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C;QAC9B,KAAK,QAAQ;YACX,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;QACzB,KAAK,QAAQ;YACX,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;QACnC,KAAK,SAAS;YACZ,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC9D;YACE,MAAM,IAAI,SAAS,CAAC,gCAAgC,IAAI,EAAE,CAAC,CAAC;IAChE,CAAC;AACH,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,iBAAiB,CAAC,IAAY,EAAE,KAAa;IAC3D,OAAO,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClD,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
1
+ {"version":3,"file":"connector-input-schema.js","sourceRoot":"","sources":["../../../src/connectors/connector-input-schema.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,EAAE;AACF,kDAAkD;AAClD,mEAAmE;AACnE,+CAA+C;AAC/C,EAAE;AACF,0DAA0D;AAE1D,mGAAmG;AAEnG,OAAO,EAAE,iCAAiC,EAAE,MAAM,2CAA2C,CAAC;AAI9F,kGAAkG;AAClG,MAAM,eAAe,GAAwB,IAAI,GAAG,CAAC;IACnD,MAAM;IACN,YAAY;IACZ,UAAU;IACV,sBAAsB;IACtB,OAAO;IACP,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;IACP,SAAS;IACT,SAAS;CACV,CAAC,CAAC;AACH,kGAAkG;AAClG,MAAM,kBAAkB,GAAwB,IAAI,GAAG,CAAC;IACtD,aAAa;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,CAAC,CAAC,CAAC,CACzF,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,KAAK,KAAK,CAAC;AACxB,CAAC;AAED,SAAS,eAAe,CAAC,IAAY,EAAE,KAAc;IACnD,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,QAAQ;YACX,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;QACnC,KAAK,SAAS;YACZ,OAAO,OAAO,KAAK,KAAK,SAAS,CAAC;QACpC,KAAK,MAAM;YACT,OAAO,KAAK,KAAK,IAAI,CAAC;QACxB,KAAK,OAAO;YACV,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC9B,KAAK,QAAQ;YACX,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;QACzB,KAAK,QAAQ;YACX,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;QACnC,KAAK,SAAS;YACZ,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC9D;YACE,MAAM,IAAI,SAAS,CAAC,gCAAgC,IAAI,EAAE,CAAC,CAAC;IAChE,CAAC;AACH,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,iBAAiB,CAAC,IAAY,EAAE,KAAa;IAC3D,OAAO,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClD,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
@@ -1,6 +1,23 @@
1
1
  import type { AsyncContext } from "@superdurable/dex";
2
- /** Returns the last heartbeat value this context saved in this attempt, or `undefined`. Internal to the core. */
3
- export declare function readSavedHeartbeatValue(context: ConnectorStepContext): unknown;
2
+ /** What one call's saved fence markers in this attempt prove; a later checkpoint cannot erase it. Internal. */
3
+ export interface FenceEvidence {
4
+ /** A claim stands: no valid `canResend` followed it. */
5
+ isClaimed: boolean;
6
+ /** The attempt claimed a send at some point. */
7
+ hasClaimed: boolean;
8
+ /** A claim recorded a provider ID. */
9
+ hasProviderId: boolean;
10
+ /** A `notSent` before any claim, or a valid `canResend`. */
11
+ hasNotSentProof: boolean;
12
+ }
13
+ /** Returns the evidence of one call's saved fence markers in this attempt, or `undefined`. Internal to the core. */
14
+ export declare function readFenceEvidence(context: ConnectorStepContext, callId: string): Readonly<FenceEvidence> | undefined;
15
+ /** Reports whether a value is a single-dispatch fence marker with only its declared fields. Internal to the core. */
16
+ export declare function isFenceMarker(value: unknown): value is Readonly<Record<string, unknown>>;
17
+ /** Returns the text checkpoint an earlier attempt saved, or `undefined`. Internal to the core. */
18
+ export declare function readPreviousCheckpoint(context: ConnectorStepContext): string | undefined;
19
+ /** Reports whether the operation asked this context for an earlier attempt's checkpoint. Internal to the core. */
20
+ export declare function hasReadCheckpoint(context: ConnectorStepContext): boolean;
4
21
  /** How a {@link ConnectorStepContext} reaches the tool Step's heartbeats. */
5
22
  export interface ConnectorStepHeartbeats {
6
23
  /** The text checkpoint an earlier attempt of the tool Step saved, or `undefined`. */
@@ -7,10 +7,63 @@
7
7
  // SPDX-License-Identifier: LicenseRef-Sustainable-Use-1.0
8
8
  import { compareCodePoints } from "./connector-input-schema.js";
9
9
  // The source reads it on a Retry; a failed save leaves the earlier value.
10
- const savedHeartbeatValues = new WeakMap();
11
- /** Returns the last heartbeat value this context saved in this attempt, or `undefined`. Internal to the core. */
12
- export function readSavedHeartbeatValue(context) {
13
- return savedHeartbeatValues.get(context);
10
+ const fenceEvidence = new WeakMap();
11
+ const fenceMarkerKeys = new Set(["callId", "attempt", "state", "providerId"]);
12
+ /** Returns the evidence of one call's saved fence markers in this attempt, or `undefined`. Internal to the core. */
13
+ export function readFenceEvidence(context, callId) {
14
+ return fenceEvidence.get(context)?.get(callId);
15
+ }
16
+ /** Reports whether a value is a single-dispatch fence marker with only its declared fields. Internal to the core. */
17
+ export function isFenceMarker(value) {
18
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
19
+ return false;
20
+ }
21
+ const record = value;
22
+ return (Object.keys(record).every((key) => fenceMarkerKeys.has(key)) &&
23
+ typeof record["callId"] === "string" &&
24
+ typeof record["attempt"] === "number" &&
25
+ Number.isInteger(record["attempt"]) &&
26
+ record["attempt"] >= 1 &&
27
+ (record["state"] === "notSent" || record["state"] === "claimed" || record["state"] === "canResend") &&
28
+ (record["providerId"] === undefined || typeof record["providerId"] === "string"));
29
+ }
30
+ function observeSavedHeartbeatValue(context, value) {
31
+ if (!isFenceMarker(value) || value["attempt"] !== context.attempt) {
32
+ return;
33
+ }
34
+ const callId = value["callId"];
35
+ const byCall = fenceEvidence.get(context) ?? new Map();
36
+ fenceEvidence.set(context, byCall);
37
+ const evidence = byCall.get(callId) ?? { isClaimed: false, hasClaimed: false, hasProviderId: false, hasNotSentProof: false };
38
+ byCall.set(callId, evidence);
39
+ const hasMarkerProviderId = value["providerId"] !== undefined && value["providerId"] !== "";
40
+ if (value["state"] === "claimed") {
41
+ evidence.isClaimed = true;
42
+ evidence.hasClaimed = true;
43
+ evidence.hasProviderId ||= hasMarkerProviderId;
44
+ evidence.hasNotSentProof = false;
45
+ }
46
+ else if (value["state"] === "canResend") {
47
+ // The fence allows canResend only after its own claim without a provider ID.
48
+ if (evidence.isClaimed && !evidence.hasProviderId && !hasMarkerProviderId) {
49
+ evidence.isClaimed = false;
50
+ evidence.hasNotSentProof = true;
51
+ }
52
+ }
53
+ else if (value["state"] === "notSent" && !evidence.hasClaimed && !hasMarkerProviderId) {
54
+ evidence.hasNotSentProof = true;
55
+ }
56
+ }
57
+ const previousCheckpoints = new WeakMap();
58
+ /** Returns the text checkpoint an earlier attempt saved, or `undefined`. Internal to the core. */
59
+ export function readPreviousCheckpoint(context) {
60
+ return previousCheckpoints.get(context);
61
+ }
62
+ // The source reads it to tell a lost fence checkpoint from an unfenced operation.
63
+ const checkpointReaders = new WeakSet();
64
+ /** Reports whether the operation asked this context for an earlier attempt's checkpoint. Internal to the core. */
65
+ export function hasReadCheckpoint(context) {
66
+ return checkpointReaders.has(context);
14
67
  }
15
68
  /**
16
69
  * The Step context a connector operation sees inside an agent tool Step, with heartbeat values kept as text.
@@ -35,6 +88,7 @@ export class ConnectorStepContext {
35
88
  constructor(context, heartbeats) {
36
89
  this.context = context;
37
90
  this.heartbeats = heartbeats;
91
+ previousCheckpoints.set(this, heartbeats.previousCheckpoint);
38
92
  }
39
93
  /** The Flow ID. */
40
94
  get flowId() {
@@ -65,6 +119,7 @@ export class ConnectorStepContext {
65
119
  * @returns `true` when the session read a checkpoint for this attempt.
66
120
  */
67
121
  hasLastHeartbeatValue() {
122
+ checkpointReaders.add(this);
68
123
  return this.heartbeats.previousCheckpoint !== undefined;
69
124
  }
70
125
  /**
@@ -78,6 +133,7 @@ export class ConnectorStepContext {
78
133
  if (codec !== undefined) {
79
134
  throw new TypeError("ConnectorStepContext keeps heartbeat values as JSON and takes no codec");
80
135
  }
136
+ checkpointReaders.add(this);
81
137
  const previous = this.heartbeats.previousCheckpoint;
82
138
  return previous === undefined ? undefined : JSON.parse(previous);
83
139
  }
@@ -101,7 +157,7 @@ export class ConnectorStepContext {
101
157
  throw new TypeError("this tool Step cannot save heartbeat checkpoints");
102
158
  }
103
159
  await this.heartbeats.saveCheckpoint(stringifyWithSortedKeys(value));
104
- savedHeartbeatValues.set(this, value);
160
+ observeSavedHeartbeatValue(this, value);
105
161
  }
106
162
  }
107
163
  /** Returns compact JSON with object keys sorted by code point, the text the Python core stores. */
@@ -1 +1 @@
1
- {"version":3,"file":"connector-step-context.js","sourceRoot":"","sources":["../../../src/connectors/connector-step-context.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,EAAE;AACF,kDAAkD;AAClD,mEAAmE;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AAC;QAC1D,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;aAChB,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC;aAC1C,IAAI,CAAC,iBAAiB,CAAC;aACvB,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAC9C,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
1
+ {"version":3,"file":"connector-step-context.js","sourceRoot":"","sources":["../../../src/connectors/connector-step-context.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,EAAE;AACF,kDAAkD;AAClD,mEAAmE;AACnE,+CAA+C;AAC/C,EAAE;AACF,0DAA0D;AAI1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAchE,0EAA0E;AAC1E,MAAM,aAAa,GAAG,IAAI,OAAO,EAAoD,CAAC;AAEtF,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;AAE9E,oHAAoH;AACpH,MAAM,UAAU,iBAAiB,CAAC,OAA6B,EAAE,MAAc;IAC7E,OAAO,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;AACjD,CAAC;AAED,qHAAqH;AACrH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACxE,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,MAAM,GAAG,KAA0C,CAAC;IAC1D,OAAO,CACL,MAAM,CAAC,IAAI,CAA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,CAAC;aACvB,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAC9C,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -2,7 +2,7 @@ import type { RetryPolicy } from "@superdurable/dex";
2
2
  import { type Call, type ConnectionRef, type Mutation, type Query, type QueryResult } from "@superdurable/connectors-sdk";
3
3
  import { type AgentTurnContext, type DeferredToolCall, type DeferredToolExecution, type ToolCallStepOptions, type ToolExecutionResult, type ToolTaskPoll, type ToolTaskPollOutcome } from "../agent-framework-runner.js";
4
4
  import type { AgentToolCall, ToolEffect } from "../agent-session-values.js";
5
- import type { SourceToolDefinition, ToolSource } from "../stepwise/tool-source.js";
5
+ import type { SourceToolDefinition, ToolSource } from "../builtin-loop/tool-source.js";
6
6
  import { ConnectorStepContext } from "./connector-step-context.js";
7
7
  /**
8
8
  * Default {@link ConnectorToolSource.sourceName}.
@@ -37,9 +37,14 @@ export type ApprovalPredicate = (toolArguments: Readonly<Record<string, unknown>
37
37
  * - `succeeded`: a required branch, such as `sent` or `refunded`. The model reads the result value.
38
38
  * - `rejected`: a branch the manifest lists as `rejected` under `agent.branches`, such as `providerRejected`.
39
39
  * Nothing took effect. The record is `failed` with an error the model reads, and the session continues.
40
- * - `failed`: `defect`, or an optional branch of a Query that `agent.branches` does not list.
41
- * - `outcome_unknown`: `uncertain`, a branch listed as `unknown`, or an optional branch of a Mutation that
42
- * `agent.branches` does not list. The write may have taken effect.
40
+ * - `failed`: an optional branch of a Query that `agent.branches` does not list, including `defect`.
41
+ * - `outcome_unknown`: `uncertain`, a Mutation's `defect`, any optional branch of a Mutation whose single-dispatch
42
+ * fence cannot prove that nothing was sent, a branch listed as `unknown`, or an optional branch of a Mutation
43
+ * that `agent.branches` does not list. The write may have taken effect.
44
+ *
45
+ * Changed in 0.5.0: a Mutation's `defect` is always `outcome_unknown`, because the Connector SDK can select it
46
+ * after the provider was called. A Query's `defect` follows `agent.branches`. A fenced Mutation whose fence cannot
47
+ * prove that nothing was sent is `outcome_unknown` on any optional branch.
43
48
  * @since 0.4.0
44
49
  */
45
50
  export type ConnectorBranchOutcome = "succeeded" | "rejected" | "failed" | "outcome_unknown";
@@ -107,7 +112,14 @@ export interface ConnectorToolOptions<Input> {
107
112
  readonly manifest: ConnectorPackageManifest;
108
113
  /** The validator the package exports for the operation's input, such as `CreateRefundInputSchema`. */
109
114
  readonly inputValidator: ConnectorInputValidator<Input>;
110
- /** Tool name; defaults to `<connectorId>_<operation in snake case>`, such as `stripe_create_refund`. */
115
+ /**
116
+ * Tool name; defaults to `<connectorId>_<operation in snake case>`, such as `stripe_create_refund`. The snake
117
+ * case is the one the Connector library uses for Python Step factory names: an acronym run stays one word, so
118
+ * `listStoryIDs` becomes `list_story_ids` and `getHTTPResponse` becomes `get_http_response`.
119
+ *
120
+ * Changed in 0.5.0: the default keeps an acronym run as one word; it used to split `listStoryIDs` into
121
+ * `list_story_i_d_s`.
122
+ */
111
123
  readonly name?: string;
112
124
  /** Model-facing description; defaults to the manifest's. */
113
125
  readonly description?: string;
@@ -120,7 +132,7 @@ export interface ConnectorToolOptions<Input> {
120
132
  readonly maxResultBytes?: number;
121
133
  }
122
134
  /**
123
- * One Connector operation offered to a Stepwise agent as a tool. Create it with {@link connectorTool}.
135
+ * One Connector operation offered to a built-in loop agent as a tool. Create it with {@link connectorTool}.
124
136
  * @since 0.4.0
125
137
  */
126
138
  export interface ConnectorTool {
@@ -163,15 +175,39 @@ export interface ConnectorTool {
163
175
  /**
164
176
  * Returns what a connector tool call records for one selected branch.
165
177
  *
178
+ * The rules apply in this order. The manifest listing comes after the checks that can only tighten an outcome to
179
+ * `outcome_unknown`:
180
+ *
181
+ * 1. `uncertain` is `outcome_unknown`, whatever `agent.branches` says or whether it is declared required. It means
182
+ * the write may have happened, so a listing of it as `rejected` is a manifest error.
183
+ * 2. A Mutation's `defect` is `outcome_unknown`, whatever `agent.branches` says or whether it is declared required.
184
+ * The Connector SDK selects `defect` for some attempts that already called the provider, such as an invalid
185
+ * attempt or an undeclared branch, and a host cannot tell those apart.
186
+ * 3. A required branch other than `defect` is `succeeded`.
187
+ * 4. On a Mutation, any other branch is `outcome_unknown` when `mayHaveDispatched` is set: its single-dispatch
188
+ * fence cannot prove that no request reached the provider.
189
+ * 5. A branch that `agent.branches` lists as `rejected` is `rejected`.
190
+ * 6. A branch that `agent.branches` lists as `unknown` is `outcome_unknown`.
191
+ * 7. Any other optional branch of a Mutation is `outcome_unknown`.
192
+ * 8. Any other branch of a Query, including `defect`, is `failed`.
193
+ *
166
194
  * The rule fails closed: an optional branch of a Mutation that the manifest does not classify is
167
195
  * `outcome_unknown`, because the write may have happened.
168
196
  *
197
+ * Changed in 0.5.0: added `mayHaveDispatched`. `agent.branches` no longer decides a Mutation's `defect`, which is
198
+ * `outcome_unknown` instead of `failed`. A Query's `defect` follows `agent.branches`.
199
+ *
169
200
  * @example
170
201
  * ```ts
171
- * classifyConnectorBranch({ kind: "mutation", branch: "invalidResponse", requiredBranches: new Set(["refunded"]),
172
- * agentBranches: {} }); // "outcome_unknown"
202
+ * classifyConnectorBranch({ kind: "mutation", branch: "defect", requiredBranches: new Set(["refunded"]),
203
+ * agentBranches: { defect: "rejected" } }); // "outcome_unknown"
173
204
  * ```
174
- * @param options - The operation kind, the selected branch, the required branches, and `agent.branches`.
205
+ * @param options - The operation kind, the selected branch, the required branches, `agent.branches`, and
206
+ * `mayHaveDispatched`: whether the attempt's single-dispatch fence checkpoints leave open that the request reached
207
+ * the provider, because this attempt claimed a send and no canResend followed, or the earlier attempt's checkpoint
208
+ * is missing, not a fence marker, malformed, foreign, or does not allow this attempt a send.
209
+ * {@link ConnectorToolSource} computes it. It defaults to `false`
210
+ * and applies only to a Mutation.
175
211
  * @returns The outcome to record.
176
212
  * @since 0.4.0
177
213
  */
@@ -180,9 +216,10 @@ export declare function classifyConnectorBranch(options: {
180
216
  readonly branch: string;
181
217
  readonly requiredBranches: ReadonlySet<string>;
182
218
  readonly agentBranches: Readonly<Record<string, string>>;
219
+ readonly mayHaveDispatched?: boolean;
183
220
  }): ConnectorBranchOutcome;
184
221
  /**
185
- * Offers one reviewed Connector operation to a Stepwise agent as a tool.
222
+ * Offers one reviewed Connector operation to a built-in loop agent as a tool.
186
223
  *
187
224
  * The tool's name, description, and argument schema come from the operation's entry in its package's
188
225
  * `dex-connector.json`. Only an operation whose entry says `agent.exposed: true` can become a tool; nothing is
@@ -198,6 +235,9 @@ export declare function classifyConnectorBranch(options: {
198
235
  * {@link ConnectorToolOptions.requiresApproval} overrides that. Arguments that break the schema never run, so
199
236
  * they never wait for approval.
200
237
  *
238
+ * Changed in 0.5.0: the default tool name keeps an acronym run as one word, as the Connector library does:
239
+ * `listStoryIDs` becomes `list_story_ids`, not `list_story_i_d_s`.
240
+ *
201
241
  * @example
202
242
  * ```ts
203
243
  * import manifest from "@superdurable/connector-stripe/dex-connector.json" with { type: "json" };
@@ -226,7 +266,7 @@ export declare function classifyConnectorBranch(options: {
226
266
  */
227
267
  export declare function connectorTool<Input, Output>(operation: Query<Input, Output> | Mutation<Input, Output>, connection: ConnectionRef, options: ConnectorToolOptions<Input>): ConnectorTool;
228
268
  /**
229
- * Offers reviewed Connector operations to a Stepwise agent as tools.
269
+ * Offers reviewed Connector operations to a built-in loop agent as tools.
230
270
  *
231
271
  * Put it in `AgentDefinition.toolSources`, as `McpToolSource` is. It lists exactly the tools the application
232
272
  * passes; no Connector is exposed by default. Each call runs one operation invocation in its own tool Step, through
@@ -253,7 +293,7 @@ export declare function connectorTool<Input, Output>(operation: Query<Input, Out
253
293
  *
254
294
  * @example
255
295
  * ```ts
256
- * const flow = createStepwiseAgentSessionFlow(
296
+ * const flow = createBuiltinAgentSessionFlow(
257
297
  * { name: "support", instructions: "You help customers.", model,
258
298
  * toolSources: [new ConnectorToolSource([refund, reply])] },
259
299
  * "SupportAgent",
@@ -349,5 +389,13 @@ export declare function boundConnectorResult(output: string, maxResultBytes: num
349
389
  * @since 0.4.0
350
390
  */
351
391
  export declare function formatConnectorResult(jsonText: string): string;
352
- /** Reports whether this attempt's last saved fence marker proves the write was not sent. */
392
+ /** Reports whether fence events leave open that the request was sent, as sdkgo does. */
393
+ export declare function mayHaveDispatched(call: Call, context: ConnectorStepContext): boolean;
394
+ /** Reports whether this attempt's fence recorded proof that the write was not sent. */
353
395
  export declare function isProvenNotSent(call: Call, context: ConnectorStepContext): boolean;
396
+ /**
397
+ * Returns an operation ID in snake case, as connectorctl `lowerCamelToSnake` names the Python Step factories.
398
+ * @param operationId - The lower camel case operation ID, such as `listStoryIDs`.
399
+ * @returns The snake case name, such as `list_story_ids`.
400
+ */
401
+ export declare function lowerCamelToSnake(operationId: string): string;