@north-light/crouter 0.3.180 → 0.3.182
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/dist/api/client.d.ts +10 -1
- package/dist/api/client.js +13 -0
- package/dist/api/dto/broker.d.ts +32 -0
- package/dist/api/dto/crons.d.ts +17 -0
- package/dist/api/dto/memory.d.ts +17 -0
- package/dist/api/dto/memory.js +6 -0
- package/dist/api/dto/messages.d.ts +5 -0
- package/dist/api/dto/reviews.d.ts +8 -4
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/routes.d.ts +2 -0
- package/dist/api/routes.js +4 -0
- package/dist/build-root.d.ts +7 -0
- package/dist/build-root.js +21 -0
- package/dist/builtin-memory/insights/init.md +48 -3
- package/dist/builtin-pi-packages/pi-crtr-extensions/__tests__/insights-active-init.test.ts +98 -0
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/claude-plugin-commands.ts +7 -50
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/memory-slash-commands.ts +16 -1
- package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/pi-shell-runner.ts +34 -0
- package/dist/cli.js +1 -2
- package/dist/clients/attach/__tests__/context-message.test.js +5 -2
- package/dist/clients/attach/assets/README.md +7 -0
- package/dist/clients/attach/assets/whip-06.mp3 +0 -0
- package/dist/clients/attach/assets/whip-crack.mp3 +0 -0
- package/dist/clients/attach/assets/whip-snap.mp3 +0 -0
- package/dist/clients/attach/chrome/canvas-panels.d.ts +7 -1
- package/dist/clients/attach/chrome/canvas-panels.js +20 -3
- package/dist/clients/attach/chrome/review-wait.d.ts +6 -0
- package/dist/clients/attach/chrome/review-wait.js +22 -0
- package/dist/clients/attach/chrome/roster.js +23 -2
- package/dist/clients/attach/chrome/widgets.js +1 -1
- package/dist/clients/attach/input/controller.js +4 -3
- package/dist/clients/attach/overlays/mcp.js +3 -1
- package/dist/clients/attach/render/chat-view.js +1 -1
- package/dist/clients/attach/session/whip.d.ts +1 -0
- package/dist/clients/attach/session/whip.js +26 -0
- package/dist/clients/attach/slash/dispatch.js +2 -0
- package/dist/clients/attach/viewer.js +578 -573
- package/dist/clients/inbox/review/document-surface.d.ts +1 -1
- package/dist/clients/inbox/review/document-surface.js +4 -4
- package/dist/clients/inbox/review/launch.js +16 -4
- package/dist/clients/inbox/review/review-client.d.ts +9 -4
- package/dist/clients/inbox/review/review-client.js +3 -0
- package/dist/commands/cron.js +30 -8
- package/dist/commands/human/prompts.d.ts +7 -2
- package/dist/commands/human/prompts.js +15 -10
- package/dist/commands/human.js +1 -2
- package/dist/commands/memory/find.js +11 -8
- package/dist/commands/memory/read.js +111 -11
- package/dist/commands/memory/write.js +1 -1
- package/dist/commands/memory.js +1 -1
- package/dist/commands/pkg/market-manage.d.ts +13 -0
- package/dist/commands/pkg/market-manage.js +39 -33
- package/dist/commands/pkg/plugin-inspect.js +4 -3
- package/dist/commands/pkg/plugin-manage.js +12 -11
- package/dist/commands/surface/node/focus.js +1 -2
- package/dist/commands/sys/doctor.js +4 -4
- package/dist/commands/sys/setup-core.d.ts +14 -7
- package/dist/commands/sys/setup-core.js +66 -11
- package/dist/commands/sys/setup-wizard.js +2 -2
- package/dist/commands/sys/setup.js +1 -1
- package/dist/core/__tests__/cron-held-settlement.test.d.ts +1 -0
- package/dist/core/__tests__/cron-held-settlement.test.js +222 -0
- package/dist/core/__tests__/helpers/harness.js +1 -2
- package/dist/core/__tests__/phase4-review-store.test.js +1 -0
- package/dist/core/__tests__/serial/command-plugins.test.js +88 -1
- package/dist/core/__tests__/session-model.test.js +5 -3
- package/dist/core/bootstrap.d.ts +0 -4
- package/dist/core/bootstrap.js +1 -55
- package/dist/core/canvas/crons.d.ts +54 -2
- package/dist/core/canvas/crons.js +48 -4
- package/dist/core/canvas/db.js +23 -0
- package/dist/core/command-manifests/manifest.d.ts +11 -0
- package/dist/core/command-manifests/manifest.js +45 -4
- package/dist/core/command-manifests/schema.d.ts +1 -1
- package/dist/core/command-plugins/bundle.d.ts +1 -0
- package/dist/core/command-plugins/bundle.js +3 -3
- package/dist/core/command-plugins/discovery.d.ts +5 -2
- package/dist/core/command-plugins/discovery.js +5 -5
- package/dist/core/command-plugins/help-addenda.d.ts +12 -0
- package/dist/core/command-plugins/help-addenda.js +30 -0
- package/dist/core/command.js +25 -2
- package/dist/core/config.js +0 -1
- package/dist/core/human/convention.d.ts +0 -1
- package/dist/core/human/convention.js +0 -6
- package/dist/core/keybindings/inbox.d.ts +6 -8
- package/dist/core/keybindings/inbox.js +6 -15
- package/dist/core/keybindings/index.d.ts +1 -1
- package/dist/core/keybindings/index.js +1 -1
- package/dist/core/memory/doc-link-grammar.js +4 -1
- package/dist/core/memory-resolver.d.ts +28 -4
- package/dist/core/memory-resolver.js +51 -39
- package/dist/core/review/stage.js +1 -0
- package/dist/core/review/store.d.ts +5 -0
- package/dist/core/review/store.js +10 -0
- package/dist/core/review/types.d.ts +4 -0
- package/dist/core/runtime/broker/event-projection.d.ts +8 -1
- package/dist/core/runtime/broker/event-projection.js +25 -1
- package/dist/core/runtime/broker/frame-dispatch.d.ts +2 -0
- package/dist/core/runtime/broker/frame-dispatch.js +50 -8
- package/dist/core/runtime/broker/inbox.d.ts +4 -0
- package/dist/core/runtime/broker/inbox.js +17 -8
- package/dist/core/runtime/broker/message-ledger.d.ts +53 -0
- package/dist/core/runtime/broker/message-ledger.js +143 -0
- package/dist/core/runtime/broker/rebind.js +14 -0
- package/dist/core/runtime/broker-protocol.d.ts +46 -1
- package/dist/core/runtime/broker.js +11 -2
- package/dist/core/runtime/interactive-deliver.d.ts +5 -2
- package/dist/core/runtime/interactive-deliver.js +6 -3
- package/dist/core/runtime/shell-expansion.d.ts +32 -0
- package/dist/core/runtime/shell-expansion.js +102 -0
- package/dist/core/session-model/session-state.d.ts +9 -4
- package/dist/core/session-model/session-state.js +5 -1
- package/dist/daemon/api/handlers/broker-ops.js +8 -0
- package/dist/daemon/api/handlers/crons.js +14 -1
- package/dist/daemon/api/handlers/inbox.js +5 -0
- package/dist/daemon/api/handlers/memory.d.ts +2 -0
- package/dist/daemon/api/handlers/memory.js +48 -0
- package/dist/daemon/api/handlers/messages.js +7 -1
- package/dist/daemon/api/handlers/reviews.js +7 -5
- package/dist/daemon/api/map.js +3 -0
- package/dist/daemon/api/server.js +2 -0
- package/dist/daemon/cron-run.js +71 -3
- package/dist/daemon/crtrd.js +3 -0
- package/dist/daemon/reconcilers/pending-review-submit.d.ts +7 -0
- package/dist/daemon/reconcilers/pending-review-submit.js +35 -0
- package/dist/daemon/review/companion.d.ts +8 -0
- package/dist/daemon/review/companion.js +35 -0
- package/dist/daemon/review/deliver.js +2 -1
- package/dist/daemon/review/finish.d.ts +29 -2
- package/dist/daemon/review/finish.js +75 -2
- package/dist/pi-extensions/canvas-inbox-watcher.js +34 -1
- package/dist/shared/generated-context.d.ts +3 -4
- package/dist/shared/generated-context.js +24 -6
- package/dist/types.d.ts +0 -1
- package/package.json +1 -1
- package/runtime.lock.json +2 -2
|
@@ -31,6 +31,8 @@ export const CONNECTION_FAULT_RECOVERY_BODY = 'The network connection is back on
|
|
|
31
31
|
export const PROVIDER_FAULT_RECOVERY_BODY = 'Your previous turn stopped on a provider fault. Continue from where you left off and retry the work that failed.';
|
|
32
32
|
const PERSONA_TRANSITION_OPEN = '<persona-transition>';
|
|
33
33
|
const PERSONA_TRANSITION_CLOSE = '</persona-transition>';
|
|
34
|
+
const REVIEW_APPROVAL_OPEN = '<crtr-review-approval>';
|
|
35
|
+
const REVIEW_APPROVAL_CLOSE = '</crtr-review-approval>';
|
|
34
36
|
const MODEL_FALLBACK_RECOVERY_OPEN = '<model-fallback-recovery>';
|
|
35
37
|
const MODEL_FALLBACK_RECOVERY_CLOSE = '</model-fallback-recovery>';
|
|
36
38
|
const STRUCTURED_OUTPUT_REPROMPT_PREFIX = 'You must call the `submit` tool with a result matching the required schema before you can stop. You cannot finish or go dormant any other way while this request is pending.\n\nRequired schema:\n\n```json\n';
|
|
@@ -39,6 +41,10 @@ const STRUCTURED_OUTPUT_REPROMPT_SUFFIX = '\n```';
|
|
|
39
41
|
export function formatPersonaTransition(guidance) {
|
|
40
42
|
return `${PERSONA_TRANSITION_OPEN}\n${guidance}\n${PERSONA_TRANSITION_CLOSE}`;
|
|
41
43
|
}
|
|
44
|
+
/** Mark a daemon-delivered review approval for compact viewer presentation. */
|
|
45
|
+
export function formatReviewApproval(body) {
|
|
46
|
+
return `${REVIEW_APPROVAL_OPEN}\n${body}\n${REVIEW_APPROVAL_CLOSE}`;
|
|
47
|
+
}
|
|
42
48
|
/** Format the stop guard's dynamic structured-output mandate. */
|
|
43
49
|
export function formatStructuredOutputReprompt(schema) {
|
|
44
50
|
return `${STRUCTURED_OUTPUT_REPROMPT_PREFIX}${schema}${STRUCTURED_OUTPUT_REPROMPT_SUFFIX}`;
|
|
@@ -55,14 +61,18 @@ const YIELD_MESSAGE_BLOCK = /<yield-message>([\s\S]*?)<\/yield-message>/;
|
|
|
55
61
|
/** The display-only disclosure body for a generated context card. The full
|
|
56
62
|
* message remains in `body` for the model and transcript bookkeeping; the two
|
|
57
63
|
* prompt-sized cards expose the one piece a person needs to inspect. */
|
|
64
|
+
function unmarkReviewApprovals(body) {
|
|
65
|
+
return body.replaceAll(`${REVIEW_APPROVAL_OPEN}\n`, '').replaceAll(`\n${REVIEW_APPROVAL_CLOSE}`, '');
|
|
66
|
+
}
|
|
58
67
|
export function generatedContextExpandedBody(presentation) {
|
|
68
|
+
let body = presentation.body;
|
|
59
69
|
if (presentation.label === 'crtr context') {
|
|
60
|
-
|
|
70
|
+
body = AUTO_LOADED_CONTEXT_BLOCK.exec(body)?.[1]?.trim() ?? '';
|
|
61
71
|
}
|
|
62
|
-
if (presentation.kind === 'revive') {
|
|
63
|
-
|
|
72
|
+
else if (presentation.kind === 'revive') {
|
|
73
|
+
body = YIELD_MESSAGE_BLOCK.exec(body)?.[1]?.trim() ?? '';
|
|
64
74
|
}
|
|
65
|
-
return
|
|
75
|
+
return unmarkReviewApprovals(body);
|
|
66
76
|
}
|
|
67
77
|
/** Plain text from a generated message's string or text-block content. */
|
|
68
78
|
export function generatedContextText(message) {
|
|
@@ -88,7 +98,9 @@ function nudgeSummary(body) {
|
|
|
88
98
|
}
|
|
89
99
|
// Stable header emitted by core/feed/inbox.ts coalesce(). Human-authored inbox
|
|
90
100
|
// messages are deliberately delivered verbatim and never carry this header.
|
|
91
|
-
|
|
101
|
+
// Senders are node ids, the two reserved words, or the daemon itself (crtrd —
|
|
102
|
+
// review notes and other daemon-originated node messages).
|
|
103
|
+
const INBOX_HEADER_RE = /^From ([a-z0-9]+(?:-[a-z0-9]+)+|system|human|crtrd) — (\d+) update/m;
|
|
92
104
|
export function isInboxDigest(text) {
|
|
93
105
|
return INBOX_HEADER_RE.test(text);
|
|
94
106
|
}
|
|
@@ -96,7 +108,7 @@ export function extractInboxSender(text) {
|
|
|
96
108
|
return INBOX_HEADER_RE.exec(text)?.[1] ?? null;
|
|
97
109
|
}
|
|
98
110
|
function inboxSummary(body) {
|
|
99
|
-
const headers = [...body.matchAll(/^From ([a-z0-9]+(?:-[a-z0-9]+)+|system|human) — (\d+) update/gm)];
|
|
111
|
+
const headers = [...body.matchAll(/^From ([a-z0-9]+(?:-[a-z0-9]+)+|system|human|crtrd) — (\d+) update/gm)];
|
|
100
112
|
if (headers.length === 0)
|
|
101
113
|
return 'node update';
|
|
102
114
|
const updates = headers.reduce((total, match) => total + Number(match[2] ?? 0), 0);
|
|
@@ -109,6 +121,9 @@ function inboxSummary(body) {
|
|
|
109
121
|
function isPersonaTransition(body) {
|
|
110
122
|
return body.startsWith(`${PERSONA_TRANSITION_OPEN}\n`) && body.endsWith(`\n${PERSONA_TRANSITION_CLOSE}`);
|
|
111
123
|
}
|
|
124
|
+
function isReviewApproval(body) {
|
|
125
|
+
return body.startsWith(`${REVIEW_APPROVAL_OPEN}\n`) && body.endsWith(`\n${REVIEW_APPROVAL_CLOSE}`);
|
|
126
|
+
}
|
|
112
127
|
function isStructuredOutputReprompt(body) {
|
|
113
128
|
if (!body.startsWith(STRUCTURED_OUTPUT_REPROMPT_PREFIX) || !body.endsWith(STRUCTURED_OUTPUT_REPROMPT_SUFFIX)) {
|
|
114
129
|
return false;
|
|
@@ -189,6 +204,9 @@ export function generatedContextPresentation(message) {
|
|
|
189
204
|
if (isInboxDigest(body)) {
|
|
190
205
|
return { kind: 'inbox', label: 'crtr inbox', summary: inboxSummary(body), body };
|
|
191
206
|
}
|
|
207
|
+
if (isReviewApproval(body)) {
|
|
208
|
+
return { kind: 'review-approval', label: 'crtr review', summary: 'human review approved', body };
|
|
209
|
+
}
|
|
192
210
|
if (isPersonaTransition(body)) {
|
|
193
211
|
return {
|
|
194
212
|
kind: 'persona-transition',
|
package/dist/types.d.ts
CHANGED
|
@@ -263,7 +263,6 @@ export interface ScopeState {
|
|
|
263
263
|
last_updated?: string;
|
|
264
264
|
}>;
|
|
265
265
|
last_self_check?: string;
|
|
266
|
-
bootstrap_done?: boolean;
|
|
267
266
|
/** The name of the remote canvas target `crtr canvas use` last selected
|
|
268
267
|
* (see `RemoteCanvasConfig`), or `null`/omitted for local. Read by
|
|
269
268
|
* `resolveCanvasSource` (`core/canvas/source.ts`) as the durable fallback
|
package/package.json
CHANGED
package/runtime.lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/crouter",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.182",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@north-light/crouter",
|
|
9
|
-
"version": "0.3.
|
|
9
|
+
"version": "0.3.182",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|