@skillcdn/console 0.6.1 → 0.6.3
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 +14 -7
- 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 +77 -30
- 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/agent-usage.d.ts +9 -6
- package/dist/agent-usage.d.ts.map +1 -1
- package/dist/agent-usage.js +38 -8
- package/dist/agent-usage.js.map +1 -1
- package/dist/api.d.ts +4 -3
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +4 -3
- 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 +369 -130
- package/dist/cli/cli.js.map +1 -1
- package/dist/cli/format.d.ts +13 -4
- package/dist/cli/format.d.ts.map +1 -1
- package/dist/cli/format.js +43 -9
- 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 +780 -318
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/pack.d.ts +2 -2
- package/dist/cli/pack.d.ts.map +1 -1
- package/dist/cli/pack.js +6 -4
- package/dist/cli/pack.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 +110 -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/client.d.ts +22 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +7 -1
- package/dist/client.js.map +1 -1
- package/dist/components/agent-page.d.ts +61 -11
- package/dist/components/agent-page.d.ts.map +1 -1
- package/dist/components/agent-page.js +146 -35
- package/dist/components/agent-page.js.map +1 -1
- package/dist/components/agents.d.ts +3 -2
- package/dist/components/agents.d.ts.map +1 -1
- package/dist/components/agents.js +9 -3
- package/dist/components/agents.js.map +1 -1
- package/dist/components/calendar.d.ts +24 -4
- package/dist/components/calendar.d.ts.map +1 -1
- package/dist/components/calendar.js +78 -35
- package/dist/components/calendar.js.map +1 -1
- package/dist/console.d.ts.map +1 -1
- package/dist/console.js +40 -12
- package/dist/console.js.map +1 -1
- package/dist/data.d.ts +2 -0
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +4 -0
- package/dist/data.js.map +1 -1
- package/dist/desk-page.js +5 -5
- package/dist/desk-page.js.map +1 -1
- package/dist/feed-words.d.ts.map +1 -1
- package/dist/feed-words.js +18 -1
- package/dist/feed-words.js.map +1 -1
- package/dist/i18n/en.d.ts +51 -1
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +44 -2
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/ko.d.ts.map +1 -1
- package/dist/i18n/ko.js +52 -17
- package/dist/i18n/ko.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/limits.d.ts +10 -0
- package/dist/limits.d.ts.map +1 -1
- package/dist/limits.js +10 -0
- package/dist/limits.js.map +1 -1
- package/dist/plugin/capabilities.d.ts +1 -1
- package/dist/plugin/capabilities.d.ts.map +1 -1
- package/dist/plugin/capabilities.js +6 -1
- package/dist/plugin/capabilities.js.map +1 -1
- package/dist/plugin/context.d.ts +101 -8
- package/dist/plugin/context.d.ts.map +1 -1
- package/dist/plugin/limits.d.ts +7 -0
- package/dist/plugin/limits.d.ts.map +1 -1
- package/dist/plugin/limits.js +7 -0
- package/dist/plugin/limits.js.map +1 -1
- package/dist/plugin/testing.d.ts +2 -0
- package/dist/plugin/testing.d.ts.map +1 -1
- package/dist/plugin/testing.js +2 -0
- package/dist/plugin/testing.js.map +1 -1
- package/dist/rules.js +1 -1
- 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 +143 -10
- package/dist/runner/claude.js.map +1 -1
- package/dist/runner/codex.d.ts.map +1 -1
- package/dist/runner/codex.js +14 -2
- 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 +20 -4
- package/dist/runner/desk.js.map +1 -1
- package/dist/runner/message.d.ts +26 -2
- package/dist/runner/message.d.ts.map +1 -1
- package/dist/runner/message.js +120 -32
- package/dist/runner/message.js.map +1 -1
- package/dist/runner/runner.d.ts +40 -2
- package/dist/runner/runner.d.ts.map +1 -1
- package/dist/runner/runner.js +533 -32
- 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 +17 -11
- package/dist/runner/slack.d.ts.map +1 -1
- package/dist/runner/slack.js +1199 -109
- package/dist/runner/slack.js.map +1 -1
- package/dist/runner/types.d.ts +205 -6
- 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 +4 -4
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +3 -3
- package/dist/runner.js.map +1 -1
- package/dist/schemas.d.ts +263 -1
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +137 -5
- package/dist/schemas.js.map +1 -1
- package/dist/vocabulary.d.ts +7 -0
- package/dist/vocabulary.d.ts.map +1 -1
- package/dist/vocabulary.js +6 -0
- 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 +21 -12
- package/docs/specs/plugins.md +12 -7
- package/docs/specs/rest.md +14 -5
- package/docs/specs/runner.md +133 -26
- package/docs/start.md +26 -5
- package/package.json +3 -3
- package/skills/building-a-plugin/SKILL.md +3 -3
- 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/planning-the-board/references/setting-up.md +1 -1
- package/skills/running-an-agent/SKILL.md +18 -72
- package/skills/running-an-agent/references/preparing-the-machine.md +17 -0
- package/skills/running-an-agent/references/several-tasks.md +1 -1
- package/skills/running-an-agent/references/slack-app.md +55 -8
- package/skills/running-an-agent/references/the-account-and-the-invitation.md +5 -0
- package/skills/running-an-agent/references/what-was-not-seen-run-yet.md +3 -0
- package/skills/running-an-agent/references/when-the-agent-could-not-go-on.md +16 -0
- package/skills/running-an-agent/references/your-first-task.md +19 -0
- 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 +11 -15
- package/skills/working-the-board/references/a-pack-skills-questions.md +3 -0
- package/skills/working-the-board/references/a-plugins-commands.md +3 -0
- package/skills/working-the-board/references/a-review.md +3 -0
- package/skills/working-the-board/references/an-open-run.md +3 -0
- package/skills/working-the-board/references/requirements.md +7 -0
- package/skills/working-the-board/references/the-pack.md +3 -3
- package/skills/working-the-board/references/what-they-were-told.md +3 -0
- package/skills/working-the-board/references/work-given-in-chat.md +5 -0
- package/src/agent-page.tsx +133 -41
- package/src/agent-state.ts +33 -0
- package/src/agent-usage.ts +55 -12
- package/src/api.ts +23 -0
- package/src/cli/cli.ts +443 -137
- package/src/cli/format.ts +49 -9
- package/src/cli/help.ts +904 -359
- package/src/cli/pack.ts +6 -4
- package/src/cli/runner-files.ts +120 -0
- package/src/cli/runner-host.ts +48 -2
- package/src/client.ts +64 -0
- package/src/components/agent-page.tsx +264 -39
- package/src/components/agents.tsx +20 -5
- package/src/components/calendar.tsx +92 -36
- package/src/console.tsx +47 -10
- package/src/data.ts +6 -0
- package/src/desk-page.tsx +5 -5
- package/src/feed-words.ts +20 -1
- package/src/i18n/en.ts +50 -2
- package/src/i18n/ko.ts +62 -17
- package/src/index.ts +2 -0
- package/src/limits.ts +10 -0
- package/src/plugin/capabilities.ts +8 -1
- package/src/plugin/context.ts +103 -7
- package/src/plugin/limits.ts +7 -0
- package/src/plugin/testing.ts +4 -0
- package/src/rules.ts +1 -1
- package/src/runner/acp.ts +9 -3
- package/src/runner/claude.ts +159 -10
- package/src/runner/codex.ts +14 -2
- package/src/runner/config.ts +114 -1
- package/src/runner/desk.ts +23 -4
- package/src/runner/message.ts +144 -35
- package/src/runner/runner.ts +658 -35
- package/src/runner/slack-status.ts +423 -0
- package/src/runner/slack.ts +1509 -128
- package/src/runner/types.ts +200 -5
- package/src/runner/usage.ts +16 -3
- package/src/runner.ts +20 -1
- package/src/schemas.ts +161 -3
- package/src/vocabulary.ts +9 -0
- package/src/wake-text.ts +133 -0
package/src/cli/pack.ts
CHANGED
|
@@ -216,8 +216,10 @@ function listingOf(
|
|
|
216
216
|
commit: mount.commit,
|
|
217
217
|
items: items.slice(from, end),
|
|
218
218
|
diagnostics: index.diagnostics,
|
|
219
|
-
// The
|
|
220
|
-
|
|
219
|
+
// The listing the command prints is of the skills alone (SkillCDN 0.6.3): the documents
|
|
220
|
+
// outside them are counted from these, with what reads them, and a page that ends before
|
|
221
|
+
// the skills do says how many are left.
|
|
222
|
+
totals: { skills: index.skills.length, documents: index.documents.length },
|
|
221
223
|
nextCursor: end < items.length ? listingCursor(end, mount.commit) : null,
|
|
222
224
|
};
|
|
223
225
|
}
|
|
@@ -399,8 +401,8 @@ export function consolePack(
|
|
|
399
401
|
|
|
400
402
|
/**
|
|
401
403
|
* The listing of a pack as the command prints it. Where the pack answered, `text` is what the
|
|
402
|
-
* skillcdn command prints for it, what a client is told on connect and then every skill
|
|
403
|
-
*
|
|
404
|
+
* skillcdn command prints for it, what a client is told on connect and then every skill, the
|
|
405
|
+
* documents counted, between the lines of the console's own: where the pack is and how it answered,
|
|
404
406
|
* where a person connects an agent of their own, and where the console's own skills are on this
|
|
405
407
|
* machine. Where it did not, why, with that last line still.
|
|
406
408
|
*/
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import type { KeptBySource, RunnerState } from "../runner/runner.js";
|
|
2
|
+
|
|
3
|
+
// The runner's own files under the desk's `work/`, as `console runner` reads them back and
|
|
4
|
+
// writes them (ADR-0085, ADR-0166): its state between its own restarts, and what each wake
|
|
5
|
+
// source keeps. A file of the desk may hold anything, whatever wrote it: what is read of one is
|
|
6
|
+
// data, bounded, and nothing where it does not read.
|
|
7
|
+
|
|
8
|
+
/** What the runner keeps between its own restarts, as its file says it; nothing for a file that does not read. */
|
|
9
|
+
export function runnerStateOf(text: string | undefined): RunnerState | undefined {
|
|
10
|
+
if (text === undefined) {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
let json: unknown;
|
|
14
|
+
try {
|
|
15
|
+
json = JSON.parse(text);
|
|
16
|
+
} catch {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
if (typeof json !== "object" || json === null) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
const delivered = "delivered" in json ? json.delivered : undefined;
|
|
23
|
+
const conversation = "conversation" in json ? json.conversation : undefined;
|
|
24
|
+
const driver = "driver" in json ? json.driver : undefined;
|
|
25
|
+
const limited = "limited" in json ? json.limited : undefined;
|
|
26
|
+
const kept: unknown = "kept" in json ? json.kept : undefined;
|
|
27
|
+
const began: unknown = "began" in json ? json.began : undefined;
|
|
28
|
+
if (typeof delivered !== "number" || !Number.isSafeInteger(delivered) || delivered < 0) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A moment in milliseconds since the epoch, or nothing for anything else: a number past what
|
|
33
|
+
* a date holds would fail the runner at every start, where it says the moment in words.
|
|
34
|
+
*/
|
|
35
|
+
const momentOf = (value: unknown): number | undefined =>
|
|
36
|
+
typeof value === "number" && Number.isSafeInteger(value) && value > 0 && value < 1e14
|
|
37
|
+
? value
|
|
38
|
+
: undefined;
|
|
39
|
+
const since =
|
|
40
|
+
typeof limited === "object" && limited !== null && "since" in limited
|
|
41
|
+
? momentOf(limited.since)
|
|
42
|
+
: undefined;
|
|
43
|
+
return {
|
|
44
|
+
delivered,
|
|
45
|
+
conversation:
|
|
46
|
+
typeof conversation === "string" && conversation.length > 0 && conversation.length <= 200
|
|
47
|
+
? conversation
|
|
48
|
+
: undefined,
|
|
49
|
+
// The driver the conversation was begun under, as a registry spells one.
|
|
50
|
+
driver:
|
|
51
|
+
typeof driver === "string" && /^[a-z][a-z0-9-]{0,39}$/.test(driver) ? driver : undefined,
|
|
52
|
+
// The usage limit the agent is not back from (ADR-0150): since when, and until when where the product said.
|
|
53
|
+
...(since === undefined || typeof limited !== "object" || limited === null
|
|
54
|
+
? {}
|
|
55
|
+
: {
|
|
56
|
+
limited: {
|
|
57
|
+
since,
|
|
58
|
+
until: "until" in limited ? momentOf(limited.until) : undefined,
|
|
59
|
+
},
|
|
60
|
+
}),
|
|
61
|
+
// The signals the record has as delivered that the agent never read: taken from the stream once more.
|
|
62
|
+
...(Array.isArray(kept)
|
|
63
|
+
? {
|
|
64
|
+
kept: kept
|
|
65
|
+
.filter((number): number is number => momentOf(number) !== undefined)
|
|
66
|
+
.slice(0, 50),
|
|
67
|
+
}
|
|
68
|
+
: {}),
|
|
69
|
+
// When the conversation kept began (ADR-0166): nothing for a file of before, or a number that
|
|
70
|
+
// is none. One ahead of the machine's clock is the runner's to hold to it, which knows the time.
|
|
71
|
+
...(momentOf(began) === undefined ? {} : { began: momentOf(began) }),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** How many names a wake source's file holds at the most, and how long a name and what stands under it may be. */
|
|
76
|
+
export const MAX_KEPT_NAMES = 2000;
|
|
77
|
+
const MAX_KEPT_LENGTH = 200;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* What a wake source kept under a runner before this one (ADR-0166), as its file says it: the
|
|
81
|
+
* names it keeps with what stands under each, the oldest first, and nothing for a file that
|
|
82
|
+
* does not read. Read as data: a pair that is none, or longer than a name is, is left out, and
|
|
83
|
+
* no more is read than a source keeps. What a name and what stands under it mean is the
|
|
84
|
+
* source's own, which holds each to its shape when it starts.
|
|
85
|
+
*/
|
|
86
|
+
export function keptBySourceOf(text: string | undefined): KeptBySource | undefined {
|
|
87
|
+
if (text === undefined) {
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
let json: unknown;
|
|
91
|
+
try {
|
|
92
|
+
json = JSON.parse(text);
|
|
93
|
+
} catch {
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
if (!Array.isArray(json)) {
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
const kept: [string, string][] = [];
|
|
100
|
+
for (const pair of json.slice(-MAX_KEPT_NAMES)) {
|
|
101
|
+
if (!Array.isArray(pair) || pair.length !== 2) {
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
const [name, value]: unknown[] = pair;
|
|
105
|
+
if (
|
|
106
|
+
typeof name === "string" &&
|
|
107
|
+
typeof value === "string" &&
|
|
108
|
+
name.length > 0 &&
|
|
109
|
+
name.length <= MAX_KEPT_LENGTH &&
|
|
110
|
+
value.length <= MAX_KEPT_LENGTH
|
|
111
|
+
) {
|
|
112
|
+
kept.push([name, value]);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return kept;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** What a wake source keeps, as its file holds it: the latest names, no more than are read back. */
|
|
119
|
+
export const keptFileOf = (kept: KeptBySource): string =>
|
|
120
|
+
`${JSON.stringify(kept.slice(-MAX_KEPT_NAMES))}\n`;
|
package/src/cli/runner-host.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { randomInt } from "node:crypto";
|
|
2
|
-
import { chmod, mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
1
|
+
import { randomBytes, randomInt } from "node:crypto";
|
|
2
|
+
import { chmod, mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
3
3
|
import { type as osType, release, userInfo } from "node:os";
|
|
4
4
|
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
5
5
|
import process from "node:process";
|
|
@@ -24,6 +24,13 @@ export interface RunnerHost {
|
|
|
24
24
|
readText(path: string): Promise<string | undefined>;
|
|
25
25
|
/** Writes a file under the desk for its owner alone, its folders made on the way: a text, or bytes as they are. */
|
|
26
26
|
writePrivate(path: string, value: string | Uint8Array): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Puts a text in place of a file under the desk, for its owner alone, whole or not at all:
|
|
29
|
+
* written beside the file first and then given its name, so that a write cut short, by a
|
|
30
|
+
* crash or a machine that went down, leaves the file there was. For what the runner reads
|
|
31
|
+
* back when it starts: its state, and what each wake source keeps (ADR-0166).
|
|
32
|
+
*/
|
|
33
|
+
replacePrivate(path: string, text: string): Promise<void>;
|
|
27
34
|
/** Removes a file under the desk; one that is not there is removed already. */
|
|
28
35
|
remove(path: string): Promise<void>;
|
|
29
36
|
/** Opens a socket for a wake source: the messages of text it carries, until it closes. */
|
|
@@ -65,6 +72,31 @@ function alive(pid: number): boolean {
|
|
|
65
72
|
}
|
|
66
73
|
}
|
|
67
74
|
|
|
75
|
+
/** How many times a file is given its name where the system says the one there is in use, and how long between. */
|
|
76
|
+
const RENAME_TRIES = 5;
|
|
77
|
+
const RENAME_PAUSE_MS = 20;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Gives a file the name of another, in its place. On Windows the system refuses while anything
|
|
81
|
+
* else has the file there open, a scanner or the same write a moment before: tried again a few
|
|
82
|
+
* times, since such a hold lasts a moment.
|
|
83
|
+
*/
|
|
84
|
+
async function takeName(from: string, to: string): Promise<void> {
|
|
85
|
+
for (let tries = 1; ; tries += 1) {
|
|
86
|
+
try {
|
|
87
|
+
await rename(from, to);
|
|
88
|
+
return;
|
|
89
|
+
} catch (error) {
|
|
90
|
+
const code =
|
|
91
|
+
typeof error === "object" && error !== null && "code" in error ? error.code : undefined;
|
|
92
|
+
if (tries >= RENAME_TRIES || (code !== "EPERM" && code !== "EBUSY" && code !== "EACCES")) {
|
|
93
|
+
throw error;
|
|
94
|
+
}
|
|
95
|
+
await new Promise((resolve) => setTimeout(resolve, RENAME_PAUSE_MS * tries));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
68
100
|
/**
|
|
69
101
|
* The runner's host on this machine, in `cwd`, with `env` as what a product's process begins
|
|
70
102
|
* from, and where a keeper names itself (`CONSOLE_RUNNER_KEEPER`).
|
|
@@ -117,6 +149,20 @@ export function createRunnerHost(
|
|
|
117
149
|
// A file that was there keeps the mode it had: say it again.
|
|
118
150
|
await chmod(full, 0o600);
|
|
119
151
|
},
|
|
152
|
+
async replacePrivate(path, text) {
|
|
153
|
+
const full = under(path);
|
|
154
|
+
await mkdir(dirname(full), { recursive: true });
|
|
155
|
+
// Beside the file, so that giving it the name moves nothing from one volume to another;
|
|
156
|
+
// under a name of its own, so that two writes at once never share one.
|
|
157
|
+
const beside = `${full}.${randomBytes(6).toString("hex")}.tmp`;
|
|
158
|
+
try {
|
|
159
|
+
await writeFile(beside, text, { mode: 0o600, flag: "wx" });
|
|
160
|
+
await takeName(beside, full);
|
|
161
|
+
} catch (error) {
|
|
162
|
+
await rm(beside, { force: true }).catch(() => undefined);
|
|
163
|
+
throw error;
|
|
164
|
+
}
|
|
165
|
+
},
|
|
120
166
|
async remove(path) {
|
|
121
167
|
await rm(under(path), { force: true });
|
|
122
168
|
},
|
package/src/client.ts
CHANGED
|
@@ -24,6 +24,10 @@ import {
|
|
|
24
24
|
type RestAgentSecret,
|
|
25
25
|
type RestAgentSecretAccesses,
|
|
26
26
|
type RestAgentSecretInput,
|
|
27
|
+
type RestAgentSecretOffer,
|
|
28
|
+
type RestAgentSecretOfferInput,
|
|
29
|
+
type RestAgentSecretOffers,
|
|
30
|
+
type RestAgentSecretOfferTakeInput,
|
|
27
31
|
type RestAgentSecrets,
|
|
28
32
|
type RestAgentSecretValue,
|
|
29
33
|
type RestAgentSession,
|
|
@@ -156,11 +160,15 @@ import {
|
|
|
156
160
|
type RestWorkspace,
|
|
157
161
|
type RestWorkspacePackConnect,
|
|
158
162
|
type RestWorkspacePatch,
|
|
163
|
+
type RestWriters,
|
|
164
|
+
type RestWritersInput,
|
|
159
165
|
restAgentInvitationMadeSchema,
|
|
160
166
|
restAgentInvitationStateSchema,
|
|
161
167
|
restAgentProposalsSchema,
|
|
162
168
|
restAgentSchema,
|
|
163
169
|
restAgentSecretAccessesSchema,
|
|
170
|
+
restAgentSecretOfferSchema,
|
|
171
|
+
restAgentSecretOffersSchema,
|
|
164
172
|
restAgentSecretSchema,
|
|
165
173
|
restAgentSecretsSchema,
|
|
166
174
|
restAgentSecretValueSchema,
|
|
@@ -250,6 +258,7 @@ import {
|
|
|
250
258
|
restWorkSchema,
|
|
251
259
|
restWorkspacePackConnectSchema,
|
|
252
260
|
restWorkspaceSchema,
|
|
261
|
+
restWritersSchema,
|
|
253
262
|
} from "./schemas.js";
|
|
254
263
|
import { readSse } from "./sse.js";
|
|
255
264
|
import type { GoalState, TaskState } from "./vocabulary.js";
|
|
@@ -795,6 +804,21 @@ export interface ConsoleClient {
|
|
|
795
804
|
input: RestAgentSecretInput,
|
|
796
805
|
): Promise<RestAgentSecret>;
|
|
797
806
|
removeAgentSecret(handle: string, name: string): Promise<void>;
|
|
807
|
+
/**
|
|
808
|
+
* A secret offered to an agent account (ADR-0169), by any member who sees it: kept sealed
|
|
809
|
+
* apart from its store until the account takes it or leaves it, and answered to nobody. The
|
|
810
|
+
* answer is the offer as its listing says it, never the value.
|
|
811
|
+
*/
|
|
812
|
+
offerAgentSecret(handle: string, input: RestAgentSecretOfferInput): Promise<RestAgentSecretOffer>;
|
|
813
|
+
/** The account's record of what it was offered, the newest first, for a supervisor: never a value. */
|
|
814
|
+
agentSecretOffers(handle: string, signal?: AbortSignal): Promise<RestAgentSecretOffers>;
|
|
815
|
+
/**
|
|
816
|
+
* What the account itself was offered and has not taken or left, on a session of its own; one
|
|
817
|
+
* taken into its store, under the name offered or another; one left.
|
|
818
|
+
*/
|
|
819
|
+
secretOffers(signal?: AbortSignal): Promise<RestAgentSecretOffers>;
|
|
820
|
+
takeSecretOffer(id: string, input?: RestAgentSecretOfferTakeInput): Promise<RestAgentSecret>;
|
|
821
|
+
leaveSecretOffer(id: string): Promise<void>;
|
|
798
822
|
/** The invitation that leads a machine to an agent account (ADR-0088), as it stands; for a supervisor. */
|
|
799
823
|
agentInvitation(handle: string, signal?: AbortSignal): Promise<RestAgentInvitationState>;
|
|
800
824
|
/** Makes the invitation, in place of the one there was: the code this once, and the command to run with it. */
|
|
@@ -838,6 +862,12 @@ export interface ConsoleClient {
|
|
|
838
862
|
signalStream(after: number, signal: AbortSignal): AsyncIterable<RestSignal>;
|
|
839
863
|
/** Raises a wake of the runner's own, from a wake source on its machine: it comes back in order on the stream. */
|
|
840
864
|
raiseWake(input: Omit<RestRunnerWake, "kind">): Promise<RestSignal>;
|
|
865
|
+
/**
|
|
866
|
+
* Who accounts at a messenger are to the agent account that asks (ADR-0164): the member each
|
|
867
|
+
* is, as a plugin that holds `people:accounts` said it, and whether they supervise the
|
|
868
|
+
* account. A console older than the route answers that there is none (`404`).
|
|
869
|
+
*/
|
|
870
|
+
writers(input: RestWritersInput, signal?: AbortSignal): Promise<RestWriters>;
|
|
841
871
|
/** An agent account raises a wake for itself (ADR-0145), by its own command: now, or kept for a moment to come. */
|
|
842
872
|
raiseOwnWake(input: RestOwnWakeInput): Promise<RestOwnWakeRaised>;
|
|
843
873
|
/** The wakes an agent account keeps for later, the soonest first; for its supervisors, and as `me` for the account. */
|
|
@@ -1733,6 +1763,38 @@ export function createClient(options: ClientOptions = {}): ConsoleClient {
|
|
|
1733
1763
|
request("PUT", `${base}${agentPath(handle, "secrets", name)}`, input, restAgentSecretSchema),
|
|
1734
1764
|
removeAgentSecret: (handle, name) =>
|
|
1735
1765
|
request("DELETE", `${base}${agentPath(handle, "secrets", name)}`, undefined, undefined),
|
|
1766
|
+
offerAgentSecret: (handle, input) =>
|
|
1767
|
+
request(
|
|
1768
|
+
"POST",
|
|
1769
|
+
`${base}${agentPath(handle, "secret-offers")}`,
|
|
1770
|
+
input,
|
|
1771
|
+
restAgentSecretOfferSchema,
|
|
1772
|
+
),
|
|
1773
|
+
agentSecretOffers: (handle, signal) =>
|
|
1774
|
+
request(
|
|
1775
|
+
"GET",
|
|
1776
|
+
`${base}${agentPath(handle, "secret-offers")}`,
|
|
1777
|
+
undefined,
|
|
1778
|
+
restAgentSecretOffersSchema,
|
|
1779
|
+
signal,
|
|
1780
|
+
),
|
|
1781
|
+
secretOffers: (signal) =>
|
|
1782
|
+
request(
|
|
1783
|
+
"GET",
|
|
1784
|
+
`${base}${agentPath("me", "secret-offers")}`,
|
|
1785
|
+
undefined,
|
|
1786
|
+
restAgentSecretOffersSchema,
|
|
1787
|
+
signal,
|
|
1788
|
+
),
|
|
1789
|
+
takeSecretOffer: (id, input) =>
|
|
1790
|
+
request(
|
|
1791
|
+
"POST",
|
|
1792
|
+
`${base}${agentPath("me", "secret-offers", id, "take")}`,
|
|
1793
|
+
input ?? {},
|
|
1794
|
+
restAgentSecretSchema,
|
|
1795
|
+
),
|
|
1796
|
+
leaveSecretOffer: (id) =>
|
|
1797
|
+
request("DELETE", `${base}${agentPath("me", "secret-offers", id)}`, undefined, undefined),
|
|
1736
1798
|
agentSecretAccesses: (handle, query, signal) =>
|
|
1737
1799
|
request(
|
|
1738
1800
|
"GET",
|
|
@@ -1803,6 +1865,8 @@ export function createClient(options: ClientOptions = {}): ConsoleClient {
|
|
|
1803
1865
|
{ kind: "wake", ...input },
|
|
1804
1866
|
restSignalSchema,
|
|
1805
1867
|
),
|
|
1868
|
+
writers: (input, signal) =>
|
|
1869
|
+
request("POST", `${base}${agentPath("me", "writers")}`, input, restWritersSchema, signal),
|
|
1806
1870
|
raiseOwnWake: (input) =>
|
|
1807
1871
|
request("POST", `${base}${agentPath("me", "wakes")}`, input, restOwnWakeRaisedSchema),
|
|
1808
1872
|
ownWakes: (handle, signal) =>
|