@skillcdn/console 0.6.1 → 0.6.2

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 (147) hide show
  1. package/README.md +2 -2
  2. package/dist/agent-page.d.ts.map +1 -1
  3. package/dist/agent-page.js +38 -28
  4. package/dist/agent-page.js.map +1 -1
  5. package/dist/agent-usage.d.ts +9 -6
  6. package/dist/agent-usage.d.ts.map +1 -1
  7. package/dist/agent-usage.js +38 -8
  8. package/dist/agent-usage.js.map +1 -1
  9. package/dist/api.d.ts +1 -1
  10. package/dist/api.d.ts.map +1 -1
  11. package/dist/api.js +1 -1
  12. package/dist/api.js.map +1 -1
  13. package/dist/cli/cli.d.ts.map +1 -1
  14. package/dist/cli/cli.js +65 -0
  15. package/dist/cli/cli.js.map +1 -1
  16. package/dist/cli/help.js +3 -3
  17. package/dist/cli/help.js.map +1 -1
  18. package/dist/client.d.ts +7 -1
  19. package/dist/client.d.ts.map +1 -1
  20. package/dist/client.js +2 -1
  21. package/dist/client.js.map +1 -1
  22. package/dist/components/agent-page.d.ts +33 -8
  23. package/dist/components/agent-page.d.ts.map +1 -1
  24. package/dist/components/agent-page.js +98 -32
  25. package/dist/components/agent-page.js.map +1 -1
  26. package/dist/components/calendar.d.ts +24 -4
  27. package/dist/components/calendar.d.ts.map +1 -1
  28. package/dist/components/calendar.js +78 -35
  29. package/dist/components/calendar.js.map +1 -1
  30. package/dist/console.d.ts.map +1 -1
  31. package/dist/console.js +39 -11
  32. package/dist/console.js.map +1 -1
  33. package/dist/data.d.ts +2 -0
  34. package/dist/data.d.ts.map +1 -1
  35. package/dist/data.js +4 -0
  36. package/dist/data.js.map +1 -1
  37. package/dist/desk-page.js +5 -5
  38. package/dist/desk-page.js.map +1 -1
  39. package/dist/feed-words.js +6 -0
  40. package/dist/feed-words.js.map +1 -1
  41. package/dist/i18n/en.d.ts +6 -0
  42. package/dist/i18n/en.d.ts.map +1 -1
  43. package/dist/i18n/en.js +8 -1
  44. package/dist/i18n/en.js.map +1 -1
  45. package/dist/i18n/ko.d.ts.map +1 -1
  46. package/dist/i18n/ko.js +24 -17
  47. package/dist/i18n/ko.js.map +1 -1
  48. package/dist/index.d.ts +1 -1
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +1 -1
  51. package/dist/index.js.map +1 -1
  52. package/dist/plugin/capabilities.d.ts +1 -1
  53. package/dist/plugin/capabilities.d.ts.map +1 -1
  54. package/dist/plugin/capabilities.js +6 -1
  55. package/dist/plugin/capabilities.js.map +1 -1
  56. package/dist/plugin/context.d.ts +62 -1
  57. package/dist/plugin/context.d.ts.map +1 -1
  58. package/dist/plugin/limits.d.ts +7 -0
  59. package/dist/plugin/limits.d.ts.map +1 -1
  60. package/dist/plugin/limits.js +7 -0
  61. package/dist/plugin/limits.js.map +1 -1
  62. package/dist/plugin/testing.d.ts +2 -0
  63. package/dist/plugin/testing.d.ts.map +1 -1
  64. package/dist/plugin/testing.js +2 -0
  65. package/dist/plugin/testing.js.map +1 -1
  66. package/dist/rules.js +1 -1
  67. package/dist/rules.js.map +1 -1
  68. package/dist/runner/claude.d.ts.map +1 -1
  69. package/dist/runner/claude.js +138 -9
  70. package/dist/runner/claude.js.map +1 -1
  71. package/dist/runner/desk.d.ts.map +1 -1
  72. package/dist/runner/desk.js +11 -4
  73. package/dist/runner/desk.js.map +1 -1
  74. package/dist/runner/message.d.ts +32 -2
  75. package/dist/runner/message.d.ts.map +1 -1
  76. package/dist/runner/message.js +163 -27
  77. package/dist/runner/message.js.map +1 -1
  78. package/dist/runner/runner.d.ts +15 -1
  79. package/dist/runner/runner.d.ts.map +1 -1
  80. package/dist/runner/runner.js +131 -15
  81. package/dist/runner/runner.js.map +1 -1
  82. package/dist/runner/slack.d.ts +17 -11
  83. package/dist/runner/slack.d.ts.map +1 -1
  84. package/dist/runner/slack.js +1007 -105
  85. package/dist/runner/slack.js.map +1 -1
  86. package/dist/runner/types.d.ts +110 -5
  87. package/dist/runner/types.d.ts.map +1 -1
  88. package/dist/runner/types.js.map +1 -1
  89. package/dist/runner.d.ts +4 -4
  90. package/dist/runner.d.ts.map +1 -1
  91. package/dist/runner.js +3 -3
  92. package/dist/runner.js.map +1 -1
  93. package/dist/schemas.d.ts +103 -0
  94. package/dist/schemas.d.ts.map +1 -1
  95. package/dist/schemas.js +55 -0
  96. package/dist/schemas.js.map +1 -1
  97. package/docs/specs/cli.md +2 -1
  98. package/docs/specs/plugins.md +7 -2
  99. package/docs/specs/rest.md +4 -2
  100. package/docs/specs/runner.md +50 -19
  101. package/package.json +1 -1
  102. package/skills/building-a-plugin/SKILL.md +3 -3
  103. package/skills/planning-the-board/references/setting-up.md +1 -1
  104. package/skills/running-an-agent/SKILL.md +10 -67
  105. package/skills/running-an-agent/references/preparing-the-machine.md +17 -0
  106. package/skills/running-an-agent/references/several-tasks.md +1 -1
  107. package/skills/running-an-agent/references/slack-app.md +36 -6
  108. package/skills/running-an-agent/references/the-account-and-the-invitation.md +5 -0
  109. package/skills/running-an-agent/references/what-was-not-seen-run-yet.md +3 -0
  110. package/skills/running-an-agent/references/when-the-agent-could-not-go-on.md +16 -0
  111. package/skills/running-an-agent/references/your-first-task.md +14 -0
  112. package/skills/working-the-board/SKILL.md +9 -13
  113. package/skills/working-the-board/references/a-pack-skills-questions.md +3 -0
  114. package/skills/working-the-board/references/a-plugins-commands.md +3 -0
  115. package/skills/working-the-board/references/a-review.md +3 -0
  116. package/skills/working-the-board/references/an-open-run.md +3 -0
  117. package/skills/working-the-board/references/requirements.md +7 -0
  118. package/skills/working-the-board/references/what-they-were-told.md +3 -0
  119. package/skills/working-the-board/references/work-given-in-chat.md +5 -0
  120. package/src/agent-page.tsx +41 -40
  121. package/src/agent-usage.ts +55 -12
  122. package/src/api.ts +7 -0
  123. package/src/cli/cli.ts +84 -0
  124. package/src/cli/help.ts +3 -3
  125. package/src/client.ts +11 -0
  126. package/src/components/agent-page.tsx +114 -36
  127. package/src/components/calendar.tsx +92 -36
  128. package/src/console.tsx +46 -10
  129. package/src/data.ts +6 -0
  130. package/src/desk-page.tsx +5 -5
  131. package/src/feed-words.ts +6 -0
  132. package/src/i18n/en.ts +11 -1
  133. package/src/i18n/ko.ts +30 -17
  134. package/src/index.ts +2 -0
  135. package/src/plugin/capabilities.ts +8 -1
  136. package/src/plugin/context.ts +63 -0
  137. package/src/plugin/limits.ts +7 -0
  138. package/src/plugin/testing.ts +4 -0
  139. package/src/rules.ts +1 -1
  140. package/src/runner/claude.ts +154 -9
  141. package/src/runner/desk.ts +13 -4
  142. package/src/runner/message.ts +176 -29
  143. package/src/runner/runner.ts +173 -15
  144. package/src/runner/slack.ts +1273 -124
  145. package/src/runner/types.ts +102 -2
  146. package/src/runner.ts +16 -1
  147. package/src/schemas.ts +64 -0
