@substrat-run/engine-assistant 0.0.0-stage → 0.1.27
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 +661 -0
- package/README.md +125 -2
- package/dist/entities.d.ts +174 -0
- package/dist/entities.d.ts.map +1 -0
- package/dist/entities.js +110 -0
- package/dist/entities.js.map +1 -0
- package/dist/events.d.ts +106 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +57 -0
- package/dist/events.js.map +1 -0
- package/dist/files.d.ts +32 -0
- package/dist/files.d.ts.map +1 -0
- package/dist/files.js +69 -0
- package/dist/files.js.map +1 -0
- package/dist/index.d.ts +356 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +811 -0
- package/dist/index.js.map +1 -0
- package/dist/model.d.ts +12 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +19 -0
- package/dist/model.js.map +1 -0
- package/dist/operations.d.ts +485 -0
- package/dist/operations.d.ts.map +1 -0
- package/dist/operations.js +106 -0
- package/dist/operations.js.map +1 -0
- package/dist/seam.d.ts +5 -0
- package/dist/seam.d.ts.map +1 -0
- package/dist/seam.js +15 -0
- package/dist/seam.js.map +1 -0
- package/dist/shapes.d.ts +413 -0
- package/dist/shapes.d.ts.map +1 -0
- package/dist/shapes.js +134 -0
- package/dist/shapes.js.map +1 -0
- package/package.json +51 -3
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The assistant engine's declared operation surface.
|
|
3
|
+
*
|
|
4
|
+
* Two audiences, and the line between them is the point of the engine.
|
|
5
|
+
*
|
|
6
|
+
* **A person** (`assistant:use`) opens threads, reads their own, says something, approves or
|
|
7
|
+
* denies what the assistant proposes, and closes a thread. Every one of those acts on the
|
|
8
|
+
* caller's own threads: none takes a principal as input to act as, so holding the key never
|
|
9
|
+
* reaches anybody else's conversation. `assistant:audit` adds reading another principal's
|
|
10
|
+
* threads, never writing to them.
|
|
11
|
+
*
|
|
12
|
+
* **The assistant host** (`assistant:run`) takes the lease on a thread, appends what the
|
|
13
|
+
* assistant said and did, and claims a gated tool's execution. This key is held by the
|
|
14
|
+
* host's principal ONLY and by no role a person has. If a person held it they could append
|
|
15
|
+
* `text-delta` events to their own thread and have the record say the assistant wrote them,
|
|
16
|
+
* or mark a tool call done that never ran. The split is what makes the record evidence.
|
|
17
|
+
*
|
|
18
|
+
* Node checks only: a thread is its owner's, which is a comparison of principals the
|
|
19
|
+
* handlers make, not a per-entity grant somebody else could hold. No `http`: an engine owns
|
|
20
|
+
* no URL shape; a composing vertical binds these with `defineEngineRoutes`.
|
|
21
|
+
*/
|
|
22
|
+
import { defineOperations } from '@substrat-run/contracts';
|
|
23
|
+
import { assistantEntities } from './entities.js';
|
|
24
|
+
import { acquireRunInput, acquiredRun, appendEventsInput, appendedEvents, claimExecutionInput, claimedExecution, createThreadInput, eventsPage, listThreadsInput, readEventsInput, releaseRunInput, releasedRun, resolveApprovalInput, resolvedApproval, sendMessageInput, sentMessage, thread, threadIdInput, } from './shapes.js';
|
|
25
|
+
/** The keys these operations check. Mirrors `ASSISTANT_PERM` in index.ts. */
|
|
26
|
+
export const ASSISTANT_PERMISSIONS = ['assistant:use', 'assistant:audit', 'assistant:run'];
|
|
27
|
+
export const assistantOperations = defineOperations(assistantEntities, ASSISTANT_PERMISSIONS)({
|
|
28
|
+
'assistant/create-thread': {
|
|
29
|
+
summary: 'Open a thread for the caller',
|
|
30
|
+
permission: 'assistant:use',
|
|
31
|
+
input: createThreadInput,
|
|
32
|
+
inputOptional: true,
|
|
33
|
+
output: thread,
|
|
34
|
+
},
|
|
35
|
+
'assistant/list-threads': {
|
|
36
|
+
summary: "The caller's threads, most recently active first (another principal's, with audit)",
|
|
37
|
+
permission: 'assistant:use',
|
|
38
|
+
input: listThreadsInput,
|
|
39
|
+
inputOptional: true,
|
|
40
|
+
output: thread,
|
|
41
|
+
// Handler-composed: a thread is a projection of its row, and the read narrows to the
|
|
42
|
+
// caller's own before it pages. The order and the cursor are (last_event_at, id).
|
|
43
|
+
paged: { sortKey: 'lastEventAt' },
|
|
44
|
+
},
|
|
45
|
+
'assistant/get-thread': {
|
|
46
|
+
summary: 'One thread',
|
|
47
|
+
permission: 'assistant:use',
|
|
48
|
+
input: threadIdInput,
|
|
49
|
+
output: thread,
|
|
50
|
+
},
|
|
51
|
+
'assistant/read-events': {
|
|
52
|
+
summary: "A thread's events after a cursor — how a client resumes",
|
|
53
|
+
permission: 'assistant:use',
|
|
54
|
+
input: readEventsInput,
|
|
55
|
+
output: eventsPage,
|
|
56
|
+
},
|
|
57
|
+
'assistant/send-message': {
|
|
58
|
+
summary: 'Send text or uploaded files in a thread, which begins a turn',
|
|
59
|
+
permission: 'assistant:use',
|
|
60
|
+
input: sendMessageInput,
|
|
61
|
+
output: sentMessage,
|
|
62
|
+
},
|
|
63
|
+
'assistant/authorize-file-upload': {
|
|
64
|
+
summary: 'Authorize a host to upload a file to the caller’s own open thread',
|
|
65
|
+
permission: 'assistant:use',
|
|
66
|
+
input: threadIdInput,
|
|
67
|
+
output: thread,
|
|
68
|
+
},
|
|
69
|
+
'assistant/resolve-approval': {
|
|
70
|
+
summary: 'Approve or deny a gated tool call, bound to the input shown',
|
|
71
|
+
permission: 'assistant:use',
|
|
72
|
+
input: resolveApprovalInput,
|
|
73
|
+
output: resolvedApproval,
|
|
74
|
+
},
|
|
75
|
+
'assistant/close-thread': {
|
|
76
|
+
summary: 'Close a thread; nothing more is appended',
|
|
77
|
+
permission: 'assistant:use',
|
|
78
|
+
input: threadIdInput,
|
|
79
|
+
output: thread,
|
|
80
|
+
},
|
|
81
|
+
'assistant/acquire-run': {
|
|
82
|
+
summary: 'Take the single-writer lease on a thread (host only)',
|
|
83
|
+
permission: 'assistant:run',
|
|
84
|
+
input: acquireRunInput,
|
|
85
|
+
output: acquiredRun,
|
|
86
|
+
},
|
|
87
|
+
'assistant/release-run': {
|
|
88
|
+
summary: 'Give the lease back when a run comes to rest (host only)',
|
|
89
|
+
permission: 'assistant:run',
|
|
90
|
+
input: releaseRunInput,
|
|
91
|
+
output: releasedRun,
|
|
92
|
+
},
|
|
93
|
+
'assistant/append-events': {
|
|
94
|
+
summary: "Append the assistant's events to a thread, fenced by the lease (host only)",
|
|
95
|
+
permission: 'assistant:run',
|
|
96
|
+
input: appendEventsInput,
|
|
97
|
+
output: appendedEvents,
|
|
98
|
+
},
|
|
99
|
+
'assistant/claim-execution': {
|
|
100
|
+
summary: 'Claim the one execution of an approved tool call (host only)',
|
|
101
|
+
permission: 'assistant:run',
|
|
102
|
+
input: claimExecutionInput,
|
|
103
|
+
output: claimedExecution,
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
//# sourceMappingURL=operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../src/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EACL,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,WAAW,EACX,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,MAAM,EACN,aAAa,GACd,MAAM,aAAa,CAAC;AAErB,6EAA6E;AAC7E,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,eAAe,EAAE,iBAAiB,EAAE,eAAe,CAAU,CAAC;AAEpG,MAAM,CAAC,MAAM,mBAAmB,GAAG,gBAAgB,CAAC,iBAAiB,EAAE,qBAAqB,CAAC,CAAC;IAC5F,yBAAyB,EAAE;QACzB,OAAO,EAAE,8BAA8B;QACvC,UAAU,EAAE,eAAe;QAC3B,KAAK,EAA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EAAE,eAAe;QAC3B,KAAK,EAAE,eAAe;QACtB,MAAM,EAAE,WAAW;KACpB;IAED,yBAAyB,EAAE;QACzB,OAAO,EAAE,4EAA4E;QACrF,UAAU,EAAE,eAAe;QAC3B,KAAK,EAAE,iBAAiB;QACxB,MAAM,EAAE,cAAc;KACvB;IAED,2BAA2B,EAAE;QAC3B,OAAO,EAAE,8DAA8D;QACvE,UAAU,EAAE,eAAe;QAC3B,KAAK,EAAE,mBAAmB;QAC1B,MAAM,EAAE,gBAAgB;KACzB;CACF,CAAC,CAAC"}
|
package/dist/seam.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** How this engine names itself in a seam failure. */
|
|
2
|
+
export declare const columnsOf: (schema: {
|
|
3
|
+
readonly shape: Readonly<Record<string, unknown>>;
|
|
4
|
+
}) => string, returns: <T>(schema: import("zod").ZodType<T>, surface: string, value: unknown) => T;
|
|
5
|
+
//# sourceMappingURL=seam.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seam.d.ts","sourceRoot":"","sources":["../src/seam.ts"],"names":[],"mappings":"AAaA,sDAAsD;AACtD,eAAO,MAAQ,SAAS;;cAAE,OAAO,6EAAmC,CAAC"}
|
package/dist/seam.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The engine seam (#771) for engine-assistant — the NAME, and nothing else.
|
|
3
|
+
*
|
|
4
|
+
* `returns(schema, surface, value)` and `columnsOf(schema)` live in `@substrat-run/contracts`
|
|
5
|
+
* (#970); an engine supplies only the name it answers under.
|
|
6
|
+
*
|
|
7
|
+
* What is specific here: a stored `body` is parsed back through the stream protocol's own
|
|
8
|
+
* schema before it reaches a client, and a stored `state` decides what a tool call may do
|
|
9
|
+
* next. A row that drifted would otherwise reach a screen as a half-formed event, or let a
|
|
10
|
+
* gated write through a state the engine thinks it cannot be in.
|
|
11
|
+
*/
|
|
12
|
+
import { engineSeam } from '@substrat-run/contracts';
|
|
13
|
+
/** How this engine names itself in a seam failure. */
|
|
14
|
+
export const { columnsOf, returns } = engineSeam('engine-assistant');
|
|
15
|
+
//# sourceMappingURL=seam.js.map
|
package/dist/seam.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seam.js","sourceRoot":"","sources":["../src/seam.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,sDAAsD;AACtD,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAC"}
|
package/dist/shapes.d.ts
ADDED
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The published shapes and the declared inputs of engine-assistant, in one place so the
|
|
3
|
+
* in-scope functions in `index.ts` and the declared operations in `operations.ts` read the
|
|
4
|
+
* same definition rather than two that drift.
|
|
5
|
+
*
|
|
6
|
+
* Published shapes are camelCase projections; the stored rows (snake_case) are in
|
|
7
|
+
* `entities.ts`. A caller never sees a row.
|
|
8
|
+
*/
|
|
9
|
+
import { z } from '@substrat-run/contracts';
|
|
10
|
+
/**
|
|
11
|
+
* The longest an event body may serialise to, in UTF-8 bytes: the Durable Object row limit
|
|
12
|
+
* is in bytes. A large tool result belongs in the operation that produced it, by id.
|
|
13
|
+
*/
|
|
14
|
+
export declare const MAX_EVENT_BYTES: number;
|
|
15
|
+
/**
|
|
16
|
+
* The longest a user's message may be, in UTF-8 bytes of its text AS SERIALISED (escapes
|
|
17
|
+
* included). Half the event bound, so a message that passes the input schema always fits in
|
|
18
|
+
* its `user-message` event: a message is refused as a message, at the boundary, never as an
|
|
19
|
+
* oversized event further in.
|
|
20
|
+
*/
|
|
21
|
+
export declare const MAX_MESSAGE_BYTES: number;
|
|
22
|
+
/** UTF-8 byte length of a string, without a platform encoder (module code has none in its types). */
|
|
23
|
+
export declare function utf8Length(s: string): number;
|
|
24
|
+
/** One thread, projected. */
|
|
25
|
+
export declare const thread: z.ZodObject<{
|
|
26
|
+
id: z.ZodString;
|
|
27
|
+
subject: z.ZodString;
|
|
28
|
+
title: z.ZodNullable<z.ZodString>;
|
|
29
|
+
status: z.ZodEnum<{
|
|
30
|
+
closed: "closed";
|
|
31
|
+
open: "open";
|
|
32
|
+
}>;
|
|
33
|
+
createdAt: z.ZodString;
|
|
34
|
+
lastEventAt: z.ZodString;
|
|
35
|
+
closedAt: z.ZodNullable<z.ZodString>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
export type Thread = z.infer<typeof thread>;
|
|
38
|
+
export declare const createThreadInput: z.ZodObject<{
|
|
39
|
+
title: z.ZodOptional<z.ZodString>;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
export type CreateThreadInput = z.infer<typeof createThreadInput>;
|
|
42
|
+
export declare const listThreadsInput: z.ZodObject<{
|
|
43
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
44
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
45
|
+
closed: "closed";
|
|
46
|
+
open: "open";
|
|
47
|
+
}>>;
|
|
48
|
+
}, z.core.$strip>;
|
|
49
|
+
export type ListThreadsInput = z.infer<typeof listThreadsInput>;
|
|
50
|
+
export declare const threadIdInput: z.ZodObject<{
|
|
51
|
+
threadId: z.ZodString;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
export type ThreadIdInput = z.infer<typeof threadIdInput>;
|
|
54
|
+
/** A bounded read of the record, by the cursor a client resumes after. */
|
|
55
|
+
export declare const readEventsInput: z.ZodObject<{
|
|
56
|
+
threadId: z.ZodString;
|
|
57
|
+
after: z.ZodDefault<z.ZodNumber>;
|
|
58
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
export type ReadEventsInput = z.input<typeof readEventsInput>;
|
|
61
|
+
export declare const eventsPage: z.ZodObject<{
|
|
62
|
+
events: z.ZodArray<z.ZodIntersection<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
63
|
+
t: z.ZodLiteral<"user-message">;
|
|
64
|
+
text: z.ZodString;
|
|
65
|
+
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
66
|
+
id: z.ZodString;
|
|
67
|
+
filename: z.ZodString;
|
|
68
|
+
contentType: z.ZodString;
|
|
69
|
+
size: z.ZodNumber;
|
|
70
|
+
sha256: z.ZodString;
|
|
71
|
+
}, z.core.$strip>>>;
|
|
72
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
73
|
+
t: z.ZodLiteral<"turn-start">;
|
|
74
|
+
v: z.ZodNumber;
|
|
75
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
76
|
+
t: z.ZodLiteral<"turn-finish">;
|
|
77
|
+
reason: z.ZodEnum<{
|
|
78
|
+
"awaiting-approval": "awaiting-approval";
|
|
79
|
+
budget: "budget";
|
|
80
|
+
done: "done";
|
|
81
|
+
stopped: "stopped";
|
|
82
|
+
}>;
|
|
83
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
84
|
+
t: z.ZodLiteral<"turn-error">;
|
|
85
|
+
code: z.ZodString;
|
|
86
|
+
message: z.ZodString;
|
|
87
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
88
|
+
t: z.ZodLiteral<"step-start">;
|
|
89
|
+
step: z.ZodString;
|
|
90
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
91
|
+
t: z.ZodLiteral<"step-end">;
|
|
92
|
+
step: z.ZodString;
|
|
93
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
94
|
+
t: z.ZodLiteral<"step-restart">;
|
|
95
|
+
step: z.ZodString;
|
|
96
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
97
|
+
pid: z.ZodString;
|
|
98
|
+
t: z.ZodLiteral<"text-start">;
|
|
99
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
100
|
+
pid: z.ZodString;
|
|
101
|
+
t: z.ZodLiteral<"text-delta">;
|
|
102
|
+
delta: z.ZodString;
|
|
103
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
104
|
+
pid: z.ZodString;
|
|
105
|
+
t: z.ZodLiteral<"text-end">;
|
|
106
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
107
|
+
t: z.ZodLiteral<"tool-input">;
|
|
108
|
+
callId: z.ZodString;
|
|
109
|
+
tool: z.ZodString;
|
|
110
|
+
input: z.ZodUnknown;
|
|
111
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
112
|
+
t: z.ZodLiteral<"tool-output">;
|
|
113
|
+
callId: z.ZodString;
|
|
114
|
+
tool: z.ZodString;
|
|
115
|
+
output: z.ZodOptional<z.ZodUnknown>;
|
|
116
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
117
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
118
|
+
t: z.ZodLiteral<"tool-error">;
|
|
119
|
+
callId: z.ZodString;
|
|
120
|
+
tool: z.ZodString;
|
|
121
|
+
message: z.ZodString;
|
|
122
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
123
|
+
t: z.ZodLiteral<"approval-request">;
|
|
124
|
+
callId: z.ZodString;
|
|
125
|
+
step: z.ZodString;
|
|
126
|
+
tool: z.ZodString;
|
|
127
|
+
operation: z.ZodString;
|
|
128
|
+
version: z.ZodString;
|
|
129
|
+
input: z.ZodUnknown;
|
|
130
|
+
expiresAt: z.core.$ZodBranded<z.ZodString, "Instant", "out">;
|
|
131
|
+
nonce: z.ZodString;
|
|
132
|
+
digest: z.ZodString;
|
|
133
|
+
preview: z.ZodString;
|
|
134
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
135
|
+
t: z.ZodLiteral<"approval-resolved">;
|
|
136
|
+
callId: z.ZodString;
|
|
137
|
+
approved: z.ZodBoolean;
|
|
138
|
+
approver: z.core.$ZodBranded<z.ZodString, "PrincipalId", "out">;
|
|
139
|
+
digest: z.ZodString;
|
|
140
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
141
|
+
t: z.ZodLiteral<"source">;
|
|
142
|
+
sid: z.ZodString;
|
|
143
|
+
title: z.ZodString;
|
|
144
|
+
url: z.ZodOptional<z.ZodString>;
|
|
145
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
146
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
147
|
+
t: z.ZodLiteral<"data-provenance">;
|
|
148
|
+
producedAt: z.core.$ZodBranded<z.ZodString, "Instant", "out">;
|
|
149
|
+
model: z.ZodOptional<z.ZodString>;
|
|
150
|
+
sources: z.ZodOptional<z.ZodNumber>;
|
|
151
|
+
query: z.ZodOptional<z.ZodString>;
|
|
152
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
153
|
+
t: z.ZodLiteral<"budget-notice">;
|
|
154
|
+
exhausted: z.ZodBoolean;
|
|
155
|
+
resetsAt: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "Instant", "out">>;
|
|
156
|
+
}, z.core.$strip>], "t">, z.ZodObject<{
|
|
157
|
+
id: z.ZodNumber;
|
|
158
|
+
}, z.core.$strip>>>;
|
|
159
|
+
lastSeq: z.ZodNumber;
|
|
160
|
+
}, z.core.$strip>;
|
|
161
|
+
export type EventsPage = z.infer<typeof eventsPage>;
|
|
162
|
+
export declare const sendMessageInput: z.ZodObject<{
|
|
163
|
+
threadId: z.ZodString;
|
|
164
|
+
text: z.ZodDefault<z.ZodString>;
|
|
165
|
+
attachmentIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
166
|
+
}, z.core.$strip>;
|
|
167
|
+
export type SendMessageInput = z.input<typeof sendMessageInput>;
|
|
168
|
+
export declare const sentMessage: z.ZodObject<{
|
|
169
|
+
firstSeq: z.ZodNumber;
|
|
170
|
+
lastSeq: z.ZodNumber;
|
|
171
|
+
}, z.core.$strip>;
|
|
172
|
+
export type SentMessage = z.infer<typeof sentMessage>;
|
|
173
|
+
export declare const resolveApprovalInput: z.ZodObject<{
|
|
174
|
+
threadId: z.ZodString;
|
|
175
|
+
callId: z.ZodString;
|
|
176
|
+
digest: z.ZodString;
|
|
177
|
+
approved: z.ZodBoolean;
|
|
178
|
+
version: z.ZodString;
|
|
179
|
+
}, z.core.$strip>;
|
|
180
|
+
export type ResolveApprovalInput = z.infer<typeof resolveApprovalInput>;
|
|
181
|
+
export declare const resolvedApproval: z.ZodObject<{
|
|
182
|
+
seq: z.ZodNumber;
|
|
183
|
+
}, z.core.$strip>;
|
|
184
|
+
export declare const acquireRunInput: z.ZodObject<{
|
|
185
|
+
threadId: z.ZodString;
|
|
186
|
+
runId: z.ZodString;
|
|
187
|
+
staleMs: z.ZodOptional<z.ZodNumber>;
|
|
188
|
+
}, z.core.$strip>;
|
|
189
|
+
export type AcquireRunInput = z.infer<typeof acquireRunInput>;
|
|
190
|
+
export declare const acquiredRun: z.ZodObject<{
|
|
191
|
+
tookOver: z.ZodBoolean;
|
|
192
|
+
}, z.core.$strip>;
|
|
193
|
+
export declare const releaseRunInput: z.ZodObject<{
|
|
194
|
+
threadId: z.ZodString;
|
|
195
|
+
runId: z.ZodString;
|
|
196
|
+
}, z.core.$strip>;
|
|
197
|
+
export type ReleaseRunInput = z.infer<typeof releaseRunInput>;
|
|
198
|
+
export declare const releasedRun: z.ZodObject<{
|
|
199
|
+
released: z.ZodBoolean;
|
|
200
|
+
}, z.core.$strip>;
|
|
201
|
+
export declare const appendEventsInput: z.ZodObject<{
|
|
202
|
+
threadId: z.ZodString;
|
|
203
|
+
runId: z.ZodString;
|
|
204
|
+
events: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
205
|
+
t: z.ZodLiteral<"user-message">;
|
|
206
|
+
text: z.ZodString;
|
|
207
|
+
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
208
|
+
id: z.ZodString;
|
|
209
|
+
filename: z.ZodString;
|
|
210
|
+
contentType: z.ZodString;
|
|
211
|
+
size: z.ZodNumber;
|
|
212
|
+
sha256: z.ZodString;
|
|
213
|
+
}, z.core.$strip>>>;
|
|
214
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
215
|
+
t: z.ZodLiteral<"turn-start">;
|
|
216
|
+
v: z.ZodNumber;
|
|
217
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
218
|
+
t: z.ZodLiteral<"turn-finish">;
|
|
219
|
+
reason: z.ZodEnum<{
|
|
220
|
+
"awaiting-approval": "awaiting-approval";
|
|
221
|
+
budget: "budget";
|
|
222
|
+
done: "done";
|
|
223
|
+
stopped: "stopped";
|
|
224
|
+
}>;
|
|
225
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
226
|
+
t: z.ZodLiteral<"turn-error">;
|
|
227
|
+
code: z.ZodString;
|
|
228
|
+
message: z.ZodString;
|
|
229
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
230
|
+
t: z.ZodLiteral<"step-start">;
|
|
231
|
+
step: z.ZodString;
|
|
232
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
233
|
+
t: z.ZodLiteral<"step-end">;
|
|
234
|
+
step: z.ZodString;
|
|
235
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
236
|
+
t: z.ZodLiteral<"step-restart">;
|
|
237
|
+
step: z.ZodString;
|
|
238
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
239
|
+
pid: z.ZodString;
|
|
240
|
+
t: z.ZodLiteral<"text-start">;
|
|
241
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
242
|
+
pid: z.ZodString;
|
|
243
|
+
t: z.ZodLiteral<"text-delta">;
|
|
244
|
+
delta: z.ZodString;
|
|
245
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
246
|
+
pid: z.ZodString;
|
|
247
|
+
t: z.ZodLiteral<"text-end">;
|
|
248
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
249
|
+
t: z.ZodLiteral<"tool-input">;
|
|
250
|
+
callId: z.ZodString;
|
|
251
|
+
tool: z.ZodString;
|
|
252
|
+
input: z.ZodUnknown;
|
|
253
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
254
|
+
t: z.ZodLiteral<"tool-output">;
|
|
255
|
+
callId: z.ZodString;
|
|
256
|
+
tool: z.ZodString;
|
|
257
|
+
output: z.ZodOptional<z.ZodUnknown>;
|
|
258
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
259
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
260
|
+
t: z.ZodLiteral<"tool-error">;
|
|
261
|
+
callId: z.ZodString;
|
|
262
|
+
tool: z.ZodString;
|
|
263
|
+
message: z.ZodString;
|
|
264
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
265
|
+
t: z.ZodLiteral<"approval-request">;
|
|
266
|
+
callId: z.ZodString;
|
|
267
|
+
step: z.ZodString;
|
|
268
|
+
tool: z.ZodString;
|
|
269
|
+
operation: z.ZodString;
|
|
270
|
+
version: z.ZodString;
|
|
271
|
+
input: z.ZodUnknown;
|
|
272
|
+
expiresAt: z.core.$ZodBranded<z.ZodString, "Instant", "out">;
|
|
273
|
+
nonce: z.ZodString;
|
|
274
|
+
digest: z.ZodString;
|
|
275
|
+
preview: z.ZodString;
|
|
276
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
277
|
+
t: z.ZodLiteral<"approval-resolved">;
|
|
278
|
+
callId: z.ZodString;
|
|
279
|
+
approved: z.ZodBoolean;
|
|
280
|
+
approver: z.core.$ZodBranded<z.ZodString, "PrincipalId", "out">;
|
|
281
|
+
digest: z.ZodString;
|
|
282
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
283
|
+
t: z.ZodLiteral<"source">;
|
|
284
|
+
sid: z.ZodString;
|
|
285
|
+
title: z.ZodString;
|
|
286
|
+
url: z.ZodOptional<z.ZodString>;
|
|
287
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
288
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
289
|
+
t: z.ZodLiteral<"data-provenance">;
|
|
290
|
+
producedAt: z.core.$ZodBranded<z.ZodString, "Instant", "out">;
|
|
291
|
+
model: z.ZodOptional<z.ZodString>;
|
|
292
|
+
sources: z.ZodOptional<z.ZodNumber>;
|
|
293
|
+
query: z.ZodOptional<z.ZodString>;
|
|
294
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
295
|
+
t: z.ZodLiteral<"budget-notice">;
|
|
296
|
+
exhausted: z.ZodBoolean;
|
|
297
|
+
resetsAt: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "Instant", "out">>;
|
|
298
|
+
}, z.core.$strip>], "t">>;
|
|
299
|
+
}, z.core.$strip>;
|
|
300
|
+
export type AppendEventsInput = z.input<typeof appendEventsInput>;
|
|
301
|
+
export declare const appendedEvents: z.ZodObject<{
|
|
302
|
+
events: z.ZodArray<z.ZodIntersection<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
303
|
+
t: z.ZodLiteral<"user-message">;
|
|
304
|
+
text: z.ZodString;
|
|
305
|
+
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
306
|
+
id: z.ZodString;
|
|
307
|
+
filename: z.ZodString;
|
|
308
|
+
contentType: z.ZodString;
|
|
309
|
+
size: z.ZodNumber;
|
|
310
|
+
sha256: z.ZodString;
|
|
311
|
+
}, z.core.$strip>>>;
|
|
312
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
313
|
+
t: z.ZodLiteral<"turn-start">;
|
|
314
|
+
v: z.ZodNumber;
|
|
315
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
316
|
+
t: z.ZodLiteral<"turn-finish">;
|
|
317
|
+
reason: z.ZodEnum<{
|
|
318
|
+
"awaiting-approval": "awaiting-approval";
|
|
319
|
+
budget: "budget";
|
|
320
|
+
done: "done";
|
|
321
|
+
stopped: "stopped";
|
|
322
|
+
}>;
|
|
323
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
324
|
+
t: z.ZodLiteral<"turn-error">;
|
|
325
|
+
code: z.ZodString;
|
|
326
|
+
message: z.ZodString;
|
|
327
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
328
|
+
t: z.ZodLiteral<"step-start">;
|
|
329
|
+
step: z.ZodString;
|
|
330
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
331
|
+
t: z.ZodLiteral<"step-end">;
|
|
332
|
+
step: z.ZodString;
|
|
333
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
334
|
+
t: z.ZodLiteral<"step-restart">;
|
|
335
|
+
step: z.ZodString;
|
|
336
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
337
|
+
pid: z.ZodString;
|
|
338
|
+
t: z.ZodLiteral<"text-start">;
|
|
339
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
340
|
+
pid: z.ZodString;
|
|
341
|
+
t: z.ZodLiteral<"text-delta">;
|
|
342
|
+
delta: z.ZodString;
|
|
343
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
344
|
+
pid: z.ZodString;
|
|
345
|
+
t: z.ZodLiteral<"text-end">;
|
|
346
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
347
|
+
t: z.ZodLiteral<"tool-input">;
|
|
348
|
+
callId: z.ZodString;
|
|
349
|
+
tool: z.ZodString;
|
|
350
|
+
input: z.ZodUnknown;
|
|
351
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
352
|
+
t: z.ZodLiteral<"tool-output">;
|
|
353
|
+
callId: z.ZodString;
|
|
354
|
+
tool: z.ZodString;
|
|
355
|
+
output: z.ZodOptional<z.ZodUnknown>;
|
|
356
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
357
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
358
|
+
t: z.ZodLiteral<"tool-error">;
|
|
359
|
+
callId: z.ZodString;
|
|
360
|
+
tool: z.ZodString;
|
|
361
|
+
message: z.ZodString;
|
|
362
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
363
|
+
t: z.ZodLiteral<"approval-request">;
|
|
364
|
+
callId: z.ZodString;
|
|
365
|
+
step: z.ZodString;
|
|
366
|
+
tool: z.ZodString;
|
|
367
|
+
operation: z.ZodString;
|
|
368
|
+
version: z.ZodString;
|
|
369
|
+
input: z.ZodUnknown;
|
|
370
|
+
expiresAt: z.core.$ZodBranded<z.ZodString, "Instant", "out">;
|
|
371
|
+
nonce: z.ZodString;
|
|
372
|
+
digest: z.ZodString;
|
|
373
|
+
preview: z.ZodString;
|
|
374
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
375
|
+
t: z.ZodLiteral<"approval-resolved">;
|
|
376
|
+
callId: z.ZodString;
|
|
377
|
+
approved: z.ZodBoolean;
|
|
378
|
+
approver: z.core.$ZodBranded<z.ZodString, "PrincipalId", "out">;
|
|
379
|
+
digest: z.ZodString;
|
|
380
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
381
|
+
t: z.ZodLiteral<"source">;
|
|
382
|
+
sid: z.ZodString;
|
|
383
|
+
title: z.ZodString;
|
|
384
|
+
url: z.ZodOptional<z.ZodString>;
|
|
385
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
386
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
387
|
+
t: z.ZodLiteral<"data-provenance">;
|
|
388
|
+
producedAt: z.core.$ZodBranded<z.ZodString, "Instant", "out">;
|
|
389
|
+
model: z.ZodOptional<z.ZodString>;
|
|
390
|
+
sources: z.ZodOptional<z.ZodNumber>;
|
|
391
|
+
query: z.ZodOptional<z.ZodString>;
|
|
392
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
393
|
+
t: z.ZodLiteral<"budget-notice">;
|
|
394
|
+
exhausted: z.ZodBoolean;
|
|
395
|
+
resetsAt: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "Instant", "out">>;
|
|
396
|
+
}, z.core.$strip>], "t">, z.ZodObject<{
|
|
397
|
+
id: z.ZodNumber;
|
|
398
|
+
}, z.core.$strip>>>;
|
|
399
|
+
}, z.core.$strip>;
|
|
400
|
+
export type AppendedEvents = z.infer<typeof appendedEvents>;
|
|
401
|
+
export declare const claimExecutionInput: z.ZodObject<{
|
|
402
|
+
threadId: z.ZodString;
|
|
403
|
+
runId: z.ZodString;
|
|
404
|
+
callId: z.ZodString;
|
|
405
|
+
operation: z.ZodString;
|
|
406
|
+
version: z.ZodString;
|
|
407
|
+
input: z.ZodUnknown;
|
|
408
|
+
}, z.core.$strip>;
|
|
409
|
+
export type ClaimExecutionInput = z.infer<typeof claimExecutionInput>;
|
|
410
|
+
export declare const claimedExecution: z.ZodObject<{
|
|
411
|
+
claimed: z.ZodLiteral<true>;
|
|
412
|
+
}, z.core.$strip>;
|
|
413
|
+
//# sourceMappingURL=shapes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shapes.d.ts","sourceRoot":"","sources":["../src/shapes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,yBAAyB,CAAC;AAG5C;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAY,CAAC;AAEzC;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,QAAY,CAAC;AAE3C,qGAAqG;AACrG,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAO5C;AAOD,6BAA6B;AAC7B,eAAO,MAAM,MAAM;;;;;;;;;;;iBASjB,CAAC;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC;AAE5C,eAAO,MAAM,iBAAiB;;iBAAsD,CAAC;AACrF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE,eAAO,MAAM,gBAAgB;;;;;;iBAI3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE,eAAO,MAAM,aAAa;;iBAAyB,CAAC;AACpD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D,0EAA0E;AAC1E,eAAO,MAAM,e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