effect-agent 0.1.0-beta.110 → 0.1.0-beta.112
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/dist/{DurableAgentRuntime-PyIgNYXF.mjs → DurableAgentRuntime-BIrgxwRl.mjs} +154 -21
- package/dist/DurableAgentRuntime-BIrgxwRl.mjs.map +1 -0
- package/dist/{EventSource-BUYLmL77.d.mts → EventSource-ARs56eBq.d.mts} +3 -3
- package/dist/{PreparedInputAdmission-J3YK6LAm.d.mts → PreparedInputAdmission-_WYg-D0f.d.mts} +4 -4
- package/dist/{Records-4qnRmniE.d.mts → Records-BtxMy8xD.d.mts} +94 -13
- package/dist/{Schedule-C2lH2kxY.d.mts → Schedule-DGPyXBzK.d.mts} +2 -2
- package/dist/{Subscription-pQUv0QD6.d.mts → Subscription-B9VszlF9.d.mts} +3 -3
- package/dist/{SubscriptionInput-DdJOiNMY.d.mts → SubscriptionInput-BJWZqCWP.d.mts} +3 -3
- package/dist/capabilities/Mcp.d.mts +1 -1
- package/dist/capabilities/Mcp.mjs +5 -6
- package/dist/capabilities/Mcp.mjs.map +1 -1
- package/dist/durable/ActivityStore.d.mts +1 -1
- package/dist/durable/Admin.d.mts +1 -1
- package/dist/durable/AgentRegistration.d.mts +1 -1
- package/dist/durable/Certification.d.mts +1 -1
- package/dist/durable/CommittedActivity.d.mts +1 -1
- package/dist/durable/Digest.d.mts +1 -1
- package/dist/durable/DurableAgentRuntime.d.mts +2 -2
- package/dist/durable/DurableAgentRuntime.mjs +2 -2
- package/dist/durable/EventSource.d.mts +1 -1
- package/dist/durable/GitHubWorkflowSource.d.mts +3 -3
- package/dist/durable/MessageDelivery.d.mts +3 -3
- package/dist/durable/MessageDeliveryStoreConformance.d.mts +1 -1
- package/dist/durable/PersistentHistory.d.mts +1 -1
- package/dist/durable/PreparedInputAdmission.d.mts +1 -1
- package/dist/durable/Records.d.mts +1 -1
- package/dist/durable/Recovery.d.mts +1 -1
- package/dist/durable/RunJournal.d.mts +1 -1
- package/dist/durable/Schedule.d.mts +1 -1
- package/dist/durable/ScheduleStoreConformance.d.mts +1 -1
- package/dist/durable/ScheduleTransition.d.mts +1 -1
- package/dist/durable/Scheduling.d.mts +2 -2
- package/dist/durable/SqlStorageV2Upgrade.d.mts +2 -2
- package/dist/durable/SqlSubscriptionStore.d.mts +2 -2
- package/dist/durable/SqlThreadNativeReads.d.mts +1 -1
- package/dist/durable/SubmissionLedger.d.mts +2 -2
- package/dist/durable/SubmissionLedger.mjs +19 -8
- package/dist/durable/SubmissionLedger.mjs.map +1 -1
- package/dist/durable/SubmissionLedgerConformance.d.mts +1 -1
- package/dist/durable/SubmissionLedgerConformance.mjs +2 -1
- package/dist/durable/SubmissionLedgerConformance.mjs.map +1 -1
- package/dist/durable/SubmissionStatus.d.mts +1 -1
- package/dist/durable/Subscription.d.mts +1 -1
- package/dist/durable/SubscriptionInput.d.mts +1 -1
- package/dist/durable/SubscriptionStoreConformance.d.mts +1 -1
- package/dist/durable/SubscriptionTools.d.mts +3 -3
- package/dist/durable/SubscriptionTransition.d.mts +1 -1
- package/dist/durable/Subscriptions.d.mts +5 -5
- package/dist/durable/ThreadContextHistory.d.mts +1 -1
- package/dist/durable/ThreadContextHistoryProjection.d.mts +1 -1
- package/dist/durable/ThreadInvariants.d.mts +1 -1
- package/dist/durable/ThreadProjection.d.mts +1 -1
- package/dist/durable/ThreadProjectionMaintenance.d.mts +1 -1
- package/dist/durable/ThreadStore.d.mts +2 -2
- package/dist/durable/ThreadStore.mjs +16 -2
- package/dist/durable/ThreadStore.mjs.map +1 -1
- package/dist/durable/ThreadStoreConformance.d.mts +1 -1
- package/dist/durable/WorkerHost.d.mts +1 -1
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +1 -1
- package/dist/sandbox/InteractiveBrowser.d.mts +98 -1
- package/dist/sandbox/InteractiveBrowser.mjs +57 -5
- package/dist/sandbox/InteractiveBrowser.mjs.map +1 -1
- package/package.json +1 -1
- package/src/capabilities/Mcp.ts +6 -7
- package/src/durable/DurableAgentRuntime.ts +278 -49
- package/src/durable/SubmissionLedger.ts +22 -9
- package/src/durable/SubmissionLedgerConformance.ts +13 -1
- package/src/durable/ThreadStore.ts +16 -0
- package/src/sandbox/InteractiveBrowser.ts +51 -2
- package/dist/DurableAgentRuntime-PyIgNYXF.mjs.map +0 -1
|
@@ -28,7 +28,7 @@ import { ExplainedEvidence, ExplainedSubmission, ExplainedUnknownCall, Integrity
|
|
|
28
28
|
import { digestJson } from "./durable/Digest.mjs";
|
|
29
29
|
import { a as definitionDigestsEqual, c as resolveWorkerBinding, i as compileRegistrations, l as toolReplayContracts, o as makeLegacyWorkerBinding, s as resolveDefinitionBinding, t as BindingUnavailable } from "./agent-registration-B5CI-Ygk.mjs";
|
|
30
30
|
import { $ as workerOriginRecordId, A as subagentRequestedRecordId, B as toolCallUnknownRecordId, C as runStartedBatchId, D as subagentLineageBatchId, E as subagentJoinedRecordId, F as toolCallPreparedRecordId, G as turnCanonicalBatch, H as toolStepSettledRecordId, I as toolCallResolutionBatchId, J as turnResponseBatch, K as turnIdForRun, L as toolCallResolvedRecordId, M as subagentStartedRecordId, N as toolApprovalDecisionRecordId, O as subagentLineageRecordId, P as toolApprovalRequestRecordId, Q as workerInputRecordId, R as toolCallResultBatchId, S as runIdForSubmission, T as subagentJoinBatchId, U as turnApprovalsBatchId, V as toolStepSettledBatchId, X as turnResultsBatch, a as childIdempotencyKeyFor, b as runDurationBatchId, c as compactionRecordId, d as modelResponseInterruptedBatchId, et as workerReportRecordId, f as modelResponseInterruptedRecordId, g as projectRunJournalStream, i as approvalDecisionBatchId, j as subagentStartedBatchId, k as subagentRequestedBatchId, l as firstWorkerInputRecordId, m as peerMessageRecordId, o as childThreadIdFor, p as modelResponseRecordId, q as turnPreparedBatchId, r as agentUpdateRecordId, s as compactionBatchId, t as RunJournalError, tt as makeJournalMetadata, u as markUnknownBatchId, v as runCompletedRecordId, w as runStartedRecordId, x as runDurationRecordId, y as runCompletionDigest, z as toolCallSettledRecordId } from "./RunJournal-BXrq0VIK.mjs";
|
|
31
|
-
import { FencedAppendRequest, LoadCheckpointRequest, MAX_THREAD_EXPORT_RECORDS, SaveRecoveryCheckpointRequest, ThreadCheckpoint, ThreadExportRequest, ThreadMaterialization, ThreadObservation, ThreadRead, ThreadStore, ThreadStoreError, ThreadTailRequest, getRecord, readWorkerState } from "./durable/ThreadStore.mjs";
|
|
31
|
+
import { FencedAppendRequest, LoadCheckpointRequest, MAX_THREAD_EXPORT_RECORDS, SaveRecoveryCheckpointRequest, ThreadCheckpoint, ThreadExportRequest, ThreadMaterialization, ThreadObservation, ThreadRead, ThreadStore, ThreadStoreDiagnostic, ThreadStoreError, ThreadTailRequest, getRecord, readWorkerState } from "./durable/ThreadStore.mjs";
|
|
32
32
|
import { DurableRuntimeFailpoint } from "./durable/DurableFailpoint.mjs";
|
|
33
33
|
import { ScheduledInputRefused, ScheduledInputRetryable } from "./durable/Schedule.mjs";
|
|
34
34
|
import { PreparedInputAdmission } from "./durable/PreparedInputAdmission.mjs";
|
|
@@ -42,7 +42,7 @@ import { verifyThreadInvariants } from "./durable/ThreadInvariants.mjs";
|
|
|
42
42
|
import { PreparedToolCallEvidence, ToolReconciler } from "./durable/ToolReconciler.mjs";
|
|
43
43
|
import { WakeScheduler } from "./durable/WakeScheduler.mjs";
|
|
44
44
|
import { Prompt } from "effect/unstable/ai";
|
|
45
|
-
import { Cause, Clock, Context, Crypto, DateTime, Deferred, Duration, Effect, Equal, Layer, Option, Ref, Schedule, Schema, Semaphore, Stream } from "effect";
|
|
45
|
+
import { Cause, Clock, Context, Crypto, DateTime, Deferred, Duration, Effect, Equal, Exit, Layer, Option, Ref, Result, Schedule, Schema, Semaphore, Stream } from "effect";
|
|
46
46
|
//#region src/durable/internal/journal-checkpoint.ts
|
|
47
47
|
/** Retired accounting is additive; the latest Tool batch always remains replayable verbatim. */
|
|
48
48
|
var JournalCheckpointSeed = class extends Schema.Class("@effect-agent/thread/internal/JournalCheckpointSeed")({
|
|
@@ -1746,8 +1746,12 @@ var DurableAgentRuntime_exports = /* @__PURE__ */ __exportAll({
|
|
|
1746
1746
|
DurableApprovalResolver: () => DurableApprovalResolver,
|
|
1747
1747
|
DurableRuntimeConfig: () => DurableRuntimeConfig,
|
|
1748
1748
|
Receipt: () => Receipt,
|
|
1749
|
+
RecoveryBlocked: () => RecoveryBlocked,
|
|
1750
|
+
RecoveryFailure: () => RecoveryFailure,
|
|
1749
1751
|
RecoveryReport: () => RecoveryReport,
|
|
1752
|
+
RecoverySweepResult: () => RecoverySweepResult,
|
|
1750
1753
|
childReservationIdFor: () => childReservationIdFor,
|
|
1754
|
+
isolateRecovery: () => isolateRecovery,
|
|
1751
1755
|
recoveryRepairBatchId: () => recoveryRepairBatchId,
|
|
1752
1756
|
recoveryRepairRecordId: () => recoveryRepairRecordId,
|
|
1753
1757
|
threadCreatedBatchId: () => threadCreatedBatchId,
|
|
@@ -1867,6 +1871,114 @@ const threadCreatedRecordId = (threadId) => decodeRecordId(`thread-created:${thr
|
|
|
1867
1871
|
const recoveryRepairBatchId = (submissionId, decisionTag) => decodeBatchId(`repair:${submissionId}:${decisionTag}`);
|
|
1868
1872
|
/** Deterministic record identity of one executed recovery decision's `RepairAnnotated` record. */
|
|
1869
1873
|
const recoveryRepairRecordId = (submissionId, decisionTag) => decodeRecordId(`repair:${submissionId}:${decisionTag}`);
|
|
1874
|
+
const RecoveryCauseTag = Schema.Literals([
|
|
1875
|
+
"AdmissionPolicyError",
|
|
1876
|
+
"DigestError",
|
|
1877
|
+
"LedgerError",
|
|
1878
|
+
"OwnershipLost",
|
|
1879
|
+
"SettlementConflict",
|
|
1880
|
+
"ThreadStoreError",
|
|
1881
|
+
"ThreadNotMaterialized",
|
|
1882
|
+
"AppendConflict",
|
|
1883
|
+
"FenceRejected",
|
|
1884
|
+
"RunJournalError",
|
|
1885
|
+
"DurableRuntimeFailpointError",
|
|
1886
|
+
"SchemaError",
|
|
1887
|
+
"Error",
|
|
1888
|
+
"TypeError",
|
|
1889
|
+
"RangeError",
|
|
1890
|
+
"ReferenceError",
|
|
1891
|
+
"SyntaxError",
|
|
1892
|
+
"URIError",
|
|
1893
|
+
"EvalError",
|
|
1894
|
+
"AggregateError",
|
|
1895
|
+
"ForeignError",
|
|
1896
|
+
"NonErrorCause"
|
|
1897
|
+
]);
|
|
1898
|
+
const isRecoveryCauseTag = Schema.is(RecoveryCauseTag);
|
|
1899
|
+
/** Recovery could not establish execution authority. This is never a Settlement or replay grant. */
|
|
1900
|
+
var RecoveryFailure = class extends Schema.Class("@effect-agent/thread/RecoveryFailure")({
|
|
1901
|
+
phase: Schema.Literals(["history", "recovery"]),
|
|
1902
|
+
reason: Schema.Literals([
|
|
1903
|
+
"failure",
|
|
1904
|
+
"defect",
|
|
1905
|
+
"timeout"
|
|
1906
|
+
]),
|
|
1907
|
+
errorTag: Schema.String.check(Schema.isMaxLength(128)),
|
|
1908
|
+
/** Static operation names only; error messages and payloads are deliberately excluded. */
|
|
1909
|
+
operation: Schema.String.check(Schema.isMaxLength(256)),
|
|
1910
|
+
/** Ordered, bounded classifications. Foreign labels, operations and prose stay private. */
|
|
1911
|
+
causes: Schema.Array(Schema.Struct({ errorTag: RecoveryCauseTag })).check(Schema.isMaxLength(16)),
|
|
1912
|
+
causesTruncated: Schema.optionalKey(Schema.Literal(true)),
|
|
1913
|
+
diagnostic: Schema.optionalKey(ThreadStoreDiagnostic)
|
|
1914
|
+
}) {};
|
|
1915
|
+
const decodeRecoveryCause = Schema.decodeUnknownOption(Schema.Struct({
|
|
1916
|
+
diagnostic: Schema.optionalKey(Schema.Unknown),
|
|
1917
|
+
cause: Schema.optionalKey(Schema.Unknown)
|
|
1918
|
+
}));
|
|
1919
|
+
/** Reuse the bounded foreign-error capture, then retain only content-free causal metadata. */
|
|
1920
|
+
const recoveryFailureDetails = (cause) => {
|
|
1921
|
+
const pending = [capture(cause)];
|
|
1922
|
+
const causes = [];
|
|
1923
|
+
let truncated = false;
|
|
1924
|
+
while (pending.length > 0 && causes.length < 16) {
|
|
1925
|
+
const node = pending.shift();
|
|
1926
|
+
if (node === void 0) break;
|
|
1927
|
+
switch (node._tag) {
|
|
1928
|
+
case "Cause":
|
|
1929
|
+
pending.unshift(...node.reasons.flatMap((reason) => reason._tag === "Fail" ? [reason.error] : reason._tag === "Die" ? [reason.defect] : []));
|
|
1930
|
+
truncated ||= node.truncated === true;
|
|
1931
|
+
break;
|
|
1932
|
+
case "Error": {
|
|
1933
|
+
const tag = node.errorTag ?? node.name;
|
|
1934
|
+
causes.push({ errorTag: isRecoveryCauseTag(tag) ? tag : "ForeignError" });
|
|
1935
|
+
pending.unshift(...node.cause === void 0 ? [] : [node.cause], ...node.reason === void 0 ? [] : [node.reason], ...node.errors ?? []);
|
|
1936
|
+
truncated ||= node.truncated === true;
|
|
1937
|
+
break;
|
|
1938
|
+
}
|
|
1939
|
+
case "Omitted":
|
|
1940
|
+
truncated = true;
|
|
1941
|
+
break;
|
|
1942
|
+
case "Value": causes.push({ errorTag: "NonErrorCause" });
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
let nested = Option.getOrUndefined(Cause.findErrorOption(cause));
|
|
1946
|
+
let diagnostic;
|
|
1947
|
+
for (let depth = 0; depth < 16 && nested !== void 0; depth++) {
|
|
1948
|
+
const decoded = decodeRecoveryCause(nested);
|
|
1949
|
+
if (Option.isNone(decoded)) break;
|
|
1950
|
+
if (decoded.value.diagnostic instanceof ThreadStoreDiagnostic) {
|
|
1951
|
+
diagnostic = decoded.value.diagnostic;
|
|
1952
|
+
break;
|
|
1953
|
+
}
|
|
1954
|
+
nested = decoded.value.cause;
|
|
1955
|
+
}
|
|
1956
|
+
return {
|
|
1957
|
+
causes,
|
|
1958
|
+
...truncated || pending.length > 0 ? { causesTruncated: true } : {},
|
|
1959
|
+
...diagnostic === void 0 ? {} : { diagnostic }
|
|
1960
|
+
};
|
|
1961
|
+
};
|
|
1962
|
+
/** @internal One bounded failure boundary for execution history and host recovery control reads. */
|
|
1963
|
+
const isolateRecovery = Effect.fnUntraced(function* (body, options) {
|
|
1964
|
+
const outcome = yield* body.pipe(Effect.scoped, Effect.timeoutOption(options.timeout), Effect.exit);
|
|
1965
|
+
if (Exit.isSuccess(outcome) && Option.isSome(outcome.value)) return Result.succeed(outcome.value.value);
|
|
1966
|
+
if (Exit.isFailure(outcome) && (Cause.hasInterrupts(outcome.cause) || outcome.cause.reasons.some((reason) => reason._tag === "Fail" && reason.error._tag === "DurableRuntimeFailpointError"))) return yield* Effect.failCause(outcome.cause);
|
|
1967
|
+
const error = Exit.isFailure(outcome) ? Cause.findErrorOption(outcome.cause) : Option.none();
|
|
1968
|
+
const phase = options.phase();
|
|
1969
|
+
return Result.fail(RecoveryFailure.make({
|
|
1970
|
+
phase,
|
|
1971
|
+
reason: Exit.isSuccess(outcome) ? "timeout" : Cause.hasDies(outcome.cause) ? "defect" : "failure",
|
|
1972
|
+
errorTag: Option.isSome(error) ? error.value._tag : Exit.isSuccess(outcome) ? "RecoveryTimeout" : "Defect",
|
|
1973
|
+
operation: Option.isSome(error) && "operation" in error.value ? error.value.operation.slice(0, 256) : options.operation ?? (phase === "history" ? "read recovery history" : "recover submission"),
|
|
1974
|
+
...Exit.isFailure(outcome) ? recoveryFailureDetails(outcome.cause) : { causes: [] }
|
|
1975
|
+
}));
|
|
1976
|
+
});
|
|
1977
|
+
/** One failed Thread remains pending; the host must not claim it before recovery succeeds. */
|
|
1978
|
+
var RecoveryBlocked = class extends Schema.TaggedError()("RecoveryBlocked", {
|
|
1979
|
+
threadId: ThreadId,
|
|
1980
|
+
failure: RecoveryFailure
|
|
1981
|
+
}) {};
|
|
1870
1982
|
/** One executed (or deliberately deferred) recovery decision (durability §14, DUR-013). */
|
|
1871
1983
|
var RecoveryReport = class extends Schema.Class("@effect-agent/thread/RecoveryReport")({
|
|
1872
1984
|
submissionId: SubmissionId,
|
|
@@ -1885,6 +1997,12 @@ var RecoveryReport = class extends Schema.Class("@effect-agent/thread/RecoveryRe
|
|
|
1885
1997
|
"unknown"
|
|
1886
1998
|
])
|
|
1887
1999
|
}) {};
|
|
2000
|
+
/** Submission decisions and operational faults have different ownership and settlement semantics. */
|
|
2001
|
+
var RecoverySweepResult = class extends Schema.Class("RecoverySweepResult")({
|
|
2002
|
+
reports: Schema.Array(RecoveryReport),
|
|
2003
|
+
/** Exactly one fault per failed Thread, regardless of its queued Submission count. */
|
|
2004
|
+
blocked: Schema.Array(RecoveryBlocked)
|
|
2005
|
+
}) {};
|
|
1888
2006
|
/**
|
|
1889
2007
|
* Optional policy-auto approval delegate consulted by the durable approval hook (plan §2.6 step
|
|
1890
2008
|
* 2) AFTER the recorded-decision lookup misses. An immediate `approved`/`denied` answer becomes
|
|
@@ -1904,6 +2022,7 @@ var DurableRuntimeConfig = class DurableRuntimeConfig extends Context.Service()(
|
|
|
1904
2022
|
settlementPollInterval: options.settlementPollInterval ?? Duration.millis(500),
|
|
1905
2023
|
leaseRenewalInterval: options.leaseRenewalInterval ?? Duration.seconds(10),
|
|
1906
2024
|
abortPollInterval: options.abortPollInterval ?? Duration.millis(500),
|
|
2025
|
+
recoveryTimeout: options.recoveryTimeout ?? Duration.seconds(30),
|
|
1907
2026
|
...options.estimateCostMicrousd === void 0 ? {} : { estimateCostMicrousd: options.estimateCostMicrousd }
|
|
1908
2027
|
};
|
|
1909
2028
|
}
|
|
@@ -6103,31 +6222,44 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (bindings) {
|
|
|
6103
6222
|
if (history.materialized && found.value.workerAdmission?.origin.reporting?.mode === "standard") yield* updateRuntime.repair(found.value.threadId);
|
|
6104
6223
|
return yield* recoverSnapshot(found.value, history);
|
|
6105
6224
|
});
|
|
6106
|
-
const
|
|
6225
|
+
const runRecovery = Effect.fn("DurableAgentRuntime.runRecovery")(function* (options) {
|
|
6107
6226
|
const nonterminal = yield* Stream.runCollect(ledger.scanNonterminal);
|
|
6108
6227
|
const reports = [];
|
|
6228
|
+
const blocked = [];
|
|
6109
6229
|
let index = 0;
|
|
6110
6230
|
while (index < nonterminal.length) {
|
|
6111
6231
|
const first = nonterminal[index];
|
|
6112
6232
|
if (first === void 0) break;
|
|
6113
6233
|
const submissionIds = [];
|
|
6114
|
-
let hasStandardReporting = false;
|
|
6115
6234
|
for (let offset = index; offset < nonterminal.length; offset += 1) {
|
|
6116
6235
|
const entry = nonterminal[offset];
|
|
6117
6236
|
if (entry === void 0 || entry.threadId !== first.threadId) break;
|
|
6118
6237
|
submissionIds.push(entry.submissionId);
|
|
6119
|
-
hasStandardReporting ||= entry.workerAdmission?.origin.reporting?.mode === "standard";
|
|
6120
|
-
}
|
|
6121
|
-
const history = yield* readRecoveryHistory(first.threadId, submissionIds);
|
|
6122
|
-
if (history.materialized && hasStandardReporting) yield* updateRuntime.repair(first.threadId);
|
|
6123
|
-
while (index < nonterminal.length) {
|
|
6124
|
-
const submission = nonterminal[index];
|
|
6125
|
-
if (submission === void 0 || submission.threadId !== first.threadId) break;
|
|
6126
|
-
reports.push(yield* recoverSnapshot(submission, history));
|
|
6127
|
-
index += 1;
|
|
6128
6238
|
}
|
|
6239
|
+
index += submissionIds.length;
|
|
6240
|
+
if (options?.threadId !== void 0 && options.threadId !== first.threadId) continue;
|
|
6241
|
+
let phase = "recovery";
|
|
6242
|
+
const outcome = yield* isolateRecovery(Effect.gen(function* () {
|
|
6243
|
+
const group = yield* Effect.forEach(submissionIds, (submissionId) => lookupKnownSubmission("recover submission", submissionId));
|
|
6244
|
+
phase = "history";
|
|
6245
|
+
const history = yield* readRecoveryHistory(first.threadId, submissionIds);
|
|
6246
|
+
phase = "recovery";
|
|
6247
|
+
if (history.materialized && group.some((row) => row.workerAdmission?.origin.reporting?.mode === "standard")) yield* updateRuntime.repair(first.threadId);
|
|
6248
|
+
return yield* Effect.forEach(group, (submission) => recoverSnapshot(submission, history));
|
|
6249
|
+
}), {
|
|
6250
|
+
timeout: config.recoveryTimeout,
|
|
6251
|
+
phase: () => phase
|
|
6252
|
+
});
|
|
6253
|
+
if (Result.isSuccess(outcome)) reports.push(...outcome.success);
|
|
6254
|
+
else blocked.push(RecoveryBlocked.make({
|
|
6255
|
+
threadId: first.threadId,
|
|
6256
|
+
failure: outcome.failure
|
|
6257
|
+
}));
|
|
6129
6258
|
}
|
|
6130
|
-
return
|
|
6259
|
+
return RecoverySweepResult.make({
|
|
6260
|
+
reports,
|
|
6261
|
+
blocked
|
|
6262
|
+
});
|
|
6131
6263
|
});
|
|
6132
6264
|
const submit = Effect.fn("DurableAgentRuntime.submit")(function* (agent, input, options) {
|
|
6133
6265
|
const encodedInput = yield* Schema.encodeEffect(agent.definition.input)(input).pipe(Effect.mapError((cause) => AgentInputError.make({ message: `Unable to encode Agent input: ${cause.message}` })));
|
|
@@ -6436,7 +6568,7 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (bindings) {
|
|
|
6436
6568
|
const explanations = [];
|
|
6437
6569
|
for (const submission of nonterminal) {
|
|
6438
6570
|
if (submission.threadId !== threadId) continue;
|
|
6439
|
-
explanations.push(yield* explainSubmission(submission));
|
|
6571
|
+
explanations.push(yield* explainSubmission(yield* lookupKnownSubmission("explain Thread", submission.submissionId)));
|
|
6440
6572
|
}
|
|
6441
6573
|
return explanations;
|
|
6442
6574
|
});
|
|
@@ -6448,8 +6580,8 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (bindings) {
|
|
|
6448
6580
|
const exported = yield* store.export(ThreadExportRequest.make({ threadId }));
|
|
6449
6581
|
const rows = /* @__PURE__ */ new Map();
|
|
6450
6582
|
const nonterminal = yield* Stream.runCollect(ledger.scanNonterminal);
|
|
6451
|
-
for (const submission of nonterminal) if (submission.threadId === threadId) rows.set(submission.submissionId, submission);
|
|
6452
6583
|
const named = /* @__PURE__ */ new Set();
|
|
6584
|
+
for (const submission of nonterminal) if (submission.threadId === threadId) named.add(submission.submissionId);
|
|
6453
6585
|
for (const envelope of exported.records) {
|
|
6454
6586
|
const payload = envelope.record.payload;
|
|
6455
6587
|
if (payload._tag === "UserInputRecorded" || payload._tag === "SubmissionSettled" || payload._tag === "AbortRequested") {
|
|
@@ -6564,8 +6696,9 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (bindings) {
|
|
|
6564
6696
|
const nowMillis = yield* Clock.currentTimeMillis;
|
|
6565
6697
|
const generatedAt = yield* nowUtc;
|
|
6566
6698
|
const entries = [];
|
|
6567
|
-
for (const
|
|
6568
|
-
const snapshot = yield* ledger.loadRecoverySnapshot(RecoverySnapshotRequest.make({ submissionId:
|
|
6699
|
+
for (const entry of nonterminal) {
|
|
6700
|
+
const snapshot = yield* ledger.loadRecoverySnapshot(RecoverySnapshotRequest.make({ submissionId: entry.submissionId }));
|
|
6701
|
+
const submission = snapshot.submission;
|
|
6569
6702
|
let blockedOn;
|
|
6570
6703
|
let since = submission.readyAt ?? submission.createdAt;
|
|
6571
6704
|
switch (submission.state) {
|
|
@@ -6685,7 +6818,7 @@ const make = Effect.fn("DurableAgentRuntime.make")(function* (bindings) {
|
|
|
6685
6818
|
processThreadHead: processThreadHeadImpl,
|
|
6686
6819
|
runWorker: runWorkerImpl,
|
|
6687
6820
|
runResolvedWorker: runResolvedWorkerImpl,
|
|
6688
|
-
runRecovery
|
|
6821
|
+
runRecovery,
|
|
6689
6822
|
recoverSubmission
|
|
6690
6823
|
});
|
|
6691
6824
|
});
|
|
@@ -6767,6 +6900,6 @@ var DurableAgentRuntime = class DurableAgentRuntime extends Context.Service()("@
|
|
|
6767
6900
|
static layer = DurableAgentRuntime.layerWithServices.pipe(Layer.provide([RunContextPreparationPassthrough, RunToolAuthorization.allowAll]));
|
|
6768
6901
|
};
|
|
6769
6902
|
//#endregion
|
|
6770
|
-
export {
|
|
6903
|
+
export { RecoveryBlocked as a, RecoverySweepResult as c, recoveryRepairBatchId as d, recoveryRepairRecordId as f, DurableRuntimeConfig as i, childReservationIdFor as l, threadCreatedRecordId as m, DurableAgentRuntime_exports as n, RecoveryFailure as o, threadCreatedBatchId as p, DurableApprovalResolver as r, RecoveryReport as s, DurableAgentRuntime as t, isolateRecovery as u };
|
|
6771
6904
|
|
|
6772
|
-
//# sourceMappingURL=DurableAgentRuntime-
|
|
6905
|
+
//# sourceMappingURL=DurableAgentRuntime-BIrgxwRl.mjs.map
|