@@ -49,6 +49,17 @@ export type DriverEvent =
49
49
  | { readonly type: "taken" }
50
50
  /** A turn completed: the agent is done with what it was sent, and waits for more. */
51
51
  | { readonly type: "turn_completed" }
52
+ /**
53
+ * How many sub-agents are at work in the background of the session, as the product lists
54
+ * them (ADR-0162): said as that changes, from the first that is. A driver whose product lists
55
+ * none says it never, and its sessions are waited for by their turns alone.
56
+ */
57
+ | { readonly type: "background"; readonly agents: number }
58
+ /**
59
+ * The product began a turn, one it starts by itself to hand the agent what a sub-agent in
60
+ * the background did among them. Said once a sub-agent was said to be at work there.
61
+ */
62
+ | { readonly type: "turn_started" }
52
63
  /**
53
64
  * The agent cannot go on: the model refused, or the product failed; with why, in the
54
65
  * heartbeat's words. For a usage limit (`usage_limit`), `until` is when the product says the
@@ -276,6 +287,58 @@ export interface WakeSocket {
276
287
  close(): void;
277
288
  }
278
289
 
290
+ /**
291
+ * A part of a wake a source raises (ADR-0163): a line of the source's own, or what someone else
292
+ * wrote. The runner hands the agent each line under the session's mark and the words in a block
293
+ * of their own, so that nothing a message holds reads as a line of the source's. A line holds
294
+ * what the source says itself, an id and a moment among it, and never a word someone else wrote.
295
+ */
296
+ export type WakePart = { readonly says: string } | { readonly words: string };
297
+
298
+ /**
299
+ * A wake as a wake source raises one: `parts` where the source says something itself, who wrote
300
+ * and where say, beside what was written; `text` where all of it is someone else's words.
301
+ */
302
+ export type RaisedWake =
303
+ | { readonly key: string; readonly parts: readonly WakePart[] }
304
+ | { readonly key: string; readonly text: string };
305
+
306
+ /**
307
+ * What a source read of where one of its wakes was raised, for the account's own command
308
+ * (`console agent messages`): the parts to print, as a wake carries them, or why it read
309
+ * nothing, in a short name: `no_token` where the account keeps nothing to read with,
310
+ * `not_a_conversation` and `not_a_moment` where what was named is none, and otherwise the
311
+ * messenger's own word.
312
+ */
313
+ export type WakeRead =
314
+ | { readonly ok: true; readonly parts: readonly WakePart[] }
315
+ | { readonly ok: false; readonly why: string };
316
+
317
+ /** An account at a source's messenger, as a message names whoever wrote it: by the messenger's ids for the workspace and the account. */
318
+ export interface WakeAccount {
319
+ readonly workspace: string;
320
+ readonly account: string;
321
+ }
322
+
323
+ /**
324
+ * Who an account at a messenger is to the agent, as the console says it (ADR-0164): `told` where
325
+ * the console is told the accounts of that workspace at all, and the member the account is, by
326
+ * their login, with what kind of member they are and whether they supervise the agent; `null`
327
+ * for an account that is no member's as far as the console is told. `administrator` and `line`
328
+ * say how: an administrator, and where in the agent's reporting line the member stands, its
329
+ * `manager`, anyone further `above`, a `report` of its own or anyone further `below`.
330
+ */
331
+ export interface WakeWriter extends WakeAccount {
332
+ readonly told: boolean;
333
+ readonly member: {
334
+ readonly login: string | null;
335
+ readonly kind: "person" | "agent";
336
+ readonly supervisor: boolean;
337
+ readonly administrator?: boolean | undefined;
338
+ readonly line?: "manager" | "above" | "report" | "below" | null | undefined;
339
+ } | null;
340
+ }
341
+
279
342
  /** What a wake source is given of the runner and of the machine. */
