@workser/runtime 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 +71 -2
- package/dist/cjs/client/follow.js +103 -0
- package/dist/cjs/client/index.js +6 -0
- package/dist/cjs/contract/actions.js +223 -0
- package/dist/cjs/contract/catalog.js +335 -0
- package/dist/cjs/contract/index.js +20 -0
- package/dist/cjs/contract/ordered-feed.js +94 -0
- package/dist/cjs/contract/types.js +9 -0
- package/dist/cjs/engine/engine.js +2 -0
- package/dist/cjs/index.js +27 -0
- package/dist/cjs/internal/async-queue.js +56 -0
- package/dist/cjs/internal/sse.js +170 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/place/place.js +2 -0
- package/dist/cjs/runner/index.js +6 -0
- package/dist/cjs/runner/journal.js +82 -0
- package/dist/cjs/runner/runner-client.js +477 -0
- package/dist/client/follow.d.ts +45 -0
- package/dist/client/follow.js +100 -0
- package/dist/client/follow.js.map +1 -0
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.js +2 -0
- package/dist/client/index.js.map +1 -0
- package/dist/contract/actions.d.ts +73 -0
- package/dist/contract/actions.js +217 -0
- package/dist/contract/actions.js.map +1 -0
- package/dist/contract/catalog.d.ts +97 -0
- package/dist/contract/catalog.js +328 -0
- package/dist/contract/catalog.js.map +1 -0
- package/dist/contract/index.d.ts +4 -0
- package/dist/contract/index.js +5 -0
- package/dist/contract/index.js.map +1 -0
- package/dist/contract/ordered-feed.d.ts +56 -0
- package/dist/contract/ordered-feed.js +91 -0
- package/dist/contract/ordered-feed.js.map +1 -0
- package/dist/contract/types.d.ts +311 -0
- package/dist/contract/types.js +9 -0
- package/dist/contract/types.js.map +1 -0
- package/dist/engine/engine.d.ts +39 -0
- package/dist/engine/engine.js +2 -0
- package/dist/engine/engine.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/async-queue.d.ts +14 -0
- package/dist/internal/async-queue.js +53 -0
- package/dist/internal/async-queue.js.map +1 -0
- package/dist/internal/sse.d.ts +57 -0
- package/dist/internal/sse.js +164 -0
- package/dist/internal/sse.js.map +1 -0
- package/dist/place/place.d.ts +81 -0
- package/dist/place/place.js +2 -0
- package/dist/place/place.js.map +1 -0
- package/dist/runner/index.d.ts +2 -0
- package/dist/runner/index.js +2 -0
- package/dist/runner/index.js.map +1 -0
- package/dist/runner/journal.d.ts +32 -0
- package/dist/runner/journal.js +79 -0
- package/dist/runner/journal.js.map +1 -0
- package/dist/runner/runner-client.d.ts +185 -0
- package/dist/runner/runner-client.js +473 -0
- package/dist/runner/runner-client.js.map +1 -0
- package/package.json +30 -4
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* COMPUTER ACTIONS — one list for every place an AI agent works a computer
|
|
3
|
+
* (workforce standardization phase 5): the owner's own computer (`desktop`),
|
|
4
|
+
* the project's cloud computer and the cloud browser.
|
|
5
|
+
*
|
|
6
|
+
* Each action has one id, one argument schema, and says:
|
|
7
|
+
* - which places can do it,
|
|
8
|
+
* - whether it changes anything (the owner may be asked first),
|
|
9
|
+
* - whether the owner's computer can do it behind their windows, without
|
|
10
|
+
* taking their screen. Jev decides background or screen; this only says
|
|
11
|
+
* what is possible. Background is preferred so the person keeps their
|
|
12
|
+
* screen.
|
|
13
|
+
*
|
|
14
|
+
* Actions are general: no per-app recipes. Jev finds an app's specifics on
|
|
15
|
+
* screen.
|
|
16
|
+
*
|
|
17
|
+
* A tool a model calls is named by place and action, `<prefix>_<action>`
|
|
18
|
+
* (`computer_click_at`, `browser_open_url`, `desktop_type`), so one run that
|
|
19
|
+
* holds both a cloud computer and a cloud browser never has two tools of the
|
|
20
|
+
* same name. Every older name (the desktop planner's steps, the local
|
|
21
|
+
* runner's `desktop_action`, the cloud computer's and both cloud browser
|
|
22
|
+
* tool sets, Jev's operations) is an alias: `resolveComputerTool` reads any
|
|
23
|
+
* of them.
|
|
24
|
+
*/
|
|
25
|
+
import type { RunPlace } from './types.js';
|
|
26
|
+
/** The places that work a computer. */
|
|
27
|
+
export type ActionPlace = Extract<RunPlace, 'desktop' | 'cloud_computer' | 'cloud_browser'>;
|
|
28
|
+
export declare const ACTION_PLACES: readonly ActionPlace[];
|
|
29
|
+
export type ComputerActionId = 'open_app' | 'open_url' | 'click' | 'click_at' | 'type' | 'set_value' | 'press' | 'scroll' | 'select' | 'hover' | 'drag' | 'menu' | 'look' | 'read' | 'wait' | 'wait_for' | 'clipboard_read' | 'clipboard_write' | 'fill_secret' | 'record_clip';
|
|
30
|
+
export interface ComputerAction {
|
|
31
|
+
id: ComputerActionId;
|
|
32
|
+
description: string;
|
|
33
|
+
places: readonly ActionPlace[];
|
|
34
|
+
/** Changes something (types, clicks, opens): approval rules may apply. */
|
|
35
|
+
side_effect: boolean;
|
|
36
|
+
/** The owner's computer can do it behind their windows, without their screen. */
|
|
37
|
+
background: boolean;
|
|
38
|
+
/** JSON Schema for the arguments. */
|
|
39
|
+
input_schema: Record<string, unknown>;
|
|
40
|
+
}
|
|
41
|
+
export declare const COMPUTER_ACTIONS: Readonly<Record<ComputerActionId, ComputerAction>>;
|
|
42
|
+
export declare const COMPUTER_ACTION_IDS: ComputerActionId[];
|
|
43
|
+
/** The tool name a model calls: `computer_click_at`, `browser_open_url`, `desktop_type`. */
|
|
44
|
+
export declare function computerToolName(place: ActionPlace, action: ComputerActionId): string;
|
|
45
|
+
/** Older names, read as an action at a place. A bare desktop planner step name is read in `resolveComputerTool`. */
|
|
46
|
+
export declare const COMPUTER_TOOL_ALIASES: Readonly<Record<string, {
|
|
47
|
+
place: ActionPlace | null;
|
|
48
|
+
action: ComputerActionId;
|
|
49
|
+
}>>;
|
|
50
|
+
export interface ResolvedComputerTool {
|
|
51
|
+
/** null: a name with no place (a Jev operation, or a bare action id). */
|
|
52
|
+
place: ActionPlace | null;
|
|
53
|
+
action: ComputerActionId;
|
|
54
|
+
/** The name was an older one. */
|
|
55
|
+
alias: boolean;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Any name a computer action has gone by, read as one action. `input` is
|
|
59
|
+
* needed only for the local runner's `desktop_action`, which names the
|
|
60
|
+
* action in its arguments. Null: not a computer action (files, shell, apps).
|
|
61
|
+
*/
|
|
62
|
+
export declare function resolveComputerTool(name: string, input?: Record<string, unknown> | null): ResolvedComputerTool | null;
|
|
63
|
+
/**
|
|
64
|
+
* Arguments in the list's shape, from any older shape: keys as a string
|
|
65
|
+
* ("cmd+s") or array, Jev's SCROLL_UP/SCROLL_DOWN, `element`/`selector` for
|
|
66
|
+
* the target, `application`/`uri` for an app.
|
|
67
|
+
*/
|
|
68
|
+
export declare function normalizeActionInput(action: ComputerActionId, input: Record<string, unknown> | null | undefined, name?: string): Record<string, unknown>;
|
|
69
|
+
/**
|
|
70
|
+
* Whether this action can run without the owner's screen at this place. The
|
|
71
|
+
* cloud computer and the cloud browser are never the owner's screen.
|
|
72
|
+
*/
|
|
73
|
+
export declare function runsWithoutOwnerScreen(action: ComputerActionId, place: ActionPlace): boolean;
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
export const ACTION_PLACES = ['desktop', 'cloud_computer', 'cloud_browser'];
|
|
2
|
+
const obj = (properties, required = []) => ({
|
|
3
|
+
type: 'object',
|
|
4
|
+
properties,
|
|
5
|
+
...(required.length ? { required } : {}),
|
|
6
|
+
additionalProperties: false,
|
|
7
|
+
});
|
|
8
|
+
const str = (description) => ({ type: 'string', description });
|
|
9
|
+
const num = (description) => ({ type: 'number', description });
|
|
10
|
+
/** What to act on: an element id from the last look/read, or its words. */
|
|
11
|
+
const TARGET = str('The element to act on: its id from the last look or read, or its visible label');
|
|
12
|
+
const APP = str('The app it is in (the owner\'s computer); omit for the front window');
|
|
13
|
+
const ALL = ['desktop', 'cloud_computer', 'cloud_browser'];
|
|
14
|
+
export const COMPUTER_ACTIONS = {
|
|
15
|
+
open_app: {
|
|
16
|
+
id: 'open_app', description: 'Open an app, or bring it forward.', places: ['desktop', 'cloud_computer'],
|
|
17
|
+
side_effect: true, background: true, input_schema: obj({ app: str('The app\'s name'), target: str('A file or address to open in it') }, ['app']),
|
|
18
|
+
},
|
|
19
|
+
open_url: {
|
|
20
|
+
id: 'open_url', description: 'Open a web address.', places: ALL,
|
|
21
|
+
side_effect: true, background: true, input_schema: obj({ url: str('The address') }, ['url']),
|
|
22
|
+
},
|
|
23
|
+
click: {
|
|
24
|
+
id: 'click', description: 'Click an element.', places: ['desktop', 'cloud_browser'],
|
|
25
|
+
side_effect: true, background: true, input_schema: obj({ target: TARGET, app: APP, double: { type: 'boolean' }, right: { type: 'boolean' } }, ['target']),
|
|
26
|
+
},
|
|
27
|
+
click_at: {
|
|
28
|
+
id: 'click_at', description: 'Click a point on the screen.', places: ['desktop', 'cloud_computer'],
|
|
29
|
+
// A point is on the screen: behind the owner's windows it has no meaning.
|
|
30
|
+
side_effect: true, background: false, input_schema: obj({ x: num('Pixels from the left'), y: num('Pixels from the top'), double: { type: 'boolean' } }, ['x', 'y']),
|
|
31
|
+
},
|
|
32
|
+
type: {
|
|
33
|
+
id: 'type', description: 'Type text, into an element or where the cursor is.', places: ALL,
|
|
34
|
+
side_effect: true, background: true, input_schema: obj({ text: str('What to type'), target: TARGET, app: APP, submit: { type: 'boolean', description: 'Press Enter after' } }, ['text']),
|
|
35
|
+
},
|
|
36
|
+
set_value: {
|
|
37
|
+
id: 'set_value', description: 'Set a field\'s value directly.', places: ['desktop', 'cloud_browser'],
|
|
38
|
+
side_effect: true, background: true, input_schema: obj({ target: TARGET, value: str('The value'), app: APP }, ['target', 'value']),
|
|
39
|
+
},
|
|
40
|
+
press: {
|
|
41
|
+
id: 'press', description: 'Press keys together, like ["cmd", "s"].', places: ALL,
|
|
42
|
+
side_effect: true, background: true, input_schema: obj({ keys: { type: 'array', items: { type: 'string' }, minItems: 1 }, app: APP }, ['keys']),
|
|
43
|
+
},
|
|
44
|
+
scroll: {
|
|
45
|
+
id: 'scroll', description: 'Scroll a window or element.', places: ALL,
|
|
46
|
+
side_effect: false, background: true,
|
|
47
|
+
input_schema: obj({ direction: { type: 'string', enum: ['up', 'down', 'left', 'right'] }, amount: { type: 'number', minimum: 1, maximum: 20 }, target: TARGET, app: APP }, ['direction']),
|
|
48
|
+
},
|
|
49
|
+
select: {
|
|
50
|
+
id: 'select', description: 'Choose an option in a list.', places: ['desktop', 'cloud_browser'],
|
|
51
|
+
side_effect: true, background: true, input_schema: obj({ target: TARGET, value: str('The option'), app: APP }, ['target', 'value']),
|
|
52
|
+
},
|
|
53
|
+
hover: {
|
|
54
|
+
id: 'hover', description: 'Point at an element without clicking.', places: ['desktop'],
|
|
55
|
+
side_effect: false, background: true, input_schema: obj({ target: TARGET, app: APP }, ['target']),
|
|
56
|
+
},
|
|
57
|
+
drag: {
|
|
58
|
+
id: 'drag', description: 'Drag from one element or point to another.', places: ['desktop'],
|
|
59
|
+
side_effect: true, background: true, input_schema: obj({ from: TARGET, to: TARGET, app: APP }, ['from', 'to']),
|
|
60
|
+
},
|
|
61
|
+
menu: {
|
|
62
|
+
id: 'menu', description: 'Choose a menu item by its path, like ["File", "Export…"].', places: ['desktop'],
|
|
63
|
+
side_effect: true, background: true, input_schema: obj({ path: { type: 'array', items: { type: 'string' }, minItems: 1 }, app: APP }, ['path']),
|
|
64
|
+
},
|
|
65
|
+
look: {
|
|
66
|
+
id: 'look', description: 'See the screen or one window (a picture).', places: ALL,
|
|
67
|
+
side_effect: false, background: true, input_schema: obj({ app: APP, window: str('Which window') }),
|
|
68
|
+
},
|
|
69
|
+
read: {
|
|
70
|
+
id: 'read', description: 'Read a window\'s or page\'s text and elements.', places: ALL,
|
|
71
|
+
side_effect: false, background: true, input_schema: obj({ app: APP, target: TARGET }),
|
|
72
|
+
},
|
|
73
|
+
wait: {
|
|
74
|
+
id: 'wait', description: 'Wait a few seconds.', places: ALL,
|
|
75
|
+
side_effect: false, background: true, input_schema: obj({ seconds: { type: 'number', minimum: 0, maximum: 60 } }, ['seconds']),
|
|
76
|
+
},
|
|
77
|
+
wait_for: {
|
|
78
|
+
id: 'wait_for', description: 'Wait until something shows up.', places: ['desktop', 'cloud_browser'],
|
|
79
|
+
side_effect: false, background: true, input_schema: obj({ text: str('Words to wait for'), target: TARGET, seconds: { type: 'number', minimum: 1, maximum: 120 } }),
|
|
80
|
+
},
|
|
81
|
+
clipboard_read: {
|
|
82
|
+
id: 'clipboard_read', description: 'Read the clipboard.', places: ['desktop'],
|
|
83
|
+
// The clipboard is the owner's: there is only one, shared with them.
|
|
84
|
+
side_effect: false, background: false, input_schema: obj({}),
|
|
85
|
+
},
|
|
86
|
+
clipboard_write: {
|
|
87
|
+
id: 'clipboard_write', description: 'Put text on the clipboard.', places: ['desktop'],
|
|
88
|
+
side_effect: true, background: false, input_schema: obj({ text: str('The text') }, ['text']),
|
|
89
|
+
},
|
|
90
|
+
fill_secret: {
|
|
91
|
+
id: 'fill_secret', description: 'Type a saved sign-in into the focused field, without seeing it.', places: ['cloud_computer', 'cloud_browser'],
|
|
92
|
+
side_effect: true, background: true,
|
|
93
|
+
input_schema: obj({ name: str('The saved sign-in'), field: { type: 'string', enum: ['username', 'password', 'totp', 'value'] } }, ['name', 'field']),
|
|
94
|
+
},
|
|
95
|
+
record_clip: {
|
|
96
|
+
id: 'record_clip', description: 'Record a short clip of the screen.', places: ['desktop', 'cloud_computer'],
|
|
97
|
+
side_effect: false, background: false, input_schema: obj({ seconds: { type: 'number', minimum: 1, maximum: 120 } }),
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
export const COMPUTER_ACTION_IDS = Object.keys(COMPUTER_ACTIONS);
|
|
101
|
+
const PREFIX = { desktop: 'desktop', cloud_computer: 'computer', cloud_browser: 'browser' };
|
|
102
|
+
/** The tool name a model calls: `computer_click_at`, `browser_open_url`, `desktop_type`. */
|
|
103
|
+
export function computerToolName(place, action) {
|
|
104
|
+
return `${PREFIX[place]}_${action}`;
|
|
105
|
+
}
|
|
106
|
+
/** Older names, read as an action at a place. A bare desktop planner step name is read in `resolveComputerTool`. */
|
|
107
|
+
export const COMPUTER_TOOL_ALIASES = {
|
|
108
|
+
// The cloud computer's names before the list.
|
|
109
|
+
computer_open: { place: 'cloud_computer', action: 'open_app' },
|
|
110
|
+
computer_click: { place: 'cloud_computer', action: 'click_at' },
|
|
111
|
+
computer_screenshot: { place: 'cloud_computer', action: 'look' },
|
|
112
|
+
computer_observe_ax: { place: 'cloud_computer', action: 'read' },
|
|
113
|
+
// The cloud browser (both tool sets).
|
|
114
|
+
browser_open: { place: 'cloud_browser', action: 'open_url' },
|
|
115
|
+
browser_navigate: { place: 'cloud_browser', action: 'open_url' },
|
|
116
|
+
browser_screenshot: { place: 'cloud_browser', action: 'look' },
|
|
117
|
+
browser_get_content: { place: 'cloud_browser', action: 'read' },
|
|
118
|
+
browser_press_keys: { place: 'cloud_browser', action: 'press' },
|
|
119
|
+
browser_fill_form: { place: 'cloud_browser', action: 'set_value' },
|
|
120
|
+
fill_login: { place: 'cloud_browser', action: 'fill_secret' },
|
|
121
|
+
// The desktop: planner steps that are another action's twin, and the local runner.
|
|
122
|
+
look_window: { place: 'desktop', action: 'look' },
|
|
123
|
+
record_session: { place: 'desktop', action: 'record_clip' },
|
|
124
|
+
desktop_see: { place: 'desktop', action: 'look' },
|
|
125
|
+
// Jev's operations (any place).
|
|
126
|
+
CLICK: { place: null, action: 'click' },
|
|
127
|
+
TYPE_TEXT: { place: null, action: 'type' },
|
|
128
|
+
SELECT: { place: null, action: 'select' },
|
|
129
|
+
KEY_PRESS: { place: null, action: 'press' },
|
|
130
|
+
SCROLL_DOWN: { place: null, action: 'scroll' },
|
|
131
|
+
SCROLL_UP: { place: null, action: 'scroll' },
|
|
132
|
+
NAVIGATE: { place: null, action: 'open_url' },
|
|
133
|
+
OPEN_APP: { place: null, action: 'open_app' },
|
|
134
|
+
WAIT: { place: null, action: 'wait' },
|
|
135
|
+
};
|
|
136
|
+
const isAction = (value) => typeof value === 'string' && Object.prototype.hasOwnProperty.call(COMPUTER_ACTIONS, value);
|
|
137
|
+
/**
|
|
138
|
+
* Any name a computer action has gone by, read as one action. `input` is
|
|
139
|
+
* needed only for the local runner's `desktop_action`, which names the
|
|
140
|
+
* action in its arguments. Null: not a computer action (files, shell, apps).
|
|
141
|
+
*/
|
|
142
|
+
export function resolveComputerTool(name, input) {
|
|
143
|
+
if (typeof name !== 'string' || !name)
|
|
144
|
+
return null;
|
|
145
|
+
if (name === 'desktop_action') {
|
|
146
|
+
const action = input?.action;
|
|
147
|
+
return isAction(action) ? { place: 'desktop', action, alias: true } : null;
|
|
148
|
+
}
|
|
149
|
+
const alias = COMPUTER_TOOL_ALIASES[name];
|
|
150
|
+
if (alias)
|
|
151
|
+
return { ...alias, alias: true };
|
|
152
|
+
for (const place of ACTION_PLACES) {
|
|
153
|
+
const prefix = `${PREFIX[place]}_`;
|
|
154
|
+
if (name.startsWith(prefix)) {
|
|
155
|
+
const action = name.slice(prefix.length);
|
|
156
|
+
if (isAction(action) && COMPUTER_ACTIONS[action].places.includes(place))
|
|
157
|
+
return { place, action, alias: false };
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
// A bare id: the desktop planner's own step names are the action ids.
|
|
161
|
+
if (isAction(name))
|
|
162
|
+
return { place: null, action: name, alias: false };
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Arguments in the list's shape, from any older shape: keys as a string
|
|
167
|
+
* ("cmd+s") or array, Jev's SCROLL_UP/SCROLL_DOWN, `element`/`selector` for
|
|
168
|
+
* the target, `application`/`uri` for an app.
|
|
169
|
+
*/
|
|
170
|
+
export function normalizeActionInput(action, input, name) {
|
|
171
|
+
const out = { ...(input ?? {}) };
|
|
172
|
+
if (action === 'press' && out.keys !== undefined) {
|
|
173
|
+
const keys = out.keys;
|
|
174
|
+
out.keys = Array.isArray(keys)
|
|
175
|
+
? keys.map(String)
|
|
176
|
+
: String(keys).split('+').map((one) => one.trim()).filter(Boolean);
|
|
177
|
+
}
|
|
178
|
+
if (action === 'scroll' && out.direction === undefined) {
|
|
179
|
+
if (name === 'SCROLL_UP')
|
|
180
|
+
out.direction = 'up';
|
|
181
|
+
if (name === 'SCROLL_DOWN')
|
|
182
|
+
out.direction = 'down';
|
|
183
|
+
}
|
|
184
|
+
if (out.target === undefined) {
|
|
185
|
+
const element = out.element ?? out.selector;
|
|
186
|
+
if (element !== undefined) {
|
|
187
|
+
out.target = String(element);
|
|
188
|
+
delete out.element;
|
|
189
|
+
delete out.selector;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
if (action === 'open_app') {
|
|
193
|
+
if (out.app === undefined && out.application !== undefined) {
|
|
194
|
+
out.app = out.application;
|
|
195
|
+
delete out.application;
|
|
196
|
+
}
|
|
197
|
+
if (out.target === undefined && out.uri !== undefined) {
|
|
198
|
+
out.target = out.uri;
|
|
199
|
+
delete out.uri;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
if (action === 'open_url' && out.url === undefined && typeof out.target === 'string') {
|
|
203
|
+
out.url = out.target;
|
|
204
|
+
delete out.target;
|
|
205
|
+
}
|
|
206
|
+
return out;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Whether this action can run without the owner's screen at this place. The
|
|
210
|
+
* cloud computer and the cloud browser are never the owner's screen.
|
|
211
|
+
*/
|
|
212
|
+
export function runsWithoutOwnerScreen(action, place) {
|
|
213
|
+
if (place !== 'desktop')
|
|
214
|
+
return true;
|
|
215
|
+
return COMPUTER_ACTIONS[action].background;
|
|
216
|
+
}
|
|
217
|
+
//# sourceMappingURL=actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../src/contract/actions.ts"],"names":[],"mappings":"AA4BA,MAAM,CAAC,MAAM,aAAa,GAA2B,CAAC,SAAS,EAAE,gBAAgB,EAAE,eAAe,CAAC,CAAC;AAoCpG,M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,GAAG,CAAC,MAAM,KAAK,SAAS,IAAI,GAAG,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;YACtD,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC;YACrB,OAAO,GAAG,CAAC,GAAG,CAAC;QACjB,CAAC;IACH,CAAC;IACD,IAAI,MAAM,KAAK,UAAU,IAAI,GAAG,CAAC,GAAG,KAAK,SAAS,IAAI,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QACrF,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC;QACrB,OAAO,GAAG,CAAC,MAAM,CAAC;IACpB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAwB,EAAE,KAAkB;IACjF,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACrC,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The run event catalog: every event a runner may send, and what it must
|
|
3
|
+
* carry. Pure and dependency-free: this file is the source of truth in
|
|
4
|
+
* `@workser/runtime`, and core-api keeps a generated copy of it (plan Phase 0).
|
|
5
|
+
*
|
|
6
|
+
* TWO GATES, ON PURPOSE
|
|
7
|
+
* ---------------------
|
|
8
|
+
* - A runner (`v1/runner/runs/:id/events`) is strict: an unknown type or a
|
|
9
|
+
* malformed payload is refused, so a screen never has to guess what an event
|
|
10
|
+
* means.
|
|
11
|
+
* - The service engine (`internal/runs/:id/events`) is lenient: it already
|
|
12
|
+
* sends ~30 types, some built at runtime, and refusing one would lose a live
|
|
13
|
+
* run's history. Unknown types are accepted and counted (`unknownLegacyType`)
|
|
14
|
+
* so the catalog can grow to cover them before that gate tightens.
|
|
15
|
+
*/
|
|
16
|
+
export declare const RUNNER_PROTOCOL_VERSION = 1;
|
|
17
|
+
/** Largest event payload we keep, serialised. Bigger outputs go to files. */
|
|
18
|
+
export declare const MAX_EVENT_DATA_BYTES: number;
|
|
19
|
+
/** Largest batch a runner may send in one call. */
|
|
20
|
+
export declare const MAX_EVENT_BATCH = 100;
|
|
21
|
+
type FieldType = 'string' | 'number' | 'boolean' | 'object' | 'array';
|
|
22
|
+
interface FieldRule {
|
|
23
|
+
type: FieldType;
|
|
24
|
+
required?: boolean;
|
|
25
|
+
oneOf?: readonly string[];
|
|
26
|
+
maxLength?: number;
|
|
27
|
+
}
|
|
28
|
+
type Shape = Record<string, FieldRule>;
|
|
29
|
+
/**
|
|
30
|
+
* What each event means, for the people reading it on a screen:
|
|
31
|
+
*
|
|
32
|
+
* - run.* the run's life. Terminal ones end the stream.
|
|
33
|
+
* - step.* one thing the agent did (a command, an edit, a tool call).
|
|
34
|
+
* - message* what the agent said; `.delta` streams it as it is written.
|
|
35
|
+
* - file/diff what changed on disk.
|
|
36
|
+
* - check.result a done-check (tests, typecheck, deck validates, numbers match).
|
|
37
|
+
* - preview.ready a URL the owner can open.
|
|
38
|
+
* - handoff.* a sub-job this run asked for started or ended (core-api
|
|
39
|
+
* writes these on the parent; `run.completed.result` is the
|
|
40
|
+
* child's typed answer).
|
|
41
|
+
* - usage tokens and cost as the runner saw them; billing uses the
|
|
42
|
+
* gateway's own figure, never this one.
|
|
43
|
+
* - log plain lines for the details view.
|
|
44
|
+
*/
|
|
45
|
+
export declare const RUN_EVENT_CATALOG: Readonly<Record<string, Shape>>;
|
|
46
|
+
/** Events that end a run. The stream closes after it delivers one. */
|
|
47
|
+
export declare const TERMINAL_EVENT_TYPES: ReadonlySet<string>;
|
|
48
|
+
/**
|
|
49
|
+
* Types the service engine sends today that aren't runner events. Accepted on
|
|
50
|
+
* the lenient gate without being counted as unknown.
|
|
51
|
+
*/
|
|
52
|
+
export declare const LEGACY_EVENT_TYPES: ReadonlySet<string>;
|
|
53
|
+
export interface RunnerEventInput {
|
|
54
|
+
event_id: string;
|
|
55
|
+
seq: number;
|
|
56
|
+
type: string;
|
|
57
|
+
data?: unknown;
|
|
58
|
+
}
|
|
59
|
+
/** `reason` is set when `ok` is false. (One shape: the repo builds without strictNullChecks, where a union wouldn't narrow.) */
|
|
60
|
+
export interface EventCheck {
|
|
61
|
+
ok: boolean;
|
|
62
|
+
reason?: string;
|
|
63
|
+
}
|
|
64
|
+
/** Is this a well-formed runner event? The strict gate. */
|
|
65
|
+
export declare function checkRunnerEvent(event: RunnerEventInput): EventCheck;
|
|
66
|
+
/** The lenient gate: only the envelope is checked. */
|
|
67
|
+
export declare function checkLegacyEvent(event: {
|
|
68
|
+
event_id?: unknown;
|
|
69
|
+
event_type?: unknown;
|
|
70
|
+
seq?: unknown;
|
|
71
|
+
}): EventCheck;
|
|
72
|
+
/** A type neither in the catalog nor in the known legacy list. */
|
|
73
|
+
export declare function unknownLegacyType(type: string): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* The run status a runner event moves the run to, or null when it doesn't.
|
|
76
|
+
* Status only moves forward: a terminal run never changes again.
|
|
77
|
+
*/
|
|
78
|
+
export declare function statusForRunnerEvent(type: string): 'RUNNING' | 'COMPLETED' | 'FAILED' | 'CANCELLED' | null;
|
|
79
|
+
/** When `ok`: `fresh` and `nextCursor`. When not: `expected` and `reason`. */
|
|
80
|
+
export interface BatchSeqCheck {
|
|
81
|
+
ok: boolean;
|
|
82
|
+
fresh?: RunnerEventInput[];
|
|
83
|
+
nextCursor?: number;
|
|
84
|
+
expected?: number;
|
|
85
|
+
reason?: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Check a runner batch against the run's cursor (the last seq accepted).
|
|
89
|
+
*
|
|
90
|
+
* Events at or below the cursor are retries and are dropped here — their
|
|
91
|
+
* `event_id` is checked against the stored row by the caller. What remains
|
|
92
|
+
* must continue the cursor exactly: `cursor+1, cursor+2, …`. A gap means the
|
|
93
|
+
* runner lost an event, and it is told where to resend from rather than
|
|
94
|
+
* having the hole papered over.
|
|
95
|
+
*/
|
|
96
|
+
export declare function checkBatchSeq(cursor: number, events: RunnerEventInput[]): BatchSeqCheck;
|
|
97
|
+
export {};
|