@usine/durable 0.0.0-stage → 0.1.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.
- package/LICENSE +21 -0
- package/README.md +81 -2
- package/dist/attempt/documents.d.ts +86 -0
- package/dist/attempt/documents.d.ts.map +1 -0
- package/dist/attempt/documents.js +30 -0
- package/dist/attempt/documents.js.map +1 -0
- package/dist/attempt/events.d.ts +22 -0
- package/dist/attempt/events.d.ts.map +1 -0
- package/dist/attempt/events.js +110 -0
- package/dist/attempt/events.js.map +1 -0
- package/dist/attempt/extension.d.ts +48 -0
- package/dist/attempt/extension.d.ts.map +1 -0
- package/dist/attempt/extension.js +34 -0
- package/dist/attempt/extension.js.map +1 -0
- package/dist/attempt/hubs.d.ts +117 -0
- package/dist/attempt/hubs.d.ts.map +1 -0
- package/dist/attempt/hubs.js +137 -0
- package/dist/attempt/hubs.js.map +1 -0
- package/dist/attempt/outcome.d.ts +22 -0
- package/dist/attempt/outcome.d.ts.map +1 -0
- package/dist/attempt/outcome.js +84 -0
- package/dist/attempt/outcome.js.map +1 -0
- package/dist/attempt/parent.d.ts +27 -0
- package/dist/attempt/parent.d.ts.map +1 -0
- package/dist/attempt/parent.js +109 -0
- package/dist/attempt/parent.js.map +1 -0
- package/dist/attempt/relay.d.ts +41 -0
- package/dist/attempt/relay.d.ts.map +1 -0
- package/dist/attempt/relay.js +457 -0
- package/dist/attempt/relay.js.map +1 -0
- package/dist/attempt/repair.d.ts +8 -0
- package/dist/attempt/repair.d.ts.map +1 -0
- package/dist/attempt/repair.js +130 -0
- package/dist/attempt/repair.js.map +1 -0
- package/dist/attempt/request.d.ts +18 -0
- package/dist/attempt/request.d.ts.map +1 -0
- package/dist/attempt/request.js +24 -0
- package/dist/attempt/request.js.map +1 -0
- package/dist/attempt/runtime.d.ts +10 -0
- package/dist/attempt/runtime.d.ts.map +1 -0
- package/dist/attempt/runtime.js +422 -0
- package/dist/attempt/runtime.js.map +1 -0
- package/dist/attempt/services.d.ts +15 -0
- package/dist/attempt/services.d.ts.map +1 -0
- package/dist/attempt/services.js +2 -0
- package/dist/attempt/services.js.map +1 -0
- package/dist/attempt/subagent.d.ts +17 -0
- package/dist/attempt/subagent.d.ts.map +1 -0
- package/dist/attempt/subagent.js +203 -0
- package/dist/attempt/subagent.js.map +1 -0
- package/dist/attempt/task.d.ts +61 -0
- package/dist/attempt/task.d.ts.map +1 -0
- package/dist/attempt/task.js +302 -0
- package/dist/attempt/task.js.map +1 -0
- package/dist/attempt/watch.d.ts +8 -0
- package/dist/attempt/watch.d.ts.map +1 -0
- package/dist/attempt/watch.js +25 -0
- package/dist/attempt/watch.js.map +1 -0
- package/dist/attempt-runtime.d.ts +123 -0
- package/dist/attempt-runtime.d.ts.map +1 -0
- package/dist/attempt-runtime.js +73 -0
- package/dist/attempt-runtime.js.map +1 -0
- package/dist/backup.d.ts +26 -0
- package/dist/backup.d.ts.map +1 -0
- package/dist/backup.js +100 -0
- package/dist/backup.js.map +1 -0
- package/dist/harness.d.ts +87 -0
- package/dist/harness.d.ts.map +1 -0
- package/dist/harness.js +271 -0
- package/dist/harness.js.map +1 -0
- package/dist/live.d.ts +15 -0
- package/dist/live.d.ts.map +1 -0
- package/dist/live.js +51 -0
- package/dist/live.js.map +1 -0
- package/dist/storage-path.d.ts +4 -0
- package/dist/storage-path.d.ts.map +1 -0
- package/dist/storage-path.js +2 -0
- package/dist/storage-path.js.map +1 -0
- package/dist/testing.d.ts +111 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +303 -0
- package/dist/testing.js.map +1 -0
- package/package.json +72 -3
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { Deferred, Effect, Option, Queue, Semaphore } from "effect";
|
|
2
|
+
import { ATTEMPT_RECORD_KIND } from "./documents.js";
|
|
3
|
+
/**
|
|
4
|
+
* Returns the notices to buffer after `notice`: the latest one, preceded by the last
|
|
5
|
+
* `WorkerUnresponsive` if the latest is a `WorkerResponsive`.
|
|
6
|
+
*/
|
|
7
|
+
export const keepNotice = (kept, notice) => {
|
|
8
|
+
const previous = kept.at(-1);
|
|
9
|
+
return notice._tag === "WorkerResponsive" && previous?._tag === "WorkerUnresponsive"
|
|
10
|
+
? [previous, notice]
|
|
11
|
+
: [notice];
|
|
12
|
+
};
|
|
13
|
+
export const attemptHubs = Effect.gen(function* () {
|
|
14
|
+
const creation = yield* Semaphore.make(1);
|
|
15
|
+
const byAttempt = new Map();
|
|
16
|
+
const byTask = new Map();
|
|
17
|
+
const byParent = new Map();
|
|
18
|
+
/** The Worker notices for Attempts without a hub. */
|
|
19
|
+
const early = new Map();
|
|
20
|
+
/**
|
|
21
|
+
* The Deferreds that `attached` waits on for Attempts without a hub. A new hub uses this
|
|
22
|
+
* Deferred.
|
|
23
|
+
*/
|
|
24
|
+
const awaited = new Map();
|
|
25
|
+
const bindParent = (hub, parent) => {
|
|
26
|
+
if (Option.isSome(hub.parent))
|
|
27
|
+
return;
|
|
28
|
+
hub.parent = Option.some(parent);
|
|
29
|
+
byParent.set(parent, hub);
|
|
30
|
+
};
|
|
31
|
+
const wake = (hub) => Queue.offerUnsafe(hub.queue, { _tag: "Wake" });
|
|
32
|
+
const hub = (attemptId, taskId) => creation.withPermits(1)(Effect.gen(function* () {
|
|
33
|
+
const existing = byAttempt.get(attemptId);
|
|
34
|
+
if (existing !== undefined)
|
|
35
|
+
return existing;
|
|
36
|
+
const queue = yield* Queue.unbounded();
|
|
37
|
+
const emission = yield* Semaphore.make(1);
|
|
38
|
+
const routing = yield* Semaphore.make(1);
|
|
39
|
+
const fresh = yield* Deferred.make();
|
|
40
|
+
// No yield until the hub is registered, so a concurrent `notice` or `attached` sees either
|
|
41
|
+
// the pre-hub buffers or the registered hub.
|
|
42
|
+
const attached = awaited.get(attemptId) ?? fresh;
|
|
43
|
+
const created = {
|
|
44
|
+
attemptId,
|
|
45
|
+
taskId,
|
|
46
|
+
queue,
|
|
47
|
+
emission,
|
|
48
|
+
routing,
|
|
49
|
+
children: new Map(),
|
|
50
|
+
childInputs: new Set(),
|
|
51
|
+
parent: Option.none(),
|
|
52
|
+
channel: Option.none(),
|
|
53
|
+
early: early.get(attemptId) ?? [],
|
|
54
|
+
attached,
|
|
55
|
+
};
|
|
56
|
+
early.delete(attemptId);
|
|
57
|
+
awaited.delete(attemptId);
|
|
58
|
+
byAttempt.set(attemptId, created);
|
|
59
|
+
byTask.set(taskId, created);
|
|
60
|
+
yield* Effect.logDebug("Tracking the Attempt in this process", {
|
|
61
|
+
attemptId,
|
|
62
|
+
taskId,
|
|
63
|
+
earlyNotices: created.early.map(({ _tag }) => _tag),
|
|
64
|
+
awaitedAttachment: attached !== fresh,
|
|
65
|
+
});
|
|
66
|
+
return created;
|
|
67
|
+
}));
|
|
68
|
+
const listener = {
|
|
69
|
+
onCommit: (publication) => {
|
|
70
|
+
for (const change of publication.changes) {
|
|
71
|
+
if (change.type === "task") {
|
|
72
|
+
const target = byTask.get(change.value.id);
|
|
73
|
+
if (target !== undefined)
|
|
74
|
+
wake(target);
|
|
75
|
+
}
|
|
76
|
+
else if (change.type === "document" &&
|
|
77
|
+
change.record.kind === ATTEMPT_RECORD_KIND &&
|
|
78
|
+
change.record.key !== undefined &&
|
|
79
|
+
change.value !== null) {
|
|
80
|
+
const target = byAttempt.get(change.record.key);
|
|
81
|
+
// SAFETY: documents of this kind are only written through AttemptRecordDoc.
|
|
82
|
+
const record = change.value;
|
|
83
|
+
if (target !== undefined &&
|
|
84
|
+
Option.isNone(target.parent) &&
|
|
85
|
+
record.parentConversation !== null) {
|
|
86
|
+
bindParent(target, record.parentConversation);
|
|
87
|
+
wake(target);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
for (const change of publication.changes) {
|
|
92
|
+
if (change.type !== "entry")
|
|
93
|
+
continue;
|
|
94
|
+
const target = byParent.get(change.value.conversationId);
|
|
95
|
+
if (target !== undefined) {
|
|
96
|
+
Queue.offerUnsafe(target.queue, { _tag: "Entry", entry: change.value.id });
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
onReopen: () => {
|
|
101
|
+
for (const target of byAttempt.values())
|
|
102
|
+
wake(target);
|
|
103
|
+
},
|
|
104
|
+
onStop: () => {
|
|
105
|
+
for (const target of byAttempt.values())
|
|
106
|
+
wake(target);
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
return {
|
|
110
|
+
hub,
|
|
111
|
+
find: (attemptId) => Option.fromNullishOr(byAttempt.get(attemptId)),
|
|
112
|
+
bindParent,
|
|
113
|
+
event: (target, event) => Queue.offer(target.queue, { _tag: "Event", event }).pipe(Effect.asVoid),
|
|
114
|
+
notice: (attemptId, notice) => Effect.sync(() => {
|
|
115
|
+
const target = byAttempt.get(attemptId);
|
|
116
|
+
if (target !== undefined) {
|
|
117
|
+
Queue.offerUnsafe(target.queue, { _tag: "Notice", notice });
|
|
118
|
+
return { _tag: "Queued" };
|
|
119
|
+
}
|
|
120
|
+
const kept = keepNotice(early.get(attemptId) ?? [], notice);
|
|
121
|
+
early.set(attemptId, kept);
|
|
122
|
+
return { _tag: "Kept", kept };
|
|
123
|
+
}),
|
|
124
|
+
delivery: (target, delivery) => Queue.offer(target.queue, delivery).pipe(Effect.asVoid),
|
|
125
|
+
// Read `attached` at call time: `relayAttempt` replaces it when the channel detaches.
|
|
126
|
+
attached: (attemptId) => Effect.suspend(() => {
|
|
127
|
+
const target = byAttempt.get(attemptId);
|
|
128
|
+
if (target !== undefined)
|
|
129
|
+
return Deferred.await(target.attached);
|
|
130
|
+
const kept = awaited.get(attemptId) ?? Deferred.makeUnsafe();
|
|
131
|
+
awaited.set(attemptId, kept);
|
|
132
|
+
return Deferred.await(kept);
|
|
133
|
+
}).pipe(Effect.asVoid),
|
|
134
|
+
listener,
|
|
135
|
+
};
|
|
136
|
+
});
|
|
137
|
+
//# sourceMappingURL=hubs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hub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IAAI,QAAQ,CAAC,UAAU,EAAkB,CAAC;YAC7E,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;YAC7B,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QACxB,QAAQ;KACa,CAAC;AAC1B,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { JsonValue } from "@earendil-works/chord";
|
|
2
|
+
import type { NextTaskState, TaskRecord } from "@earendil-works/pi-durable";
|
|
3
|
+
import { AttemptFailure } from "@usine/core/attempt/failure";
|
|
4
|
+
import { StepResult } from "@usine/core/step/result";
|
|
5
|
+
import { Option, Result } from "effect";
|
|
6
|
+
import { AttemptReport, type FinishedAttempt } from "../attempt-runtime.ts";
|
|
7
|
+
import type { AttemptRecord, AttemptResult } from "./documents.ts";
|
|
8
|
+
export type Settled = Result.Result<AttemptReport, AttemptFailure>;
|
|
9
|
+
/** Returns the terminal task state for `failure`. */
|
|
10
|
+
export declare const failedOutcome: (failure: AttemptFailure) => NextTaskState<never, AttemptResult>;
|
|
11
|
+
/** Returns the terminal task state for a parent that finished with `message`. */
|
|
12
|
+
export declare const completedOutcome: (message: string, answeredOperator: boolean) => NextTaskState<never, AttemptResult>;
|
|
13
|
+
/** Returns the report or failure recorded as the task's outcome. */
|
|
14
|
+
export declare const settledOf: (task: TaskRecord<JsonValue, JsonValue, unknown>) => Settled;
|
|
15
|
+
/** Encodes a harvested result for `AttemptRecord.result`. */
|
|
16
|
+
export declare const encodeResult: (input: StepResult, options?: import("effect/SchemaAST").ParseOptions) => string;
|
|
17
|
+
/**
|
|
18
|
+
* Returns the final state of a finished Attempt. Returns `None` before the terminal envelope is
|
|
19
|
+
* relayed or for a canceled task; a stored result that doesn't decode counts as absent.
|
|
20
|
+
*/
|
|
21
|
+
export declare const finishedOf: (record: Readonly<AttemptRecord>, task: TaskRecord<JsonValue, JsonValue, unknown>) => Option.Option<FinishedAttempt>;
|
|
22
|
+
//# sourceMappingURL=outcome.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outcome.d.ts","sourceRoot":"","sources":["../../src/attempt/outcome.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAEL,cAAc,EAGf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAS,MAAM,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AACvD,OAAO,EACL,aAAa,EACb,KAAK,eAAe,EAIrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEnE,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;AAyBnE,qDAAqD;AACrD,eAAO,MAAM,aAAa,YAAa,cAAc,KAAG,aAAa,CAAC,KAAK,EAAE,aAAa,CAMxF,CAAC;AAEH,iFAAiF;AACjF,eAAO,MAAM,gBAAgB,YAClB,MAAM,oBACG,OAAO,KACxB,aAAa,CAAC,KAAK,EAAE,aAAa,CAGnC,CAAC;AAEH,oEAAoE;AACpE,eAAO,MAAM,SAAS,SAAU,UAAU,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,KAAG,OAgD3E,CAAC;AAIF,6DAA6D;AAC7D,eAAO,MAAM,YAAY,kFAAgC,CAAC;AAG1D;;;GAGG;AACH,eAAO,MAAM,UAAU,WACb,QAAQ,CAAC,aAAa,CAAC,QACzB,UAAU,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,KAC9C,MAAM,CAAC,MAAM,CAAC,eAAe,CAY/B,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { AgentFailure, AttemptFailure, DefectFailure, InfraFailure, } from "@usine/core/attempt/failure";
|
|
2
|
+
import { StepResult } from "@usine/core/step/result";
|
|
3
|
+
import { Match, Option, Result, Schema } from "effect";
|
|
4
|
+
import { AttemptReport, ParentFailed, ParentReported, ResultRecorded, } from "../attempt-runtime.js";
|
|
5
|
+
const failureJson = Schema.fromJsonString(AttemptFailure);
|
|
6
|
+
const encodeFailure = Schema.encodeSync(failureJson);
|
|
7
|
+
const decodeFailure = Schema.decodeUnknownOption(failureJson);
|
|
8
|
+
const decodeResult = Schema.decodeUnknownOption(Schema.Struct({
|
|
9
|
+
message: Schema.NonEmptyString,
|
|
10
|
+
answeredOperator: Schema.optionalKey(Schema.Boolean),
|
|
11
|
+
}));
|
|
12
|
+
const failureMessage = (failure) => Match.valueTags(failure, {
|
|
13
|
+
InfraFailure: ({ message }) => message,
|
|
14
|
+
DefectFailure: ({ message }) => message,
|
|
15
|
+
AgentFailure: ({ message }) => message,
|
|
16
|
+
BlockedFailure: ({ message }) => message,
|
|
17
|
+
QuestionFailure: ({ question }) => question,
|
|
18
|
+
RunawayFailure: ({ ceiling }) => `The runaway guard stopped the attempt at its ${ceiling} ceiling`,
|
|
19
|
+
ChildSessionBudgetFailure: ({ attemptedChildren, maxChildren }) => `The attempt requested child ${attemptedChildren}, over its budget of ${maxChildren} children`,
|
|
20
|
+
}) || failure._tag;
|
|
21
|
+
/** Returns the terminal task state for `failure`. */
|
|
22
|
+
export const failedOutcome = (failure) => ({
|
|
23
|
+
status: "terminal",
|
|
24
|
+
outcome: {
|
|
25
|
+
status: "failed",
|
|
26
|
+
error: { message: failureMessage(failure), detail: encodeFailure(failure) },
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
/** Returns the terminal task state for a parent that finished with `message`. */
|
|
30
|
+
export const completedOutcome = (message, answeredOperator) => ({
|
|
31
|
+
status: "terminal",
|
|
32
|
+
outcome: { status: "completed", result: { message, answeredOperator } },
|
|
33
|
+
});
|
|
34
|
+
/** Returns the report or failure recorded as the task's outcome. */
|
|
35
|
+
export const settledOf = (task) => {
|
|
36
|
+
const outcome = task.state.outcome;
|
|
37
|
+
if (outcome === undefined) {
|
|
38
|
+
return Result.fail(new InfraFailure({ message: "The attempt task is still running", cause: task.state.status }));
|
|
39
|
+
}
|
|
40
|
+
switch (outcome.status) {
|
|
41
|
+
case "completed":
|
|
42
|
+
return Option.match(decodeResult(outcome.result), {
|
|
43
|
+
onNone: () => Result.fail(new DefectFailure({
|
|
44
|
+
message: "The attempt task completed without a final message",
|
|
45
|
+
cause: outcome.result,
|
|
46
|
+
})),
|
|
47
|
+
onSome: ({ message, answeredOperator }) => Result.succeed(new AttemptReport({ message, answeredOperator: answeredOperator ?? false })),
|
|
48
|
+
});
|
|
49
|
+
case "failed":
|
|
50
|
+
return Result.fail(Option.getOrElse(decodeFailure(outcome.error.detail), () => new InfraFailure({ message: outcome.error.message, cause: outcome.error })));
|
|
51
|
+
case "aborted":
|
|
52
|
+
return Result.fail(new AgentFailure({ message: "The attempt was canceled, and its parent stopped" }));
|
|
53
|
+
case "faulted":
|
|
54
|
+
return Result.fail(new DefectFailure({
|
|
55
|
+
message: `The attempt task faulted: ${outcome.error.message}`,
|
|
56
|
+
cause: outcome.error,
|
|
57
|
+
}));
|
|
58
|
+
case "orphaned":
|
|
59
|
+
return Result.fail(new InfraFailure({
|
|
60
|
+
message: `The attempt task can no longer run: ${outcome.reason}`,
|
|
61
|
+
cause: outcome.reason,
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const resultJson = Schema.fromJsonString(StepResult);
|
|
66
|
+
/** Encodes a harvested result for `AttemptRecord.result`. */
|
|
67
|
+
export const encodeResult = Schema.encodeSync(resultJson);
|
|
68
|
+
const decodeHarvested = Schema.decodeUnknownOption(resultJson);
|
|
69
|
+
/**
|
|
70
|
+
* Returns the final state of a finished Attempt. Returns `None` before the terminal envelope is
|
|
71
|
+
* relayed or for a canceled task; a stored result that doesn't decode counts as absent.
|
|
72
|
+
*/
|
|
73
|
+
export const finishedOf = (record, task) => {
|
|
74
|
+
if (!record.terminalRelayed || task.state.outcome?.status === "aborted")
|
|
75
|
+
return Option.none();
|
|
76
|
+
return Option.some(Result.match(settledOf(task), {
|
|
77
|
+
onFailure: (failure) => new ParentFailed({ failure }),
|
|
78
|
+
onSuccess: (report) => Option.match(Option.flatMap(Option.fromUndefinedOr(record.result), decodeHarvested), {
|
|
79
|
+
onNone: () => new ParentReported({ report }),
|
|
80
|
+
onSome: (result) => new ResultRecorded({ result }),
|
|
81
|
+
}),
|
|
82
|
+
}));
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=outcome.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outcome.js","sourceRoot":"","sources":["../../src/attempt/outcome.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EACZ,cAAc,EACd,aAAa,EACb,YAAY,GACb,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACvD,OAAO,EACL,aAAa,EAEb,YAAY,EACZ,cAAc,EACd,cAAc,GACf,MAAM,uBAAuB,CAAC;AAK/B,MAAM,WAAW,GAAG,MAAM,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;AAC1D,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;AACrD,MAAM,aAAa,GAAG,MAAM,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;AAC9D,MAAM,YAAY,GAAG,MAAM,CAAC,mBAAmB,CAC7C,MAAM,CAAC,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC,cAAc;IAC9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e,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC,EAAE;YACnF,MAAM,EAAE,GAAoB,EAAE,CAAC,IAAI,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;YAC7D,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;SACnD,CAAC;KACL,CAAC,CACH,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type Models } from "@earendil-works/pi-ai";
|
|
2
|
+
import type { ModelRef } from "@earendil-works/pi-durable";
|
|
3
|
+
import { type PiPool } from "@usine/agents/pi/authentication";
|
|
4
|
+
import { PoolUnavailableError, SessionOperationError, UnknownModelError, UnsupportedEffortError } from "@usine/agents/runtime";
|
|
5
|
+
import { ModelId } from "@usine/core/agent/brain";
|
|
6
|
+
import { AgentSessionId, ParentSession } from "@usine/core/agent/session";
|
|
7
|
+
import type { AttemptId } from "@usine/core/attempt";
|
|
8
|
+
import type { RunSpec } from "@usine/core/attempt/channel";
|
|
9
|
+
import { Effect, Option } from "effect";
|
|
10
|
+
/** Returns the session ID of the Attempt's Pi parent, the default target of operator input. */
|
|
11
|
+
export declare const parentSessionId: (attemptId: AttemptId) => AgentSessionId;
|
|
12
|
+
/** Returns the parent session with the rostered Agent and the resolved model. */
|
|
13
|
+
export declare const parentSession: (spec: RunSpec, model: ModelId) => ParentSession;
|
|
14
|
+
/**
|
|
15
|
+
* Resolves the parent's model, effort, and billing pool. Fails before the conversation is created
|
|
16
|
+
* if the model is unknown, doesn't support the effort, or the credential is outside the provider's
|
|
17
|
+
* pool.
|
|
18
|
+
*/
|
|
19
|
+
export declare const resolveParent: (models: Models, defaultModel: Option.Option<ModelRef>, spec: RunSpec) => Effect.Effect<{
|
|
20
|
+
ref: {
|
|
21
|
+
provider: string;
|
|
22
|
+
modelId: string;
|
|
23
|
+
};
|
|
24
|
+
model: string & import("effect/Brand").Brand<"ModelId">;
|
|
25
|
+
pool: PiPool;
|
|
26
|
+
}, PoolUnavailableError | SessionOperationError | UnknownModelError | UnsupportedEffortError, never>;
|
|
27
|
+
//# sourceMappingURL=parent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parent.d.ts","sourceRoot":"","sources":["../../src/attempt/parent.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAEL,KAAK,MAAM,EAIZ,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAa,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AASxC,+FAA+F;AAC/F,eAAO,MAAM,eAAe,cAAe,SAAS,KAAG,cACX,CAAC;AAE7C,iFAAiF;AACjF,eAAO,MAAM,aAAa,SAAU,OAAO,SAAS,OAAO,KAAG,aAK1D,CAAC;AAwDL;;;;GAIG;AACH,eAAO,MAAM,aAAa;;QAoDf,QAAQ;QAAqB,OAAO;;;;oGAI7C,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { getSupportedThinkingLevels } from "@earendil-works/pi-ai";
|
|
2
|
+
import { piAuthentication, requiredPiPool, resolvePiPool, splitPiModel, } from "@usine/agents/pi/authentication";
|
|
3
|
+
import { PoolUnavailableError, SessionOperationError, UnknownModelError, UnsupportedEffortError, } from "@usine/agents/runtime";
|
|
4
|
+
import { BrainSpec, ModelId } from "@usine/core/agent/brain";
|
|
5
|
+
import { AgentSessionId, ParentSession } from "@usine/core/agent/session";
|
|
6
|
+
import { Effect, Option } from "effect";
|
|
7
|
+
/** Returns the session ID of the Attempt's Pi parent, the default target of operator input. */
|
|
8
|
+
export const parentSessionId = (attemptId) => AgentSessionId.make(`parent:${attemptId}`);
|
|
9
|
+
/** Returns the parent session with the rostered Agent and the resolved model. */
|
|
10
|
+
export const parentSession = (spec, model) => new ParentSession({
|
|
11
|
+
id: parentSessionId(spec.attemptId),
|
|
12
|
+
agent: spec.agent.name,
|
|
13
|
+
brain: new BrainSpec({ harness: "pi", model, effort: spec.parentEffort }),
|
|
14
|
+
});
|
|
15
|
+
const launchError = (spec, message, cause) => new SessionOperationError({
|
|
16
|
+
operation: "launch",
|
|
17
|
+
sessionId: Option.some(parentSessionId(spec.attemptId)),
|
|
18
|
+
message,
|
|
19
|
+
cause,
|
|
20
|
+
});
|
|
21
|
+
const selectModel = Effect.fn("ParentModel.select")(function* (models, defaultModel, spec) {
|
|
22
|
+
if (Option.isSome(spec.parentModel)) {
|
|
23
|
+
const named = spec.parentModel.value;
|
|
24
|
+
const found = Option.flatMap(Option.fromNullishOr(splitPiModel(named)), (ref) => Option.fromNullishOr(models.getModel(ref.provider, ref.modelId)));
|
|
25
|
+
if (Option.isNone(found)) {
|
|
26
|
+
yield* Effect.logError("Pi parent rejected an unknown model", { model: named });
|
|
27
|
+
return yield* new UnknownModelError({
|
|
28
|
+
harness: "pi",
|
|
29
|
+
model: named,
|
|
30
|
+
message: `Pi has no model "${named}"`,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return found.value;
|
|
34
|
+
}
|
|
35
|
+
const configured = Option.flatMap(defaultModel, (ref) => Option.fromNullishOr(models.getModel(ref.provider, ref.modelId)));
|
|
36
|
+
if (Option.isSome(configured)) {
|
|
37
|
+
yield* Effect.logDebug("Pi parent uses the configured default model");
|
|
38
|
+
return configured.value;
|
|
39
|
+
}
|
|
40
|
+
const available = yield* Effect.tryPromise({
|
|
41
|
+
try: (signal) => models.getAvailable(undefined, { signal }),
|
|
42
|
+
catch: (cause) => launchError(spec, "Can't list the models that have a configured credential", cause),
|
|
43
|
+
});
|
|
44
|
+
const first = available[0];
|
|
45
|
+
if (first === undefined) {
|
|
46
|
+
const model = ModelId.make("unknown");
|
|
47
|
+
yield* Effect.logError("Pi parent has no model with a configured credential");
|
|
48
|
+
return yield* new UnknownModelError({
|
|
49
|
+
harness: "pi",
|
|
50
|
+
model,
|
|
51
|
+
message: "Pi has no model with a configured credential for the parent",
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
yield* Effect.logDebug("Pi parent uses the first model with a configured credential");
|
|
55
|
+
return first;
|
|
56
|
+
});
|
|
57
|
+
/**
|
|
58
|
+
* Resolves the parent's model, effort, and billing pool. Fails before the conversation is created
|
|
59
|
+
* if the model is unknown, doesn't support the effort, or the credential is outside the provider's
|
|
60
|
+
* pool.
|
|
61
|
+
*/
|
|
62
|
+
export const resolveParent = Effect.fn("ParentModel.resolve")(function* (models, defaultModel, spec) {
|
|
63
|
+
yield* Effect.annotateCurrentSpan({
|
|
64
|
+
attemptId: spec.attemptId,
|
|
65
|
+
parentEffort: spec.parentEffort,
|
|
66
|
+
parentModel: Option.getOrUndefined(spec.parentModel),
|
|
67
|
+
});
|
|
68
|
+
const selected = yield* selectModel(models, defaultModel, spec);
|
|
69
|
+
const model = ModelId.make(`${selected.provider}/${selected.id}`);
|
|
70
|
+
const supported = getSupportedThinkingLevels(selected);
|
|
71
|
+
if (!supported.includes(spec.parentEffort)) {
|
|
72
|
+
yield* Effect.logError("Pi parent rejected an unsupported effort", {
|
|
73
|
+
effort: spec.parentEffort,
|
|
74
|
+
model,
|
|
75
|
+
supported,
|
|
76
|
+
});
|
|
77
|
+
return yield* new UnsupportedEffortError({
|
|
78
|
+
harness: "pi",
|
|
79
|
+
model,
|
|
80
|
+
effort: spec.parentEffort,
|
|
81
|
+
message: `Pi model "${model}" doesn't support effort ${spec.parentEffort}. Supported efforts: ${supported.join(", ")}`,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
const check = yield* Effect.tryPromise({
|
|
85
|
+
try: (signal) => models.checkAuth(selected.provider, { signal }),
|
|
86
|
+
catch: (cause) => launchError(spec, "Can't check the parent model's credential", cause),
|
|
87
|
+
});
|
|
88
|
+
const authentication = piAuthentication(check, models.getProvider(selected.provider)?.auth.oauth?.isSubscription === true);
|
|
89
|
+
const required = requiredPiPool(selected.provider);
|
|
90
|
+
const pool = resolvePiPool(selected.provider, authentication);
|
|
91
|
+
if (pool === undefined) {
|
|
92
|
+
yield* Effect.logError(authentication === undefined
|
|
93
|
+
? "Pi parent has no credential for its model"
|
|
94
|
+
: "Pi parent model has unsupported OAuth authentication", { model, requiredPool: required, authentication: authentication?._tag });
|
|
95
|
+
return yield* new PoolUnavailableError({
|
|
96
|
+
harness: "pi",
|
|
97
|
+
model,
|
|
98
|
+
pool: required,
|
|
99
|
+
message: `Pi parent model "${model}" requires a credential from the ${required} pool`,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
yield* Effect.logInfo("Pi parent authenticated", { model, pool });
|
|
103
|
+
return {
|
|
104
|
+
ref: { provider: selected.provider, modelId: selected.id },
|
|
105
|
+
model,
|
|
106
|
+
pool,
|
|
107
|
+
};
|
|
108
|
+
});
|
|
109
|
+
//# sourceMappingURL=parent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parent.js","sourceRoot":"","sources":["../../src/attempt/parent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAe,MAAM,uBAAuB,CAAC;AAEhF,OAAO,EACL,gBAAgB,EAEhB,cAAc,EACd,aAAa,EACb,YAAY,GACb,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB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Y,EAAE,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,IAAI,EAAE,CACxE,CAAC;QACF,OAAO,KAAK,CAAC,CAAC,IAAI,oBAAoB,CAAC;YACrC,OAAO,EAAE,IAAI;YACb,KAAK;YACL,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,oBAAoB,KAAK,oCAAoC,QAAQ,OAAO;SACtF,CAAC,CAAC;IACL,CAAC;IACD,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,yBAAyB,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAClE,OAAO;QACL,GAAG,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,EAAE;QAC1D,KAAK;QACL,IAAI;KACoB,CAAC;AAC7B,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as AttemptChannel from "@usine/core/attempt/channel";
|
|
2
|
+
import { AgentFailure, type AttemptFailure } from "@usine/core/attempt/failure";
|
|
3
|
+
import { Effect, Option } from "effect";
|
|
4
|
+
import type { AttemptRequest } from "../attempt-runtime.ts";
|
|
5
|
+
import type { DurableHarness, DurableHarnessError } from "../harness.ts";
|
|
6
|
+
import { type AttemptRecord } from "./documents.ts";
|
|
7
|
+
import { type AttemptHub, type AttemptHubs } from "./hubs.ts";
|
|
8
|
+
/**
|
|
9
|
+
* Reads the Attempt's durable record. Returns `undefined` before the first `execute` creates its
|
|
10
|
+
* task.
|
|
11
|
+
*/
|
|
12
|
+
export declare const readRecord: (durable: DurableHarness["Service"], attemptId: string) => Effect.Effect<Readonly<AttemptRecord> | undefined, DurableHarnessError, never>;
|
|
13
|
+
/** Sends a payload that is not derived from a parent entry, such as an intervention result. */
|
|
14
|
+
export declare const emitPayload: (durable: DurableHarness["Service"], hub: AttemptHub, payload: AttemptChannel.OutboundPayload) => Effect.Effect<void, AgentFailure | import("@usine/core/attempt/failure").BlockedFailure | import("@usine/core/attempt/failure").ChildSessionBudgetFailure | import("@usine/core/attempt/failure").DefectFailure | DurableHarnessError | import("@usine/core/attempt/failure").InfraFailure | import("@usine/core/attempt/failure").QuestionFailure | import("@usine/core/attempt/failure").RunawayFailure, never>;
|
|
15
|
+
/** Appends an operator input to the transcript and returns its inbound sequence number. */
|
|
16
|
+
export declare const appendInbound: (durable: DurableHarness["Service"], hub: AttemptHub, operator: string, target: AttemptChannel.SessionTarget, payload: AttemptChannel.InboundPayload) => Effect.Effect<AttemptChannel.Sequence, AttemptFailure | DurableHarnessError>;
|
|
17
|
+
/**
|
|
18
|
+
* Sends the second receipt for each resolved queued operator input, and rejects all unread ones if
|
|
19
|
+
* `attempt` is `ended`. The caller must hold the hub's routing permit.
|
|
20
|
+
*/
|
|
21
|
+
export declare const relayDeliveries: (durable: {
|
|
22
|
+
readonly models: import("@earendil-works/pi-ai").Models;
|
|
23
|
+
readonly defaultModel: Option.Option<import("@earendil-works/pi-durable").ModelRef>;
|
|
24
|
+
readonly install: (extension: import("@earendil-works/pi-durable").Extension) => Effect.Effect<void>;
|
|
25
|
+
readonly resume: (beforeResume: import("../harness.ts").BeforeResume) => Effect.Effect<void, DurableHarnessError>;
|
|
26
|
+
readonly use: <A>(operation: string, run: (harness: import("@earendil-works/pi-durable").Harness, context: import("@earendil-works/chord").Context) => Promise<A>) => Effect.Effect<A, DurableHarnessError>;
|
|
27
|
+
readonly subscribe: (listener: import("../harness.ts").HarnessListener) => Effect.Effect<void, never, import("effect/Scope").Scope>;
|
|
28
|
+
}, hub: AttemptHub, attempt: "ended" | "live") => Effect.Effect<void, AgentFailure | import("@usine/core/attempt/failure").BlockedFailure | import("@usine/core/attempt/failure").ChildSessionBudgetFailure | import("@usine/core/attempt/failure").DefectFailure | DurableHarnessError | import("@usine/core/attempt/failure").InfraFailure | import("@usine/core/attempt/failure").QuestionFailure | import("@usine/core/attempt/failure").RunawayFailure, never>;
|
|
29
|
+
/**
|
|
30
|
+
* Relays one Attempt to `io` in order of occurrence until exactly one terminal envelope (`Final`,
|
|
31
|
+
* `Failed`, or `Interrupted`) is sent. Continues from the durable progress of an earlier call.
|
|
32
|
+
*/
|
|
33
|
+
export declare const relayAttempt: (durable: {
|
|
34
|
+
readonly models: import("@earendil-works/pi-ai").Models;
|
|
35
|
+
readonly defaultModel: Option.Option<import("@earendil-works/pi-durable").ModelRef>;
|
|
36
|
+
readonly install: (extension: import("@earendil-works/pi-durable").Extension) => Effect.Effect<void>;
|
|
37
|
+
readonly resume: (beforeResume: import("../harness.ts").BeforeResume) => Effect.Effect<void, DurableHarnessError>;
|
|
38
|
+
readonly use: <A>(operation: string, run: (harness: import("@earendil-works/pi-durable").Harness, context: import("@earendil-works/chord").Context) => Promise<A>) => Effect.Effect<A, DurableHarnessError>;
|
|
39
|
+
readonly subscribe: (listener: import("../harness.ts").HarnessListener) => Effect.Effect<void, never, import("effect/Scope").Scope>;
|
|
40
|
+
}, hubs: AttemptHubs, hub: AttemptHub, request: AttemptRequest, io: AttemptChannel.Sink) => Effect.Effect<import("./outcome.ts").Settled, AgentFailure | import("@usine/core/attempt/failure").BlockedFailure | import("@usine/core/attempt/failure").ChildSessionBudgetFailure | import("@usine/core/attempt/failure").DefectFailure | DurableHarnessError | import("@usine/core/attempt/failure").InfraFailure | import("@usine/core/attempt/failure").QuestionFailure | import("@usine/core/attempt/failure").RunawayFailure, never>;
|
|
41
|
+
//# sourceMappingURL=relay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relay.d.ts","sourceRoot":"","sources":["../../src/attempt/relay.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,cAAc,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAEhF,OAAO,EAAsB,MAAM,EAAE,MAAM,EAAyB,MAAM,QAAQ,CAAC;AACnF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,KAAK,aAAa,EAA6B,MAAM,gBAAgB,CAAC;AAE/E,OAAO,EACL,KAAK,UAAU,EACf,KAAK,WAAW,EAKjB,MAAM,WAAW,CAAC;AA0CnB;;;GAGG;AACH,eAAO,MAAM,UAAU,YAAa,cAAc,CAAC,SAAS,CAAC,aAAa,MAAM,mFAG7E,CAAC;AAkDJ,+FAA+F;AAC/F,eAAO,MAAM,WAAW,YACb,cAAc,CAAC,SAAS,CAAC,OAC7B,UAAU,WACN,cAAc,CAAC,eAAe,sZACG,CAAC;AAE7C,2FAA2F;AAC3F,eAAO,MAAM,aAAa,YACf,cAAc,CAAC,SAAS,CAAC,OAC7B,UAAU,YACL,MAAM,UACR,cAAc,CAAC,aAAa,WAC3B,cAAc,CAAC,cAAc,KACrC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,cAAc,GAAG,mBAAmB,CAwB3E,CAAC;AAoDJ;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;mcA6E1B,CAAC;AA0CH;;;GAGG;AACH,eAAO,MAAM,YAAY;;;;;;;ugBA6RR,CAAC"}
|