280
343
  export interface WakeHost {
281
344
  /** A secret of the account's store, by name; nothing where it keeps none. */
@@ -285,8 +348,19 @@ export interface WakeHost {
285
348
  * they are of: what a person says in one wakes the agent, named or not.
286
349
  */
287
350
  readonly channels: readonly string[];
288
- /** Raises a wake: the console records it, and it reaches the agent in order, as someone else's words. */
289
- raise(wake: { readonly key: string; readonly text: string }): Promise<void>;
351
+ /**
352
+ * Raises a wake: the console records it, and it reaches the agent in order, the source's own
353
+ * lines under the session's mark and everything else as someone else's words. Answers
354
+ * whether the console took it: a wake raised past what the console takes within an hour is
355
+ * let go, and reaches nobody.
356
+ */
357
+ raise(wake: RaisedWake): Promise<boolean>;
358
+ /**
359
+ * What the source keeps from one run of its own to the next, under names of its own, for as
360
+ * long as the runner runs: a runner started again begins with nothing. Never a secret, and
361
+ * never a word of a message.
362
+ */
363
+ readonly kept: Map<string, string>;
290
364
  /** A line for whoever reads the runner's own output: never what a message says. */
291
365
  log(line: string): void;
292
366
  /**
@@ -305,6 +379,14 @@ export interface WakeHost {
305
379
  socket(url: string): WakeSocket;
306
380
  /** Waits so long, or less where the signal ends the wait. */
307
381
  wait(ms: number, signal: AbortSignal): Promise<void>;
382
+ /**
383
+ * Who accounts at the source's messenger are, as the console knows them (ADR-0164), in the
384
+ * order asked: the one way a source learns that an account is a member's, or a supervisor's.
385
+ * It is the console's answer to the account's own sign-in, and nothing a message, a name or
386
+ * the messenger says stands in for it. Left out, or rejecting, where the console says nothing
387
+ * of it, one older than this say: the source then says of an account what the messenger does.
388
+ */
389
+ writers?(accounts: readonly WakeAccount[], signal: AbortSignal): Promise<readonly WakeWriter[]>;
308
390
  }
309
391
 
310
392
  /** A module that raises wakes from outside the console. `console`, the console's own stream of signals, is the runner's own. */
@@ -315,6 +397,24 @@ export interface WakeSource {
315
397
  * source that ended is started again by the runner, after a while. `console` has none.
316
398
  */
317
399
  run?(host: WakeHost, signal: AbortSignal): Promise<void>;
400
+ /**
401
+ * Reads the latest of what was said where a wake of the source's was raised, named as the
402
+ * wake's key names it after the source's own name: for the account's own command, where a wake
403
+ * carried less than the agent needs. Left out by a source that reads nothing.
404
+ */
405
+ read?(
406
+ host: Pick<WakeHost, "secret" | "fetch" | "writers">,
407
+ where: string,
408
+ options: {
409
+ /** How many of the latest messages are asked for, held to the source's own bounds; its own number where none is said. */
410
+ readonly limit?: number | undefined;
411
+ /** The moment of a message, as the messenger spells one: what was written after it alone is read. */
412
+ readonly after?: string | undefined;
413
+ /** The moment the read is asked at, in milliseconds since the epoch: how long ago a message was written is said by it. */
414
+ readonly now: number;
415
+ readonly signal: AbortSignal;
416
+ },
417
+ ): Promise<WakeRead>;
318
418
  }
319
419
 
320
420
  /** What a service is told of the runner it keeps running. */
package/src/runner.ts CHANGED
@@ -35,6 +35,8 @@ export {
35
35
  MAX_GROUP_LENGTH,
36
36
  MAX_GROUP_SIGNALS,
37
37
  makeMark,
38
+ wakePartsOf,
39
+ wakeTextOf,
38
40
  } from "./runner/message.js";
39
41
  export { ownRunnerModules } from "./runner/modules.js";
40
42
  export { createSpawn } from "./runner/process.js";
@@ -63,12 +65,20 @@ export {
63
65
  HOLD_MS,
64
66
  MAX_COOL_DOWN_MS,
65
67
  MAX_HOLD_MS,
68
+ REPORT_MS,
66
69
  type Runner,
67
70
  type RunnerClient,
68
71
  type RunnerOptions,
69
72
  type RunnerState,
73
+ SUBAGENTS_MS,
70
74
  } from "./runner/runner.js";
71
- export { SLACK_APP_TOKEN, slack, slackWakeOf } from "./runner/slack.js";
75
+ export {
76
+ SLACK_APP_TOKEN,
77
+ SLACK_USER_TOKEN,
78
+ type SlackWake,
79
+ slack,
80
+ slackWakeOf,
81
+ } from "./runner/slack.js";
72
82
  export { SYSTEMD_UNIT, systemdUnit, systemdUser } from "./runner/systemd-user.js";
73
83
  export {
74
84
  KEPT_LOGS,
@@ -91,15 +101,20 @@ export type {
91
101
  Fact,
92
102
  Picture,
93
103
  Probe,
104
+ RaisedWake,
94
105
  Service,
95
106
  ServiceCommand,
96
107
  ServiceInput,
97
108
  ServicePlan,
98
109
  Spawn,
99
110
  StartOptions,
111
+ WakeAccount,
100
112
  WakeHost,
113
+ WakePart,
114
+ WakeRead,
101
115
  WakeSocket,
102
116
  WakeSource,
117
+ WakeWriter,
103
118
  } from "./runner/types.js";
104
119
  export {
105
120
  errorsShown,
package/src/schemas.ts CHANGED
@@ -921,6 +921,59 @@ export const restOwnWakeRaisedSchema = z.object({
921
921
  });
922
922
  export type RestOwnWakeRaised = z.infer<typeof restOwnWakeRaisedSchema>;
923
923
 
924
+ /** How many accounts at a messenger one asking names. */
925
+ export const MAX_WRITERS_ASKED = 100;
926
+ const messengerId = z.string().check(z.regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/), z.maxLength(64));
927
+
928
+ /**
929
+ * What `POST /api/v1/agents/me/writers` is sent, by an agent account for itself (ADR-0164):
930
+ * accounts at a messenger, each by the messenger's ids for its workspace and for itself, as a
931
+ * message there names whoever wrote it.
932
+ */
933
+ export const restWritersInputSchema = z.object({
934
+ messenger: z.string().check(z.regex(/^[a-z][a-z0-9-]{1,31}$/)),
935
+ accounts: z
936
+ .array(z.object({ workspace: messengerId, account: messengerId }))
937
+ .check(z.minLength(1), z.maxLength(MAX_WRITERS_ASKED)),
938
+ });
939
+ export type RestWritersInput = z.infer<typeof restWritersInputSchema>;
940
+
941
+ /**
942
+ * Who an account at a messenger is to the agent account that asks (ADR-0164). `told` is whether
943
+ * the console is told the accounts of that workspace at all, by a plugin that is enabled and
944
+ * holds `people:accounts`: where it is not, nothing is known there, and `member` is `null` for
945
+ * every account. `member` is the active member whose account it is, by their login, `null` for
946
+ * one the account that asks may not see (ADR-0035), with what kind of member they are and
947
+ * whether they supervise the account; `null` itself for an account that is no member's as far as
948
+ * the console is told.
949
+ *
950
+ * `supervisor` is the whole of ADR-0084, point 5: an administrator, or anyone above the asker
951
+ * in the reporting line, its manager and every level above. `administrator` and `line` say
952
+ * which, and the other way too: `line` is where the member stands in the asker's line,
953
+ * `manager` whom it reports to, `above` anyone further up, `report` whoever reports to it,
954
+ * `below` anyone further down, `null` nowhere in it. An administrator may stand anywhere in
955
+ * the line, below the asker too, and supervises it all the same.
956
+ */
957
+ export const restWriterSchema = z.object({
958
+ workspace: z.string(),
959
+ account: z.string(),
960
+ told: z.boolean(),
961
+ member: z.nullable(
962
+ z.object({
963
+ login: z.nullable(z.string()),
964
+ kind: z.enum(PERSON_KINDS),
965
+ supervisor: z.boolean(),
966
+ administrator: z.boolean(),
967
+ line: z.nullable(z.enum(["manager", "above", "report", "below"])),
968
+ }),
969
+ ),
970
+ });
971
+ export type RestWriter = z.infer<typeof restWriterSchema>;
972
+
973
+ /** What `POST /api/v1/agents/me/writers` answers: the accounts asked of, in the order asked. */
974
+ export const restWritersSchema = z.object({ items: z.array(restWriterSchema) });
975
+ export type RestWriters = z.infer<typeof restWritersSchema>;
976
+
924
977
  /** `GET /api/v1/agents/<handle>/wakes`: the wakes the account keeps for later, the soonest first. */
925
978
  export const restOwnWakesSchema = z.object({ items: z.array(restOwnWakeSchema) });
926
979
  export type RestOwnWakes = z.infer<typeof restOwnWakesSchema>;
@@ -1786,6 +1839,8 @@ export const restTaskSchema = z.object({
1786
1839
  /** What happened: when the task was first moved past ready, and when it was moved to done; each or `null`. The board keeps both. */
1787
1840
  startedAt: z.nullable(instant),
1788
1841
  doneAt: z.nullable(instant),
1842
+ /** When the last of its runs to end ended, or `null` where none has (ADR-0159). Left out by an older console. */
1843
+ lastRunEndedAt: z.optional(z.nullable(instant)),
1789
1844
  /** When the task was put away (ADR-0029): out of the listings, the board and the calendar, open by its number; `null` while current. */
1790
1845
  archivedAt: z.nullable(instant),
1791
1846
  links: z.array(restTaskLinkSchema),
@@ -2268,6 +2323,15 @@ export const restEventDataSchema = z.object({
2268
2323
  team: z.optional(z.string()),
2269
2324
  /** For `person.email_changed`: whether the person has an address now; never the address itself. */
2270
2325
  set: z.optional(z.boolean()),
2326
+ /**
2327
+ * For a `person.updated` whose `fields` are `account` (ADR-0164), which says that a plugin
2328
+ * said an account at a messenger is the member's (`set`) or is theirs no longer: the messenger
2329
+ * by its name, the workspace there and the account, by the ids the messenger gives them; the
2330
+ * member is `login`, and the plugin that said it the event's own `plugin`.
2331
+ */
2332
+ messenger: z.optional(z.string()),
2333
+ workspace: z.optional(z.string()),
2334
+ account: z.optional(z.string()),
2271
2335
  /** For `person.updated` of an agent account and for `agent.state_changed`: the account's handle. */
2272
2336
  handle: z.optional(z.string()),
2273
2337
  /**