@skillcdn/console 0.6.2 → 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.
Files changed (179) hide show
  1. package/README.md +13 -6
  2. package/SKILLCDN.md +3 -2
  3. package/dist/agent-page.d.ts +2 -0
  4. package/dist/agent-page.d.ts.map +1 -1
  5. package/dist/agent-page.js +40 -3
  6. package/dist/agent-page.js.map +1 -1
  7. package/dist/agent-state.d.ts +9 -0
  8. package/dist/agent-state.d.ts.map +1 -0
  9. package/dist/agent-state.js +28 -0
  10. package/dist/agent-state.js.map +1 -0
  11. package/dist/api.d.ts +4 -3
  12. package/dist/api.d.ts.map +1 -1
  13. package/dist/api.js +4 -3
  14. package/dist/api.js.map +1 -1
  15. package/dist/cli/cli.d.ts +2 -0
  16. package/dist/cli/cli.d.ts.map +1 -1
  17. package/dist/cli/cli.js +304 -130
  18. package/dist/cli/cli.js.map +1 -1
  19. package/dist/cli/format.d.ts +13 -4
  20. package/dist/cli/format.d.ts.map +1 -1
  21. package/dist/cli/format.js +43 -9
  22. package/dist/cli/format.js.map +1 -1
  23. package/dist/cli/help.d.ts +82 -9
  24. package/dist/cli/help.d.ts.map +1 -1
  25. package/dist/cli/help.js +780 -318
  26. package/dist/cli/help.js.map +1 -1
  27. package/dist/cli/pack.d.ts +2 -2
  28. package/dist/cli/pack.d.ts.map +1 -1
  29. package/dist/cli/pack.js +6 -4
  30. package/dist/cli/pack.js.map +1 -1
  31. package/dist/cli/runner-files.d.ts +16 -0
  32. package/dist/cli/runner-files.d.ts.map +1 -0
  33. package/dist/cli/runner-files.js +110 -0
  34. package/dist/cli/runner-files.js.map +1 -0
  35. package/dist/cli/runner-host.d.ts +7 -0
  36. package/dist/cli/runner-host.d.ts.map +1 -1
  37. package/dist/cli/runner-host.js +40 -2
  38. package/dist/cli/runner-host.js.map +1 -1
  39. package/dist/client.d.ts +16 -1
  40. package/dist/client.d.ts.map +1 -1
  41. package/dist/client.js +6 -1
  42. package/dist/client.js.map +1 -1
  43. package/dist/components/agent-page.d.ts +28 -3
  44. package/dist/components/agent-page.d.ts.map +1 -1
  45. package/dist/components/agent-page.js +48 -3
  46. package/dist/components/agent-page.js.map +1 -1
  47. package/dist/components/agents.d.ts +3 -2
  48. package/dist/components/agents.d.ts.map +1 -1
  49. package/dist/components/agents.js +9 -3
  50. package/dist/components/agents.js.map +1 -1
  51. package/dist/console.d.ts.map +1 -1
  52. package/dist/console.js +1 -1
  53. package/dist/console.js.map +1 -1
  54. package/dist/feed-words.d.ts.map +1 -1
  55. package/dist/feed-words.js +12 -1
  56. package/dist/feed-words.js.map +1 -1
  57. package/dist/i18n/en.d.ts +45 -1
  58. package/dist/i18n/en.d.ts.map +1 -1
  59. package/dist/i18n/en.js +36 -1
  60. package/dist/i18n/en.js.map +1 -1
  61. package/dist/i18n/ko.d.ts.map +1 -1
  62. package/dist/i18n/ko.js +28 -0
  63. package/dist/i18n/ko.js.map +1 -1
  64. package/dist/limits.d.ts +10 -0
  65. package/dist/limits.d.ts.map +1 -1
  66. package/dist/limits.js +10 -0
  67. package/dist/limits.js.map +1 -1
  68. package/dist/plugin/context.d.ts +39 -7
  69. package/dist/plugin/context.d.ts.map +1 -1
  70. package/dist/runner/acp.d.ts.map +1 -1
  71. package/dist/runner/acp.js +9 -3
  72. package/dist/runner/acp.js.map +1 -1
  73. package/dist/runner/claude.d.ts.map +1 -1
  74. package/dist/runner/claude.js +5 -1
  75. package/dist/runner/claude.js.map +1 -1
  76. package/dist/runner/codex.d.ts.map +1 -1
  77. package/dist/runner/codex.js +14 -2
  78. package/dist/runner/codex.js.map +1 -1
  79. package/dist/runner/config.d.ts +18 -0
  80. package/dist/runner/config.d.ts.map +1 -1
  81. package/dist/runner/config.js +77 -1
  82. package/dist/runner/config.js.map +1 -1
  83. package/dist/runner/desk.d.ts +7 -0
  84. package/dist/runner/desk.d.ts.map +1 -1
  85. package/dist/runner/desk.js +9 -0
  86. package/dist/runner/desk.js.map +1 -1
  87. package/dist/runner/message.d.ts +16 -22
  88. package/dist/runner/message.d.ts.map +1 -1
  89. package/dist/runner/message.js +72 -120
  90. package/dist/runner/message.js.map +1 -1
  91. package/dist/runner/runner.d.ts +25 -1
  92. package/dist/runner/runner.d.ts.map +1 -1
  93. package/dist/runner/runner.js +404 -19
  94. package/dist/runner/runner.js.map +1 -1
  95. package/dist/runner/slack-status.d.ts +19 -0
  96. package/dist/runner/slack-status.d.ts.map +1 -0
  97. package/dist/runner/slack-status.js +332 -0
  98. package/dist/runner/slack-status.js.map +1 -0
  99. package/dist/runner/slack.d.ts.map +1 -1
  100. package/dist/runner/slack.js +245 -57
  101. package/dist/runner/slack.js.map +1 -1
  102. package/dist/runner/types.d.ts +109 -15
  103. package/dist/runner/types.d.ts.map +1 -1
  104. package/dist/runner/types.js.map +1 -1
  105. package/dist/runner/usage.d.ts +6 -1
  106. package/dist/runner/usage.d.ts.map +1 -1
  107. package/dist/runner/usage.js +9 -2
  108. package/dist/runner/usage.js.map +1 -1
  109. package/dist/runner.d.ts +2 -2
  110. package/dist/runner.d.ts.map +1 -1
  111. package/dist/runner.js.map +1 -1
  112. package/dist/schemas.d.ts +160 -1
  113. package/dist/schemas.d.ts.map +1 -1
  114. package/dist/schemas.js +82 -5
  115. package/dist/schemas.js.map +1 -1
  116. package/dist/vocabulary.d.ts +7 -0
  117. package/dist/vocabulary.d.ts.map +1 -1
  118. package/dist/vocabulary.js +6 -0
  119. package/dist/vocabulary.js.map +1 -1
  120. package/dist/wake-text.d.ts +43 -0
  121. package/dist/wake-text.d.ts.map +1 -0
  122. package/dist/wake-text.js +115 -0
  123. package/dist/wake-text.js.map +1 -0
  124. package/docs/specs/cli.md +19 -11
  125. package/docs/specs/plugins.md +5 -5
  126. package/docs/specs/rest.md +10 -3
  127. package/docs/specs/runner.md +96 -20
  128. package/docs/start.md +26 -5
  129. package/package.json +3 -3
  130. package/skills/building-a-plugin/SKILL.md +2 -2
  131. package/skills/deploying-a-console/SKILL.md +3 -3
  132. package/skills/deploying-a-console/references/access.md +15 -1
  133. package/skills/deploying-a-console/references/resources.md +2 -2
  134. package/skills/deploying-a-console/scripts/github-app.mjs +593 -0
  135. package/skills/running-an-agent/SKILL.md +13 -10
  136. package/skills/running-an-agent/references/preparing-the-machine.md +1 -1
  137. package/skills/running-an-agent/references/slack-app.md +25 -8
  138. package/skills/running-an-agent/references/the-account-and-the-invitation.md +1 -1
  139. package/skills/running-an-agent/references/what-was-not-seen-run-yet.md +1 -1
  140. package/skills/running-an-agent/references/when-the-agent-could-not-go-on.md +1 -1
  141. package/skills/running-an-agent/references/your-first-task.md +7 -2
  142. package/skills/trying-a-console/SKILL.md +136 -0
  143. package/skills/trying-a-console/references/when-it-does-not-go.md +30 -0
  144. package/skills/working-the-board/SKILL.md +3 -3
  145. package/skills/working-the-board/references/the-pack.md +3 -3
  146. package/skills/working-the-board/references/what-they-were-told.md +1 -1
  147. package/src/agent-page.tsx +92 -1
  148. package/src/agent-state.ts +33 -0
  149. package/src/api.ts +16 -0
  150. package/src/cli/cli.ts +359 -137
  151. package/src/cli/format.ts +49 -9
  152. package/src/cli/help.ts +904 -359
  153. package/src/cli/pack.ts +6 -4
  154. package/src/cli/runner-files.ts +120 -0
  155. package/src/cli/runner-host.ts +48 -2
  156. package/src/client.ts +53 -0
  157. package/src/components/agent-page.tsx +150 -3
  158. package/src/components/agents.tsx +20 -5
  159. package/src/console.tsx +1 -0
  160. package/src/feed-words.ts +14 -1
  161. package/src/i18n/en.ts +39 -1
  162. package/src/i18n/ko.ts +32 -0
  163. package/src/limits.ts +10 -0
  164. package/src/plugin/context.ts +40 -7
  165. package/src/runner/acp.ts +9 -3
  166. package/src/runner/claude.ts +5 -1
  167. package/src/runner/codex.ts +14 -2
  168. package/src/runner/config.ts +114 -1
  169. package/src/runner/desk.ts +10 -0
  170. package/src/runner/message.ts +88 -126
  171. package/src/runner/runner.ts +487 -22
  172. package/src/runner/slack-status.ts +423 -0
  173. package/src/runner/slack.ts +293 -61
  174. package/src/runner/types.ts +108 -13
  175. package/src/runner/usage.ts +16 -3
  176. package/src/runner.ts +4 -0
  177. package/src/schemas.ts +97 -3
  178. package/src/vocabulary.ts +9 -0
  179. package/src/wake-text.ts +133 -0
