@rarog/server 1.1.2-beta.1 → 1.1.2-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node_modules/@rarog/shared/package.json +1 -1
- package/node_modules/@rarog/shared/src/decode.js +43 -1
- package/node_modules/@rarog/shared/src/notify-copy.js +1 -0
- package/node_modules/@rarog/shared/src/protocol/context.js +57 -0
- package/node_modules/@rarog/shared/src/protocol/coordination.js +42 -0
- package/node_modules/@rarog/shared/src/protocol/dialog-live.js +117 -0
- package/node_modules/@rarog/shared/src/protocol/files.js +1 -1
- package/node_modules/@rarog/shared/src/protocol/inbox.js +6 -0
- package/node_modules/@rarog/shared/src/protocol/presence.js +47 -0
- package/node_modules/@rarog/shared/src/protocol.js +14 -146
- package/node_modules/@rarog/shared/src/rest.js +16 -1
- package/node_modules/@rarog/shared/src/sentences/push.js +6 -0
- package/node_modules/@rarog/shared/src/sentences/rest.js +9 -0
- package/node_modules/@rarog/shared/src/sentences/restart.js +1 -0
- package/node_modules/@rarog/shared/src/sentences/session.js +24 -0
- package/package.json +2 -2
- package/plugin/rarog/.claude-plugin/plugin.json +4 -0
- package/plugin/rarog/bin/rarog-coordinator +7 -0
- package/plugin/rarog/hooks/hooks.json +18 -0
- package/plugin/rarog/hooks/recipient.mjs +95 -0
- package/plugin/rarog/lib/coordinator.mjs +1340 -0
- package/plugin/rarog/lib/threads.mjs +350 -0
- package/plugin/rarog/skills/coordinator/SKILL.md +111 -0
- package/plugin/rarog/skills/coordinator/check-and-merge.md +46 -0
- package/plugin/rarog/skills/coordinator/close-thread.md +15 -0
- package/plugin/rarog/skills/coordinator/role.md +61 -0
- package/plugin/rarog/skills/coordinator/send-back.md +39 -0
- package/plugin/rarog/skills/coordinator/start-thread.md +43 -0
- package/server/src/bootstrap/coordination.js +49 -0
- package/server/src/bootstrap/coordinator-start.js +27 -0
- package/server/src/bootstrap/inbox.js +4 -0
- package/server/src/bootstrap/push.js +24 -1
- package/server/src/companion/catalog.js +1 -1
- package/server/src/companion/index.js +2 -4
- package/server/src/config/flags.js +4 -0
- package/server/src/config-env.js +15 -0
- package/server/src/config.js +17 -3
- package/server/src/coordination/merge-events.js +86 -0
- package/server/src/coordination/merge-prompt.js +244 -0
- package/server/src/coordination/registry.js +289 -0
- package/server/src/coordination/state.js +94 -0
- package/server/src/coordination/summary.js +422 -0
- package/server/src/coordination/thread-file.js +245 -0
- package/server/src/coordination/thread-git.js +110 -0
- package/server/src/coordination/watch.js +237 -0
- package/server/src/demo/content/coordinator.js +89 -0
- package/server/src/demo/content/en.js +57 -1
- package/server/src/demo/content/pl.js +57 -1
- package/server/src/demo/inbox.js +12 -0
- package/server/src/demo/mock-herdr.js +3 -2
- package/server/src/demo/review-routes.js +2 -2
- package/server/src/demo/seeds.js +20 -2
- package/server/src/drivers/herdr/live-dialog.js +412 -0
- package/server/src/drivers/herdr/live-step.js +261 -0
- package/server/src/drivers/herdr/pause-gate.js +60 -0
- package/server/src/drivers/herdr/returned-prompt.js +4 -1
- package/server/src/drivers/herdr/screen-fallback.js +50 -0
- package/server/src/drivers/herdr/start-dialog-gate.js +4 -0
- package/server/src/drivers/herdr-driver.js +88 -66
- package/server/src/files/refusals.js +9 -2
- package/server/src/files/session-gate.js +5 -4
- package/server/src/git-branch-diff.js +194 -0
- package/server/src/herdr/argv.js +34 -3
- package/server/src/herdr/audit.js +32 -1
- package/server/src/herdr/background/cli-shapes.js +19 -0
- package/server/src/herdr/background/queued-prompt.js +46 -0
- package/server/src/herdr/background/work.js +12 -0
- package/server/src/herdr/client.js +22 -46
- package/server/src/herdr/commands/catalog.js +11 -7
- package/server/src/herdr/commands/discover.js +33 -1
- package/server/src/herdr/commands/index.js +3 -2
- package/server/src/herdr/dialogs/index.js +9 -0
- package/server/src/herdr/dialogs/layer1/hook-list/hook-list.js +4 -56
- package/server/src/herdr/dialogs/live/model.js +220 -0
- package/server/src/herdr/dialogs/live/policy.js +108 -0
- package/server/src/herdr/dialogs/live/view.js +261 -0
- package/server/src/herdr/dialogs/screen/form.js +4 -3
- package/server/src/herdr/dialogs/screen/signatures.js +23 -0
- package/server/src/herdr/engines.js +96 -0
- package/server/src/herdr/history-steps.js +9 -4
- package/server/src/herdr/identity.js +20 -5
- package/server/src/herdr/jsonl-follow.js +20 -1
- package/server/src/herdr/plugin-copy.js +281 -0
- package/server/src/herdr/session-index.js +19 -0
- package/server/src/herdr/supervisor.js +16 -13
- package/server/src/herdr/types.js +1 -0
- package/server/src/inbox/card.js +31 -8
- package/server/src/inbox/heads.js +1 -0
- package/server/src/inbox/inbox.js +21 -4
- package/server/src/inbox/removals.js +10 -1
- package/server/src/index.js +37 -5
- package/server/src/notify/content.js +27 -0
- package/server/src/notify/index.js +7 -3
- package/server/src/notify/live-activity-state.js +14 -5
- package/server/src/notify/policy.js +49 -11
- package/server/src/notify/ready-to-merge.js +148 -0
- package/server/src/project-root.js +233 -0
- package/server/src/routes/sessions.js +68 -2
- package/server/src/sessions/branch-diff.js +57 -0
- package/server/src/sessions/cli-registry.js +17 -3
- package/server/src/sessions/companion-scope.js +2 -1
- package/server/src/sessions/consent-cards.js +49 -2
- package/server/src/sessions/conversation-lists.js +4 -1
- package/server/src/sessions/coordinator-start.js +172 -0
- package/server/src/sessions/demo-modules.js +1 -0
- package/server/src/sessions/demo-seeds.js +100 -0
- package/server/src/sessions/driver-events.js +61 -11
- package/server/src/sessions/herdr-lifecycle.js +11 -4
- package/server/src/sessions/launch-gate.js +36 -11
- package/server/src/sessions/live-dialog.js +69 -0
- package/server/src/sessions/manager.js +124 -282
- package/server/src/sessions/owner-turn.js +36 -0
- package/server/src/sessions/seen-marks.js +31 -12
- package/server/src/sessions/session-dialog.js +82 -0
- package/server/src/sessions/session-git.js +1 -0
- package/server/src/sessions/session-scope.js +6 -5
- package/server/src/sessions/session-take-back.js +5 -0
- package/server/src/sessions/session.js +72 -7
- package/server/src/sessions/state-machine.js +2 -0
- package/server/src/sessions/state-sentences.js +87 -30
- package/server/src/sessions/waiting-line.js +49 -0
- package/server/src/transcript-import.js +20 -2
- package/server/src/version.js +4 -0
- /package/server/src/{companion/asks-owner.js → asks-owner.js} +0 -0
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { EXIT_PLAN_MODE_TOOL, WAITING_TEXT_MAX } from '@rarog/shared';
|
|
7
7
|
// Ta sama etykieta, którą dostaje wiersz tool-calla w transkrypcie — patrz `decisionText`.
|
|
8
8
|
import { summarizeToolInput } from '../drivers/tool-summary.js';
|
|
9
|
+
import { DECISION_STATES } from './state-sentences.js';
|
|
9
10
|
/**
|
|
10
11
|
* Treść decyzji do JEDNEJ linii karty listy: pierwsza linia, przycięta do `WAITING_TEXT_MAX`.
|
|
11
12
|
*
|
|
@@ -70,3 +71,51 @@ export function decisionText(permission) {
|
|
|
70
71
|
// Bez trafionego klucza `summarizeToolInput` oddaje NAZWĘ narzędzia — a ta stoi już obok.
|
|
71
72
|
return summary === permission.toolName ? '' : summary;
|
|
72
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Skrót stojącej decyzji dla LISTY — fakty, nie gotowy napis.
|
|
76
|
+
*
|
|
77
|
+
* Liczony z `#pending` przy każdym `#summaryOf` i nigdzie nie zapamiętywany: wpis znika
|
|
78
|
+
* razem z kartą (`permission-cleared`, `#expirePending`, odpowiedź), więc nie ma kodu,
|
|
79
|
+
* który musiałby to pole kasować — a takiego kodu nikt nie wywoła w ścieżce, o której
|
|
80
|
+
* zapomniał. Pierwsza karta w kolejce, bo SDK potrafi zgłosić kilka naraz, a linia karty
|
|
81
|
+
* ma jeden wiersz; kolejne widać po wejściu w sesję.
|
|
82
|
+
*
|
|
83
|
+
* Dialog z ekranu (`herdrDialog`) świadomie NIE ma tu wpisu: jego rodzaj jedzie kanałem
|
|
84
|
+
* globalnym własnym polem, więc drugi opis tej samej rzeczy byłby dwoma źródłami
|
|
85
|
+
* prawdy o jednym dialogu.
|
|
86
|
+
*/
|
|
87
|
+
export function waitingFor(session, pending, consentRequests) {
|
|
88
|
+
if (!DECISION_STATES.includes(session.state))
|
|
89
|
+
return undefined;
|
|
90
|
+
// Karta kanału zgód liczy się jako „czeka na człowieka” wyłącznie w stanie `pending`.
|
|
91
|
+
const permission = pending.permissionsFor(session.id)[0]
|
|
92
|
+
?? consentRequests(session).find((request) => request.state === 'pending');
|
|
93
|
+
if (permission !== undefined) {
|
|
94
|
+
const text = waitingText(decisionText(permission));
|
|
95
|
+
return {
|
|
96
|
+
kind: 'permission',
|
|
97
|
+
tool: permission.toolName,
|
|
98
|
+
...(text === '' ? {} : { text }),
|
|
99
|
+
// Lista mówi „plan" z tego pola, nie z nazwy `ExitPlanMode`.
|
|
100
|
+
subject: permission.subject ?? permissionSubject(permission.toolName),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
const question = pending.questionsFor(session.id)[0];
|
|
104
|
+
if (question === undefined)
|
|
105
|
+
return undefined;
|
|
106
|
+
const text = waitingText(question.questions[0]?.question ?? '');
|
|
107
|
+
return {
|
|
108
|
+
kind: 'question',
|
|
109
|
+
...(text === '' ? {} : { text }),
|
|
110
|
+
// „1" nie jest informacją: numeracja na karcie ma sens dopiero od dwóch pytań.
|
|
111
|
+
...(question.questions.length > 1 ? { count: question.questions.length } : {}),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Przedmiot zgody: wyjście z trybu planu albo zwykłe narzędzie. Jedyne miejsce, w którym
|
|
116
|
+
* nazwa `ExitPlanMode` staje się faktem dla klienta — telefon buduje kartę planu z pola
|
|
117
|
+
* `subject`, a nazwy narzędzia CLI nie zna.
|
|
118
|
+
*/
|
|
119
|
+
export function permissionSubject(toolName) {
|
|
120
|
+
return toolName === EXIT_PLAN_MODE_TOOL ? 'plan' : 'tool';
|
|
121
|
+
}
|
|
@@ -29,7 +29,7 @@ import { CLI_PLUMBING_TAGS } from './herdr/commands/registry.js';
|
|
|
29
29
|
import { INTERRUPTION_TEXT, parseJsonlEntry } from './herdr/jsonl-pending.js';
|
|
30
30
|
import { isMainCompactBoundary } from './herdr/jsonl-usage.js';
|
|
31
31
|
import { FileEchoPairing, plainFileEchoOf, systemEntryNote, userEntryNote } from './herdr/commands/transcript.js';
|
|
32
|
-
import { queuedHumanPrompt } from './herdr/background/queued-prompt.js';
|
|
32
|
+
import { crossSessionPrompt, queuedHumanPrompt } from './herdr/background/queued-prompt.js';
|
|
33
33
|
import { MAX_TRANSCRIPT_MESSAGES } from './sessions/session.js';
|
|
34
34
|
import { MAX_TOOL_DETAIL, clipForDisplay, toolCallSemantics, toolDiffText, toolInputText, } from './drivers/tool-text.js';
|
|
35
35
|
import { summarizeToolInput } from './drivers/tool-summary.js';
|
|
@@ -343,6 +343,18 @@ export function parseImportLine(line, opts = {}) {
|
|
|
343
343
|
? { role: 'user', message: null, conversational: false }
|
|
344
344
|
: { role: 'user', message: { role: 'user', blocks, at: queued.at }, conversational: true };
|
|
345
345
|
}
|
|
346
|
+
/*
|
|
347
|
+
* A message from another session, idle (meta `user` entry) or absorbed into a turn (queue attachment): both carry
|
|
348
|
+
* the bare text in the origin, so both give the same bubble without the envelope and the preamble for the model.
|
|
349
|
+
* Only on request; otherwise the entry falls to the meta rule below and stays hidden.
|
|
350
|
+
*/
|
|
351
|
+
const peer = opts.crossSessionPrompts === true ? crossSessionPrompt(value) : null;
|
|
352
|
+
if (peer !== null) {
|
|
353
|
+
const blocks = userBlocksFrom(peer.body);
|
|
354
|
+
return blocks.length === 0
|
|
355
|
+
? { role: 'user', message: null, conversational: false }
|
|
356
|
+
: { role: 'user', message: { role: 'user', blocks, at: peer.at, peer: true }, conversational: true };
|
|
357
|
+
}
|
|
346
358
|
// Wpisy meta (podsumowania CLI) i sidechainy (podagenci) nie są rozmową człowieka z agentem.
|
|
347
359
|
// Reguła dotyczy WSZYSTKICH ról: transkrypt podagenta w głównym wątku byłby szumem, a nie historią.
|
|
348
360
|
//
|
|
@@ -466,8 +478,12 @@ export function parseTranscriptTail(text, opts) {
|
|
|
466
478
|
let openTurn = null;
|
|
467
479
|
const result = { messages };
|
|
468
480
|
const fileEcho = new FileEchoPairing();
|
|
481
|
+
const lineOpts = {
|
|
482
|
+
...(opts.promptBlock === false ? { promptBlock: false } : {}),
|
|
483
|
+
...(opts.crossSessionPrompts === true ? { crossSessionPrompts: true } : {}),
|
|
484
|
+
};
|
|
469
485
|
for (const line of lines) {
|
|
470
|
-
const entry = parseImportLine(line,
|
|
486
|
+
const entry = parseImportLine(line, lineOpts);
|
|
471
487
|
if (entry === null) {
|
|
472
488
|
// A mark stays out of the "/compact" pairing, as every entry without a parse result does.
|
|
473
489
|
const mark = opts.turnMarks === true ? turnMarkOf(line) : null;
|
|
@@ -575,5 +591,7 @@ export async function importTranscript(cwd, engineSessionId, opts = {}) {
|
|
|
575
591
|
const parseOpts = { dropFirstLine: tail.truncated };
|
|
576
592
|
if (opts.limit !== undefined)
|
|
577
593
|
parseOpts.limit = opts.limit;
|
|
594
|
+
if (opts.crossSessionPrompts === true)
|
|
595
|
+
parseOpts.crossSessionPrompts = true;
|
|
578
596
|
return parseTranscriptTail(tail.text, parseOpts);
|
|
579
597
|
}
|
package/server/src/version.js
CHANGED
|
@@ -53,9 +53,13 @@ export const RAROG_VERSION = readPackageVersion();
|
|
|
53
53
|
* `GET /api/sessions/:id/companion/turns` and the field `companionSessions` in `GET /api/version`. A capability of
|
|
54
54
|
* the code, not of the configuration: whether the mode works (`RAROG_COMPANION_SESSIONS` next to a working voice
|
|
55
55
|
* agent) says `companionSessions`.
|
|
56
|
+
* - `coordination` — the server knows the project coordinator (`docs/coordinator.md`): a Launch body with
|
|
57
|
+
* `coordinator: true` starts one, the summaries carry `projectRoot` and `coordination`, and
|
|
58
|
+
* `GET /api/sessions/:id/branch-diff/files` and `…/branch-diff/file?path=` answer. A capability of the code.
|
|
56
59
|
*/
|
|
57
60
|
export const SERVER_CAPABILITIES = [
|
|
58
61
|
'device-auth', 'pair', 'pair-from-device', 'push-relay', 'push-e2e-v2', 'companion', 'companion-sessions',
|
|
62
|
+
'coordination',
|
|
59
63
|
];
|
|
60
64
|
/**
|
|
61
65
|
* `inbox` — the server keeps an Inbox card per session: `GET /api/stream?inbox=1` adds the Inbox heads, and
|
|
File without changes
|