@yourtechbudstudio/fluidcast-tool-agent 0.0.0-stage → 0.0.2
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 +201 -0
- package/dist/claude/attach.d.ts +24 -0
- package/dist/claude/attach.d.ts.map +1 -0
- package/dist/claude/attach.js +25 -0
- package/dist/claude/attach.js.map +1 -0
- package/dist/claude/connect.d.ts +52 -0
- package/dist/claude/connect.d.ts.map +1 -0
- package/dist/claude/connect.js +93 -0
- package/dist/claude/connect.js.map +1 -0
- package/dist/claude/failure.d.ts +35 -0
- package/dist/claude/failure.d.ts.map +1 -0
- package/dist/claude/failure.js +42 -0
- package/dist/claude/failure.js.map +1 -0
- package/dist/claude/index.d.ts +30 -0
- package/dist/claude/index.d.ts.map +1 -0
- package/dist/claude/index.js +41 -0
- package/dist/claude/index.js.map +1 -0
- package/dist/claude/transcript.d.ts +33 -0
- package/dist/claude/transcript.d.ts.map +1 -0
- package/dist/claude/transcript.js +217 -0
- package/dist/claude/transcript.js.map +1 -0
- package/dist/claude/turn.d.ts +57 -0
- package/dist/claude/turn.d.ts.map +1 -0
- package/dist/claude/turn.js +96 -0
- package/dist/claude/turn.js.map +1 -0
- package/dist/codex/attach.d.ts +29 -0
- package/dist/codex/attach.d.ts.map +1 -0
- package/dist/codex/attach.js +78 -0
- package/dist/codex/attach.js.map +1 -0
- package/dist/codex/connect.d.ts +71 -0
- package/dist/codex/connect.d.ts.map +1 -0
- package/dist/codex/connect.js +93 -0
- package/dist/codex/connect.js.map +1 -0
- package/dist/codex/index.d.ts +60 -0
- package/dist/codex/index.d.ts.map +1 -0
- package/dist/codex/index.js +53 -0
- package/dist/codex/index.js.map +1 -0
- package/dist/codex/process.d.ts +41 -0
- package/dist/codex/process.d.ts.map +1 -0
- package/dist/codex/process.js +66 -0
- package/dist/codex/process.js.map +1 -0
- package/dist/codex/protocol.d.ts +133 -0
- package/dist/codex/protocol.d.ts.map +1 -0
- package/dist/codex/protocol.js +189 -0
- package/dist/codex/protocol.js.map +1 -0
- package/dist/codex/rpc.d.ts +51 -0
- package/dist/codex/rpc.d.ts.map +1 -0
- package/dist/codex/rpc.js +133 -0
- package/dist/codex/rpc.js.map +1 -0
- package/dist/codex/transcript.d.ts +38 -0
- package/dist/codex/transcript.d.ts.map +1 -0
- package/dist/codex/transcript.js +246 -0
- package/dist/codex/transcript.js.map +1 -0
- package/dist/codex/turn.d.ts +35 -0
- package/dist/codex/turn.d.ts.map +1 -0
- package/dist/codex/turn.js +132 -0
- package/dist/codex/turn.js.map +1 -0
- package/dist/content.d.ts +9 -0
- package/dist/content.d.ts.map +1 -0
- package/dist/content.js +8 -0
- package/dist/content.js.map +1 -0
- package/dist/forward-tool.d.ts +68 -0
- package/dist/forward-tool.d.ts.map +1 -0
- package/dist/forward-tool.js +57 -0
- package/dist/forward-tool.js.map +1 -0
- package/dist/handoff.d.ts +70 -0
- package/dist/handoff.d.ts.map +1 -0
- package/dist/handoff.js +241 -0
- package/dist/handoff.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/progress.d.ts +42 -0
- package/dist/progress.d.ts.map +1 -0
- package/dist/progress.js +88 -0
- package/dist/progress.js.map +1 -0
- package/dist/schema.d.ts +267 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +112 -0
- package/dist/schema.js.map +1 -0
- package/dist/session.d.ts +100 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +316 -0
- package/dist/session.js.map +1 -0
- package/dist/worker.d.ts +69 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +9 -0
- package/dist/worker.js.map +1 -0
- package/package.json +74 -3
- package/README.md +0 -3
package/dist/schema.d.ts
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Forward Agent tool's contract: the model-facing input, results, the worker's status,
|
|
3
|
+
* transcript entries and the Worker stream messages, everything a client needs to recognise
|
|
4
|
+
* forward calls and present the worker. A pure export: it imports only `effect`.
|
|
5
|
+
*/
|
|
6
|
+
import { Schema } from 'effect';
|
|
7
|
+
/** The model-facing action `type` of a forward call: it hands the conversation to the agent. */
|
|
8
|
+
export declare const forwardToolName = "forward_agent";
|
|
9
|
+
/**
|
|
10
|
+
* The model-facing input: nothing. The model writes `{"type":"forward_agent"}`; the worker receives the
|
|
11
|
+
* listener's own words and the conversation since its last reply, built from the session. Extra
|
|
12
|
+
* fields the model may add are ignored.
|
|
13
|
+
*/
|
|
14
|
+
export declare const ForwardInput: Schema.Struct<{}>;
|
|
15
|
+
export type ForwardInput = typeof ForwardInput.Type;
|
|
16
|
+
/** What the model reads for one busy period: the worker's top-level text messages, in order. */
|
|
17
|
+
export declare const ForwardResult: Schema.Struct<{
|
|
18
|
+
readonly messages: Schema.$Array<Schema.String>;
|
|
19
|
+
}>;
|
|
20
|
+
export type ForwardResult = typeof ForwardResult.Type;
|
|
21
|
+
/** The line in a failed busy period's text that separates the error from what the worker wrote. */
|
|
22
|
+
export declare const forwardErrorMarker = "What was written before stopping:";
|
|
23
|
+
/**
|
|
24
|
+
* The model-facing text of a failed busy period, with one owner for building and splitting it:
|
|
25
|
+
* `The work stopped with an error (<outcome>).`, plus ` The usage limit resets at <ISO time>.` when
|
|
26
|
+
* `resetsAt` (epoch seconds, as on `turnEnd`) is known, then, when the worker wrote anything, a
|
|
27
|
+
* blank line, the marker line, a blank line and its messages joined by blank lines.
|
|
28
|
+
*/
|
|
29
|
+
export declare const forwardErrorMessage: (failure: {
|
|
30
|
+
readonly outcome: string;
|
|
31
|
+
readonly resetsAt?: number | undefined;
|
|
32
|
+
readonly messages: ReadonlyArray<string>;
|
|
33
|
+
}) => string;
|
|
34
|
+
/**
|
|
35
|
+
* Splits `forwardErrorMessage` text at the first marker line. `written` is the joined text (not
|
|
36
|
+
* separable into messages again), or `null` when the worker wrote nothing.
|
|
37
|
+
*/
|
|
38
|
+
export declare const forwardErrorParts: (message: string) => {
|
|
39
|
+
readonly error: string;
|
|
40
|
+
readonly written: string | null;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* - `idle`: nothing to do (never sent anything, or its last busy period succeeded);
|
|
44
|
+
* - `working`: a busy period or an automatic turn runs;
|
|
45
|
+
* - `failed`: its last busy period ended in an error, or its connection faulted.
|
|
46
|
+
*/
|
|
47
|
+
export declare const WorkerStatus: Schema.Literals<readonly ["idle", "working", "failed"]>;
|
|
48
|
+
export type WorkerStatus = typeof WorkerStatus.Type;
|
|
49
|
+
/**
|
|
50
|
+
* The worker as the Worker view shows it, sent whenever its status or session ID changes.
|
|
51
|
+
* `sessionId` is the agent's, `null` until a new worker's agent reports it.
|
|
52
|
+
*/
|
|
53
|
+
export declare const WorkerSummary: Schema.TaggedStruct<"WorkerSummary", {
|
|
54
|
+
readonly status: Schema.Literals<readonly ["idle", "working", "failed"]>;
|
|
55
|
+
readonly sessionId: Schema.NullOr<Schema.String>;
|
|
56
|
+
}>;
|
|
57
|
+
export type WorkerSummary = typeof WorkerSummary.Type;
|
|
58
|
+
/** One normalised item of the worker's transcript. */
|
|
59
|
+
export declare const TranscriptEntry: Schema.Union<readonly [Schema.TaggedStruct<"prompt", {
|
|
60
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
61
|
+
readonly source: Schema.Literals<readonly ["fluidcast", "earlier"]>;
|
|
62
|
+
readonly text: Schema.String;
|
|
63
|
+
}>, Schema.TaggedStruct<"text", {
|
|
64
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
65
|
+
readonly text: Schema.String;
|
|
66
|
+
}>, Schema.TaggedStruct<"toolCall", {
|
|
67
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
68
|
+
readonly toolUseId: Schema.String;
|
|
69
|
+
readonly name: Schema.String;
|
|
70
|
+
readonly input: Schema.String;
|
|
71
|
+
readonly truncated: Schema.Boolean;
|
|
72
|
+
}>, Schema.TaggedStruct<"toolResult", {
|
|
73
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
74
|
+
readonly toolUseId: Schema.String;
|
|
75
|
+
readonly content: Schema.String;
|
|
76
|
+
readonly truncated: Schema.Boolean;
|
|
77
|
+
readonly isError: Schema.Boolean;
|
|
78
|
+
}>, Schema.TaggedStruct<"status", {
|
|
79
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
80
|
+
readonly text: Schema.String;
|
|
81
|
+
}>, Schema.TaggedStruct<"turnEnd", {
|
|
82
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
83
|
+
readonly outcome: Schema.String;
|
|
84
|
+
readonly resetsAt: Schema.optionalKey<Schema.Number>;
|
|
85
|
+
}>]>;
|
|
86
|
+
export type TranscriptEntry = typeof TranscriptEntry.Type;
|
|
87
|
+
/** The first message of a transcript stream: every entry so far. */
|
|
88
|
+
export declare const TranscriptSnapshot: Schema.TaggedStruct<"TranscriptSnapshot", {
|
|
89
|
+
readonly entries: Schema.$Array<Schema.Union<readonly [Schema.TaggedStruct<"prompt", {
|
|
90
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
91
|
+
readonly source: Schema.Literals<readonly ["fluidcast", "earlier"]>;
|
|
92
|
+
readonly text: Schema.String;
|
|
93
|
+
}>, Schema.TaggedStruct<"text", {
|
|
94
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
95
|
+
readonly text: Schema.String;
|
|
96
|
+
}>, Schema.TaggedStruct<"toolCall", {
|
|
97
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
98
|
+
readonly toolUseId: Schema.String;
|
|
99
|
+
readonly name: Schema.String;
|
|
100
|
+
readonly input: Schema.String;
|
|
101
|
+
readonly truncated: Schema.Boolean;
|
|
102
|
+
}>, Schema.TaggedStruct<"toolResult", {
|
|
103
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
104
|
+
readonly toolUseId: Schema.String;
|
|
105
|
+
readonly content: Schema.String;
|
|
106
|
+
readonly truncated: Schema.Boolean;
|
|
107
|
+
readonly isError: Schema.Boolean;
|
|
108
|
+
}>, Schema.TaggedStruct<"status", {
|
|
109
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
110
|
+
readonly text: Schema.String;
|
|
111
|
+
}>, Schema.TaggedStruct<"turnEnd", {
|
|
112
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
113
|
+
readonly outcome: Schema.String;
|
|
114
|
+
readonly resetsAt: Schema.optionalKey<Schema.Number>;
|
|
115
|
+
}>]>>;
|
|
116
|
+
}>;
|
|
117
|
+
/** Entries appended after the snapshot, in order. */
|
|
118
|
+
export declare const TranscriptAppended: Schema.TaggedStruct<"TranscriptAppended", {
|
|
119
|
+
readonly entries: Schema.$Array<Schema.Union<readonly [Schema.TaggedStruct<"prompt", {
|
|
120
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
121
|
+
readonly source: Schema.Literals<readonly ["fluidcast", "earlier"]>;
|
|
122
|
+
readonly text: Schema.String;
|
|
123
|
+
}>, Schema.TaggedStruct<"text", {
|
|
124
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
125
|
+
readonly text: Schema.String;
|
|
126
|
+
}>, Schema.TaggedStruct<"toolCall", {
|
|
127
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
128
|
+
readonly toolUseId: Schema.String;
|
|
129
|
+
readonly name: Schema.String;
|
|
130
|
+
readonly input: Schema.String;
|
|
131
|
+
readonly truncated: Schema.Boolean;
|
|
132
|
+
}>, Schema.TaggedStruct<"toolResult", {
|
|
133
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
134
|
+
readonly toolUseId: Schema.String;
|
|
135
|
+
readonly content: Schema.String;
|
|
136
|
+
readonly truncated: Schema.Boolean;
|
|
137
|
+
readonly isError: Schema.Boolean;
|
|
138
|
+
}>, Schema.TaggedStruct<"status", {
|
|
139
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
140
|
+
readonly text: Schema.String;
|
|
141
|
+
}>, Schema.TaggedStruct<"turnEnd", {
|
|
142
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
143
|
+
readonly outcome: Schema.String;
|
|
144
|
+
readonly resetsAt: Schema.optionalKey<Schema.Number>;
|
|
145
|
+
}>]>>;
|
|
146
|
+
}>;
|
|
147
|
+
export declare const TranscriptMessage: Schema.Union<readonly [Schema.TaggedStruct<"TranscriptSnapshot", {
|
|
148
|
+
readonly entries: Schema.$Array<Schema.Union<readonly [Schema.TaggedStruct<"prompt", {
|
|
149
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
150
|
+
readonly source: Schema.Literals<readonly ["fluidcast", "earlier"]>;
|
|
151
|
+
readonly text: Schema.String;
|
|
152
|
+
}>, Schema.TaggedStruct<"text", {
|
|
153
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
154
|
+
readonly text: Schema.String;
|
|
155
|
+
}>, Schema.TaggedStruct<"toolCall", {
|
|
156
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
157
|
+
readonly toolUseId: Schema.String;
|
|
158
|
+
readonly name: Schema.String;
|
|
159
|
+
readonly input: Schema.String;
|
|
160
|
+
readonly truncated: Schema.Boolean;
|
|
161
|
+
}>, Schema.TaggedStruct<"toolResult", {
|
|
162
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
163
|
+
readonly toolUseId: Schema.String;
|
|
164
|
+
readonly content: Schema.String;
|
|
165
|
+
readonly truncated: Schema.Boolean;
|
|
166
|
+
readonly isError: Schema.Boolean;
|
|
167
|
+
}>, Schema.TaggedStruct<"status", {
|
|
168
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
169
|
+
readonly text: Schema.String;
|
|
170
|
+
}>, Schema.TaggedStruct<"turnEnd", {
|
|
171
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
172
|
+
readonly outcome: Schema.String;
|
|
173
|
+
readonly resetsAt: Schema.optionalKey<Schema.Number>;
|
|
174
|
+
}>]>>;
|
|
175
|
+
}>, Schema.TaggedStruct<"TranscriptAppended", {
|
|
176
|
+
readonly entries: Schema.$Array<Schema.Union<readonly [Schema.TaggedStruct<"prompt", {
|
|
177
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
178
|
+
readonly source: Schema.Literals<readonly ["fluidcast", "earlier"]>;
|
|
179
|
+
readonly text: Schema.String;
|
|
180
|
+
}>, Schema.TaggedStruct<"text", {
|
|
181
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
182
|
+
readonly text: Schema.String;
|
|
183
|
+
}>, Schema.TaggedStruct<"toolCall", {
|
|
184
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
185
|
+
readonly toolUseId: Schema.String;
|
|
186
|
+
readonly name: Schema.String;
|
|
187
|
+
readonly input: Schema.String;
|
|
188
|
+
readonly truncated: Schema.Boolean;
|
|
189
|
+
}>, Schema.TaggedStruct<"toolResult", {
|
|
190
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
191
|
+
readonly toolUseId: Schema.String;
|
|
192
|
+
readonly content: Schema.String;
|
|
193
|
+
readonly truncated: Schema.Boolean;
|
|
194
|
+
readonly isError: Schema.Boolean;
|
|
195
|
+
}>, Schema.TaggedStruct<"status", {
|
|
196
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
197
|
+
readonly text: Schema.String;
|
|
198
|
+
}>, Schema.TaggedStruct<"turnEnd", {
|
|
199
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
200
|
+
readonly outcome: Schema.String;
|
|
201
|
+
readonly resetsAt: Schema.optionalKey<Schema.Number>;
|
|
202
|
+
}>]>>;
|
|
203
|
+
}>]>;
|
|
204
|
+
export type TranscriptMessage = typeof TranscriptMessage.Type;
|
|
205
|
+
/** The Worker stream messages as JSON text, for any transport that carries them (the reference apps use SSE). */
|
|
206
|
+
export declare const WorkerSummaryJson: Schema.fromJsonString<Schema.TaggedStruct<"WorkerSummary", {
|
|
207
|
+
readonly status: Schema.Literals<readonly ["idle", "working", "failed"]>;
|
|
208
|
+
readonly sessionId: Schema.NullOr<Schema.String>;
|
|
209
|
+
}>>;
|
|
210
|
+
export declare const TranscriptMessageJson: Schema.fromJsonString<Schema.Union<readonly [Schema.TaggedStruct<"TranscriptSnapshot", {
|
|
211
|
+
readonly entries: Schema.$Array<Schema.Union<readonly [Schema.TaggedStruct<"prompt", {
|
|
212
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
213
|
+
readonly source: Schema.Literals<readonly ["fluidcast", "earlier"]>;
|
|
214
|
+
readonly text: Schema.String;
|
|
215
|
+
}>, Schema.TaggedStruct<"text", {
|
|
216
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
217
|
+
readonly text: Schema.String;
|
|
218
|
+
}>, Schema.TaggedStruct<"toolCall", {
|
|
219
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
220
|
+
readonly toolUseId: Schema.String;
|
|
221
|
+
readonly name: Schema.String;
|
|
222
|
+
readonly input: Schema.String;
|
|
223
|
+
readonly truncated: Schema.Boolean;
|
|
224
|
+
}>, Schema.TaggedStruct<"toolResult", {
|
|
225
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
226
|
+
readonly toolUseId: Schema.String;
|
|
227
|
+
readonly content: Schema.String;
|
|
228
|
+
readonly truncated: Schema.Boolean;
|
|
229
|
+
readonly isError: Schema.Boolean;
|
|
230
|
+
}>, Schema.TaggedStruct<"status", {
|
|
231
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
232
|
+
readonly text: Schema.String;
|
|
233
|
+
}>, Schema.TaggedStruct<"turnEnd", {
|
|
234
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
235
|
+
readonly outcome: Schema.String;
|
|
236
|
+
readonly resetsAt: Schema.optionalKey<Schema.Number>;
|
|
237
|
+
}>]>>;
|
|
238
|
+
}>, Schema.TaggedStruct<"TranscriptAppended", {
|
|
239
|
+
readonly entries: Schema.$Array<Schema.Union<readonly [Schema.TaggedStruct<"prompt", {
|
|
240
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
241
|
+
readonly source: Schema.Literals<readonly ["fluidcast", "earlier"]>;
|
|
242
|
+
readonly text: Schema.String;
|
|
243
|
+
}>, Schema.TaggedStruct<"text", {
|
|
244
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
245
|
+
readonly text: Schema.String;
|
|
246
|
+
}>, Schema.TaggedStruct<"toolCall", {
|
|
247
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
248
|
+
readonly toolUseId: Schema.String;
|
|
249
|
+
readonly name: Schema.String;
|
|
250
|
+
readonly input: Schema.String;
|
|
251
|
+
readonly truncated: Schema.Boolean;
|
|
252
|
+
}>, Schema.TaggedStruct<"toolResult", {
|
|
253
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
254
|
+
readonly toolUseId: Schema.String;
|
|
255
|
+
readonly content: Schema.String;
|
|
256
|
+
readonly truncated: Schema.Boolean;
|
|
257
|
+
readonly isError: Schema.Boolean;
|
|
258
|
+
}>, Schema.TaggedStruct<"status", {
|
|
259
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
260
|
+
readonly text: Schema.String;
|
|
261
|
+
}>, Schema.TaggedStruct<"turnEnd", {
|
|
262
|
+
readonly parentToolUseId: Schema.NullOr<Schema.String>;
|
|
263
|
+
readonly outcome: Schema.String;
|
|
264
|
+
readonly resetsAt: Schema.optionalKey<Schema.Number>;
|
|
265
|
+
}>]>>;
|
|
266
|
+
}>]>>;
|
|
267
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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AE1D,oEAAoE;AACpE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAE7B,CAAC;AACH,qDAAqD;AACrD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAE7B,CAAC;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAyD,CAAC;AACxF,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAC;AAE9D,iHAAiH;AACjH,eAAO,MAAM,iBAAiB;;;GAAuC,CAAC;AACtE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAA2C,CAAC"}
|
package/dist/schema.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Forward Agent tool's contract: the model-facing input, results, the worker's status,
|
|
3
|
+
* transcript entries and the Worker stream messages, everything a client needs to recognise
|
|
4
|
+
* forward calls and present the worker. A pure export: it imports only `effect`.
|
|
5
|
+
*/
|
|
6
|
+
import { Schema } from 'effect';
|
|
7
|
+
/** The model-facing action `type` of a forward call: it hands the conversation to the agent. */
|
|
8
|
+
export const forwardToolName = 'forward_agent';
|
|
9
|
+
/**
|
|
10
|
+
* The model-facing input: nothing. The model writes `{"type":"forward_agent"}`; the worker receives the
|
|
11
|
+
* listener's own words and the conversation since its last reply, built from the session. Extra
|
|
12
|
+
* fields the model may add are ignored.
|
|
13
|
+
*/
|
|
14
|
+
export const ForwardInput = Schema.Struct({}).annotate({
|
|
15
|
+
description: "Starts your work on the listener's latest words: it carries them, with what you said and showed since the last forward. It has no fields.",
|
|
16
|
+
});
|
|
17
|
+
/** What the model reads for one busy period: the worker's top-level text messages, in order. */
|
|
18
|
+
export const ForwardResult = Schema.Struct({
|
|
19
|
+
messages: Schema.Array(Schema.String),
|
|
20
|
+
});
|
|
21
|
+
/** The line in a failed busy period's text that separates the error from what the worker wrote. */
|
|
22
|
+
export const forwardErrorMarker = 'What was written before stopping:';
|
|
23
|
+
const markerLine = `\n\n${forwardErrorMarker}\n\n`;
|
|
24
|
+
/**
|
|
25
|
+
* The model-facing text of a failed busy period, with one owner for building and splitting it:
|
|
26
|
+
* `The work stopped with an error (<outcome>).`, plus ` The usage limit resets at <ISO time>.` when
|
|
27
|
+
* `resetsAt` (epoch seconds, as on `turnEnd`) is known, then, when the worker wrote anything, a
|
|
28
|
+
* blank line, the marker line, a blank line and its messages joined by blank lines.
|
|
29
|
+
*/
|
|
30
|
+
export const forwardErrorMessage = (failure) => {
|
|
31
|
+
const resets = failure.resetsAt === undefined
|
|
32
|
+
? ''
|
|
33
|
+
: ` The usage limit resets at ${new Date(failure.resetsAt * 1000).toISOString()}.`;
|
|
34
|
+
const error = `The work stopped with an error (${failure.outcome}).${resets}`;
|
|
35
|
+
return failure.messages.length === 0
|
|
36
|
+
? error
|
|
37
|
+
: `${error}${markerLine}${failure.messages.join('\n\n')}`;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Splits `forwardErrorMessage` text at the first marker line. `written` is the joined text (not
|
|
41
|
+
* separable into messages again), or `null` when the worker wrote nothing.
|
|
42
|
+
*/
|
|
43
|
+
export const forwardErrorParts = (message) => {
|
|
44
|
+
const at = message.indexOf(markerLine);
|
|
45
|
+
return at === -1
|
|
46
|
+
? { error: message, written: null }
|
|
47
|
+
: { error: message.slice(0, at), written: message.slice(at + markerLine.length) };
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* - `idle`: nothing to do (never sent anything, or its last busy period succeeded);
|
|
51
|
+
* - `working`: a busy period or an automatic turn runs;
|
|
52
|
+
* - `failed`: its last busy period ended in an error, or its connection faulted.
|
|
53
|
+
*/
|
|
54
|
+
export const WorkerStatus = Schema.Literals(['idle', 'working', 'failed']);
|
|
55
|
+
/**
|
|
56
|
+
* The worker as the Worker view shows it, sent whenever its status or session ID changes.
|
|
57
|
+
* `sessionId` is the agent's, `null` until a new worker's agent reports it.
|
|
58
|
+
*/
|
|
59
|
+
export const WorkerSummary = Schema.TaggedStruct('WorkerSummary', {
|
|
60
|
+
status: WorkerStatus,
|
|
61
|
+
sessionId: Schema.NullOr(Schema.String),
|
|
62
|
+
});
|
|
63
|
+
/** The tool call an entry is nested under (a subagent's), or `null` at the top level. */
|
|
64
|
+
const Parent = { parentToolUseId: Schema.NullOr(Schema.String) };
|
|
65
|
+
/** One normalised item of the worker's transcript. */
|
|
66
|
+
export const TranscriptEntry = Schema.Union([
|
|
67
|
+
/** Exactly what the worker was sent: by this Fluidcast session, or before it attached. */
|
|
68
|
+
Schema.TaggedStruct('prompt', {
|
|
69
|
+
...Parent,
|
|
70
|
+
source: Schema.Literals(['fluidcast', 'earlier']),
|
|
71
|
+
text: Schema.String,
|
|
72
|
+
}),
|
|
73
|
+
/** Text the worker wrote, as Markdown. */
|
|
74
|
+
Schema.TaggedStruct('text', { ...Parent, text: Schema.String }),
|
|
75
|
+
/** A tool call; `input` is its JSON text, capped, with `truncated` saying whether the cap applied. */
|
|
76
|
+
Schema.TaggedStruct('toolCall', {
|
|
77
|
+
...Parent,
|
|
78
|
+
toolUseId: Schema.String,
|
|
79
|
+
name: Schema.String,
|
|
80
|
+
input: Schema.String,
|
|
81
|
+
truncated: Schema.Boolean,
|
|
82
|
+
}),
|
|
83
|
+
/** A tool call's result text, capped, with `truncated` saying whether the cap applied. */
|
|
84
|
+
Schema.TaggedStruct('toolResult', {
|
|
85
|
+
...Parent,
|
|
86
|
+
toolUseId: Schema.String,
|
|
87
|
+
content: Schema.String,
|
|
88
|
+
truncated: Schema.Boolean,
|
|
89
|
+
isError: Schema.Boolean,
|
|
90
|
+
}),
|
|
91
|
+
/** A subagent's progress summary. */
|
|
92
|
+
Schema.TaggedStruct('status', { ...Parent, text: Schema.String }),
|
|
93
|
+
/** A turn ended: `success`, or a display-safe error tag such as `error_max_turns` or `usage_limit` (with when it resets, epoch seconds, if known). */
|
|
94
|
+
Schema.TaggedStruct('turnEnd', {
|
|
95
|
+
...Parent,
|
|
96
|
+
outcome: Schema.String,
|
|
97
|
+
resetsAt: Schema.optionalKey(Schema.Number),
|
|
98
|
+
}),
|
|
99
|
+
]);
|
|
100
|
+
/** The first message of a transcript stream: every entry so far. */
|
|
101
|
+
export const TranscriptSnapshot = Schema.TaggedStruct('TranscriptSnapshot', {
|
|
102
|
+
entries: Schema.Array(TranscriptEntry),
|
|
103
|
+
});
|
|
104
|
+
/** Entries appended after the snapshot, in order. */
|
|
105
|
+
export const TranscriptAppended = Schema.TaggedStruct('TranscriptAppended', {
|
|
106
|
+
entries: Schema.Array(TranscriptEntry),
|
|
107
|
+
});
|
|
108
|
+
export const TranscriptMessage = Schema.Union([TranscriptSnapshot, TranscriptAppended]);
|
|
109
|
+
/** The Worker stream messages as JSON text, for any transport that carries them (the reference apps use SSE). */
|
|
110
|
+
export const WorkerSummaryJson = Schema.fromJsonString(WorkerSummary);
|
|
111
|
+
export const TranscriptMessageJson = Schema.fromJsonString(TranscriptMessage);
|
|
112
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,gGAAgG;AAChG,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC;AAE/C;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC;IACrD,WAAW,EACT,2IAA2I;CAC9I,CAAC,CAAC;AAGH,gGAAgG;AAChG,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC;IACzC,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAA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C;IACrC,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;IACjE,sJAAsJ;IACtJ,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE;QAC7B,GAAG,MAAM;QACT,OAAO,EAAE,MAAM,CAAC,MAAM;QACtB,QAAQ,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC;KAC5C,CAAC;CACH,CAAC,CAAC;AAGH,oEAAoE;AACpE,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,YAAY,CAAC,oBAAoB,EAAE;IAC1E,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC;CACvC,CAAC,CAAC;AACH,qDAAqD;AACrD,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,YAAY,CAAC,oBAAoB,EAAE;IAC1E,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC;CACvC,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC,CAAC;AAGxF,iHAAiH;AACjH,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;AACtE,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The worker session: the one worker's state, busy periods (one Harness execution each), its reader
|
|
3
|
+
* fiber, faults, and the Worker streams.
|
|
4
|
+
*
|
|
5
|
+
* All state, including the worker's transcript, is one `SubscriptionRef`. Every decision is one
|
|
6
|
+
* atomic `modify` that records its transcript entries and returns the effects it implies (complete
|
|
7
|
+
* a `Deferred`, report a fault), which run right after it. That linearises `assign` (under the
|
|
8
|
+
* Harness lock), reader events, context sampling, progress snapshots and the Worker streams without
|
|
9
|
+
* a second lock, and the transcript's order is the order of the decisions.
|
|
10
|
+
*/
|
|
11
|
+
import { Deferred, Effect, Stream, type Schedule, type Scope } from 'effect';
|
|
12
|
+
import type { LanguageModel } from 'effect/ai';
|
|
13
|
+
import { ToolError, ToolFault, type CallAssignment, type InvocationContext } from '@yourtechbudstudio/fluidcast-harness';
|
|
14
|
+
import type { ExecutionId } from '@yourtechbudstudio/fluidcast-harness/protocol';
|
|
15
|
+
import { type Handoff, type HandoffPrompt } from './handoff.ts';
|
|
16
|
+
import { type ForwardInput, type ForwardResult, type TranscriptEntry, type TranscriptMessage, type WorkerStatus, type WorkerSummary } from './schema.ts';
|
|
17
|
+
import type { WorkerSetupError, WorkerType } from './worker.ts';
|
|
18
|
+
type Outcome = Deferred.Deferred<ForwardResult, ToolError | ToolFault>;
|
|
19
|
+
type TurnEndEntry = Extract<TranscriptEntry, {
|
|
20
|
+
readonly _tag: 'turnEnd';
|
|
21
|
+
}>;
|
|
22
|
+
/** One busy period: the life of one Forward execution. */
|
|
23
|
+
interface Period {
|
|
24
|
+
readonly executionId: ExecutionId;
|
|
25
|
+
/** Message IDs sent in this period, and those a turn has taken in. */
|
|
26
|
+
readonly sent: ReadonlySet<string>;
|
|
27
|
+
readonly consumed: ReadonlySet<string>;
|
|
28
|
+
/** Top-level text entries, in order. */
|
|
29
|
+
readonly texts: ReadonlyArray<string>;
|
|
30
|
+
/** The latest top-level `turnEnd` entry. */
|
|
31
|
+
readonly lastTurnEnd: TurnEndEntry | undefined;
|
|
32
|
+
readonly outcome: Outcome;
|
|
33
|
+
}
|
|
34
|
+
/** What `run` finds for a new execution: a period to await, or a refusal decided in `assign`. */
|
|
35
|
+
type Opening = {
|
|
36
|
+
readonly _tag: 'Period';
|
|
37
|
+
readonly outcome: Outcome;
|
|
38
|
+
/** The period's first transcript index: its hand-off prompt. */
|
|
39
|
+
readonly transcriptStart: number;
|
|
40
|
+
} | {
|
|
41
|
+
readonly _tag: 'Refused';
|
|
42
|
+
readonly failure: ToolFault;
|
|
43
|
+
};
|
|
44
|
+
interface WorkerState {
|
|
45
|
+
/**
|
|
46
|
+
* The agent's session ID: the preloaded one from the start, else `undefined` until the connection
|
|
47
|
+
* reports it (`SessionStarted`).
|
|
48
|
+
*/
|
|
49
|
+
readonly sessionId: string | undefined;
|
|
50
|
+
readonly cwd: string;
|
|
51
|
+
/** A reader has been forked: once in the worker's life. */
|
|
52
|
+
readonly connected: boolean;
|
|
53
|
+
/** The last forward call whose message was sent. */
|
|
54
|
+
readonly lastHandle: string | undefined;
|
|
55
|
+
/** From events: any entry makes it `running`; `Settled` makes it `settled`. */
|
|
56
|
+
readonly activity: 'running' | 'settled';
|
|
57
|
+
/** The last busy period ended in an error, or it faulted. */
|
|
58
|
+
readonly failed: boolean;
|
|
59
|
+
readonly fault: ToolFault | undefined;
|
|
60
|
+
readonly period: Period | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Top-level text written with no period open (an automatic turn between forwards), in order. The
|
|
63
|
+
* next period's result starts with it, so the voice reads it exactly once.
|
|
64
|
+
*/
|
|
65
|
+
readonly undelivered: ReadonlyArray<string>;
|
|
66
|
+
/** Append-only: each change replaces the array. */
|
|
67
|
+
readonly transcript: ReadonlyArray<TranscriptEntry>;
|
|
68
|
+
/** New executions waiting for `run`. */
|
|
69
|
+
readonly openings: ReadonlyMap<ExecutionId, Opening>;
|
|
70
|
+
}
|
|
71
|
+
export interface WorkerSessionOptions {
|
|
72
|
+
readonly type: WorkerType;
|
|
73
|
+
/** An existing session to resume as the worker. */
|
|
74
|
+
readonly sessionId: string | undefined;
|
|
75
|
+
readonly hook: (handoff: Handoff) => HandoffPrompt;
|
|
76
|
+
readonly schedule: Schedule.Schedule<unknown>;
|
|
77
|
+
/** The progress writer's system prompt. */
|
|
78
|
+
readonly progressPrompt: string;
|
|
79
|
+
readonly model: LanguageModel.LanguageModel;
|
|
80
|
+
}
|
|
81
|
+
export declare const statusOf: (worker: WorkerState) => WorkerStatus;
|
|
82
|
+
/** The per-iteration context: the worker's state, or nothing while it is idle. */
|
|
83
|
+
export declare const renderContext: (status: WorkerStatus) => string | undefined;
|
|
84
|
+
/** The worker session's parts: the Forward tool's execution half, and the Worker view. */
|
|
85
|
+
export interface WorkerSession {
|
|
86
|
+
readonly assign: (input: ForwardInput, call: CallAssignment) => Effect.Effect<ExecutionId>;
|
|
87
|
+
readonly run: (input: ForwardInput, context: InvocationContext<unknown>) => Effect.Effect<ForwardResult, ToolError | ToolFault>;
|
|
88
|
+
readonly context: Effect.Effect<string | undefined>;
|
|
89
|
+
readonly faults: Stream.Stream<ToolFault>;
|
|
90
|
+
readonly status: Stream.Stream<WorkerSummary>;
|
|
91
|
+
readonly transcript: Stream.Stream<TranscriptMessage>;
|
|
92
|
+
/** The worker's connection fault, once recorded; never completes otherwise. */
|
|
93
|
+
readonly fault: Effect.Effect<ToolFault>;
|
|
94
|
+
/** The session ID in the worker's state now; final once the session's scope has closed. */
|
|
95
|
+
readonly sessionId: Effect.Effect<string | null>;
|
|
96
|
+
}
|
|
97
|
+
/** Builds the worker session in the current scope, attaching a preloaded session. Nothing connects. */
|
|
98
|
+
export declare const makeWorkerSession: (options: WorkerSessionOptions) => Effect.Effect<WorkerSession, WorkerSetupError, Scope.Scope>;
|
|
99
|
+
export {};
|
|
100
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EACL,QAAQ,EACR,MAAM,EAIN,MAAM,EAEN,KAAK,QAAQ,EACb,KAAK,KAAK,EACX,MAAM,QAAQ,CAAC;AAChB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAG/C,OAAO,EACL,SAAS,EACT,SAAS,EACT,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACvB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