veryfront 0.1.245 → 0.1.246
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/esm/deno.js +1 -1
- package/esm/src/agent/durable.d.ts +20 -0
- package/esm/src/agent/durable.d.ts.map +1 -1
- package/esm/src/agent/durable.js +47 -0
- package/esm/src/agent/index.d.ts +1 -1
- package/esm/src/agent/index.d.ts.map +1 -1
- package/esm/src/agent/index.js +1 -1
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +1 -1
- package/src/deno.js +1 -1
- package/src/src/agent/durable.ts +74 -0
- package/src/src/agent/index.ts +2 -0
- package/src/src/utils/version-constant.ts +1 -1
package/esm/deno.js
CHANGED
|
@@ -79,6 +79,7 @@ export type ActiveConversationRunStatus = Extract<ConversationRunProjection["sta
|
|
|
79
79
|
export type TerminalConversationRunStatus = Extract<ConversationRunProjection["status"], "completed" | "failed" | "cancelled">;
|
|
80
80
|
export type ConversationRunAppendCursorResyncResult = "advanced" | "non_appendable" | "unchanged";
|
|
81
81
|
export type ConversationRunAppendRecoveryOutcome = "resumed" | "stopped" | "bubbled";
|
|
82
|
+
export type ConversationRunAppendFailureOutcome = "resumed" | "stopped" | "retry_scheduled";
|
|
82
83
|
export declare const CreateConversationRunAcceptedSchema: z.ZodPipe<z.ZodObject<{
|
|
83
84
|
run: z.ZodObject<{
|
|
84
85
|
runId: z.ZodOptional<z.ZodString>;
|
|
@@ -230,6 +231,25 @@ export declare function recoverConversationRunCursorMismatch(input: {
|
|
|
230
231
|
disableReason?: "cursor_resyncs_exhausted" | "non_appendable";
|
|
231
232
|
run?: ConversationRunProjection;
|
|
232
233
|
}>;
|
|
234
|
+
export declare function recoverConversationRunAppendFailure(input: {
|
|
235
|
+
error: unknown;
|
|
236
|
+
authToken: string;
|
|
237
|
+
apiUrl: string;
|
|
238
|
+
conversationId: string;
|
|
239
|
+
runId: string;
|
|
240
|
+
latestEventId: number;
|
|
241
|
+
latestExternalEventSequence: number;
|
|
242
|
+
cursorResyncsThisFlush: number;
|
|
243
|
+
maxCursorResyncsPerFlush: number;
|
|
244
|
+
abortSignal?: AbortSignal;
|
|
245
|
+
}): Promise<{
|
|
246
|
+
outcome: ConversationRunAppendFailureOutcome;
|
|
247
|
+
latestEventId: number;
|
|
248
|
+
latestExternalEventSequence: number;
|
|
249
|
+
disableReason?: "cursor_resyncs_exhausted" | "non_appendable" | "ignorable_append_rejection";
|
|
250
|
+
errorMessage?: string;
|
|
251
|
+
run?: ConversationRunProjection;
|
|
252
|
+
}>;
|
|
233
253
|
export declare function getConversationRun(input: {
|
|
234
254
|
authToken: string;
|
|
235
255
|
apiUrl: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"durable.d.ts","sourceRoot":"","sources":["../../../src/src/agent/durable.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAgCxB,eAAO,MAAM,4BAA4B;;;;;;;;;;iBAIvC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF,wBAAgB,6BAA6B,CAAC,KAAK,EAAE;IACnD,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,GAAG,sBAAsB,CAoBzB;AAED,eAAO,MAAM,2BAA2B;;;;;;;EAOtC,CAAC;AAEH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CxC,CAAC;AAEL,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AACxF,MAAM,MAAM,2BAA2B,GAAG,OAAO,CAC/C,yBAAyB,CAAC,QAAQ,C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4BAA4B,CAChD,KAAK,EAAE,iCAAiC,GACvC,OAAO,CAAC,IAAI,CAAC,CAwBf"}
|
package/esm/src/agent/durable.js
CHANGED
|
@@ -314,6 +314,53 @@ export async function recoverConversationRunCursorMismatch(input) {
|
|
|
314
314
|
run: resynced.run,
|
|
315
315
|
};
|
|
316
316
|
}
|
|
317
|
+
export async function recoverConversationRunAppendFailure(input) {
|
|
318
|
+
const cursorRecovery = await recoverConversationRunCursorMismatch({
|
|
319
|
+
error: input.error,
|
|
320
|
+
authToken: input.authToken,
|
|
321
|
+
apiUrl: input.apiUrl,
|
|
322
|
+
conversationId: input.conversationId,
|
|
323
|
+
runId: input.runId,
|
|
324
|
+
latestEventId: input.latestEventId,
|
|
325
|
+
latestExternalEventSequence: input.latestExternalEventSequence,
|
|
326
|
+
cursorResyncsThisFlush: input.cursorResyncsThisFlush,
|
|
327
|
+
maxCursorResyncsPerFlush: input.maxCursorResyncsPerFlush,
|
|
328
|
+
abortSignal: input.abortSignal,
|
|
329
|
+
});
|
|
330
|
+
if (cursorRecovery.outcome === "resumed") {
|
|
331
|
+
return {
|
|
332
|
+
outcome: "resumed",
|
|
333
|
+
latestEventId: cursorRecovery.latestEventId,
|
|
334
|
+
latestExternalEventSequence: cursorRecovery.latestExternalEventSequence,
|
|
335
|
+
...(cursorRecovery.run ? { run: cursorRecovery.run } : {}),
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
if (cursorRecovery.outcome === "stopped") {
|
|
339
|
+
return {
|
|
340
|
+
outcome: "stopped",
|
|
341
|
+
latestEventId: cursorRecovery.latestEventId,
|
|
342
|
+
latestExternalEventSequence: cursorRecovery.latestExternalEventSequence,
|
|
343
|
+
disableReason: cursorRecovery.disableReason,
|
|
344
|
+
...(cursorRecovery.run ? { run: cursorRecovery.run } : {}),
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
if (isIgnorableConversationRunAppendError(input.error)) {
|
|
348
|
+
return {
|
|
349
|
+
outcome: "stopped",
|
|
350
|
+
latestEventId: cursorRecovery.latestEventId,
|
|
351
|
+
latestExternalEventSequence: cursorRecovery.latestExternalEventSequence,
|
|
352
|
+
disableReason: "ignorable_append_rejection",
|
|
353
|
+
...(cursorRecovery.run ? { run: cursorRecovery.run } : {}),
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
return {
|
|
357
|
+
outcome: "retry_scheduled",
|
|
358
|
+
latestEventId: cursorRecovery.latestEventId,
|
|
359
|
+
latestExternalEventSequence: cursorRecovery.latestExternalEventSequence,
|
|
360
|
+
errorMessage: input.error instanceof Error ? input.error.message : String(input.error),
|
|
361
|
+
...(cursorRecovery.run ? { run: cursorRecovery.run } : {}),
|
|
362
|
+
};
|
|
363
|
+
}
|
|
317
364
|
async function waitForConversationRunPoll(ms, abortSignal) {
|
|
318
365
|
if (ms <= 0 || abortSignal?.aborted) {
|
|
319
366
|
return;
|
package/esm/src/agent/index.d.ts
CHANGED
|
@@ -93,7 +93,7 @@ export { type ConversationRunContext, createConversationRunContext, } from "./co
|
|
|
93
93
|
export { type ConversationRootRunContext, type ConversationRootRunDescriptor, createConversationRootRunContext, createConversationRootRunStartAdapter, prepareConversationRootRunContext, startConversationRootRun, } from "./conversation-root-run-context.js";
|
|
94
94
|
export { bootstrapConversationAgentRun, type BootstrapConversationAgentRunResult, type ConversationMessageRecord, ConversationMessageRecordSchema, type ConversationRecord, ConversationRecordSchema, createConversationMessage, createConversationRecord, ensureConversationProjectLink, fetchConversationRecord, } from "./conversation-bootstrap.js";
|
|
95
95
|
export { type ConversationChildLifecycleContext, type ConversationHostedLifecycleFinalizeInput, createConversationChildLifecycleAdapter, createConversationHostedLifecycleAdapter, type CreateConversationHostedLifecycleAdapterOptions, } from "./conversation-hosted-lifecycle.js";
|
|
96
|
-
export { type ActiveConversationRunStatus, appendConversationRunEvents, AppendConversationRunEventsError, type AppendConversationRunEventsResponse, AppendConversationRunEventsResponseSchema, CompleteConversationRunResponseSchema, type ConversationAgentRunUsage, type ConversationRunAppendCursorResyncResult, type ConversationRunAppendRecoveryOutcome, type ConversationRunProjection, ConversationRunProjectionSchema, ConversationRunStatusSchema, type ConversationRunTargets, ConversationRunTargetsSchema, ConversationRunTerminalStateError, createConversationAgentRun, finalizeConversationAgentRun, getConversationRun, isActiveConversationRunStatus, isAppendableConversationRunProjection, isCursorMismatchConversationRunAppendError, isIgnorableConversationRunAppendError, monitorConversationRunStatus, parseAppendConversationRunEventsErrorBody, recoverConversationRunCursorMismatch, resolveConversationRunTargets, resyncConversationRunAppendCursor, type TerminalConversationRunStatus, } from "./durable.js";
|
|
96
|
+
export { type ActiveConversationRunStatus, appendConversationRunEvents, AppendConversationRunEventsError, type AppendConversationRunEventsResponse, AppendConversationRunEventsResponseSchema, CompleteConversationRunResponseSchema, type ConversationAgentRunUsage, type ConversationRunAppendCursorResyncResult, type ConversationRunAppendFailureOutcome, type ConversationRunAppendRecoveryOutcome, type ConversationRunProjection, ConversationRunProjectionSchema, ConversationRunStatusSchema, type ConversationRunTargets, ConversationRunTargetsSchema, ConversationRunTerminalStateError, createConversationAgentRun, finalizeConversationAgentRun, getConversationRun, isActiveConversationRunStatus, isAppendableConversationRunProjection, isCursorMismatchConversationRunAppendError, isIgnorableConversationRunAppendError, monitorConversationRunStatus, parseAppendConversationRunEventsErrorBody, recoverConversationRunAppendFailure, recoverConversationRunCursorMismatch, resolveConversationRunTargets, resyncConversationRunAppendCursor, type TerminalConversationRunStatus, } from "./durable.js";
|
|
97
97
|
export { buildInvokeAgentChildRunLifecycleCustomEvent, buildInvokeAgentChildRunProgressEvents, buildInvokeAgentChildRunStateDelta, type InvokeAgentChildRunLifecycleCustomEvent, InvokeAgentChildRunLifecycleCustomEventSchema, type InvokeAgentChildRunLifecycleValue, InvokeAgentChildRunLifecycleValueSchema, type InvokeAgentChildRunProgressEvent, type InvokeAgentChildRunProgressInput, type InvokeAgentChildRunStateDelta, InvokeAgentChildRunStateDeltaSchema, publishInvokeAgentChildRunProgress, } from "./invoke-agent-child-runs.js";
|
|
98
98
|
export { type HostedChildLifecycleAdapter, type HostedChildLifecycleRunnerOptions, type HostedChildLifecycleRunResult, type HostedChildLifecycleTerminalState, runHostedChildLifecycle, } from "./hosted-child-lifecycle.js";
|
|
99
99
|
export { type HostedLifecycleAdapter, type HostedLifecycleExecution, type HostedLifecycleRunnerOptions, type HostedLifecycleRunResult, type HostedLifecycleTerminalState, runHostedLifecycle, } from "./hosted-lifecycle.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/agent/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+EG;AACH,OAAO,yBAAyB,CAAC;AAGjC,YAAY,EACV,KAAK,EACL,WAAW,EACX,YAAY,EACZ,eAAe,EACf,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,OAAO,IAAI,YAAY,EACvB,WAAW,EACX,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,GACf,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEnF,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,KAAK,MAAM,EACX,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,WAAW,EACX,KAAK,iBAAiB,EACtB,aAAa,GACd,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,WAAW,EAC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AC1B,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,8BAA8B,EACnC,KAAK,6BAA6B,EAClC,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,KAAK,8BAA8B,EACnC,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/agent/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+EG;AACH,OAAO,yBAAyB,CAAC;AAGjC,YAAY,EACV,KAAK,EACL,WAAW,EACX,YAAY,EACZ,eAAe,EACf,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,OAAO,IAAI,YAAY,EACvB,WAAW,EACX,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,GACf,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEnF,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,KAAK,MAAM,EACX,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,WAAW,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,gBAAgB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,4BAA4B,EAC5B,iBAAiB,EACjB,KAAK,wBAAwB,GAC9B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,8BAA8B,EACnC,KAAK,6BAA6B,EAClC,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,KAAK,8BAA8B,EACnC,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC"}
|
package/esm/src/agent/index.js
CHANGED
|
@@ -92,7 +92,7 @@ export { createConversationRunContext, } from "./conversation-run-context.js";
|
|
|
92
92
|
export { createConversationRootRunContext, createConversationRootRunStartAdapter, prepareConversationRootRunContext, startConversationRootRun, } from "./conversation-root-run-context.js";
|
|
93
93
|
export { bootstrapConversationAgentRun, ConversationMessageRecordSchema, ConversationRecordSchema, createConversationMessage, createConversationRecord, ensureConversationProjectLink, fetchConversationRecord, } from "./conversation-bootstrap.js";
|
|
94
94
|
export { createConversationChildLifecycleAdapter, createConversationHostedLifecycleAdapter, } from "./conversation-hosted-lifecycle.js";
|
|
95
|
-
export { appendConversationRunEvents, AppendConversationRunEventsError, AppendConversationRunEventsResponseSchema, CompleteConversationRunResponseSchema, ConversationRunProjectionSchema, ConversationRunStatusSchema, ConversationRunTargetsSchema, ConversationRunTerminalStateError, createConversationAgentRun, finalizeConversationAgentRun, getConversationRun, isActiveConversationRunStatus, isAppendableConversationRunProjection, isCursorMismatchConversationRunAppendError, isIgnorableConversationRunAppendError, monitorConversationRunStatus, parseAppendConversationRunEventsErrorBody, recoverConversationRunCursorMismatch, resolveConversationRunTargets, resyncConversationRunAppendCursor, } from "./durable.js";
|
|
95
|
+
export { appendConversationRunEvents, AppendConversationRunEventsError, AppendConversationRunEventsResponseSchema, CompleteConversationRunResponseSchema, ConversationRunProjectionSchema, ConversationRunStatusSchema, ConversationRunTargetsSchema, ConversationRunTerminalStateError, createConversationAgentRun, finalizeConversationAgentRun, getConversationRun, isActiveConversationRunStatus, isAppendableConversationRunProjection, isCursorMismatchConversationRunAppendError, isIgnorableConversationRunAppendError, monitorConversationRunStatus, parseAppendConversationRunEventsErrorBody, recoverConversationRunAppendFailure, recoverConversationRunCursorMismatch, resolveConversationRunTargets, resyncConversationRunAppendCursor, } from "./durable.js";
|
|
96
96
|
export { buildInvokeAgentChildRunLifecycleCustomEvent, buildInvokeAgentChildRunProgressEvents, buildInvokeAgentChildRunStateDelta, InvokeAgentChildRunLifecycleCustomEventSchema, InvokeAgentChildRunLifecycleValueSchema, InvokeAgentChildRunStateDeltaSchema, publishInvokeAgentChildRunProgress, } from "./invoke-agent-child-runs.js";
|
|
97
97
|
export { runHostedChildLifecycle, } from "./hosted-child-lifecycle.js";
|
|
98
98
|
export { runHostedLifecycle, } from "./hosted-lifecycle.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.
|
|
1
|
+
export declare const VERSION = "0.1.246";
|
|
2
2
|
//# sourceMappingURL=version-constant.d.ts.map
|
package/package.json
CHANGED
package/src/deno.js
CHANGED
package/src/src/agent/durable.ts
CHANGED
|
@@ -138,6 +138,10 @@ export type ConversationRunAppendRecoveryOutcome =
|
|
|
138
138
|
| "resumed"
|
|
139
139
|
| "stopped"
|
|
140
140
|
| "bubbled";
|
|
141
|
+
export type ConversationRunAppendFailureOutcome =
|
|
142
|
+
| "resumed"
|
|
143
|
+
| "stopped"
|
|
144
|
+
| "retry_scheduled";
|
|
141
145
|
|
|
142
146
|
export const CreateConversationRunAcceptedSchema = z
|
|
143
147
|
.object({
|
|
@@ -457,6 +461,76 @@ export async function recoverConversationRunCursorMismatch(input: {
|
|
|
457
461
|
};
|
|
458
462
|
}
|
|
459
463
|
|
|
464
|
+
export async function recoverConversationRunAppendFailure(input: {
|
|
465
|
+
error: unknown;
|
|
466
|
+
authToken: string;
|
|
467
|
+
apiUrl: string;
|
|
468
|
+
conversationId: string;
|
|
469
|
+
runId: string;
|
|
470
|
+
latestEventId: number;
|
|
471
|
+
latestExternalEventSequence: number;
|
|
472
|
+
cursorResyncsThisFlush: number;
|
|
473
|
+
maxCursorResyncsPerFlush: number;
|
|
474
|
+
abortSignal?: AbortSignal;
|
|
475
|
+
}): Promise<{
|
|
476
|
+
outcome: ConversationRunAppendFailureOutcome;
|
|
477
|
+
latestEventId: number;
|
|
478
|
+
latestExternalEventSequence: number;
|
|
479
|
+
disableReason?: "cursor_resyncs_exhausted" | "non_appendable" | "ignorable_append_rejection";
|
|
480
|
+
errorMessage?: string;
|
|
481
|
+
run?: ConversationRunProjection;
|
|
482
|
+
}> {
|
|
483
|
+
const cursorRecovery = await recoverConversationRunCursorMismatch({
|
|
484
|
+
error: input.error,
|
|
485
|
+
authToken: input.authToken,
|
|
486
|
+
apiUrl: input.apiUrl,
|
|
487
|
+
conversationId: input.conversationId,
|
|
488
|
+
runId: input.runId,
|
|
489
|
+
latestEventId: input.latestEventId,
|
|
490
|
+
latestExternalEventSequence: input.latestExternalEventSequence,
|
|
491
|
+
cursorResyncsThisFlush: input.cursorResyncsThisFlush,
|
|
492
|
+
maxCursorResyncsPerFlush: input.maxCursorResyncsPerFlush,
|
|
493
|
+
abortSignal: input.abortSignal,
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
if (cursorRecovery.outcome === "resumed") {
|
|
497
|
+
return {
|
|
498
|
+
outcome: "resumed",
|
|
499
|
+
latestEventId: cursorRecovery.latestEventId,
|
|
500
|
+
latestExternalEventSequence: cursorRecovery.latestExternalEventSequence,
|
|
501
|
+
...(cursorRecovery.run ? { run: cursorRecovery.run } : {}),
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
if (cursorRecovery.outcome === "stopped") {
|
|
506
|
+
return {
|
|
507
|
+
outcome: "stopped",
|
|
508
|
+
latestEventId: cursorRecovery.latestEventId,
|
|
509
|
+
latestExternalEventSequence: cursorRecovery.latestExternalEventSequence,
|
|
510
|
+
disableReason: cursorRecovery.disableReason,
|
|
511
|
+
...(cursorRecovery.run ? { run: cursorRecovery.run } : {}),
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
if (isIgnorableConversationRunAppendError(input.error)) {
|
|
516
|
+
return {
|
|
517
|
+
outcome: "stopped",
|
|
518
|
+
latestEventId: cursorRecovery.latestEventId,
|
|
519
|
+
latestExternalEventSequence: cursorRecovery.latestExternalEventSequence,
|
|
520
|
+
disableReason: "ignorable_append_rejection",
|
|
521
|
+
...(cursorRecovery.run ? { run: cursorRecovery.run } : {}),
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
return {
|
|
526
|
+
outcome: "retry_scheduled",
|
|
527
|
+
latestEventId: cursorRecovery.latestEventId,
|
|
528
|
+
latestExternalEventSequence: cursorRecovery.latestExternalEventSequence,
|
|
529
|
+
errorMessage: input.error instanceof Error ? input.error.message : String(input.error),
|
|
530
|
+
...(cursorRecovery.run ? { run: cursorRecovery.run } : {}),
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
|
|
460
534
|
async function waitForConversationRunPoll(
|
|
461
535
|
ms: number,
|
|
462
536
|
abortSignal?: AbortSignal,
|
package/src/src/agent/index.ts
CHANGED
|
@@ -220,6 +220,7 @@ export {
|
|
|
220
220
|
CompleteConversationRunResponseSchema,
|
|
221
221
|
type ConversationAgentRunUsage,
|
|
222
222
|
type ConversationRunAppendCursorResyncResult,
|
|
223
|
+
type ConversationRunAppendFailureOutcome,
|
|
223
224
|
type ConversationRunAppendRecoveryOutcome,
|
|
224
225
|
type ConversationRunProjection,
|
|
225
226
|
ConversationRunProjectionSchema,
|
|
@@ -236,6 +237,7 @@ export {
|
|
|
236
237
|
isIgnorableConversationRunAppendError,
|
|
237
238
|
monitorConversationRunStatus,
|
|
238
239
|
parseAppendConversationRunEventsErrorBody,
|
|
240
|
+
recoverConversationRunAppendFailure,
|
|
239
241
|
recoverConversationRunCursorMismatch,
|
|
240
242
|
resolveConversationRunTargets,
|
|
241
243
|
resyncConversationRunAppendCursor,
|