@skillcdn/console 0.6.1 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -7
- package/SKILLCDN.md +3 -2
- package/dist/agent-page.d.ts +2 -0
- package/dist/agent-page.d.ts.map +1 -1
- package/dist/agent-page.js +77 -30
- package/dist/agent-page.js.map +1 -1
- package/dist/agent-state.d.ts +9 -0
- package/dist/agent-state.d.ts.map +1 -0
- package/dist/agent-state.js +28 -0
- package/dist/agent-state.js.map +1 -0
- package/dist/agent-usage.d.ts +9 -6
- package/dist/agent-usage.d.ts.map +1 -1
- package/dist/agent-usage.js +38 -8
- package/dist/agent-usage.js.map +1 -1
- package/dist/api.d.ts +4 -3
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +4 -3
- package/dist/api.js.map +1 -1
- package/dist/cli/cli.d.ts +2 -0
- package/dist/cli/cli.d.ts.map +1 -1
- package/dist/cli/cli.js +369 -130
- package/dist/cli/cli.js.map +1 -1
- package/dist/cli/format.d.ts +13 -4
- package/dist/cli/format.d.ts.map +1 -1
- package/dist/cli/format.js +43 -9
- package/dist/cli/format.js.map +1 -1
- package/dist/cli/help.d.ts +82 -9
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +780 -318
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/pack.d.ts +2 -2
- package/dist/cli/pack.d.ts.map +1 -1
- package/dist/cli/pack.js +6 -4
- package/dist/cli/pack.js.map +1 -1
- package/dist/cli/runner-files.d.ts +16 -0
- package/dist/cli/runner-files.d.ts.map +1 -0
- package/dist/cli/runner-files.js +110 -0
- package/dist/cli/runner-files.js.map +1 -0
- package/dist/cli/runner-host.d.ts +7 -0
- package/dist/cli/runner-host.d.ts.map +1 -1
- package/dist/cli/runner-host.js +40 -2
- package/dist/cli/runner-host.js.map +1 -1
- package/dist/client.d.ts +22 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +7 -1
- package/dist/client.js.map +1 -1
- package/dist/components/agent-page.d.ts +61 -11
- package/dist/components/agent-page.d.ts.map +1 -1
- package/dist/components/agent-page.js +146 -35
- package/dist/components/agent-page.js.map +1 -1
- package/dist/components/agents.d.ts +3 -2
- package/dist/components/agents.d.ts.map +1 -1
- package/dist/components/agents.js +9 -3
- package/dist/components/agents.js.map +1 -1
- package/dist/components/calendar.d.ts +24 -4
- package/dist/components/calendar.d.ts.map +1 -1
- package/dist/components/calendar.js +78 -35
- package/dist/components/calendar.js.map +1 -1
- package/dist/console.d.ts.map +1 -1
- package/dist/console.js +40 -12
- package/dist/console.js.map +1 -1
- package/dist/data.d.ts +2 -0
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +4 -0
- package/dist/data.js.map +1 -1
- package/dist/desk-page.js +5 -5
- package/dist/desk-page.js.map +1 -1
- package/dist/feed-words.d.ts.map +1 -1
- package/dist/feed-words.js +18 -1
- package/dist/feed-words.js.map +1 -1
- package/dist/i18n/en.d.ts +51 -1
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +44 -2
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/ko.d.ts.map +1 -1
- package/dist/i18n/ko.js +52 -17
- package/dist/i18n/ko.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/limits.d.ts +10 -0
- package/dist/limits.d.ts.map +1 -1
- package/dist/limits.js +10 -0
- package/dist/limits.js.map +1 -1
- package/dist/plugin/capabilities.d.ts +1 -1
- package/dist/plugin/capabilities.d.ts.map +1 -1
- package/dist/plugin/capabilities.js +6 -1
- package/dist/plugin/capabilities.js.map +1 -1
- package/dist/plugin/context.d.ts +101 -8
- package/dist/plugin/context.d.ts.map +1 -1
- package/dist/plugin/limits.d.ts +7 -0
- package/dist/plugin/limits.d.ts.map +1 -1
- package/dist/plugin/limits.js +7 -0
- package/dist/plugin/limits.js.map +1 -1
- package/dist/plugin/testing.d.ts +2 -0
- package/dist/plugin/testing.d.ts.map +1 -1
- package/dist/plugin/testing.js +2 -0
- package/dist/plugin/testing.js.map +1 -1
- package/dist/rules.js +1 -1
- package/dist/rules.js.map +1 -1
- package/dist/runner/acp.d.ts.map +1 -1
- package/dist/runner/acp.js +9 -3
- package/dist/runner/acp.js.map +1 -1
- package/dist/runner/claude.d.ts.map +1 -1
- package/dist/runner/claude.js +143 -10
- package/dist/runner/claude.js.map +1 -1
- package/dist/runner/codex.d.ts.map +1 -1
- package/dist/runner/codex.js +14 -2
- package/dist/runner/codex.js.map +1 -1
- package/dist/runner/config.d.ts +18 -0
- package/dist/runner/config.d.ts.map +1 -1
- package/dist/runner/config.js +77 -1
- package/dist/runner/config.js.map +1 -1
- package/dist/runner/desk.d.ts +7 -0
- package/dist/runner/desk.d.ts.map +1 -1
- package/dist/runner/desk.js +20 -4
- package/dist/runner/desk.js.map +1 -1
- package/dist/runner/message.d.ts +26 -2
- package/dist/runner/message.d.ts.map +1 -1
- package/dist/runner/message.js +120 -32
- package/dist/runner/message.js.map +1 -1
- package/dist/runner/runner.d.ts +40 -2
- package/dist/runner/runner.d.ts.map +1 -1
- package/dist/runner/runner.js +533 -32
- package/dist/runner/runner.js.map +1 -1
- package/dist/runner/slack-status.d.ts +19 -0
- package/dist/runner/slack-status.d.ts.map +1 -0
- package/dist/runner/slack-status.js +332 -0
- package/dist/runner/slack-status.js.map +1 -0
- package/dist/runner/slack.d.ts +17 -11
- package/dist/runner/slack.d.ts.map +1 -1
- package/dist/runner/slack.js +1199 -109
- package/dist/runner/slack.js.map +1 -1
- package/dist/runner/types.d.ts +205 -6
- package/dist/runner/types.d.ts.map +1 -1
- package/dist/runner/types.js.map +1 -1
- package/dist/runner/usage.d.ts +6 -1
- package/dist/runner/usage.d.ts.map +1 -1
- package/dist/runner/usage.js +9 -2
- package/dist/runner/usage.js.map +1 -1
- package/dist/runner.d.ts +4 -4
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +3 -3
- package/dist/runner.js.map +1 -1
- package/dist/schemas.d.ts +263 -1
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +137 -5
- package/dist/schemas.js.map +1 -1
- package/dist/vocabulary.d.ts +7 -0
- package/dist/vocabulary.d.ts.map +1 -1
- package/dist/vocabulary.js +6 -0
- package/dist/vocabulary.js.map +1 -1
- package/dist/wake-text.d.ts +43 -0
- package/dist/wake-text.d.ts.map +1 -0
- package/dist/wake-text.js +115 -0
- package/dist/wake-text.js.map +1 -0
- package/docs/specs/cli.md +21 -12
- package/docs/specs/plugins.md +12 -7
- package/docs/specs/rest.md +14 -5
- package/docs/specs/runner.md +133 -26
- package/docs/start.md +26 -5
- package/package.json +3 -3
- package/skills/building-a-plugin/SKILL.md +3 -3
- package/skills/deploying-a-console/SKILL.md +3 -3
- package/skills/deploying-a-console/references/access.md +15 -1
- package/skills/deploying-a-console/references/resources.md +2 -2
- package/skills/deploying-a-console/scripts/github-app.mjs +593 -0
- package/skills/planning-the-board/references/setting-up.md +1 -1
- package/skills/running-an-agent/SKILL.md +18 -72
- package/skills/running-an-agent/references/preparing-the-machine.md +17 -0
- package/skills/running-an-agent/references/several-tasks.md +1 -1
- package/skills/running-an-agent/references/slack-app.md +55 -8
- package/skills/running-an-agent/references/the-account-and-the-invitation.md +5 -0
- package/skills/running-an-agent/references/what-was-not-seen-run-yet.md +3 -0
- package/skills/running-an-agent/references/when-the-agent-could-not-go-on.md +16 -0
- package/skills/running-an-agent/references/your-first-task.md +19 -0
- package/skills/trying-a-console/SKILL.md +136 -0
- package/skills/trying-a-console/references/when-it-does-not-go.md +30 -0
- package/skills/working-the-board/SKILL.md +11 -15
- package/skills/working-the-board/references/a-pack-skills-questions.md +3 -0
- package/skills/working-the-board/references/a-plugins-commands.md +3 -0
- package/skills/working-the-board/references/a-review.md +3 -0
- package/skills/working-the-board/references/an-open-run.md +3 -0
- package/skills/working-the-board/references/requirements.md +7 -0
- package/skills/working-the-board/references/the-pack.md +3 -3
- package/skills/working-the-board/references/what-they-were-told.md +3 -0
- package/skills/working-the-board/references/work-given-in-chat.md +5 -0
- package/src/agent-page.tsx +133 -41
- package/src/agent-state.ts +33 -0
- package/src/agent-usage.ts +55 -12
- package/src/api.ts +23 -0
- package/src/cli/cli.ts +443 -137
- package/src/cli/format.ts +49 -9
- package/src/cli/help.ts +904 -359
- package/src/cli/pack.ts +6 -4
- package/src/cli/runner-files.ts +120 -0
- package/src/cli/runner-host.ts +48 -2
- package/src/client.ts +64 -0
- package/src/components/agent-page.tsx +264 -39
- package/src/components/agents.tsx +20 -5
- package/src/components/calendar.tsx +92 -36
- package/src/console.tsx +47 -10
- package/src/data.ts +6 -0
- package/src/desk-page.tsx +5 -5
- package/src/feed-words.ts +20 -1
- package/src/i18n/en.ts +50 -2
- package/src/i18n/ko.ts +62 -17
- package/src/index.ts +2 -0
- package/src/limits.ts +10 -0
- package/src/plugin/capabilities.ts +8 -1
- package/src/plugin/context.ts +103 -7
- package/src/plugin/limits.ts +7 -0
- package/src/plugin/testing.ts +4 -0
- package/src/rules.ts +1 -1
- package/src/runner/acp.ts +9 -3
- package/src/runner/claude.ts +159 -10
- package/src/runner/codex.ts +14 -2
- package/src/runner/config.ts +114 -1
- package/src/runner/desk.ts +23 -4
- package/src/runner/message.ts +144 -35
- package/src/runner/runner.ts +658 -35
- package/src/runner/slack-status.ts +423 -0
- package/src/runner/slack.ts +1509 -128
- package/src/runner/types.ts +200 -5
- package/src/runner/usage.ts +16 -3
- package/src/runner.ts +20 -1
- package/src/schemas.ts +161 -3
- package/src/vocabulary.ts +9 -0
- package/src/wake-text.ts +133 -0
|
@@ -9,20 +9,26 @@ import {
|
|
|
9
9
|
useRef,
|
|
10
10
|
useState,
|
|
11
11
|
} from "react";
|
|
12
|
+
import { reasonMoment } from "../agent-state.js";
|
|
12
13
|
import {
|
|
13
14
|
type AgentState,
|
|
14
15
|
type FileUpload,
|
|
16
|
+
isSecretName,
|
|
17
|
+
MAX_AGENT_SECRET_NAME_LENGTH,
|
|
15
18
|
MAX_FILE_BYTES,
|
|
19
|
+
MAX_SECRET_OFFER_NOTE_LENGTH,
|
|
16
20
|
MAX_SIGNAL_ATTACHMENTS,
|
|
17
21
|
MAX_SIGNAL_LENGTH,
|
|
18
22
|
type RestAgent,
|
|
19
23
|
type RestAgentRunner,
|
|
20
24
|
type RestAgentSecret,
|
|
25
|
+
type RestAgentSecretOffer,
|
|
21
26
|
type RestAgentSession,
|
|
22
27
|
type RestAgentUsageWindow,
|
|
23
28
|
type RestPerson,
|
|
24
29
|
type RestSignal,
|
|
25
30
|
type RestTranscriptEvent,
|
|
31
|
+
SECRET_OFFER_DAYS,
|
|
26
32
|
usageNear,
|
|
27
33
|
usageSaidTogether,
|
|
28
34
|
usedHundredths,
|
|
@@ -123,10 +129,14 @@ export function AgentUsage(props: {
|
|
|
123
129
|
);
|
|
124
130
|
}
|
|
125
131
|
|
|
126
|
-
/**
|
|
132
|
+
/**
|
|
133
|
+
* The state of an agent account as a badge: the word, and where there is room since when it
|
|
134
|
+
* stands so, right after the word it is the moment of, then why, with when that was said where
|
|
135
|
+
* it is another moment than the state's.
|
|
136
|
+
*/
|
|
127
137
|
export function AgentStateBadge(props: {
|
|
128
138
|
readonly state: RestAgent["state"];
|
|
129
|
-
/** With
|
|
139
|
+
/** With since when it stands so, why, and when its runner was last heard from. */
|
|
130
140
|
readonly full?: boolean | undefined;
|
|
131
141
|
}) {
|
|
132
142
|
const words = useWords().agents.page.state;
|
|
@@ -145,6 +155,7 @@ export function AgentStateBadge(props: {
|
|
|
145
155
|
}
|
|
146
156
|
const reasons: Readonly<Record<string, string>> = words.reasons;
|
|
147
157
|
const reason = state.reason === null ? undefined : (reasons[state.reason] ?? state.reason);
|
|
158
|
+
const said = reasonMoment(state);
|
|
148
159
|
const badge = (
|
|
149
160
|
<Badge
|
|
150
161
|
tone={STATE_TONES[state.state]}
|
|
@@ -162,7 +173,6 @@ export function AgentStateBadge(props: {
|
|
|
162
173
|
<span className="sc-agent-state">
|
|
163
174
|
{badge}
|
|
164
175
|
<span className="sc-note">
|
|
165
|
-
{reason !== undefined && `${reason} · `}
|
|
166
176
|
{words.since.before}
|
|
167
177
|
<Time iso={state.since} precision="clock" />
|
|
168
178
|
{words.since.after}
|
|
@@ -174,6 +184,19 @@ export function AgentStateBadge(props: {
|
|
|
174
184
|
{words.until.after}
|
|
175
185
|
</>
|
|
176
186
|
)}
|
|
187
|
+
{reason !== undefined && (
|
|
188
|
+
<>
|
|
189
|
+
{" · "}
|
|
190
|
+
{reason}
|
|
191
|
+
{said !== undefined && (
|
|
192
|
+
<>
|
|
193
|
+
{words.reasonAt.before}
|
|
194
|
+
<Time iso={said} precision="clock" />
|
|
195
|
+
{words.reasonAt.after}
|
|
196
|
+
</>
|
|
197
|
+
)}
|
|
198
|
+
</>
|
|
199
|
+
)}
|
|
177
200
|
{state.heardAt !== null && (
|
|
178
201
|
<>
|
|
179
202
|
{" · "}
|
|
@@ -252,8 +275,16 @@ export type TalkItem =
|
|
|
252
275
|
* their parent, read as a conversation of their own. Nothing for a call that started none.
|
|
253
276
|
*/
|
|
254
277
|
readonly steps?: readonly TalkItem[] | undefined;
|
|
255
|
-
/**
|
|
278
|
+
/**
|
|
279
|
+
* When the turn or the session it ran in ended, where that came before its answer; for a
|
|
280
|
+
* sub-agent that goes on in the background, when its session ended before it did.
|
|
281
|
+
*/
|
|
256
282
|
readonly endedAt?: string | undefined;
|
|
283
|
+
/**
|
|
284
|
+
* The event of the sub-agent's that says it ended, and how (`over`, ADR-0161): the last
|
|
285
|
+
* of them, and none where the sub-agent did something after it, as one started again does.
|
|
286
|
+
*/
|
|
287
|
+
readonly over?: RestTranscriptEvent | undefined;
|
|
257
288
|
};
|
|
258
289
|
|
|
259
290
|
/** The most characters of a sub-agent's name that a label shows. */
|
|
@@ -291,8 +322,27 @@ const endsTurn = (event: RestTranscriptEvent): boolean =>
|
|
|
291
322
|
event.sealed === null &&
|
|
292
323
|
(event.data.turn === "completed" || typeof event.data.ended === "string");
|
|
293
324
|
|
|
325
|
+
/** Whether an event is a sub-agent's word that it ended: a runner writes how under `over` (ADR-0161). */
|
|
326
|
+
const saysOver = (event: RestTranscriptEvent): boolean =>
|
|
327
|
+
event.kind === "status" && typeof event.data.over === "string";
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* The kinds of event by which a sub-agent that ended is at work again: what it says, thinks and
|
|
331
|
+
* calls, and its own word that it was started again. A tool's answer is none: a product that
|
|
332
|
+
* stops a sub-agent in the middle of a call says first that it ended, and then what became of
|
|
333
|
+
* the call.
|
|
334
|
+
*/
|
|
335
|
+
const AT_WORK: ReadonlySet<string> = new Set(["assistant", "thinking", "tool_call", "status"]);
|
|
336
|
+
|
|
294
337
|
type ToolItem = Extract<TalkItem, { type: "tool" }>;
|
|
295
338
|
|
|
339
|
+
/**
|
|
340
|
+
* Whether a call was answered with the word that its sub-agent goes on in the background
|
|
341
|
+
* (`background` on its answer, ADR-0161): the answer is then not the sub-agent's, which goes on
|
|
342
|
+
* past it, and past the turn it was started in.
|
|
343
|
+
*/
|
|
344
|
+
const goesOn = (item: ToolItem): boolean => item.result?.data.background === true;
|
|
345
|
+
|
|
296
346
|
/** Things in the order they are read: the session's own, or one sub-agent's. */
|
|
297
347
|
type TalkLineOf = TalkItem[];
|
|
298
348
|
|
|
@@ -313,7 +363,9 @@ interface TalkPlace {
|
|
|
313
363
|
* not a thing of the line the call stands in. A call that says it starts a sub-agent (`starts`)
|
|
314
364
|
* has such a line from the first, empty; one a runner of before wrote has it from the first
|
|
315
365
|
* event that names it. An event that names a call the events do not hold stays where it stood.
|
|
316
|
-
* A turn or a session that ended ends every sub-agent still open in it
|
|
366
|
+
* A turn or a session that ended ends every sub-agent still open in it, but for one that goes on
|
|
367
|
+
* in the background (ADR-0161): its own line says when it ended, and nothing but its session's
|
|
368
|
+
* end ends it before.
|
|
317
369
|
*/
|
|
318
370
|
export function talkOf(events: readonly RestTranscriptEvent[]): TalkItem[] {
|
|
319
371
|
const top: TalkLineOf = [];
|
|
@@ -323,7 +375,7 @@ export function talkOf(events: readonly RestTranscriptEvent[]): TalkItem[] {
|
|
|
323
375
|
const calls = new Map<string, TalkPlace>();
|
|
324
376
|
/** The line of each sub-agent, by the id of the call that started it. */
|
|
325
377
|
const lines = new Map<string, TalkLineOf>();
|
|
326
|
-
/** The calls that started a sub-agent
|
|
378
|
+
/** The calls that started a sub-agent that nothing ended yet, as far as the events read say. */
|
|
327
379
|
let running: TalkPlace[] = [];
|
|
328
380
|
const toolAt = (place: TalkPlace | undefined): ToolItem | undefined => {
|
|
329
381
|
const item = place === undefined ? undefined : place.line[place.at];
|
|
@@ -370,6 +422,13 @@ export function talkOf(events: readonly RestTranscriptEvent[]): TalkItem[] {
|
|
|
370
422
|
const parent = parentOf(event);
|
|
371
423
|
const starter = parent === undefined ? undefined : calls.get(parent);
|
|
372
424
|
const line = parent === undefined || starter === undefined ? top : lineOf(parent, starter);
|
|
425
|
+
// What a sub-agent's own line says of its end stands until the sub-agent does something
|
|
426
|
+
// after it, as one that was started again does: then it is at work again.
|
|
427
|
+
const begun = toolAt(starter);
|
|
428
|
+
if (starter !== undefined && begun !== undefined && event.sealed === null) {
|
|
429
|
+
const over = saysOver(event) ? event : AT_WORK.has(event.kind) ? undefined : begun.over;
|
|
430
|
+
set(starter, { ...begun, over });
|
|
431
|
+
}
|
|
373
432
|
// A sealed event says who sealed it and why, wherever it stood.
|
|
374
433
|
if (event.sealed !== null) {
|
|
375
434
|
line.push({ type: "note", event });
|
|
@@ -442,15 +501,26 @@ export function talkOf(events: readonly RestTranscriptEvent[]): TalkItem[] {
|
|
|
442
501
|
} else {
|
|
443
502
|
line.push({ type: "note", event });
|
|
444
503
|
// Where the session's own line says a turn ended, or the session did, nothing started in
|
|
445
|
-
// it goes on: a sub-agent that was not answered by then is ended there.
|
|
504
|
+
// it goes on: a sub-agent that was not answered by then is ended there. One that goes on
|
|
505
|
+
// in the background goes on past a turn's end, and is ended by its session's alone.
|
|
446
506
|
if (parent === undefined && endsTurn(event)) {
|
|
507
|
+
const session = typeof event.data.ended === "string";
|
|
508
|
+
const still: TalkPlace[] = [];
|
|
447
509
|
for (const place of running) {
|
|
448
510
|
const tool = toolAt(place);
|
|
449
|
-
if (tool
|
|
511
|
+
if (tool === undefined) {
|
|
512
|
+
continue;
|
|
513
|
+
}
|
|
514
|
+
if (goesOn(tool) && !session) {
|
|
515
|
+
still.push(place);
|
|
516
|
+
} else if (
|
|
517
|
+
(goesOn(tool) ? tool.over === undefined : tool.result === undefined) &&
|
|
518
|
+
tool.endedAt === undefined
|
|
519
|
+
) {
|
|
450
520
|
set(place, { ...tool, endedAt: event.at });
|
|
451
521
|
}
|
|
452
522
|
}
|
|
453
|
-
running =
|
|
523
|
+
running = still;
|
|
454
524
|
}
|
|
455
525
|
}
|
|
456
526
|
}
|
|
@@ -527,6 +597,11 @@ function atOf(steps: readonly TalkItem[]): Working {
|
|
|
527
597
|
* otherwise, which only an open session's is (`live`); how long it ran, to its answer, to where
|
|
528
598
|
* it was ended or to the last thing it did, and to `now` while it runs; how many tools it
|
|
529
599
|
* called; and what it is at. Nothing for a thing that is no call that started a sub-agent.
|
|
600
|
+
*
|
|
601
|
+
* One that goes on in the background (ADR-0161) is not answered for by its call's answer, which
|
|
602
|
+
* says only that it was started: it stands by its own word that it ended, done, failed or
|
|
603
|
+
* stopped, is ended where its session ended first, and is at work otherwise, whatever turn
|
|
604
|
+
* ended meanwhile.
|
|
530
605
|
*/
|
|
531
606
|
export function subAgentOf(
|
|
532
607
|
item: TalkItem,
|
|
@@ -544,24 +619,34 @@ export function subAgentOf(
|
|
|
544
619
|
const named = typeof said === "string" ? said : steps.map(firstOf).find(Boolean)?.data.subagent;
|
|
545
620
|
const name = typeof named === "string" ? named.trim().slice(0, MAX_SUBAGENT_NAME) : "";
|
|
546
621
|
const started = Date.parse(first.at);
|
|
547
|
-
|
|
622
|
+
// What the sub-agent answered: the call's answer, but for one that says the sub-agent goes on.
|
|
623
|
+
const answer = goesOn(item) ? undefined : item.result;
|
|
624
|
+
const how = item.over?.data.over;
|
|
548
625
|
const cut = item.endedAt === undefined ? Number.NaN : Date.parse(item.endedAt);
|
|
549
626
|
const state: SubAgentState =
|
|
550
|
-
|
|
551
|
-
?
|
|
627
|
+
answer !== undefined
|
|
628
|
+
? answer.data.error === true
|
|
552
629
|
? "failed"
|
|
553
630
|
: "done"
|
|
554
|
-
: item.
|
|
555
|
-
? "
|
|
556
|
-
|
|
631
|
+
: item.over !== undefined
|
|
632
|
+
? how === "failed"
|
|
633
|
+
? "failed"
|
|
634
|
+
: how === "stopped"
|
|
635
|
+
? "ended"
|
|
636
|
+
: "done"
|
|
637
|
+
: item.endedAt !== undefined || refusedOf(item) || !input.live
|
|
638
|
+
? "ended"
|
|
639
|
+
: "running";
|
|
557
640
|
const until =
|
|
558
641
|
state === "running"
|
|
559
642
|
? input.now
|
|
560
|
-
:
|
|
561
|
-
?
|
|
562
|
-
: item.
|
|
563
|
-
?
|
|
564
|
-
:
|
|
643
|
+
: answer !== undefined
|
|
644
|
+
? Date.parse(answer.at)
|
|
645
|
+
: item.over !== undefined
|
|
646
|
+
? Date.parse(item.over.at)
|
|
647
|
+
: item.endedAt !== undefined
|
|
648
|
+
? cut
|
|
649
|
+
: Math.max(started, ...steps.flatMap(momentsOf));
|
|
565
650
|
const seconds = Math.floor((until - started) / 1000);
|
|
566
651
|
return {
|
|
567
652
|
n: first.n,
|
|
@@ -588,22 +673,33 @@ function subAgentsIn(
|
|
|
588
673
|
}
|
|
589
674
|
|
|
590
675
|
/**
|
|
591
|
-
* The sub-agents at work in
|
|
592
|
-
*
|
|
593
|
-
*
|
|
676
|
+
* The sub-agents at work in an open session, read off its events alone, in the order they were
|
|
677
|
+
* started: those a call of the turn under way started that was not answered yet, and those that
|
|
678
|
+
* go on in the background, whatever turn started them, until each says it ended (ADR-0161).
|
|
679
|
+
* None where the session has no event; none but those in the background where its last turn is
|
|
680
|
+
* over.
|
|
594
681
|
*/
|
|
595
682
|
export function atWorkOf(events: readonly RestTranscriptEvent[], now: number): readonly SubAgent[] {
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
683
|
+
return subAgentsIn(talkOf(events), { now, live: true }).filter((one) => one.state === "running");
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
/**
|
|
687
|
+
* Whether the events read hold what a sub-agent did and not the call that started it: the call
|
|
688
|
+
* then stands before them, as it does once a sub-agent has worked for long, and what it did is
|
|
689
|
+
* read under it only once the events before are read too.
|
|
690
|
+
*/
|
|
691
|
+
export function lacksStarter(events: readonly RestTranscriptEvent[]): boolean {
|
|
692
|
+
const calls = new Set<string>();
|
|
693
|
+
for (const event of events) {
|
|
694
|
+
const id = event.kind === "tool_call" ? idOf(event) : undefined;
|
|
695
|
+
if (id !== undefined) {
|
|
696
|
+
calls.add(id);
|
|
602
697
|
}
|
|
603
698
|
}
|
|
604
|
-
return
|
|
605
|
-
|
|
606
|
-
|
|
699
|
+
return events.some((event) => {
|
|
700
|
+
const parent = parentOf(event);
|
|
701
|
+
return parent !== undefined && !calls.has(parent);
|
|
702
|
+
});
|
|
607
703
|
}
|
|
608
704
|
|
|
609
705
|
/**
|
|
@@ -956,7 +1052,8 @@ function sameItem(a: TalkItem, b: TalkItem): boolean {
|
|
|
956
1052
|
a.call === b.call &&
|
|
957
1053
|
a.result === b.result &&
|
|
958
1054
|
a.permission === b.permission &&
|
|
959
|
-
a.endedAt === b.endedAt
|
|
1055
|
+
a.endedAt === b.endedAt &&
|
|
1056
|
+
a.over === b.over
|
|
960
1057
|
);
|
|
961
1058
|
}
|
|
962
1059
|
return a.type === b.type && a.event === b.event;
|
|
@@ -1462,7 +1559,8 @@ const TalkLine: NamedExoticComponent<TalkLineProps> = memo(function Line(
|
|
|
1462
1559
|
);
|
|
1463
1560
|
}
|
|
1464
1561
|
// A wake, a status, an error, and whatever a newer runner calls otherwise: a note between.
|
|
1465
|
-
// What the note's own words say already, how a session ended, is not said
|
|
1562
|
+
// What the note's own words say already, how a session or a sub-agent ended, is not said
|
|
1563
|
+
// twice as a fact.
|
|
1466
1564
|
// The id of the call that started a sub-agent is for joining, and says nothing to a reader;
|
|
1467
1565
|
// whose a note is, is not said again under the sub-agent that made it.
|
|
1468
1566
|
const facts = Object.entries(event.data).filter(
|
|
@@ -1471,6 +1569,7 @@ const TalkLine: NamedExoticComponent<TalkLineProps> = memo(function Line(
|
|
|
1471
1569
|
name !== "signal" &&
|
|
1472
1570
|
name !== "kind" &&
|
|
1473
1571
|
name !== "ended" &&
|
|
1572
|
+
name !== "over" &&
|
|
1474
1573
|
name !== "parent" &&
|
|
1475
1574
|
!(name === "subagent" && props.inside === true),
|
|
1476
1575
|
);
|
|
@@ -1709,22 +1808,24 @@ export function TalkWaiting(props: TalkWaitingProps) {
|
|
|
1709
1808
|
* The sign that the agent is at work while a turn is under way: its picture, three dots, and
|
|
1710
1809
|
* what it is at, a thought, a tool by its name, or the work between. Where sub-agents run, it
|
|
1711
1810
|
* says how many, with each under it: its name, what it is at, how many tools it called and how
|
|
1712
|
-
* long it has run, which the page counts by itself (ADR-0141).
|
|
1713
|
-
*
|
|
1811
|
+
* long it has run, which the page counts by itself (ADR-0141). Sub-agents that go on in the
|
|
1812
|
+
* background are at work past the turn that started them (ADR-0161), and the sign stands for
|
|
1813
|
+
* them alone then. A row of the conversation's list; nothing where no turn is under way and no
|
|
1814
|
+
* sub-agent is at work.
|
|
1714
1815
|
*/
|
|
1715
1816
|
export function TalkWorking(props: {
|
|
1716
1817
|
readonly working: Working | undefined;
|
|
1717
1818
|
readonly agent?: RestPerson | undefined;
|
|
1718
|
-
/** The sub-agents at work in the
|
|
1819
|
+
/** The sub-agents at work in the session: `atWorkOf` says which. */
|
|
1719
1820
|
readonly agents?: readonly SubAgent[] | undefined;
|
|
1720
1821
|
}) {
|
|
1721
1822
|
const live = useWords().agents.page.live;
|
|
1722
1823
|
const words = live.working;
|
|
1723
1824
|
const { working } = props;
|
|
1724
|
-
|
|
1825
|
+
const agents = props.agents ?? [];
|
|
1826
|
+
if (working === undefined && agents.length === 0) {
|
|
1725
1827
|
return null;
|
|
1726
1828
|
}
|
|
1727
|
-
const agents = props.agents ?? [];
|
|
1728
1829
|
return (
|
|
1729
1830
|
<li
|
|
1730
1831
|
className={cx(
|
|
@@ -2525,6 +2626,130 @@ export function AgentElsewhereList(props: {
|
|
|
2525
2626
|
);
|
|
2526
2627
|
}
|
|
2527
2628
|
|
|
2629
|
+
export interface AgentSecretOfferListProps {
|
|
2630
|
+
readonly offers: readonly RestAgentSecretOffer[];
|
|
2631
|
+
}
|
|
2632
|
+
|
|
2633
|
+
/** What a secret offered to an account stands as, in the tone a badge says it in. */
|
|
2634
|
+
const OFFER_TONES = {
|
|
2635
|
+
waiting: "accent",
|
|
2636
|
+
taken: "success",
|
|
2637
|
+
left: "neutral",
|
|
2638
|
+
lapsed: "neutral",
|
|
2639
|
+
} as const;
|
|
2640
|
+
|
|
2641
|
+
/**
|
|
2642
|
+
* The secrets offered to an agent account (ADR-0169), a row each: the name proposed, who offers
|
|
2643
|
+
* it and when, and how the offer stands. Never a value.
|
|
2644
|
+
*/
|
|
2645
|
+
export function AgentSecretOfferList(props: AgentSecretOfferListProps) {
|
|
2646
|
+
const words = useWords().agents.page.offers;
|
|
2647
|
+
return (
|
|
2648
|
+
<ul className="sc-divided sc-agent-secret-list" aria-label={words.title}>
|
|
2649
|
+
{props.offers.map((offer) => (
|
|
2650
|
+
<li key={offer.id} className="sc-small sc-agent-secret">
|
|
2651
|
+
<code>{offer.name}</code>
|
|
2652
|
+
<span className="sc-muted">
|
|
2653
|
+
{offer.by === null ? words.someone : personName(offer.by)}
|
|
2654
|
+
{" · "}
|
|
2655
|
+
<Time iso={offer.at} precision="day" />
|
|
2656
|
+
{offer.takenAs !== null && offer.takenAs !== offer.name && (
|
|
2657
|
+
<>
|
|
2658
|
+
{" · "}
|
|
2659
|
+
{words.takenAs(offer.takenAs)}
|
|
2660
|
+
</>
|
|
2661
|
+
)}
|
|
2662
|
+
</span>
|
|
2663
|
+
<Badge tone={OFFER_TONES[offer.state]} kind="state">
|
|
2664
|
+
{words.state[offer.state]}
|
|
2665
|
+
</Badge>
|
|
2666
|
+
</li>
|
|
2667
|
+
))}
|
|
2668
|
+
</ul>
|
|
2669
|
+
);
|
|
2670
|
+
}
|
|
2671
|
+
|
|
2672
|
+
export interface AgentSecretOfferFormProps {
|
|
2673
|
+
/** What the account is called, for the line that says what becomes of an offer. */
|
|
2674
|
+
readonly account: string;
|
|
2675
|
+
readonly busy?: boolean | undefined;
|
|
2676
|
+
/** Offers a secret: the account takes it or leaves it, and nobody reads the value back. */
|
|
2677
|
+
readonly onOffer: (offer: {
|
|
2678
|
+
readonly name: string;
|
|
2679
|
+
readonly value: string;
|
|
2680
|
+
readonly note: string | undefined;
|
|
2681
|
+
}) => void;
|
|
2682
|
+
}
|
|
2683
|
+
|
|
2684
|
+
/** The way a member offers an agent account a secret (ADR-0169): its name, its value, typed unseen, and what it is for. */
|
|
2685
|
+
export function AgentSecretOfferForm(props: AgentSecretOfferFormProps) {
|
|
2686
|
+
const words = useWords().agents.page.offers;
|
|
2687
|
+
const [name, setName] = useState("");
|
|
2688
|
+
const [value, setValue] = useState("");
|
|
2689
|
+
const [note, setNote] = useState("");
|
|
2690
|
+
const busy = props.busy === true;
|
|
2691
|
+
const ready = isSecretName(name.trim()) && value.length > 0;
|
|
2692
|
+
const submit = (event: FormEvent) => {
|
|
2693
|
+
event.preventDefault();
|
|
2694
|
+
if (!ready || busy) {
|
|
2695
|
+
return;
|
|
2696
|
+
}
|
|
2697
|
+
props.onOffer({
|
|
2698
|
+
name: name.trim(),
|
|
2699
|
+
value,
|
|
2700
|
+
note: note.trim().length === 0 ? undefined : note.trim(),
|
|
2701
|
+
});
|
|
2702
|
+
setName("");
|
|
2703
|
+
setValue("");
|
|
2704
|
+
setNote("");
|
|
2705
|
+
};
|
|
2706
|
+
return (
|
|
2707
|
+
<form className="sc-form" aria-label={words.offerAria} onSubmit={submit}>
|
|
2708
|
+
<div className="sc-field-row">
|
|
2709
|
+
<label className="sc-field">
|
|
2710
|
+
<span className="sc-field-label">{words.name}</span>
|
|
2711
|
+
<input
|
|
2712
|
+
className="sc-input"
|
|
2713
|
+
placeholder={words.namePlaceholder}
|
|
2714
|
+
value={name}
|
|
2715
|
+
maxLength={MAX_AGENT_SECRET_NAME_LENGTH}
|
|
2716
|
+
autoComplete="off"
|
|
2717
|
+
spellCheck={false}
|
|
2718
|
+
aria-invalid={name.trim() !== "" && !isSecretName(name.trim())}
|
|
2719
|
+
onChange={(event) => setName(event.target.value.toLowerCase())}
|
|
2720
|
+
/>
|
|
2721
|
+
</label>
|
|
2722
|
+
<label className="sc-field">
|
|
2723
|
+
<span className="sc-field-label">{words.value}</span>
|
|
2724
|
+
<input
|
|
2725
|
+
className="sc-input"
|
|
2726
|
+
type="password"
|
|
2727
|
+
value={value}
|
|
2728
|
+
autoComplete="new-password"
|
|
2729
|
+
onChange={(event) => setValue(event.target.value)}
|
|
2730
|
+
/>
|
|
2731
|
+
</label>
|
|
2732
|
+
</div>
|
|
2733
|
+
<label className="sc-field">
|
|
2734
|
+
<span className="sc-field-label">{words.note}</span>
|
|
2735
|
+
<input
|
|
2736
|
+
className="sc-input"
|
|
2737
|
+
value={note}
|
|
2738
|
+
maxLength={MAX_SECRET_OFFER_NOTE_LENGTH}
|
|
2739
|
+
autoComplete="off"
|
|
2740
|
+
onChange={(event) => setNote(event.target.value)}
|
|
2741
|
+
/>
|
|
2742
|
+
</label>
|
|
2743
|
+
<p className="sc-field-hint">{words.intro(props.account, SECRET_OFFER_DAYS)}</p>
|
|
2744
|
+
<div className="sc-form-actions">
|
|
2745
|
+
<Button type="submit" variant="primary" disabled={busy || !ready}>
|
|
2746
|
+
{words.offer}
|
|
2747
|
+
</Button>
|
|
2748
|
+
</div>
|
|
2749
|
+
</form>
|
|
2750
|
+
);
|
|
2751
|
+
}
|
|
2752
|
+
|
|
2528
2753
|
export interface AgentSecretListProps {
|
|
2529
2754
|
readonly secrets: readonly RestAgentSecret[];
|
|
2530
2755
|
readonly busy?: boolean | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type FormEvent, useContext, useEffect, useState } from "react";
|
|
2
|
+
import { reasonMoment } from "../agent-state.js";
|
|
2
3
|
import {
|
|
3
4
|
hostOfLogin,
|
|
4
5
|
isHandle,
|
|
@@ -122,8 +123,9 @@ export interface AgentAccountListProps {
|
|
|
122
123
|
|
|
123
124
|
/**
|
|
124
125
|
* Agent accounts, a card each, for whoever looks after several: the picture, the name with the
|
|
125
|
-
* handle and what it does, and across from them how it stands; then
|
|
126
|
-
*
|
|
126
|
+
* handle and what it does, and across from them how it stands; then why it stands so, with
|
|
127
|
+
* when that was said where it is another moment than the state's, and under it the state with
|
|
128
|
+
* since when it stands; what it runs, and whom it reports to where that is someone else. Rows of one
|
|
127
129
|
* shape, so that the cards read alike down a column. The whole card leads to the account's
|
|
128
130
|
* page; what is kept of the account, the login it signs in with among it, is said there.
|
|
129
131
|
*/
|
|
@@ -144,6 +146,10 @@ export function AgentAccountList(props: AgentAccountListProps) {
|
|
|
144
146
|
const invited = person.invited === true;
|
|
145
147
|
const title = person.title ?? "";
|
|
146
148
|
const state = agent.state ?? null;
|
|
149
|
+
// The reason has a moment of its own where it was said under a state that stayed; the
|
|
150
|
+
// state's moment is said with the state's word, so that neither reads as the other's.
|
|
151
|
+
const said = state === null ? undefined : reasonMoment(state);
|
|
152
|
+
const stood = state === null ? undefined : states.sinceAs(states[state.state]);
|
|
147
153
|
const product = agent.runner?.product ?? null;
|
|
148
154
|
const usage = usageStanding(agent.usage, props.now ?? Date.now());
|
|
149
155
|
const model = agent.runner?.running?.model ?? agent.runner?.settings.model ?? null;
|
|
@@ -192,12 +198,21 @@ export function AgentAccountList(props: AgentAccountListProps) {
|
|
|
192
198
|
) : (
|
|
193
199
|
<span className="sc-agent-card-now">
|
|
194
200
|
{state.reason !== null && (
|
|
195
|
-
<span>
|
|
201
|
+
<span>
|
|
202
|
+
{reasons[state.reason] ?? state.reason}
|
|
203
|
+
{said !== undefined && (
|
|
204
|
+
<span className="sc-muted">
|
|
205
|
+
{states.reasonAt.before}
|
|
206
|
+
<Time iso={said} precision="clock" />
|
|
207
|
+
{states.reasonAt.after}
|
|
208
|
+
</span>
|
|
209
|
+
)}
|
|
210
|
+
</span>
|
|
196
211
|
)}
|
|
197
212
|
<span className="sc-muted">
|
|
198
|
-
{
|
|
213
|
+
{stood?.before}
|
|
199
214
|
<Time iso={state.since} precision="clock" />
|
|
200
|
-
{
|
|
215
|
+
{stood?.after}
|
|
201
216
|
{state.until !== undefined && state.until !== null && (
|
|
202
217
|
<>
|
|
203
218
|
{" · "}
|