@yaks/machine 0.0.0-stage → 0.2.36
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 +202 -0
- package/README.md +243 -2
- package/_dist/comp.d.ts +5 -0
- package/_dist/comp.d.ts.map +1 -0
- package/_dist/connectors.d.ts +29 -0
- package/_dist/connectors.d.ts.map +1 -0
- package/_dist/effects.d.ts +5 -0
- package/_dist/effects.d.ts.map +1 -0
- package/_dist/execution.d.ts +6 -0
- package/_dist/execution.d.ts.map +1 -0
- package/_dist/graph.d.ts +4 -0
- package/_dist/graph.d.ts.map +1 -0
- package/_dist/mod.d.ts +12 -0
- package/_dist/mod.d.ts.map +1 -0
- package/_dist/recorded.d.ts +4 -0
- package/_dist/recorded.d.ts.map +1 -0
- package/_dist/room.d.ts +45 -0
- package/_dist/room.d.ts.map +1 -0
- package/_dist/targets.d.ts +27 -0
- package/_dist/targets.d.ts.map +1 -0
- package/_dist/tools.d.ts +51 -0
- package/_dist/tools.d.ts.map +1 -0
- package/_dist/vocab.d.ts +5 -0
- package/_dist/vocab.d.ts.map +1 -0
- package/_dist/workspace.d.ts +64 -0
- package/_dist/workspace.d.ts.map +1 -0
- package/_dist/workspaces.d.ts +10 -0
- package/_dist/workspaces.d.ts.map +1 -0
- package/comp.js +3 -0
- package/comp.js.map +1 -0
- package/comp.ts +3 -0
- package/connectors.js +149 -0
- package/connectors.js.map +1 -0
- package/connectors.ts +221 -0
- package/deno.json +1 -0
- package/effect-vocab.json +40 -0
- package/effects.js +71 -0
- package/effects.js.map +1 -0
- package/effects.ts +93 -0
- package/execution.js +239 -0
- package/execution.js.map +1 -0
- package/execution.ts +264 -0
- package/graph.js +70 -0
- package/graph.js.map +1 -0
- package/graph.ts +60 -0
- package/mod.js +5 -0
- package/mod.js.map +1 -0
- package/mod.ts +20 -0
- package/package.json +62 -4
- package/recorded.js +108 -0
- package/recorded.js.map +1 -0
- package/recorded.ts +74 -0
- package/room.js +160 -0
- package/room.js.map +1 -0
- package/room.ts +228 -0
- package/targets.js +127 -0
- package/targets.js.map +1 -0
- package/targets.ts +137 -0
- package/tools.js +346 -0
- package/tools.js.map +1 -0
- package/tools.ts +444 -0
- package/vocab.js +17 -0
- package/vocab.js.map +1 -0
- package/vocab.json +69 -0
- package/vocab.ts +13 -0
- package/workspace.js +79 -0
- package/workspace.js.map +1 -0
- package/workspace.ts +181 -0
- package/workspaces.js +38 -0
- package/workspaces.js.map +1 -0
- package/workspaces.ts +49 -0
package/tools.js
ADDED
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
// File-and-command verbs over workspace targets; timeout never disposes a command.
|
|
2
|
+
import { token } from "@yaks/graph/guard";
|
|
3
|
+
import { processWorkspace, targetFor } from "./targets.js";
|
|
4
|
+
import { settle } from "./workspace.js";
|
|
5
|
+
import { CallError } from "@yaks/tools/errors";
|
|
6
|
+
// How long `shell` waits for its command unless told otherwise (ms).
|
|
7
|
+
let BUDGET = 5000;
|
|
8
|
+
/** Whether a path names its own root.
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { assert } from '@std/assert'
|
|
12
|
+
* assert(rooted('/etc/hosts') && rooted('C:\\tmp') && !rooted('src/lib.rs'))
|
|
13
|
+
* ```
|
|
14
|
+
*/ export let rooted = (path)=>/^(\/|[A-Za-z]:[\\/])/.test(path);
|
|
15
|
+
let under = (dir, path)=>dir == null || rooted(path) ? path : `${dir.replace(/\/+$/, '')}/${path}`;
|
|
16
|
+
let code = (c)=>c == null ? 'exited, code unknown' : `exited ${c}`;
|
|
17
|
+
// What a path that is not a file names instead (`Stat`).
|
|
18
|
+
let SAID = {
|
|
19
|
+
missing: 'nothing is there',
|
|
20
|
+
dangling: 'it is a link to nothing',
|
|
21
|
+
directory: 'it is a directory',
|
|
22
|
+
other: 'it is not a regular file'
|
|
23
|
+
};
|
|
24
|
+
let pid = (p)=>p.pid ? ` (pid ${p.pid})` : '';
|
|
25
|
+
let str = (description)=>({
|
|
26
|
+
type: 'string',
|
|
27
|
+
description
|
|
28
|
+
});
|
|
29
|
+
let os = (description)=>({
|
|
30
|
+
...str(description),
|
|
31
|
+
pattern: '^[^\\u0000]*$'
|
|
32
|
+
});
|
|
33
|
+
/** The machine tools' declarations: `shell`, `wait`, `stop`, `read` and
|
|
34
|
+
* `write`. */ export let machineDeclared = (o = {})=>[
|
|
35
|
+
{
|
|
36
|
+
name: 'shell',
|
|
37
|
+
description: 'Run a shell command. A command still running when the timeout passes ' + 'keeps running as a process: the result gives its id, and wait or stop ' + 'accepts that id.',
|
|
38
|
+
parameters: {
|
|
39
|
+
type: 'object',
|
|
40
|
+
properties: {
|
|
41
|
+
command: os('the command line, run by bash'),
|
|
42
|
+
timeout: {
|
|
43
|
+
type: 'number',
|
|
44
|
+
description: `milliseconds to wait for it (default ${o.budget ?? BUDGET})`
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
required: [
|
|
48
|
+
'command'
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'wait',
|
|
54
|
+
waits: true,
|
|
55
|
+
description: 'Wait for a process to exit. Returns its exit code and output, ' + 'or reports that it is still running when the timeout ' + 'passes.',
|
|
56
|
+
parameters: {
|
|
57
|
+
type: 'object',
|
|
58
|
+
properties: {
|
|
59
|
+
process: str('the process id'),
|
|
60
|
+
timeout: {
|
|
61
|
+
type: 'number',
|
|
62
|
+
description: 'milliseconds to wait (default 60000)'
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
required: [
|
|
66
|
+
'process'
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'stop',
|
|
72
|
+
description: 'Stop a process: SIGTERM, then SIGKILL if it is still running after ' + 'the grace period. Returns its exit code.',
|
|
73
|
+
parameters: {
|
|
74
|
+
type: 'object',
|
|
75
|
+
properties: {
|
|
76
|
+
process: str('the process id'),
|
|
77
|
+
grace: {
|
|
78
|
+
type: 'number',
|
|
79
|
+
description: 'milliseconds between the two signals (default 2000)'
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
required: [
|
|
83
|
+
'process'
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: 'read',
|
|
89
|
+
description: 'Read a text file.',
|
|
90
|
+
parameters: {
|
|
91
|
+
type: 'object',
|
|
92
|
+
properties: {
|
|
93
|
+
path: os('the file, from the working directory unless rooted')
|
|
94
|
+
},
|
|
95
|
+
required: [
|
|
96
|
+
'path'
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: 'write',
|
|
102
|
+
description: 'Write a text file, replacing whatever the path held and making its ' + 'directory if there is none.',
|
|
103
|
+
parameters: {
|
|
104
|
+
type: 'object',
|
|
105
|
+
properties: {
|
|
106
|
+
path: os('the file, from the working directory unless rooted'),
|
|
107
|
+
content: str('the whole text of the file')
|
|
108
|
+
},
|
|
109
|
+
required: [
|
|
110
|
+
'path',
|
|
111
|
+
'content'
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
];
|
|
116
|
+
/**
|
|
117
|
+
* The machine tools over a machine.
|
|
118
|
+
*
|
|
119
|
+
* A command that finishes within its timeout answers its code and output; one
|
|
120
|
+
* that does not answers its process id, still running, for `wait` and `stop`
|
|
121
|
+
* to name.
|
|
122
|
+
*/ export let machineTools = (source, o = {})=>{
|
|
123
|
+
if (typeof source == 'function') {
|
|
124
|
+
return machineDeclared(o).map((declaration)=>({
|
|
125
|
+
...declaration,
|
|
126
|
+
run: async (args, ctx)=>{
|
|
127
|
+
let tool = machineTools(await source(ctx), o).find((t)=>t.name == declaration.name);
|
|
128
|
+
return tool.run(args, ctx);
|
|
129
|
+
},
|
|
130
|
+
...declaration.name == 'shell' ? {
|
|
131
|
+
recover: async (args, ctx)=>machineTools(await source(ctx), o).find((t)=>t.name == 'shell').recover(args, ctx)
|
|
132
|
+
} : {}
|
|
133
|
+
}));
|
|
134
|
+
}
|
|
135
|
+
let m = source;
|
|
136
|
+
let runs = machineOperations(m, o);
|
|
137
|
+
let lines = o.lines ?? Number.MAX_SAFE_INTEGER;
|
|
138
|
+
let recover = async (_args, ctx)=>{
|
|
139
|
+
let call = ctx?.call.entity.eid ?? o.call;
|
|
140
|
+
return await shellReceipt(m, call, lines) ?? 'Shell execution has no process receipt; inspect before retrying.';
|
|
141
|
+
};
|
|
142
|
+
return machineDeclared(o).map((d)=>({
|
|
143
|
+
...d,
|
|
144
|
+
run: async (args, ctx)=>(await runs[d.name](args, ctx)).body ?? '',
|
|
145
|
+
...d.name == 'shell' ? {
|
|
146
|
+
recover
|
|
147
|
+
} : {}
|
|
148
|
+
}));
|
|
149
|
+
};
|
|
150
|
+
let processValue = (id, p)=>({
|
|
151
|
+
process: id,
|
|
152
|
+
...p.pid == null ? {} : {
|
|
153
|
+
pid: p.pid
|
|
154
|
+
},
|
|
155
|
+
...p.exit ? {
|
|
156
|
+
exit: p.exit
|
|
157
|
+
} : {}
|
|
158
|
+
});
|
|
159
|
+
/** File and process operations over one workspace. */ export let machineOperations = (m, o = {})=>{
|
|
160
|
+
let lines = o.lines ?? Number.MAX_SAFE_INTEGER;
|
|
161
|
+
let here = async (ctx)=>await o.cwd?.(ctx);
|
|
162
|
+
let told = async (id, head, p)=>({
|
|
163
|
+
body: [
|
|
164
|
+
head,
|
|
165
|
+
...await m.tail(id, lines)
|
|
166
|
+
].join('\n'),
|
|
167
|
+
value: processValue(id, p)
|
|
168
|
+
});
|
|
169
|
+
return {
|
|
170
|
+
shell: async (args, ctx)=>{
|
|
171
|
+
let ms = Number(args.timeout ?? o.budget ?? BUDGET);
|
|
172
|
+
// The timeout covers the whole call, the start included; a child that
|
|
173
|
+
// outlived it is reported as running even if it exits a moment later.
|
|
174
|
+
let end = Date.now() + ms;
|
|
175
|
+
let id = await m.start(String(args.command ?? ''), await here(ctx), ctx?.call.entity.eid ?? o.call, ctx?.session);
|
|
176
|
+
let p = await settle(m, id, {
|
|
177
|
+
ms: end - Date.now(),
|
|
178
|
+
signal: ctx?.signal
|
|
179
|
+
}) ?? {};
|
|
180
|
+
return {
|
|
181
|
+
body: await shellResult(m, id, p, lines, ctx?.signal?.aborted ? undefined : ms),
|
|
182
|
+
value: processValue(id, p)
|
|
183
|
+
};
|
|
184
|
+
},
|
|
185
|
+
wait: async (args, ctx)=>{
|
|
186
|
+
let id = String(args.process ?? '');
|
|
187
|
+
let ms = Number(args.timeout ?? 60_000);
|
|
188
|
+
let p = await settle(m, id, {
|
|
189
|
+
ms,
|
|
190
|
+
signal: ctx?.signal
|
|
191
|
+
});
|
|
192
|
+
if (!p) return {
|
|
193
|
+
body: `no such process: ${id}`
|
|
194
|
+
};
|
|
195
|
+
return told(id, p.exit ? `process ${id} ${code(p.exit.code)}` : `process ${id} still running${pid(p)}${ctx?.signal?.aborted ? '' : ` after ${ms}ms`}`, p);
|
|
196
|
+
},
|
|
197
|
+
stop: async (args)=>{
|
|
198
|
+
let id = String(args.process ?? '');
|
|
199
|
+
let p = await m.look(id);
|
|
200
|
+
if (!p) return {
|
|
201
|
+
body: `no such process: ${id}`
|
|
202
|
+
};
|
|
203
|
+
if (p.exit) {
|
|
204
|
+
return {
|
|
205
|
+
body: `process ${id} ${code(p.exit.code)} already`,
|
|
206
|
+
value: processValue(id, p)
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
let grace = Number(args.grace ?? o.grace ?? 2000);
|
|
210
|
+
await m.kill(id, 'SIGTERM');
|
|
211
|
+
p = await settle(m, id, {
|
|
212
|
+
ms: grace
|
|
213
|
+
});
|
|
214
|
+
if (!p?.exit) {
|
|
215
|
+
await m.kill(id, 'SIGKILL');
|
|
216
|
+
p = await settle(m, id, {
|
|
217
|
+
ms: grace
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
return {
|
|
221
|
+
body: p?.exit ? `process ${id} ${code(p.exit.code)}` : `process ${id} signalled, no exit recorded yet`,
|
|
222
|
+
value: processValue(id, p ?? {})
|
|
223
|
+
};
|
|
224
|
+
},
|
|
225
|
+
read: async (args, ctx)=>{
|
|
226
|
+
let cwd = await here(ctx);
|
|
227
|
+
if (Array.isArray(args.paths)) {
|
|
228
|
+
let paths = args.paths.map((path)=>under(cwd, String(path)));
|
|
229
|
+
let stats = await m.stat(paths);
|
|
230
|
+
return {
|
|
231
|
+
body: JSON.stringify(stats),
|
|
232
|
+
value: {
|
|
233
|
+
paths,
|
|
234
|
+
stats
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
let path = under(cwd, String(args.path ?? ''));
|
|
239
|
+
try {
|
|
240
|
+
return {
|
|
241
|
+
body: await m.read(path)
|
|
242
|
+
};
|
|
243
|
+
} catch (e) {
|
|
244
|
+
// A path that names no file is the caller's to correct, however the
|
|
245
|
+
// machine said so; any other failure is the machine's own.
|
|
246
|
+
let [found] = await m.stat([
|
|
247
|
+
path
|
|
248
|
+
]).catch(()=>[]);
|
|
249
|
+
if (!found || found.kind == 'file') throw e;
|
|
250
|
+
throw new CallError('path', `No file at ${path}: ${SAID[found.kind]}`);
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
write: async (args, ctx)=>{
|
|
254
|
+
let path = String(args.path ?? '');
|
|
255
|
+
await m.write(under(await here(ctx), path), String(args.body ?? args.content ?? ''));
|
|
256
|
+
return {
|
|
257
|
+
body: `wrote ${path}`
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
};
|
|
262
|
+
let shellResult = async (m, id, p, lines, ms)=>{
|
|
263
|
+
let head = p?.exit ? `process ${id} ${code(p.exit.code)}` : !p?.pid ? `process ${id} start unconfirmed — inspect before retrying` : `process ${id} still running${pid(p)}${ms == null ? '' : ` after ${ms}ms`} — wait or stop it by that id`;
|
|
264
|
+
return [
|
|
265
|
+
head,
|
|
266
|
+
...await m.tail(id, lines)
|
|
267
|
+
].join('\n');
|
|
268
|
+
};
|
|
269
|
+
/** Recover the command identified by its invocation, without starting one. */ export let shellReceipt = async (m, call, lines = Number.MAX_SAFE_INTEGER)=>{
|
|
270
|
+
let id = call && await m.receipt?.(call);
|
|
271
|
+
if (!id) return;
|
|
272
|
+
let process = await m.look(id);
|
|
273
|
+
if (process) return shellResult(m, id, process, lines);
|
|
274
|
+
};
|
|
275
|
+
/** Bind tools to graph targets. Each call persists its concrete target before
|
|
276
|
+
* touching a filesystem. Recovery refuses an invocation without that target. */ export let workspaceTools = (g, workspaces, o = {})=>machineDeclared(o).map((declaration)=>{
|
|
277
|
+
let process = [
|
|
278
|
+
'wait',
|
|
279
|
+
'stop'
|
|
280
|
+
].includes(declaration.name);
|
|
281
|
+
let parameters = declaration.parameters;
|
|
282
|
+
let properties = parameters.properties;
|
|
283
|
+
return {
|
|
284
|
+
...declaration,
|
|
285
|
+
parameters: {
|
|
286
|
+
...parameters,
|
|
287
|
+
properties: {
|
|
288
|
+
...properties,
|
|
289
|
+
...!process ? {
|
|
290
|
+
workspace: str("A workspace entity's eid; otherwise the session home. " + "graph_query '.workspace.root=<directory>' finds the one " + 'at a directory'),
|
|
291
|
+
cwd: os('Absolute command directory; otherwise the selected workspace default')
|
|
292
|
+
} : {}
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
run: async (args, ctx)=>{
|
|
296
|
+
// A durable call may already have been targeted by an interrupted worker.
|
|
297
|
+
let recorded = ctx ? (await g.get([
|
|
298
|
+
ctx.call.entity.eid
|
|
299
|
+
], [
|
|
300
|
+
'call'
|
|
301
|
+
]))[0] : undefined;
|
|
302
|
+
let prior = recorded?.call?.args;
|
|
303
|
+
let input = prior?.workspace ? prior : args;
|
|
304
|
+
let target = process ? {
|
|
305
|
+
workspace: await processWorkspace(g, String(input.process)),
|
|
306
|
+
cwd: undefined
|
|
307
|
+
} : await targetFor(g, ctx?.session, input);
|
|
308
|
+
if (ctx && recorded) {
|
|
309
|
+
await g.apply([
|
|
310
|
+
{
|
|
311
|
+
entity: ctx.call.entity,
|
|
312
|
+
call: {
|
|
313
|
+
args: {
|
|
314
|
+
...input,
|
|
315
|
+
...target
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
$was: {
|
|
319
|
+
call: {
|
|
320
|
+
args: token(prior ?? null)
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
]);
|
|
325
|
+
}
|
|
326
|
+
let tools = machineTools(await workspaces.connect(target.workspace), {
|
|
327
|
+
...o,
|
|
328
|
+
cwd: ()=>target.cwd
|
|
329
|
+
});
|
|
330
|
+
return await tools.find((t)=>t.name == declaration.name).run(input, ctx);
|
|
331
|
+
},
|
|
332
|
+
...declaration.name == 'shell' ? {
|
|
333
|
+
recover: async (args, ctx)=>{
|
|
334
|
+
if (typeof args.workspace != 'string' || typeof args.cwd != 'string') {
|
|
335
|
+
return 'Shell execution has no recorded workspace target; inspect before retrying.';
|
|
336
|
+
}
|
|
337
|
+
let tools = machineTools(await workspaces.connect(args.workspace), {
|
|
338
|
+
...o,
|
|
339
|
+
cwd: ()=>String(args.cwd)
|
|
340
|
+
});
|
|
341
|
+
return await tools.find((t)=>t.name == 'shell').recover(args, ctx);
|
|
342
|
+
}
|
|
343
|
+
} : {}
|
|
344
|
+
};
|
|
345
|
+
});
|
|
346
|
+
//# sourceMappingURL=tools.js.map
|
package/tools.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sources":["./tools.ts"],"names":[],"mappings":"AAAA,mFAAmF;AA4BnF,SAAS,KAAK,iCAAsC;AACpD,SAAS,gBAAgB,EAAE,SAAS,uBAAuC;AAG3E,SAAS,MAAM,yBAAwB;AACvC,SAAS,SAAS,kCAAuC;AAiBzD,qEAAqE;AACrE,IAAI,SAAS;AAEb;;;;;;CAMC,GACD,OAAO,IAAI,SAAS,CAAC,OAA0B,uBAAuB,IAAI,CAAC,MAAK;AAEhF,IA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