@corenel/harness 0.7.5 → 0.9.0
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/conversation.d.ts +15 -0
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +13 -1
- package/dist/conversation.js.map +1 -1
- package/dist/core/compactHistory.d.ts +84 -0
- package/dist/core/compactHistory.d.ts.map +1 -0
- package/dist/core/compactHistory.js +206 -0
- package/dist/core/compactHistory.js.map +1 -0
- package/dist/core/contextPressure.d.ts +45 -0
- package/dist/core/contextPressure.d.ts.map +1 -0
- package/dist/core/contextPressure.js +69 -0
- package/dist/core/contextPressure.js.map +1 -0
- package/dist/core/loop.d.ts +25 -0
- package/dist/core/loop.d.ts.map +1 -1
- package/dist/core/loop.js +176 -13
- package/dist/core/loop.js.map +1 -1
- package/dist/core/pricing.d.ts +30 -1
- package/dist/core/pricing.d.ts.map +1 -1
- package/dist/core/pricing.js +50 -21
- package/dist/core/pricing.js.map +1 -1
- package/dist/core/summarize.d.ts +10 -0
- package/dist/core/summarize.d.ts.map +1 -0
- package/dist/core/summarize.js +66 -0
- package/dist/core/summarize.js.map +1 -0
- package/dist/guardrail/builtins.d.ts.map +1 -1
- package/dist/guardrail/builtins.js +9 -3
- package/dist/guardrail/builtins.js.map +1 -1
- package/dist/guardrail/validate.d.ts.map +1 -1
- package/dist/guardrail/validate.js +6 -2
- package/dist/guardrail/validate.js.map +1 -1
- package/dist/prompts/host.d.ts +23 -0
- package/dist/prompts/host.d.ts.map +1 -1
- package/dist/prompts/host.js.map +1 -1
- package/dist/prompts/index.d.ts +14 -0
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +43 -2
- package/dist/prompts/index.js.map +1 -1
- package/dist/prompts/library/defaults.generated.js +5 -5
- package/dist/prompts/library/defaults.generated.js.map +1 -1
- package/dist/providers/contextWindow.d.ts +23 -4
- package/dist/providers/contextWindow.d.ts.map +1 -1
- package/dist/providers/contextWindow.js +25 -0
- package/dist/providers/contextWindow.js.map +1 -1
- package/dist/sessions/checkpointStore.d.ts +12 -0
- package/dist/sessions/checkpointStore.d.ts.map +1 -0
- package/dist/sessions/checkpointStore.js +48 -0
- package/dist/sessions/checkpointStore.js.map +1 -0
- package/dist/sessions/fileSessionStore.d.ts +4 -0
- package/dist/sessions/fileSessionStore.d.ts.map +1 -1
- package/dist/sessions/fileSessionStore.js +28 -2
- package/dist/sessions/fileSessionStore.js.map +1 -1
- package/dist/skillSource.d.ts +36 -0
- package/dist/skillSource.d.ts.map +1 -0
- package/dist/skillSource.js +105 -0
- package/dist/skillSource.js.map +1 -0
- package/dist/skills.d.ts +38 -2
- package/dist/skills.d.ts.map +1 -1
- package/dist/skills.js +64 -9
- package/dist/skills.js.map +1 -1
- package/dist/tools/builtins.d.ts.map +1 -1
- package/dist/tools/builtins.js +50 -2
- package/dist/tools/builtins.js.map +1 -1
- package/dist/tools/project.d.ts +11 -0
- package/dist/tools/project.d.ts.map +1 -0
- package/dist/tools/project.js +133 -0
- package/dist/tools/project.js.map +1 -0
- package/package.json +2 -2
|
@@ -4,7 +4,11 @@ export const STANDARD_POLICY = {
|
|
|
4
4
|
name: 'standard',
|
|
5
5
|
description: 'Read-only tools run automatically; writes ask for approval.',
|
|
6
6
|
onViolation: 'stop',
|
|
7
|
-
maxTurns
|
|
7
|
+
// maxTurns counts iterations WITHIN one user message (one model call plus
|
|
8
|
+
// its tool round-trip), not messages across a conversation -- 8 was
|
|
9
|
+
// exhausted inside a single tool-heavy reply. 0 means unlimited (see
|
|
10
|
+
// core/loop.ts); this default stays a finite backstop.
|
|
11
|
+
maxTurns: 40,
|
|
8
12
|
permissions: {
|
|
9
13
|
'prompd:propose_edit': 'allow', // proposals are reviewed in the diff UI, not applied directly
|
|
10
14
|
'system:*': 'deny', // harness self-configuration is never automatic
|
|
@@ -17,7 +21,7 @@ export const READ_ONLY_POLICY = {
|
|
|
17
21
|
name: 'read-only',
|
|
18
22
|
description: 'Inspection only — all writes and side effects are refused.',
|
|
19
23
|
onViolation: 'stop',
|
|
20
|
-
maxTurns:
|
|
24
|
+
maxTurns: 40, // see STANDARD_POLICY: counts iterations within one reply, not conversation turns
|
|
21
25
|
tools: {
|
|
22
26
|
deny: [
|
|
23
27
|
'fs:write_file', 'fs:create_file', 'fs:delete_file', 'fs:rename_file',
|
|
@@ -50,7 +54,9 @@ export const AUTONOMOUS_POLICY = {
|
|
|
50
54
|
name: 'autonomous',
|
|
51
55
|
description: 'Everything runs automatically — no approval prompts (system config still asks).',
|
|
52
56
|
onViolation: 'warn',
|
|
53
|
-
|
|
57
|
+
// Higher than the other builtins: nobody is watching an autonomous run turn
|
|
58
|
+
// by turn, so it gets more headroom before the backstop kicks in.
|
|
59
|
+
maxTurns: 80,
|
|
54
60
|
permissions: {
|
|
55
61
|
'system:*': 'ask', // even unattended, never silently reconfigure the harness
|
|
56
62
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtins.js","sourceRoot":"","sources":["../../guardrail/builtins.ts"],"names":[],"mappings":"AAQA,6EAA6E;AAC7E,MAAM,CAAC,MAAM,eAAe,GAAW;IACrC,OAAO,EAAE,CAAC;IACV,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,6DAA6D;IAC1E,WAAW,EAAE,MAAM;IACnB,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"builtins.js","sourceRoot":"","sources":["../../guardrail/builtins.ts"],"names":[],"mappings":"AAQA,6EAA6E;AAC7E,MAAM,CAAC,MAAM,eAAe,GAAW;IACrC,OAAO,EAAE,CAAC;IACV,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,6DAA6D;IAC1E,WAAW,EAAE,MAAM;IACnB,0EAA0E;IAC1E,oEAAoE;IACpE,qEAAqE;IACrE,uDAAuD;IACvD,QAAQ,EAAE,EAAE;IACZ,WAAW,EAAE;QACX,qBAAqB,EAAE,OAAO,EAAE,8DAA8D;QAC9F,UAAU,EAAE,MAAM,E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gBAAgB;IAC7B,UAAU,EAAE,iBAAiB;CAC9B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../guardrail/validate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAoD,MAAM,mBAAmB,CAAC;AAkBlG,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AA2BD,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,sBAAsB,
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../guardrail/validate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAoD,MAAM,mBAAmB,CAAC;AAkBlG,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AA2BD,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,sBAAsB,CAuErE"}
|
|
@@ -54,8 +54,12 @@ export function validatePolicy(input) {
|
|
|
54
54
|
if (o.onViolation !== undefined && !ACTIONS.includes(o.onViolation)) {
|
|
55
55
|
errors.push(`Policy.onViolation must be one of: ${ACTIONS.join(', ')}.`);
|
|
56
56
|
}
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
// 0 is a valid, meaningful value here -- explicit "unlimited turns" (see
|
|
58
|
+
// core/loop.ts) -- so maxTurns alone accepts a non-negative integer, not
|
|
59
|
+
// the strictly-positive isPosInt every other budget field requires.
|
|
60
|
+
if (o.maxTurns !== undefined && !(typeof o.maxTurns === 'number' && Number.isInteger(o.maxTurns) && o.maxTurns >= 0)) {
|
|
61
|
+
errors.push('Policy.maxTurns must be a non-negative integer (0 means unlimited).');
|
|
62
|
+
}
|
|
59
63
|
if (o.maxToolCalls !== undefined && !isPosInt(o.maxToolCalls))
|
|
60
64
|
errors.push('Policy.maxToolCalls must be a positive integer.');
|
|
61
65
|
if (o.tools !== undefined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../guardrail/validate.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,GAAsB,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AAC3D,MAAM,OAAO,GAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACpD,MAAM,UAAU,GAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAE/D;mFACmF;AACnF,MAAM,aAAa,GAAoC;IACrD,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM;IACxC,IAAI,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM;CACzC,CAAC;AAEF,kFAAkF;AAClF,SAAS,cAAc,CAAC,CAAU;IAChC,OAAO,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9D,CAAC;AAQD,SAAS,aAAa,CAAC,CAAU;IAC/B,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC;AACnE,CAAC;AACD,SAAS,QAAQ,CAAC,CAAU;IAC1B,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/D,CAAC;AACD;qFACqF;AACrF,SAAS,QAAQ,CAAC,CAAU;IAC1B,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ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U,CAAC,QAAQ,CAAC,CAAC,CAAC,UAA4B,CAAC,EAAE,CAAC;QACvF,MAAM,CAAC,IAAI,CAAC,qCAAqC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7E,CAAC;IACD,IAAI,CAAC,CAAC,aAAa,KAAK,SAAS,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE,CAAC;QAChE,MAAM,CAAC,IAAI,CAAC,iDAAiD,CAAC,CAAC;IACjE,CAAC;IAED,IAAI,MAAM,CAAC,MAAM;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAChD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAe,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;AAC3D,CAAC"}
|
package/dist/prompts/host.d.ts
CHANGED
|
@@ -58,6 +58,29 @@ export interface PromptHost {
|
|
|
58
58
|
* itself with this, so a shared prompt cannot hardcode either brand. Optional:
|
|
59
59
|
* a host that does not set one gets the neutral default. */
|
|
60
60
|
appName?(): string;
|
|
61
|
+
/**
|
|
62
|
+
* The PRODUCT's own guidance on the tools this run actually has — shipped in
|
|
63
|
+
* the binary, not in the config workspace.
|
|
64
|
+
*
|
|
65
|
+
* WHY A HOOK AND NOT A FILE. `tools/guidance.md` is one shipped default
|
|
66
|
+
* seeded into every host's workspace, so anything host-specific written
|
|
67
|
+
* there would be wrong somewhere: the browser has no shell, and telling it
|
|
68
|
+
* about one is how the base prompt came to advertise `search_packages` to a
|
|
69
|
+
* CLI that never registers it. `reconcileConfig` iterates a module constant,
|
|
70
|
+
* so per-host default FILES are not available without changing how seeding
|
|
71
|
+
* works. A hook is the seam `appName` and `siteIndex` already use.
|
|
72
|
+
*
|
|
73
|
+
* KEYED ON THE TOOL NAMES, not on the host, because the host is the wrong
|
|
74
|
+
* granularity: the sidecar runs on this same node host but gates its shell
|
|
75
|
+
* behind `--allow-shell`, so "node means there is a shell" is false. An
|
|
76
|
+
* implementation must describe only what it is handed and stay silent about
|
|
77
|
+
* the rest — guidance for an absent tool is the original bug wearing a
|
|
78
|
+
* different hat.
|
|
79
|
+
*
|
|
80
|
+
* Composed ABOVE the workspace's `tools/guidance.md`, so the user's file is
|
|
81
|
+
* the last word and can qualify or contradict it.
|
|
82
|
+
*/
|
|
83
|
+
toolGuidance?(toolNames: string[]): string;
|
|
61
84
|
}
|
|
62
85
|
/** Wire the host bits at boot (the app calls this before composing). */
|
|
63
86
|
export declare function setPromptHost(h: PromptHost): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../prompts/host.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,yDAAyD;AACzD,MAAM,WAAW,YAAY;IAAG,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE;AAChE,8DAA8D;AAC9D,MAAM,WAAW,aAAa;IAAG,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE;AAElD;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,UAAU,CAAC;AAEtD,MAAM,WAAW,UAAU;IACzB,+DAA+D;IAC/D,SAAS,EAAE,WAAW,CAAC;IACvB,+DAA+D;IAC/D,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD;;;+DAG2D;IAC3D,QAAQ,CAAC,IAAI,cAAc,CAAC;IAC5B,uDAAuD;IACvD,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAAC;IACpC,yEAAyE;IACzE,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,aAAa,CAA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Ae,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IACxG,+DAA+D;IAC/D,SAAS,IAAI,MAAM,CAAC;IACpB;;;;;;;;;;;;OAYG;IACH,gBAAgB,CAAC,IAAI,WAAW,GAAG,IAAI,CAAC;IACxC;;gEAE4D;IAC5D,OAAO,CAAC,IAAI,MAAM,CAAC;IACnB;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,YAAY,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;CAC5C;AAID,wEAAwE;AACxE,wBAAgB,aAAa,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI,CAAc;AAEhE,wBAAgB,UAAU,IAAI,UAAU,CAGvC;AAED,8EAA8E;AAC9E,wBAAgB,eAAe,IAAI,WAAW,CAAmC"}
|
package/dist/prompts/host.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.js","sourceRoot":"","sources":["../../prompts/host.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"host.js","sourceRoot":"","sources":["../../prompts/host.ts"],"names":[],"mappings":"AA8FA,IAAI,IAAI,GAAsB,IAAI,CAAC;AAEnC,wEAAwE;AACxE,MAAM,UAAU,aAAa,CAAC,CAAa,IAAU,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;AAEhE,MAAM,UAAU,UAAU;IACxB,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IACjF,OAAO,IAAI,CAAC;AACd,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,eAAe,KAAkB,OAAO,UAAU,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC"}
|
package/dist/prompts/index.d.ts
CHANGED
|
@@ -45,7 +45,21 @@ export interface ComposeArgs {
|
|
|
45
45
|
/** Optional host hook: the merged MEMORY.md index (both scopes). Injected into
|
|
46
46
|
* file_context so the agent knows what it can recall. Absent/empty -> no block. */
|
|
47
47
|
memoryIndex?: () => Promise<string>;
|
|
48
|
+
/** Facts about THIS run that the model cannot infer from anything else it is
|
|
49
|
+
* given — the host's working directory, its platform. One `Label: value` per
|
|
50
|
+
* entry. The DATE is always added here by compose (every host has a clock),
|
|
51
|
+
* so a host passing nothing still gets a dated prompt.
|
|
52
|
+
*
|
|
53
|
+
* THE BUG this closes: the terminal face composed with `{ mode, tools }` and
|
|
54
|
+
* nothing else, so the agent knew neither the date, nor the directory it was
|
|
55
|
+
* standing in, nor that it was on Windows — and guessed all three, which on
|
|
56
|
+
* Windows costs a failed command. */
|
|
57
|
+
runFacts?: string[];
|
|
48
58
|
}
|
|
59
|
+
/** The {{ run_context }} block: the date (always) plus whatever the host knows.
|
|
60
|
+
* `toISOString().slice(0, 10)` deliberately — a UTC calendar date is a fact the
|
|
61
|
+
* model can reason from, where a locale-formatted one is ambiguous to parse. */
|
|
62
|
+
export declare function formatRunContext(extra?: string[]): string;
|
|
49
63
|
/**
|
|
50
64
|
* Assemble the agent system prompt. The system prompt is the config file
|
|
51
65
|
* systems/system-base.md (a .prmd with declared parameters); @prompd/core
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../prompts/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C;iFACiF;AACjF,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAe3G;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO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+49,13 @@ export async function compileConfigTemplate(path, params, source) {
|
|
|
49
49
|
return liveSrc.trim();
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
+
/** The {{ run_context }} block: the date (always) plus whatever the host knows.
|
|
53
|
+
* `toISOString().slice(0, 10)` deliberately — a UTC calendar date is a fact the
|
|
54
|
+
* model can reason from, where a locale-formatted one is ambiguous to parse. */
|
|
55
|
+
export function formatRunContext(extra = []) {
|
|
56
|
+
const lines = [`Date: ${new Date().toISOString().slice(0, 10)}`, ...extra.map((s) => s.trim()).filter(Boolean)];
|
|
57
|
+
return lines.join('\n');
|
|
58
|
+
}
|
|
52
59
|
/** Render tool definitions as a markdown list for the {{ tools }} parameter. */
|
|
53
60
|
function formatTools(tools) {
|
|
54
61
|
return tools && tools.length ? formatToolLines(tools) : '';
|
|
@@ -78,7 +85,27 @@ export async function composeAgentSystem(args) {
|
|
|
78
85
|
]);
|
|
79
86
|
// The default tool-guidance body is an HTML-comment placeholder — drop it so it
|
|
80
87
|
// doesn't leak into the prompt; real guidance (no comment) passes through.
|
|
81
|
-
const
|
|
88
|
+
const userGuidance = toolGuidanceRaw.replace(/<!--[\s\S]*?-->/g, '').trim();
|
|
89
|
+
/* The PRODUCT's guidance for the tools this run actually has (PromptHost.
|
|
90
|
+
* toolGuidance), above the user's file so their file is the last word.
|
|
91
|
+
*
|
|
92
|
+
* Names come from `args.tools`, which is the same array the caller turns into
|
|
93
|
+
* the model's function schemas. A caller that passes `toolsText` instead (the
|
|
94
|
+
* worker, filling TOOLS_MARKER later) has no names here and gets no host
|
|
95
|
+
* guidance -- correct, since guidance for tools nobody enumerated would be
|
|
96
|
+
* guidance for tools that might not be there.
|
|
97
|
+
*
|
|
98
|
+
* Best-effort: a host hook that throws must not take the prompt down. */
|
|
99
|
+
let hostGuidance = '';
|
|
100
|
+
if (args.includeToolGuidance !== false) {
|
|
101
|
+
try {
|
|
102
|
+
hostGuidance = promptHost().toolGuidance?.((args.tools ?? []).map((t) => t.name))?.trim() ?? '';
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
hostGuidance = '';
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const tool_guidance = [hostGuidance, userGuidance].filter(Boolean).join('\n\n');
|
|
82
109
|
// Enabled skills inject their SKILL.md as an extra context block (with a gated-
|
|
83
110
|
// scripts note). Read-only + best-effort — a skills failure never breaks compose.
|
|
84
111
|
const skillsBlock = await enabledSkillInstructions(args.skillAllow).catch(() => '');
|
|
@@ -98,7 +125,21 @@ export async function composeAgentSystem(args) {
|
|
|
98
125
|
mode_hint,
|
|
99
126
|
tool_guidance,
|
|
100
127
|
tools: args.toolsText ?? formatTools(args.tools),
|
|
101
|
-
|
|
128
|
+
run_context: formatRunContext(args.runFacts),
|
|
129
|
+
/* THREE SLOTS, not one. These used to be concatenated into `file_context`,
|
|
130
|
+
* whose own declared description is "the editor file / selection /
|
|
131
|
+
* compiled-output context block" -- so skills and memory were filed as
|
|
132
|
+
* incidental context, below the mode hint, in a parameter documented to
|
|
133
|
+
* hold something else. Skills are not context: they are instructions that
|
|
134
|
+
* change how a task is done, and burying sixteen of them under a slot that
|
|
135
|
+
* means "here is the open file" is what made them easy to ignore.
|
|
136
|
+
*
|
|
137
|
+
* ORDER in the template is skills, memory, then file_context -- the editor
|
|
138
|
+
* context stays LAST, nearest the user's message, because it is the part
|
|
139
|
+
* that changes every turn. */
|
|
140
|
+
skills: skillsBlock,
|
|
141
|
+
memory: memoryBlock,
|
|
142
|
+
file_context: (args.contextText || '').trim(),
|
|
102
143
|
...(args.params || {}),
|
|
103
144
|
}, args.systemText);
|
|
104
145
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../prompts/index.ts"],"names":[],"mappings":"AAAA;;mEAEmE;AACnE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;A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OAAO,qBAAqB,CAAC,UAAU,EAAE;QACvC,0EAA0E;QAC1E,sEAAsE;QACtE,2DAA2D;QAC3D,GAAG,EAAE,UAAU,EAAE,CAAC,OAAO,EAAE,EAAE,IAAI,QAAQ;QACzC,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE;QACvB,IAAI;QACJ,SAAS;QACT,aAAa;QACb,KAAK,EAAE,IAAI,CAAC,SAAS,IAAI,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC;QAChD,WAAW,EAAE,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC;QAC5C;;;;;;;;;;sCAU8B;QAC9B,MAAM,EAAE,WAAW;QACnB,MAAM,EAAE,WAAW;QACnB,YAAY,EAAE,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;QAC7C,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;KACvB,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;AACtB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,aAAa,GAAG,EAAE;IACxD,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,wBAAwB,CAAC,CAAC;IAC3D,MAAM,SAAS,GAAG,UAAU,EAAE,CAAC,SAAS,EAAE,CAAC;IAC3C,2EAA2E;IAC3E,2EAA2E;IAC3E,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC,OAAO,EAAE,EAAE,IAAI,QAAQ,CAAC;IACjD,OAAO,iBAAiB,CAAC,OAAO,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC,CAAC;AACvF,CAAC"}
|
|
@@ -8,10 +8,10 @@ export const RAW_DEFAULTS = {
|
|
|
8
8
|
"editor/inline-assist-suggestions.md": "# Inline \"Ask Corenel\" suggestion chips — one per line.\n# Format: Label :: instruction sent to the model (no \"::\" means the line is both)\n# $PARAM is replaced with the prompt's first parameter; lines that use it are\n# skipped when the prompt has no parameters. Lines starting with # are ignored.\nUse the $PARAM parameter :: Add a clear instruction line that uses the {{ $PARAM }} parameter.\nSpecify the output format :: Add an instruction specifying the desired output format — length, structure, and tone.\nMake the instructions clearer :: Rewrite the nearby prompt instruction to be clearer, more specific, and unambiguous.\nAdd a constraint :: Add a constraint or rule to the prompt instructions (what to avoid or always do).\n",
|
|
9
9
|
"guards.json": "[\n {\n \"_comment\": \"Declarative client-side feature guards (NON-authoritative — for defaults/UX; real enforcement is the backend entitlements API). Copy an entry and remove \\\"disabled\\\". rule: \\\"require-auth\\\" or \\\"free-quota\\\" (with \\\"limit\\\"). feature: a FeatureId like \\\"llm-execution\\\", or \\\"*\\\". action: { \\\"kind\\\": \\\"sign-in\\\" } or { \\\"kind\\\": \\\"upgrade\\\", \\\"label\\\": \\\"...\\\" }.\",\n \"disabled\": true,\n \"id\": \"example-free-quota\",\n \"feature\": \"llm-execution\",\n \"rule\": \"free-quota\",\n \"limit\": 3,\n \"reason\": \"Free limit reached — sign in to keep going.\",\n \"action\": { \"kind\": \"sign-in\" }\n }\n]\n",
|
|
10
10
|
"languages/prmd.md": "{% raw %}\n# PRMD File Format Overview\n\nPRMD files are structured in YAML format and are used to define prompts for various applications within the Prompd system. Each file contains essential metadata in the frontmatter followed by the body content, which is where the prompt logic and structure reside.\n\n## Field Descriptions\n- **id**: A unique identifier for the prompt file, usually in kebab-case.\n- **name**: A brief title for the prompt that identifies it.\n- **version**: The version number of the prompt file, following semantic versioning.\n- **description**: Optional human-readable summary.\n- **model** / **provider**: Optional default model + provider for runs.\n- **inherits**: A path to another prompt file whose body this one extends (the parent renders first, then this file's body). Resolved at compile time — siblings locally, registry refs on the backend.\n- **using**: Optional list of package refs imported for context/blocks; each `{ name: \"@scope/pkg@1.2.0\", prefix: \"@alias\" }`.\n- **parameters**: A list of typed input variables for the prompt (see below).\n\n## Parameter Types\nPrompd supports thirteen parameter types covering scalars, dates, structured data, and binary content.\n\n| Type | Description |\n|----------|-----------------------------------------------------------------|\n| string | Plain text |\n| enum | A value restricted to a fixed set of options (see Enums below) |\n| number | Integer or float (generic numeric) |\n| integer | Whole number only — rejects floats |\n| float | Decimal number |\n| boolean | true / false |\n| date | Calendar date → `YYYY-MM-DD`. Resolved at compile time. |\n| datetime | Date + time → `YYYY-MM-DDTHH:mm:ss` (local). Resolved at compile time. |\n| array | JSON array with untyped elements |\n| object | Plain key-value object (non-array) |\n| json | Any JSON value — arrays of objects, nested structures, etc. |\n| file | File path; caller supplies the file content as a string |\n| base64 | Base64-encoded binary (images, PDFs, blobs for multimodal LLMs) |\n\n### Enums (restricted values)\nAn `enum` parameter limits the value to a fixed set of choices. Provide the allowed values as a JSON array of strings in an `enum:` field, e.g. `[\"small\", \"medium\", \"large\"]` (a YAML block list works too). Set `type: enum` — or omit `type`, since it's inferred when `enum` is present. The `default:`, if given, must be one of the options.\n\n```yaml\n- name: tone\n type: enum\n enum: [\"detailed\", \"summary\", \"concise\"]\n default: \"summary\"\n```\n\n### Date & datetime defaults\n`date` and `datetime` defaults accept `now` / `today`, a relative offset `now±N<unit>`, or a literal ISO date. Units: `d` (days), `w` (weeks), `mo` (months), `y` (years); `datetime` also `h` (hours), `min`, `s`. The value is resolved at compile time, so each run uses the current clock.\n\nExamples (assume today is 2026-06-11):\n\n| Default | Type | Resolves to |\n|----------------|----------|------------------------|\n| `now` | date | `2026-06-11` |\n| `now-8d` | date | `2026-06-03` |\n| `now-2w` | date | `2026-05-28` |\n| `now-1mo` | date | `2026-05-11` |\n| `now+1y` | date | `2027-06-11` |\n| `now` | datetime | `2026-06-11T09:30:00` |\n| `now-3h` | datetime | `2026-06-11T06:30:00` |\n| `2025-01-15` | date | `2025-01-15` |\n\n## Body (Markdown + Jinja2/Nunjucks)\n- `{{ param }}` and `{{ param | filter }}` interpolation.\n- `{% if %}` / `{% elif %}` / `{% else %}` / `{% endif %}` conditionals.\n- `{% for x in list %} … {% endfor %}` loops.\n- `{% include %}` and inherited blocks resolve against the workspace + registry at compile time.\n- Only declared parameters are guaranteed to exist; treat any other variable as undefined.\n\n## Example PRMD File\n```yaml\n---\nid: report-window\nname: Report Window\nversion: 1.0.0\nparameters:\n - name: user_name\n type: string\n default: \"Guest\"\n - name: since\n type: date\n default: \"now-8d\" # 8 days ago, resolved at compile time\n - name: generated_at\n type: datetime\n default: \"now\"\n---\nHello, {{ user_name }}! Here is your report covering everything since {{ since }} (generated {{ generated_at }}).\n```\n{% endraw %}\n",
|
|
11
|
-
"modes/auto.md": "---\nid: auto\nname: Auto\ndescription:
|
|
12
|
-
"modes/brainstorm.md": "---\nid: brainstorm\nname: Brainstorm\ndescription:
|
|
13
|
-
"modes/edit.md": "---\nid: edit\nname: Edit\ndescription:
|
|
14
|
-
"modes/plan.md": "---\nid: plan\nname: Plan\ndescription:
|
|
11
|
+
"modes/auto.md": "---\nid: auto\nname: Auto\ndescription: Act on the request, deciding what is cheap to decide and asking only what is expensive to get wrong.\n---\nMode: AUTO — act.\n\nMake the smallest set of decisions needed to start, say plainly what you assumed, and build a thin working slice before elaborating it. A broad request is not a reason to stop and interview the user.\n\nAsk only where a wrong guess is expensive to undo — the data model, anything touching security, privacy or regulated data, and where the thing runs. Keep it to two or three questions and ask them before you build, not after. Everything that is cheap to change later is an assumption to state, not a question to ask.\n",
|
|
12
|
+
"modes/brainstorm.md": "---\nid: brainstorm\nname: Brainstorm\ndescription: Generate genuinely different options with their trade-offs, and recommend one.\n---\nMode: BRAINSTORM — explore options and alternatives; be generative.\n\nGive at least two genuinely different approaches, not one approach with its dial turned. Name what each is good at and what it costs, then say which you would pick and why. Do not edit files.\n",
|
|
13
|
+
"modes/edit.md": "---\nid: edit\nname: Edit\ndescription: Make the smallest concrete change that does the job.\n---\nMode: EDIT — make the smallest concrete change that does the job, and say what you changed.\n\nWhen a file is open in the editor, prefer propose_edit with the COMPLETE new file content, so the user reviews a diff before anything is applied.\n",
|
|
14
|
+
"modes/plan.md": "---\nid: plan\nname: Plan\ndescription: Settle the shape-changing decisions first, then outline the approach without mutating anything.\n---\nMode: PLAN — decide before acting.\n\nFirst surface the decisions that change the SHAPE of the result and ask about those; an outline built on an unasked question is wasted work. Then think step by step and lay out the approach, with the trade-offs you are choosing between made explicit.\n\nAvoid mutating tools. Producing a plan the user can argue with is the deliverable here.\n",
|
|
15
15
|
"crew/memory.md": "---\nid: crew-memory\nname: Crew agent — memory block\nversion: 1.0.0\ndescription: Told to every crew agent about its own memory folder. Appended after the agent's own role and instructions, because it is housekeeping and they are the job.\nparameters:\n - name: dir\n type: string\n description: The agent's memory folder, with no trailing slash (e.g. crew/auditor/memory).\n default: \"memory\"\n - name: index\n type: string\n description: Full path of the agent's memory index, derived from dir (e.g. crew/auditor/memory/MEMORY.md).\n default: \"memory/MEMORY.md\"\n---\n--- Memory ---\nYou keep durable notes in your own memory folder, `{{ dir }}/`, one Markdown file per note, alongside `{{ index }}`, an index you maintain for yourself.\nRead `{{ index }}` at the start of a run to recall what you already know, and call recall_memory to look up one note by name. If you can call save_memory, use it for what is worth knowing on a later run, and keep `{{ index }}` current as you do. If a file tool you have takes a `root` argument, you can pass `{{ dir }}/` as `root` to read and edit those files directly.\n",
|
|
16
16
|
"crew/room.md": "---\nid: crew-room\nname: Crew room turn\nversion: 1.0.0\ndescription: Appended to an agent's own definition for a room turn — the etiquette of a shared, rotating conversation and the findings discipline that makes it a plan. Substitution only, so every conditional piece is computed by the caller and passed in whole.\nparameters:\n - name: brief_line\n type: string\n description: What the room met to do, or a line saying it was not recorded.\n default: \"\"\n - name: me_block\n type: string\n description: Who the reader is, with a leading newline. Empty when the id matches no participant.\n default: \"\"\n - name: participants\n type: string\n description: The other participants, one \"- name (id)\" per line.\n default: \"\"\n - name: addressed_block\n type: string\n description: Why this turn is a hand-over and from whom, with two leading newlines. Empty on an ordinary rotation turn.\n default: \"\"\n - name: findings\n type: string\n description: The findings document as it stands, rendered.\n default: \"\"\n - name: max_findings\n type: string\n description: How many findings the room keeps.\n default: \"\"\n - name: ending_rules\n type: string\n description: Who may end this room. Stated differently for a room with a person in it than for a room of agents, so the caller passes the whole paragraph.\n default: \"\"\n - name: max_turns\n type: string\n description: The turn cap that stops the room as a backstop.\n default: \"\"\n---\n--- Room ---\n{{ brief_line }}\n\nThe room is here to discuss and plan that work, not to exchange greetings. Bring\nwhat you know that the others do not, build on what has already been said rather\nthan restating it, and aim at a plan someone could act on.\n\nYou are one participant in a shared room. Everyone here reads the same transcript,\nand each message says who wrote it.{{ me_block }}\n\nThe only participants are you and:\n{{ participants }}\n\nTurns rotate. When your turn comes, say your piece and stop -- do not answer on\nanyone else's behalf. Handing the floor comes after that, and is optional: once you\nhave said something, call address_participant with one participant's id and they will\nspeak once before the rotation resumes. It is one hand-over per turn -- a second call\nis refused and the first one stands -- and you may address only the participants\nlisted above. A turn that only hands the floor around has contributed nothing.\n\nWhen you speak TO someone, write their NAME with an @ in front of it, in the\nsentence itself -- \"@ann, does that scan?\" -- and not as a separate line announcing\nwhat you are about to do. Use the name, never the id in brackets after it: a human\nparticipant's id is a long opaque account string, and @-ing somebody with it is\nunreadable for every person in the room. Only the names listed above are\naddressable this way.{{ addressed_block }}\n\nFindings so far -- what this room has already decided:\n{{ findings }}\n\nThe plan this room is making lives in that findings document. It is built up with\nrecord_finding, and it is not written to a file: a room turn has no file-writing or\nedit-proposing tools, and there is nobody here to review a proposed edit. You can still\nread the workspace to ground what you propose.\n\nRecord a decision the moment the room reaches it, with record_finding: one finding per\ndecision, stated so someone who was not here could act on it. Anything listed above is\nalready recorded -- do not record it again, and do not argue it again either; build on it.\nIf one of them is now wrong, correct it with record_finding and `replaces`, or retire it\nwith withdraw_finding and say why. The room keeps at most {{ max_findings }} findings, so record\ndecisions, not discussion.\n\n{{ ending_rules }}\nThe room also stops on its own after {{ max_turns }} turns or when its budget runs\nout, but that is a backstop for a conversation that failed to end, not the way to\nend one.\n",
|
|
17
17
|
"crew/self-direction.md": "---\nid: crew-self-direction\nname: Crew agent — self-direction block\nversion: 1.0.0\ndescription: Told to a self-directed crew agent about its own loop. Nothing else tells it there IS one, or that the loop ends if it does not schedule itself.\nparameters:\n - name: consequence\n type: string\n description: What happens if the run ends without scheduling — differs depending on whether a fallback wake is configured.\n default: \"\"\n---\n--- Self-direction ---\nYou run on your own schedule. You will not run again unless you call `schedule_self` with the time you should next wake, before this run ends.\n{{ consequence }}\nSo decide, before you finish, whether there is more to do and when it should happen.\n",
|
|
@@ -35,7 +35,7 @@ export const RAW_DEFAULTS = {
|
|
|
35
35
|
"personas/senior-dev.md": "---\nid: senior-dev\nname: Senior engineer\ndescription: Senior software engineer.\n---\nYou are a senior software engineer. Bring that craft to every change:\n- Fit the codebase. Study neighboring code and follow its conventions before writing. Don't assume a library is available — confirm it's already used in the project before depending on it.\n- Write the minimum that solves the task. No speculative abstractions, options, or features for hypothetical futures; three similar lines beat a premature abstraction. No half-finished or stubbed implementations.\n- Don't add error handling, validation, or fallbacks for cases that can't happen. Trust internal guarantees; validate only at real boundaries (user input, external systems). No backwards-compat shims unless asked.\n- Comments are for the non-obvious WHY — a constraint, an invariant, a workaround. Don't narrate what the code already says; default to none.\n- Verify your work before calling a change done. If you couldn't verify something, say so plainly.\n- Be security-minded: no injection, no leaked secrets, least privilege.\n",
|
|
36
36
|
"personas/terse.md": "---\nid: terse\nname: Terse\ndescription: Extremely concise.\n---\nBe extremely concise. One sentence per update. No preamble. No summary unless asked.\n",
|
|
37
37
|
"memory/MEMORY.md": "# Memory index\n\nSaved notes appear here, one line each. The agent adds them with save_memory and\nreads them with recall_memory. This is the global (~/.prompd) memory; a project's\nown notes live in ./.prompd/memory.\n",
|
|
38
|
-
"systems/system-base.md": "---\nid: system-base\nname: Operational system prompt\nversion: 1.0.0\ndescription: The agent's system prompt —
|
|
38
|
+
"systems/system-base.md": "---\nid: system-base\nname: Operational system prompt\nversion: 1.0.0\ndescription: The agent's system prompt — surface-agnostic identity, mode, tool definitions and context composed by @prompd/core. Editor and workflow specifics live in the prompts that inherit this one.\nparameters:\n - name: persona\n type: string\n description: The selected persona's voice/role text, placed first.\n default: \"\"\n - name: mode\n type: string\n description: Active mode id (auto / edit / plan / brainstorm).\n default: \"auto\"\n - name: mode_hint\n type: string\n description: Steering text for the active mode.\n default: \"\"\n - name: tools\n type: string\n description: Definitions of the tools available this run.\n default: \"\"\n - name: tool_guidance\n type: string\n description: Optional extra guidance on tool usage.\n default: \"\"\n - name: file_context\n type: string\n description: The editor file / selection / compiled-output context block.\n default: \"\"\n - name: skills\n type: string\n description: Instructions contributed by the skills enabled for this run.\n default: \"\"\n - name: memory\n type: string\n description: The index of notes saved to this run's memory plane.\n default: \"\"\n - name: run_context\n type: string\n description: Facts about THIS run the model cannot otherwise know — the date, and whatever the host adds (working directory, platform).\n default: \"\"\n - name: app\n type: string\n description: Product name of the host application, used for the agent's own identity.\n default: \"Prompd\"\n---\n{% if persona %}{{ persona }}\n\n{% endif %}You are the {{ app }} assistant. You help the user do real work: reading and changing files, composing and running prompts and workflows, and building software. Work from the context you were given below rather than assuming a particular screen.\n\nVerify before you claim. Do not say something is done, fixed, passing or ready unless you checked it in this conversation and can point at what you checked. If you did not run it, say you did not run it. If a check failed, say so plainly and show what failed. A wrong claim of success costs the user far more than the check would have.\n\nSay what you assumed and what you did not do. A request that leaves room for interpretation gets its decisions named, one line each, so the user can correct one without unpicking the rest. How much you decide for yourself versus ask about is the mode's call, below.\n\nA tool call that comes back denied, blocked or unavailable is a decision, not a failure to route around. Do not retry it, do not reach for another tool to accomplish the same thing, and never describe the change as made. Say what you wanted to do and stop.\n\nPrefer calling a tool over guessing: read the file rather than recalling it, run the command rather than predicting its output. Use the file tools to read and change files, and compile_prompd to preview rendered output. For a job with several steps, keep a visible task list with todo_write and mark each step as you finish it.\n\nBe brief. Lead with the answer, then only what the user needs to act on or check it. Use headings, lists and tables where they carry something prose would not, and prose everywhere else. Do not restate the request back, do not narrate what you are about to do, and do not end by summarizing what the user has just read.\n\n{% if run_context %}## This run\n{{ run_context }}\n\n{% endif %}## Tools available this run\n{{ tools }}\n{% if tool_guidance %}\n\n{{ tool_guidance }}\n{% endif %}\n{% if mode_hint %}\n\n## Mode\n{{ mode_hint }}\n{% endif %}\n{% if skills %}\n\n{{ skills }}\n{% endif %}\n{% if memory %}\n\n{{ memory }}\n{% endif %}\n{% if file_context %}\n\n{{ file_context }}\n{% endif %}\n",
|
|
39
39
|
"systems/system-crew-agent.md": "---\nid: system-crew-agent\nname: Crew agent — interactive chat\nversion: 1.0.0\ndescription: The system prompt for a crew agent talking to a person in the Chat tab. The agent's own definition leads; this only adds what the browser session needs and the daemon does not.\nparameters:\n - name: agent_system\n type: string\n description: The crew agent's own composed definition — role, soul, persona, instructions, memory and self-direction. Placed FIRST because it is the agent's identity, not context about it.\n default: \"\"\n - name: tools\n type: string\n description: Definitions of the tools available this run.\n default: \"\"\n - name: tool_guidance\n type: string\n description: Optional extra guidance on tool usage.\n default: \"\"\n - name: file_context\n type: string\n description: Workspace description and any host-supplied context blocks.\n default: \"\"\n---\n{{ agent_system }}\n\n## This session\n\nYou are talking with a person, in a chat window, right now. This is not one of\nyour triggered runs: nobody scheduled it, and the person who opened it is\nreading your replies as they arrive and can answer you.\n\nThat changes one thing about how you work. When a request is genuinely\nambiguous, ask — a short, specific question, then wait. On a triggered run\nthere is nobody to ask and you have to make a reasonable assumption and record\nit; here, asking is cheaper and better. Do not ask when you can simply begin:\none clarifying question that unblocks real work beats a list of questions that\npostpones it.\n\nEverything else is unchanged. You are the same agent here as when you run on a\nschedule — same role, same instructions, same memory, same limits. This window\nis where your person works with you directly, and a good way for them to see\nwhat you will do before you do it unattended.\n\n## Tools available this run\n{{ tools }}\n{% if tool_guidance %}\n\n{{ tool_guidance }}\n{% endif %}\n{% if file_context %}\n\n{{ file_context }}\n{% endif %}\n",
|
|
40
40
|
"systems/system-pdflow.md": "---\nid: system-pdflow\nname: Workflow file system prompt\nversion: 1.0.0\ndescription: Adds .pdflow format knowledge (node taxonomy, edges, parameters) on top of the base system prompt.\ninherits: system-base.md\n---\n\n## Active file format — Prompd workflow (.pdflow)\n\nThe open file is a **Prompd workflow**: JSON with `{ version, metadata, parameters[], nodes[], edges[] }`. The web editor renders it as a linear chain — a fixed Start, ordered middle nodes, a fixed End — connected one edge each.\n\nEach node is `{ id, type, position, data }`. Node types and their key `data`:\n\n- `trigger` — Start (entry point). Exactly one.\n- `prompt` — runs a `.prmd`/`.md` prompt. `data.sourceType` is `'file'` (`data.source` = a WORKSPACE-RELATIVE path) or `'raw'` (`data.rawPrompt`). Optional `data.model` / `data.providerNodeId`.\n- `user-input` — pauses to collect input. `data.prompt`, `data.inputType` (`text` / `textarea` / `choice` / `confirm` / `number`).\n- `guardrail` — validates/gates. `data.systemPrompt`, `data.passExpression` or `data.scoreThreshold`.\n- `agent` — composite (input guardrail → prompt → output guardrail). `data.systemPrompt`, `data.userPrompt`, `data.maxIterations`; internal guardrails in `data.inputGuardrail` / `data.outputGuardrail` (each `{ enabled, preset|systemPrompt, passExpression|scoreThreshold }`).\n- `transformer` — JSON→JSON map. `data.mode: 'template'` with `data.template` (`{{ input }}` substitution).\n- `callback` / `checkpoint` — debug/observation point (logs node I/O).\n- `output` — End (workflow result). Exactly one.\n- `provider` — one off-chain node holding the canvas-wide provider/model; nodes reference it via `data.providerNodeId`.\n\nEdges thread each node's output to the next; the runner exposes `{{ input }}` / `{{ previous_output }}` to downstream nodes.\n\n### Example (minimal chain)\n\n```\n{\n \"version\": \"1.0\",\n \"metadata\": { \"name\": \"summarize\" },\n \"parameters\": [],\n \"nodes\": [\n { \"id\": \"start\", \"type\": \"trigger\", \"position\": { \"x\": 0, \"y\": 0 }, \"data\": {} },\n { \"id\": \"p1\", \"type\": \"prompt\", \"position\": { \"x\": 0, \"y\": 120 }, \"data\": { \"sourceType\": \"file\", \"source\": \"prompts/summarize.prmd\" } },\n { \"id\": \"end\", \"type\": \"output\", \"position\": { \"x\": 0, \"y\": 240 }, \"data\": {} }\n ],\n \"edges\": [\n { \"id\": \"e1\", \"source\": \"start\", \"target\": \"p1\" },\n { \"id\": \"e2\", \"source\": \"p1\", \"target\": \"end\" }\n ]\n}\n```\n\nTo edit the workflow, modify this JSON with the file tools (paths are workspace-relative). Keep exactly one `trigger` and one `output`.\n",
|
|
41
41
|
"systems/system-prmd-md.md": "---\nid: system-prmd-md\nname: Prompt file system prompt (.prmd / .md)\nversion: 1.0.0\ninherits: ./system-base.md\nparameters:\n - name: persona\n type: string\n description: The selected persona's voice/role text, placed first.\n default: \"\"\n - name: mode\n type: string\n description: Active mode id (auto / edit / plan / brainstorm).\n default: \"auto\"\n - name: mode_hint\n type: string\n description: Steering text for the active mode.\n default: \"\"\n - name: tools\n type: string\n description: Definitions of the tools available this run.\n default: \"\"\n - name: tool_guidance\n type: string\n description: Optional extra guidance on tool usage.\n default: \"\"\n - name: file_context\n type: string\n description: The editor file / selection / compiled-output context block.\n default: \"\"\n---\n\n{% include \"../languages/prmd.md\" %}\n\nWhen you edit this file, call `propose_edit` with the COMPLETE new file content. Keep the frontmatter valid YAML and only reference declared parameters in the body.\n",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.generated.js","sourceRoot":"","sources":["../../../prompts/library/defaults.generated.ts"],"names":[],"mappings":"AAAA;;gFAEgF;AAChF,MAAM,CAAC,MAAM,YAAY,GAA2B;IAClD,wBAAwB,EAAE,2iFAA2iF;IACrkF,mBAAmB,EAAE,0PAA0P;IAC/Q,2BAA2B,EAAE,87EAA87E;IAC39E,qCAAqC,EAAE,wuBAAwuB;IAC/wB,aAAa,EAAE,ysBAAysB;IACxtB,mBAAmB,EAAE,soJAAsoJ;IAC3pJ,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"defaults.generated.js","sourceRoot":"","sources":["../../../prompts/library/defaults.generated.ts"],"names":[],"mappings":"AAAA;;gFAEgF;AAChF,MAAM,CAAC,MAAM,YAAY,GAA2B;IAClD,wBAAwB,EAAE,2iFAA2iF;IACrkF,mBAAmB,EAAE,0PAA0P;IAC/Q,2BAA2B,EAAE,87EA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+HAA+H;IACpK,+CAA+C,EAAE,u8GAAu8G;IACx/G,sDAAsD,EAAE,u2FAAu2F;IAC/5F,uDAAuD,EAAE,yoNAAyoN;IAClsN,6CAA6C,EAAE,uuIAAuuI;IACtxI,sDAAsD,EAAE,q4IAAq4I;CAC97I,CAAC"}
|
|
@@ -7,13 +7,32 @@
|
|
|
7
7
|
export declare const CONSERVATIVE_FALLBACK_WINDOW = 32000;
|
|
8
8
|
export interface ResolvedContextWindow {
|
|
9
9
|
window: number;
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
|
|
10
|
+
/** Where this window came from — surfaced so a caller can report it (see
|
|
11
|
+
* `corenel doctor` / --debug), since a silent wrong guess is what caused
|
|
12
|
+
* this bug in the first place.
|
|
13
|
+
* - 'hydrated': the backend's own catalog said so (see
|
|
14
|
+
* @corenel/harness/core/pricing's `WindowTable`) — authoritative,
|
|
15
|
+
* preferred over everything below.
|
|
16
|
+
* - 'known': the hand-maintained static map in this file.
|
|
17
|
+
* - 'fallback': neither of the above knew this model; CONSERVATIVE_FALLBACK_WINDOW. */
|
|
18
|
+
source: 'hydrated' | 'known' | 'fallback';
|
|
14
19
|
}
|
|
15
20
|
/** Resolve a model id's context window. Exact match first, then the id with a
|
|
16
21
|
* trailing date/version suffix stripped, else the conservative fallback.
|
|
17
22
|
* Case-insensitive, since provider ids are inconsistent about it. */
|
|
18
23
|
export declare function resolveContextWindow(modelId: string): ResolvedContextWindow;
|
|
24
|
+
/** Same resolution as `resolveContextWindow`, but checks a hydrated table
|
|
25
|
+
* FIRST (see @corenel/harness/core/pricing's `WindowTable`) -- the backend's
|
|
26
|
+
* own catalog, which knows about a model released after this file's
|
|
27
|
+
* `KNOWN_WINDOWS` was last hand-edited. This is a layer ON TOP of
|
|
28
|
+
* `resolveContextWindow`, not a replacement for it: `resolveContextWindow`
|
|
29
|
+
* itself stays synchronous and network-free (see this file's header) for
|
|
30
|
+
* callers with no hydrated data yet, e.g. before hydration has completed or
|
|
31
|
+
* when it never will (offline / signed-out -- `hydrated` is then `null` or
|
|
32
|
+
* empty and this falls straight through to the exact same static-map-then-
|
|
33
|
+
* fallback behavior).
|
|
34
|
+
*
|
|
35
|
+
* `hydrated` may be `null`/`undefined` (nothing fetched yet) or empty (fetch
|
|
36
|
+
* ran but returned nothing, e.g. no token) -- both fall through unchanged. */
|
|
37
|
+
export declare function resolveContextWindowWithHydration(modelId: string, hydrated: ReadonlyMap<string, number> | null | undefined): ResolvedContextWindow;
|
|
19
38
|
//# sourceMappingURL=contextWindow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contextWindow.d.ts","sourceRoot":"","sources":["../../providers/contextWindow.ts"],"names":[],"mappings":"AA4CA;;;;;sCAKsC;AACtC,eAAO,MAAM,4BAA4B,QAAS,CAAC;AAEnD,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf
|
|
1
|
+
{"version":3,"file":"contextWindow.d.ts","sourceRoot":"","sources":["../../providers/contextWindow.ts"],"names":[],"mappings":"AA4CA;;;;;sCAKsC;AACtC,eAAO,MAAM,4BAA4B,QAAS,CAAC;AAEnD,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf;;;;;;;4FAOwF;IACxF,MAAM,EAAE,UAAU,GAAG,OAAO,GAAG,UAAU,CAAC;CAC3C;AASD;;qEAEqE;AACrE,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,qBAAqB,CAM3E;AAED;;;;;;;;;;;;8EAY8E;AAC9E,wBAAgB,iCAAiC,CAC/C,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS,GACvD,qBAAqB,CAWvB"}
|
|
@@ -65,4 +65,29 @@ export function resolveContextWindow(modelId) {
|
|
|
65
65
|
return { window: KNOWN_WINDOWS[stripped], source: 'known' };
|
|
66
66
|
return { window: CONSERVATIVE_FALLBACK_WINDOW, source: 'fallback' };
|
|
67
67
|
}
|
|
68
|
+
/** Same resolution as `resolveContextWindow`, but checks a hydrated table
|
|
69
|
+
* FIRST (see @corenel/harness/core/pricing's `WindowTable`) -- the backend's
|
|
70
|
+
* own catalog, which knows about a model released after this file's
|
|
71
|
+
* `KNOWN_WINDOWS` was last hand-edited. This is a layer ON TOP of
|
|
72
|
+
* `resolveContextWindow`, not a replacement for it: `resolveContextWindow`
|
|
73
|
+
* itself stays synchronous and network-free (see this file's header) for
|
|
74
|
+
* callers with no hydrated data yet, e.g. before hydration has completed or
|
|
75
|
+
* when it never will (offline / signed-out -- `hydrated` is then `null` or
|
|
76
|
+
* empty and this falls straight through to the exact same static-map-then-
|
|
77
|
+
* fallback behavior).
|
|
78
|
+
*
|
|
79
|
+
* `hydrated` may be `null`/`undefined` (nothing fetched yet) or empty (fetch
|
|
80
|
+
* ran but returned nothing, e.g. no token) -- both fall through unchanged. */
|
|
81
|
+
export function resolveContextWindowWithHydration(modelId, hydrated) {
|
|
82
|
+
if (hydrated && hydrated.size > 0) {
|
|
83
|
+
const id = modelId.trim().toLowerCase();
|
|
84
|
+
for (const [key, window] of hydrated) {
|
|
85
|
+
const keyId = key.trim().toLowerCase();
|
|
86
|
+
if (keyId === id || stripDateSuffix(keyId) === stripDateSuffix(id)) {
|
|
87
|
+
return { window, source: 'hydrated' };
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return resolveContextWindow(modelId);
|
|
92
|
+
}
|
|
68
93
|
//# sourceMappingURL=contextWindow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contextWindow.js","sourceRoot":"","sources":["../../providers/contextWindow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;gDA2BgD;AAEhD;;wCAEwC;AACxC,MAAM,aAAa,GAA2B;IAC5C,mBAAmB,EAAE,MAAO;IAC5B,kBAAkB,EA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ACrC,IAAI,QAAQ,IAAI,aAAa;QAAE,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IAC3F,OAAO,EAAE,MAAM,EAAE,4BAA4B,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;AACtE,CAAC;AAED;;;;;;;;;;;;8EAY8E;AAC9E,MAAM,UAAU,iCAAiC,CAC/C,OAAe,EACf,QAAwD;IAExD,IAAI,QAAQ,IAAI,QAAQ,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;QAClC,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QACxC,KAAK,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;YACrC,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;YACvC,IAAI,KAAK,KAAK,EAAE,IAAI,eAAe,CAAC,KAAK,CAAC,KAAK,eAAe,CAAC,EAAE,CAAC,EAAE,CAAC;gBACnE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;YACxC,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,oBAAoB,CAAC,OAAO,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FileService } from '@corenel/protocol';
|
|
2
|
+
type GetFiles = () => FileService | null | Promise<FileService | null>;
|
|
3
|
+
/** The file, beside SESSION.jsonl in the same session directory. */
|
|
4
|
+
export declare const CHECKPOINT_FILE = "CHECKPOINT.md";
|
|
5
|
+
export interface CheckpointStore {
|
|
6
|
+
/** Add one checkpoint to this session's file, creating it if this is the
|
|
7
|
+
* first. Resolves without writing when the host has no file service. */
|
|
8
|
+
append(sessionId: string, body: string): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export declare function makeCheckpointStore(getFiles: GetFiles, root: string): CheckpointStore;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=checkpointStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkpointStore.d.ts","sourceRoot":"","sources":["../../sessions/checkpointStore.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,KAAK,QAAQ,GAAG,MAAM,WAAW,GAAG,IAAI,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;AAEvE,oEAAoE;AACpE,eAAO,MAAM,eAAe,kBAAkB,CAAC;AAE/C,MAAM,WAAW,eAAe;IAC9B;4EACwE;IACxE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxD;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,eAAe,CAoCrF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/* Durable home for what a compaction collapsed.
|
|
2
|
+
*
|
|
3
|
+
* A checkpoint is lossy by construction, so it must not be an invisible blob
|
|
4
|
+
* the model carries and the user cannot audit. It lands as CHECKPOINT.md beside
|
|
5
|
+
* the session's SESSION.jsonl, where the user can open it, read what was kept,
|
|
6
|
+
* and correct it when it dropped the one thing that mattered.
|
|
7
|
+
*
|
|
8
|
+
* Appends rather than replaces: a long session compacts more than once, and
|
|
9
|
+
* each boundary's decisions stay readable in order. */
|
|
10
|
+
/** The file, beside SESSION.jsonl in the same session directory. */
|
|
11
|
+
export const CHECKPOINT_FILE = 'CHECKPOINT.md';
|
|
12
|
+
export function makeCheckpointStore(getFiles, root) {
|
|
13
|
+
return {
|
|
14
|
+
async append(sessionId, body) {
|
|
15
|
+
const files = await getFiles();
|
|
16
|
+
if (!files)
|
|
17
|
+
return;
|
|
18
|
+
const path = `${root}/${sessionId}/${CHECKPOINT_FILE}`;
|
|
19
|
+
const entry = `## ${new Date().toISOString()}\n\n${body}\n`;
|
|
20
|
+
/* NEVER write to a path we have not successfully read.
|
|
21
|
+
*
|
|
22
|
+
* The obvious implementation asks `stat` whether the file exists and
|
|
23
|
+
* branches on the answer. That is wrong here: a sidecar `stat` returns
|
|
24
|
+
* null when the TRANSPORT fails, so "I could not reach the daemon" and
|
|
25
|
+
* "the file is not there" are the same value. Branching on it would
|
|
26
|
+
* overwrite a real checkpoint on any hiccup.
|
|
27
|
+
*
|
|
28
|
+
* So: read first. If the read succeeds we know what is there and can
|
|
29
|
+
* append to it. If it fails — absent, or unreachable, we cannot tell —
|
|
30
|
+
* we try `create`, which REJECTS when the file already exists. A
|
|
31
|
+
* transient failure over an existing checkpoint therefore surfaces as an
|
|
32
|
+
* error, and the only copy of a decision survives. */
|
|
33
|
+
let existing = null;
|
|
34
|
+
try {
|
|
35
|
+
existing = await files.read(path);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
existing = null;
|
|
39
|
+
}
|
|
40
|
+
if (existing === null) {
|
|
41
|
+
await files.create(path, `# Checkpoints\n\n${entry}`);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
await files.write(path, `${existing}\n${entry}`);
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=checkpointStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkpointStore.js","sourceRoot":"","sources":["../../sessions/checkpointStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;uDAQuD;AAMvD,oEAAoE;AACpE,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC;AAQ/C,MAAM,UAAU,mBAAmB,CAAC,QAAkB,EAAE,IAAY;IAClE,OAAO;QACL,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI;YAC1B,MAAM,KAAK,GAAG,MAAM,QAAQ,EAAE,CAAC;YAC/B,IAAI,CAAC,KAAK;gBAAE,OAAO;YAEnB,MAAM,IAAI,GAAG,GAAG,IAAI,IAAI,SAAS,IAAI,eAAe,EAAE,CAAC;YACvD,MAAM,KAAK,GAAG,MAAM,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,OAAO,IAAI,IAAI,CAAC;YAE5D;;;;;;;;;;;;kEAYsD;YACtD,IAAI,QAAQ,GAAkB,IAAI,CAAC;YACnC,IAAI,CAAC;gBACH,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACpC,CAAC;YAAC,MAAM,CAAC;gBACP,QAAQ,GAAG,IAAI,CAAC;YAClB,CAAC;YAED,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;gBACtB,MAAM,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,oBAAoB,KAAK,EAAE,CAAC,CAAC;gBACtD,OAAO;YACT,CAAC;YACD,MAAM,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,GAAG,QAAQ,KAAK,KAAK,EAAE,CAAC,CAAC;QACnD,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -5,6 +5,10 @@ export declare class JsonlSessionStore implements ISessionStore {
|
|
|
5
5
|
private cursors;
|
|
6
6
|
constructor(getFiles: () => FileService | null | Promise<FileService | null>, root?: () => string);
|
|
7
7
|
private files;
|
|
8
|
+
private movedRoots;
|
|
9
|
+
/** Resolve this id somewhere other than the store's own root, from now on. */
|
|
10
|
+
setRootFor(id: string, root: string): void;
|
|
11
|
+
private rootFor;
|
|
8
12
|
private path;
|
|
9
13
|
create(title: string, surface?: SessionSurface): Promise<AgentSession>;
|
|
10
14
|
get(id: string): Promise<AgentSession | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileSessionStore.d.ts","sourceRoot":"","sources":["../../sessions/fileSessionStore.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,YAAY,EAAY,WAAW,EAAE,aAAa,EAAE,cAAc,EAClE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AAC,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAO7D;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,QAAQ,CAAC,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,WAAW,CAAC;IA4DnD,IAAI,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IA4BhD;;mBAEe;YACD,IAAI;IAeZ,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYhD,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAIxC"}
|
|
@@ -69,6 +69,25 @@ export class JsonlSessionStore {
|
|
|
69
69
|
writable: true,
|
|
70
70
|
value: new Map()
|
|
71
71
|
});
|
|
72
|
+
/* Sessions that have been MOVED out from under this store's root, id -> the
|
|
73
|
+
* root they now live in.
|
|
74
|
+
*
|
|
75
|
+
* A session can move mid-run: start_project offers to bring the conversation
|
|
76
|
+
* into the project it just created, and the run that asked is still writing.
|
|
77
|
+
* Without this, the next save() would resolve the OLD path and recreate the
|
|
78
|
+
* file there from its cursor -- the same conversation in two places, neither
|
|
79
|
+
* complete. The cursor itself survives the move untouched: it is keyed by id
|
|
80
|
+
* and holds the text, not the path.
|
|
81
|
+
*
|
|
82
|
+
* In memory only, and deliberately: it describes where a session went during
|
|
83
|
+
* THIS page's life. A reload lists both roots afresh and needs no memory of
|
|
84
|
+
* the journey. */
|
|
85
|
+
Object.defineProperty(this, "movedRoots", {
|
|
86
|
+
enumerable: true,
|
|
87
|
+
configurable: true,
|
|
88
|
+
writable: true,
|
|
89
|
+
value: new Map()
|
|
90
|
+
});
|
|
72
91
|
}
|
|
73
92
|
async files() {
|
|
74
93
|
const f = await this.getFiles();
|
|
@@ -76,8 +95,15 @@ export class JsonlSessionStore {
|
|
|
76
95
|
throw new Error('No file workspace is connected — sessions are unavailable.');
|
|
77
96
|
return f;
|
|
78
97
|
}
|
|
98
|
+
/** Resolve this id somewhere other than the store's own root, from now on. */
|
|
99
|
+
setRootFor(id, root) {
|
|
100
|
+
this.movedRoots.set(id, root);
|
|
101
|
+
}
|
|
102
|
+
rootFor(id) {
|
|
103
|
+
return this.movedRoots.get(id) ?? this.root();
|
|
104
|
+
}
|
|
79
105
|
path(id) {
|
|
80
|
-
return `${this.
|
|
106
|
+
return `${this.rootFor(id)}/${id}/SESSION.jsonl`;
|
|
81
107
|
}
|
|
82
108
|
async create(title, surface) {
|
|
83
109
|
const createdAt = now();
|
|
@@ -269,7 +295,7 @@ export class JsonlSessionStore {
|
|
|
269
295
|
}
|
|
270
296
|
async delete(id) {
|
|
271
297
|
this.cursors.delete(id);
|
|
272
|
-
await (await this.files()).remove(`${this.
|
|
298
|
+
await (await this.files()).remove(`${this.rootFor(id)}/${id}`).catch(() => { });
|
|
273
299
|
}
|
|
274
300
|
}
|
|
275
301
|
//# sourceMappingURL=fileSessionStore.js.map
|