@rarog/server 1.1.0 → 1.1.2-beta.1
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/node_modules/@rarog/shared/package.json +1 -1
- package/node_modules/@rarog/shared/src/decode.js +3 -0
- package/node_modules/@rarog/shared/src/notify-copy.js +1 -0
- package/node_modules/@rarog/shared/src/protocol/background.js +7 -0
- package/node_modules/@rarog/shared/src/sentences/dialogs.js +10 -0
- package/node_modules/@rarog/shared/src/sentences/push.js +3 -0
- package/package.json +2 -2
- package/server/src/bootstrap/pr-status.js +15 -7
- package/server/src/bootstrap/push.js +36 -5
- package/server/src/cli/doctor-pr-status.js +10 -6
- package/server/src/cli/update-registry.js +31 -1
- package/server/src/cli/update.js +128 -6
- package/server/src/demo/control.js +4 -2
- package/server/src/demo/mock-herdr.js +2 -2
- package/server/src/demo/scenarios.js +31 -17
- package/server/src/demo/seeds.js +62 -38
- package/server/src/drivers/herdr/pull-request-poll.js +5 -5
- package/server/src/drivers/herdr/queue-take-back.js +4 -0
- package/server/src/drivers/herdr/start-dialog-gate.js +132 -0
- package/server/src/drivers/herdr-driver.js +75 -15
- package/server/src/herdr/background/cli-shapes.js +16 -15
- package/server/src/herdr/background/index.js +7 -7
- package/server/src/herdr/background/merge.js +17 -5
- package/server/src/herdr/background/notification.js +0 -4
- package/server/src/herdr/background/pull-request-files.js +53 -161
- package/server/src/herdr/background/pull-requests.js +54 -632
- package/server/src/herdr/background/work.js +84 -0
- package/server/src/herdr/dialogs/copy.js +7 -0
- package/server/src/herdr/dialogs/index.js +4 -1
- package/server/src/herdr/dialogs/screen/form.js +2 -1
- package/server/src/herdr/dialogs/screen/option-run.js +25 -3
- package/server/src/herdr/dialogs/screen/parse.js +3 -3
- package/server/src/herdr/dialogs/screen/signatures.js +55 -0
- package/server/src/herdr/dialogs/screen/start-dialog.js +72 -0
- package/server/src/herdr/dialogs/screen/trust-arrow.js +46 -9
- package/server/src/herdr/jsonl-follow.js +6 -2
- package/server/src/herdr/label-code.js +104 -0
- package/server/src/herdr/label-migration.js +142 -0
- package/server/src/herdr/launcher.js +30 -5
- package/server/src/herdr/provenance.js +80 -40
- package/server/src/herdr/start-dialog-wait.js +96 -0
- package/server/src/herdr/supervisor.js +33 -10
- package/server/src/herdr/workspace-resolver.js +5 -4
- package/server/src/index.js +8 -3
- package/server/src/notify/apns-payload.js +5 -3
- package/server/src/notify/content.js +37 -0
- package/server/src/notify/index.js +4 -0
- package/server/src/notify/live-activity-state.js +9 -5
- package/server/src/notify/live-activity.js +5 -2
- package/server/src/notify/policy.js +4 -2
- package/server/src/notify/stalled-wait.js +213 -0
- package/server/src/pr-status/facts.js +87 -0
- package/server/src/pr-status/gh.js +76 -9
- package/server/src/pr-status/index.js +1 -10
- package/server/src/pr-status/source.js +20 -6
- package/server/src/pr-status/tracker.js +32 -9
- package/server/src/sessions/conversation-lists.js +8 -2
- package/server/src/sessions/driver-events.js +7 -3
- package/server/src/sessions/interrupt-windows.js +28 -4
- package/server/src/sessions/manager.js +14 -5
- package/server/src/sessions/pr-status-link.js +64 -16
- package/server/src/sessions/session.js +10 -3
- package/server/src/sessions/state-machine.js +11 -0
- package/server/src/sessions/test-session.js +50 -0
- package/server/src/term/herdr-backend.js +15 -12
- package/server/src/term/lifecycle.js +4 -6
|
@@ -59,6 +59,8 @@ export const DEGRADATIONS = {
|
|
|
59
59
|
'activity.kind': undefined,
|
|
60
60
|
'waitingFor.kind': undefined,
|
|
61
61
|
'backgroundTasks.kind': UNSUPPORTED,
|
|
62
|
+
/** `BackgroundTask.ownCommandWait`: an unknown stage drops the field, so the task reads as without a known wait. */
|
|
63
|
+
'backgroundTasks.ownCommandWait': undefined,
|
|
62
64
|
/** Notka systemowa — nie udaje ani człowieka, ani agenta. */
|
|
63
65
|
'message.role': 'system',
|
|
64
66
|
/** Blok zastępczy `{ type: 'unsupported' }`; reszta pól nieznanego bloku jest odcinana. */
|
|
@@ -205,6 +207,7 @@ function buildSchemas(raw) {
|
|
|
205
207
|
activity: activity.optional(),
|
|
206
208
|
backgroundTasks: z.array(backgroundTaskSchema.extend({
|
|
207
209
|
kind: lenient(backgroundTaskSchema.shape.kind, UNSUPPORTED),
|
|
210
|
+
ownCommandWait: lenientOpt(backgroundTaskSchema.shape.ownCommandWait, undefined),
|
|
208
211
|
})).optional(),
|
|
209
212
|
waitingFor: waitingFor.optional(),
|
|
210
213
|
pullRequests: z.array(sessionPullRequestSchema.extend({
|
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
* Re-exported unchanged by `shared/src/protocol.ts`; code imports the names from there.
|
|
6
6
|
*/
|
|
7
7
|
import { z } from 'zod';
|
|
8
|
+
/**
|
|
9
|
+
* How long a subagent in standby has waited on its own background command (`BackgroundTask.ownCommandWait`), on the
|
|
10
|
+
* server clock from `waitingSince`: `short` below 30 minutes, `long` from 30, `stuck` from 60
|
|
11
|
+
* (`docs/subagent-long-wait.md`). Wire values; a new meaning is a new value.
|
|
12
|
+
*/
|
|
13
|
+
export const OWN_COMMAND_WAITS = ['short', 'long', 'stuck'];
|
|
8
14
|
/**
|
|
9
15
|
* PR state on GitHub (`SessionPullRequest.state`): the wire values, lowercase. `draft` is an open PR marked as a draft
|
|
10
16
|
* on GitHub; only an open PR can be one.
|
|
@@ -41,6 +47,7 @@ export const backgroundTaskSchema = z.object({
|
|
|
41
47
|
// nieznane klucze, więc bez tych linii klient parsujący tym schematem by ich nie zobaczył.
|
|
42
48
|
waitingSince: z.string().optional(),
|
|
43
49
|
ownTasks: z.array(agentOwnTaskSchema).optional(),
|
|
50
|
+
ownCommandWait: z.enum(OWN_COMMAND_WAITS).optional(),
|
|
44
51
|
});
|
|
45
52
|
const _agentOwnTaskSchemaMatchesType = true;
|
|
46
53
|
const _agentOwnTaskTypeMatchesSchema = true;
|
|
@@ -88,6 +88,16 @@ export const DIALOGS_SENTENCES = {
|
|
|
88
88
|
'dialogs.stale-decision': {
|
|
89
89
|
en: "⚠ The answer didn't go through: the dialog in the terminal changed in the meantime. Tap again on the new card. Rarog sent no key.",
|
|
90
90
|
},
|
|
91
|
+
'dialogs.start-dialog.imports': {
|
|
92
|
+
en: 'Claude Code asks in the terminal whether to allow external imports in the instruction files of this project. ' +
|
|
93
|
+
'Answer it in the terminal: Claude Code keeps the answer for this project for good. Rarog sends no key to it.',
|
|
94
|
+
},
|
|
95
|
+
'dialogs.start-dialog.refused': {
|
|
96
|
+
en: '⚠ A Claude Code start dialog stands in the terminal. Rarog sent no key and no text. Answer it in the terminal.',
|
|
97
|
+
},
|
|
98
|
+
'dialogs.start-dialog.unknown': {
|
|
99
|
+
en: "Claude Code stands on a start dialog Rarog doesn't know. Answer it in the terminal; Rarog sends no key to it.",
|
|
100
|
+
},
|
|
91
101
|
'dialogs.submit-abort.not-a-form': { en: 'the screen no longer shows a question form' },
|
|
92
102
|
'dialogs.submit-abort.notes-editing': {
|
|
93
103
|
en: 'the form is in note-editing mode (the digit may have been typed as text; check the field)',
|
|
@@ -12,6 +12,8 @@ export const PUSH_SENTENCES = {
|
|
|
12
12
|
'push.body.fallback.limit': { en: 'Open to see when to try again.' },
|
|
13
13
|
'push.body.fallback.permission': { en: 'Open to decide.' },
|
|
14
14
|
'push.body.fallback.question': { en: 'The agent asked a question. Answer in Rarog.' },
|
|
15
|
+
'push.body.fallback.stalled': { en: 'A subagent is waiting on its own command.' },
|
|
16
|
+
'push.detail.stalled': { en: 'Subagent "{agent}" is waiting on its own command.', args: ['agent:text'] },
|
|
15
17
|
'push.body.label': { en: '{label}', args: ['label:text'] },
|
|
16
18
|
'push.paired-body.mac': {
|
|
17
19
|
en: "{label}. If this wasn't you, revoke it on the Mac: rarog devices",
|
|
@@ -30,6 +32,7 @@ export const PUSH_SENTENCES = {
|
|
|
30
32
|
'push.title.limit': { en: '✋ Plan limit · {project}', args: ['project:text'] },
|
|
31
33
|
'push.title.permission': { en: '⏳ Waiting for permission · {project}', args: ['project:text'] },
|
|
32
34
|
'push.title.question': { en: '❓ Question · {project}', args: ['project:text'] },
|
|
35
|
+
'push.title.stalled': { en: '⏰ Waiting over 1 h · {project}', args: ['project:text'] },
|
|
33
36
|
'push.version-title': { en: '🔄 Version changed' },
|
|
34
37
|
'push.version-body.claude-code': { en: 'Claude Code {from} → {to}', args: ['from:text', 'to:text'] },
|
|
35
38
|
'push.version-body.herdr': { en: 'herdr {from} → {to}', args: ['from:text', 'to:text'] },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rarog/server",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2-beta.1",
|
|
4
4
|
"description": "Rarog is a free, open-source (MIT) iPhone and iPad app, plus a server on your Mac or Linux machine, that shows the Claude Code sessions running in Herdr TUI and lets you drive them.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude-code",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@number0/iroh": "1.2.0",
|
|
37
|
-
"@rarog/shared": "1.1.
|
|
37
|
+
"@rarog/shared": "1.1.2-beta.1",
|
|
38
38
|
"qrcode": "1.5.4",
|
|
39
39
|
"ws": "8.21.3",
|
|
40
40
|
"zod": "4.4.3"
|
|
@@ -2,21 +2,25 @@ import { createFixedPrStateSource, createGhSource, createPrStatusTracker } from
|
|
|
2
2
|
/** Tracker and port over a source; the change callback goes to the listener the manager registers. */
|
|
3
3
|
export function createPrStatusLink(opts) {
|
|
4
4
|
let listener = null;
|
|
5
|
-
const tracker = createPrStatusTracker({ ...opts, onChange: (
|
|
5
|
+
const tracker = createPrStatusTracker({ ...opts, onChange: (change) => { listener?.(change); } });
|
|
6
6
|
return {
|
|
7
7
|
tracker,
|
|
8
8
|
port: {
|
|
9
9
|
stateOf: (url) => tracker.stateOf(url),
|
|
10
|
+
factsOf: (url) => tracker.factsOf(url),
|
|
11
|
+
viewerLogin: () => tracker.viewerLogin(),
|
|
10
12
|
setSessionUrls: (sessionId, urls) => { tracker.setSessionUrls(sessionId, urls); },
|
|
13
|
+
setSessionLinks: (sessionId, urls) => { tracker.setSessionLinks(sessionId, urls); },
|
|
11
14
|
dropSession: (sessionId) => { tracker.dropSession(sessionId); },
|
|
12
15
|
listen: (onChange) => { listener = onChange; },
|
|
13
16
|
},
|
|
14
17
|
};
|
|
15
18
|
}
|
|
16
19
|
/**
|
|
17
|
-
* The PR status of this process, or `null` when `RAROG_PR_STATUS=0`. The demo source is
|
|
18
|
-
* content set (`demoContent`, `null` outside the demo
|
|
19
|
-
*
|
|
20
|
+
* The PR status of this process, or `null` when `RAROG_PR_STATUS=0`. The demo source is the fixed GitHub of the
|
|
21
|
+
* active content set (`demoContent`, `null` outside the demo; states, titles, authors, the demo login) read without
|
|
22
|
+
* delay and without a connected client, so a demo list gets its facts and state at once; it is loaded lazily, like
|
|
23
|
+
* the rest of the demo content.
|
|
20
24
|
*/
|
|
21
25
|
export async function createPrStatus(config, log, demoContent, deps = {}) {
|
|
22
26
|
if (!config.prStatusEnabled)
|
|
@@ -25,10 +29,14 @@ export async function createPrStatus(config, log, demoContent, deps = {}) {
|
|
|
25
29
|
if (config.demo) {
|
|
26
30
|
if (demoContent === null)
|
|
27
31
|
throw new Error('createPrStatus: demo mode requires demoContent');
|
|
28
|
-
const {
|
|
29
|
-
|
|
30
|
-
source: createFixedPrStateSource(
|
|
32
|
+
const { demoGitHub } = await import('../demo/seeds.js');
|
|
33
|
+
const link = createPrStatusLink({
|
|
34
|
+
source: createFixedPrStateSource(demoGitHub(demoContent)), log: logLine, newUrlDelayMs: 0,
|
|
31
35
|
});
|
|
36
|
+
// The fixed map starts no process: it is read whatever the client count, so a scenario created before the app
|
|
37
|
+
// connects has its list at once.
|
|
38
|
+
link.tracker.setClientConnected(true);
|
|
39
|
+
return { ...link, tracker: { ...link.tracker, setClientConnected: () => undefined } };
|
|
32
40
|
}
|
|
33
41
|
const ghSource = deps.ghSource ?? createGhSource;
|
|
34
42
|
return createPrStatusLink({ source: ghSource({ env: { ...config.prStatusEnvBase } }), log: logLine });
|
|
@@ -2,8 +2,26 @@ import { createApnsChannel } from '../notify/apns-channel.js';
|
|
|
2
2
|
import { createFanoutSink } from '../notify/fanout.js';
|
|
3
3
|
import { Notifier, sessionLook } from '../notify/index.js';
|
|
4
4
|
import { Presence } from '../notify/presence.js';
|
|
5
|
+
import { createStalledWaitAlert } from '../notify/stalled-wait.js';
|
|
6
|
+
import { inTemporaryDirectory } from '../sessions/test-session.js';
|
|
5
7
|
/** Start log phrase when `RAROG_PUSH_RELAY_URL` has a bad value (`docs/server-config.md`). */
|
|
6
8
|
export const PUSH_RELAY_DISABLED_LOG = 'push: push relay off';
|
|
9
|
+
/**
|
|
10
|
+
* The stalled wait alarm behind the manager's listener: the session facts of the push (`title`, `label`, `termId`) and
|
|
11
|
+
* the test session rule (`inTemporaryDirectory(cwd)`) come from the session at every list swap.
|
|
12
|
+
*/
|
|
13
|
+
export function stalledWaitListener(alert, testSession = inTemporaryDirectory) {
|
|
14
|
+
return {
|
|
15
|
+
stuckWaits: (session, waits) => {
|
|
16
|
+
alert.update({
|
|
17
|
+
sessionId: session.id, project: session.title, testSession: testSession(session.cwd),
|
|
18
|
+
...(session.label === undefined ? {} : { label: session.label }),
|
|
19
|
+
...(session.termId === undefined ? {} : { termId: session.termId }),
|
|
20
|
+
}, waits);
|
|
21
|
+
},
|
|
22
|
+
forget: (sessionId) => { alert.forget(sessionId); },
|
|
23
|
+
};
|
|
24
|
+
}
|
|
7
25
|
export function createPush(config, deps) {
|
|
8
26
|
const { managerRef, devices, macStats, log } = deps;
|
|
9
27
|
/*
|
|
@@ -44,6 +62,10 @@ export function createPush(config, deps) {
|
|
|
44
62
|
// Klucze push urządzeń i filtr tokenów odpiętych: magazyn `devices.json` powstał wcześniej.
|
|
45
63
|
pairedDevices: devices,
|
|
46
64
|
});
|
|
65
|
+
// Plakietka na ikonie = sesje, które STOJĄ i czekają na człowieka (`waiting-permission`
|
|
66
|
+
// i `waiting-question`). Liczona w chwili WYSYŁKI.
|
|
67
|
+
const badge = () => (managerRef()?.list() ?? [])
|
|
68
|
+
.filter((s) => s.state === 'waiting-permission' || s.state === 'waiting-question').length;
|
|
47
69
|
/*
|
|
48
70
|
* Harmonogram powstaje WYŁĄCZNIE z kanałem APNs — to jedyny kanał zdolny wysłać baner. Bez
|
|
49
71
|
* niego nie ma też obecności w routerze (`main()`), więc `POST /api/presence` jest no-opem.
|
|
@@ -55,12 +77,13 @@ export function createPush(config, deps) {
|
|
|
55
77
|
// Dźwięk „skończył” z kafla Live Activity: zlecany przy wysłanym „gotowe”.
|
|
56
78
|
sink: createFanoutSink({ apns: apns.sink, chime: () => apns.liveActivity.chime() }),
|
|
57
79
|
look: (id) => sessionLook(managerRef()?.get(id)),
|
|
58
|
-
|
|
59
|
-
// i `waiting-question`). Liczona w chwili WYSYŁKI.
|
|
60
|
-
badge: () => (managerRef()?.list() ?? [])
|
|
61
|
-
.filter((s) => s.state === 'waiting-permission' || s.state === 'waiting-question').length,
|
|
80
|
+
badge,
|
|
62
81
|
})
|
|
63
82
|
: null;
|
|
83
|
+
// The stalled wait alarm sends through the same sink, next to the scheduler and never through it.
|
|
84
|
+
const alert = apns === undefined ? undefined : createStalledWaitAlert({
|
|
85
|
+
send: (content) => apns.sink.send(content), presence, badge, log: (line) => { log.info(line); },
|
|
86
|
+
});
|
|
64
87
|
if (notifier !== null && apns !== undefined) {
|
|
65
88
|
// Powrót do Raroga kasuje czekające banery i dźwięki kafla, które jeszcze nie wyszły.
|
|
66
89
|
const liveActivity = apns.liveActivity;
|
|
@@ -84,5 +107,13 @@ export function createPush(config, deps) {
|
|
|
84
107
|
// Przepustki dla wpisów, które ich nie mają albo którym kończy się termin; bez przekaźnika — nic.
|
|
85
108
|
apns.passes?.start();
|
|
86
109
|
}
|
|
87
|
-
return {
|
|
110
|
+
return {
|
|
111
|
+
presence, apns, notifier,
|
|
112
|
+
stalledWait: alert === undefined ? undefined : stalledWaitListener(alert),
|
|
113
|
+
close: () => {
|
|
114
|
+
// The alarm only stops its timers (nothing to wait for), so the channel starts closing at once, as before.
|
|
115
|
+
void alert?.close();
|
|
116
|
+
return apns?.close() ?? Promise.resolve();
|
|
117
|
+
},
|
|
118
|
+
};
|
|
88
119
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `rarog doctor`: the PR status line (`docs/pull-requests.md`).
|
|
3
|
-
*
|
|
4
|
-
* `gh
|
|
2
|
+
* `rarog doctor`: the PR status line (`docs/pull-requests.md`). Session cards list only PRs whose author GitHub
|
|
3
|
+
* confirms through the `gh` login, so without `gh` in the closed directory list and a login they show no PRs. It
|
|
4
|
+
* looks for `gh` the way the server does (the closed directory list, `~/` from the service environment that
|
|
5
|
+
* `buildServeEnv` gives), then runs `gh auth status --active --no-refresh --hostname github.com` with the same closed
|
|
6
|
+
* environment as the server's reads.
|
|
5
7
|
*
|
|
6
8
|
* `RAROG_PR_STATUS=0` = info; the demo and its review mode (`RAROG_DEMO`, as `bootstrap/pr-status.ts` decides) = info
|
|
7
9
|
* about the fixed state source, no lookup; no `gh` = warn with a fix; not logged in, a `gh` too old for the check's
|
|
@@ -15,14 +17,16 @@ import { GH_AUTH_ARGV, GH_DIRECTORIES, GH_HOST, checkGhAuth, findGh } from '../p
|
|
|
15
17
|
const LOGIN = `gh auth login --hostname ${GH_HOST}`;
|
|
16
18
|
const CHECK = `gh ${GH_AUTH_ARGV.join(' ')}`;
|
|
17
19
|
const CHECK_FLAGS = GH_AUTH_ARGV.filter((arg) => arg === '--active' || arg === '--no-refresh').join(' ');
|
|
20
|
+
/** Without GitHub's answer no linked PR is confirmed as the user's, so the cards list none. */
|
|
21
|
+
const NO_PRS = ', so session cards show no PRs';
|
|
18
22
|
/** The line for given facts; no process, no disk. */
|
|
19
23
|
export function prStatusLineOf(input) {
|
|
20
24
|
if (input.flag.trim() === '0')
|
|
21
|
-
return { verdict: 'info', text: `PR status: off (${PR_STATUS_ENV}=0)` };
|
|
25
|
+
return { verdict: 'info', text: `PR status: off (${PR_STATUS_ENV}=0)${NO_PRS}` };
|
|
22
26
|
if (input.gh === null) {
|
|
23
27
|
return {
|
|
24
28
|
verdict: 'warn',
|
|
25
|
-
text: `PR status: gh not found in ${(input.directories ?? GH_DIRECTORIES).join(', ')}
|
|
29
|
+
text: `PR status: gh not found in ${(input.directories ?? GH_DIRECTORIES).join(', ')}${NO_PRS}`,
|
|
26
30
|
repair: `install the GitHub CLI (gh) in one of these directories, run ${LOGIN} and restart the server,`
|
|
27
31
|
+ ` or set ${PR_STATUS_ENV}=0 in config.json`,
|
|
28
32
|
};
|
|
@@ -32,7 +36,7 @@ export function prStatusLineOf(input) {
|
|
|
32
36
|
if (input.auth === 'not-logged-in') {
|
|
33
37
|
return {
|
|
34
38
|
verdict: 'warn',
|
|
35
|
-
text: `PR status: ${input.gh} is not logged in to ${GH_HOST}
|
|
39
|
+
text: `PR status: ${input.gh} is not logged in to ${GH_HOST}${NO_PRS}`,
|
|
36
40
|
repair: `${LOGIN} as the user the service runs as; the server picks it up within 30 min, without a restart`,
|
|
37
41
|
};
|
|
38
42
|
}
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
* `update-provenance.ts` checks that one file, and npm installs exactly that file with `--ignore-scripts`. It finishes
|
|
11
11
|
* nothing: `update.ts` hands a new version to that version's own `rarog update --finish`. After npm has replaced the
|
|
12
12
|
* package files this process only reads one file and starts a child, so it never loads a module from the new files
|
|
13
|
-
* (no dynamic import).
|
|
13
|
+
* (no dynamic import). `nodeInstallsHere` tells `update.ts` whether the npm of another node (the service's) installs
|
|
14
|
+
* into this installation.
|
|
14
15
|
*/
|
|
15
16
|
import { spawn } from 'node:child_process';
|
|
16
17
|
import { mkdirSync, mkdtempSync, realpathSync, rmSync } from 'node:fs';
|
|
@@ -295,6 +296,35 @@ function npmPrefixOf(root) {
|
|
|
295
296
|
const binDir = npmBinDir(root);
|
|
296
297
|
return binDir === null ? null : path.dirname(binDir);
|
|
297
298
|
}
|
|
299
|
+
/**
|
|
300
|
+
* `node` is the node of the npm prefix of the installation at `root` (`<prefix>/bin`), and `npm prefix -g` of the npm
|
|
301
|
+
* next to it, in the environment `env`, is that prefix: a user `prefix=` in `.npmrc` can move it away from the node's
|
|
302
|
+
* own directory. Only then a whole `rarog update` on `node` installs into this installation and finishes on that node.
|
|
303
|
+
* Each reason for `false` is a line to `line`; Ctrl-C during npm = {@link SetupInterrupted}.
|
|
304
|
+
*/
|
|
305
|
+
export async function nodeInstallsHere(input) {
|
|
306
|
+
const { node, root, line } = input;
|
|
307
|
+
const prefix = packageManagerOf(root) === 'npm' ? npmPrefixOf(root) : null;
|
|
308
|
+
if (prefix === null || !sameDir(path.dirname(node), path.join(prefix, 'bin'))) {
|
|
309
|
+
line(` ${node} is not the node of the npm prefix of ${root}`);
|
|
310
|
+
return false;
|
|
311
|
+
}
|
|
312
|
+
const found = npmCliOf(node);
|
|
313
|
+
if ('failure' in found) {
|
|
314
|
+
line(` ${found.failure}`);
|
|
315
|
+
return false;
|
|
316
|
+
}
|
|
317
|
+
const run = await runNpm({
|
|
318
|
+
execPath: node, npmCli: found.file, env: npmEnv(input.env, NPM_AGE_GATE_CONFIG), cwd: input.cwd,
|
|
319
|
+
}, PREFIX_ARGS, line);
|
|
320
|
+
if (run.interrupted)
|
|
321
|
+
throw new SetupInterrupted('npm prefix was interrupted (Ctrl-C)');
|
|
322
|
+
const said = run.stdout.trim();
|
|
323
|
+
if (run.code === 0 && said !== '' && sameDir(said, prefix))
|
|
324
|
+
return true;
|
|
325
|
+
line(` npm prefix -g of ${node}: ${run.code === 0 ? said : `exit ${String(run.code)}`}`);
|
|
326
|
+
return false;
|
|
327
|
+
}
|
|
298
328
|
/**
|
|
299
329
|
* The Download step on `view`: the header with the versions, then one step line. Ctrl-C during npm =
|
|
300
330
|
* {@link SetupInterrupted}.
|
package/server/src/cli/update.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* `rarog update`: the newest version of the npm package from the registry (the Download step, `update-registry.ts`),
|
|
3
3
|
* then `rarog update --finish` of the version installed: a new version finishes in its own process (this one only
|
|
4
4
|
* started it, so a fault in the old version's finish cannot block the new one), the same version finishes here.
|
|
5
|
+
* Started on another node than the service's, when that node is the one of this prefix, it first runs again on the
|
|
6
|
+
* service's node, so the finish never moves the service to the terminal's node.
|
|
5
7
|
*
|
|
6
8
|
* `rarog update --finish` finishes the installed version without the registry. In order: the Claude SDK it pins
|
|
7
9
|
* (downloaded without a question), the service pointed at this installation when the run that has just installed it
|
|
@@ -16,11 +18,11 @@
|
|
|
16
18
|
* launchctl does not tell is refused before any step.
|
|
17
19
|
*/
|
|
18
20
|
import { spawn } from 'node:child_process';
|
|
19
|
-
import { realpathSync } from 'node:fs';
|
|
21
|
+
import { accessSync, constants, realpathSync } from 'node:fs';
|
|
20
22
|
import path from 'node:path';
|
|
21
23
|
import { INSTALL_MODE, INSTALL_ROOT } from '../install/mode.js';
|
|
22
|
-
import { rarogCli, repairCommands, shellQuote } from '../install/repair.js';
|
|
23
|
-
import { transientInstall } from '../install/service-target.js';
|
|
24
|
+
import { installationCli, rarogCli, repairCommands, shellQuote } from '../install/repair.js';
|
|
25
|
+
import { serviceArgvNode, transientInstall } from '../install/service-target.js';
|
|
24
26
|
import { readPackageVersion } from '../version.js';
|
|
25
27
|
import { trackChild } from './child-output.js';
|
|
26
28
|
import { EXIT_INTERRUPTED, EXIT_OK, EXIT_REFUSED, Refusal, Usage, err, homeOf, out, platformOf } from './io.js';
|
|
@@ -33,7 +35,7 @@ import { closingCheck, setupCliTarget } from './setup-check.js';
|
|
|
33
35
|
import { SCREEN_TITLE, SERVICE_UNDETERMINED, entry, serviceStateFix } from './setup-context.js';
|
|
34
36
|
import { SetupView } from './setup-screen.js';
|
|
35
37
|
import { unitFilePath } from './systemd-unit.js';
|
|
36
|
-
import { downloadStep } from './update-registry.js';
|
|
38
|
+
import { downloadStep, nodeInstallsHere } from './update-registry.js';
|
|
37
39
|
import { UPDATE_LOCK_TOKEN, markInstalled, takeUpdateLock, updateLockOf } from './update-lock.js';
|
|
38
40
|
import { sentenceFor, usageFor } from './screen/prose.js';
|
|
39
41
|
export const UPDATE_USAGE = ` rarog update [--beta] [--data-dir <dir>] [--verbose]
|
|
@@ -51,6 +53,11 @@ export const UPDATE_USAGE = ` rarog update [--beta] [--data-dir <dir>] [--verbo
|
|
|
51
53
|
project folders and leaves config.json as it is.
|
|
52
54
|
--data-dir: the installation's data directory from rarog serve --data-dir.
|
|
53
55
|
--verbose: every detail line on the screen.`;
|
|
56
|
+
/**
|
|
57
|
+
* Set in the environment of `rarog update` run again on the service's node: that run never switches again, so a
|
|
58
|
+
* node that still differs ends in a refusal, not in a loop.
|
|
59
|
+
*/
|
|
60
|
+
export const UPDATE_NODE_GUARD = 'RAROG_UPDATE_ON_SERVICE_NODE';
|
|
54
61
|
/** Command name of the run log (`<dataDir>/logs/update-….log`). */
|
|
55
62
|
export const UPDATE_LOG_COMMAND = 'update';
|
|
56
63
|
/** Step lines of a finish: four steps and the closing Check. */
|
|
@@ -166,6 +173,107 @@ function serviceAgainst(io, platform, root) {
|
|
|
166
173
|
? { kind: 'unloaded', what: `the service file ${file} is there, but launchd has no ${SERVICE_LABEL} loaded` }
|
|
167
174
|
: HERE;
|
|
168
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* The node the service starts when it starts this installation on another node than this process's: every source
|
|
178
|
+
* names the same executable node (macOS: the definition launchd has loaded and the plist; Linux: the unit file).
|
|
179
|
+
* `null` otherwise: no service, an unreadable one, sources that disagree, another installation, this process's node,
|
|
180
|
+
* or a load state launchctl does not tell. The Download step offers it only when it is the node of this prefix.
|
|
181
|
+
*/
|
|
182
|
+
function otherServiceNode(io, platform, root) {
|
|
183
|
+
const current = { node: process.execPath, bin: path.join(root, 'bin', 'rarog.mjs') };
|
|
184
|
+
const home = homeOf(io.env);
|
|
185
|
+
const sources = [];
|
|
186
|
+
if (platform === 'linux') {
|
|
187
|
+
if (entry(unitFilePath(home)) !== 'present')
|
|
188
|
+
return null;
|
|
189
|
+
const found = unitArgv(io);
|
|
190
|
+
if ('issue' in found)
|
|
191
|
+
return null;
|
|
192
|
+
sources.push(found.argv);
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
const loaded = loadedDefinition(SERVICE_LABEL, io, platform);
|
|
196
|
+
if (loaded.kind === 'unknown')
|
|
197
|
+
return null;
|
|
198
|
+
if (loaded.kind === 'loaded')
|
|
199
|
+
sources.push(loaded.argv);
|
|
200
|
+
if (entry(servicePlistPath(home)) === 'present') {
|
|
201
|
+
const found = servicePlistArgv(io);
|
|
202
|
+
if ('issue' in found)
|
|
203
|
+
return null;
|
|
204
|
+
sources.push(found.argv);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
const nodes = new Set();
|
|
208
|
+
for (const argv of sources) {
|
|
209
|
+
if (serviceInstallationMismatch(argv, 'package', current)?.kind !== 'node')
|
|
210
|
+
return null;
|
|
211
|
+
nodes.add(serviceArgvNode(argv) ?? '');
|
|
212
|
+
}
|
|
213
|
+
const [node] = nodes;
|
|
214
|
+
if (nodes.size !== 1 || node === undefined || node === '')
|
|
215
|
+
return null;
|
|
216
|
+
try {
|
|
217
|
+
accessSync(node, constants.X_OK);
|
|
218
|
+
}
|
|
219
|
+
catch {
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
return node;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* The service's node when this installation's update has to run on it: the service starts this installation on
|
|
226
|
+
* another node ({@link otherServiceNode}), that node is the one of this installation's npm prefix, and its npm installs
|
|
227
|
+
* there (`nodeInstallsHere`). `null` otherwise; `line` gets the reason.
|
|
228
|
+
*/
|
|
229
|
+
async function updateNodeOfService(io, platform, root, line) {
|
|
230
|
+
const node = otherServiceNode(io, platform, root);
|
|
231
|
+
if (node === null)
|
|
232
|
+
return null;
|
|
233
|
+
return await nodeInstallsHere({ node, root, env: io.env, cwd: homeOf(io.env), line }) ? node : null;
|
|
234
|
+
}
|
|
235
|
+
/** The arguments of a command as the user types them: the words bare, the value of `--data-dir` quoted. */
|
|
236
|
+
function typed(args) {
|
|
237
|
+
return args.map((arg, i) => (args[i - 1] === '--data-dir' ? shellQuote(arg) : arg)).join(' ');
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* `rarog update` (`argv` starts with `update`) on another node than the service's, when the update has to run on the
|
|
241
|
+
* service's node ({@link updateNodeOfService}): this process becomes the same command with the same arguments on that
|
|
242
|
+
* node (`process.execve`, the same PID), so its npm installs and the new version's finish runs on the node the service
|
|
243
|
+
* starts (a finish on this node would move the service here). One line says so; that run takes the update lock
|
|
244
|
+
* itself and gets {@link UPDATE_NODE_GUARD}. A run with the guard that still sees another node refuses instead of
|
|
245
|
+
* switching again. `null` = this run goes on.
|
|
246
|
+
*/
|
|
247
|
+
async function onServiceNode(argv, io, platform, root, replaceWith) {
|
|
248
|
+
let node;
|
|
249
|
+
try {
|
|
250
|
+
node = await updateNodeOfService(io, platform, root, () => { });
|
|
251
|
+
}
|
|
252
|
+
catch (failure) {
|
|
253
|
+
if (failure instanceof SetupInterrupted)
|
|
254
|
+
return EXIT_INTERRUPTED;
|
|
255
|
+
throw failure;
|
|
256
|
+
}
|
|
257
|
+
if (node === null)
|
|
258
|
+
return null;
|
|
259
|
+
const bin = path.join(root, 'bin', 'rarog.mjs');
|
|
260
|
+
const command = installationCli({ node, bin }, typed(argv));
|
|
261
|
+
if (io.env[UPDATE_NODE_GUARD] !== undefined) {
|
|
262
|
+
throw new Refusal(`the service starts ${node}, but this run on it runs on ${process.execPath}; nothing was`
|
|
263
|
+
+ ` changed; run ${command}.`);
|
|
264
|
+
}
|
|
265
|
+
const replace = replaceWith ?? (typeof process.execve === 'function' ? process.execve : null);
|
|
266
|
+
if (replace === null) {
|
|
267
|
+
// `bin/rarog.mjs` lets only a Node with `process.execve` in; a second process would not stop with this one.
|
|
268
|
+
throw new Refusal(`the service starts ${node}, and this Node (v${process.versions.node}) has no process.execve`
|
|
269
|
+
+ ` to run the update on it; nothing was changed; run ${command}.`);
|
|
270
|
+
}
|
|
271
|
+
out(io, `rarog update: the service starts ${node}, so this update runs on it.`);
|
|
272
|
+
// The same process becomes the run on the service's node: every signal reaches it as it would reach `rarog update`
|
|
273
|
+
// started there, and no process is left behind that could exit while the update goes on.
|
|
274
|
+
const code = replace(node, [node, bin, ...argv], { ...withoutToken(io.env), [UPDATE_NODE_GUARD]: '1' });
|
|
275
|
+
return typeof code === 'number' ? code : EXIT_REFUSED;
|
|
276
|
+
}
|
|
169
277
|
/** `rarog update` and `rarog update --finish` — `argv` starts with `update`; tests give `deps`. */
|
|
170
278
|
export async function updateCommand(argv, io, deps = DEFAULT_DEPS) {
|
|
171
279
|
if (argv.includes('--help') || argv.includes('-h')) {
|
|
@@ -200,6 +308,12 @@ export async function updateCommand(argv, io, deps = DEFAULT_DEPS) {
|
|
|
200
308
|
throw new Refusal(`${what}: no ${path.join(rarogConfigDir(io.env), 'config.json')}, so there is no installation`
|
|
201
309
|
+ ` to ${flags.finish ? 'finish' : 'update'}; run ${rarogCli('setup', mode)} first.`);
|
|
202
310
|
}
|
|
311
|
+
// Before the lock: the run on the service's node takes it itself.
|
|
312
|
+
if (!flags.finish) {
|
|
313
|
+
const code = await onServiceNode(argv, io, platform, root, deps.replaceProcess);
|
|
314
|
+
if (code !== null)
|
|
315
|
+
return code;
|
|
316
|
+
}
|
|
203
317
|
// `rarog update` installs, so it always takes the lock itself; a finish inherits the lock of a run that installed.
|
|
204
318
|
const dir = rarogConfigDir(io.env);
|
|
205
319
|
const lock = flags.finish ? updateLockOf(dir, io.env, what) : takeUpdateLock(dir, what);
|
|
@@ -364,8 +478,16 @@ async function runSteps(io, view, steps, run, deps, at) {
|
|
|
364
478
|
// The update lock does not name this installation as the one just installed: the refusal of rarog restart.
|
|
365
479
|
start('service', 'Service', false);
|
|
366
480
|
view.detail(` ${service.what}`);
|
|
367
|
-
//
|
|
368
|
-
|
|
481
|
+
// A service on the node of this prefix whose npm installs here: this command again on that node, which the service
|
|
482
|
+
// already starts (`rarog service install` here would move the service to this process's node).
|
|
483
|
+
const node = service.other === 'node'
|
|
484
|
+
? await updateNodeOfService(io, run.platform, run.root, (text) => { view.detail(text); }) : null;
|
|
485
|
+
const again = [...(run.flags.finish ? ['update', '--finish'] : ['update']),
|
|
486
|
+
...(run.flags.dataDir === null ? [] : ['--data-dir', run.flags.dataDir])];
|
|
487
|
+
// Otherwise the command of this installation (the absolute form outside `PATH`, `screenFix`); the step line says why.
|
|
488
|
+
show(view, 'fail', `starts another ${service.other}; nothing was changed`, node === null
|
|
489
|
+
? rarogCli('service install', 'package')
|
|
490
|
+
: installationCli({ node, bin: path.join(run.root, 'bin', 'rarog.mjs') }, typed(again)));
|
|
369
491
|
return EXIT_REFUSED;
|
|
370
492
|
}
|
|
371
493
|
const results = [];
|
|
@@ -24,7 +24,9 @@ const actionSchema = z.discriminatedUnion('action', [
|
|
|
24
24
|
'artifacts', 'pull-requests', 'scheduled-tasks', 'prompt-blocked']),
|
|
25
25
|
label: z.string().trim().min(1).max(80).optional(),
|
|
26
26
|
// Katalog sesji zamiast `SCENARIO_CWD`: długa nazwa projektu w nagłówku (tytuł to nazwa katalogu, nie etykieta).
|
|
27
|
-
cwd: z.string().startsWith('/').max(200).optional()
|
|
27
|
+
cwd: z.string().startsWith('/').max(200).optional(),
|
|
28
|
+
// `standby` only: the subagent has stood 47 min (`long`) or 75 min (`stuck`) on a wait loop of its own.
|
|
29
|
+
wait: z.enum(['long', 'stuck']).optional() }).strict(),
|
|
28
30
|
// Notatka projektu zapisana „na innym urządzeniu": nowa wersja w magazynie demo i event `notes`.
|
|
29
31
|
z.object({ action: z.literal('note-remote'), text: z.string().max(4096) }).strict(),
|
|
30
32
|
z.object({ action: z.literal('emit'), sessionId: z.uuid(),
|
|
@@ -270,7 +272,7 @@ export function createDemoControl(router, config, manager, panels, notes) {
|
|
|
270
272
|
if (action.action === 'create') {
|
|
271
273
|
const scenario = action.scenario;
|
|
272
274
|
await reset();
|
|
273
|
-
const pane = panels.create(scenario, action.label ?? `M1 ${scenario}`, action.cwd);
|
|
275
|
+
const pane = panels.create(scenario, action.label ?? `M1 ${scenario}`, action.cwd, action.wait);
|
|
274
276
|
sessionId = pane.sessionId;
|
|
275
277
|
driver = pane.driver;
|
|
276
278
|
// Adopcja i historia są asynchroniczne. Odpowiedź create daje gotowy scenariusz,
|
|
@@ -232,9 +232,9 @@ export function createMockHerdr(content) {
|
|
|
232
232
|
// Ten sam wzorzec nazwy co `herdr/uploads.ts` — ścieżka od klienta nie wskaże niczego innego.
|
|
233
233
|
const readUpload = (cwd, name) => Promise.resolve(UPLOAD_IMAGE_FILE_PATTERN.test(name) ? (uploads.get(uploadKey(cwd, name)) ?? null) : null);
|
|
234
234
|
const scenarioPanels = {
|
|
235
|
-
create(scenario, label, cwd = SCENARIO_CWD) {
|
|
235
|
+
create(scenario, label, cwd = SCENARIO_CWD, wait) {
|
|
236
236
|
const sessionId = randomUUID();
|
|
237
|
-
const driver = new ScenarioDriver(scenario, label);
|
|
237
|
+
const driver = new ScenarioDriver(scenario, label, wait);
|
|
238
238
|
panes.set(sessionId, { key: sessionId, cwd, scenario: { kind: 'idle' },
|
|
239
239
|
launchedByRarog: true, driver });
|
|
240
240
|
// Normalna ścieżka przyłączenia panelu herdr; seedy innych sesji zostają na miejscu.
|
|
@@ -4,6 +4,7 @@ import { foreign } from '@rarog/shared/sentences';
|
|
|
4
4
|
import { MAX_DIRTY, demoGitStatus } from '../drivers/mock-driver.js';
|
|
5
5
|
import { AsyncEventQueue } from '../drivers/runtime.js';
|
|
6
6
|
import { APPLIED, STALE } from '../drivers/types.js';
|
|
7
|
+
import { ownCommandWaitOf } from '../herdr/background/work.js';
|
|
7
8
|
import { echoKey } from '../herdr/jsonl-follow.js';
|
|
8
9
|
import { demoArtifacts, demoBlocks, demoPullRequests, demoScheduledTasks, demoStandbyNotice } from './seeds.js';
|
|
9
10
|
/** Katalog paneli scenariuszy — w tabeli ahead/behind demo (`rarog`: ↓1). */
|
|
@@ -27,6 +28,7 @@ export const SCENARIO_BLOCKED_REASON = 'this session must be restarted before it
|
|
|
27
28
|
/** Subagent w postoju scenariusza `standby` (sekcja „w tle” apki: trzy stany subagenta). */
|
|
28
29
|
export const SCENARIO_STANDBY_TASK_ID = 'm1-standby';
|
|
29
30
|
export const SCENARIO_STANDBY_NAME = 'Przegląd pokrycia testami';
|
|
31
|
+
const STANDBY_WAIT_AGO_MS = { long: 47 * 60_000, stuck: 75 * 60_000 };
|
|
30
32
|
/**
|
|
31
33
|
* Rozkład startowy: 12 skończonych agentów implementacji, 44 skończonych i jeden żywy (od 4 min)
|
|
32
34
|
* w Review, Poprawki bez agentów. Review ma 45 agentów: rozwinięta lista jej skończonych przewija panel na
|
|
@@ -52,7 +54,7 @@ export class ScenarioDriver {
|
|
|
52
54
|
sends = 0;
|
|
53
55
|
decisions = 0;
|
|
54
56
|
answers = [];
|
|
55
|
-
constructor(scenario, label) {
|
|
57
|
+
constructor(scenario, label, wait) {
|
|
56
58
|
this.#blocksPrompts = scenario === 'prompt-blocked';
|
|
57
59
|
this.events.push({ type: 'init', engineSessionId: randomUUID(), model: 'claude-fable-5-1' });
|
|
58
60
|
this.events.push({ type: 'title', title: label });
|
|
@@ -70,11 +72,14 @@ export class ScenarioDriver {
|
|
|
70
72
|
// „Skończone ostatnio".
|
|
71
73
|
const now = Date.now();
|
|
72
74
|
const at = (agoMs) => new Date(now - agoMs).toISOString();
|
|
73
|
-
const
|
|
75
|
+
const standingMs = wait === undefined ? 18 * 60_000 : STANDBY_WAIT_AGO_MS[wait];
|
|
76
|
+
// The start of the turn, 7 min before the standby, as in the plain scenario.
|
|
77
|
+
const startedMs = standingMs + 7 * 60_000;
|
|
78
|
+
const notice = demoStandbyNotice(standingMs, SCENARIO_STANDBY_NAME);
|
|
74
79
|
this.events.push({ type: 'history', messages: [
|
|
75
|
-
{ role: 'user', at: at(
|
|
80
|
+
{ role: 'user', at: at(startedMs + 60_000),
|
|
76
81
|
blocks: [{ type: 'text', text: foreign('Policz pokrycie testami modułu transkryptu.') }] },
|
|
77
|
-
{ role: 'assistant', at: at(
|
|
82
|
+
{ role: 'assistant', at: at(startedMs), blocks: [{ type: 'text', text: foreign('Puszczam subagenta w tle.') }] },
|
|
78
83
|
{ role: 'user', at: at(notice.agoMs), blocks: demoBlocks(notice.blocks), notice: notice.notice },
|
|
79
84
|
{ role: 'assistant', at: at(notice.agoMs - 2000),
|
|
80
85
|
blocks: [{
|
|
@@ -82,13 +87,17 @@ export class ScenarioDriver {
|
|
|
82
87
|
}] },
|
|
83
88
|
] });
|
|
84
89
|
// Stoi od 18 min i czeka na dwie własne komendy; druga bez treści (serwer bywa, że jej nie zna).
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
90
|
+
// The variant stands on a wait loop of its own: a `pgrep` that matches its own shell and a `sleep`.
|
|
91
|
+
const commands = wait === undefined
|
|
92
|
+
? [
|
|
88
93
|
{ id: `${SCENARIO_STANDBY_TASK_ID}-cmd-1`, command: 'pnpm test -- --coverage', startedAt: at(21 * 60_000) },
|
|
89
94
|
{ id: `${SCENARIO_STANDBY_TASK_ID}-cmd-2`, startedAt: at(19 * 60_000) },
|
|
90
|
-
]
|
|
91
|
-
|
|
95
|
+
]
|
|
96
|
+
: [
|
|
97
|
+
{ id: `${SCENARIO_STANDBY_TASK_ID}-cmd-1`, command: "pgrep -f 'demo-build'", startedAt: at(standingMs + 3 * 60_000) },
|
|
98
|
+
{ id: `${SCENARIO_STANDBY_TASK_ID}-cmd-2`, command: 'sleep 30', startedAt: at(standingMs + 60_000) },
|
|
99
|
+
];
|
|
100
|
+
this.#standby = { startedAt: at(startedMs), waitingSince: at(standingMs), waiting: true, commands };
|
|
92
101
|
}
|
|
93
102
|
if (scenario === 'artifacts')
|
|
94
103
|
this.#pushArtifacts();
|
|
@@ -169,7 +178,7 @@ export class ScenarioDriver {
|
|
|
169
178
|
say('user', 2 * hour + 60_000, 'Dodaj eksport notatek do CSV i otwórz PR.'),
|
|
170
179
|
say('assistant', 2 * hour - 5000, 'PR z eksportem otwarty.'),
|
|
171
180
|
] });
|
|
172
|
-
this.events.push({ type: 'pull-requests',
|
|
181
|
+
this.events.push({ type: 'pull-requests', ...demoPullRequests(now) });
|
|
173
182
|
}
|
|
174
183
|
/**
|
|
175
184
|
* Scenario `scheduled-tasks` (the inspector's scheduled tasks section): a short history, then a one-shot and a
|
|
@@ -188,17 +197,22 @@ export class ScenarioDriver {
|
|
|
188
197
|
] });
|
|
189
198
|
this.events.push({ type: 'scheduled-tasks', scheduledTasks: demoScheduledTasks(now) });
|
|
190
199
|
}
|
|
191
|
-
/**
|
|
200
|
+
/**
|
|
201
|
+
* Lista zadań scenariusza `standby`: jeden subagent, w postoju albo (po `agent-wake`) pracujący. The wait stage comes
|
|
202
|
+
* from `ownCommandWaitOf` with the clock of this emission, as `merge.ts` sets it on production lists.
|
|
203
|
+
*/
|
|
192
204
|
#pushStandby() {
|
|
193
205
|
const agent = this.#standby;
|
|
194
206
|
if (agent === null)
|
|
195
207
|
return;
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
208
|
+
const task = {
|
|
209
|
+
id: SCENARIO_STANDBY_TASK_ID, kind: 'agent', description: SCENARIO_STANDBY_NAME, agentType: 'general-purpose',
|
|
210
|
+
model: 'claude-opus-5-5', startedAt: agent.startedAt,
|
|
211
|
+
...(agent.waiting ? { waitingSince: agent.waitingSince } : {}),
|
|
212
|
+
...(agent.commands.length > 0 ? { ownTasks: agent.commands.map((command) => ({ ...command })) } : {}),
|
|
213
|
+
};
|
|
214
|
+
const stage = ownCommandWaitOf(task, Date.now());
|
|
215
|
+
this.events.push({ type: 'background-tasks', tasks: [stage === undefined ? task : { ...task, ownCommandWait: stage }] });
|
|
202
216
|
}
|
|
203
217
|
/**
|
|
204
218
|
* `agent-wake`: pierwsza własna komenda agenta się skończyła, więc agent ruszył sam. Jedzie w górę bez
|