@skillcdn/console 0.5.1 → 0.5.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 +20 -2
- package/dist/agent-page.d.ts.map +1 -1
- package/dist/agent-page.js +4 -4
- package/dist/agent-page.js.map +1 -1
- package/dist/api.d.ts +5 -4
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +5 -4
- package/dist/api.js.map +1 -1
- package/dist/cli/cli.d.ts +32 -0
- package/dist/cli/cli.d.ts.map +1 -1
- package/dist/cli/cli.js +442 -93
- package/dist/cli/cli.js.map +1 -1
- package/dist/cli/format.d.ts +6 -2
- package/dist/cli/format.d.ts.map +1 -1
- package/dist/cli/format.js +25 -3
- package/dist/cli/format.js.map +1 -1
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +10 -5
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/machine-check.d.ts +36 -0
- package/dist/cli/machine-check.d.ts.map +1 -0
- package/dist/cli/machine-check.js +151 -0
- package/dist/cli/machine-check.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 +2 -0
- package/dist/cli/runner-host.js.map +1 -1
- package/dist/cli/secret-notes.d.ts +8 -0
- package/dist/cli/secret-notes.d.ts.map +1 -0
- package/dist/cli/secret-notes.js +48 -0
- package/dist/cli/secret-notes.js.map +1 -0
- package/dist/client.d.ts +7 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +6 -1
- package/dist/client.js.map +1 -1
- package/dist/components/agent-page.d.ts +106 -13
- package/dist/components/agent-page.d.ts.map +1 -1
- package/dist/components/agent-page.js +391 -102
- package/dist/components/agent-page.js.map +1 -1
- package/dist/components/agents.d.ts.map +1 -1
- package/dist/components/agents.js +1 -1
- package/dist/components/agents.js.map +1 -1
- package/dist/components/board.d.ts.map +1 -1
- package/dist/components/board.js +3 -2
- package/dist/components/board.js.map +1 -1
- package/dist/components/categories.js +1 -1
- package/dist/components/categories.js.map +1 -1
- package/dist/components/decision-list.d.ts.map +1 -1
- package/dist/components/decision-list.js +1 -1
- package/dist/components/decision-list.js.map +1 -1
- package/dist/components/event-feed.d.ts.map +1 -1
- package/dist/components/event-feed.js +3 -2
- package/dist/components/event-feed.js.map +1 -1
- package/dist/components/goals.d.ts +2 -0
- package/dist/components/goals.d.ts.map +1 -1
- package/dist/components/goals.js +1 -1
- package/dist/components/goals.js.map +1 -1
- package/dist/components/home.d.ts.map +1 -1
- package/dist/components/home.js +13 -15
- package/dist/components/home.js.map +1 -1
- package/dist/components/icon.d.ts +31 -0
- package/dist/components/icon.d.ts.map +1 -0
- package/dist/components/icon.js +169 -0
- package/dist/components/icon.js.map +1 -0
- package/dist/components/markdown.d.ts +6 -0
- package/dist/components/markdown.d.ts.map +1 -1
- package/dist/components/markdown.js +10 -2
- package/dist/components/markdown.js.map +1 -1
- package/dist/components/people.js +1 -1
- package/dist/components/people.js.map +1 -1
- package/dist/components/plugin-frame.d.ts.map +1 -1
- package/dist/components/plugin-frame.js +7 -0
- package/dist/components/plugin-frame.js.map +1 -1
- package/dist/components/projects.d.ts +17 -4
- package/dist/components/projects.d.ts.map +1 -1
- package/dist/components/projects.js +25 -6
- package/dist/components/projects.js.map +1 -1
- package/dist/components/sessions.d.ts.map +1 -1
- package/dist/components/sessions.js +3 -2
- package/dist/components/sessions.js.map +1 -1
- package/dist/components/setup.d.ts.map +1 -1
- package/dist/components/setup.js +2 -2
- package/dist/components/setup.js.map +1 -1
- package/dist/components/shell.d.ts.map +1 -1
- package/dist/components/shell.js +3 -2
- package/dist/components/shell.js.map +1 -1
- package/dist/components/tokens.js +1 -1
- package/dist/components/tokens.js.map +1 -1
- package/dist/components/ui.d.ts +5 -2
- package/dist/components/ui.d.ts.map +1 -1
- package/dist/components/ui.js +10 -7
- package/dist/components/ui.js.map +1 -1
- package/dist/connect-page.js +1 -1
- package/dist/connect-page.js.map +1 -1
- package/dist/console.css +473 -77
- package/dist/console.d.ts.map +1 -1
- package/dist/console.js +38 -31
- package/dist/console.js.map +1 -1
- package/dist/home-tiles.d.ts +24 -33
- package/dist/home-tiles.d.ts.map +1 -1
- package/dist/home-tiles.js +65 -259
- package/dist/home-tiles.js.map +1 -1
- package/dist/i18n/en.d.ts +49 -2
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +126 -3
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/ko.d.ts.map +1 -1
- package/dist/i18n/ko.js +197 -79
- package/dist/i18n/ko.js.map +1 -1
- package/dist/i18n/particles.d.ts +7 -0
- package/dist/i18n/particles.d.ts.map +1 -0
- package/dist/i18n/particles.js +72 -0
- package/dist/i18n/particles.js.map +1 -0
- package/dist/icons/glyphs.d.ts +605 -0
- package/dist/icons/glyphs.d.ts.map +1 -0
- package/dist/icons/glyphs.js +104 -0
- package/dist/icons/glyphs.js.map +1 -0
- package/dist/icons/index.d.ts +59 -0
- package/dist/icons/index.d.ts.map +1 -0
- package/dist/icons/index.js +157 -0
- package/dist/icons/index.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/limits.d.ts +9 -0
- package/dist/limits.d.ts.map +1 -1
- package/dist/limits.js +9 -0
- package/dist/limits.js.map +1 -1
- package/dist/marks.d.ts +9 -0
- package/dist/marks.d.ts.map +1 -1
- package/dist/marks.js +9 -0
- package/dist/marks.js.map +1 -1
- package/dist/onboarding.js +3 -3
- package/dist/onboarding.js.map +1 -1
- package/dist/plugin/manifest.d.ts.map +1 -1
- package/dist/plugin/manifest.js +3 -2
- package/dist/plugin/manifest.js.map +1 -1
- package/dist/plugin/web.d.ts +3 -0
- package/dist/plugin/web.d.ts.map +1 -1
- package/dist/plugin/web.js +5 -1
- package/dist/plugin/web.js.map +1 -1
- package/dist/runner/acp.d.ts.map +1 -1
- package/dist/runner/acp.js +2 -2
- package/dist/runner/acp.js.map +1 -1
- package/dist/runner/awake.d.ts +35 -0
- package/dist/runner/awake.d.ts.map +1 -0
- package/dist/runner/awake.js +95 -0
- package/dist/runner/awake.js.map +1 -0
- package/dist/runner/claude.d.ts.map +1 -1
- package/dist/runner/claude.js +19 -7
- package/dist/runner/claude.js.map +1 -1
- package/dist/runner/codex.d.ts.map +1 -1
- package/dist/runner/codex.js +2 -2
- package/dist/runner/codex.js.map +1 -1
- package/dist/runner/config.d.ts +5 -0
- package/dist/runner/config.d.ts.map +1 -1
- package/dist/runner/config.js +9 -0
- package/dist/runner/config.js.map +1 -1
- package/dist/runner/desk.d.ts.map +1 -1
- package/dist/runner/desk.js +5 -6
- package/dist/runner/desk.js.map +1 -1
- package/dist/runner/runner.d.ts +13 -2
- package/dist/runner/runner.d.ts.map +1 -1
- package/dist/runner/runner.js +141 -22
- package/dist/runner/runner.js.map +1 -1
- package/dist/runner/slack.d.ts.map +1 -1
- package/dist/runner/slack.js +10 -4
- package/dist/runner/slack.js.map +1 -1
- package/dist/runner/types.d.ts +15 -0
- package/dist/runner/types.d.ts.map +1 -1
- package/dist/runner/types.js +9 -0
- package/dist/runner/types.js.map +1 -1
- package/dist/schemas.d.ts +94 -1
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +81 -5
- package/dist/schemas.js.map +1 -1
- package/dist/services.d.ts.map +1 -1
- package/dist/services.js +9 -5
- package/dist/services.js.map +1 -1
- package/dist/setup-guide.d.ts +14 -3
- package/dist/setup-guide.d.ts.map +1 -1
- package/dist/setup-guide.js +41 -37
- package/dist/setup-guide.js.map +1 -1
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +5 -1
- package/dist/tokens.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/docs/specs/cli.md +10 -7
- package/docs/specs/plugins.md +18 -7
- package/docs/specs/rest.md +10 -8
- package/docs/specs/runner.md +26 -8
- package/package.json +7 -3
- package/skills/building-a-console/SKILL.md +2 -2
- package/skills/building-a-plugin/SKILL.md +3 -3
- package/skills/keeping-a-desk/SKILL.md +2 -2
- package/skills/running-an-agent/SKILL.md +47 -57
- package/skills/working-the-board/SKILL.md +5 -4
- package/skills/working-the-board/references/the-pack.md +1 -1
- package/src/agent-page.tsx +13 -1
- package/src/api.ts +32 -1
- package/src/cli/cli.ts +530 -106
- package/src/cli/format.ts +31 -3
- package/src/cli/help.ts +12 -4
- package/src/cli/machine-check.ts +223 -0
- package/src/cli/runner-host.ts +8 -0
- package/src/cli/secret-notes.ts +63 -0
- package/src/client.ts +23 -0
- package/src/components/agent-page.tsx +629 -112
- package/src/components/agents.tsx +9 -5
- package/src/components/board.tsx +3 -15
- package/src/components/categories.tsx +2 -2
- package/src/components/decision-list.tsx +11 -7
- package/src/components/event-feed.tsx +7 -2
- package/src/components/goals.tsx +33 -25
- package/src/components/home.tsx +29 -26
- package/src/components/icon.tsx +337 -0
- package/src/components/markdown.tsx +22 -2
- package/src/components/people.tsx +1 -1
- package/src/components/plugin-frame.tsx +7 -0
- package/src/components/projects.tsx +39 -5
- package/src/components/sessions.tsx +2 -13
- package/src/components/setup.tsx +2 -2
- package/src/components/shell.tsx +3 -20
- package/src/components/tokens.tsx +1 -1
- package/src/components/ui.tsx +16 -8
- package/src/connect-page.tsx +1 -1
- package/src/console.tsx +87 -53
- package/src/home-tiles.ts +76 -291
- package/src/i18n/en.ts +128 -3
- package/src/i18n/ko.ts +200 -79
- package/src/i18n/particles.ts +79 -0
- package/src/icons/glyphs.ts +112 -0
- package/src/icons/index.ts +195 -0
- package/src/index.ts +7 -0
- package/src/limits.ts +9 -0
- package/src/marks.ts +12 -0
- package/src/onboarding.ts +3 -3
- package/src/plugin/manifest.ts +3 -2
- package/src/plugin/web.ts +9 -2
- package/src/runner/acp.ts +2 -1
- package/src/runner/awake.ts +135 -0
- package/src/runner/claude.ts +19 -4
- package/src/runner/codex.ts +2 -1
- package/src/runner/config.ts +9 -0
- package/src/runner/desk.ts +5 -6
- package/src/runner/runner.ts +183 -23
- package/src/runner/slack.ts +10 -4
- package/src/runner/types.ts +20 -0
- package/src/schemas.ts +94 -3
- package/src/services.ts +9 -5
- package/src/setup-guide.ts +43 -38
- package/src/styles/README.md +5 -4
- package/src/styles/base.css +17 -0
- package/src/styles/console.css +1 -0
- package/src/styles/drawn-by-pages.json +1 -1
- package/src/styles/pages/agents.css +103 -1
- package/src/styles/pages/board.css +0 -10
- package/src/styles/pages/calendar.css +1 -1
- package/src/styles/pages/connect.css +0 -10
- package/src/styles/pages/decisions.css +3 -1
- package/src/styles/pages/feed.css +5 -2
- package/src/styles/pages/home.css +5 -0
- package/src/styles/pages/roadmap.css +2 -2
- package/src/styles/pages/settings.css +11 -0
- package/src/styles/pages/task.css +0 -20
- package/src/styles/pages/thread.css +1 -1
- package/src/styles/parts/calendar.css +1 -1
- package/src/styles/parts/callout.css +1 -0
- package/src/styles/parts/detail.css +22 -0
- package/src/styles/parts/empty.css +2 -0
- package/src/styles/parts/eyebrow.css +1 -1
- package/src/styles/parts/facts.css +1 -1
- package/src/styles/parts/figures.css +1 -1
- package/src/styles/parts/form.css +2 -1
- package/src/styles/parts/icon.css +191 -0
- package/src/styles/parts/input.css +14 -4
- package/src/styles/parts/mark.css +36 -0
- package/src/styles/parts/menu.css +1 -7
- package/src/styles/parts/page.css +1 -1
- package/src/styles/parts/panel.css +10 -0
- package/src/styles/parts/person.css +5 -2
- package/src/styles/parts/progress.css +5 -2
- package/src/styles/parts/rows.css +1 -0
- package/src/styles/parts/settings.css +5 -0
- package/src/styles/parts/stat.css +1 -1
- package/src/styles/tokens.css +22 -7
- package/src/tokens.ts +5 -1
- package/src/vocabulary.ts +9 -0
package/src/cli/format.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { createHash } from "node:crypto";
|
|
|
2
2
|
import { argUsage } from "../plugin/args.js";
|
|
3
3
|
import type {
|
|
4
4
|
RestAgent,
|
|
5
|
+
RestAgentRunner,
|
|
5
6
|
RestAgentSecret,
|
|
6
7
|
RestArtifact,
|
|
7
8
|
RestCategory,
|
|
@@ -15,6 +16,7 @@ import type {
|
|
|
15
16
|
RestGoal,
|
|
16
17
|
RestListing,
|
|
17
18
|
RestMember,
|
|
19
|
+
RestOwnWake,
|
|
18
20
|
RestPerson,
|
|
19
21
|
RestPersonWork,
|
|
20
22
|
RestPlugin,
|
|
@@ -121,7 +123,7 @@ export function formatProject(project: RestProject): string {
|
|
|
121
123
|
const lines = [
|
|
122
124
|
`project ${project.key}: ${project.name}`,
|
|
123
125
|
`visibility: ${project.visibility} role: ${project.role} skills: ${project.skillsAddress ?? "the organization's"}`,
|
|
124
|
-
`color: ${project.color ?? "none"} symbol: ${project.symbol ?? "none"} image: ${project.icon === null ? "none" : project.icon.contentType}`,
|
|
126
|
+
`color: ${project.color ?? "none"} symbol: ${project.symbol ?? "none"} glyph: ${project.glyph ?? "none"} image: ${project.icon === null ? "none" : project.icon.contentType}`,
|
|
125
127
|
`pack token: ${project.packToken === null ? "none" : `set ${moment(project.packToken.setAt)}`}`,
|
|
126
128
|
];
|
|
127
129
|
if (project.description.trim().length > 0) {
|
|
@@ -213,6 +215,11 @@ export function formatAgent(agent: RestAgent): string {
|
|
|
213
215
|
`runs with: model ${runner.running.model ?? OWN_CHOICE}, effort ${runner.running.effort ?? OWN_CHOICE}`,
|
|
214
216
|
]),
|
|
215
217
|
`signals: ${runner.delivered} of ${runner.latest} delivered`,
|
|
218
|
+
...(runner.sources === undefined || runner.sources.length === 0
|
|
219
|
+
? []
|
|
220
|
+
: [
|
|
221
|
+
`wake sources beside the console: ${runner.sources.map(formatWakeSource).join("; ")}`,
|
|
222
|
+
]),
|
|
216
223
|
]),
|
|
217
224
|
...(agent.hours === undefined
|
|
218
225
|
? []
|
|
@@ -232,6 +239,22 @@ export function formatAgent(agent: RestAgent): string {
|
|
|
232
239
|
].join("\n");
|
|
233
240
|
}
|
|
234
241
|
|
|
242
|
+
/** A wake source as its runner last said it stands (ADR-0144): listening and since when, or not, and why. */
|
|
243
|
+
export function formatWakeSource(source: NonNullable<RestAgentRunner["sources"]>[number]): string {
|
|
244
|
+
const why = source.why === undefined ? "" : ` (${source.why})`;
|
|
245
|
+
return source.state === "connected"
|
|
246
|
+
? `${source.name} connected since ${moment(source.since)}`
|
|
247
|
+
: `${source.name} ${source.state}${why} since ${moment(source.since)}`;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/** A wake an agent account keeps for later (ADR-0145): what it is called, when it is raised, and the first words of what it says. */
|
|
251
|
+
export function formatOwnWakeLine(wake: RestOwnWake): string {
|
|
252
|
+
const words = wake.text.replaceAll(/\s+/g, " ").trim();
|
|
253
|
+
const said =
|
|
254
|
+
words.length === 0 ? "" : ` ${words.length > 120 ? `${words.slice(0, 119)}…` : words}`;
|
|
255
|
+
return `to come ${wake.key} ${moment(wake.at)}${said}`;
|
|
256
|
+
}
|
|
257
|
+
|
|
235
258
|
/** How an agent account stands (ADR-0085), in a few words: the state, why, and when its runner was last heard from. */
|
|
236
259
|
export function formatAgentState(agent: RestAgent): string {
|
|
237
260
|
const state = agent.state ?? null;
|
|
@@ -248,7 +271,7 @@ export function formatAgentState(agent: RestAgent): string {
|
|
|
248
271
|
* One signal of an agent account's record (ADR-0085): its number, its kind, who sent it or where
|
|
249
272
|
* it came from, when, and the first words of what it says.
|
|
250
273
|
*/
|
|
251
|
-
export function formatSignalLine(signal: RestSignal): string {
|
|
274
|
+
export function formatSignalLine(signal: RestSignal, delivered?: number): string {
|
|
252
275
|
const who =
|
|
253
276
|
signal.by === null
|
|
254
277
|
? `${signal.source}${signal.key === null ? "" : `: ${signal.key}`}`
|
|
@@ -260,7 +283,12 @@ export function formatSignalLine(signal: RestSignal): string {
|
|
|
260
283
|
const words = signal.text.replaceAll(/\s+/g, " ").trim();
|
|
261
284
|
const said =
|
|
262
285
|
words.length === 0 ? "" : ` ${words.length > 120 ? `${words.slice(0, 119)}…` : words}`;
|
|
263
|
-
|
|
286
|
+
// Whether it is delivered, where the record says how far it is (ADR-0131): the product took
|
|
287
|
+
// it or the record says what became of it, or it waits for that. A console that does not
|
|
288
|
+
// say, one before 0.5.2 and the answer to a signal just sent, has nothing said here.
|
|
289
|
+
const state =
|
|
290
|
+
delivered === undefined ? "" : signal.number <= delivered ? "delivered " : "waiting ";
|
|
291
|
+
return `#${signal.number} ${signal.kind} ${state}${who} ${moment(signal.at)}${set}${said}`;
|
|
264
292
|
}
|
|
265
293
|
|
|
266
294
|
/** One secret of an agent account's store (ADR-0087): its name, when it was set and by which side, and the day it ends on where one is known. Never its value. */
|
package/src/cli/help.ts
CHANGED
|
@@ -28,6 +28,9 @@ import {
|
|
|
28
28
|
MAX_NOTE_LENGTH,
|
|
29
29
|
MAX_OPTION_LABEL_LENGTH,
|
|
30
30
|
MAX_OPTIONS,
|
|
31
|
+
MAX_OWN_WAKE_DAYS,
|
|
32
|
+
MAX_OWN_WAKES,
|
|
33
|
+
MAX_OWN_WAKES_PER_HOUR,
|
|
31
34
|
MAX_PERSON_NAME_LENGTH,
|
|
32
35
|
MAX_PERSON_TITLE_LENGTH,
|
|
33
36
|
MAX_PROJECT_DESCRIPTION_LENGTH,
|
|
@@ -263,18 +266,19 @@ export const COMMAND_HELP: Readonly<Record<string, CommandHelp>> = {
|
|
|
263
266
|
},
|
|
264
267
|
agent: {
|
|
265
268
|
usage:
|
|
266
|
-
'agent <handle> [--avatar <file>] [--account <service>=<name|none>]... [--day-start <HH:MM|none>] [--day-end <HH:MM|none>] | agent new <handle> [--login <login>] [--name "<name>"] [--title "<title>"] [--manager <login|me>] [--host gh|google] [--seed <seed>] [--convert] | agent tell <handle> "<words>" [--file <path>] | agent interrupt|stop|restart|reset|wake <handle> ["<words>"] | agent set <handle> [--model <name|none>] [--effort <level|none>] | agent signals <handle|me> [--limit <n>] [--before <number>] | agent secrets <handle> | agent secret <handle> <name> [--file <path>] [--expires <day|none>] | agent secret <handle> <name> --remove | agent invite <handle> [--revoke] | agent setup --console <origin> --code <code> [--guide] [--desk <dir>] [--new-desk] [--no-service] | agent setup --refresh [--desk <dir>]',
|
|
269
|
+
'agent <handle> [--avatar <file>] [--account <service>=<name|none>]... [--day-start <HH:MM|none>] [--day-end <HH:MM|none>] | agent new <handle> [--login <login>] [--name "<name>"] [--title "<title>"] [--manager <login|me>] [--host gh|google] [--seed <seed>] [--convert] | agent tell <handle> "<words>" [--file <path>] | agent interrupt|stop|restart|reset|wake <handle> ["<words>"] | agent wake me ["<words>"] [--in <minutes> | --at <HH:MM>] [--key <name>] | agent wake me --cancel [--key <name>] | agent set <handle> [--model <name|none>] [--effort <level|none>] | agent signals <handle|me> [--limit <n>] [--before <number>] | agent secrets <handle> | agent secret <handle> <name> [--file <path>] [--expires <day|none>] | agent secret <handle> <name> --remove | agent invite <handle> [--revoke] | agent setup --console <origin> --code <code> [--guide] [--desk <dir>] [--new-desk] [--no-service] [--driver <name>] [--no-browser] | agent setup --refresh [--desk <dir>]',
|
|
267
270
|
overview:
|
|
268
271
|
"agent <handle> | agent new <handle> [flags] | agent tell|interrupt|stop|restart|reset|set|wake|signals|secrets|invite <handle> | agent secret <handle> <name>",
|
|
269
272
|
synopsis:
|
|
270
273
|
"One agent account and how it stands; or one made, told, stopped, started, or its secrets seeded, by whoever may.",
|
|
271
274
|
about:
|
|
272
|
-
"One agent account by its handle, with or without the @: its line as console agents prints it, and whether you supervise it. With --avatar, its avatar is written as a PNG file of 1024 pixels a side, to the path given, or into a directory under the handle's name: the picture is drawn here from the parts the console keeps (ADR-0084), for the profile of the agent's account elsewhere, at a messenger or at the identity provider, where the agent puts it with that service's own tool or in a browser. With --account <service>=<name>, given once for each, the accounts the agent holds elsewhere are recorded on it (ADR-0089), what it is called at each service by the service's short name, github=acme-mira say, and never a secret, so that whoever takes the account out reads what to close; =none takes one away. The account records its own, and a supervisor may. --day-start and --day-end keep the hours of its day, in the workspace's time zone (ADR-0085): at the start, 09:00 where none is said, the console sends it the day's briefing, its tasks planned for today, those carried over and the decisions that wait, and on the week's first day the week's; at the end, where it has one, a wrap, to write the day down and push its desk; none takes an hour away. By the account, or a supervisor. new makes an agent account, for an administrator: the handle it is called by, which never changes; --login, the account it will sign in with at the identity provider, a login at the git host or an address at Google, which a person makes there, and which is made of the workspace's short name, the handle and its domain where the workspace names its identity service and none is said (--host says the provider where the login's shape does not); --name, the handle capitalized when left out; --title, what it does; --manager, whom it reports to, you when left out; and the project it starts in, this directory's or --project. The member's row is written at once, so that work is assigned to it before anyone signed in with it. At Google its first sign-in with that address binds the provider's account to it. At a git host, where a login is whoever's registers it, the console asks the organization which account the login is and binds the row to that account at once (ADR-0126): the answer says confirmed, and that account alone is let in, whatever it is called by then; or not confirmed, where the organization has no member called so or could not be asked, and the account is let in once it is a member there, or where this console reads no organization at the host, and whoever holds the login is let in until the account has signed in. The console rolls its avatar, from --seed where one is given. A login a member already carries is refused (agent.login_is_member), so that nobody is made an agent account by a name that happens to be theirs; --convert says that the member is to become the account, once and for good, with everything they did. The pages make one from proposals instead: Agents, Add an agent account. tell, interrupt, stop, restart, reset, set and wake are a supervisor's signals to the account's runner (ADR-0085), sent in the supervisor's own name and kept on the account's record: tell says something to the agent, which reads it after the tool call it is at; interrupt stops what it is doing first, and without words has it read now what it was told and has not come to; stop ends its session, and nothing reaches it until it is started again; restart starts it with the conversation it had, for a product that hung or a sign-in that was mended; reset starts it with a new conversation, for one that cannot go on, and nothing else begins one for it; set chooses the model and the level of effort it runs with, among those its product offers, none for the product's own; wake says there is something to do. The words are given as an argument, with --file, or as - on standard input. An agent the model refused, or whose product failed, waits: what a supervisor sends is tried at once, in the same conversation, so another model, another effort or other words are the first things to try. signals reads the record, the newest first: who told the agent what, and when; the account reads its own as console agent signals me. secrets and secret are a supervisor's part of the account's secret store (ADR-0087): secrets lists the names it keeps, with when each was set and the day it ends on where one is known; secret seeds one, write-only, so that a person or an agent above hands the account a credential it cannot make for itself, the value typed unseen at the terminal, or read from standard input when piped, or from --file, and never an argument; --expires says the day the value ends on, a product's long-lived token say; --remove takes one away. Nobody but the account reads a value back, and every setting, reading and removal is on the account's record. invite makes the invitation that leads a machine to the account (ADR-0088), for a supervisor: a code of eight letters and digits, shown this once, with the one line to say to the agent's product on its machine and the address where a person reads the same guide; made again, it takes the place of the one before, and --revoke takes it away. The code is no credential: it says which account a setup is for and opens the guide, good until its day or until the account's command has signed in, and the account is entered through its own sign-in alone. setup is the machine's own, run in the agent's OS account where an agent account is being set up, signed in nowhere yet. With the console and the code of the invitation's line, it prints the guide of that account's setup,
|
|
275
|
+
"One agent account by its handle, with or without the @: its line as console agents prints it, and whether you supervise it. With --avatar, its avatar is written as a PNG file of 1024 pixels a side, to the path given, or into a directory under the handle's name: the picture is drawn here from the parts the console keeps (ADR-0084), for the profile of the agent's account elsewhere, at a messenger or at the identity provider, where the agent puts it with that service's own tool or in a browser. With --account <service>=<name>, given once for each, the accounts the agent holds elsewhere are recorded on it (ADR-0089), what it is called at each service by the service's short name, github=acme-mira say, and never a secret, so that whoever takes the account out reads what to close; =none takes one away. The account records its own, and a supervisor may. --day-start and --day-end keep the hours of its day, in the workspace's time zone (ADR-0085): at the start, 09:00 where none is said, the console sends it the day's briefing, its tasks planned for today, those carried over and the decisions that wait, and on the week's first day the week's; at the end, where it has one, a wrap, to write the day down and push its desk; none takes an hour away. By the account, or a supervisor. new makes an agent account, for an administrator: the handle it is called by, which never changes; --login, the account it will sign in with at the identity provider, a login at the git host or an address at Google, which a person makes there, and which is made of the workspace's short name, the handle and its domain where the workspace names its identity service and none is said (--host says the provider where the login's shape does not); --name, the handle capitalized when left out; --title, what it does; --manager, whom it reports to, you when left out; and the project it starts in, this directory's or --project. The member's row is written at once, so that work is assigned to it before anyone signed in with it. At Google its first sign-in with that address binds the provider's account to it. At a git host, where a login is whoever's registers it, the console asks the organization which account the login is and binds the row to that account at once (ADR-0126): the answer says confirmed, and that account alone is let in, whatever it is called by then; or not confirmed, where the organization has no member called so or could not be asked, and the account is let in once it is a member there, or where this console reads no organization at the host, and whoever holds the login is let in until the account has signed in. The console rolls its avatar, from --seed where one is given. A login a member already carries is refused (agent.login_is_member), so that nobody is made an agent account by a name that happens to be theirs; --convert says that the member is to become the account, once and for good, with everything they did. The pages make one from proposals instead: Agents, Add an agent account. tell, interrupt, stop, restart, reset, set and wake are a supervisor's signals to the account's runner (ADR-0085), sent in the supervisor's own name and kept on the account's record: tell says something to the agent, which reads it after the tool call it is at; interrupt stops what it is doing first, and without words has it read now what it was told and has not come to; stop ends its session, and nothing reaches it until it is started again; restart starts it with the conversation it had, for a product that hung or a sign-in that was mended; reset starts it with a new conversation, for one that cannot go on, and nothing else begins one for it; set chooses the model and the level of effort it runs with, among those its product offers, none for the product's own; wake says there is something to do. The words are given as an argument, with --file, or as - on standard input. wake me is the account's own (ADR-0145), on the command signed in as the account: a wake it raises for itself, which its runner takes as any wake, for whoever prepared its machine or signed something in there to say so, and for the agent to come back to something; --in <minutes> or --at <HH:MM>, the next time the workspace's clock says so, keeps it for later instead, one under a name (--key, wake where none is said), a second taking the first one's place, and --cancel takes one away. A wake and nothing else: what tells, stops or starts an agent stays its supervisors'. An agent the model refused, or whose product failed, waits: what a supervisor sends is tried at once, in the same conversation, so another model, another effort or other words are the first things to try. signals reads the record, the newest first: who told the agent what, and when, and of each whether it is delivered, the product having taken it or the record saying what became of it, or waiting for that, as the account's runner last said (ADR-0131); the account reads its own as console agent signals me. secrets and secret are a supervisor's part of the account's secret store (ADR-0087): secrets lists the names it keeps, with when each was set and the day it ends on where one is known; secret seeds one, write-only, so that a person or an agent above hands the account a credential it cannot make for itself, the value typed unseen at the terminal, or read from standard input when piped, or from --file, and never an argument; --expires says the day the value ends on, a product's long-lived token say; --remove takes one away. Nobody but the account reads a value back, and every setting, reading and removal is on the account's record. invite makes the invitation that leads a machine to the account (ADR-0088), for a supervisor: a code of eight letters and digits, shown this once, with the one line to say to the agent's product on its machine and the address where a person reads the same guide; made again, it takes the place of the one before, and --revoke takes it away. The code is no credential: it says which account a setup is for and opens the guide, good until its day or until the account's command has signed in, and the account is entered through its own sign-in alone. setup is the machine's own, run in the agent's OS account where an agent account is being set up, signed in nowhere yet. With the console and the code of the invitation's line, it prints the guide of that account's setup, the part of whoever prepares the machine and no more (ADR-0140), written for that account and the services of its workspace, and nothing secret; --guide stops there, and --json prints what the code opened and the guide whole, in its parts, with what the agent does when it starts and what it asks for. Then it goes on by itself. It looks at the machine first and says everything that is missing at once, with what installs it, and sets nothing up until it is there: git, the command of the agent's product, the first of claude and codex that answers or the one --driver names, and for a product with a browser tool of its own the browser that tool works in, unless --no-browser says the agent signs in at no page. Then it asks to be signed in as the account, opens the page in the machine's browser and waits until the account, signed in there, says that the command is it; a sign-in that turns out to be anyone else's is given up and nothing is set up. Signed in, it settles the desk, --desk <dir>, or this directory where it is a desk, or desk in the OS account's home: one that is there is left as it is; one the account pushed before is cloned from its git host, read with the account's own secret git.token, which is handed to git in the environment and never on a command line; otherwise a new one is written from the template, over no file that is there, its runner.json naming the product and the browser found, and --new-desk writes a new one whatever the account keeps. A desk it wrote or cloned is a repository whose git reads git.token from the account's store when the workspace's git host asks, in place of the machine's own helpers, so that the agent pushes with nothing typed and no copy kept elsewhere. It writes the service that keeps the runner running, launchd on macOS, a unit of the account's own systemd on Linux and a scheduled task on Windows, loads it, says whether the runner is heard from, waits a little for the agent's first session, and ends by saying where to watch it, that the machine's part ends there, and whether the machine is kept from sleeping; where no service is written, on another platform or with --no-service, it says how the runner is started by hand. It needs no administrator's rights. --refresh derives a machine again, by the account's own command in its desk, when the services or the account changed: what is missing of the desk is written, the service is written again where it changed and read when it is next loaded, and the services are said as they are now; it never unloads a service, which may be running under it.",
|
|
273
276
|
limits: [
|
|
274
277
|
`handle: ${MIN_HANDLE_LENGTH} to ${MAX_HANDLE_LENGTH} lowercase letters, digits and hyphens, a letter or a digit first and last; none of new, me, proposals, setup`,
|
|
275
278
|
`name: one line, up to ${MAX_PERSON_NAME_LENGTH} characters; title: one line, up to ${MAX_PERSON_TITLE_LENGTH}`,
|
|
276
279
|
`an invitation: one for an account, good for ${INVITATION_DAYS} days`,
|
|
277
280
|
`an account held elsewhere: the service in lowercase letters, digits and hyphens, the name one line up to ${MAX_ELSEWHERE_NAME_LENGTH} characters; up to ${MAX_AGENT_ELSEWHERE} of them`,
|
|
281
|
+
`a wake kept for later: a name of up to 40 lowercase letters, digits and hyphens, a moment within ${MAX_OWN_WAKE_DAYS} days, up to ${MAX_OWN_WAKES} at a time`,
|
|
278
282
|
],
|
|
279
283
|
refusals: [
|
|
280
284
|
"agent.not_found: no agent account has that handle, or it is not yours to see",
|
|
@@ -289,6 +293,9 @@ export const COMMAND_HELP: Readonly<Record<string, CommandHelp>> = {
|
|
|
289
293
|
"agent.too_many_accounts: an account records as many accounts held elsewhere as one may",
|
|
290
294
|
"auth.forbidden, of a signal or a secret: only a supervisor of the account sends one, seeds or removes one",
|
|
291
295
|
"signal.not_offered: the model or the effort is none of those the agent's product offers",
|
|
296
|
+
`signal.too_many, of wake me: the account raised as many wakes for itself within the hour as it may, ${MAX_OWN_WAKES_PER_HOUR}`,
|
|
297
|
+
`wake.too_many: the account keeps as many wakes for later as it may, ${MAX_OWN_WAKES}; take one away with --cancel`,
|
|
298
|
+
"wake.not_found: the account keeps no wake of that name",
|
|
292
299
|
"secret.not_found: the account keeps no secret of that name",
|
|
293
300
|
"secret.too_many: the account keeps as many secrets as one may",
|
|
294
301
|
"secret.too_large: a value is at most 8 KiB",
|
|
@@ -392,7 +399,7 @@ export const COMMAND_HELP: Readonly<Record<string, CommandHelp>> = {
|
|
|
392
399
|
},
|
|
393
400
|
project: {
|
|
394
401
|
usage:
|
|
395
|
-
'project <key> | project new <key> "<name>" [--description <markdown>|--file <path>] [--visibility workspace|private] [--skills <address>|none] [--color <name>] [--symbol <text>] | project edit <key> [--name "<name>"] [the same flags; none clears] | project icon <key> <file> | project icon <key> --remove | project pack-token <key> --connect | project pack-token <key> --stdin | project pack-token <key> --remove',
|
|
402
|
+
'project <key> | project new <key> "<name>" [--description <markdown>|--file <path>] [--visibility workspace|private] [--skills <address>|none] [--color <name>] [--symbol <text>] [--glyph <name>] | project edit <key> [--name "<name>"] [the same flags; none clears] | project icon <key> <file> | project icon <key> --remove | project pack-token <key> --connect | project pack-token <key> --stdin | project pack-token <key> --remove',
|
|
396
403
|
overview:
|
|
397
404
|
"project <key> | project new <key> <name> [flags] | project edit <key> [flags] | project icon <key> <file>|--remove | project pack-token <key> --connect|--stdin|--remove",
|
|
398
405
|
synopsis:
|
|
@@ -403,6 +410,7 @@ export const COMMAND_HELP: Readonly<Record<string, CommandHelp>> = {
|
|
|
403
410
|
`key: ${KEY}, up to ${MAX_PROJECT_KEY_LENGTH} characters; it does not change once made`,
|
|
404
411
|
`name: one line, up to ${MAX_PROJECT_NAME_LENGTH} characters; description: up to ${MAX_PROJECT_DESCRIPTION_LENGTH}`,
|
|
405
412
|
`color: ${COLORS}; symbol: up to ${MAX_PROJECT_SYMBOL_LENGTH} characters without spaces, shown on the colour; left out, the pages choose both from the key and the name`,
|
|
413
|
+
"glyph: the name of an icon of the console's pack (calendar, flag, pack), shown on the colour in the symbol's place; a name that is none of the pack's is answered with the pack's names",
|
|
406
414
|
`image: a PNG, a JPEG, a GIF or a WebP of at most ${MAX_PROJECT_ICON_BYTES} bytes`,
|
|
407
415
|
`at most ${MAX_PROJECTS_PER_WORKSPACE} projects in the workspace`,
|
|
408
416
|
],
|
|
@@ -821,7 +829,7 @@ export const COMMAND_HELP: Readonly<Record<string, CommandHelp>> = {
|
|
|
821
829
|
usage: "runner",
|
|
822
830
|
synopsis: "For an agent account's machine: keeps its agent's session going, in its desk.",
|
|
823
831
|
about:
|
|
824
|
-
"For an agent account's machine: the runner of the account the command is signed in as (console login --self), started in its desk. It starts the agent's product there, hands it what the console sends, a supervisor's tell or a wake, as messages under a header only the session knows, reports what the product does as the session's transcript, and says every thirty seconds that it is there. It restarts nothing by itself: an agent that cannot go on waits, and its supervisor's next word is tried. runner.json in the desk names the product's driver, claude, codex or acp,
|
|
832
|
+
"For an agent account's machine: the runner of the account the command is signed in as (console login --self), started in its desk. It starts the agent's product there, hands it what the console sends, a supervisor's tell or a wake, as messages under a header only the session knows, reports what the product does as the session's transcript, and says every thirty seconds that it is there. It restarts nothing by itself: an agent that cannot go on waits, and its supervisor's next word is tried. runner.json in the desk names the product's driver, claude, codex or acp, the wake sources beside the console's own, the secrets a session is handed, and, as browser, the browser (chrome) a product's own browser tool is started in. A runner.json that changed is taken by itself (ADR-0144): the runner ends between two turns and begins again with it, in the same process and with the same conversation; one that does not read changes nothing, and the agent is told what is wrong with it. While it runs, the machine is kept from sleeping when idle, through the system's own helper and with no setting of the machine changed. Stop it with Ctrl+C; where the service that keeps it running names its own process (CONSOLE_RUNNER_KEEPER), it stops when that process is gone.",
|
|
825
833
|
refusals: [
|
|
826
834
|
"a runner is an agent account's own: sign the command in as the account, console login --self",
|
|
827
835
|
"runner.json does not read: nothing of it is used",
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import type { SetupMachine } from "./setup-machine.js";
|
|
2
|
+
|
|
3
|
+
// What `console agent setup` looks for on a machine before it asks anyone to sign in (ADR-0140):
|
|
4
|
+
// git, the command of the agent's product, and the browser that product's browser tool works
|
|
5
|
+
// in. Everything that is missing is found in one look and said at once, with what installs it,
|
|
6
|
+
// so that the session that was given the line installs it all and runs the line again, and a
|
|
7
|
+
// person is asked to sign in once, on a machine that is ready. What the setup cannot see, a
|
|
8
|
+
// product's sign-in and a browser's extension, it says in a line and does not hold up for.
|
|
9
|
+
|
|
10
|
+
/** A product the package has a driver for, as a setup looks for it on a machine. */
|
|
11
|
+
interface Product {
|
|
12
|
+
readonly driver: string;
|
|
13
|
+
readonly name: string;
|
|
14
|
+
readonly command: string;
|
|
15
|
+
/** What installs it for an OS account, by platform; `any` where one line does everywhere. */
|
|
16
|
+
readonly install: Readonly<Record<string, string>>;
|
|
17
|
+
/** The browser its own browser tool works in, and what that browser needs for it. */
|
|
18
|
+
readonly browser?: { readonly name: "chrome"; readonly needs: string } | undefined;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const PRODUCTS: readonly Product[] = [
|
|
22
|
+
{
|
|
23
|
+
driver: "claude",
|
|
24
|
+
name: "Claude Code",
|
|
25
|
+
command: "claude",
|
|
26
|
+
install: {
|
|
27
|
+
any: "npm install -g @anthropic-ai/claude-code",
|
|
28
|
+
// The runner starts a program, and npm makes a script of it there.
|
|
29
|
+
win32: "its native installer for Windows, which puts claude.exe on the PATH",
|
|
30
|
+
},
|
|
31
|
+
browser: { name: "chrome", needs: "the Claude in Chrome extension" },
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
driver: "codex",
|
|
35
|
+
name: "Codex",
|
|
36
|
+
command: "codex",
|
|
37
|
+
install: {
|
|
38
|
+
any: "npm install -g @openai/codex",
|
|
39
|
+
win32: "a build of it for Windows that is a program on the PATH",
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
/** What a look at a machine found. */
|
|
45
|
+
export interface MachineLook {
|
|
46
|
+
/** The driver of the product found, or the one asked for; nothing where none was found. */
|
|
47
|
+
readonly driver: string | undefined;
|
|
48
|
+
/** What the product is called and the version it says, where it answered. */
|
|
49
|
+
readonly product: string | undefined;
|
|
50
|
+
/** The browser the product's browser tool works in, where the product has such a tool and the browser is there. */
|
|
51
|
+
readonly browser: "chrome" | undefined;
|
|
52
|
+
/** What is missing, a line each, with what installs it: the setup stops for any of these. */
|
|
53
|
+
readonly missing: readonly string[];
|
|
54
|
+
/** What the setup could not see and says once: it goes on. */
|
|
55
|
+
readonly notes: readonly string[];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const answers = async (
|
|
59
|
+
machine: SetupMachine,
|
|
60
|
+
command: string,
|
|
61
|
+
args: readonly string[],
|
|
62
|
+
): Promise<string | undefined> => {
|
|
63
|
+
const ran = await machine.run(command, args);
|
|
64
|
+
return ran.code === 0 ? ran.out.trim().split(/\r?\n/)[0]?.trim() || "" : undefined;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/** What installs git for an OS account, by platform, in words a session acts on. */
|
|
68
|
+
function gitMissing(platform: string): string {
|
|
69
|
+
switch (platform) {
|
|
70
|
+
case "darwin":
|
|
71
|
+
return "git: the Command Line Tools are not installed, so git is a placeholder that opens a window. Install them: xcode-select --install, then Install in the window it opens on the machine's screen, pressed by whoever sees that screen.";
|
|
72
|
+
case "win32":
|
|
73
|
+
return "git: winget install --id Git.Git -e --source winget, then a new terminal so that it is on the PATH.";
|
|
74
|
+
default:
|
|
75
|
+
return "git: install it with the system's package manager, which takes an administrator (sudo apt-get install -y git, or the like).";
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** Whether Google Chrome is on the machine, looked for where each system keeps it. */
|
|
80
|
+
async function chromeThere(machine: SetupMachine): Promise<boolean> {
|
|
81
|
+
if (machine.platform === "darwin") {
|
|
82
|
+
return (
|
|
83
|
+
(await machine.exists("/Applications/Google Chrome.app")) ||
|
|
84
|
+
(await machine.exists(machine.path(machine.home, "Applications", "Google Chrome.app")))
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
if (machine.platform === "win32") {
|
|
88
|
+
for (const place of [
|
|
89
|
+
"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe",
|
|
90
|
+
"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",
|
|
91
|
+
machine.path(
|
|
92
|
+
machine.home,
|
|
93
|
+
"AppData",
|
|
94
|
+
"Local",
|
|
95
|
+
"Google",
|
|
96
|
+
"Chrome",
|
|
97
|
+
"Application",
|
|
98
|
+
"chrome.exe",
|
|
99
|
+
),
|
|
100
|
+
]) {
|
|
101
|
+
if (await machine.exists(place)) {
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
for (const command of ["google-chrome", "google-chrome-stable"]) {
|
|
108
|
+
if ((await answers(machine, command, ["--version"])) !== undefined) {
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Looks at the machine: git, the product, its browser. `driver` names the product where whoever
|
|
117
|
+
* runs the setup said one, and the first of the package's products that answers is taken where
|
|
118
|
+
* they said none; `browser: false` is an agent that signs in at no page.
|
|
119
|
+
*/
|
|
120
|
+
export async function lookAtMachine(
|
|
121
|
+
machine: SetupMachine,
|
|
122
|
+
wanted: { readonly driver?: string | undefined; readonly browser: boolean },
|
|
123
|
+
): Promise<MachineLook> {
|
|
124
|
+
const missing: string[] = [];
|
|
125
|
+
const notes: string[] = [];
|
|
126
|
+
|
|
127
|
+
// On a Mac without the Command Line Tools, git is there and opens a window instead of
|
|
128
|
+
// answering: asked for only once the tools are known to be installed.
|
|
129
|
+
const tools =
|
|
130
|
+
machine.platform !== "darwin" || (await answers(machine, "xcode-select", ["-p"])) !== undefined;
|
|
131
|
+
if (!tools || (await answers(machine, "git", ["--version"])) === undefined) {
|
|
132
|
+
missing.push(gitMissing(machine.platform));
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const install = (product: Product): string =>
|
|
136
|
+
product.install[machine.platform] ?? product.install.any ?? "as its maker says";
|
|
137
|
+
let found: { readonly product: Product; readonly version: string } | undefined;
|
|
138
|
+
const candidates =
|
|
139
|
+
wanted.driver === undefined
|
|
140
|
+
? PRODUCTS
|
|
141
|
+
: PRODUCTS.filter((product) => product.driver === wanted.driver);
|
|
142
|
+
for (const product of candidates) {
|
|
143
|
+
const version = await answers(machine, product.command, ["--version"]);
|
|
144
|
+
if (version !== undefined) {
|
|
145
|
+
found = { product, version };
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if (found === undefined && candidates.length > 0) {
|
|
150
|
+
missing.push(
|
|
151
|
+
candidates.length === 1 && candidates[0] !== undefined
|
|
152
|
+
? `${candidates[0].name}: its command ${candidates[0].command} does not answer where this command looks for programs. Install it (${install(candidates[0])}) and sign it in with the agent's own subscription.`
|
|
153
|
+
: `the agent's product: none of ${candidates.map((product) => `${product.command} (${product.name})`).join(", ")} answers where this command looks for programs. Install the one the agent runs in (${candidates.map((product) => `${product.name}: ${install(product)}`).join("; ")}) and sign it in with the agent's own subscription. For another product, say --driver acp and name its command in the desk's runner.json.`,
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
let browser: "chrome" | undefined;
|
|
158
|
+
const tool = found?.product.browser;
|
|
159
|
+
if (tool !== undefined && wanted.browser) {
|
|
160
|
+
if (await chromeThere(machine)) {
|
|
161
|
+
browser = tool.name;
|
|
162
|
+
notes.push(
|
|
163
|
+
`Google Chrome is there. ${found?.product.name}'s browser tool also takes ${tool.needs} in it, signed in as the agent's subscription account: install it now where it is not there.`,
|
|
164
|
+
);
|
|
165
|
+
} else {
|
|
166
|
+
missing.push(
|
|
167
|
+
`Google Chrome: ${found?.product.name}'s browser tool works in it, and the agent signs in at its services with that tool. Install it, and ${tool.needs} in it. For an agent that signs in at no page, say --no-browser.`,
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if (found !== undefined) {
|
|
172
|
+
notes.push(
|
|
173
|
+
`Whether ${found.product.name} is signed in cannot be seen from here: where it is not, the agent's page says so once its first session starts.`,
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
return {
|
|
177
|
+
driver: found?.product.driver ?? wanted.driver,
|
|
178
|
+
product:
|
|
179
|
+
found === undefined
|
|
180
|
+
? undefined
|
|
181
|
+
: `${found.product.name}${found.version.length === 0 ? "" : ` (${found.version})`}`,
|
|
182
|
+
browser,
|
|
183
|
+
missing,
|
|
184
|
+
notes,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Whether the machine is held awake by the runner's own helper, as the system says where it
|
|
190
|
+
* can be asked without an administrator: yes, no, or nothing where it cannot be asked.
|
|
191
|
+
*/
|
|
192
|
+
export async function heldAwake(machine: SetupMachine): Promise<boolean | undefined> {
|
|
193
|
+
if (machine.platform !== "darwin") {
|
|
194
|
+
return undefined;
|
|
195
|
+
}
|
|
196
|
+
const ran = await machine.run("pmset", ["-g", "assertions"]);
|
|
197
|
+
return ran.code === 0 ? /\(caffeinate\)/.test(ran.out) : undefined;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* What a setup says of sleep, a sentence by platform: that the machine is held awake where the
|
|
202
|
+
* system said so, that it is not where it said that, and where it cannot be asked, what the
|
|
203
|
+
* runner does and where it says whether that holds; then what is left to whoever keeps the
|
|
204
|
+
* machine. `log` is where the runner's own lines are.
|
|
205
|
+
*/
|
|
206
|
+
export function awakeWords(platform: string, held: boolean | undefined, log?: string): string {
|
|
207
|
+
const back =
|
|
208
|
+
platform === "linux"
|
|
209
|
+
? ""
|
|
210
|
+
: " After a restart the runner starts when this OS account is logged in: turn on automatic login for it where the machine is to come back by itself.";
|
|
211
|
+
if (held === false) {
|
|
212
|
+
return `The machine is not held awake by the runner: set it never to sleep when idle (System Settings, Energy; or sudo pmset -a sleep 0, which takes an administrator), or the agent is not heard from once it sleeps.${back}`;
|
|
213
|
+
}
|
|
214
|
+
if (held === true) {
|
|
215
|
+
return `The machine is kept from sleeping while the runner runs; a sleep someone asks for, or a lid that is closed, still ends that.${back}`;
|
|
216
|
+
}
|
|
217
|
+
const where = log === undefined ? "its own lines" : `its own lines (${log})`;
|
|
218
|
+
const otherwise =
|
|
219
|
+
platform === "win32"
|
|
220
|
+
? " Where they say it is not, or the machine sleeps all the same: powercfg /change standby-timeout-ac 0."
|
|
221
|
+
: " Where they say it is not, turn sleeping when idle off in the system's power settings.";
|
|
222
|
+
return `The runner asks the system to keep the machine from sleeping while it runs, and ${where} say whether that holds.${otherwise}${back}`;
|
|
223
|
+
}
|
package/src/cli/runner-host.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { chmod, mkdir, readFile, 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";
|
|
6
|
+
import { type Awake, holdAwake } from "../runner/awake.js";
|
|
6
7
|
import { createSpawn } from "../runner/process.js";
|
|
7
8
|
import { KEEPER_VARIABLE, type Spawn, type WakeSocket } from "../runner/types.js";
|
|
8
9
|
|
|
@@ -32,6 +33,12 @@ export interface RunnerHost {
|
|
|
32
33
|
* stopping by itself.
|
|
33
34
|
*/
|
|
34
35
|
untilStopped(): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Holds the machine awake for as long as this process runs, where the system has a way that
|
|
38
|
+
* needs no administrator (ADR-0140), and answers what holds it, or why nothing does. Left out
|
|
39
|
+
* by a host that touches no machine.
|
|
40
|
+
*/
|
|
41
|
+
keepAwake?(): Promise<Awake>;
|
|
35
42
|
readonly random: () => number;
|
|
36
43
|
}
|
|
37
44
|
|
|
@@ -178,6 +185,7 @@ export function createRunnerHost(
|
|
|
178
185
|
timer.unref();
|
|
179
186
|
}
|
|
180
187
|
}),
|
|
188
|
+
keepAwake: () => holdAwake(process.platform, process.pid, env),
|
|
181
189
|
// A session's mark is made of these: not to be guessed from outside the machine.
|
|
182
190
|
random: () => randomInt(0, 2 ** 31) / 2 ** 31,
|
|
183
191
|
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// What the command says of a secret's value as it is kept (ADR-0140): a value that does not look
|
|
2
|
+
// like what its name says is kept all the same, since the console knows no service's tokens for
|
|
3
|
+
// sure, and said so at once, where whoever keeps it can still put it right. A token copied half,
|
|
4
|
+
// or another value pasted in its place, is otherwise found out when a push fails. Nothing of the
|
|
5
|
+
// value is said: what a note names is its shape.
|
|
6
|
+
|
|
7
|
+
/** What a secret's name says of its value's shape, for the names the package itself reads. */
|
|
8
|
+
const SHAPES: readonly {
|
|
9
|
+
readonly name: string;
|
|
10
|
+
/** The kind of git host the shape holds for, where it is one host's own. */
|
|
11
|
+
readonly host?: string;
|
|
12
|
+
readonly shape: RegExp;
|
|
13
|
+
readonly says: string;
|
|
14
|
+
}[] = [
|
|
15
|
+
{
|
|
16
|
+
name: "slack.app_token",
|
|
17
|
+
shape: /^xapp-/,
|
|
18
|
+
says: "an app-level token of Slack begins with xapp-",
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: "git.token",
|
|
22
|
+
host: "github",
|
|
23
|
+
shape: /^(gh[pousr]_|github_pat_)/,
|
|
24
|
+
says: "a token of GitHub begins with ghp_ or github_pat_",
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: "git.token",
|
|
28
|
+
host: "gitlab",
|
|
29
|
+
shape: /^gl[a-z]{2,6}-/,
|
|
30
|
+
says: "a token of GitLab begins with glpat- or the like",
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* What to say of a value kept under a name, a line each, or nothing: that it holds a space or a
|
|
36
|
+
* line break, which a token copied from a page seldom does on purpose, and that it is not of
|
|
37
|
+
* the shape its name says. `gitHost` is the kind of git host the workspace names, where it
|
|
38
|
+
* names one.
|
|
39
|
+
*/
|
|
40
|
+
export function secretNotes(
|
|
41
|
+
name: string,
|
|
42
|
+
value: string,
|
|
43
|
+
gitHost?: string | undefined,
|
|
44
|
+
): readonly string[] {
|
|
45
|
+
const notes: string[] = [];
|
|
46
|
+
// A token by its name. A key is not asked this: one of several lines is a key all the same.
|
|
47
|
+
const token = /(?:^|[._])token$/.test(name);
|
|
48
|
+
if (token && /\s/.test(value)) {
|
|
49
|
+
notes.push(
|
|
50
|
+
"The value holds a space or a line break, which a token does not: check that it was copied whole and alone.",
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
for (const one of SHAPES) {
|
|
54
|
+
if (one.name === name && (one.host === undefined || one.host === gitHost)) {
|
|
55
|
+
if (!one.shape.test(value.trim())) {
|
|
56
|
+
notes.push(
|
|
57
|
+
`The value does not look like what ${name} holds: ${one.says}. It is kept as it is; set it again if another value was pasted.`,
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return notes;
|
|
63
|
+
}
|
package/src/client.ts
CHANGED
|
@@ -68,6 +68,9 @@ import {
|
|
|
68
68
|
type RestMembers,
|
|
69
69
|
type RestMePatch,
|
|
70
70
|
type RestMyDecisions,
|
|
71
|
+
type RestOwnWakeInput,
|
|
72
|
+
type RestOwnWakeRaised,
|
|
73
|
+
type RestOwnWakes,
|
|
71
74
|
type RestPackConnect,
|
|
72
75
|
type RestPackConnectStarted,
|
|
73
76
|
type RestPackTokenInput,
|
|
@@ -180,6 +183,8 @@ import {
|
|
|
180
183
|
restMembersSchema,
|
|
181
184
|
restMeSchema,
|
|
182
185
|
restMyDecisionsSchema,
|
|
186
|
+
restOwnWakeRaisedSchema,
|
|
187
|
+
restOwnWakesSchema,
|
|
183
188
|
restPackConnectSchema,
|
|
184
189
|
restPackConnectStartedSchema,
|
|
185
190
|
restPeopleSchema,
|
|
@@ -821,6 +826,12 @@ export interface ConsoleClient {
|
|
|
821
826
|
signalStream(after: number, signal: AbortSignal): AsyncIterable<RestSignal>;
|
|
822
827
|
/** Raises a wake of the runner's own, from a wake source on its machine: it comes back in order on the stream. */
|
|
823
828
|
raiseWake(input: Omit<RestRunnerWake, "kind">): Promise<RestSignal>;
|
|
829
|
+
/** An agent account raises a wake for itself (ADR-0145), by its own command: now, or kept for a moment to come. */
|
|
830
|
+
raiseOwnWake(input: RestOwnWakeInput): Promise<RestOwnWakeRaised>;
|
|
831
|
+
/** The wakes an agent account keeps for later, the soonest first; for its supervisors, and as `me` for the account. */
|
|
832
|
+
ownWakes(handle: string, signal?: AbortSignal): Promise<RestOwnWakes>;
|
|
833
|
+
/** Takes a wake kept for later away, by what it is called; the account's own. */
|
|
834
|
+
cancelOwnWake(key: string): Promise<void>;
|
|
824
835
|
/** The runner begins a session (ADR-0086): the one that was open is taken over. */
|
|
825
836
|
beginAgentSession(input: RestAgentSessionInput): Promise<RestAgentSession>;
|
|
826
837
|
/** The runner reports a batch of a session's events, in order; the same number sent again changes nothing. */
|
|
@@ -1751,6 +1762,18 @@ export function createClient(options: ClientOptions = {}): ConsoleClient {
|
|
|
1751
1762
|
{ kind: "wake", ...input },
|
|
1752
1763
|
restSignalSchema,
|
|
1753
1764
|
),
|
|
1765
|
+
raiseOwnWake: (input) =>
|
|
1766
|
+
request("POST", `${base}${agentPath("me", "wakes")}`, input, restOwnWakeRaisedSchema),
|
|
1767
|
+
ownWakes: (handle, signal) =>
|
|
1768
|
+
request("GET", `${base}${agentPath(handle, "wakes")}`, undefined, restOwnWakesSchema, signal),
|
|
1769
|
+
cancelOwnWake: async (key) => {
|
|
1770
|
+
await request(
|
|
1771
|
+
"DELETE",
|
|
1772
|
+
`${base}${agentPath("me", "wakes", key)}`,
|
|
1773
|
+
undefined,
|
|
1774
|
+
restOwnWakesSchema,
|
|
1775
|
+
);
|
|
1776
|
+
},
|
|
1754
1777
|
async *signalStream(after, signal) {
|
|
1755
1778
|
let response: Response;
|
|
1756
1779
|
try {
|