package/src/i18n/ko.ts CHANGED
@@ -189,6 +189,12 @@ export const ko: Messages = {
189
189
  "secret.unreadable": "이 배포의 키로 값을 열 수 없습니다. 값을 가진 사람이 다시 넣어야 합니다.",
190
190
  "secret.own_session":
191
191
  "시크릿 저장소는 계정 자신이 로그인해서 읽습니다. 계정이 만든 토큰으로는 읽을 수 없습니다.",
192
+ "secret.exists":
193
+ "계정에 같은 이름의 시크릿이 이미 있습니다. 계정이 다른 이름으로 받거나, 바꾸겠다고 한 경우에만 그 자리에 받습니다.",
194
+ "secret.offer_not_found": "계정에 대기 중인 그런 제안이 없습니다.",
195
+ "secret.too_many_offers":
196
+ "이 계정에 대기할 수 있는 만큼의 제안이 이미 있습니다. 하나를 받거나, 받지 않거나, 기한이 지나야 합니다.",
197
+ "secret.offer_own": "계정 자신의 시크릿은 계정이 직접 넣습니다.",
192
198
  "agent.own_command":
193
199
  "계정 자신만 할 수 있는 요청입니다. 계정으로 로그인한 명령의 러너가 요청합니다.",
194
200
  "signal.not_offered": "에이전트의 제품이 제공하지 않는 모델 또는 추론 강도입니다.",
@@ -1963,6 +1969,24 @@ export const ko: Messages = {
1963
1969
  title: "그런 에이전트 계정이 없습니다",
1964
1970
  body: "없는 계정이거나, 볼 수 없는 계정입니다.",
1965
1971
  },
1972
+ offers: {
1973
+ title: "제안된 시크릿",
1974
+ offerTitle: "시크릿 제안",
1975
+ offerAria: "시크릿 제안",
1976
+ intro: (name: string, days: number) =>
1977
+ `${name}에게 알려지며, 받을지 말지는 계정이 직접 정합니다. 값은 여기에 한 번 입력하면 누구에게도 보이지 않으며, 받지 않은 제안은 ${days}일 뒤 사라집니다.`,
1978
+ waits: (name: string) =>
1979
+ `받을지 말지는 ${name} 계정이 직접 정합니다. 값은 보이지 않습니다.`,
1980
+ own: "명령으로 받거나 받지 않습니다: console secrets --offered",
1981
+ name: "이름",
1982
+ namePlaceholder: "mail.password",
1983
+ value: "값",
1984
+ note: "용도",
1985
+ offer: "제안",
1986
+ someone: "지금은 없는 사람",
1987
+ takenAs: (name: string) => `받은 이름: ${name}`,
1988
+ state: { waiting: "대기 중", taken: "받음", left: "받지 않음", lapsed: "기한 지남" },
1989
+ },
1966
1990
  notSupervised: {
1967
1991
  title: "감독자만 볼 수 있습니다",
1968
1992
  body: "에이전트가 하는 일은 매니저와 그 위의 매니저들, 그리고 관리자만 볼 수 있습니다.",
@@ -1976,6 +2000,8 @@ export const ko: Messages = {
1976
2000
  failed: "실패",
1977
2001
  unheard: "응답 없음",
1978
2002
  since: { before: "", after: "부터" },
2003
+ sinceAs: (state) => ({ before: "", after: `부터 ${state}` }),
2004
+ reasonAt: { before: " (", after: ")" },
1979
2005
  until: { before: "", after: "까지" },
1980
2006
  heard: "러너의 마지막 응답",
1981
2007
  reasons: {
@@ -2320,6 +2346,12 @@ export const ko: Messages = {
2320
2346
  submit: "에이전트 계정 추가",
2321
2347
  },
2322
2348
  },
2349
+ status: {
2350
+ thinking: "생각 중",
2351
+ working: "작업 중 · 답이 조금 늦어요",
2352
+ limited: "충전 중",
2353
+ back: "{time}에 돌아와요",
2354
+ },
2323
2355
  },
2324
2356
 
2325
2357
  sessions: {
package/src/limits.ts CHANGED
@@ -61,6 +61,16 @@ export const MAX_PERSON_NAME_LENGTH = 80;
61
61
  export const MAX_AGENT_SECRET_NAME_LENGTH = 64;
62
62
  export const MAX_AGENT_SECRET_BYTES = 8 * 1024;
63
63
  export const MAX_AGENT_SECRETS = 200;
64
+ /**
65
+ * A secret a member offers an agent account (ADR-0169): what it is for, in a line; how many
66
+ * offers wait for one account at once, and how many of them one member's; how long one waits
67
+ * before it is gone; and how many the account's record of them keeps once they no longer wait.
68
+ */
69
+ export const MAX_SECRET_OFFER_NOTE_LENGTH = 200;
70
+ export const MAX_SECRET_OFFERS_WAITING = 20;
71
+ export const MAX_SECRET_OFFERS_BY_ONE = 5;
72
+ export const SECRET_OFFER_DAYS = 7;
73
+ export const MAX_SECRET_OFFERS_KEPT = 200;
64
74
  /** What a signal says to an agent (ADR-0085): a few paragraphs. */
65
75
  export const MAX_SIGNAL_LENGTH = 8000;
66
76
  /** What a wake a runner raises itself is about, in a line: a thread at a messenger, say. */
@@ -18,7 +18,7 @@ import type {
18
18
  RestTaskPatch,
19
19
  RestTeam,
20
20
  } from "../schemas.js";
21
- import type { WeekStart } from "../vocabulary.js";
21
+ import type { PeopleVisibility, WeekStart } from "../vocabulary.js";
22
22
  import type { PluginFileHandle } from "./args.js";
23
23
 
24
24
  /** A schema as the Standard Schema interface spells one: what every build of zod implements, so that a plugin's own copy validates its records. */
@@ -308,6 +308,15 @@ export interface PluginWorkspace {
308
308
  readonly timeZoneSet: boolean;
309
309
  /** The day the week begins on (ADR-0035): `auto` leaves it to the language of whoever reads. */
310
310
  readonly weekStart: WeekStart;
311
+ /**
312
+ * Whether the console shows every member to every member (ADR-0035): `everyone`, or
313
+ * `shared_projects`, where a member sees those they share a project with, themselves and the
314
+ * administrators. Where it is `shared_projects`, "everyone" is more than any one member sees:
315
+ * a plugin that holds the whole directory reads the people its caller may see with
316
+ * `seenByCaller` (ADR-0168), and says to an administrator whom a notice to everyone reaches.
317
+ * Left out by a console older than 0.6.3.
318
+ */
319
+ readonly peopleVisibility?: PeopleVisibility;
311
320
  /**
312
321
  * The console's public origin (`PUBLIC_URL`), for a link to the console in what a plugin
313
322
  * writes elsewhere; `null` where the deployment names none.
@@ -358,19 +367,39 @@ export interface PluginMessengerAccount {
358
367
  readonly since: string;
359
368
  }
360
369
 
370
+ /**
371
+ * What a read of people, or of the teams' members, takes beside what it names (ADR-0168).
372
+ *
373
+ * `seenByCaller: true` answers among the people the caller may see, as the console's own
374
+ * listing of people shows that member (ADR-0035), whatever the plugin holds. A plugin with
375
+ * `people:read` alone reads so already; one with `people:read:all`, which opens the whole
376
+ * directory to its hooks and jobs, reads everyone in a person's call too unless it asks for
377
+ * this, and so shows a member people the console keeps from them where its people are kept
378
+ * apart (`peopleVisibility` of the workspace). The view is a person's: the caller's own, their
379
+ * agent's, an agent account's, or that of the person a plugin acts for, as a member. A hook, a
380
+ * job and a plugin calling as itself have no caller, and the read is refused
381
+ * (`plugin.forbidden`), never answered with everyone. Refused as `plugin.invalid_args` where it
382
+ * is neither `true` nor `false`; a console older than 0.6.3 reads past it and answers everyone
383
+ * with `people:read:all`, so a plugin that relies on it names 0.6.3 as the oldest console it
384
+ * runs on.
385
+ */
386
+ export interface PeopleReadOptions {
387
+ readonly seenByCaller?: boolean;
388
+ }
389
+
361
390
  /** The console's board, as a plugin reaches it with the `board:*` capabilities, each read the caller's own. */
362
391
  export interface PluginConsole {
363
392
  workspace(): Promise<PluginWorkspace>;
364
393
  people: {
365
- list(options?: { readonly q?: string }): Promise<readonly RestPerson[]>;
366
- get(id: string): Promise<RestPerson | null>;
394
+ list(options?: { readonly q?: string } & PeopleReadOptions): Promise<readonly RestPerson[]>;
395
+ get(id: string, options?: PeopleReadOptions): Promise<RestPerson | null>;
367
396
  /**
368
397
  * The active people a role of the plugin was granted to, by name, through a project or with
369
398
  * everyone, and everyone for `defaultRole` (ADR-0063); for a role that follows the reporting
370
399
  * line, whoever manages someone besides (ADR-0068). An administrator holds every role, and is
371
400
  * listed only where they were granted it or manage someone.
372
401
  */
373
- granted(role: string): Promise<readonly RestPerson[]>;
402
+ granted(role: string, options?: PeopleReadOptions): Promise<readonly RestPerson[]>;
374
403
  };
375
404
  /**
376
405
  * Which account at a messenger is a member's (ADR-0164), with `people:accounts`: said by a
@@ -422,11 +451,15 @@ export interface PluginConsole {
422
451
  notifications: {
423
452
  settings(): Promise<RestNotificationSettings>;
424
453
  };
425
- /** The teams of the workspace (ADR-0073): a name and its members, among the people the caller may see. */
454
+ /**
455
+ * The teams of the workspace (ADR-0073): a name and its members, among the people the caller
456
+ * may see; among everyone with `people:read:all`, unless `seenByCaller` asks for the caller's
457
+ * own view (ADR-0168).
458
+ */
426
459
  teams: {
427
- list(): Promise<readonly RestTeam[]>;
460
+ list(options?: PeopleReadOptions): Promise<readonly RestTeam[]>;
428
461
  /** One team by its key (ADR-0074), what a grant and a person's `teams` name it by. */
429
- get(key: string): Promise<RestTeam | null>;
462
+ get(key: string, options?: PeopleReadOptions): Promise<RestTeam | null>;
430
463
  };
431
464
  projects: {
432
465
  list(): Promise<readonly RestProject[]>;
package/src/runner/acp.ts CHANGED
@@ -804,8 +804,11 @@ function sessionOf(
804
804
  }
805
805
  // A turn refused on the product's usage limit: nothing goes better before a window
806
806
  // resets, and the protocol has no word for when that is. The session stays open; the
807
- // runner waits, tries again by itself, and hands over again what was not answered.
808
- // Read by pattern, of the agent's own error alone: not seen with an agent yet.
807
+ // runner waits, tries again by itself, and says again, whole, what was not answered:
808
+ // a message is said taken here as it is handed over, and nothing says that an agent
809
+ // keeps a prompt it refused, so the driver vouches for no conversation that holds it
810
+ // (`can.holdsTaken` is left out). Read by pattern, of the agent's own error alone:
811
+ // not seen with an agent yet.
809
812
  if (saysUsageLimit(words)) {
810
813
  waiting = [];
811
814
  emit({ type: "cannot_go_on", state: "failed", reason: "usage_limit" });
@@ -935,6 +938,9 @@ function sessionOf(
935
938
  text: "This agent goes on with no conversation from one session to the next: a new one begins.",
936
939
  });
937
940
  }
941
+ // A conversation begun where another was to be gone on with is said as that (ADR-0166):
942
+ // the runner counts nothing the agent was handed before as held by it.
943
+ const anew = session === undefined && options.resume !== undefined;
938
944
  if (session === undefined) {
939
945
  opened = await connection.request("session/new", place);
940
946
  session = isObject(opened) ? textOf(opened.sessionId) : undefined;
@@ -951,7 +957,7 @@ function sessionOf(
951
957
  const agent = agentOf(initialized);
952
958
  await stand(standingOf(opened), agent.name);
953
959
  product = agent.version ?? null;
954
- emit({ type: "conversation", id: session });
960
+ emit({ type: "conversation", id: session, ...(anew ? { anew: true } : {}) });
955
961
  runs();
956
962
  ready = true;
957
963
  if (waiting.length > 0) {
@@ -560,6 +560,8 @@ function eventsOf(line: Json, state: Read): DriverEvent[] {
560
560
  kind: "status",
561
561
  text: "The product compacted the conversation.",
562
562
  });
563
+ // The runner's to know too: what the agent was handed before is a summary at best.
564
+ events.push({ type: "compacted" });
563
565
  } else if (line.subtype === "api_retry") {
564
566
  const attempt = typeof line.attempt === "number" ? line.attempt : null;
565
567
  events.push({
@@ -1060,7 +1062,9 @@ export function createClaudeDriver(host: DriverHost): Driver {
1060
1062
  return {
1061
1063
  name: "claude",
1062
1064
  product: { name: "Claude Code", tried: TRIED },
1063
- can: { steer: true, images: true, resume: true, set: false },
1065
+ // A message is said taken when the product says it back off its input, into the
1066
+ // conversation: it stands there whatever becomes of the turn (`holdsTaken`).
1067
+ can: { steer: true, images: true, resume: true, set: false, holdsTaken: true },
1064
1068
  permissions: { modes: MODES, unattended: UNATTENDED_MODE, least: LEAST_MODE },
1065
1069
  async probe() {
1066
1070
  let version: string | undefined;
@@ -959,6 +959,9 @@ function sessionOf(
959
959
  });
960
960
  }
961
961
  }
962
+ // A conversation begun where another was to be gone on with is said as that (ADR-0166):
963
+ // the runner counts nothing the agent was handed before as held by it.
964
+ const anew = opened === undefined && resume !== undefined;
962
965
  opened ??= await connection.request("thread/start", settings);
963
966
  const said = isObject(opened) ? opened : {};
964
967
  const named = isObject(said.thread) ? said.thread : {};
@@ -991,7 +994,7 @@ function sessionOf(
991
994
  effort: word(textOf(said.reasoningEffort)) ?? null,
992
995
  };
993
996
  emit(
994
- { type: "conversation", id: thread },
997
+ { type: "conversation", id: thread, ...(anew ? { anew: true } : {}) },
995
998
  { type: "running", model: runs.model, effort: runs.effort, version },
996
999
  {
997
1000
  type: "event",
@@ -1176,7 +1179,16 @@ export function createCodexDriver(host: DriverHost): Driver {
1176
1179
  product: { name: "Codex", tried: TRIED },
1177
1180
  // A message is put into the turn under way. A picture is taken as a file, by its path in
1178
1181
  // the desk. The model and the effort are said with a turn, and taken from the next one on.
1179
- can: { steer: true, images: true, imageFiles: true, resume: true, set: true },
1182
+ // A message is said taken when the product says it back out of the conversation, or at
1183
+ // the end of the turn it began: it stands in the conversation either way (`holdsTaken`).
1184
+ can: {
1185
+ steer: true,
1186
+ images: true,
1187
+ imageFiles: true,
1188
+ resume: true,
1189
+ set: true,
1190
+ holdsTaken: true,
1191
+ },
1180
1192
  permissions: { modes: MODES, unattended: UNATTENDED_MODE, least: LEAST_MODE },
1181
1193
  async probe() {
1182
1194
  // One line: what the command is called, then its version.
@@ -1,5 +1,6 @@
1
1
  import * as z from "zod/mini";
2
2
  import { isSecretName } from "../schemas.js";
3
+ import { hasForbiddenCodePoint } from "../text.js";
3
4
 
4
5
  // `runner.json` (docs/specs/runner.md): in the desk, the working directory the runner is started
5
6
  // in; written by setup, the agent's from then on. It names things and holds no secret. A file
@@ -32,6 +33,58 @@ const channel = z
32
33
  z.regex(/^[A-Z0-9]{2,24}$/, "is a channel's id at the messenger, as C0123ABCD, never its name"),
33
34
  );
34
35
  const MAX_ENTRIES = 50;
36
+ /**
37
+ * An emoji of a status (ADR-0170), by its name between colons as a messenger spells one: never
38
+ * the character itself, and nothing a messenger would read as words.
39
+ */
40
+ const statusEmoji = z
41
+ .string()
42
+ .check(
43
+ z.regex(/^:[a-z0-9_+-]{1,64}:$/, "is an emoji by its name between colons, as :hourglass:"),
44
+ );
45
+ /** The words of a status: one line of plain words, within what a messenger shows of one. */
46
+ const statusText = (most: number) =>
47
+ z
48
+ .string()
49
+ .check(
50
+ z.refine(
51
+ (text) =>
52
+ text.length > 0 &&
53
+ text.length <= most &&
54
+ text.trim() === text &&
55
+ !hasForbiddenCodePoint(text),
56
+ `is one line of plain words, ${most} characters at the most`,
57
+ ),
58
+ );
59
+ /** The most a status says: what the messenger of the one source that shows one takes. */
60
+ const MAX_STATUS_TEXT = 100;
61
+ /**
62
+ * What the words of the usage limit go on with where the moment is known: `{time}` stands for
63
+ * it. Short enough that the two together, with the longest moment, stay within a status.
64
+ */
65
+ const MAX_STATUS_LIMITED_TEXT = 60;
66
+ const MAX_STATUS_BACK = 24;
67
+ const statusBack = z
68
+ .string()
69
+ .check(
70
+ z.refine(
71
+ (text) =>
72
+ text.length <= MAX_STATUS_BACK &&
73
+ text.trim() === text &&
74
+ !hasForbiddenCodePoint(text) &&
75
+ text.split("{time}").length === 2,
76
+ `is a few plain words with {time} in them once, ${MAX_STATUS_BACK} characters at the most`,
77
+ ),
78
+ );
79
+ /** The seconds a turn is given before the agent is shown as at work: where the desk says none, and the least and the most it may say. */
80
+ export const STATUS_AFTER = 30;
81
+ const MIN_STATUS_AFTER = 5;
82
+ const MAX_STATUS_AFTER = 600;
83
+ /** How a status is shown: its emoji and its words, each the source's own where left out. */
84
+ const statusLook = (most: number) =>
85
+ z.optional(
86
+ z.strictObject({ emoji: z.optional(statusEmoji), text: z.optional(statusText(most)) }),
87
+ );
35
88
  /**
36
89
  * The browsers a desk may name (ADR-0151): `headless`, a Google Chrome with no window and a
37
90
  * profile of its own, driven by a program the product is started with; `window`, the same
@@ -89,6 +142,42 @@ export const runnerConfigSchema = z.object({
89
142
  * wakes the agent only where it is named.
90
143
  */
91
144
  channels: z.optional(z.array(channel).check(z.maxLength(MAX_ENTRIES))),
145
+ /**
146
+ * How the agent stands to whoever waits for it, shown where a wake source has a place for it
147
+ * (ADR-0170): that it is thinking over what was said to it there, that it has been at work
148
+ * for longer than `after` seconds, and that the usage limit of its product stopped it, until
149
+ * when. Each with an emoji and words of the desk's own, or the source's where it says none;
150
+ * `false` shows nothing at all. Left out, as in a desk written before there was such a key
151
+ * and in a config put together by hand, it is shown in the source's own way, and a turn is
152
+ * given `STATUS_AFTER` seconds.
153
+ */
154
+ status: z.optional(
155
+ z.union(
156
+ [
157
+ z.literal(false),
158
+ z.strictObject({
159
+ after: z.optional(
160
+ z
161
+ .int("is a whole number of seconds")
162
+ .check(
163
+ z.gte(MIN_STATUS_AFTER, `is ${MIN_STATUS_AFTER} seconds at the least`),
164
+ z.lte(MAX_STATUS_AFTER, `is ${MAX_STATUS_AFTER} seconds at the most`),
165
+ ),
166
+ ),
167
+ thinking: statusLook(MAX_STATUS_TEXT),
168
+ working: statusLook(MAX_STATUS_TEXT),
169
+ limited: z.optional(
170
+ z.strictObject({
171
+ emoji: z.optional(statusEmoji),
172
+ text: z.optional(statusText(MAX_STATUS_LIMITED_TEXT)),
173
+ back: z.optional(statusBack),
174
+ }),
175
+ ),
176
+ }),
177
+ ],
178
+ "is false, or what is shown: after, thinking, working, limited",
179
+ ),
180
+ ),
92
181
  });
93
182
  export type RunnerConfig = z.infer<typeof runnerConfigSchema>;
94
183
 
@@ -118,7 +207,7 @@ export function parseRunnerConfig(
118
207
  }
119
208
  const parsed = runnerConfigSchema.safeParse(json);
120
209
  if (!parsed.success) {
121
- const issue = parsed.error.issues[0];
210
+ const issue = nearest(parsed.error.issues[0]);
122
211
  const path = (issue?.path ?? []).map(String).join(".");
123
212
  return {
124
213
  ok: false,
@@ -127,3 +216,27 @@ export function parseRunnerConfig(
127
216
  }
128
217
  return { ok: true, config: parsed.data };
129
218
  }
219
+
220
+ /** What is wrong, as the schema says it, and where. */
221
+ interface Problem {
222
+ readonly path: readonly PropertyKey[];
223
+ readonly message: string;
224
+ }
225
+
226
+ /**
227
+ * The problem as said nearest to what is wrong. A value that may be one of several shapes is
228
+ * refused as none of them, which names the key and not the word under it that does not read:
229
+ * where one of the shapes was read further in before it failed, its own problem is the one said.
230
+ */
231
+ function nearest(issue: z.core.$ZodIssue | undefined): Problem | undefined {
232
+ if (issue === undefined || issue.code !== "invalid_union") {
233
+ return issue;
234
+ }
235
+ const within = issue.errors
236
+ .map((problems) => nearest(problems[0]))
237
+ .filter((inner) => inner !== undefined && inner.path.length > 0)
238
+ .sort((one, other) => (other?.path.length ?? 0) - (one?.path.length ?? 0))[0];
239
+ return within === undefined
240
+ ? issue
241
+ : { path: [...issue.path, ...within.path], message: within.message };
242
+ }
@@ -139,6 +139,8 @@ This repository is mine. Whatever should outlive this machine lives here, in my
139
139
 
140
140
  A secret I cannot afford to lose, a password above all, is kept in the console's secret store and nowhere else: \`console secret <name>\` reads one, \`console secret <name> --set\` keeps one. Any other may be kept another safe way, as a command-line tool keeps its own sign-in in the system's keychain. Never in a file, a message, a task or this desk, since everything else here is read by others. What leaked is rotated, and I say so to my manager.
141
141
 
142
+ A key or a token I make for a service, I make with no more reach than the work asks for, and without an end where the service lets me choose: this machine and this account of it are mine alone, and nobody is here to renew one. Where the service, or my organization's rule for it, sets an end, I keep the day with the value (\`--expires <day>\`); the console wakes me before it, and I make the next one myself, where it was made.
143
+
142
144
  ## Projects
143
145
 
144
146
  This desk is bound to no project and stays so: a board command I run here names one, \`--project <key>\`, as a wake does when it names a task (\`console task <number> --project <key>\`), and \`console use\` is for a checkout. A project's repository is cloned under \`work/<name>\` and worked there. Its own rules come first: its \`AGENTS.md\`, which I read before the first change there, since a session begun in the desk was not handed it, and the rules of its project on the console. Before I do a job by hand, I look for a skill for it in the organization's pack: \`console skills --search <words> --limit 5\`. What the organization should keep goes to the console's documents; a skill goes to the organization's pack, by pull request.
@@ -203,6 +205,14 @@ export function deskFiles(input: DeskInput): ReadonlyMap<string, string> {
203
205
  ]);
204
206
  }
205
207
 
208
+ /**
209
+ * The most the `AGENTS.md` an account is set up with comes to, in characters, for the account
210
+ * its test sets up (ADR-0174). Every session of the account reads the file, so `desk.test.ts`
211
+ * holds the template to it: what concerns one event is said by that event's wake, and the bound
212
+ * is not raised to fit.
213
+ */
214
+ export const DESK_INSTRUCTIONS_AT_MOST = 8000;
215
+
206
216
  /** The eight things `AGENTS.md` says, in the order it says them. */
207
217
  export const DESK_SECTIONS = [
208
218
  "Who I am",