@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
package/src/agent-page.tsx
CHANGED
|
@@ -20,12 +20,15 @@ import {
|
|
|
20
20
|
AgentElsewhereList,
|
|
21
21
|
AgentRunnerFacts,
|
|
22
22
|
AgentSecretList,
|
|
23
|
+
AgentSecretOfferForm,
|
|
24
|
+
AgentSecretOfferList,
|
|
23
25
|
AgentSessionList,
|
|
24
26
|
AgentStateBadge,
|
|
25
27
|
AgentUsage,
|
|
26
28
|
atWorkOf,
|
|
27
29
|
ChatPane,
|
|
28
30
|
isOwnReset,
|
|
31
|
+
lacksStarter,
|
|
29
32
|
ownResetWaiting,
|
|
30
33
|
SignalComposer,
|
|
31
34
|
TalkWaiting,
|
|
@@ -63,7 +66,11 @@ import { useAction } from "./use-action.js";
|
|
|
63
66
|
const REFRESH_MS = 10_000;
|
|
64
67
|
/** How many of a session's last events the page reads first, and how many more a step back reads. */
|
|
65
68
|
const TAIL = 200;
|
|
66
|
-
/**
|
|
69
|
+
/**
|
|
70
|
+
* How many steps back the page reads, quietly, for what the conversation's foot says: the last
|
|
71
|
+
* word the agent took, and the call that started a sub-agent, where the events shown hold
|
|
72
|
+
* neither.
|
|
73
|
+
*/
|
|
67
74
|
const LOOK_BACK_STEPS = 5;
|
|
68
75
|
|
|
69
76
|
const TABS: readonly AgentTab[] = ["live", "work", "sessions", "settings"];
|
|
@@ -104,11 +111,9 @@ export function useRead<T>(
|
|
|
104
111
|
|
|
105
112
|
/** What a session's events say to whoever puts something at the conversation's foot. */
|
|
106
113
|
interface SessionRead {
|
|
114
|
+
/** The events shown, and those before them that were read back for the foot. */
|
|
107
115
|
readonly events: readonly RestTranscriptEvent[];
|
|
108
|
-
/**
|
|
109
|
-
* The number of the last signal the session's events say the agent took; nothing where the
|
|
110
|
-
* events read, and a few steps before them, say none.
|
|
111
|
-
*/
|
|
116
|
+
/** The number of the last signal these events say the agent took; nothing where they say none. */
|
|
112
117
|
readonly taken: number | undefined;
|
|
113
118
|
}
|
|
114
119
|
|
|
@@ -155,8 +160,8 @@ function SessionTranscript(props: {
|
|
|
155
160
|
const [standing, setStanding] = useState<StreamStanding>("waiting");
|
|
156
161
|
/** Whether the events before the first one shown are being read: asked for once at a time. */
|
|
157
162
|
const [readingEarlier, setReadingEarlier] = useState(false);
|
|
158
|
-
/** The
|
|
159
|
-
const [
|
|
163
|
+
/** The events before those shown that were read for the foot alone, and stand nowhere else. */
|
|
164
|
+
const [behind, setBehind] = useState<readonly RestTranscriptEvent[]>([]);
|
|
160
165
|
const ended = useRef(onEnded);
|
|
161
166
|
ended.current = onEnded;
|
|
162
167
|
const open = session.ended === null;
|
|
@@ -178,7 +183,7 @@ function SessionTranscript(props: {
|
|
|
178
183
|
setProblem(false);
|
|
179
184
|
setStanding("waiting");
|
|
180
185
|
setReadingEarlier(false);
|
|
181
|
-
|
|
186
|
+
setBehind([]);
|
|
182
187
|
// What is there is read, and what arrives is followed; a stream that closed for good, as
|
|
183
188
|
// one does while the console restarts, is opened again from the last event read.
|
|
184
189
|
return followSession({
|
|
@@ -193,37 +198,37 @@ function SessionTranscript(props: {
|
|
|
193
198
|
onEnded: () => ended.current?.(),
|
|
194
199
|
});
|
|
195
200
|
}, [client, handle, session.id]);
|
|
196
|
-
//
|
|
197
|
-
//
|
|
198
|
-
//
|
|
199
|
-
|
|
200
|
-
|
|
201
|
+
// What stands at the conversation's foot is read off what is shown and, where that does not
|
|
202
|
+
// say it, off the events before, a step at a time and a few at most: the last signal the agent
|
|
203
|
+
// took, by which the words that still wait are told, and the call that started a sub-agent
|
|
204
|
+
// (ADR-0161), which one that has worked for long has far back. None of them is shown, so that
|
|
205
|
+
// nothing moves under whoever reads, and one that could not be read is left at that.
|
|
206
|
+
const all = behind.length === 0 ? events : withEarlier(events, behind, from);
|
|
207
|
+
const taken = takenOf(all);
|
|
208
|
+
const upTo = Math.min(from, (behind[0]?.n ?? Number.POSITIVE_INFINITY) - 1);
|
|
209
|
+
const looks =
|
|
210
|
+
props.foot !== undefined &&
|
|
211
|
+
open &&
|
|
212
|
+
events.length > 0 &&
|
|
213
|
+
upTo > 0 &&
|
|
214
|
+
from - upTo < LOOK_BACK_STEPS * TAIL &&
|
|
215
|
+
(taken === undefined || lacksStarter(all));
|
|
201
216
|
useEffect(() => {
|
|
202
|
-
if (!looks
|
|
217
|
+
if (!looks) {
|
|
203
218
|
return;
|
|
204
219
|
}
|
|
205
220
|
const controller = new AbortController();
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
session.id,
|
|
213
|
-
{ after, limit: upTo - after },
|
|
214
|
-
controller.signal,
|
|
215
|
-
);
|
|
216
|
-
const found = takenOf(page.items);
|
|
217
|
-
if (found !== undefined) {
|
|
218
|
-
setBefore(found);
|
|
219
|
-
return;
|
|
221
|
+
const after = Math.max(0, upTo - TAIL);
|
|
222
|
+
client
|
|
223
|
+
.transcript(handle, session.id, { after, limit: upTo - after }, controller.signal)
|
|
224
|
+
.then((page) => {
|
|
225
|
+
if (!controller.signal.aborted) {
|
|
226
|
+
setBehind((current) => [...page.items, ...current]);
|
|
220
227
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
setBefore(0);
|
|
224
|
-
})().catch(() => undefined);
|
|
228
|
+
})
|
|
229
|
+
.catch(() => undefined);
|
|
225
230
|
return () => controller.abort();
|
|
226
|
-
}, [looks,
|
|
231
|
+
}, [looks, upTo, client, handle, session.id]);
|
|
227
232
|
const earlier = () => {
|
|
228
233
|
if (readingEarlier) {
|
|
229
234
|
return;
|
|
@@ -252,7 +257,6 @@ function SessionTranscript(props: {
|
|
|
252
257
|
}
|
|
253
258
|
});
|
|
254
259
|
};
|
|
255
|
-
const taken = known ?? (before !== undefined && before > 0 ? before : undefined);
|
|
256
260
|
return (
|
|
257
261
|
<section className="sc-agent-transcript" aria-label={words.transcript}>
|
|
258
262
|
{session.away && <Callout tone="warning">{words.away}</Callout>}
|
|
@@ -276,7 +280,7 @@ function SessionTranscript(props: {
|
|
|
276
280
|
onReadWhole={async (n) => (await client.transcriptText(handle, session.id, n)).text}
|
|
277
281
|
live={props.working ?? open}
|
|
278
282
|
empty={session.away ? null : <p className="sc-field-hint">{words.empty}</p>}
|
|
279
|
-
foot={props.foot?.({ events, taken })}
|
|
283
|
+
foot={props.foot?.({ events: all, taken })}
|
|
280
284
|
/>
|
|
281
285
|
{/* At the conversation's end, where what is new would stand and a pane that follows it looks. */}
|
|
282
286
|
{open && standing === "lost" && (
|
|
@@ -422,6 +426,9 @@ function AgentLive(props: {
|
|
|
422
426
|
const foot = (events: readonly RestTranscriptEvent[], taken: number | undefined): ReactNode => {
|
|
423
427
|
const open = session !== undefined && session.ended === null;
|
|
424
428
|
const working = open && state === "running" ? workingOf(events) : undefined;
|
|
429
|
+
// A sub-agent that goes on in the background is at work past the turn that started it
|
|
430
|
+
// (ADR-0161): read of an agent at work in an open session, a turn under way or none.
|
|
431
|
+
const agents = open && state === "running" ? atWorkOf(events, Date.now()) : undefined;
|
|
425
432
|
// Signals are taken in order: everything up to the last one the record says was taken is.
|
|
426
433
|
// Where the record says none, what the runner says is delivered counts as taken: what the
|
|
427
434
|
// product took, or the record of an earlier session says was never read (ADR-0131).
|
|
@@ -453,11 +460,7 @@ function AgentLive(props: {
|
|
|
453
460
|
: "call";
|
|
454
461
|
return (
|
|
455
462
|
<>
|
|
456
|
-
<TalkWorking
|
|
457
|
-
working={working}
|
|
458
|
-
agent={agent.person}
|
|
459
|
-
agents={working === undefined ? undefined : atWorkOf(events, Date.now())}
|
|
460
|
-
/>
|
|
463
|
+
<TalkWorking working={working} agent={agent.person} agents={agents} />
|
|
461
464
|
<TalkWaiting
|
|
462
465
|
signals={waiting}
|
|
463
466
|
why={why}
|
|
@@ -678,6 +681,68 @@ function AgentSessions(props: {
|
|
|
678
681
|
);
|
|
679
682
|
}
|
|
680
683
|
|
|
684
|
+
/** How many offers that no longer wait a member is shown of their own, beside those that wait. */
|
|
685
|
+
const OFFERS_SHOWN_AFTER = 3;
|
|
686
|
+
|
|
687
|
+
/**
|
|
688
|
+
* Under an agent's plate, for whoever sees the account and supervises it not (ADR-0169): the
|
|
689
|
+
* way to offer it a secret, and how their own offers stand. For the account itself, what it was
|
|
690
|
+
* offered that waits, which it takes or leaves with its command.
|
|
691
|
+
*/
|
|
692
|
+
function AgentOffers(props: {
|
|
693
|
+
readonly client: ConsoleClient;
|
|
694
|
+
readonly agent: RestAgent;
|
|
695
|
+
readonly handle: string;
|
|
696
|
+
/** Whether the page is the account's own. */
|
|
697
|
+
readonly own: boolean;
|
|
698
|
+
}) {
|
|
699
|
+
const words = useWords().agents.page.offers;
|
|
700
|
+
const { client, agent, handle, own } = props;
|
|
701
|
+
const { busy, error, act } = useAction();
|
|
702
|
+
const read = useCallback(
|
|
703
|
+
(signal: AbortSignal) =>
|
|
704
|
+
own ? client.secretOffers(signal) : client.agentSecretOffers(handle, signal),
|
|
705
|
+
[client, handle, own],
|
|
706
|
+
);
|
|
707
|
+
const found = useRead(read);
|
|
708
|
+
const all = found.value?.items ?? [];
|
|
709
|
+
const waiting = all.filter((offer) => offer.state === "waiting");
|
|
710
|
+
const shown = own
|
|
711
|
+
? waiting
|
|
712
|
+
: [
|
|
713
|
+
...waiting,
|
|
714
|
+
...all.filter((offer) => offer.state !== "waiting").slice(0, OFFERS_SHOWN_AFTER),
|
|
715
|
+
];
|
|
716
|
+
if (own && shown.length === 0) {
|
|
717
|
+
return null;
|
|
718
|
+
}
|
|
719
|
+
return (
|
|
720
|
+
<section className="sc-panel" aria-label={own ? words.title : words.offerTitle}>
|
|
721
|
+
<h2 className="sc-section-title">{own ? words.title : words.offerTitle}</h2>
|
|
722
|
+
{error !== undefined && <Callout tone="danger">{error}</Callout>}
|
|
723
|
+
{shown.length > 0 && <AgentSecretOfferList offers={shown} />}
|
|
724
|
+
{own ? (
|
|
725
|
+
<p className="sc-field-hint">{words.own}</p>
|
|
726
|
+
) : (
|
|
727
|
+
<AgentSecretOfferForm
|
|
728
|
+
account={personName(agent.person)}
|
|
729
|
+
busy={busy}
|
|
730
|
+
onOffer={(offer) =>
|
|
731
|
+
void act(async () => {
|
|
732
|
+
await client.offerAgentSecret(handle, {
|
|
733
|
+
name: offer.name,
|
|
734
|
+
value: offer.value,
|
|
735
|
+
...(offer.note === undefined ? {} : { note: offer.note }),
|
|
736
|
+
});
|
|
737
|
+
found.again();
|
|
738
|
+
})
|
|
739
|
+
}
|
|
740
|
+
/>
|
|
741
|
+
)}
|
|
742
|
+
</section>
|
|
743
|
+
);
|
|
744
|
+
}
|
|
745
|
+
|
|
681
746
|
/** What is kept of the agent: its runner, where it is signed in, what it runs with, its secrets by name, its persona. */
|
|
682
747
|
function AgentSettings(props: {
|
|
683
748
|
readonly client: ConsoleClient;
|
|
@@ -698,6 +763,13 @@ function AgentSettings(props: {
|
|
|
698
763
|
[client, handle],
|
|
699
764
|
);
|
|
700
765
|
const secrets = useRead(readSecrets);
|
|
766
|
+
const readOffers = useCallback(
|
|
767
|
+
(signal: AbortSignal) => client.agentSecretOffers(handle, signal),
|
|
768
|
+
[client, handle],
|
|
769
|
+
);
|
|
770
|
+
const offers = useRead(readOffers);
|
|
771
|
+
/** What members offered the account that it has neither taken nor left (ADR-0169). */
|
|
772
|
+
const offered = (offers.value?.items ?? []).filter((offer) => offer.state === "waiting");
|
|
701
773
|
const readSignIns = useCallback(
|
|
702
774
|
(signal: AbortSignal) =>
|
|
703
775
|
viaToken ? Promise.resolve(undefined) : client.agentSignIns(handle, signal),
|
|
@@ -893,6 +965,13 @@ function AgentSettings(props: {
|
|
|
893
965
|
}
|
|
894
966
|
/>
|
|
895
967
|
</section>
|
|
968
|
+
{offered.length > 0 && (
|
|
969
|
+
<section className="sc-panel" aria-label={page.offers.title}>
|
|
970
|
+
<h2 className="sc-section-title">{page.offers.title}</h2>
|
|
971
|
+
<AgentSecretOfferList offers={offered} />
|
|
972
|
+
<p className="sc-field-hint">{page.offers.waits(personName(agent.person))}</p>
|
|
973
|
+
</section>
|
|
974
|
+
)}
|
|
896
975
|
</div>
|
|
897
976
|
</div>
|
|
898
977
|
);
|
|
@@ -909,6 +988,8 @@ export interface AgentPageProps {
|
|
|
909
988
|
readonly providers?: readonly RestProvider[] | undefined;
|
|
910
989
|
/** The agent's plate, which the console draws as it draws a person's. */
|
|
911
990
|
readonly work: (agent: RestAgent) => ReactNode;
|
|
991
|
+
/** The member who looks at the page, by their id: the account itself is offered no secret of its own. */
|
|
992
|
+
readonly me?: string | undefined;
|
|
912
993
|
}
|
|
913
994
|
|
|
914
995
|
/**
|
|
@@ -1006,7 +1087,18 @@ export function AgentPage(props: AgentPageProps) {
|
|
|
1006
1087
|
</nav>
|
|
1007
1088
|
)}
|
|
1008
1089
|
{view === "work" ? (
|
|
1009
|
-
|
|
1090
|
+
<>
|
|
1091
|
+
{props.work(agent)}
|
|
1092
|
+
{/* A supervisor seeds a secret among what is kept of the agent; anyone else offers one. */}
|
|
1093
|
+
{!agent.supervised && props.me !== undefined && (
|
|
1094
|
+
<AgentOffers
|
|
1095
|
+
client={client}
|
|
1096
|
+
agent={agent}
|
|
1097
|
+
handle={handle}
|
|
1098
|
+
own={props.me === person.id}
|
|
1099
|
+
/>
|
|
1100
|
+
)}
|
|
1101
|
+
</>
|
|
1010
1102
|
) : view === "closed" ? (
|
|
1011
1103
|
<EmptyState title={words.notSupervised.title} body={words.notSupervised.body} />
|
|
1012
1104
|
) : view === "live" ? (
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { RestAgentState } from "./schemas.js";
|
|
2
|
+
|
|
3
|
+
// How an agent account stands (ADR-0085), as the pages and the command read it: the state has
|
|
4
|
+
// a moment, since when it stands, and the reason may have another, when it was said. A reason
|
|
5
|
+
// changes under a state that stays, a turn completes or a new conversation begins while the
|
|
6
|
+
// agent runs on, so the one is never shown as the other's.
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* How far apart the two moments are before the reason's is shown beside it: a reason said
|
|
10
|
+
* within a minute of its state is the state's own, and the pages show a moment to the minute.
|
|
11
|
+
* The runner's clock and the console's are two machines', a few seconds apart.
|
|
12
|
+
*/
|
|
13
|
+
const OWN_MOMENT_MS = 60_000;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* When the reason was said, where that is a moment of its own to show beside it: one the
|
|
17
|
+
* console keeps, and another than the state's. A reason that came with its state is of the
|
|
18
|
+
* state's moment, which stands with the state; one of before the console kept such a moment
|
|
19
|
+
* has none. Either is shown without one, and never beside the state's as if it were its own.
|
|
20
|
+
*/
|
|
21
|
+
export function reasonMoment(
|
|
22
|
+
state: Pick<RestAgentState, "since" | "reasonAt">,
|
|
23
|
+
): string | undefined {
|
|
24
|
+
const at = state.reasonAt ?? undefined;
|
|
25
|
+
if (at === undefined) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
const said = Date.parse(at);
|
|
29
|
+
const since = Date.parse(state.since);
|
|
30
|
+
return Number.isNaN(said) || Number.isNaN(since) || Math.abs(said - since) < OWN_MOMENT_MS
|
|
31
|
+
? undefined
|
|
32
|
+
: at;
|
|
33
|
+
}
|
package/src/agent-usage.ts
CHANGED
|
@@ -21,22 +21,65 @@ export interface UsageReading {
|
|
|
21
21
|
*/
|
|
22
22
|
export const USAGE_KEPT_MS = 8 * 24 * 60 * 60 * 1000;
|
|
23
23
|
|
|
24
|
+
/** How many minutes a window lasts, by the word its driver names it with: none where the word says none. */
|
|
25
|
+
const MINUTES: Readonly<Record<string, number>> = { minute: 1, hour: 60, day: 24 * 60 };
|
|
26
|
+
const LASTS = /^([0-9]{1,6})-(minute|hour|day)$/;
|
|
27
|
+
function minutesOf(word: string): number | undefined {
|
|
28
|
+
if (word === "weekly") {
|
|
29
|
+
return 7 * 24 * 60;
|
|
30
|
+
}
|
|
31
|
+
const [, count, unit] = LASTS.exec(word) ?? [];
|
|
32
|
+
return count === undefined || unit === undefined
|
|
33
|
+
? undefined
|
|
34
|
+
: Number(count) * (MINUTES[unit] ?? 1);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Where a window stands among the others, by its name: the plan's own first, the shortest of
|
|
39
|
+
* them before the longer; then the windows of a part of the allowance (`weekly fable`), the
|
|
40
|
+
* shortest first as well; then any other.
|
|
41
|
+
*/
|
|
42
|
+
function placeOf(name: string): { readonly group: number; readonly minutes: number } {
|
|
43
|
+
const space = name.indexOf(" ");
|
|
44
|
+
const minutes = minutesOf(space < 0 ? name : name.slice(0, space));
|
|
45
|
+
return minutes === undefined ? { group: 2, minutes: 0 } : { group: space < 0 ? 0 : 1, minutes };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Two windows in the order they are shown in, which their names alone decide. */
|
|
49
|
+
interface Named {
|
|
50
|
+
readonly name?: string | undefined;
|
|
51
|
+
}
|
|
52
|
+
function inOrder({ name: a = "" }: Named, { name: b = "" }: Named): number {
|
|
53
|
+
const [first, second] = [placeOf(a), placeOf(b)];
|
|
54
|
+
return (
|
|
55
|
+
first.group - second.group || first.minutes - second.minutes || (a < b ? -1 : a > b ? 1 : 0)
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
24
59
|
/**
|
|
25
|
-
* The windows that still stand at a moment. One whose reset has
|
|
26
|
-
* window after it, and an account whose runner is away keeps what it
|
|
27
|
-
* is left out, so that no page shows a share of a window that is over.
|
|
28
|
-
* reset is left out once it was said longer ago than any window lasts
|
|
29
|
-
* Which windows there are is the product's to say, and nothing here expects
|
|
30
|
-
* no short window shows the week alone.
|
|
60
|
+
* The windows that still stand at a moment, in the order they are shown in. One whose reset has
|
|
61
|
+
* passed says nothing of the window after it, and an account whose runner is away keeps what it
|
|
62
|
+
* last said: such a window is left out, so that no page shows a share of a window that is over.
|
|
63
|
+
* One that names no reset is left out once it was said longer ago than any window lasts
|
|
64
|
+
* (`USAGE_KEPT_MS`). Which windows there are is the product's to say, and nothing here expects
|
|
65
|
+
* one: a plan with no short window shows the week alone. Their order is by their names, the
|
|
66
|
+
* short window, the week, then the week of a model: a product says a window at a time, and one
|
|
67
|
+
* that reset is said again after those that did not.
|
|
31
68
|
*/
|
|
32
69
|
export function usageStanding<
|
|
33
|
-
T extends {
|
|
70
|
+
T extends {
|
|
71
|
+
readonly name?: string | undefined;
|
|
72
|
+
readonly resetsAt: string | null;
|
|
73
|
+
readonly at?: string | undefined;
|
|
74
|
+
},
|
|
34
75
|
>(usage: readonly T[] | null | undefined, now: number): readonly T[] {
|
|
35
|
-
return (usage ?? [])
|
|
36
|
-
window
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
76
|
+
return (usage ?? [])
|
|
77
|
+
.filter((window) =>
|
|
78
|
+
window.resetsAt === null
|
|
79
|
+
? !(window.at !== undefined && now - Date.parse(window.at) > USAGE_KEPT_MS)
|
|
80
|
+
: !(Date.parse(window.resetsAt) <= now),
|
|
81
|
+
)
|
|
82
|
+
.sort(inOrder);
|
|
40
83
|
}
|
|
41
84
|
|
|
42
85
|
/** How far apart two windows may have been said and still be said together: one answer of the product. */
|
package/src/api.ts
CHANGED
|
@@ -180,6 +180,10 @@ export {
|
|
|
180
180
|
MAX_SEAL_REASON_LENGTH,
|
|
181
181
|
MAX_SEARCH_LENGTH,
|
|
182
182
|
MAX_SECRET_LENGTH,
|
|
183
|
+
MAX_SECRET_OFFER_NOTE_LENGTH,
|
|
184
|
+
MAX_SECRET_OFFERS_BY_ONE,
|
|
185
|
+
MAX_SECRET_OFFERS_KEPT,
|
|
186
|
+
MAX_SECRET_OFFERS_WAITING,
|
|
183
187
|
MAX_SERVICE_PARAMETERS,
|
|
184
188
|
MAX_SERVICE_VALUE_LENGTH,
|
|
185
189
|
MAX_SESSIONS_PAGE_LIMIT,
|
|
@@ -216,6 +220,7 @@ export {
|
|
|
216
220
|
MIN_HANDLE_LENGTH,
|
|
217
221
|
MIN_OPTIONS,
|
|
218
222
|
OWN_WAKE_KEY,
|
|
223
|
+
SECRET_OFFER_DAYS,
|
|
219
224
|
SESSIONS_PAGE_LIMIT,
|
|
220
225
|
SIGNALS_PAGE_LIMIT,
|
|
221
226
|
TRANSCRIPT_INLINE_BYTES,
|
|
@@ -362,6 +367,7 @@ export {
|
|
|
362
367
|
isHandle,
|
|
363
368
|
isLoginAt,
|
|
364
369
|
isSecretName,
|
|
370
|
+
MAX_WRITERS_ASKED,
|
|
365
371
|
OPTION_KEY_PATTERN,
|
|
366
372
|
RESERVED_HANDLES,
|
|
367
373
|
type RestAgent,
|
|
@@ -380,6 +386,10 @@ export {
|
|
|
380
386
|
type RestAgentSecretAccess,
|
|
381
387
|
type RestAgentSecretAccesses,
|
|
382
388
|
type RestAgentSecretInput,
|
|
389
|
+
type RestAgentSecretOffer,
|
|
390
|
+
type RestAgentSecretOfferInput,
|
|
391
|
+
type RestAgentSecretOffers,
|
|
392
|
+
type RestAgentSecretOfferTakeInput,
|
|
383
393
|
type RestAgentSecrets,
|
|
384
394
|
type RestAgentSecretValue,
|
|
385
395
|
type RestAgentSession,
|
|
@@ -542,6 +552,9 @@ export {
|
|
|
542
552
|
type RestWorkspacePatch,
|
|
543
553
|
type RestWorkspaceService,
|
|
544
554
|
type RestWorkspaceServices,
|
|
555
|
+
type RestWriter,
|
|
556
|
+
type RestWriters,
|
|
557
|
+
type RestWritersInput,
|
|
545
558
|
reportCountOf,
|
|
546
559
|
restAgentChoiceSchema,
|
|
547
560
|
restAgentElsewhereSchema,
|
|
@@ -558,6 +571,10 @@ export {
|
|
|
558
571
|
restAgentSecretAccessesSchema,
|
|
559
572
|
restAgentSecretAccessSchema,
|
|
560
573
|
restAgentSecretInputSchema,
|
|
574
|
+
restAgentSecretOfferInputSchema,
|
|
575
|
+
restAgentSecretOfferSchema,
|
|
576
|
+
restAgentSecretOffersSchema,
|
|
577
|
+
restAgentSecretOfferTakeInputSchema,
|
|
561
578
|
restAgentSecretSchema,
|
|
562
579
|
restAgentSecretsSchema,
|
|
563
580
|
restAgentSecretValueSchema,
|
|
@@ -721,6 +738,9 @@ export {
|
|
|
721
738
|
restWorkspaceSchema,
|
|
722
739
|
restWorkspaceServiceSchema,
|
|
723
740
|
restWorkspaceServicesSchema,
|
|
741
|
+
restWriterSchema,
|
|
742
|
+
restWritersInputSchema,
|
|
743
|
+
restWritersSchema,
|
|
724
744
|
type ServiceProblem,
|
|
725
745
|
serviceProblem,
|
|
726
746
|
serviceProblemOf,
|
|
@@ -810,10 +830,12 @@ export {
|
|
|
810
830
|
type RunEnding,
|
|
811
831
|
type RunStatus,
|
|
812
832
|
SECRET_ACCESSES,
|
|
833
|
+
SECRET_OFFER_STATES,
|
|
813
834
|
SERVICE_ROLES,
|
|
814
835
|
SESSION_ENDS,
|
|
815
836
|
SESSION_KINDS,
|
|
816
837
|
type SecretAccess,
|
|
838
|
+
type SecretOfferState,
|
|
817
839
|
type ServiceRole,
|
|
818
840
|
type SessionEnd,
|
|
819
841
|
type SessionKind,
|
|
@@ -836,3 +858,4 @@ export {
|
|
|
836
858
|
WEEK_STARTS,
|
|
837
859
|
type WeekStart,
|
|
838
860
|
} from "./vocabulary.js";
|
|
861
|
+
export { BOARD_PARTS_FROM, type WakePart, wakePartsOf, wakeTextOf } from "./wake-text.js";
|