@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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { memo, useCallback, useEffect, useMemo, useRef, useState, } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { reasonMoment } from "../agent-state.js";
|
|
4
|
+
import { isSecretName, MAX_AGENT_SECRET_NAME_LENGTH, MAX_FILE_BYTES, MAX_SECRET_OFFER_NOTE_LENGTH, MAX_SIGNAL_ATTACHMENTS, MAX_SIGNAL_LENGTH, SECRET_OFFER_DAYS, usageNear, usageSaidTogether, usedHundredths, } from "../api.js";
|
|
4
5
|
import { today } from "../dates.js";
|
|
5
6
|
import { useWords } from "../i18n/index.js";
|
|
6
7
|
import { isPicture } from "./files.js";
|
|
@@ -53,7 +54,11 @@ export function AgentUsage(props) {
|
|
|
53
54
|
: undefined, note: resets === false && apart === false ? undefined : (_jsxs(_Fragment, { children: [resets, resets !== false && apart !== false && " · ", apart] })) }, place));
|
|
54
55
|
}), props.said === true && together !== undefined && (_jsx("span", { className: "sc-progress-words", children: said(together) }))] }));
|
|
55
56
|
}
|
|
56
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* The state of an agent account as a badge: the word, and where there is room since when it
|
|
59
|
+
* stands so, right after the word it is the moment of, then why, with when that was said where
|
|
60
|
+
* it is another moment than the state's.
|
|
61
|
+
*/
|
|
57
62
|
export function AgentStateBadge(props) {
|
|
58
63
|
const words = useWords().agents.page.state;
|
|
59
64
|
const state = props.state ?? null;
|
|
@@ -64,11 +69,12 @@ export function AgentStateBadge(props) {
|
|
|
64
69
|
}
|
|
65
70
|
const reasons = words.reasons;
|
|
66
71
|
const reason = state.reason === null ? undefined : (reasons[state.reason] ?? state.reason);
|
|
72
|
+
const said = reasonMoment(state);
|
|
67
73
|
const badge = (_jsx(Badge, { tone: STATE_TONES[state.state], kind: "state", live: state.state === "running", title: reason, children: words[state.state] }));
|
|
68
74
|
if (props.full !== true) {
|
|
69
75
|
return badge;
|
|
70
76
|
}
|
|
71
|
-
return (_jsxs("span", { className: "sc-agent-state", children: [badge, _jsxs("span", { className: "sc-note", children: [
|
|
77
|
+
return (_jsxs("span", { className: "sc-agent-state", children: [badge, _jsxs("span", { className: "sc-note", children: [words.since.before, _jsx(Time, { iso: state.since, precision: "clock" }), words.since.after, state.until !== undefined && state.until !== null && (_jsxs(_Fragment, { children: [" · ", words.until.before, _jsx(Time, { iso: state.until, precision: "clock" }), words.until.after] })), reason !== undefined && (_jsxs(_Fragment, { children: [" · ", reason, said !== undefined && (_jsxs(_Fragment, { children: [words.reasonAt.before, _jsx(Time, { iso: said, precision: "clock" }), words.reasonAt.after] }))] })), state.heardAt !== null && (_jsxs(_Fragment, { children: [" · ", words.heard, " ", _jsx(Time, { iso: state.heardAt, precision: "clock" })] }))] })] }));
|
|
72
78
|
}
|
|
73
79
|
/** What a runner says of an event that is said apart from the rest: the tool it names. */
|
|
74
80
|
const TOOL = "tool";
|
|
@@ -101,6 +107,21 @@ const idOf = (event) => {
|
|
|
101
107
|
const endsTurn = (event) => event.kind === "status" &&
|
|
102
108
|
event.sealed === null &&
|
|
103
109
|
(event.data.turn === "completed" || typeof event.data.ended === "string");
|
|
110
|
+
/** Whether an event is a sub-agent's word that it ended: a runner writes how under `over` (ADR-0161). */
|
|
111
|
+
const saysOver = (event) => event.kind === "status" && typeof event.data.over === "string";
|
|
112
|
+
/**
|
|
113
|
+
* The kinds of event by which a sub-agent that ended is at work again: what it says, thinks and
|
|
114
|
+
* calls, and its own word that it was started again. A tool's answer is none: a product that
|
|
115
|
+
* stops a sub-agent in the middle of a call says first that it ended, and then what became of
|
|
116
|
+
* the call.
|
|
117
|
+
*/
|
|
118
|
+
const AT_WORK = new Set(["assistant", "thinking", "tool_call", "status"]);
|
|
119
|
+
/**
|
|
120
|
+
* Whether a call was answered with the word that its sub-agent goes on in the background
|
|
121
|
+
* (`background` on its answer, ADR-0161): the answer is then not the sub-agent's, which goes on
|
|
122
|
+
* past it, and past the turn it was started in.
|
|
123
|
+
*/
|
|
124
|
+
const goesOn = (item) => item.result?.data.background === true;
|
|
104
125
|
/**
|
|
105
126
|
* The events of a session as the things a person reads, in order. A tool's call, what it
|
|
106
127
|
* answered and what was asked before it ran are one thing, joined by the id the product gave
|
|
@@ -112,7 +133,9 @@ const endsTurn = (event) => event.kind === "status" &&
|
|
|
112
133
|
* not a thing of the line the call stands in. A call that says it starts a sub-agent (`starts`)
|
|
113
134
|
* has such a line from the first, empty; one a runner of before wrote has it from the first
|
|
114
135
|
* event that names it. An event that names a call the events do not hold stays where it stood.
|
|
115
|
-
* A turn or a session that ended ends every sub-agent still open in it
|
|
136
|
+
* A turn or a session that ended ends every sub-agent still open in it, but for one that goes on
|
|
137
|
+
* in the background (ADR-0161): its own line says when it ended, and nothing but its session's
|
|
138
|
+
* end ends it before.
|
|
116
139
|
*/
|
|
117
140
|
export function talkOf(events) {
|
|
118
141
|
const top = [];
|
|
@@ -122,7 +145,7 @@ export function talkOf(events) {
|
|
|
122
145
|
const calls = new Map();
|
|
123
146
|
/** The line of each sub-agent, by the id of the call that started it. */
|
|
124
147
|
const lines = new Map();
|
|
125
|
-
/** The calls that started a sub-agent
|
|
148
|
+
/** The calls that started a sub-agent that nothing ended yet, as far as the events read say. */
|
|
126
149
|
let running = [];
|
|
127
150
|
const toolAt = (place) => {
|
|
128
151
|
const item = place === undefined ? undefined : place.line[place.at];
|
|
@@ -169,6 +192,13 @@ export function talkOf(events) {
|
|
|
169
192
|
const parent = parentOf(event);
|
|
170
193
|
const starter = parent === undefined ? undefined : calls.get(parent);
|
|
171
194
|
const line = parent === undefined || starter === undefined ? top : lineOf(parent, starter);
|
|
195
|
+
// What a sub-agent's own line says of its end stands until the sub-agent does something
|
|
196
|
+
// after it, as one that was started again does: then it is at work again.
|
|
197
|
+
const begun = toolAt(starter);
|
|
198
|
+
if (starter !== undefined && begun !== undefined && event.sealed === null) {
|
|
199
|
+
const over = saysOver(event) ? event : AT_WORK.has(event.kind) ? undefined : begun.over;
|
|
200
|
+
set(starter, { ...begun, over });
|
|
201
|
+
}
|
|
172
202
|
// A sealed event says who sealed it and why, wherever it stood.
|
|
173
203
|
if (event.sealed !== null) {
|
|
174
204
|
line.push({ type: "note", event });
|
|
@@ -249,15 +279,25 @@ export function talkOf(events) {
|
|
|
249
279
|
else {
|
|
250
280
|
line.push({ type: "note", event });
|
|
251
281
|
// Where the session's own line says a turn ended, or the session did, nothing started in
|
|
252
|
-
// it goes on: a sub-agent that was not answered by then is ended there.
|
|
282
|
+
// it goes on: a sub-agent that was not answered by then is ended there. One that goes on
|
|
283
|
+
// in the background goes on past a turn's end, and is ended by its session's alone.
|
|
253
284
|
if (parent === undefined && endsTurn(event)) {
|
|
285
|
+
const session = typeof event.data.ended === "string";
|
|
286
|
+
const still = [];
|
|
254
287
|
for (const place of running) {
|
|
255
288
|
const tool = toolAt(place);
|
|
256
|
-
if (tool
|
|
289
|
+
if (tool === undefined) {
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
if (goesOn(tool) && !session) {
|
|
293
|
+
still.push(place);
|
|
294
|
+
}
|
|
295
|
+
else if ((goesOn(tool) ? tool.over === undefined : tool.result === undefined) &&
|
|
296
|
+
tool.endedAt === undefined) {
|
|
257
297
|
set(place, { ...tool, endedAt: event.at });
|
|
258
298
|
}
|
|
259
299
|
}
|
|
260
|
-
running =
|
|
300
|
+
running = still;
|
|
261
301
|
}
|
|
262
302
|
}
|
|
263
303
|
}
|
|
@@ -297,6 +337,11 @@ function atOf(steps) {
|
|
|
297
337
|
* otherwise, which only an open session's is (`live`); how long it ran, to its answer, to where
|
|
298
338
|
* it was ended or to the last thing it did, and to `now` while it runs; how many tools it
|
|
299
339
|
* called; and what it is at. Nothing for a thing that is no call that started a sub-agent.
|
|
340
|
+
*
|
|
341
|
+
* One that goes on in the background (ADR-0161) is not answered for by its call's answer, which
|
|
342
|
+
* says only that it was started: it stands by its own word that it ended, done, failed or
|
|
343
|
+
* stopped, is ended where its session ended first, and is at work otherwise, whatever turn
|
|
344
|
+
* ended meanwhile.
|
|
300
345
|
*/
|
|
301
346
|
export function subAgentOf(item, input) {
|
|
302
347
|
if (item.type !== "tool" || item.steps === undefined) {
|
|
@@ -311,22 +356,32 @@ export function subAgentOf(item, input) {
|
|
|
311
356
|
const named = typeof said === "string" ? said : steps.map(firstOf).find(Boolean)?.data.subagent;
|
|
312
357
|
const name = typeof named === "string" ? named.trim().slice(0, MAX_SUBAGENT_NAME) : "";
|
|
313
358
|
const started = Date.parse(first.at);
|
|
314
|
-
|
|
359
|
+
// What the sub-agent answered: the call's answer, but for one that says the sub-agent goes on.
|
|
360
|
+
const answer = goesOn(item) ? undefined : item.result;
|
|
361
|
+
const how = item.over?.data.over;
|
|
315
362
|
const cut = item.endedAt === undefined ? Number.NaN : Date.parse(item.endedAt);
|
|
316
|
-
const state =
|
|
317
|
-
?
|
|
363
|
+
const state = answer !== undefined
|
|
364
|
+
? answer.data.error === true
|
|
318
365
|
? "failed"
|
|
319
366
|
: "done"
|
|
320
|
-
: item.
|
|
321
|
-
? "
|
|
322
|
-
|
|
367
|
+
: item.over !== undefined
|
|
368
|
+
? how === "failed"
|
|
369
|
+
? "failed"
|
|
370
|
+
: how === "stopped"
|
|
371
|
+
? "ended"
|
|
372
|
+
: "done"
|
|
373
|
+
: item.endedAt !== undefined || refusedOf(item) || !input.live
|
|
374
|
+
? "ended"
|
|
375
|
+
: "running";
|
|
323
376
|
const until = state === "running"
|
|
324
377
|
? input.now
|
|
325
|
-
:
|
|
326
|
-
?
|
|
327
|
-
: item.
|
|
328
|
-
?
|
|
329
|
-
:
|
|
378
|
+
: answer !== undefined
|
|
379
|
+
? Date.parse(answer.at)
|
|
380
|
+
: item.over !== undefined
|
|
381
|
+
? Date.parse(item.over.at)
|
|
382
|
+
: item.endedAt !== undefined
|
|
383
|
+
? cut
|
|
384
|
+
: Math.max(started, ...steps.flatMap(momentsOf));
|
|
330
385
|
const seconds = Math.floor((until - started) / 1000);
|
|
331
386
|
return {
|
|
332
387
|
n: first.n,
|
|
@@ -348,20 +403,32 @@ function subAgentsIn(items, input) {
|
|
|
348
403
|
});
|
|
349
404
|
}
|
|
350
405
|
/**
|
|
351
|
-
* The sub-agents at work in
|
|
352
|
-
*
|
|
353
|
-
*
|
|
406
|
+
* The sub-agents at work in an open session, read off its events alone, in the order they were
|
|
407
|
+
* started: those a call of the turn under way started that was not answered yet, and those that
|
|
408
|
+
* go on in the background, whatever turn started them, until each says it ended (ADR-0161).
|
|
409
|
+
* None where the session has no event; none but those in the background where its last turn is
|
|
410
|
+
* over.
|
|
354
411
|
*/
|
|
355
412
|
export function atWorkOf(events, now) {
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
413
|
+
return subAgentsIn(talkOf(events), { now, live: true }).filter((one) => one.state === "running");
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Whether the events read hold what a sub-agent did and not the call that started it: the call
|
|
417
|
+
* then stands before them, as it does once a sub-agent has worked for long, and what it did is
|
|
418
|
+
* read under it only once the events before are read too.
|
|
419
|
+
*/
|
|
420
|
+
export function lacksStarter(events) {
|
|
421
|
+
const calls = new Set();
|
|
422
|
+
for (const event of events) {
|
|
423
|
+
const id = event.kind === "tool_call" ? idOf(event) : undefined;
|
|
424
|
+
if (id !== undefined) {
|
|
425
|
+
calls.add(id);
|
|
362
426
|
}
|
|
363
427
|
}
|
|
364
|
-
return
|
|
428
|
+
return events.some((event) => {
|
|
429
|
+
const parent = parentOf(event);
|
|
430
|
+
return parent !== undefined && !calls.has(parent);
|
|
431
|
+
});
|
|
365
432
|
}
|
|
366
433
|
/**
|
|
367
434
|
* Whether a turn is under way, and what the agent is at, read off a session's events alone:
|
|
@@ -585,7 +652,8 @@ function sameItem(a, b) {
|
|
|
585
652
|
a.call === b.call &&
|
|
586
653
|
a.result === b.result &&
|
|
587
654
|
a.permission === b.permission &&
|
|
588
|
-
a.endedAt === b.endedAt
|
|
655
|
+
a.endedAt === b.endedAt &&
|
|
656
|
+
a.over === b.over);
|
|
589
657
|
}
|
|
590
658
|
return a.type === b.type && a.event === b.event;
|
|
591
659
|
}
|
|
@@ -802,13 +870,15 @@ const TalkLine = memo(function Line(props) {
|
|
|
802
870
|
return (_jsx("li", { className: "sc-talk-item sc-talk-turn", "data-n": event.n, children: _jsxs("span", { className: "sc-talk-note-line", children: [words.turnDone(Number.isFinite(seconds) ? seconds : undefined), when(event)] }) }));
|
|
803
871
|
}
|
|
804
872
|
// A wake, a status, an error, and whatever a newer runner calls otherwise: a note between.
|
|
805
|
-
// What the note's own words say already, how a session ended, is not said
|
|
873
|
+
// What the note's own words say already, how a session or a sub-agent ended, is not said
|
|
874
|
+
// twice as a fact.
|
|
806
875
|
// The id of the call that started a sub-agent is for joining, and says nothing to a reader;
|
|
807
876
|
// whose a note is, is not said again under the sub-agent that made it.
|
|
808
877
|
const facts = Object.entries(event.data).filter(([name, fact]) => fact !== null &&
|
|
809
878
|
name !== "signal" &&
|
|
810
879
|
name !== "kind" &&
|
|
811
880
|
name !== "ended" &&
|
|
881
|
+
name !== "over" &&
|
|
812
882
|
name !== "parent" &&
|
|
813
883
|
!(name === "subagent" && props.inside === true));
|
|
814
884
|
const lines = event.text.split("\n").filter((line) => line.trim().length > 0);
|
|
@@ -909,17 +979,19 @@ export function TalkWaiting(props) {
|
|
|
909
979
|
* The sign that the agent is at work while a turn is under way: its picture, three dots, and
|
|
910
980
|
* what it is at, a thought, a tool by its name, or the work between. Where sub-agents run, it
|
|
911
981
|
* says how many, with each under it: its name, what it is at, how many tools it called and how
|
|
912
|
-
* long it has run, which the page counts by itself (ADR-0141).
|
|
913
|
-
*
|
|
982
|
+
* long it has run, which the page counts by itself (ADR-0141). Sub-agents that go on in the
|
|
983
|
+
* background are at work past the turn that started them (ADR-0161), and the sign stands for
|
|
984
|
+
* them alone then. A row of the conversation's list; nothing where no turn is under way and no
|
|
985
|
+
* sub-agent is at work.
|
|
914
986
|
*/
|
|
915
987
|
export function TalkWorking(props) {
|
|
916
988
|
const live = useWords().agents.page.live;
|
|
917
989
|
const words = live.working;
|
|
918
990
|
const { working } = props;
|
|
919
|
-
|
|
991
|
+
const agents = props.agents ?? [];
|
|
992
|
+
if (working === undefined && agents.length === 0) {
|
|
920
993
|
return null;
|
|
921
994
|
}
|
|
922
|
-
const agents = props.agents ?? [];
|
|
923
995
|
return (_jsxs("li", { className: cx("sc-talk-item", "sc-talk-working", "sc-note", agents.length > 0 && "sc-talk-working-agents"), role: "status", children: [props.agent !== undefined && _jsx(Avatar, { person: props.agent, size: "sm" }), _jsxs("span", { className: "sc-talk-dots", "aria-hidden": "true", children: [_jsx("span", {}), _jsx("span", {}), _jsx("span", {})] }), _jsx("span", { children: agents.length > 0 ? words.agents(agents.length) : workingWord(words, working) }), agents.length > 0 && (_jsx("ul", { className: "sc-talk-agents", "aria-live": "off", children: agents.map((one) => (_jsxs("li", { className: "sc-talk-agents-row", children: [_jsx("span", { className: "sc-name sc-talk-agent-name", children: one.name.length === 0 ? live.agent.label : one.name }), _jsxs("span", { className: "sc-talk-agents-facts", children: [workingWord(words, one.at), " \u00B7 ", live.agent.calls(one.calls), " \u00B7", " ", _jsx(RunningFor, { since: one.startedAt })] })] }, one.n))) }))] }));
|
|
924
996
|
}
|
|
925
997
|
/**
|
|
@@ -1318,6 +1390,45 @@ export function AgentElsewhereList(props) {
|
|
|
1318
1390
|
const held = Object.entries(props.accounts ?? {});
|
|
1319
1391
|
return (_jsxs("div", { children: [held.length === 0 ? (_jsx("p", { className: "sc-field-hint", children: words.empty })) : (_jsx("dl", { className: "sc-person-facts sc-agent-runner-facts", "aria-label": words.title, children: held.map(([service, name]) => (_jsxs("div", { className: "sc-person-fact", children: [_jsx("dt", { children: service }), _jsx("dd", { children: name })] }, service))) })), _jsx("p", { className: "sc-field-hint", children: words.intro })] }));
|
|
1320
1392
|
}
|
|
1393
|
+
/** What a secret offered to an account stands as, in the tone a badge says it in. */
|
|
1394
|
+
const OFFER_TONES = {
|
|
1395
|
+
waiting: "accent",
|
|
1396
|
+
taken: "success",
|
|
1397
|
+
left: "neutral",
|
|
1398
|
+
lapsed: "neutral",
|
|
1399
|
+
};
|
|
1400
|
+
/**
|
|
1401
|
+
* The secrets offered to an agent account (ADR-0169), a row each: the name proposed, who offers
|
|
1402
|
+
* it and when, and how the offer stands. Never a value.
|
|
1403
|
+
*/
|
|
1404
|
+
export function AgentSecretOfferList(props) {
|
|
1405
|
+
const words = useWords().agents.page.offers;
|
|
1406
|
+
return (_jsx("ul", { className: "sc-divided sc-agent-secret-list", "aria-label": words.title, children: props.offers.map((offer) => (_jsxs("li", { className: "sc-small sc-agent-secret", children: [_jsx("code", { children: offer.name }), _jsxs("span", { className: "sc-muted", children: [offer.by === null ? words.someone : personName(offer.by), " · ", _jsx(Time, { iso: offer.at, precision: "day" }), offer.takenAs !== null && offer.takenAs !== offer.name && (_jsxs(_Fragment, { children: [" · ", words.takenAs(offer.takenAs)] }))] }), _jsx(Badge, { tone: OFFER_TONES[offer.state], kind: "state", children: words.state[offer.state] })] }, offer.id))) }));
|
|
1407
|
+
}
|
|
1408
|
+
/** The way a member offers an agent account a secret (ADR-0169): its name, its value, typed unseen, and what it is for. */
|
|
1409
|
+
export function AgentSecretOfferForm(props) {
|
|
1410
|
+
const words = useWords().agents.page.offers;
|
|
1411
|
+
const [name, setName] = useState("");
|
|
1412
|
+
const [value, setValue] = useState("");
|
|
1413
|
+
const [note, setNote] = useState("");
|
|
1414
|
+
const busy = props.busy === true;
|
|
1415
|
+
const ready = isSecretName(name.trim()) && value.length > 0;
|
|
1416
|
+
const submit = (event) => {
|
|
1417
|
+
event.preventDefault();
|
|
1418
|
+
if (!ready || busy) {
|
|
1419
|
+
return;
|
|
1420
|
+
}
|
|
1421
|
+
props.onOffer({
|
|
1422
|
+
name: name.trim(),
|
|
1423
|
+
value,
|
|
1424
|
+
note: note.trim().length === 0 ? undefined : note.trim(),
|
|
1425
|
+
});
|
|
1426
|
+
setName("");
|
|
1427
|
+
setValue("");
|
|
1428
|
+
setNote("");
|
|
1429
|
+
};
|
|
1430
|
+
return (_jsxs("form", { className: "sc-form", "aria-label": words.offerAria, onSubmit: submit, children: [_jsxs("div", { className: "sc-field-row", children: [_jsxs("label", { className: "sc-field", children: [_jsx("span", { className: "sc-field-label", children: words.name }), _jsx("input", { className: "sc-input", placeholder: words.namePlaceholder, value: name, maxLength: MAX_AGENT_SECRET_NAME_LENGTH, autoComplete: "off", spellCheck: false, "aria-invalid": name.trim() !== "" && !isSecretName(name.trim()), onChange: (event) => setName(event.target.value.toLowerCase()) })] }), _jsxs("label", { className: "sc-field", children: [_jsx("span", { className: "sc-field-label", children: words.value }), _jsx("input", { className: "sc-input", type: "password", value: value, autoComplete: "new-password", onChange: (event) => setValue(event.target.value) })] })] }), _jsxs("label", { className: "sc-field", children: [_jsx("span", { className: "sc-field-label", children: words.note }), _jsx("input", { className: "sc-input", value: note, maxLength: MAX_SECRET_OFFER_NOTE_LENGTH, autoComplete: "off", onChange: (event) => setNote(event.target.value) })] }), _jsx("p", { className: "sc-field-hint", children: words.intro(props.account, SECRET_OFFER_DAYS) }), _jsx("div", { className: "sc-form-actions", children: _jsx(Button, { type: "submit", variant: "primary", disabled: busy || !ready, children: words.offer }) })] }));
|
|
1431
|
+
}
|
|
1321
1432
|
/** The names of an agent account's secrets, and the way a supervisor seeds one or removes one. Never a value. */
|
|
1322
1433
|
export function AgentSecretList(props) {
|
|
1323
1434
|
const words = useWords().agents.page.settings.secrets;
|