@skillcdn/console 0.6.2 → 0.6.4
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/README.md +16 -9
- package/SKILLCDN.md +3 -2
- package/dist/agent-page.d.ts +2 -0
- package/dist/agent-page.d.ts.map +1 -1
- package/dist/agent-page.js +46 -5
- package/dist/agent-page.js.map +1 -1
- package/dist/agent-state.d.ts +9 -0
- package/dist/agent-state.d.ts.map +1 -0
- package/dist/agent-state.js +28 -0
- package/dist/agent-state.js.map +1 -0
- package/dist/api.d.ts +6 -4
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +6 -4
- package/dist/api.js.map +1 -1
- package/dist/cli/cli.d.ts +2 -0
- package/dist/cli/cli.d.ts.map +1 -1
- package/dist/cli/cli.js +948 -252
- package/dist/cli/cli.js.map +1 -1
- package/dist/cli/format.d.ts +44 -7
- package/dist/cli/format.d.ts.map +1 -1
- package/dist/cli/format.js +168 -13
- package/dist/cli/format.js.map +1 -1
- package/dist/cli/help.d.ts +82 -9
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +855 -331
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/pack.d.ts +13 -12
- package/dist/cli/pack.d.ts.map +1 -1
- package/dist/cli/pack.js +33 -45
- package/dist/cli/pack.js.map +1 -1
- package/dist/cli/plugin-cli.d.ts.map +1 -1
- package/dist/cli/plugin-cli.js +8 -5
- package/dist/cli/plugin-cli.js.map +1 -1
- package/dist/cli/runner-files.d.ts +16 -0
- package/dist/cli/runner-files.d.ts.map +1 -0
- package/dist/cli/runner-files.js +125 -0
- package/dist/cli/runner-files.js.map +1 -0
- package/dist/cli/runner-host.d.ts +7 -0
- package/dist/cli/runner-host.d.ts.map +1 -1
- package/dist/cli/runner-host.js +40 -2
- package/dist/cli/runner-host.js.map +1 -1
- package/dist/cli/skill-path.d.ts +11 -0
- package/dist/cli/skill-path.d.ts.map +1 -0
- package/dist/cli/skill-path.js +44 -0
- package/dist/cli/skill-path.js.map +1 -0
- package/dist/client.d.ts +32 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +15 -1
- package/dist/client.js.map +1 -1
- package/dist/components/agent-page.d.ts +93 -6
- package/dist/components/agent-page.d.ts.map +1 -1
- package/dist/components/agent-page.js +202 -10
- package/dist/components/agent-page.js.map +1 -1
- package/dist/components/agents.d.ts +6 -6
- package/dist/components/agents.d.ts.map +1 -1
- package/dist/components/agents.js +16 -9
- package/dist/components/agents.js.map +1 -1
- package/dist/components/people.d.ts.map +1 -1
- package/dist/components/people.js +7 -2
- package/dist/components/people.js.map +1 -1
- package/dist/components/picker.d.ts +16 -0
- package/dist/components/picker.d.ts.map +1 -1
- package/dist/components/picker.js +69 -4
- package/dist/components/picker.js.map +1 -1
- package/dist/console.css +40 -0
- package/dist/console.js +2 -2
- package/dist/console.js.map +1 -1
- package/dist/feed-words.d.ts.map +1 -1
- package/dist/feed-words.js +12 -1
- package/dist/feed-words.js.map +1 -1
- package/dist/i18n/en.d.ts +64 -6
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +59 -10
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/ko.d.ts.map +1 -1
- package/dist/i18n/ko.js +49 -9
- package/dist/i18n/ko.js.map +1 -1
- package/dist/limits.d.ts +26 -0
- package/dist/limits.d.ts.map +1 -1
- package/dist/limits.js +26 -0
- package/dist/limits.js.map +1 -1
- package/dist/onboarding.d.ts +18 -6
- package/dist/onboarding.d.ts.map +1 -1
- package/dist/onboarding.js +42 -7
- package/dist/onboarding.js.map +1 -1
- package/dist/plugin/args.d.ts +24 -2
- package/dist/plugin/args.d.ts.map +1 -1
- package/dist/plugin/args.js +20 -2
- package/dist/plugin/args.js.map +1 -1
- package/dist/plugin/context.d.ts +39 -7
- package/dist/plugin/context.d.ts.map +1 -1
- package/dist/plugin/define.d.ts.map +1 -1
- package/dist/plugin/define.js +12 -3
- package/dist/plugin/define.js.map +1 -1
- package/dist/plugin/rest-schemas.d.ts +2 -0
- package/dist/plugin/rest-schemas.d.ts.map +1 -1
- package/dist/plugin/rest-schemas.js +1 -0
- package/dist/plugin/rest-schemas.js.map +1 -1
- package/dist/routes.d.ts +2 -0
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +2 -0
- package/dist/routes.js.map +1 -1
- package/dist/rules.d.ts +4 -1
- package/dist/rules.d.ts.map +1 -1
- package/dist/rules.js +5 -2
- package/dist/rules.js.map +1 -1
- package/dist/runner/acp.d.ts.map +1 -1
- package/dist/runner/acp.js +9 -3
- package/dist/runner/acp.js.map +1 -1
- package/dist/runner/claude.d.ts.map +1 -1
- package/dist/runner/claude.js +53 -1
- package/dist/runner/claude.js.map +1 -1
- package/dist/runner/codex.d.ts.map +1 -1
- package/dist/runner/codex.js +18 -3
- package/dist/runner/codex.js.map +1 -1
- package/dist/runner/config.d.ts +18 -0
- package/dist/runner/config.d.ts.map +1 -1
- package/dist/runner/config.js +77 -1
- package/dist/runner/config.js.map +1 -1
- package/dist/runner/desk.d.ts +7 -0
- package/dist/runner/desk.d.ts.map +1 -1
- package/dist/runner/desk.js +14 -4
- package/dist/runner/desk.js.map +1 -1
- package/dist/runner/message.d.ts +16 -22
- package/dist/runner/message.d.ts.map +1 -1
- package/dist/runner/message.js +72 -120
- package/dist/runner/message.js.map +1 -1
- package/dist/runner/runner.d.ts +41 -1
- package/dist/runner/runner.d.ts.map +1 -1
- package/dist/runner/runner.js +557 -23
- package/dist/runner/runner.js.map +1 -1
- package/dist/runner/slack-status.d.ts +19 -0
- package/dist/runner/slack-status.d.ts.map +1 -0
- package/dist/runner/slack-status.js +332 -0
- package/dist/runner/slack-status.js.map +1 -0
- package/dist/runner/slack.d.ts.map +1 -1
- package/dist/runner/slack.js +258 -59
- package/dist/runner/slack.js.map +1 -1
- package/dist/runner/types.d.ts +128 -15
- package/dist/runner/types.d.ts.map +1 -1
- package/dist/runner/types.js.map +1 -1
- package/dist/runner/usage.d.ts +6 -1
- package/dist/runner/usage.d.ts.map +1 -1
- package/dist/runner/usage.js +9 -2
- package/dist/runner/usage.js.map +1 -1
- package/dist/runner.d.ts +2 -2
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js.map +1 -1
- package/dist/schemas.d.ts +635 -6
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +197 -15
- package/dist/schemas.js.map +1 -1
- package/dist/secret-file.d.ts +21 -0
- package/dist/secret-file.d.ts.map +1 -0
- package/dist/secret-file.js +59 -0
- package/dist/secret-file.js.map +1 -0
- package/dist/services.d.ts.map +1 -1
- package/dist/services.js +3 -2
- package/dist/services.js.map +1 -1
- package/dist/setup-guide.d.ts +2 -2
- package/dist/setup-guide.d.ts.map +1 -1
- package/dist/setup-guide.js +6 -5
- package/dist/setup-guide.js.map +1 -1
- package/dist/vocabulary.d.ts +17 -2
- package/dist/vocabulary.d.ts.map +1 -1
- package/dist/vocabulary.js +15 -2
- package/dist/vocabulary.js.map +1 -1
- package/dist/wake-text.d.ts +43 -0
- package/dist/wake-text.d.ts.map +1 -0
- package/dist/wake-text.js +115 -0
- package/dist/wake-text.js.map +1 -0
- package/docs/specs/cli.md +39 -25
- package/docs/specs/plugins.md +10 -9
- package/docs/specs/rest.md +34 -15
- package/docs/specs/runner.md +108 -25
- package/docs/start.md +28 -6
- package/package.json +3 -3
- package/skills/building-a-plugin/SKILL.md +2 -2
- package/skills/deploying-a-console/SKILL.md +3 -3
- package/skills/deploying-a-console/references/access.md +15 -1
- package/skills/deploying-a-console/references/resources.md +2 -2
- package/skills/deploying-a-console/scripts/github-app.mjs +593 -0
- package/skills/keeping-the-pack/SKILL.md +87 -0
- package/skills/planning-the-board/SKILL.md +6 -6
- package/skills/planning-the-board/references/a-task.md +1 -1
- package/skills/planning-the-board/references/setting-up.md +9 -5
- package/skills/running-an-agent/SKILL.md +21 -17
- package/skills/running-an-agent/references/preparing-the-machine.md +4 -3
- package/skills/running-an-agent/references/several-tasks.md +8 -2
- package/skills/running-an-agent/references/slack-app.md +31 -8
- package/skills/running-an-agent/references/the-account-and-the-invitation.md +1 -1
- package/skills/running-an-agent/references/what-was-not-seen-run-yet.md +3 -1
- package/skills/running-an-agent/references/when-the-agent-could-not-go-on.md +4 -4
- package/skills/running-an-agent/references/your-first-task.md +11 -5
- package/skills/trying-a-console/SKILL.md +136 -0
- package/skills/trying-a-console/references/when-it-does-not-go.md +30 -0
- package/skills/working-the-board/SKILL.md +6 -6
- package/skills/working-the-board/references/terms.md +3 -1
- package/skills/working-the-board/references/the-pack.md +14 -7
- package/skills/working-the-board/references/what-they-were-told.md +1 -1
- package/src/agent-page.tsx +111 -4
- package/src/agent-state.ts +33 -0
- package/src/api.ts +43 -0
- package/src/cli/cli.ts +1190 -313
- package/src/cli/format.ts +207 -13
- package/src/cli/help.ts +991 -372
- package/src/cli/pack.ts +55 -62
- package/src/cli/plugin-cli.ts +8 -5
- package/src/cli/runner-files.ts +137 -0
- package/src/cli/runner-host.ts +48 -2
- package/src/cli/skill-path.ts +51 -0
- package/src/client.ts +103 -0
- package/src/components/agent-page.tsx +446 -20
- package/src/components/agents.tsx +27 -28
- package/src/components/people.tsx +7 -3
- package/src/components/picker.tsx +79 -5
- package/src/console.tsx +1 -1
- package/src/feed-words.ts +14 -1
- package/src/i18n/en.ts +64 -11
- package/src/i18n/ko.ts +55 -9
- package/src/limits.ts +26 -0
- package/src/onboarding.ts +60 -21
- package/src/plugin/args.ts +29 -3
- package/src/plugin/context.ts +40 -7
- package/src/plugin/define.ts +18 -3
- package/src/plugin/rest-schemas.ts +3 -0
- package/src/routes.ts +2 -0
- package/src/rules.ts +5 -2
- package/src/runner/acp.ts +9 -3
- package/src/runner/claude.ts +58 -1
- package/src/runner/codex.ts +18 -3
- package/src/runner/config.ts +114 -1
- package/src/runner/desk.ts +15 -4
- package/src/runner/message.ts +88 -126
- package/src/runner/runner.ts +682 -27
- package/src/runner/slack-status.ts +423 -0
- package/src/runner/slack.ts +310 -67
- package/src/runner/types.ts +124 -13
- package/src/runner/usage.ts +16 -3
- package/src/runner.ts +4 -0
- package/src/schemas.ts +245 -13
- package/src/secret-file.ts +76 -0
- package/src/services.ts +3 -2
- package/src/setup-guide.ts +6 -5
- package/src/styles/README.md +1 -1
- package/src/styles/pages/agents.css +40 -0
- package/src/vocabulary.ts +21 -2
- package/src/wake-text.ts +133 -0
- package/dist/cli/command-words.d.ts +0 -20
- package/dist/cli/command-words.d.ts.map +0 -1
- package/dist/cli/command-words.js +0 -51
- package/dist/cli/command-words.js.map +0 -1
- package/src/cli/command-words.ts +0 -56
package/src/runner/types.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AgentStateReason, TranscriptKind } from "../vocabulary.js";
|
|
2
|
+
import type { WakePart } from "../wake-text.js";
|
|
2
3
|
|
|
3
4
|
// What the runner's modules are to one another (ADR-0085, docs/specs/runner.md): a driver speaks
|
|
4
5
|
// to one product, a wake source raises wakes from outside the console, a service keeps the
|
|
@@ -39,8 +40,13 @@ export type DriverEvent =
|
|
|
39
40
|
readonly effort: string | null;
|
|
40
41
|
readonly version: string | null;
|
|
41
42
|
}
|
|
42
|
-
/**
|
|
43
|
-
|
|
43
|
+
/**
|
|
44
|
+
* The id the product resumes the conversation from next time. With `anew`, the product was
|
|
45
|
+
* asked to go on with a conversation and began this one in its place, since it kept the other
|
|
46
|
+
* no more or goes on with none (ADR-0166): the runner then takes the agent's conversation to
|
|
47
|
+
* have begun with the session, which holds nothing it was handed before.
|
|
48
|
+
*/
|
|
49
|
+
| { readonly type: "conversation"; readonly id: string; readonly anew?: boolean | undefined }
|
|
44
50
|
/**
|
|
45
51
|
* The product took a message: the oldest it was sent and had not said so of. Said once for
|
|
46
52
|
* every message sent, when the product reads it, so that a message handed over in a turn is
|
|
@@ -49,6 +55,12 @@ export type DriverEvent =
|
|
|
49
55
|
| { readonly type: "taken" }
|
|
50
56
|
/** A turn completed: the agent is done with what it was sent, and waits for more. */
|
|
51
57
|
| { readonly type: "turn_completed" }
|
|
58
|
+
/**
|
|
59
|
+
* The product put the conversation so far in fewer words of its own, as one does whose
|
|
60
|
+
* conversation grew long (ADR-0166): what the agent was handed before, it holds as a summary
|
|
61
|
+
* at best. Said by a driver whose product says so, and never by another.
|
|
62
|
+
*/
|
|
63
|
+
| { readonly type: "compacted" }
|
|
52
64
|
/**
|
|
53
65
|
* How many sub-agents are at work in the background of the session, as the product lists
|
|
54
66
|
* them (ADR-0162): said as that changes, from the first that is. A driver whose product lists
|
|
@@ -77,6 +89,13 @@ export type DriverEvent =
|
|
|
77
89
|
* nothing of it, of which the runner then knows nothing.
|
|
78
90
|
*/
|
|
79
91
|
| { readonly type: "usage"; readonly windows: readonly UsageWindow[] }
|
|
92
|
+
/**
|
|
93
|
+
* The product wrote something the driver has no reading for (ADR-0182): `what` names its kind
|
|
94
|
+
* in a few words of the driver's own, a line, and never what the product wrote. Said once for
|
|
95
|
+
* a kind in a session, by a driver whose product's output has no kind a client is to pass
|
|
96
|
+
* over: under a protocol that names such kinds, a driver says it never.
|
|
97
|
+
*/
|
|
98
|
+
| { readonly type: "unknown"; readonly what: string }
|
|
80
99
|
/** The product's process is gone: by itself, or mid-turn. Always the last. */
|
|
81
100
|
| { readonly type: "ended"; readonly how: "exited" | "crashed" };
|
|
82
101
|
|
|
@@ -235,6 +254,15 @@ export interface Driver {
|
|
|
235
254
|
readonly resume: boolean;
|
|
236
255
|
/** Whether the model and the effort are taken in a running session. */
|
|
237
256
|
readonly set: boolean;
|
|
257
|
+
/**
|
|
258
|
+
* Whether a message the driver said was taken stands in the product's conversation from
|
|
259
|
+
* then on, whatever became of the turn: the driver says `taken` when the product says the
|
|
260
|
+
* message back out of its conversation, or began a turn with it. Where it does, what the
|
|
261
|
+
* product took as a usage limit was reached is named to the agent in the same session and
|
|
262
|
+
* not said a second time (ADR-0166). Left out, or false, for a driver that says `taken` when
|
|
263
|
+
* it handed the message over: the runner then says such a message whole again.
|
|
264
|
+
*/
|
|
265
|
+
readonly holdsTaken?: boolean | undefined;
|
|
238
266
|
};
|
|
239
267
|
/**
|
|
240
268
|
* The product's permission modes, in its own words: what runs without asking. `unattended` is
|
|
@@ -287,13 +315,9 @@ export interface WakeSocket {
|
|
|
287
315
|
close(): void;
|
|
288
316
|
}
|
|
289
317
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
* of their own, so that nothing a message holds reads as a line of the source's. A line holds
|
|
294
|
-
* what the source says itself, an id and a moment among it, and never a word someone else wrote.
|
|
295
|
-
*/
|
|
296
|
-
export type WakePart = { readonly says: string } | { readonly words: string };
|
|
318
|
+
// A part of a wake a source raises (ADR-0163): declared with how the parts are written as a
|
|
319
|
+
// signal's text, which the console writes too.
|
|
320
|
+
export type { WakePart } from "../wake-text.js";
|
|
297
321
|
|
|
298
322
|
/**
|
|
299
323
|
* A wake as a wake source raises one: `parts` where the source says something itself, who wrote
|
|
@@ -356,11 +380,29 @@ export interface WakeHost {
|
|
|
356
380
|
*/
|
|
357
381
|
raise(wake: RaisedWake): Promise<boolean>;
|
|
358
382
|
/**
|
|
359
|
-
*
|
|
360
|
-
*
|
|
361
|
-
*
|
|
383
|
+
* Says that the source took a message it will raise a wake for (ADR-0170), before it reads
|
|
384
|
+
* anything for that wake: the agent is shown as thinking it over from here, and not from when
|
|
385
|
+
* the wake went up, which is as much later as those reads take. Answers what ends the word,
|
|
386
|
+
* called once the wake was raised or will not be: one that went up is shown from then on as
|
|
387
|
+
* any wake on its way is, and one that did not leaves nothing shown. A word never ended
|
|
388
|
+
* lapses by itself within the minute. Left out by a host that shows nothing before a wake.
|
|
389
|
+
*/
|
|
390
|
+
heard?(): () => void;
|
|
391
|
+
/**
|
|
392
|
+
* What the source keeps from one run of its own to the next, under names of its own, and from
|
|
393
|
+
* one runner to the one started after it where the machine keeps it (ADR-0166): the ids and
|
|
394
|
+
* the moments of what it brought the agent. Never a secret, and never a word of a message.
|
|
362
395
|
*/
|
|
363
396
|
readonly kept: Map<string, string>;
|
|
397
|
+
/**
|
|
398
|
+
* When the conversation the agent goes on with began, in milliseconds since the epoch
|
|
399
|
+
* (ADR-0166): at a reset, with a new day where the desk says so, in a session whose product
|
|
400
|
+
* goes on with none, and when the product put it in fewer words. What the agent was handed
|
|
401
|
+
* before that moment its conversation holds no more, so a source counts nothing from before
|
|
402
|
+
* it as brought. 0 where nothing says when; left out by a host that says nothing of it, which
|
|
403
|
+
* a source reads as 0.
|
|
404
|
+
*/
|
|
405
|
+
began?(): number;
|
|
364
406
|
/** A line for whoever reads the runner's own output: never what a message says. */
|
|
365
407
|
log(line: string): void;
|
|
366
408
|
/**
|
|
@@ -368,14 +410,25 @@ export interface WakeHost {
|
|
|
368
410
|
* yet, with why in a few words of the source's own. Never what a message says.
|
|
369
411
|
*/
|
|
370
412
|
stands(state: "connected" | "waiting", why?: string): void;
|
|
413
|
+
/**
|
|
414
|
+
* Asks an address of the source's messenger. `body` is what a call that writes sends, as its
|
|
415
|
+
* text. Of the answer, what it says as JSON, and beside it the status of the answer and its
|
|
416
|
+
* headers where the host has them: a messenger that asks to be left alone for a while says so
|
|
417
|
+
* there.
|
|
418
|
+
*/
|
|
371
419
|
fetch(
|
|
372
420
|
url: string,
|
|
373
421
|
init: {
|
|
374
422
|
readonly method: string;
|
|
375
423
|
readonly headers: Readonly<Record<string, string>>;
|
|
424
|
+
readonly body?: string | undefined;
|
|
376
425
|
readonly signal: AbortSignal;
|
|
377
426
|
},
|
|
378
|
-
): Promise<{
|
|
427
|
+
): Promise<{
|
|
428
|
+
json(): Promise<unknown>;
|
|
429
|
+
readonly status?: number | undefined;
|
|
430
|
+
readonly headers?: { get(name: string): string | null } | undefined;
|
|
431
|
+
}>;
|
|
379
432
|
socket(url: string): WakeSocket;
|
|
380
433
|
/** Waits so long, or less where the signal ends the wait. */
|
|
381
434
|
wait(ms: number, signal: AbortSignal): Promise<void>;
|
|
@@ -389,6 +442,40 @@ export interface WakeHost {
|
|
|
389
442
|
writers?(accounts: readonly WakeAccount[], signal: AbortSignal): Promise<readonly WakeWriter[]>;
|
|
390
443
|
}
|
|
391
444
|
|
|
445
|
+
/**
|
|
446
|
+
* How an agent stands to whoever waits for it where a wake source listens (ADR-0170), as the
|
|
447
|
+
* runner says it and the source shows it where it can:
|
|
448
|
+
*
|
|
449
|
+
* - `idle`: nothing to show. With `last`, the runner ends and says nothing after it: what the
|
|
450
|
+
* source showed is taken back now or not at all;
|
|
451
|
+
* - `thinking`: what that source raised reached the runner, and the turn it began is under way;
|
|
452
|
+
* - `working`: the agent has been at work for longer than `runner.json` gives a turn before it
|
|
453
|
+
* is said, whatever woke it, sub-agents in its background among it;
|
|
454
|
+
* - `limited`: the usage limit of its product stopped it, until the moment `until` where the
|
|
455
|
+
* product said one, in milliseconds since the epoch.
|
|
456
|
+
*/
|
|
457
|
+
export type AgentStatus =
|
|
458
|
+
| { readonly state: "idle"; readonly last?: boolean | undefined }
|
|
459
|
+
| { readonly state: "thinking" }
|
|
460
|
+
| { readonly state: "working" }
|
|
461
|
+
| { readonly state: "limited"; readonly until?: number | undefined };
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* What `runner.json` says of how each of them is shown, under `status`: an emoji by its name
|
|
465
|
+
* and a line of words, each the source's own where the desk says none. `back` is what the
|
|
466
|
+
* words of `limited` go on with where the moment is known, `{time}` in it standing for the
|
|
467
|
+
* moment.
|
|
468
|
+
*/
|
|
469
|
+
export interface StatusWords {
|
|
470
|
+
readonly thinking?: StatusLook | undefined;
|
|
471
|
+
readonly working?: StatusLook | undefined;
|
|
472
|
+
readonly limited?: (StatusLook & { readonly back?: string | undefined }) | undefined;
|
|
473
|
+
}
|
|
474
|
+
export interface StatusLook {
|
|
475
|
+
readonly emoji?: string | undefined;
|
|
476
|
+
readonly text?: string | undefined;
|
|
477
|
+
}
|
|
478
|
+
|
|
392
479
|
/** A module that raises wakes from outside the console. `console`, the console's own stream of signals, is the runner's own. */
|
|
393
480
|
export interface WakeSource {
|
|
394
481
|
readonly name: string;
|
|
@@ -415,6 +502,30 @@ export interface WakeSource {
|
|
|
415
502
|
readonly signal: AbortSignal;
|
|
416
503
|
},
|
|
417
504
|
): Promise<WakeRead>;
|
|
505
|
+
/**
|
|
506
|
+
* Shows how the agent stands, where the source's messenger has a place for it (ADR-0170): the
|
|
507
|
+
* runner decides which, and the source how. Said when it changes, and again every half
|
|
508
|
+
* minute while it stands, so that a source keeps what it shows from lapsing and tries again
|
|
509
|
+
* what failed; with the host the source runs with, the same one every time. It never rejects
|
|
510
|
+
* for what the messenger answered, and what it cannot show costs the agent nothing: said
|
|
511
|
+
* once, in the runner's lines. Left out by a source that shows nothing.
|
|
512
|
+
*/
|
|
513
|
+
show?(
|
|
514
|
+
host: Pick<WakeHost, "secret" | "fetch" | "wait" | "log" | "kept">,
|
|
515
|
+
status: AgentStatus,
|
|
516
|
+
options: {
|
|
517
|
+
/** What `runner.json` says of the emoji and the words. */
|
|
518
|
+
readonly words: StatusWords;
|
|
519
|
+
/** The language of the workspace, where the runner knows it: the source's own words are in it where it has them. */
|
|
520
|
+
readonly language?: string | undefined;
|
|
521
|
+
/** The moment, in milliseconds since the epoch. */
|
|
522
|
+
now(): number;
|
|
523
|
+
/** A moment as people read one, in the workspace's zone: the hour and the minute, with the day where it is not within the day to come. */
|
|
524
|
+
time(at: number): string;
|
|
525
|
+
/** Ends when the runner does, and with the last thing said a few seconds after it. */
|
|
526
|
+
readonly signal: AbortSignal;
|
|
527
|
+
},
|
|
528
|
+
): Promise<void>;
|
|
418
529
|
}
|
|
419
530
|
|
|
420
531
|
/** What a service is told of the runner it keeps running. */
|
package/src/runner/usage.ts
CHANGED
|
@@ -210,8 +210,13 @@ export function limitWords(
|
|
|
210
210
|
options: {
|
|
211
211
|
readonly now: number;
|
|
212
212
|
readonly moment: (iso: string) => string;
|
|
213
|
-
/** How many signals follow in the message. */
|
|
213
|
+
/** How many signals follow in the message, said whole. */
|
|
214
214
|
readonly follow: number;
|
|
215
|
+
/**
|
|
216
|
+
* How many more the message only names (ADR-0166): what the product took in this
|
|
217
|
+
* conversation as the limit was reached and the agent never answered, which stands above.
|
|
218
|
+
*/
|
|
219
|
+
readonly above?: number | undefined;
|
|
215
220
|
/** Whether this is a supervisor's signal tried before the runner's own try, with what else is kept left for then. */
|
|
216
221
|
readonly early?: boolean | undefined;
|
|
217
222
|
},
|
|
@@ -224,11 +229,19 @@ export function limitWords(
|
|
|
224
229
|
: limited.until === undefined
|
|
225
230
|
? `The product did not say when the limit resets, so the runner tries now, ${at(options.now)}, by itself.`
|
|
226
231
|
: `The limit reset ${at(limited.until)}, and the runner brings you back by itself.`;
|
|
232
|
+
const above = options.above ?? 0;
|
|
233
|
+
// What the conversation holds is not said twice: it is named, and the agent reads it above.
|
|
234
|
+
const unanswered =
|
|
235
|
+
above === 0
|
|
236
|
+
? ""
|
|
237
|
+
: `What you were handed as the limit was reached and had not answered stands above in this conversation: it is named below by its ${above === 1 ? "number" : "numbers"}, and not said again. `;
|
|
227
238
|
const meanwhile = early
|
|
228
239
|
? "The message follows; what else reached you meanwhile is kept, and handed to you then."
|
|
229
240
|
: options.follow === 0
|
|
230
|
-
?
|
|
231
|
-
:
|
|
241
|
+
? `${unanswered}Nothing ${above === 0 ? "" : "else "}reached you meanwhile.`
|
|
242
|
+
: above === 0
|
|
243
|
+
? "What reached you meanwhile follows, in the order it came, what you were handed as the limit was reached and had not read among it."
|
|
244
|
+
: `${unanswered}What reached you since follows, in the order it came.`;
|
|
232
245
|
return `${stopped} ${now} Go on with what you were doing: look at what each sub-agent left before you start it again. ${meanwhile}`;
|
|
233
246
|
}
|
|
234
247
|
|
package/src/runner.ts
CHANGED
|
@@ -63,6 +63,7 @@ export {
|
|
|
63
63
|
createRunner,
|
|
64
64
|
HEARTBEAT_MS,
|
|
65
65
|
HOLD_MS,
|
|
66
|
+
type KeptBySource,
|
|
66
67
|
MAX_COOL_DOWN_MS,
|
|
67
68
|
MAX_HOLD_MS,
|
|
68
69
|
REPORT_MS,
|
|
@@ -91,6 +92,7 @@ export {
|
|
|
91
92
|
taskScript,
|
|
92
93
|
} from "./runner/task-scheduler.js";
|
|
93
94
|
export type {
|
|
95
|
+
AgentStatus,
|
|
94
96
|
Boundary,
|
|
95
97
|
Child,
|
|
96
98
|
Cut,
|
|
@@ -108,6 +110,8 @@ export type {
|
|
|
108
110
|
ServicePlan,
|
|
109
111
|
Spawn,
|
|
110
112
|
StartOptions,
|
|
113
|
+
StatusLook,
|
|
114
|
+
StatusWords,
|
|
111
115
|
WakeAccount,
|
|
112
116
|
WakeHost,
|
|
113
117
|
WakePart,
|
package/src/schemas.ts
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
// most of what a page downloads. The server validates what it is sent with the input schemas
|
|
3
3
|
// and builds the output shapes; the pages and a custom console parse answers with the rest.
|
|
4
4
|
// Absent values are `null` on the wire, never missing keys. Changes within a version are additive.
|
|
5
|
+
|
|
6
|
+
import { parseRepoPath } from "@skillcdn/core/address";
|
|
5
7
|
import {
|
|
6
8
|
restBrowseSchema as packBrowseSchema,
|
|
7
9
|
restCodeSchema as packCodeSchema,
|
|
@@ -10,7 +12,7 @@ import {
|
|
|
10
12
|
restMountSchema as packMountSchema,
|
|
11
13
|
restRowsSchema as packRowsSchema,
|
|
12
14
|
restSkillSchema as packSkillSchema,
|
|
13
|
-
} from "@skillcdn/core";
|
|
15
|
+
} from "@skillcdn/core/rest";
|
|
14
16
|
import * as z from "zod/mini";
|
|
15
17
|
import { isDocumentPath } from "./documents.js";
|
|
16
18
|
import { isIconName } from "./icons/index.js";
|
|
@@ -38,6 +40,9 @@ import {
|
|
|
38
40
|
MAX_NOTIFICATION_KIND_LENGTH,
|
|
39
41
|
MAX_OPTION_LABEL_LENGTH,
|
|
40
42
|
MAX_OPTIONS,
|
|
43
|
+
MAX_PACK_NOTE_LENGTH,
|
|
44
|
+
MAX_PACK_NOTE_OUTCOME_LENGTH,
|
|
45
|
+
MAX_PACK_NOTE_PATH_LENGTH,
|
|
41
46
|
MAX_PERSON_NAME_LENGTH,
|
|
42
47
|
MAX_PERSON_TITLE_LENGTH,
|
|
43
48
|
MAX_PROJECT_DESCRIPTION_LENGTH,
|
|
@@ -52,6 +57,7 @@ import {
|
|
|
52
57
|
MAX_RUNNER_USAGE_WINDOWS,
|
|
53
58
|
MAX_SEAL_REASON_LENGTH,
|
|
54
59
|
MAX_SECRET_LENGTH,
|
|
60
|
+
MAX_SECRET_OFFER_NOTE_LENGTH,
|
|
55
61
|
MAX_SERVICE_PARAMETERS,
|
|
56
62
|
MAX_SERVICE_VALUE_LENGTH,
|
|
57
63
|
MAX_SIGNAL_KEY_LENGTH,
|
|
@@ -91,6 +97,7 @@ import {
|
|
|
91
97
|
LINK_SOURCES,
|
|
92
98
|
MEMBERSHIP_SOURCES,
|
|
93
99
|
PACK_CONNECT_ENDINGS,
|
|
100
|
+
PACK_NOTE_STATES,
|
|
94
101
|
PEOPLE_VISIBILITIES,
|
|
95
102
|
PERSON_KINDS,
|
|
96
103
|
PERSON_ROLES,
|
|
@@ -105,6 +112,7 @@ import {
|
|
|
105
112
|
RUN_ENDINGS,
|
|
106
113
|
RUN_STATUSES,
|
|
107
114
|
SECRET_ACCESSES,
|
|
115
|
+
SECRET_OFFER_STATES,
|
|
108
116
|
SERVICE_ROLES,
|
|
109
117
|
SESSION_ENDS,
|
|
110
118
|
SESSION_KINDS,
|
|
@@ -138,8 +146,22 @@ const paragraphs = (maxLength: number) =>
|
|
|
138
146
|
/** A body in Markdown. */
|
|
139
147
|
const body = paragraphs(MAX_BODY_LENGTH);
|
|
140
148
|
|
|
149
|
+
/**
|
|
150
|
+
* An address of the web someone sent, of the schemes named: trimmed, bounded, and with nothing
|
|
151
|
+
* in it that hides. A control character is run by the terminal a link is printed in, and an
|
|
152
|
+
* invisible one makes an address read as another, so neither is taken, a tab and a line break
|
|
153
|
+
* among them, which an address has no use for.
|
|
154
|
+
*/
|
|
155
|
+
const link = (protocol: RegExp) =>
|
|
156
|
+
z.string().check(
|
|
157
|
+
z.trim(),
|
|
158
|
+
z.maxLength(MAX_URL_LENGTH),
|
|
159
|
+
z.refine((value) => !hasForbiddenCodePoint(value), "must not contain control characters"),
|
|
160
|
+
z.url({ protocol }),
|
|
161
|
+
);
|
|
162
|
+
|
|
141
163
|
/** A link a person adds to a task: the web, over https, and nothing that runs. */
|
|
142
|
-
const url =
|
|
164
|
+
const url = link(/^https$/);
|
|
143
165
|
|
|
144
166
|
const uuid = z.uuid();
|
|
145
167
|
/** An ISO 8601 instant, as the server writes it. */
|
|
@@ -147,6 +169,8 @@ const instant = z.iso.datetime();
|
|
|
147
169
|
/** A calendar day (`2026-10-20`): a plan is made in days, wherever the people are (ADR-0019). */
|
|
148
170
|
const day = z.iso.date();
|
|
149
171
|
const count = z.int().check(z.nonnegative());
|
|
172
|
+
/** An hour and a minute of the day, as `09:00`. */
|
|
173
|
+
const clockTime = z.string().check(z.regex(/^(?:[01][0-9]|2[0-3]):[0-5][0-9]$/));
|
|
150
174
|
|
|
151
175
|
/** A person of the workspace, as the pages show them. Nothing here is a secret. */
|
|
152
176
|
/** A language tag as a browser sends one (`en`, `ko-KR`). */
|
|
@@ -595,6 +619,15 @@ export const restWorkspaceSchema = z.object({
|
|
|
595
619
|
* for none. Optional, so that a console older than it still answers.
|
|
596
620
|
*/
|
|
597
621
|
packToken: z.optional(z.nullable(z.object({ setAt: instant }))),
|
|
622
|
+
/**
|
|
623
|
+
* Who keeps the organization's skills (ADR-0178), the member the notes on them wait for, by
|
|
624
|
+
* their id; `null` for nobody, when they wait for the administrators. And the hour of the
|
|
625
|
+
* keeper's round, in the workspace's time zone, at which the console wakes a keeper that is
|
|
626
|
+
* an agent account where a note was left since the last; `null` for no round. Answered from
|
|
627
|
+
* the release that carries the notes and read as optional.
|
|
628
|
+
*/
|
|
629
|
+
keeperId: z.optional(z.nullable(uuid)),
|
|
630
|
+
roundAt: z.optional(z.nullable(clockTime)),
|
|
598
631
|
}),
|
|
599
632
|
/**
|
|
600
633
|
* Who sees whom on the People page (ADR-0035): everyone, or the people one shares a project
|
|
@@ -632,6 +665,10 @@ export const restWorkspacePatchSchema = z
|
|
|
632
665
|
handle: z.optional(z.nullable(z.string().check(z.refine(isHandle, "is a short name")))),
|
|
633
666
|
/** Its mail and web domain, in small letters; `null` for none. */
|
|
634
667
|
domain: z.optional(z.nullable(z.string().check(z.refine(isDomain, "is a domain")))),
|
|
668
|
+
/** Who keeps the organization's skills (ADR-0178), a member by their id; `null` for nobody. */
|
|
669
|
+
packKeeperId: z.optional(z.nullable(uuid)),
|
|
670
|
+
/** The hour of the keeper's round, `HH:MM` in the workspace's time zone; `null` for no round. */
|
|
671
|
+
packRoundAt: z.optional(z.nullable(clockTime)),
|
|
635
672
|
/** The services named anew, by role: one left out stays as it is, `null` takes one away. */
|
|
636
673
|
services: z.optional(
|
|
637
674
|
z.object({
|
|
@@ -889,6 +926,13 @@ export const restRunnerHeartbeatInputSchema = z.object({
|
|
|
889
926
|
* out by a runner of before, and empty where the product has said nothing.
|
|
890
927
|
*/
|
|
891
928
|
usage: z.optional(z.array(runnerUsageWindow).check(z.maxLength(MAX_RUNNER_USAGE_WINDOWS))),
|
|
929
|
+
/**
|
|
930
|
+
* When the runner said the reason, by its machine's clock: a reason changes under a state
|
|
931
|
+
* that stays, a turn completes or a new conversation begins while the agent runs on, and is
|
|
932
|
+
* said again the same, so the console cannot tell a turn that just completed from one that
|
|
933
|
+
* did an hour ago. Left out by a runner of before.
|
|
934
|
+
*/
|
|
935
|
+
reasonAt: z.optional(instant),
|
|
892
936
|
});
|
|
893
937
|
export type RestRunnerHeartbeatInput = z.infer<typeof restRunnerHeartbeatInputSchema>;
|
|
894
938
|
|
|
@@ -1004,7 +1048,14 @@ export type RestRunnerHeartbeat = z.infer<typeof restRunnerHeartbeatSchema>;
|
|
|
1004
1048
|
export const restAgentStateSchema = z.object({
|
|
1005
1049
|
state: z.enum(AGENT_STATES),
|
|
1006
1050
|
reason: z.nullable(z.string()),
|
|
1051
|
+
/** Since when the state stands: not when the reason was said, which changes under a state that stays. */
|
|
1007
1052
|
since: instant,
|
|
1053
|
+
/**
|
|
1054
|
+
* When the reason was said: the same moment as `since` where the two came together, a later
|
|
1055
|
+
* one where the reason changed under the state. Left out by a console of before, and `null`
|
|
1056
|
+
* where the console keeps no moment for it: the reason is then shown with none.
|
|
1057
|
+
*/
|
|
1058
|
+
reasonAt: z.optional(z.nullable(instant)),
|
|
1008
1059
|
heardAt: z.nullable(instant),
|
|
1009
1060
|
/**
|
|
1010
1061
|
* Until when it stands so, where its runner said (ADR-0150): when a usage limit resets.
|
|
@@ -1424,11 +1475,71 @@ export const restAgentSecretAccessesSchema = z.object({
|
|
|
1424
1475
|
});
|
|
1425
1476
|
export type RestAgentSecretAccesses = z.infer<typeof restAgentSecretAccessesSchema>;
|
|
1426
1477
|
|
|
1478
|
+
/**
|
|
1479
|
+
* What `POST /api/v1/agents/<handle>/secret-offers` is sent (ADR-0169): the name the offerer
|
|
1480
|
+
* proposes, the value, up to `MAX_AGENT_SECRET_BYTES` of UTF-8, what it is for in a line, and
|
|
1481
|
+
* optionally the day the value ends on.
|
|
1482
|
+
*/
|
|
1483
|
+
export const restAgentSecretOfferInputSchema = z.object({
|
|
1484
|
+
name: z.string().check(z.refine(isSecretName)),
|
|
1485
|
+
value: z.string().check(z.minLength(1), z.maxLength(MAX_AGENT_SECRET_BYTES)),
|
|
1486
|
+
note: z.optional(z.nullable(line(MAX_SECRET_OFFER_NOTE_LENGTH))),
|
|
1487
|
+
expiresOn: z.optional(z.nullable(day)),
|
|
1488
|
+
});
|
|
1489
|
+
export type RestAgentSecretOfferInput = z.infer<typeof restAgentSecretOfferInputSchema>;
|
|
1490
|
+
|
|
1491
|
+
/**
|
|
1492
|
+
* A secret offered to an agent account (ADR-0169), as its listing says it: never its value. The
|
|
1493
|
+
* name the offerer proposed, what they said it is for, who offered it and through which agent,
|
|
1494
|
+
* how it stands, until when it waits, and, once the account took it, the name it keeps it under.
|
|
1495
|
+
*/
|
|
1496
|
+
export const restAgentSecretOfferSchema = z.object({
|
|
1497
|
+
id: uuid,
|
|
1498
|
+
name: z.string(),
|
|
1499
|
+
note: z.nullable(z.string()),
|
|
1500
|
+
/** Who offered it; `null` for someone who is no longer there. */
|
|
1501
|
+
by: z.nullable(restPersonSchema),
|
|
1502
|
+
/** The agent they offered it through, when they acted with a token; `null` when they did it themselves. */
|
|
1503
|
+
agent: z.nullable(z.string()),
|
|
1504
|
+
expiresOn: z.nullable(day),
|
|
1505
|
+
state: z.enum(SECRET_OFFER_STATES),
|
|
1506
|
+
at: instant,
|
|
1507
|
+
/** Until when it waits: past it, the offer is gone as one left is. */
|
|
1508
|
+
endsAt: instant,
|
|
1509
|
+
/** When the account took or left it, or its days ran out; `null` while it waits. */
|
|
1510
|
+
decidedAt: z.nullable(instant),
|
|
1511
|
+
/** The name the account keeps it under, once taken; `null` otherwise. */
|
|
1512
|
+
takenAs: z.nullable(z.string()),
|
|
1513
|
+
});
|
|
1514
|
+
export type RestAgentSecretOffer = z.infer<typeof restAgentSecretOfferSchema>;
|
|
1515
|
+
|
|
1516
|
+
/**
|
|
1517
|
+
* `GET /api/v1/agents/me/secret-offers`, the offers that wait for the account itself, and
|
|
1518
|
+
* `GET /api/v1/agents/<handle>/secret-offers`, the account's record of them for a supervisor,
|
|
1519
|
+
* the newest first.
|
|
1520
|
+
*/
|
|
1521
|
+
export const restAgentSecretOffersSchema = z.object({
|
|
1522
|
+
items: z.array(restAgentSecretOfferSchema),
|
|
1523
|
+
});
|
|
1524
|
+
export type RestAgentSecretOffers = z.infer<typeof restAgentSecretOffersSchema>;
|
|
1525
|
+
|
|
1526
|
+
/**
|
|
1527
|
+
* What `POST /api/v1/agents/me/secret-offers/<id>/take` is sent: the name to keep the value
|
|
1528
|
+
* under, where another than the one offered, and whether it takes the place of a secret the
|
|
1529
|
+
* account keeps under that name already.
|
|
1530
|
+
*/
|
|
1531
|
+
export const restAgentSecretOfferTakeInputSchema = z.object({
|
|
1532
|
+
as: z.optional(z.string().check(z.refine(isSecretName))),
|
|
1533
|
+
replace: z.optional(z.boolean()),
|
|
1534
|
+
});
|
|
1535
|
+
export type RestAgentSecretOfferTakeInput = z.infer<typeof restAgentSecretOfferTakeInputSchema>;
|
|
1536
|
+
|
|
1427
1537
|
/**
|
|
1428
1538
|
* `GET /api/v1/me/manager`: whom whoever asks reports to, a person or an agent account, `null`
|
|
1429
1539
|
* for nobody; and the administrators of the workspace, who stand in where there is nobody, or
|
|
1430
|
-
* the manager is out (ADR-0084)
|
|
1431
|
-
* board: a decision is addressed to whomever
|
|
1540
|
+
* the manager is out (ADR-0084), whoever asks left out where they are one (ADR-0180). A manager
|
|
1541
|
+
* is whom a member turns to first, not a rule of the board: a decision is addressed to whomever
|
|
1542
|
+
* the asker names.
|
|
1432
1543
|
*/
|
|
1433
1544
|
export const restManagerSchema = z.object({
|
|
1434
1545
|
manager: z.nullable(restPersonSchema),
|
|
@@ -1436,6 +1547,116 @@ export const restManagerSchema = z.object({
|
|
|
1436
1547
|
});
|
|
1437
1548
|
export type RestManager = z.infer<typeof restManagerSchema>;
|
|
1438
1549
|
|
|
1550
|
+
/**
|
|
1551
|
+
* A note on the pack (ADR-0178): what a run showed a skill, or a page of the pack, to lack or to
|
|
1552
|
+
* say wrong, left by whoever met it for whoever keeps the pack; or, with no path, a job of a kind
|
|
1553
|
+
* that comes again for which the pack has no skill. Kept by the console and never in the pack,
|
|
1554
|
+
* which may be public. Who left it and through which agent, the project it was left from where
|
|
1555
|
+
* one was named, how it stands, and, once closed, what became of it and who said so.
|
|
1556
|
+
*/
|
|
1557
|
+
export const restPackNoteSchema = z.object({
|
|
1558
|
+
id: uuid,
|
|
1559
|
+
/** The address of the pack it is on, as the console read it then; `null` where it names none. */
|
|
1560
|
+
pack: z.nullable(z.string()),
|
|
1561
|
+
/** The skill or the page it is on, by its path in the pack; `null` for a job no skill fit. */
|
|
1562
|
+
path: z.nullable(z.string()),
|
|
1563
|
+
body: z.string(),
|
|
1564
|
+
/** One of `PACK_NOTE_STATES`. */
|
|
1565
|
+
state: z.enum(PACK_NOTE_STATES),
|
|
1566
|
+
/** Who left it; `null` for a member the asker may not see (ADR-0035). */
|
|
1567
|
+
by: z.nullable(restPersonSchema),
|
|
1568
|
+
/** The agent they left it through, when they acted with a token; `null` when they did it themselves, or the asker may not see them. */
|
|
1569
|
+
agent: z.nullable(z.string()),
|
|
1570
|
+
/** The key of the project it was left from; `null` where none was named, or the asker may not see it. */
|
|
1571
|
+
project: z.nullable(z.string()),
|
|
1572
|
+
at: instant,
|
|
1573
|
+
/** What became of it, in its closer's words; `null` while it is open. */
|
|
1574
|
+
outcome: z.nullable(z.string()),
|
|
1575
|
+
/** Who closed it, and the agent they closed it through; `null` while it is open, and for a member the asker may not see. */
|
|
1576
|
+
closedBy: z.nullable(restPersonSchema),
|
|
1577
|
+
closedAgent: z.nullable(z.string()),
|
|
1578
|
+
closedAt: z.nullable(instant),
|
|
1579
|
+
});
|
|
1580
|
+
export type RestPackNote = z.infer<typeof restPackNoteSchema>;
|
|
1581
|
+
|
|
1582
|
+
/**
|
|
1583
|
+
* `GET /api/v1/pack-notes`: a page of the notes the asker reads, the oldest first, everyone's
|
|
1584
|
+
* for whoever keeps the pack and for an administrator (`everyones`), their own for anyone else;
|
|
1585
|
+
* how many of all of them are open; whether a member keeps the pack (`kept`), and who, `null`
|
|
1586
|
+
* for nobody and for a keeper the asker may not see; and the hour of their round, `null` for
|
|
1587
|
+
* none.
|
|
1588
|
+
*/
|
|
1589
|
+
export const restPackNotesSchema = z.object({
|
|
1590
|
+
items: z.array(restPackNoteSchema),
|
|
1591
|
+
open: count,
|
|
1592
|
+
everyones: z.boolean(),
|
|
1593
|
+
kept: z.boolean(),
|
|
1594
|
+
keeper: z.nullable(restPersonSchema),
|
|
1595
|
+
roundAt: z.nullable(clockTime),
|
|
1596
|
+
});
|
|
1597
|
+
export type RestPackNotes = z.infer<typeof restPackNotesSchema>;
|
|
1598
|
+
|
|
1599
|
+
/** What a note's text is: a few sentences, with their line breaks, and something in them. */
|
|
1600
|
+
const packNoteText = (maxLength: number) =>
|
|
1601
|
+
z.string().check(
|
|
1602
|
+
z.trim(),
|
|
1603
|
+
z.minLength(1),
|
|
1604
|
+
z.maxLength(maxLength),
|
|
1605
|
+
z.refine((value) => !hasForbiddenCodePoint(value, true), "must not contain control characters"),
|
|
1606
|
+
);
|
|
1607
|
+
|
|
1608
|
+
/**
|
|
1609
|
+
* Whether a note may be on this path: a path of the pack from its root, as the pack's own
|
|
1610
|
+
* reads hold one (`parseRepoPath` of @skillcdn/core), with no slash at either end and no `.`
|
|
1611
|
+
* or `..` among its parts, or `.` alone, a pack that is one skill at its root. A note names
|
|
1612
|
+
* what it is on and reads nothing there, yet what is listed as a path is one.
|
|
1613
|
+
*/
|
|
1614
|
+
export const isPackNotePath = (path: string): boolean =>
|
|
1615
|
+
path === "." || (path.length > 0 && parseRepoPath(path).ok && !path.endsWith("/"));
|
|
1616
|
+
|
|
1617
|
+
/**
|
|
1618
|
+
* What `POST /api/v1/pack-notes` is sent: what the note says; the path of the skill or the page
|
|
1619
|
+
* it is on, left out or `null` for a job no skill fit; and the key of the project it is left
|
|
1620
|
+
* from, where the command names one, whose pack it is then on.
|
|
1621
|
+
*/
|
|
1622
|
+
export const restPackNoteInputSchema = z.object({
|
|
1623
|
+
path: z.optional(
|
|
1624
|
+
z.nullable(
|
|
1625
|
+
line(MAX_PACK_NOTE_PATH_LENGTH).check(
|
|
1626
|
+
z.refine(
|
|
1627
|
+
isPackNotePath,
|
|
1628
|
+
"is a path of the pack from its root, with no slash at either end, no backslash and no . or .. among its parts",
|
|
1629
|
+
),
|
|
1630
|
+
),
|
|
1631
|
+
),
|
|
1632
|
+
),
|
|
1633
|
+
body: packNoteText(MAX_PACK_NOTE_LENGTH),
|
|
1634
|
+
project: z.optional(z.string().check(z.minLength(1), z.maxLength(MAX_PROJECT_KEY_LENGTH))),
|
|
1635
|
+
});
|
|
1636
|
+
export type RestPackNoteInput = z.infer<typeof restPackNoteInputSchema>;
|
|
1637
|
+
|
|
1638
|
+
/**
|
|
1639
|
+
* What leaving a note answers: the note, whether a member keeps the pack it waits for (`kept`),
|
|
1640
|
+
* and who, `null` for nobody and for a keeper the asker may not see.
|
|
1641
|
+
*/
|
|
1642
|
+
export const restPackNoteLeftSchema = z.object({
|
|
1643
|
+
note: restPackNoteSchema,
|
|
1644
|
+
kept: z.boolean(),
|
|
1645
|
+
keeper: z.nullable(restPersonSchema),
|
|
1646
|
+
});
|
|
1647
|
+
export type RestPackNoteLeft = z.infer<typeof restPackNoteLeftSchema>;
|
|
1648
|
+
|
|
1649
|
+
/**
|
|
1650
|
+
* What `POST /api/v1/pack-notes/<id>/close` is sent: how the note ends, `done` where what it
|
|
1651
|
+
* asked for is in the pack or before a person as a proposal and `dropped` where nothing follows
|
|
1652
|
+
* from it, and what became of it, in a sentence or two.
|
|
1653
|
+
*/
|
|
1654
|
+
export const restPackNoteCloseInputSchema = z.object({
|
|
1655
|
+
state: z.enum(["done", "dropped"]),
|
|
1656
|
+
outcome: packNoteText(MAX_PACK_NOTE_OUTCOME_LENGTH),
|
|
1657
|
+
});
|
|
1658
|
+
export type RestPackNoteCloseInput = z.infer<typeof restPackNoteCloseInputSchema>;
|
|
1659
|
+
|
|
1439
1660
|
/** What an avatar's parts were rolled from: a short text of letters, digits, hyphens and underscores. */
|
|
1440
1661
|
const avatarSeed = z.string().check(z.minLength(1), z.maxLength(64), z.regex(/^[A-Za-z0-9_-]+$/));
|
|
1441
1662
|
|
|
@@ -1460,8 +1681,6 @@ export type RestAgentProposals = z.infer<typeof restAgentProposalsSchema>;
|
|
|
1460
1681
|
const elsewhereService = z.string().check(z.regex(/^[a-z][a-z0-9-]{0,39}$/));
|
|
1461
1682
|
/** What the agent is called at a service: a line, and no secret. */
|
|
1462
1683
|
const elsewhereName = line(MAX_ELSEWHERE_NAME_LENGTH);
|
|
1463
|
-
/** An hour and a minute of the day, as `09:00`. */
|
|
1464
|
-
const clockTime = z.string().check(z.regex(/^(?:[01][0-9]|2[0-3]):[0-5][0-9]$/));
|
|
1465
1684
|
/**
|
|
1466
1685
|
* The hours an agent account keeps (ADR-0085, point 11), in the workspace's time zone: when its
|
|
1467
1686
|
* day starts, which is when its day's briefing is sent, and when it ends, with a wrap then, or
|
|
@@ -1562,7 +1781,11 @@ export const restAgentSchema = z.object({
|
|
|
1562
1781
|
accounts: z.optional(restAgentElsewhereSchema),
|
|
1563
1782
|
/** The hours it keeps: answered where one account is read, to its supervisors and to the account. */
|
|
1564
1783
|
hours: z.optional(restAgentHoursSchema),
|
|
1565
|
-
/**
|
|
1784
|
+
/**
|
|
1785
|
+
* The onboarding task a console before 0.6.4 made with the account (ADR-0088), answered there
|
|
1786
|
+
* when the account was made. A console from 0.6.4 on makes none and leaves this out: the
|
|
1787
|
+
* onboarding is its first message to the account (ADR-0181).
|
|
1788
|
+
*/
|
|
1566
1789
|
onboarding: z.optional(
|
|
1567
1790
|
z.nullable(z.object({ project: z.string(), number: z.number().check(z.int()) })),
|
|
1568
1791
|
),
|
|
@@ -1584,8 +1807,9 @@ export type RestAgents = z.infer<typeof restAgentsSchema>;
|
|
|
1584
1807
|
/**
|
|
1585
1808
|
* What `POST /api/v1/agents` is sent, by an administrator: the account the agent will sign in
|
|
1586
1809
|
* with, at one of the providers the deployment has, as a listing names one; its persona; its
|
|
1587
|
-
* manager, whoever makes it where none is named
|
|
1588
|
-
*
|
|
1810
|
+
* manager, whoever makes it where none is named. A login a member already carries is made an
|
|
1811
|
+
* agent account only where `convert` asks for it, once (ADR-0104). An account is made in no
|
|
1812
|
+
* project (ADR-0181): it is put in one later, as any member is.
|
|
1589
1813
|
*/
|
|
1590
1814
|
export const restAgentInputSchema = z
|
|
1591
1815
|
.object({
|
|
@@ -1599,8 +1823,11 @@ export const restAgentInputSchema = z
|
|
|
1599
1823
|
/** Left out, the console rolls them: from the seed where one is given, from one of its own otherwise. */
|
|
1600
1824
|
avatarParts: z.optional(restAvatarPartsSchema),
|
|
1601
1825
|
managerId: z.optional(uuid),
|
|
1602
|
-
/**
|
|
1603
|
-
|
|
1826
|
+
/**
|
|
1827
|
+
* Taken and not used (ADR-0181): the key of the project an account started in, which a
|
|
1828
|
+
* console before 0.6.4 required and a command of before still sends.
|
|
1829
|
+
*/
|
|
1830
|
+
project: z.optional(z.string().check(z.minLength(1), z.maxLength(MAX_PROJECT_KEY_LENGTH))),
|
|
1604
1831
|
/**
|
|
1605
1832
|
* `true` says that the member who carries the login already is to become the account, for
|
|
1606
1833
|
* good (ADR-0104); left out, such a login is refused (`agent.login_is_member`). It asks
|
|
@@ -3166,9 +3393,14 @@ export const restCommentInputSchema = z.object({
|
|
|
3166
3393
|
});
|
|
3167
3394
|
export type RestCommentInput = z.infer<typeof restCommentInputSchema>;
|
|
3168
3395
|
|
|
3169
|
-
/**
|
|
3396
|
+
/**
|
|
3397
|
+
* What `POST .../runs/<id>/artifacts` is sent: a link to what was made. Over https; over plain
|
|
3398
|
+
* http the console takes an address of its own alone, which a console on one machine is served
|
|
3399
|
+
* at (`http://127.0.0.1:11199`), and refuses any other, so the schema lets both schemes through
|
|
3400
|
+
* and the console says which.
|
|
3401
|
+
*/
|
|
3170
3402
|
export const restArtifactInputSchema = z.object({
|
|
3171
|
-
url,
|
|
3403
|
+
url: link(/^https?$/),
|
|
3172
3404
|
label: z.optional(line(MAX_LINK_LABEL_LENGTH)),
|
|
3173
3405
|
});
|
|
3174
3406
|
export type RestArtifactInput = z.infer<typeof restArtifactInputSchema>;
|