@agimon-ai/doompi-plan 0.0.1-alpha.2 → 0.0.1-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -19
- package/dist/adapters/pi/extension.cjs +2 -0
- package/dist/adapters/pi/extension.cjs.map +1 -0
- package/dist/{extension.d.cts → adapters/pi/extension.d.cts} +1 -1
- package/dist/adapters/pi/extension.d.cts.map +1 -0
- package/dist/{extension.d.mts → adapters/pi/extension.d.mts} +1 -1
- package/dist/adapters/pi/extension.d.mts.map +1 -0
- package/dist/adapters/pi/extension.mjs +2 -0
- package/dist/adapters/pi/extension.mjs.map +1 -0
- package/dist/adapters/telemetry/logSinkTelemetry.cjs +2 -0
- package/dist/adapters/telemetry/logSinkTelemetry.cjs.map +1 -0
- package/dist/adapters/telemetry/logSinkTelemetry.d.cts +34 -0
- package/dist/adapters/telemetry/logSinkTelemetry.d.cts.map +1 -0
- package/dist/adapters/telemetry/logSinkTelemetry.d.mts +34 -0
- package/dist/adapters/telemetry/logSinkTelemetry.d.mts.map +1 -0
- package/dist/adapters/telemetry/logSinkTelemetry.mjs +2 -0
- package/dist/adapters/telemetry/logSinkTelemetry.mjs.map +1 -0
- package/dist/config.cjs +1 -2
- package/dist/config.d.cts +2 -14
- package/dist/config.d.mts +2 -14
- package/dist/config.mjs +1 -2
- package/dist/extensions/doom.cjs +1 -1
- package/dist/extensions/doom.cjs.map +1 -1
- package/dist/extensions/doom.mjs +1 -1
- package/dist/extensions/doom.mjs.map +1 -1
- package/dist/extensions/pi.cjs +1 -1
- package/dist/extensions/pi.cjs.map +1 -1
- package/dist/extensions/pi.d.cts +1 -1
- package/dist/extensions/pi.d.mts +1 -1
- package/dist/extensions/pi.mjs +1 -1
- package/dist/extensions/pi.mjs.map +1 -1
- package/dist/fableFlow.cjs +1 -3
- package/dist/fableFlow.d.cts +2 -66
- package/dist/fableFlow.d.mts +2 -66
- package/dist/fableFlow.mjs +1 -3
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +1 -1
- package/dist/logSinkTelemetry.cjs +1 -2
- package/dist/logSinkTelemetry.d.cts +2 -24
- package/dist/logSinkTelemetry.d.mts +2 -24
- package/dist/logSinkTelemetry.mjs +1 -2
- package/dist/planConfig.cjs +1 -2
- package/dist/planConfig.d.cts +2 -0
- package/dist/planConfig.d.mts +2 -0
- package/dist/planConfig.mjs +1 -2
- package/dist/planMode.cjs +1 -6
- package/dist/planMode.d.cts +3 -75
- package/dist/planMode.d.mts +3 -75
- package/dist/planMode.mjs +1 -6
- package/dist/prompts.cjs +1 -3
- package/dist/prompts.d.cts +2 -24
- package/dist/prompts.d.mts +2 -24
- package/dist/prompts.mjs +1 -3
- package/dist/schemas/plan/config.cjs +2 -0
- package/dist/schemas/plan/config.cjs.map +1 -0
- package/dist/schemas/plan/config.d.cts +14 -0
- package/dist/schemas/plan/config.d.cts.map +1 -0
- package/dist/schemas/plan/config.d.mts +14 -0
- package/dist/schemas/plan/config.d.mts.map +1 -0
- package/dist/schemas/plan/config.mjs +2 -0
- package/dist/schemas/plan/config.mjs.map +1 -0
- package/dist/schemas/plan/planConfig.cjs +2 -0
- package/dist/schemas/plan/planConfig.cjs.map +1 -0
- package/dist/schemas/plan/planConfig.d.cts +21 -0
- package/dist/schemas/plan/planConfig.d.cts.map +1 -0
- package/dist/schemas/plan/planConfig.d.mts +21 -0
- package/dist/schemas/plan/planConfig.d.mts.map +1 -0
- package/dist/schemas/plan/planConfig.mjs +2 -0
- package/dist/schemas/plan/planConfig.mjs.map +1 -0
- package/dist/services/plan/fableFlow.cjs +3 -0
- package/dist/services/plan/fableFlow.cjs.map +1 -0
- package/dist/services/plan/fableFlow.d.cts +66 -0
- package/dist/services/plan/fableFlow.d.cts.map +1 -0
- package/dist/services/plan/fableFlow.d.mts +66 -0
- package/dist/services/plan/fableFlow.d.mts.map +1 -0
- package/dist/services/plan/fableFlow.mjs +3 -0
- package/dist/services/plan/fableFlow.mjs.map +1 -0
- package/dist/services/plan/planMode.cjs +6 -0
- package/dist/services/plan/planMode.cjs.map +1 -0
- package/dist/services/plan/planMode.d.cts +79 -0
- package/dist/services/plan/planMode.d.cts.map +1 -0
- package/dist/services/plan/planMode.d.mts +79 -0
- package/dist/services/plan/planMode.d.mts.map +1 -0
- package/dist/services/plan/planMode.mjs +6 -0
- package/dist/services/plan/planMode.mjs.map +1 -0
- package/dist/services/plan/prompts.cjs +3 -0
- package/dist/services/plan/prompts.cjs.map +1 -0
- package/dist/services/plan/prompts.d.cts +24 -0
- package/dist/services/plan/prompts.d.cts.map +1 -0
- package/dist/services/plan/prompts.d.mts +24 -0
- package/dist/services/plan/prompts.d.mts.map +1 -0
- package/dist/services/plan/prompts.mjs +3 -0
- package/dist/services/plan/prompts.mjs.map +1 -0
- package/package.json +16 -8
- package/dist/config.cjs.map +0 -1
- package/dist/config.d.cts.map +0 -1
- package/dist/config.d.mts.map +0 -1
- package/dist/config.mjs.map +0 -1
- package/dist/extension.cjs +0 -2
- package/dist/extension.cjs.map +0 -1
- package/dist/extension.d.cts.map +0 -1
- package/dist/extension.d.mts.map +0 -1
- package/dist/extension.mjs +0 -2
- package/dist/extension.mjs.map +0 -1
- package/dist/fableFlow.cjs.map +0 -1
- package/dist/fableFlow.d.cts.map +0 -1
- package/dist/fableFlow.d.mts.map +0 -1
- package/dist/fableFlow.mjs.map +0 -1
- package/dist/logSinkTelemetry.cjs.map +0 -1
- package/dist/logSinkTelemetry.d.cts.map +0 -1
- package/dist/logSinkTelemetry.d.mts.map +0 -1
- package/dist/logSinkTelemetry.mjs.map +0 -1
- package/dist/planConfig.cjs.map +0 -1
- package/dist/planConfig.mjs.map +0 -1
- package/dist/planMode.cjs.map +0 -1
- package/dist/planMode.d.cts.map +0 -1
- package/dist/planMode.d.mts.map +0 -1
- package/dist/planMode.mjs.map +0 -1
- package/dist/prompts.cjs.map +0 -1
- package/dist/prompts.d.cts.map +0 -1
- package/dist/prompts.d.mts.map +0 -1
- package/dist/prompts.mjs.map +0 -1
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=logSinkTelemetry.cjs.map
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./adapters/telemetry/logSinkTelemetry.cjs`);exports.PLAN_EVENT=e.PLAN_EVENT,exports.createPlanTelemetry=e.createPlanTelemetry;
|
|
@@ -1,24 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
readonly configLoadFailed: "doom_plan.config_load_failed";
|
|
4
|
-
readonly writePlanFailed: "doom_plan.write_plan_failed";
|
|
5
|
-
readonly writePlanTimedOut: "doom_plan.write_plan_timed_out";
|
|
6
|
-
readonly writePlanUnsafePath: "doom_plan.write_plan_unsafe_path";
|
|
7
|
-
readonly modelResolveFailed: "doom_plan.model_resolve_failed";
|
|
8
|
-
readonly modeEnabled: "doom_plan.mode_enabled";
|
|
9
|
-
readonly modeDisabled: "doom_plan.mode_disabled";
|
|
10
|
-
readonly planWritten: "doom_plan.plan_written";
|
|
11
|
-
readonly planReviewCompleted: "doom_plan.plan_review_completed";
|
|
12
|
-
};
|
|
13
|
-
type PlanEventName = (typeof PLAN_EVENT)[keyof typeof PLAN_EVENT];
|
|
14
|
-
type PlanEventAttributes = Record<string, string | number | boolean>;
|
|
15
|
-
interface PlanTelemetry {
|
|
16
|
-
recordError(event: PlanEventName, error: unknown, attributes?: PlanEventAttributes): Promise<void>;
|
|
17
|
-
recordWarning(event: PlanEventName, error: unknown, attributes?: PlanEventAttributes): Promise<void>;
|
|
18
|
-
recordEvent(event: PlanEventName, attributes?: PlanEventAttributes): Promise<void>;
|
|
19
|
-
flush(): Promise<void>;
|
|
20
|
-
shutdown(): Promise<void>;
|
|
21
|
-
}
|
|
22
|
-
//#endregion
|
|
23
|
-
export { PlanTelemetry };
|
|
24
|
-
//# sourceMappingURL=logSinkTelemetry.d.cts.map
|
|
1
|
+
import { PLAN_EVENT, PlanEventAttributes, PlanEventName, PlanTelemetry, PlanTelemetryOptions, createPlanTelemetry } from "./adapters/telemetry/logSinkTelemetry.cjs";
|
|
2
|
+
export { PLAN_EVENT, PlanEventAttributes, PlanEventName, PlanTelemetry, PlanTelemetryOptions, createPlanTelemetry };
|
|
@@ -1,24 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
readonly configLoadFailed: "doom_plan.config_load_failed";
|
|
4
|
-
readonly writePlanFailed: "doom_plan.write_plan_failed";
|
|
5
|
-
readonly writePlanTimedOut: "doom_plan.write_plan_timed_out";
|
|
6
|
-
readonly writePlanUnsafePath: "doom_plan.write_plan_unsafe_path";
|
|
7
|
-
readonly modelResolveFailed: "doom_plan.model_resolve_failed";
|
|
8
|
-
readonly modeEnabled: "doom_plan.mode_enabled";
|
|
9
|
-
readonly modeDisabled: "doom_plan.mode_disabled";
|
|
10
|
-
readonly planWritten: "doom_plan.plan_written";
|
|
11
|
-
readonly planReviewCompleted: "doom_plan.plan_review_completed";
|
|
12
|
-
};
|
|
13
|
-
type PlanEventName = (typeof PLAN_EVENT)[keyof typeof PLAN_EVENT];
|
|
14
|
-
type PlanEventAttributes = Record<string, string | number | boolean>;
|
|
15
|
-
interface PlanTelemetry {
|
|
16
|
-
recordError(event: PlanEventName, error: unknown, attributes?: PlanEventAttributes): Promise<void>;
|
|
17
|
-
recordWarning(event: PlanEventName, error: unknown, attributes?: PlanEventAttributes): Promise<void>;
|
|
18
|
-
recordEvent(event: PlanEventName, attributes?: PlanEventAttributes): Promise<void>;
|
|
19
|
-
flush(): Promise<void>;
|
|
20
|
-
shutdown(): Promise<void>;
|
|
21
|
-
}
|
|
22
|
-
//#endregion
|
|
23
|
-
export { PlanTelemetry };
|
|
24
|
-
//# sourceMappingURL=logSinkTelemetry.d.mts.map
|
|
1
|
+
import { PLAN_EVENT, PlanEventAttributes, PlanEventName, PlanTelemetry, PlanTelemetryOptions, createPlanTelemetry } from "./adapters/telemetry/logSinkTelemetry.mjs";
|
|
2
|
+
export { PLAN_EVENT, PlanEventAttributes, PlanEventName, PlanTelemetry, PlanTelemetryOptions, createPlanTelemetry };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=logSinkTelemetry.mjs.map
|
|
1
|
+
import{PLAN_EVENT as e,createPlanTelemetry as t}from"./adapters/telemetry/logSinkTelemetry.mjs";export{e as PLAN_EVENT,t as createPlanTelemetry};
|
package/dist/planConfig.cjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=planConfig.cjs.map
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./schemas/plan/planConfig.cjs`);exports.PLAN_CONFIG_SECTION_ID=e.PLAN_CONFIG_SECTION_ID,exports.PLAN_SETTINGS=e.PLAN_SETTINGS,exports.planConfigSections=e.planConfigSections,exports.planSettingByFieldId=e.planSettingByFieldId;
|
package/dist/planConfig.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=planConfig.mjs.map
|
|
1
|
+
import{PLAN_CONFIG_SECTION_ID as e,PLAN_SETTINGS as t,planConfigSections as n,planSettingByFieldId as r}from"./schemas/plan/planConfig.mjs";export{e as PLAN_CONFIG_SECTION_ID,t as PLAN_SETTINGS,n as planConfigSections,r as planSettingByFieldId};
|
package/dist/planMode.cjs
CHANGED
|
@@ -1,6 +1 @@
|
|
|
1
|
-
const e=require(`./
|
|
2
|
-
|
|
3
|
-
`).trim()||void 0}}function _e(e){return e.reason instanceof Error?e.reason:Error(`Plan write cancelled.`)}async function B(e,t){if(t.aborted)throw _e(t);let n,r=new Promise((e,r)=>{n=()=>r(_e(t)),t.addEventListener(`abort`,n,{once:!0})});try{return await Promise.race([e(),r])}finally{n&&t.removeEventListener(`abort`,n)}}function V(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function H(e){return typeof e==`string`}function U(e){if(!(!V(e)||!H(e.provider)||!H(e.id))&&!(!e.provider||!e.id||e.provider.length>128||e.id.length>128))return{provider:e.provider,id:e.id}}function W(e){return H(e)&&L.includes(e)?e:void 0}function G(e){return H(e)&&R.includes(e)?e:void 0}function ve(e){if(!(!Array.isArray(e)||e.some(e=>!H(e))))return e.map(e=>e)}function K(e){if(!V(e))return;let t=ve(e.tools),n=W(e.thinking);if(!t||n===void 0)return;let r=e.model===void 0?void 0:U(e.model);if(!(e.model!==void 0&&!r))return{tools:t,...r?{model:r}:{},thinking:n}}function ye(e){return e===`normal`||e===`debug`||e===`fable`?e:void 0}function be(e){if(e.version!==2)return;let t=e.activeFlavor===void 0?void 0:ye(e.activeFlavor);if(e.activeFlavor!==void 0&&!t)return;let n=e.originalSnapshot===void 0?void 0:K(e.originalSnapshot);if(e.originalSnapshot!==void 0&&!n)return;let r=e.planId===void 0?void 0:H(e.planId)?e.planId:void 0;if(e.planId!==void 0&&r===void 0)return;let i=e.interruptedFableStage===void 0?void 0:G(e.interruptedFableStage);if(!(e.interruptedFableStage!==void 0&&!i))return{version:2,...t?{activeFlavor:t}:{},...n?{originalSnapshot:n}:{},...r?{planId:r}:{},...i?{interruptedFableStage:i}:{}}}function xe(e){if(e.enabled!==!0&&e.enabled!==!1)return;let t=e.toolsBeforePlanMode===void 0?void 0:ve(e.toolsBeforePlanMode);if(e.toolsBeforePlanMode!==void 0&&!t)return;let n=e.modelBeforePlanMode===void 0?void 0:U(e.modelBeforePlanMode);if(e.modelBeforePlanMode!==void 0&&!n)return;let r=e.thinkingBeforePlanMode===void 0?void 0:W(e.thinkingBeforePlanMode);if(e.thinkingBeforePlanMode!==void 0&&r===void 0)return;let i=e.planId===void 0?void 0:H(e.planId)?e.planId:void 0;if(e.planId!==void 0&&i===void 0)return;let a=t&&r!==void 0?{tools:t,...n?{model:n}:{},thinking:r}:void 0;return{version:2,...e.enabled?{activeFlavor:`normal`}:{},...a?{originalSnapshot:a}:{},...i?{planId:i}:{}}}function Se(e){if(V(e))return be(e)??xe(e)}function Ce(e){if(!V(e)||!H(e.content)||!H(e.path)||!H(e.sessionId)||!H(e.title)||!H(e.writtenAt))return;let t=e.planId===void 0?void 0:H(e.planId)?e.planId:void 0;if(!(e.planId!==void 0&&t===void 0))return{content:e.content,path:e.path,sessionId:e.sessionId,...t?{planId:t}:{},title:e.title,writtenAt:e.writtenAt}}function q(e,t,n){if(!H(e))throw Error(`${t} must be a string.`);let r=e.trim();if(n&&!r)throw Error(`${t} must not be empty.`);if(s.Buffer.byteLength(r,`utf8`)>4096)throw Error(`${t} exceeds the bounded debug evidence limit.`);return r}function we(e,t){if(!Array.isArray(e)||e.length>32)throw Error(`${t} must be a bounded string array.`);return e.map((e,n)=>q(e,`${t}[${n}]`,!1))}function Te(e,t){return e===void 0?``:q(e,t,!1)}function J(e,t){return e===void 0?[]:we(e,t)}function Ee(e,t,n){let r=new Set(t),i=Object.keys(e).find(e=>!r.has(e));if(i)throw Error(`${n} contains unsupported field '${i}'.`)}function De(e){if(!V(e))throw Error(`Debug evidence must be an object.`);Ee(e,[`issue`,`expectedBehavior`,`reproductionAttempt`,`actualBehavior`,`logs`,`correlatedTraceEvidence`,`processOutput`,`browserConsoleEvidence`,`correlationIds`,`timestamps`,`verifiedFacts`,`hypotheses`,`unavailableEvidence`],`Debug evidence`);let t={issue:q(e.issue,`issue`,!0),expectedBehavior:Te(e.expectedBehavior,`expectedBehavior`),reproductionAttempt:Te(e.reproductionAttempt,`reproductionAttempt`),actualBehavior:Te(e.actualBehavior,`actualBehavior`),logs:J(e.logs,`logs`),correlatedTraceEvidence:J(e.correlatedTraceEvidence,`correlatedTraceEvidence`),processOutput:J(e.processOutput,`processOutput`),browserConsoleEvidence:J(e.browserConsoleEvidence,`browserConsoleEvidence`),correlationIds:J(e.correlationIds,`correlationIds`),timestamps:J(e.timestamps,`timestamps`),verifiedFacts:J(e.verifiedFacts,`verifiedFacts`),hypotheses:J(e.hypotheses,`hypotheses`),unavailableEvidence:J(e.unavailableEvidence,`unavailableEvidence`)};if(s.Buffer.byteLength(JSON.stringify(t),`utf8`)>32768)throw Error(`Debug evidence exceeds the bounded packet size.`);return t}function Oe(e,t){let n=new Set(t),r=e.filter(e=>fe.has(e)),i=F.filter(e=>n.has(e)),a=[b,v,T,y].filter(e=>n.has(e));return[...new Set([...r,...i,...a])]}function ke(e,t,n,r){let i=new Set(t),a=Oe(e,t),o=n===`debug`?[E,...r].filter(e=>i.has(e)):[];return n===`fable`&&i.has(D)&&o.push(D),[...new Set([...a,...o])]}function Y(e){if(e.output=!1,e.progress=!1,e.worktree=!1,Array.isArray(e.parallel))for(let t of e.parallel)Y(t);else e.parallel&&Y(e.parallel)}function Ae(e){if(e.action!==void 0){(0,g.isSubagentAction)(e.action)&&(0,g.subagentActionAcceptsField)(e.action,`artifacts`)&&(e.artifacts=!1);return}e.artifacts=!1,e.output=!1,e.share=!1,e.progress=!1,e.worktree=!1,delete e.chainDir,delete e.outputSchema,delete e.sessionDir;for(let t of e.tasks??[])Y(t);for(let t of e.chain??[])Y(t)}function je(e,t){if(!e?.model&&!e?.thinking)return;let n=e.model??(t?`${t.provider}/${t.id}`:void 0);if(n)return e.thinking?`${n.replace(/:(?:off|minimal|low|medium|high|xhigh|max)$/,``)}:${e.thinking}`:n}function Me(e,t){if(e.action===`run`)for(let n of e.requests??[])n.model=t}function Ne(e,t){e.action===`assign`&&(e.model=t)}function Pe(e){return new Set([`append-step`,`create`,`delete`,`disable`,`eject`,`enable`,`grant-spawn-budget`,`reset`,`schedule`,`schedule-cancel`,`update`,`watchdog.configure`]).has(e??``)}function Fe(e,t){let n=e.indexOf(`/`);if(n>0)return t.modelRegistry.find(e.slice(0,n),e.slice(n+1));let r=t.modelRegistry.getAvailable().filter(t=>t.id===e);return r.find(e=>e.provider===t.model?.provider)??(r.length===1?r[0]:void 0)}function Ie(e=process.env,n=process.cwd()){return t.loadDoomConfig((0,o.loadHarnessState)(e).state.root??n).modes?.planning}function Le(e){let t={key:`p`,label:`plan`,order:60};return[{id:`plan.normal`,path:[t,{key:`p`,label:`normal`,detail:`read-only planning`}],action:{name:`plan.normal`}},{id:`plan.debug`,path:[t,{key:`d`,label:`debug`,detail:`adaptive debug planning`}],action:{name:`plan.debug`}},{id:`plan.fable`,path:[t,{key:`f`,label:`fable`,detail:`repository-aware draft`}],action:{name:`plan.fable`}},...e?[{id:`plan.exit`,path:[t,{key:`e`,label:`exit`,detail:`restore and exit`}],action:{name:`plan.exit`}}]:[]]}function Re(e,t=Ie,c=a.createPlanTelemetry(),g={}){let b=!1,x,S,C,O,F,L,R=!1,V,H=`idle`,U,W,G,ve=Promise.resolve(),K=g.doomIntegrations??!0,ye=new Set(g.debugDiagnosticTools??ue),be=(0,ne.createFablePlanBrokerClient)(()=>W?.sessionManager.getSessionId()),xe=g.fableBroker??{start:(e,t)=>be.start(e,t),cancel:(e,t)=>be.cancel({requester:ne.FABLE_PLAN_REQUESTER,operationId:e,reason:t})},q=()=>g.fableBroker!==void 0||be.isAvailable(),we=K?(0,te.registerDoomModeContribution)(e,{source:k,id:`plan`,order:40}):{update:()=>void 0},Te=K?(0,p.createDoomLeaderContribution)(e,{source:k,bindings:Le(!1)}):{update:()=>void 0},J,Ee=K?(0,f.registerDoomConfigContribution)(e,{source:k,listSections:()=>{try{return r.planConfigSections(t(),J)}catch(e){return r.planConfigSections(void 0,e instanceof Error?e.message:String(e))}},handlers:{[f.CONFIG_ACTION.set]:async({fieldId:e,value:t})=>{let n=r.planSettingByFieldId(e);!n||!t||(J=void 0,await(0,d.setDoomConfigValue)((0,o.globalDoomConfigPath)(),[...n.keyPath],t))},[f.CONFIG_ACTION.clear]:async({fieldId:e})=>{let t=r.planSettingByFieldId(e);t&&(J=void 0,await(0,d.unsetDoomConfigValue)((0,o.globalDoomConfigPath)(),[...t.keyPath]))}},onError:e=>{J=e instanceof Error?e.message:String(e)}}):{dispose:()=>void 0,update:()=>void 0};function Oe(){Te.update(Le(b))}function Y(e){Oe();let t=x,n=b&&t?`plan:${t}`:void 0,r=t===`fable`&&H!==`idle`?` · ${H}`:``;e.ui.setStatus(`plan-mode`,n?e.ui.theme.fg(A,n):void 0),we.update(b&&t?{label:`PLAN`,detail:`${t}${r} - read only`,color:A}:void 0)}function Re(){if(!K||!b||!x||!W)return;let t={owner:k,allowedTools:[...pe],requiredTools:[ie,`mcp`],allowMcpTools:!0,allowedExternalProfiles:x===`fable`?[n.FABLE_PLAN_PROFILE]:[],denyExtensions:!1};O?O.update(t):O=(0,h.registerSubagentPolicy)((0,m.createProtocolRuntime)({bus:e.events,source:k,sessionId:W.sessionManager.getSessionId()}),t)}function X(){e.appendEntry(_,{version:2,...b&&x?{activeFlavor:x}:{},...S?{originalSnapshot:{tools:[...S.tools],...S.model?{model:{...S.model}}:{},thinking:S.thinking}}:{},...L?{planId:L}:{},...U?{interruptedFableStage:U}:{}})}function Z(e,t,n){c.recordWarning(a.PLAN_EVENT.modelResolveFailed,`Planning model ${n}: ${t}`,{[oe]:t,"plan.model.phase":e,"plan.model.reason":n})}async function ze(t){let n=C?.main;if(n){if(n.model){let r=Fe(n.model,t);r?await e.setModel(r)||(t.ui.notify(`Planning model is unavailable without authentication: ${n.model}`,A),Z(`apply`,n.model,ce)):(t.ui.notify(`Planning model not found: ${n.model}`,A),Z(`apply`,n.model,se))}n.thinking&&e.setThinkingLevel(n.thinking)}}async function Be(t,n){if(!n)return!1;if(n.model){let r=`${n.model.provider}/${n.model.id}`,i=t.modelRegistry.find(n.model.provider,n.model.id);if(!i)return t.ui.notify(`Previous model not found: ${r}`,A),Z(`restore`,r,se),!1;try{if(!await e.setModel(i))return t.ui.notify(`Previous model is unavailable without authentication: ${r}`,A),Z(`restore`,r,ce),!1}catch(e){return t.ui.notify(`Previous model could not be restored: ${r}`,A),Z(`restore`,r,le),c.recordError(a.PLAN_EVENT.modelResolveFailed,e,{[oe]:r,"plan.model.phase":`restore`,"plan.model.reason":le}),!1}}return e.setThinkingLevel(n.thinking),!0}function Ve(e){b&&x?e.ui.notify(`Already in plan:${x}.`,ae):e.ui.notify(`Plan mode is inactive.`,ae)}function Q(e){let t=ve.then(e,e);return ve=t.then(()=>void 0,()=>void 0),t}async function He(e){if(!G&&!H.match(/^(draft|review)$/u))return;(H===`draft`||H===`review`)&&(U=H),We.cancel(e);let t=G;if(t)try{await t}catch(e){c.recordError(a.PLAN_EVENT.modeDisabled,e,{[N]:`fable`,"plan.fable.reason":`cancel_failed`})}G=void 0,U&&(H=`interrupted`),W&&Y(W),X()}async function $(n,r,i,o){if(W=n,b){if(x===r){Ve(n);return}x===`fable`&&await He(`Leaving Fable for plan:${r}.`),x=r,Re(),e.setActiveTools(ke(S?.tools??[],e.getAllTools().map(e=>e.name),r,ye)),Y(n),X(),c.recordEvent(a.PLAN_EVENT.modeEnabled,{[M]:i,[N]:r,"plan.tool.count":e.getActiveTools().length});return}let s;try{s=t()}catch(e){throw c.recordError(a.PLAN_EVENT.configLoadFailed,e,{[M]:i}),e}o?L??=z():(F=void 0,R=!1,L=z(),U=void 0,H=`idle`),C=s,S??={tools:[...e.getActiveTools()],...n.model?{model:{provider:n.model.provider,id:n.model.id}}:{},thinking:e.getThinkingLevel()},b=!0,x=r,e.setActiveTools(ke(S.tools,e.getAllTools().map(e=>e.name),r,ye)),Re(),await ze(n),Y(n),X(),c.recordEvent(a.PLAN_EVENT.modeEnabled,{[M]:i,[N]:r,"plan.tool.count":e.getActiveTools().length,...C?.main?.model?{[oe]:C.main.model}:{},...C?.main?.thinking?{"plan.thinking":C.main.thinking}:{}})}async function Ue(t,n){if(!b)return Ve(t),!1;await He(`Plan mode is exiting.`);let r=S;if(!await Be(t,r))return t.ui.notify(`Previous model was not restored. Plan mode remains read-only.`,A),Y(t),X(),c.recordWarning(a.PLAN_EVENT.modeDisabled,`Plan mode restoration failed.`,{[M]:n,[N]:x??`unknown`,"plan.restored":!1}),!1;let i=!!F;return e.setActiveTools([...r?.tools??[]]),O?.dispose(),O=void 0,b=!1,x=void 0,C=void 0,S=void 0,V=void 0,H=`idle`,U=void 0,Y(t),X(),c.recordEvent(a.PLAN_EVENT.modeDisabled,{[M]:n,[N]:`normal`,"plan.written":i,"plan.restored":!0}),!0}let We=n.createFablePlanFlow({broker:xe,isAuthorized:()=>b&&x===`fable`&&q(),onStage:e=>{H=e,(e===`completed`||e===`failed`||e===`cancelled`)&&(U=void 0),W&&Y(W),b&&X()},onError:e=>{c.recordError(a.PLAN_EVENT.modeEnabled,e,{[N]:`fable`,"plan.fable.reason":`flow_error`})}});e.registerTool({name:E,label:`Record Debug Evidence`,description:`Record optional bounded debug evidence while planning a repository fix.`,promptSnippet:`Record the issue and any relevant reproduction, logs, traces, process output, or browser evidence`,parameters:{type:`object`,properties:{issue:{type:`string`},expectedBehavior:{type:`string`},reproductionAttempt:{type:`string`},actualBehavior:{type:`string`},logs:{type:`array`,items:{type:`string`}},correlatedTraceEvidence:{type:`array`,items:{type:`string`}},processOutput:{type:`array`,items:{type:`string`}},browserConsoleEvidence:{type:`array`,items:{type:`string`}},correlationIds:{type:`array`,items:{type:`string`}},timestamps:{type:`array`,items:{type:`string`}},verifiedFacts:{type:`array`,items:{type:`string`}},hypotheses:{type:`array`,items:{type:`string`}},unavailableEvidence:{type:`array`,items:{type:`string`}}},required:[`issue`],additionalProperties:!1},async execute(e,t){if(!b||x!==`debug`)return{content:[{type:`text`,text:`Debug planning is not active.`}],details:{recorded:!1}};try{V=De(t)}catch(e){throw c.recordWarning(a.PLAN_EVENT.modeEnabled,e,{[N]:`debug`,"plan.debug.reason":`invalid_evidence`}),e}return W&&Y(W),{content:[{type:`text`,text:`Debug evidence recorded as optional planning context.`}],details:{recorded:!0}}}}),e.registerTool({name:D,label:`Run Fable Plan`,description:`Send a bounded, sanitized planning packet to the local Fable broker for one repository-aware draft.`,promptSnippet:`Run the local Fable draft with the bounded planning packet`,parameters:{type:`object`,properties:{goal:{type:`array`,items:{type:`string`}},constraints:{type:`array`,items:{type:`string`}},decisions:{type:`array`,items:{type:`string`}},verifiedFindings:{type:`array`,items:{type:`object`}},inferredFindings:{type:`array`,items:{type:`string`}},unresolvedQuestions:{type:`array`,items:{type:`string`}},currentPlan:{type:`string`}},additionalProperties:!1},async execute(e,t,n){if(!b||x!==`fable`)return{content:[{type:`text`,text:`Fable planning is not active.`}],details:{started:!1}};if(!q())return{content:[{type:`text`,text:`The local Fable broker is unavailable. Fable planning remains disabled.`}],details:{started:!1,errorCode:`broker_unavailable`}};let r=We.run(t,n);G=r;try{let e=await r;return{content:[{type:`text`,text:e.draft?`Fable draft:\n${e.draft}`:`Fable planning ${e.status}: ${e.errorCode??`no output`}.`}],details:{...e,started:!0}}}finally{G===r&&(G=void 0)}}}),e.registerTool({name:y,label:`Write Plan`,description:`After presenting the complete implementation plan as Markdown in chat, save that visible plan to a unique Markdown file in the configured plans directory.`,promptSnippet:`Save the implementation plan already presented in chat to the configured plans directory`,parameters:{type:`object`,properties:{},additionalProperties:!1},async execute(t,n,r,i,d){if(!b)return{content:[{type:`text`,text:`Plan mode is disabled. Use normal file tools instead.`}],details:{written:!1}};let f=ge(d.sessionManager.getBranch(),t);if(!f){let e=Error(`Present the complete implementation plan as visible Markdown in chat before calling write_plan.`);throw c.recordError(a.PLAN_EVENT.writePlanFailed,e,{"plan.reason":`missing_visible_plan`}),e}let p=Date.now(),te=(0,o.getHarnessState)().root??d.cwd,m=(0,o.resolvePlanningPlansDirectory)(C?.plansDirectory,te,ee.default.homedir()),ne=he(d.sessionManager.getSessionId());L??=z();let h=F?.planId===L&&u.default.dirname(F.path)===m?F.path:void 0,g=me(f),_=L,v=h??u.default.join(m,`${g}--${_}.md`),y=new AbortController,ie=Error(`Writing ${v} timed out after ${P}ms.`),x=setTimeout(()=>y.abort(ie),P),S=r?AbortSignal.any([r,y.signal]):y.signal,w=`checking`,T=()=>{i?.({content:[{type:`text`,text:`${w===`checking`?`Checking`:`Writing`} ${v}...`}],details:{phase:w,path:v,startedAt:p}})},E=(e,t)=>{c.recordWarning(a.PLAN_EVENT.writePlanUnsafePath,t,{"plan.phase":w,"plan.refusal":e})};try{T();try{await B(()=>l.default.promises.mkdir(m,{recursive:!0,mode:448}),S)}catch(e){throw S.aborted?_e(S):Error(`Could not create the configured plans directory ${m}.`,{cause:e})}let t=await B(()=>l.default.promises.lstat(m),S),n=await B(()=>l.default.promises.realpath(m),S);if(t.isSymbolicLink()||!t.isDirectory())return E(`unsafe_plans_directory`,`Refused to write the plan because the configured path is unsafe.`),{content:[{type:`text`,text:`Refused to write the plan because the configured path is unsafe.`}],details:{written:!1,path:v,phase:w,durationMs:Date.now()-p}};w=`writing`,T();let r;try{for(let e=0;e<3;e+=1)try{let e=h?0:l.default.constants.O_EXCL;r=await B(()=>l.default.promises.open(v,l.default.constants.O_CREAT|l.default.constants.O_WRONLY|l.default.constants.O_NONBLOCK|l.default.constants.O_NOFOLLOW|e,384),S);break}catch(t){if(!(!h&&t instanceof Error&&`code`in t&&String(t.code)===`EEXIST`)||e===2)throw t;_=z(),L=_,v=u.default.join(m,`${g}--${_}.md`),X()}if(!r)throw Error(`Could not allocate a unique plan filename in ${m}.`);let e=await B(()=>l.default.promises.realpath(m),S),t=await B(()=>r.stat(),S);if(e!==n||!t.isFile()||t.nlink!==1)return E(`invalid_destination`,j),{content:[{type:`text`,text:j}],details:{written:!1,path:v,phase:w,durationMs:Date.now()-p}};await B(()=>r.truncate(0),S),await B(()=>r.writeFile(f,{encoding:`utf8`,signal:S}),S)}catch(e){if(e instanceof Error&&`code`in e&&[`EISDIR`,`ELOOP`,`ENXIO`].includes(String(e.code)))return E(`invalid_destination`,j),{content:[{type:`text`,text:j}],details:{written:!1,path:v,phase:w,durationMs:Date.now()-p}};throw e}finally{await r?.close()}return F={content:f,path:v,sessionId:ne,planId:_,title:g,writtenAt:new Date().toISOString()},e.appendEntry(re,F),R=!0,c.recordEvent(a.PLAN_EVENT.planWritten,{"plan.written":!0,"plan.bytes":s.Buffer.byteLength(f,`utf8`),"plan.duration_ms":Date.now()-p,"plan.revised":!!h}),{content:[{type:`text`,text:`Wrote implementation plan to ${v}.`}],details:{written:!0,path:v,phase:w,durationMs:Date.now()-p}}}catch(e){let t={"plan.phase":w,"plan.duration_ms":Date.now()-p};if(y.signal.aborted&&!r?.aborted){let n=Error(`write_plan timed out during ${w} for ${v}.`,{cause:e});throw c.recordError(a.PLAN_EVENT.writePlanTimedOut,n,{...t,"plan.timeout_ms":P}),n}throw c.recordError(a.PLAN_EVENT.writePlanFailed,e,{...t,"plan.cancelled":r?.aborted??!1}),e}finally{clearTimeout(x)}}}),e.registerTool({name:v,label:`Complete Plan`,description:`Use only after presenting a concrete implementation plan. Ask the user whether to exit plan mode and begin implementation or continue planning.`,promptSnippet:`Ask the user whether to exit plan mode after the implementation plan is complete`,parameters:{type:`object`,properties:{},additionalProperties:!1},async execute(e,t,n,r,i){if(!b)return{content:[{type:`text`,text:`Plan mode is already disabled.`}],details:{exited:!1}};if(!R)return{content:[{type:`text`,text:`Present the complete plan in chat and save it with write_plan before requesting approval.`}],details:{exited:!1}};if(!i.hasUI)return c.recordEvent(a.PLAN_EVENT.planReviewCompleted,{"plan.outcome":`no_ui`}),{content:[{type:`text`,text:`The plan is complete, but this run cannot ask the user interactively. Remain in plan mode until the user uses SPC p e.`}],details:{exited:!1}};let o=await i.ui.select(`Plan complete. What would you like to do?`,[de,`Continue planning`]);if(c.recordEvent(a.PLAN_EVENT.planReviewCompleted,{"plan.outcome":o===de?`exited`:`continued`}),o===de){let e=await Q(()=>Ue(i,`plan_approved`));return{content:[{type:`text`,text:e?`The user approved exiting plan mode. Full tool access is restored. Begin implementing the approved plan.`:`The previous model could not be restored. Plan mode remains read-only.`}],details:{exited:e}}}return R=!1,{content:[{type:`text`,text:`The user chose to continue planning. Remain read-only and refine the plan.`}],details:{exited:!1}}}}),K&&(0,p.registerDoomLeaderActionHandlers)(e,{source:k,handlers:{"plan.normal":()=>{let e=W;return e?Q(()=>$(e,`normal`,I,!1)):void 0},"plan.exit":()=>{let e=W;return e?Q(async()=>{await Ue(e,I)}):void 0},"plan.debug":()=>{let e=W;return e?Q(()=>$(e,`debug`,I,!1)):void 0},"plan.fable":()=>{let e=W;return e?Q(()=>$(e,`fable`,I,!1)):void 0}},onError:(e,t)=>{W?.hasUI&&W.ui.notify(`Leader action ${t} failed. Plan mode remains read-only.`,A),c.recordError(a.PLAN_EVENT.modeEnabled,e,{[M]:I,"plan.action":t})}}),e.on(`tool_call`,async(e,t)=>{if(!b)return;let n=x===`debug`&&(e.toolName===E||ye.has(e.toolName))||x===`fable`&&e.toolName===D;if(!fe.has(e.toolName)&&!n)return{block:!0,reason:`Plan mode blocks the ${e.toolName} tool. Use SPC p e to restore access.`};let r=je(C?.subagents,t.model);if(e.toolName===T){r&&Ne(e.input,r);return}if(e.toolName!==w)return;let i=e.input;if(Pe(i.action))return{block:!0,reason:`Plan mode blocks subagent management action '${i.action}'. Use SPC p e first.`};Ae(i),r&&Me(i,r)}),e.on(`before_agent_start`,async(e,t)=>{let n=[];if(b){let e=(0,o.getHarnessState)().root??t.cwd,r=(0,o.resolvePlanningPlansDirectory)(C?.plansDirectory,e,ee.default.homedir());n.push(`[PLAN MODE ACTIVE]\nYou are in repository read-only plan mode. The dedicated write_plan tool may write one unique Markdown plan file under ${r}.\n\nExplore the codebase and produce a concrete implementation plan. For every plan, first call subagent with action "agents", cluster the exploration by independent domain, subsystem, or integration boundary, and create a provisional task graph with the task tool. Select specialized agents by matching their names and descriptions to each cluster. Assign every unblocked delegated task through the task tool, and use a one-shot inlineAgent with a focused systemPrompt when no discovered specialist fits. Treat the initial graph as provisional, not as a fixed contract. After findings arrive, review the entire graph at least once and perform one to three review passes in total. In each pass, use the evidence to add, rewrite, delete, cancel, reassign, or change blockedBy relationships for tasks when warranted. Do not keep following tasks that new information has made stale. Stop revising early when the graph is stable, or after the third pass.\n\nEvery plan must end with a delegated planning-draft stage blocked by all exploration and decision tasks. A single-boundary plan gets one planning draft. A complex plan spanning multiple subsystems, domains, packages, apps, or integration boundaries gets two planning drafts concurrently. Use three concurrent drafts instead when the work is cross-layer, migration-sensitive, security-sensitive, or similarly high risk. Assign each draft through the task tool to the discovered "planner" agent with context "fork" so it receives the conversation and gathered evidence. If the planner agent is unavailable, assign the same draft task through the task tool with a focused inlineAgent. All children receive read, Bash, grep, find, ls, and configured MCP tools with artifacts disabled. Bash and MCP tools are for read-only inspection and must not modify files, external systems, or repository state. Doom Team runs asynchronously, so do not poll. After launch, continue non-overlapping exploration or end the turn and wait for completion notifications.\n\nAfter all planning drafts complete, the main agent must compare the candidates, pick the strongest draft, cross-check it against the gathered evidence and the other drafts, resolve conflicts and gaps, and ask the user only for product decisions. A child produces the draft, but the main agent owns and synthesizes the final plan. Do not modify files or repository state except through write_plan. Start the final plan with a meaningful Markdown H1 because write_plan derives the filename from it. Present the complete plan as visible Markdown in chat, then call write_plan with no arguments. After write_plan succeeds, clear the completed durable task graph and call complete_plan so the user can review the plan and choose whether to begin implementation or continue planning. Do not exit plan mode without that approval.`,i.buildFlavorPlanningPrompt(x,r,V,H))}if(F&&n.push(`[CURRENT PLAN]\nSource: ${F.path}\n\n${F.content}`),n.length!==0)return{systemPrompt:`${e.systemPrompt}\n\n${n.join(`
|
|
4
|
-
|
|
5
|
-
`)}`}}),e.on(`context`,async e=>({messages:e.messages.filter(e=>e.customType!==`agent-harness-plan-mode-context`)})),e.on(`session_start`,async(t,n)=>{let r=n.sessionManager.getEntries(),i=r.flatMap(e=>e.type===`custom`&&e.customType===_?[Se(e.data)]:[]).filter(e=>e!==void 0).at(-1),a=he(n.sessionManager.getSessionId()),o=r.flatMap(e=>e.type===`custom`&&e.customType===re?[Ce(e.data)]:[]).filter(e=>e!==void 0).at(-1),s=S;if(O?.dispose(),O=void 0,F=o?.sessionId===a?o:void 0,L=i?.planId??F?.planId,R=!1,C=void 0,V=void 0,b=!1,x=void 0,Oe(),S=i?.originalSnapshot,U=i?.interruptedFableStage,H=U?`interrupted`:`idle`,W=n,i?.activeFlavor)await $(n,i.activeFlavor,`session_restore`,!0);else{let t=i?.originalSnapshot??s;t?await Be(n,t)&&e.setActiveTools([...t.tools]):e.setActiveTools(e.getActiveTools().filter(e=>e!==v&&e!==y&&e!==E&&e!==D)),S=void 0,Y(n)}}),e.on(`session_shutdown`,async(t,n)=>{await He(`Plan host session is shutting down.`),b&&S&&await Be(n,S)&&e.setActiveTools([...S.tools]),O?.dispose(),O=void 0,Ee.dispose(),W=void 0,await c.shutdown()})}exports.WRITE_PLAN_TIMEOUT_MS=P,exports.configurePlanningSubagentInput=Me,exports.configurePlanningTaskInput=Ne,exports.constrainSubagentInput=Ae,exports.createPlanIdentifier=z,exports.isBlockedSubagentManagementAction=Pe,exports.loadPlanningModeConfig=Ie,exports.parseDebugEvidencePacket=De,exports.parsePersistedPlanState=Se,exports.planModeExtension=Re,exports.planModeTools=Oe,exports.planSessionIdentifier=he,exports.planTitleSlug=me,exports.planningSubagentModel=je,exports.visiblePlanForToolCall=ge;
|
|
6
|
-
//# sourceMappingURL=planMode.cjs.map
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./services/plan/planMode.cjs`);exports.WRITE_PLAN_TIMEOUT_MS=e.WRITE_PLAN_TIMEOUT_MS,exports.configurePlanningSubagentInput=e.configurePlanningSubagentInput,exports.configurePlanningTaskInput=e.configurePlanningTaskInput,exports.constrainSubagentInput=e.constrainSubagentInput,exports.createPlanIdentifier=e.createPlanIdentifier,exports.isBlockedSubagentManagementAction=e.isBlockedSubagentManagementAction,exports.loadPlanningModeConfig=e.loadPlanningModeConfig,exports.parseDebugEvidencePacket=e.parseDebugEvidencePacket,exports.parsePersistedPlanState=e.parsePersistedPlanState,exports.planModeExtension=e.planModeExtension,exports.planModeTools=e.planModeTools,exports.planSessionIdentifier=e.planSessionIdentifier,exports.planTitleSlug=e.planTitleSlug,exports.planningSubagentModel=e.planningSubagentModel,exports.visiblePlanForToolCall=e.visiblePlanForToolCall;
|
package/dist/planMode.d.cts
CHANGED
|
@@ -1,75 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { PlanTelemetry } from "./logSinkTelemetry.cjs";
|
|
5
|
-
import { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
6
|
-
|
|
7
|
-
//#region src/planMode.d.ts
|
|
8
|
-
declare const WRITE_PLAN_TIMEOUT_MS = 5000;
|
|
9
|
-
declare const PLAN_STATE_VERSION: 2;
|
|
10
|
-
interface ModelIdentity {
|
|
11
|
-
provider: string;
|
|
12
|
-
id: string;
|
|
13
|
-
}
|
|
14
|
-
interface PlanSnapshot {
|
|
15
|
-
tools: string[];
|
|
16
|
-
model?: ModelIdentity;
|
|
17
|
-
thinking: PlanningThinkingLevel;
|
|
18
|
-
}
|
|
19
|
-
interface PersistedPlanModeState {
|
|
20
|
-
version: typeof PLAN_STATE_VERSION;
|
|
21
|
-
activeFlavor?: PlanningFlavor;
|
|
22
|
-
originalSnapshot?: PlanSnapshot;
|
|
23
|
-
planId?: string;
|
|
24
|
-
interruptedFableStage?: FableStage;
|
|
25
|
-
}
|
|
26
|
-
interface PlanModeExtensionOptions {
|
|
27
|
-
fableBroker?: FablePlanBroker;
|
|
28
|
-
debugDiagnosticTools?: readonly string[];
|
|
29
|
-
doomIntegrations?: boolean;
|
|
30
|
-
}
|
|
31
|
-
declare function planTitleSlug(markdown: string): string;
|
|
32
|
-
declare function planSessionIdentifier(sessionId: string): string;
|
|
33
|
-
declare function createPlanIdentifier(now?: Date, id?: `${string}-${string}-${string}-${string}-${string}`): string;
|
|
34
|
-
declare function visiblePlanForToolCall(entries: readonly unknown[], toolCallId: string): string | undefined;
|
|
35
|
-
type MutableSubagentStep = {
|
|
36
|
-
model?: string;
|
|
37
|
-
output?: string | boolean;
|
|
38
|
-
progress?: boolean;
|
|
39
|
-
worktree?: boolean;
|
|
40
|
-
parallel?: MutableSubagentStep | MutableSubagentStep[];
|
|
41
|
-
};
|
|
42
|
-
type MutableSubagentRunRequest = {
|
|
43
|
-
[key: string]: unknown;
|
|
44
|
-
model?: string;
|
|
45
|
-
};
|
|
46
|
-
type MutableSubagentInput = MutableSubagentStep & {
|
|
47
|
-
action?: string;
|
|
48
|
-
artifacts?: boolean;
|
|
49
|
-
outputSchema?: Record<string, unknown>;
|
|
50
|
-
share?: boolean;
|
|
51
|
-
tasks?: MutableSubagentStep[];
|
|
52
|
-
chain?: MutableSubagentStep[];
|
|
53
|
-
chainDir?: string;
|
|
54
|
-
sessionDir?: string;
|
|
55
|
-
requests?: MutableSubagentRunRequest[];
|
|
56
|
-
};
|
|
57
|
-
type MutableTaskInput = {
|
|
58
|
-
action?: string;
|
|
59
|
-
model?: string;
|
|
60
|
-
};
|
|
61
|
-
declare function parsePersistedPlanState(value: unknown): PersistedPlanModeState | undefined;
|
|
62
|
-
declare function parseDebugEvidencePacket(value: unknown): DebugEvidencePacket;
|
|
63
|
-
declare function planModeTools(activeTools: string[], availableTools: string[]): string[];
|
|
64
|
-
declare function constrainSubagentInput(input: MutableSubagentInput): void;
|
|
65
|
-
declare function planningSubagentModel(config: PlanningAgentConfig | undefined, currentModel: ModelIdentity | undefined): string | undefined;
|
|
66
|
-
declare function configurePlanningSubagentInput(input: MutableSubagentInput, model: string): void;
|
|
67
|
-
declare function configurePlanningTaskInput(input: MutableTaskInput, model: string): void;
|
|
68
|
-
declare function isBlockedSubagentManagementAction(action: string | undefined): boolean;
|
|
69
|
-
type PlanningConfigProvider = () => PlanningModeConfig | undefined;
|
|
70
|
-
/** Reads Doom settings from disk so each plan-mode activation sees current configuration. */
|
|
71
|
-
declare function loadPlanningModeConfig(environment?: NodeJS.ProcessEnv, currentDirectory?: string): PlanningModeConfig | undefined;
|
|
72
|
-
declare function planModeExtension(pi: ExtensionAPI, planningConfigProvider?: PlanningConfigProvider, telemetry?: PlanTelemetry, options?: PlanModeExtensionOptions): void;
|
|
73
|
-
//#endregion
|
|
74
|
-
export { ModelIdentity, PlanModeExtensionOptions, PlanSnapshot, PlanningConfigProvider, WRITE_PLAN_TIMEOUT_MS, configurePlanningSubagentInput, configurePlanningTaskInput, constrainSubagentInput, createPlanIdentifier, isBlockedSubagentManagementAction, loadPlanningModeConfig, parseDebugEvidencePacket, parsePersistedPlanState, planModeExtension, planModeTools, planSessionIdentifier, planTitleSlug, planningSubagentModel, visiblePlanForToolCall };
|
|
75
|
-
//# sourceMappingURL=planMode.d.cts.map
|
|
1
|
+
import { PlanningFlavor } from "./services/plan/prompts.cjs";
|
|
2
|
+
import { ModelIdentity, PlanModeExtensionOptions, PlanSnapshot, PlanningConfigProvider, WRITE_PLAN_TIMEOUT_MS, configurePlanningSubagentInput, configurePlanningTaskInput, constrainSubagentInput, createPlanIdentifier, isBlockedSubagentManagementAction, loadPlanningModeConfig, parseDebugEvidencePacket, parsePersistedPlanState, planModeExtension, planModeTools, planSessionIdentifier, planTitleSlug, planningSubagentModel, visiblePlanForToolCall } from "./services/plan/planMode.cjs";
|
|
3
|
+
export { ModelIdentity, PlanModeExtensionOptions, PlanSnapshot, PlanningConfigProvider, PlanningFlavor, WRITE_PLAN_TIMEOUT_MS, configurePlanningSubagentInput, configurePlanningTaskInput, constrainSubagentInput, createPlanIdentifier, isBlockedSubagentManagementAction, loadPlanningModeConfig, parseDebugEvidencePacket, parsePersistedPlanState, planModeExtension, planModeTools, planSessionIdentifier, planTitleSlug, planningSubagentModel, visiblePlanForToolCall };
|
package/dist/planMode.d.mts
CHANGED
|
@@ -1,75 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { PlanTelemetry } from "./logSinkTelemetry.mjs";
|
|
5
|
-
import { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
6
|
-
|
|
7
|
-
//#region src/planMode.d.ts
|
|
8
|
-
declare const WRITE_PLAN_TIMEOUT_MS = 5000;
|
|
9
|
-
declare const PLAN_STATE_VERSION: 2;
|
|
10
|
-
interface ModelIdentity {
|
|
11
|
-
provider: string;
|
|
12
|
-
id: string;
|
|
13
|
-
}
|
|
14
|
-
interface PlanSnapshot {
|
|
15
|
-
tools: string[];
|
|
16
|
-
model?: ModelIdentity;
|
|
17
|
-
thinking: PlanningThinkingLevel;
|
|
18
|
-
}
|
|
19
|
-
interface PersistedPlanModeState {
|
|
20
|
-
version: typeof PLAN_STATE_VERSION;
|
|
21
|
-
activeFlavor?: PlanningFlavor;
|
|
22
|
-
originalSnapshot?: PlanSnapshot;
|
|
23
|
-
planId?: string;
|
|
24
|
-
interruptedFableStage?: FableStage;
|
|
25
|
-
}
|
|
26
|
-
interface PlanModeExtensionOptions {
|
|
27
|
-
fableBroker?: FablePlanBroker;
|
|
28
|
-
debugDiagnosticTools?: readonly string[];
|
|
29
|
-
doomIntegrations?: boolean;
|
|
30
|
-
}
|
|
31
|
-
declare function planTitleSlug(markdown: string): string;
|
|
32
|
-
declare function planSessionIdentifier(sessionId: string): string;
|
|
33
|
-
declare function createPlanIdentifier(now?: Date, id?: `${string}-${string}-${string}-${string}-${string}`): string;
|
|
34
|
-
declare function visiblePlanForToolCall(entries: readonly unknown[], toolCallId: string): string | undefined;
|
|
35
|
-
type MutableSubagentStep = {
|
|
36
|
-
model?: string;
|
|
37
|
-
output?: string | boolean;
|
|
38
|
-
progress?: boolean;
|
|
39
|
-
worktree?: boolean;
|
|
40
|
-
parallel?: MutableSubagentStep | MutableSubagentStep[];
|
|
41
|
-
};
|
|
42
|
-
type MutableSubagentRunRequest = {
|
|
43
|
-
[key: string]: unknown;
|
|
44
|
-
model?: string;
|
|
45
|
-
};
|
|
46
|
-
type MutableSubagentInput = MutableSubagentStep & {
|
|
47
|
-
action?: string;
|
|
48
|
-
artifacts?: boolean;
|
|
49
|
-
outputSchema?: Record<string, unknown>;
|
|
50
|
-
share?: boolean;
|
|
51
|
-
tasks?: MutableSubagentStep[];
|
|
52
|
-
chain?: MutableSubagentStep[];
|
|
53
|
-
chainDir?: string;
|
|
54
|
-
sessionDir?: string;
|
|
55
|
-
requests?: MutableSubagentRunRequest[];
|
|
56
|
-
};
|
|
57
|
-
type MutableTaskInput = {
|
|
58
|
-
action?: string;
|
|
59
|
-
model?: string;
|
|
60
|
-
};
|
|
61
|
-
declare function parsePersistedPlanState(value: unknown): PersistedPlanModeState | undefined;
|
|
62
|
-
declare function parseDebugEvidencePacket(value: unknown): DebugEvidencePacket;
|
|
63
|
-
declare function planModeTools(activeTools: string[], availableTools: string[]): string[];
|
|
64
|
-
declare function constrainSubagentInput(input: MutableSubagentInput): void;
|
|
65
|
-
declare function planningSubagentModel(config: PlanningAgentConfig | undefined, currentModel: ModelIdentity | undefined): string | undefined;
|
|
66
|
-
declare function configurePlanningSubagentInput(input: MutableSubagentInput, model: string): void;
|
|
67
|
-
declare function configurePlanningTaskInput(input: MutableTaskInput, model: string): void;
|
|
68
|
-
declare function isBlockedSubagentManagementAction(action: string | undefined): boolean;
|
|
69
|
-
type PlanningConfigProvider = () => PlanningModeConfig | undefined;
|
|
70
|
-
/** Reads Doom settings from disk so each plan-mode activation sees current configuration. */
|
|
71
|
-
declare function loadPlanningModeConfig(environment?: NodeJS.ProcessEnv, currentDirectory?: string): PlanningModeConfig | undefined;
|
|
72
|
-
declare function planModeExtension(pi: ExtensionAPI, planningConfigProvider?: PlanningConfigProvider, telemetry?: PlanTelemetry, options?: PlanModeExtensionOptions): void;
|
|
73
|
-
//#endregion
|
|
74
|
-
export { ModelIdentity, PlanModeExtensionOptions, PlanSnapshot, PlanningConfigProvider, WRITE_PLAN_TIMEOUT_MS, configurePlanningSubagentInput, configurePlanningTaskInput, constrainSubagentInput, createPlanIdentifier, isBlockedSubagentManagementAction, loadPlanningModeConfig, parseDebugEvidencePacket, parsePersistedPlanState, planModeExtension, planModeTools, planSessionIdentifier, planTitleSlug, planningSubagentModel, visiblePlanForToolCall };
|
|
75
|
-
//# sourceMappingURL=planMode.d.mts.map
|
|
1
|
+
import { PlanningFlavor } from "./services/plan/prompts.mjs";
|
|
2
|
+
import { ModelIdentity, PlanModeExtensionOptions, PlanSnapshot, PlanningConfigProvider, WRITE_PLAN_TIMEOUT_MS, configurePlanningSubagentInput, configurePlanningTaskInput, constrainSubagentInput, createPlanIdentifier, isBlockedSubagentManagementAction, loadPlanningModeConfig, parseDebugEvidencePacket, parsePersistedPlanState, planModeExtension, planModeTools, planSessionIdentifier, planTitleSlug, planningSubagentModel, visiblePlanForToolCall } from "./services/plan/planMode.mjs";
|
|
3
|
+
export { ModelIdentity, PlanModeExtensionOptions, PlanSnapshot, PlanningConfigProvider, PlanningFlavor, WRITE_PLAN_TIMEOUT_MS, configurePlanningSubagentInput, configurePlanningTaskInput, constrainSubagentInput, createPlanIdentifier, isBlockedSubagentManagementAction, loadPlanningModeConfig, parseDebugEvidencePacket, parsePersistedPlanState, planModeExtension, planModeTools, planSessionIdentifier, planTitleSlug, planningSubagentModel, visiblePlanForToolCall };
|
package/dist/planMode.mjs
CHANGED
|
@@ -1,6 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
|
|
3
|
-
`).trim()||void 0}}function De(e){return e.reason instanceof Error?e.reason:Error(`Plan write cancelled.`)}async function V(e,t){if(t.aborted)throw De(t);let n,r=new Promise((e,r)=>{n=()=>r(De(t)),t.addEventListener(`abort`,n,{once:!0})});try{return await Promise.race([e(),r])}finally{n&&t.removeEventListener(`abort`,n)}}function H(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function U(e){return typeof e==`string`}function W(e){if(!(!H(e)||!U(e.provider)||!U(e.id))&&!(!e.provider||!e.id||e.provider.length>128||e.id.length>128))return{provider:e.provider,id:e.id}}function Oe(e){return U(e)&&R.includes(e)?e:void 0}function G(e){return U(e)&&z.includes(e)?e:void 0}function K(e){if(!(!Array.isArray(e)||e.some(e=>!U(e))))return e.map(e=>e)}function ke(e){if(!H(e))return;let t=K(e.tools),n=Oe(e.thinking);if(!t||n===void 0)return;let r=e.model===void 0?void 0:W(e.model);if(!(e.model!==void 0&&!r))return{tools:t,...r?{model:r}:{},thinking:n}}function Ae(e){return e===`normal`||e===`debug`||e===`fable`?e:void 0}function je(e){if(e.version!==2)return;let t=e.activeFlavor===void 0?void 0:Ae(e.activeFlavor);if(e.activeFlavor!==void 0&&!t)return;let n=e.originalSnapshot===void 0?void 0:ke(e.originalSnapshot);if(e.originalSnapshot!==void 0&&!n)return;let r=e.planId===void 0?void 0:U(e.planId)?e.planId:void 0;if(e.planId!==void 0&&r===void 0)return;let i=e.interruptedFableStage===void 0?void 0:G(e.interruptedFableStage);if(!(e.interruptedFableStage!==void 0&&!i))return{version:2,...t?{activeFlavor:t}:{},...n?{originalSnapshot:n}:{},...r?{planId:r}:{},...i?{interruptedFableStage:i}:{}}}function Me(e){if(e.enabled!==!0&&e.enabled!==!1)return;let t=e.toolsBeforePlanMode===void 0?void 0:K(e.toolsBeforePlanMode);if(e.toolsBeforePlanMode!==void 0&&!t)return;let n=e.modelBeforePlanMode===void 0?void 0:W(e.modelBeforePlanMode);if(e.modelBeforePlanMode!==void 0&&!n)return;let r=e.thinkingBeforePlanMode===void 0?void 0:Oe(e.thinkingBeforePlanMode);if(e.thinkingBeforePlanMode!==void 0&&r===void 0)return;let i=e.planId===void 0?void 0:U(e.planId)?e.planId:void 0;if(e.planId!==void 0&&i===void 0)return;let a=t&&r!==void 0?{tools:t,...n?{model:n}:{},thinking:r}:void 0;return{version:2,...e.enabled?{activeFlavor:`normal`}:{},...a?{originalSnapshot:a}:{},...i?{planId:i}:{}}}function Ne(e){if(H(e))return je(e)??Me(e)}function Pe(e){if(!H(e)||!U(e.content)||!U(e.path)||!U(e.sessionId)||!U(e.title)||!U(e.writtenAt))return;let t=e.planId===void 0?void 0:U(e.planId)?e.planId:void 0;if(!(e.planId!==void 0&&t===void 0))return{content:e.content,path:e.path,sessionId:e.sessionId,...t?{planId:t}:{},title:e.title,writtenAt:e.writtenAt}}function Fe(e,t,n){if(!U(e))throw Error(`${t} must be a string.`);let r=e.trim();if(n&&!r)throw Error(`${t} must not be empty.`);if(te.byteLength(r,`utf8`)>4096)throw Error(`${t} exceeds the bounded debug evidence limit.`);return r}function q(e,t){if(!Array.isArray(e)||e.length>32)throw Error(`${t} must be a bounded string array.`);return e.map((e,n)=>Fe(e,`${t}[${n}]`,!1))}function Ie(e,t){return e===void 0?``:Fe(e,t,!1)}function J(e,t){return e===void 0?[]:q(e,t)}function Y(e,t,n){let r=new Set(t),i=Object.keys(e).find(e=>!r.has(e));if(i)throw Error(`${n} contains unsupported field '${i}'.`)}function Le(e){if(!H(e))throw Error(`Debug evidence must be an object.`);Y(e,[`issue`,`expectedBehavior`,`reproductionAttempt`,`actualBehavior`,`logs`,`correlatedTraceEvidence`,`processOutput`,`browserConsoleEvidence`,`correlationIds`,`timestamps`,`verifiedFacts`,`hypotheses`,`unavailableEvidence`],`Debug evidence`);let t={issue:Fe(e.issue,`issue`,!0),expectedBehavior:Ie(e.expectedBehavior,`expectedBehavior`),reproductionAttempt:Ie(e.reproductionAttempt,`reproductionAttempt`),actualBehavior:Ie(e.actualBehavior,`actualBehavior`),logs:J(e.logs,`logs`),correlatedTraceEvidence:J(e.correlatedTraceEvidence,`correlatedTraceEvidence`),processOutput:J(e.processOutput,`processOutput`),browserConsoleEvidence:J(e.browserConsoleEvidence,`browserConsoleEvidence`),correlationIds:J(e.correlationIds,`correlationIds`),timestamps:J(e.timestamps,`timestamps`),verifiedFacts:J(e.verifiedFacts,`verifiedFacts`),hypotheses:J(e.hypotheses,`hypotheses`),unavailableEvidence:J(e.unavailableEvidence,`unavailableEvidence`)};if(te.byteLength(JSON.stringify(t),`utf8`)>32768)throw Error(`Debug evidence exceeds the bounded packet size.`);return t}function Re(e,t){let n=new Set(t),r=e.filter(e=>Se.has(e)),i=I.filter(e=>n.has(e)),a=[w,ue,pe,C].filter(e=>n.has(e));return[...new Set([...r,...i,...a])]}function ze(e,t,n,r){let i=new Set(t),a=Re(e,t),o=n===`debug`?[O,...r].filter(e=>i.has(e)):[];return n===`fable`&&i.has(k)&&o.push(k),[...new Set([...a,...o])]}function X(e){if(e.output=!1,e.progress=!1,e.worktree=!1,Array.isArray(e.parallel))for(let t of e.parallel)X(t);else e.parallel&&X(e.parallel)}function Be(e){if(e.action!==void 0){x(e.action)&&S(e.action,`artifacts`)&&(e.artifacts=!1);return}e.artifacts=!1,e.output=!1,e.share=!1,e.progress=!1,e.worktree=!1,delete e.chainDir,delete e.outputSchema,delete e.sessionDir;for(let t of e.tasks??[])X(t);for(let t of e.chain??[])X(t)}function Ve(e,t){if(!e?.model&&!e?.thinking)return;let n=e.model??(t?`${t.provider}/${t.id}`:void 0);if(n)return e.thinking?`${n.replace(/:(?:off|minimal|low|medium|high|xhigh|max)$/,``)}:${e.thinking}`:n}function He(e,t){if(e.action===`run`)for(let n of e.requests??[])n.model=t}function Ue(e,t){e.action===`assign`&&(e.model=t)}function We(e){return new Set([`append-step`,`create`,`delete`,`disable`,`eject`,`enable`,`grant-spawn-budget`,`reset`,`schedule`,`schedule-cancel`,`update`,`watchdog.configure`]).has(e??``)}function Ge(e,t){let n=e.indexOf(`/`);if(n>0)return t.modelRegistry.find(e.slice(0,n),e.slice(n+1));let r=t.modelRegistry.getAvailable().filter(t=>t.id===e);return r.find(e=>e.provider===t.model?.provider)??(r.length===1?r[0]:void 0)}function Ke(e=process.env,r=process.cwd()){return t(n(e).state.root??r).modes?.planning}function qe(e){let t={key:`p`,label:`plan`,order:60};return[{id:`plan.normal`,path:[t,{key:`p`,label:`normal`,detail:`read-only planning`}],action:{name:`plan.normal`}},{id:`plan.debug`,path:[t,{key:`d`,label:`debug`,detail:`adaptive debug planning`}],action:{name:`plan.debug`}},{id:`plan.fable`,path:[t,{key:`f`,label:`fable`,detail:`repository-aware draft`}],action:{name:`plan.fable`}},...e?[{id:`plan.exit`,path:[t,{key:`e`,label:`exit`,detail:`restore and exit`}],action:{name:`plan.exit`}}]:[]]}function Z(t,n=Ke,d=u(),f={}){let x=!1,S,w,T,E,D,A,I=!1,R,z=`idle`,H,U,W,Oe=Promise.resolve(),G=f.doomIntegrations??!0,K=new Set(f.debugDiagnosticTools??be),ke=b(()=>U?.sessionManager.getSessionId()),Ae=f.fableBroker??{start:(e,t)=>ke.start(e,t),cancel:(e,t)=>ke.cancel({requester:y,operationId:e,reason:t})},je=()=>f.fableBroker!==void 0||ke.isAvailable(),Me=G?ae(t,{source:j,id:`plan`,order:40}):{update:()=>void 0},Fe=G?_(t,{source:j,bindings:qe(!1)}):{update:()=>void 0},q,Ie=G?g(t,{source:j,listSections:()=>{try{return o(n(),q)}catch(e){return o(void 0,e instanceof Error?e.message:String(e))}},handlers:{[h.set]:async({fieldId:e,value:t})=>{let n=s(e);!n||!t||(q=void 0,await ie(ee(),[...n.keyPath],t))},[h.clear]:async({fieldId:e})=>{let t=s(e);t&&(q=void 0,await m(ee(),[...t.keyPath]))}},onError:e=>{q=e instanceof Error?e.message:String(e)}}):{dispose:()=>void 0,update:()=>void 0};function J(){Fe.update(qe(x))}function Y(e){J();let t=S,n=x&&t?`plan:${t}`:void 0,r=t===`fable`&&z!==`idle`?` · ${z}`:``;e.ui.setStatus(`plan-mode`,n?e.ui.theme.fg(M,n):void 0),Me.update(x&&t?{label:`PLAN`,detail:`${t}${r} - read only`,color:M}:void 0)}function Re(){if(!G||!x||!S||!U)return;let e={owner:j,allowedTools:[...Ce],requiredTools:[de,`mcp`],allowMcpTools:!0,allowedExternalProfiles:S===`fable`?[i]:[],denyExtensions:!1};E?E.update(e):E=se(oe({bus:t.events,source:j,sessionId:U.sessionManager.getSessionId()}),e)}function X(){t.appendEntry(ce,{version:2,...x&&S?{activeFlavor:S}:{},...w?{originalSnapshot:{tools:[...w.tools],...w.model?{model:{...w.model}}:{},thinking:w.thinking}}:{},...A?{planId:A}:{},...H?{interruptedFableStage:H}:{}})}function Z(e,t,n){d.recordWarning(l.modelResolveFailed,`Planning model ${n}: ${t}`,{[ge]:t,"plan.model.phase":e,"plan.model.reason":n})}async function Je(e){let n=T?.main;if(n){if(n.model){let r=Ge(n.model,e);r?await t.setModel(r)||(e.ui.notify(`Planning model is unavailable without authentication: ${n.model}`,M),Z(`apply`,n.model,ve)):(e.ui.notify(`Planning model not found: ${n.model}`,M),Z(`apply`,n.model,_e))}n.thinking&&t.setThinkingLevel(n.thinking)}}async function Ye(e,n){if(!n)return!1;if(n.model){let r=`${n.model.provider}/${n.model.id}`,i=e.modelRegistry.find(n.model.provider,n.model.id);if(!i)return e.ui.notify(`Previous model not found: ${r}`,M),Z(`restore`,r,_e),!1;try{if(!await t.setModel(i))return e.ui.notify(`Previous model is unavailable without authentication: ${r}`,M),Z(`restore`,r,ve),!1}catch(t){return e.ui.notify(`Previous model could not be restored: ${r}`,M),Z(`restore`,r,ye),d.recordError(l.modelResolveFailed,t,{[ge]:r,"plan.model.phase":`restore`,"plan.model.reason":ye}),!1}}return t.setThinkingLevel(n.thinking),!0}function Xe(e){x&&S?e.ui.notify(`Already in plan:${S}.`,me):e.ui.notify(`Plan mode is inactive.`,me)}function Q(e){let t=Oe.then(e,e);return Oe=t.then(()=>void 0,()=>void 0),t}async function Ze(e){if(!W&&!z.match(/^(draft|review)$/u))return;(z===`draft`||z===`review`)&&(H=z),$e.cancel(e);let t=W;if(t)try{await t}catch(e){d.recordError(l.modeDisabled,e,{[P]:`fable`,"plan.fable.reason":`cancel_failed`})}W=void 0,H&&(z=`interrupted`),U&&Y(U),X()}async function $(e,r,i,a){if(U=e,x){if(S===r){Xe(e);return}S===`fable`&&await Ze(`Leaving Fable for plan:${r}.`),S=r,Re(),t.setActiveTools(ze(w?.tools??[],t.getAllTools().map(e=>e.name),r,K)),Y(e),X(),d.recordEvent(l.modeEnabled,{[N]:i,[P]:r,"plan.tool.count":t.getActiveTools().length});return}let o;try{o=n()}catch(e){throw d.recordError(l.configLoadFailed,e,{[N]:i}),e}a?A??=B():(D=void 0,I=!1,A=B(),H=void 0,z=`idle`),T=o,w??={tools:[...t.getActiveTools()],...e.model?{model:{provider:e.model.provider,id:e.model.id}}:{},thinking:t.getThinkingLevel()},x=!0,S=r,t.setActiveTools(ze(w.tools,t.getAllTools().map(e=>e.name),r,K)),Re(),await Je(e),Y(e),X(),d.recordEvent(l.modeEnabled,{[N]:i,[P]:r,"plan.tool.count":t.getActiveTools().length,...T?.main?.model?{[ge]:T.main.model}:{},...T?.main?.thinking?{"plan.thinking":T.main.thinking}:{}})}async function Qe(e,n){if(!x)return Xe(e),!1;await Ze(`Plan mode is exiting.`);let r=w;if(!await Ye(e,r))return e.ui.notify(`Previous model was not restored. Plan mode remains read-only.`,M),Y(e),X(),d.recordWarning(l.modeDisabled,`Plan mode restoration failed.`,{[N]:n,[P]:S??`unknown`,"plan.restored":!1}),!1;let i=!!D;return t.setActiveTools([...r?.tools??[]]),E?.dispose(),E=void 0,x=!1,S=void 0,T=void 0,w=void 0,R=void 0,z=`idle`,H=void 0,Y(e),X(),d.recordEvent(l.modeDisabled,{[N]:n,[P]:`normal`,"plan.written":i,"plan.restored":!0}),!0}let $e=a({broker:Ae,isAuthorized:()=>x&&S===`fable`&&je(),onStage:e=>{z=e,(e===`completed`||e===`failed`||e===`cancelled`)&&(H=void 0),U&&Y(U),x&&X()},onError:e=>{d.recordError(l.modeEnabled,e,{[P]:`fable`,"plan.fable.reason":`flow_error`})}});t.registerTool({name:O,label:`Record Debug Evidence`,description:`Record optional bounded debug evidence while planning a repository fix.`,promptSnippet:`Record the issue and any relevant reproduction, logs, traces, process output, or browser evidence`,parameters:{type:`object`,properties:{issue:{type:`string`},expectedBehavior:{type:`string`},reproductionAttempt:{type:`string`},actualBehavior:{type:`string`},logs:{type:`array`,items:{type:`string`}},correlatedTraceEvidence:{type:`array`,items:{type:`string`}},processOutput:{type:`array`,items:{type:`string`}},browserConsoleEvidence:{type:`array`,items:{type:`string`}},correlationIds:{type:`array`,items:{type:`string`}},timestamps:{type:`array`,items:{type:`string`}},verifiedFacts:{type:`array`,items:{type:`string`}},hypotheses:{type:`array`,items:{type:`string`}},unavailableEvidence:{type:`array`,items:{type:`string`}}},required:[`issue`],additionalProperties:!1},async execute(e,t){if(!x||S!==`debug`)return{content:[{type:`text`,text:`Debug planning is not active.`}],details:{recorded:!1}};try{R=Le(t)}catch(e){throw d.recordWarning(l.modeEnabled,e,{[P]:`debug`,"plan.debug.reason":`invalid_evidence`}),e}return U&&Y(U),{content:[{type:`text`,text:`Debug evidence recorded as optional planning context.`}],details:{recorded:!0}}}}),t.registerTool({name:k,label:`Run Fable Plan`,description:`Send a bounded, sanitized planning packet to the local Fable broker for one repository-aware draft.`,promptSnippet:`Run the local Fable draft with the bounded planning packet`,parameters:{type:`object`,properties:{goal:{type:`array`,items:{type:`string`}},constraints:{type:`array`,items:{type:`string`}},decisions:{type:`array`,items:{type:`string`}},verifiedFindings:{type:`array`,items:{type:`object`}},inferredFindings:{type:`array`,items:{type:`string`}},unresolvedQuestions:{type:`array`,items:{type:`string`}},currentPlan:{type:`string`}},additionalProperties:!1},async execute(e,t,n){if(!x||S!==`fable`)return{content:[{type:`text`,text:`Fable planning is not active.`}],details:{started:!1}};if(!je())return{content:[{type:`text`,text:`The local Fable broker is unavailable. Fable planning remains disabled.`}],details:{started:!1,errorCode:`broker_unavailable`}};let r=$e.run(t,n);W=r;try{let e=await r;return{content:[{type:`text`,text:e.draft?`Fable draft:\n${e.draft}`:`Fable planning ${e.status}: ${e.errorCode??`no output`}.`}],details:{...e,started:!0}}}finally{W===r&&(W=void 0)}}}),t.registerTool({name:C,label:`Write Plan`,description:`After presenting the complete implementation plan as Markdown in chat, save that visible plan to a unique Markdown file in the configured plans directory.`,promptSnippet:`Save the implementation plan already presented in chat to the configured plans directory`,parameters:{type:`object`,properties:{},additionalProperties:!1},async execute(n,i,a,o,s){if(!x)return{content:[{type:`text`,text:`Plan mode is disabled. Use normal file tools instead.`}],details:{written:!1}};let c=Ee(s.sessionManager.getBranch(),n);if(!c){let e=Error(`Present the complete implementation plan as visible Markdown in chat before calling write_plan.`);throw d.recordError(l.writePlanFailed,e,{"plan.reason":`missing_visible_plan`}),e}let u=Date.now(),ee=e().root??s.cwd,f=r(T?.plansDirectory,ee,ne.homedir()),ie=Te(s.sessionManager.getSessionId());A??=B();let m=D?.planId===A&&re.dirname(D.path)===f?D.path:void 0,h=we(c),g=A,_=m??re.join(f,`${h}--${g}.md`),v=new AbortController,ae=Error(`Writing ${_} timed out after ${F}ms.`),oe=setTimeout(()=>v.abort(ae),F),y=a?AbortSignal.any([a,v.signal]):v.signal,b=`checking`,se=()=>{o?.({content:[{type:`text`,text:`${b===`checking`?`Checking`:`Writing`} ${_}...`}],details:{phase:b,path:_,startedAt:u}})},S=(e,t)=>{d.recordWarning(l.writePlanUnsafePath,t,{"plan.phase":b,"plan.refusal":e})};try{se();try{await V(()=>p.promises.mkdir(f,{recursive:!0,mode:448}),y)}catch(e){throw y.aborted?De(y):Error(`Could not create the configured plans directory ${f}.`,{cause:e})}let e=await V(()=>p.promises.lstat(f),y),n=await V(()=>p.promises.realpath(f),y);if(e.isSymbolicLink()||!e.isDirectory())return S(`unsafe_plans_directory`,`Refused to write the plan because the configured path is unsafe.`),{content:[{type:`text`,text:`Refused to write the plan because the configured path is unsafe.`}],details:{written:!1,path:_,phase:b,durationMs:Date.now()-u}};b=`writing`,se();let r;try{for(let e=0;e<3;e+=1)try{let e=m?0:p.constants.O_EXCL;r=await V(()=>p.promises.open(_,p.constants.O_CREAT|p.constants.O_WRONLY|p.constants.O_NONBLOCK|p.constants.O_NOFOLLOW|e,384),y);break}catch(t){if(!(!m&&t instanceof Error&&`code`in t&&String(t.code)===`EEXIST`)||e===2)throw t;g=B(),A=g,_=re.join(f,`${h}--${g}.md`),X()}if(!r)throw Error(`Could not allocate a unique plan filename in ${f}.`);let e=await V(()=>p.promises.realpath(f),y),t=await V(()=>r.stat(),y);if(e!==n||!t.isFile()||t.nlink!==1)return S(`invalid_destination`,he),{content:[{type:`text`,text:he}],details:{written:!1,path:_,phase:b,durationMs:Date.now()-u}};await V(()=>r.truncate(0),y),await V(()=>r.writeFile(c,{encoding:`utf8`,signal:y}),y)}catch(e){if(e instanceof Error&&`code`in e&&[`EISDIR`,`ELOOP`,`ENXIO`].includes(String(e.code)))return S(`invalid_destination`,he),{content:[{type:`text`,text:he}],details:{written:!1,path:_,phase:b,durationMs:Date.now()-u}};throw e}finally{await r?.close()}return D={content:c,path:_,sessionId:ie,planId:g,title:h,writtenAt:new Date().toISOString()},t.appendEntry(le,D),I=!0,d.recordEvent(l.planWritten,{"plan.written":!0,"plan.bytes":te.byteLength(c,`utf8`),"plan.duration_ms":Date.now()-u,"plan.revised":!!m}),{content:[{type:`text`,text:`Wrote implementation plan to ${_}.`}],details:{written:!0,path:_,phase:b,durationMs:Date.now()-u}}}catch(e){let t={"plan.phase":b,"plan.duration_ms":Date.now()-u};if(v.signal.aborted&&!a?.aborted){let n=Error(`write_plan timed out during ${b} for ${_}.`,{cause:e});throw d.recordError(l.writePlanTimedOut,n,{...t,"plan.timeout_ms":F}),n}throw d.recordError(l.writePlanFailed,e,{...t,"plan.cancelled":a?.aborted??!1}),e}finally{clearTimeout(oe)}}}),t.registerTool({name:ue,label:`Complete Plan`,description:`Use only after presenting a concrete implementation plan. Ask the user whether to exit plan mode and begin implementation or continue planning.`,promptSnippet:`Ask the user whether to exit plan mode after the implementation plan is complete`,parameters:{type:`object`,properties:{},additionalProperties:!1},async execute(e,t,n,r,i){if(!x)return{content:[{type:`text`,text:`Plan mode is already disabled.`}],details:{exited:!1}};if(!I)return{content:[{type:`text`,text:`Present the complete plan in chat and save it with write_plan before requesting approval.`}],details:{exited:!1}};if(!i.hasUI)return d.recordEvent(l.planReviewCompleted,{"plan.outcome":`no_ui`}),{content:[{type:`text`,text:`The plan is complete, but this run cannot ask the user interactively. Remain in plan mode until the user uses SPC p e.`}],details:{exited:!1}};let a=await i.ui.select(`Plan complete. What would you like to do?`,[xe,`Continue planning`]);if(d.recordEvent(l.planReviewCompleted,{"plan.outcome":a===xe?`exited`:`continued`}),a===xe){let e=await Q(()=>Qe(i,`plan_approved`));return{content:[{type:`text`,text:e?`The user approved exiting plan mode. Full tool access is restored. Begin implementing the approved plan.`:`The previous model could not be restored. Plan mode remains read-only.`}],details:{exited:e}}}return I=!1,{content:[{type:`text`,text:`The user chose to continue planning. Remain read-only and refine the plan.`}],details:{exited:!1}}}}),G&&v(t,{source:j,handlers:{"plan.normal":()=>{let e=U;return e?Q(()=>$(e,`normal`,L,!1)):void 0},"plan.exit":()=>{let e=U;return e?Q(async()=>{await Qe(e,L)}):void 0},"plan.debug":()=>{let e=U;return e?Q(()=>$(e,`debug`,L,!1)):void 0},"plan.fable":()=>{let e=U;return e?Q(()=>$(e,`fable`,L,!1)):void 0}},onError:(e,t)=>{U?.hasUI&&U.ui.notify(`Leader action ${t} failed. Plan mode remains read-only.`,M),d.recordError(l.modeEnabled,e,{[N]:L,"plan.action":t})}}),t.on(`tool_call`,async(e,t)=>{if(!x)return;let n=S===`debug`&&(e.toolName===O||K.has(e.toolName))||S===`fable`&&e.toolName===k;if(!Se.has(e.toolName)&&!n)return{block:!0,reason:`Plan mode blocks the ${e.toolName} tool. Use SPC p e to restore access.`};let r=Ve(T?.subagents,t.model);if(e.toolName===pe){r&&Ue(e.input,r);return}if(e.toolName!==fe)return;let i=e.input;if(We(i.action))return{block:!0,reason:`Plan mode blocks subagent management action '${i.action}'. Use SPC p e first.`};Be(i),r&&He(i,r)}),t.on(`before_agent_start`,async(t,n)=>{let i=[];if(x){let t=e().root??n.cwd,a=r(T?.plansDirectory,t,ne.homedir());i.push(`[PLAN MODE ACTIVE]\nYou are in repository read-only plan mode. The dedicated write_plan tool may write one unique Markdown plan file under ${a}.\n\nExplore the codebase and produce a concrete implementation plan. For every plan, first call subagent with action "agents", cluster the exploration by independent domain, subsystem, or integration boundary, and create a provisional task graph with the task tool. Select specialized agents by matching their names and descriptions to each cluster. Assign every unblocked delegated task through the task tool, and use a one-shot inlineAgent with a focused systemPrompt when no discovered specialist fits. Treat the initial graph as provisional, not as a fixed contract. After findings arrive, review the entire graph at least once and perform one to three review passes in total. In each pass, use the evidence to add, rewrite, delete, cancel, reassign, or change blockedBy relationships for tasks when warranted. Do not keep following tasks that new information has made stale. Stop revising early when the graph is stable, or after the third pass.\n\nEvery plan must end with a delegated planning-draft stage blocked by all exploration and decision tasks. A single-boundary plan gets one planning draft. A complex plan spanning multiple subsystems, domains, packages, apps, or integration boundaries gets two planning drafts concurrently. Use three concurrent drafts instead when the work is cross-layer, migration-sensitive, security-sensitive, or similarly high risk. Assign each draft through the task tool to the discovered "planner" agent with context "fork" so it receives the conversation and gathered evidence. If the planner agent is unavailable, assign the same draft task through the task tool with a focused inlineAgent. All children receive read, Bash, grep, find, ls, and configured MCP tools with artifacts disabled. Bash and MCP tools are for read-only inspection and must not modify files, external systems, or repository state. Doom Team runs asynchronously, so do not poll. After launch, continue non-overlapping exploration or end the turn and wait for completion notifications.\n\nAfter all planning drafts complete, the main agent must compare the candidates, pick the strongest draft, cross-check it against the gathered evidence and the other drafts, resolve conflicts and gaps, and ask the user only for product decisions. A child produces the draft, but the main agent owns and synthesizes the final plan. Do not modify files or repository state except through write_plan. Start the final plan with a meaningful Markdown H1 because write_plan derives the filename from it. Present the complete plan as visible Markdown in chat, then call write_plan with no arguments. After write_plan succeeds, clear the completed durable task graph and call complete_plan so the user can review the plan and choose whether to begin implementation or continue planning. Do not exit plan mode without that approval.`,c(S,a,R,z))}if(D&&i.push(`[CURRENT PLAN]\nSource: ${D.path}\n\n${D.content}`),i.length!==0)return{systemPrompt:`${t.systemPrompt}\n\n${i.join(`
|
|
4
|
-
|
|
5
|
-
`)}`}}),t.on(`context`,async e=>({messages:e.messages.filter(e=>e.customType!==`agent-harness-plan-mode-context`)})),t.on(`session_start`,async(e,n)=>{let r=n.sessionManager.getEntries(),i=r.flatMap(e=>e.type===`custom`&&e.customType===ce?[Ne(e.data)]:[]).filter(e=>e!==void 0).at(-1),a=Te(n.sessionManager.getSessionId()),o=r.flatMap(e=>e.type===`custom`&&e.customType===le?[Pe(e.data)]:[]).filter(e=>e!==void 0).at(-1),s=w;if(E?.dispose(),E=void 0,D=o?.sessionId===a?o:void 0,A=i?.planId??D?.planId,I=!1,T=void 0,R=void 0,x=!1,S=void 0,J(),w=i?.originalSnapshot,H=i?.interruptedFableStage,z=H?`interrupted`:`idle`,U=n,i?.activeFlavor)await $(n,i.activeFlavor,`session_restore`,!0);else{let e=i?.originalSnapshot??s;e?await Ye(n,e)&&t.setActiveTools([...e.tools]):t.setActiveTools(t.getActiveTools().filter(e=>e!==ue&&e!==C&&e!==O&&e!==k)),w=void 0,Y(n)}}),t.on(`session_shutdown`,async(e,n)=>{await Ze(`Plan host session is shutting down.`),x&&w&&await Ye(n,w)&&t.setActiveTools([...w.tools]),E?.dispose(),E=void 0,Ie.dispose(),U=void 0,await d.shutdown()})}export{F as WRITE_PLAN_TIMEOUT_MS,He as configurePlanningSubagentInput,Ue as configurePlanningTaskInput,Be as constrainSubagentInput,B as createPlanIdentifier,We as isBlockedSubagentManagementAction,Ke as loadPlanningModeConfig,Le as parseDebugEvidencePacket,Ne as parsePersistedPlanState,Z as planModeExtension,Re as planModeTools,Te as planSessionIdentifier,we as planTitleSlug,Ve as planningSubagentModel,Ee as visiblePlanForToolCall};
|
|
6
|
-
//# sourceMappingURL=planMode.mjs.map
|
|
1
|
+
import{WRITE_PLAN_TIMEOUT_MS as e,configurePlanningSubagentInput as t,configurePlanningTaskInput as n,constrainSubagentInput as r,createPlanIdentifier as i,isBlockedSubagentManagementAction as a,loadPlanningModeConfig as o,parseDebugEvidencePacket as s,parsePersistedPlanState as c,planModeExtension as l,planModeTools as u,planSessionIdentifier as d,planTitleSlug as f,planningSubagentModel as p,visiblePlanForToolCall as m}from"./services/plan/planMode.mjs";export{e as WRITE_PLAN_TIMEOUT_MS,t as configurePlanningSubagentInput,n as configurePlanningTaskInput,r as constrainSubagentInput,i as createPlanIdentifier,a as isBlockedSubagentManagementAction,o as loadPlanningModeConfig,s as parseDebugEvidencePacket,c as parsePersistedPlanState,l as planModeExtension,u as planModeTools,d as planSessionIdentifier,f as planTitleSlug,p as planningSubagentModel,m as visiblePlanForToolCall};
|
package/dist/prompts.cjs
CHANGED
|
@@ -1,3 +1 @@
|
|
|
1
|
-
const e=
|
|
2
|
-
`)}function n(e){return`[PLAN MODE ACTIVE: NORMAL]\nYou are in repository read-only normal planning. The dedicated write_plan tool may write one unique Markdown plan file under ${e}.\n\nExplore the codebase and produce a concrete implementation plan. For every plan, first call subagent with action "agents", cluster exploration by independent domain, subsystem, or integration boundary, and create a provisional task graph with the task tool. Select specialized agents by matching their names and descriptions to each cluster. Assign every unblocked delegated task through the task tool, and use a one-shot inlineAgent with a focused systemPrompt when no discovered specialist fits. Treat the initial graph as provisional, not as a fixed contract. After findings arrive, review the entire graph at least once and perform one to three review passes in total. In each pass, use evidence to add, rewrite, delete, cancel, reassign, or change blockedBy relationships for tasks when warranted. Do not keep following tasks that new information has made stale. Stop revising early when the graph is stable, or after the third pass.\n\nEvery plan must end with a delegated planning-draft stage blocked by all exploration and decision tasks. A single-boundary plan gets one planning draft. A complex plan spanning multiple subsystems, domains, packages, apps, or integration boundaries gets two planning drafts concurrently. Use three concurrent drafts instead when the work is cross-layer, migration-sensitive, security-sensitive, or similarly high risk. Assign each draft through the task tool to the discovered planner agent with context "fork" so it receives the conversation and gathered evidence. If the planner agent is unavailable, assign the same draft task through the task tool with a focused inlineAgent. All children receive read, Bash, grep, find, ls, and configured MCP tools with artifacts disabled. Bash and MCP tools are for read-only inspection and must not modify files, external systems, or repository state. Doom Team runs asynchronously, so do not poll. After launch, continue non-overlapping exploration or end the turn and wait for completion notifications.\n\nAfter all planning drafts complete, compare the candidates, pick the strongest draft, cross-check it against gathered evidence and the other drafts, resolve conflicts and gaps, and ask the user only for product decisions. A child produces the draft, but the main agent owns and synthesizes the final plan. Do not modify files or repository state except through write_plan. Start the final plan with a meaningful Markdown H1 because write_plan derives the filename from it. Present the complete plan as visible Markdown, then call write_plan with no arguments. After write_plan succeeds, clear the completed durable task graph and call complete_plan so the user can review the plan and choose whether to begin implementation or continue planning. Do not exit plan mode without that approval.`}function r(e,n){return`[PLAN MODE ACTIVE: DEBUG]\nYou are in repository read-only adaptive debug planning. The dedicated write_plan tool may write one unique Markdown plan file under ${e}.\n\n${n?`A bounded debug evidence packet is recorded below. Cite its verified facts when making source findings. Keep verified facts and hypotheses distinct. Do not claim a verified root cause when reproduction or supporting evidence is unavailable.\n\n[DEBUG EVIDENCE]\n${t(n)}`:`No structured debug evidence packet is recorded yet. First understand the reported issue, then gather only the evidence relevant to it. Recording evidence is optional and must not block source exploration, delegation, writing a plan, or completing a plan.`}\n\nUse the exact read-only tools available for the issue. Bash is available for repository inspection, but commands must not modify files or repository state. Treat unavailable evidence as unavailable, never invent its contents, and keep verified facts separate from hypotheses. ${n?`The final plan must separate verified facts from hypotheses and must not present an unsupported root cause as verified.`:`You may call record_debug_evidence when structured notes would help, but continue investigating without it when it is not relevant.`}`}function i(e,t){return`[PLAN MODE ACTIVE: FABLE]\nYou are in repository read-only Fable planning. Pi owns final verification and synthesis. The dedicated write_plan tool may write one unique Markdown plan file under ${e}.\n\nUse Pi read-only exploration first. When the bounded packet is ready, call run_fable_plan. Fable runs one fresh draft with repository inspection access and returns untrusted text. Cross-check every Fable claim against repository evidence, keep verified findings separate from explicitly inferred findings, resolve conflicts yourself, and present the final visible plan before calling write_plan. Never treat Fable output as repository evidence and never expose credentials, transcripts, commands, tools, or session data in the packet.\n\nCurrent Fable stage: ${t}. An interrupted stage is not relaunched automatically.`}function a(e,t,a,o){return e===`debug`?r(t,a):e===`fable`?i(t,o):n(t)}exports.buildDebugPlanningPrompt=r,exports.buildFablePlanningPrompt=i,exports.buildFlavorPlanningPrompt=a,exports.buildNormalPlanningPrompt=n;
|
|
3
|
-
//# sourceMappingURL=prompts.cjs.map
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./services/plan/prompts.cjs`);exports.buildDebugPlanningPrompt=e.buildDebugPlanningPrompt,exports.buildFablePlanningPrompt=e.buildFablePlanningPrompt,exports.buildFlavorPlanningPrompt=e.buildFlavorPlanningPrompt,exports.buildNormalPlanningPrompt=e.buildNormalPlanningPrompt;
|
package/dist/prompts.d.cts
CHANGED
|
@@ -1,24 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
interface DebugEvidencePacket {
|
|
4
|
-
issue: string;
|
|
5
|
-
expectedBehavior: string;
|
|
6
|
-
reproductionAttempt: string;
|
|
7
|
-
actualBehavior: string;
|
|
8
|
-
logs: string[];
|
|
9
|
-
correlatedTraceEvidence: string[];
|
|
10
|
-
processOutput: string[];
|
|
11
|
-
browserConsoleEvidence: string[];
|
|
12
|
-
correlationIds: string[];
|
|
13
|
-
timestamps: string[];
|
|
14
|
-
verifiedFacts: string[];
|
|
15
|
-
hypotheses: string[];
|
|
16
|
-
unavailableEvidence: string[];
|
|
17
|
-
}
|
|
18
|
-
declare function buildNormalPlanningPrompt(plansDirectory: string): string;
|
|
19
|
-
declare function buildDebugPlanningPrompt(plansDirectory: string, evidence: DebugEvidencePacket | undefined): string;
|
|
20
|
-
declare function buildFablePlanningPrompt(plansDirectory: string, stage: string): string;
|
|
21
|
-
declare function buildFlavorPlanningPrompt(flavor: PlanningFlavor, plansDirectory: string, evidence: DebugEvidencePacket | undefined, fableStage: string): string;
|
|
22
|
-
//#endregion
|
|
23
|
-
export { DebugEvidencePacket, PlanningFlavor, buildDebugPlanningPrompt, buildFablePlanningPrompt, buildFlavorPlanningPrompt, buildNormalPlanningPrompt };
|
|
24
|
-
//# sourceMappingURL=prompts.d.cts.map
|
|
1
|
+
import { DebugEvidencePacket, PlanningFlavor, buildDebugPlanningPrompt, buildFablePlanningPrompt, buildFlavorPlanningPrompt, buildNormalPlanningPrompt } from "./services/plan/prompts.cjs";
|
|
2
|
+
export { DebugEvidencePacket, PlanningFlavor, buildDebugPlanningPrompt, buildFablePlanningPrompt, buildFlavorPlanningPrompt, buildNormalPlanningPrompt };
|
package/dist/prompts.d.mts
CHANGED
|
@@ -1,24 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
interface DebugEvidencePacket {
|
|
4
|
-
issue: string;
|
|
5
|
-
expectedBehavior: string;
|
|
6
|
-
reproductionAttempt: string;
|
|
7
|
-
actualBehavior: string;
|
|
8
|
-
logs: string[];
|
|
9
|
-
correlatedTraceEvidence: string[];
|
|
10
|
-
processOutput: string[];
|
|
11
|
-
browserConsoleEvidence: string[];
|
|
12
|
-
correlationIds: string[];
|
|
13
|
-
timestamps: string[];
|
|
14
|
-
verifiedFacts: string[];
|
|
15
|
-
hypotheses: string[];
|
|
16
|
-
unavailableEvidence: string[];
|
|
17
|
-
}
|
|
18
|
-
declare function buildNormalPlanningPrompt(plansDirectory: string): string;
|
|
19
|
-
declare function buildDebugPlanningPrompt(plansDirectory: string, evidence: DebugEvidencePacket | undefined): string;
|
|
20
|
-
declare function buildFablePlanningPrompt(plansDirectory: string, stage: string): string;
|
|
21
|
-
declare function buildFlavorPlanningPrompt(flavor: PlanningFlavor, plansDirectory: string, evidence: DebugEvidencePacket | undefined, fableStage: string): string;
|
|
22
|
-
//#endregion
|
|
23
|
-
export { DebugEvidencePacket, PlanningFlavor, buildDebugPlanningPrompt, buildFablePlanningPrompt, buildFlavorPlanningPrompt, buildNormalPlanningPrompt };
|
|
24
|
-
//# sourceMappingURL=prompts.d.mts.map
|
|
1
|
+
import { DebugEvidencePacket, PlanningFlavor, buildDebugPlanningPrompt, buildFablePlanningPrompt, buildFlavorPlanningPrompt, buildNormalPlanningPrompt } from "./services/plan/prompts.mjs";
|
|
2
|
+
export { DebugEvidencePacket, PlanningFlavor, buildDebugPlanningPrompt, buildFablePlanningPrompt, buildFlavorPlanningPrompt, buildNormalPlanningPrompt };
|
package/dist/prompts.mjs
CHANGED
|
@@ -1,3 +1 @@
|
|
|
1
|
-
|
|
2
|
-
`)}function n(e){return`[PLAN MODE ACTIVE: NORMAL]\nYou are in repository read-only normal planning. The dedicated write_plan tool may write one unique Markdown plan file under ${e}.\n\nExplore the codebase and produce a concrete implementation plan. For every plan, first call subagent with action "agents", cluster exploration by independent domain, subsystem, or integration boundary, and create a provisional task graph with the task tool. Select specialized agents by matching their names and descriptions to each cluster. Assign every unblocked delegated task through the task tool, and use a one-shot inlineAgent with a focused systemPrompt when no discovered specialist fits. Treat the initial graph as provisional, not as a fixed contract. After findings arrive, review the entire graph at least once and perform one to three review passes in total. In each pass, use evidence to add, rewrite, delete, cancel, reassign, or change blockedBy relationships for tasks when warranted. Do not keep following tasks that new information has made stale. Stop revising early when the graph is stable, or after the third pass.\n\nEvery plan must end with a delegated planning-draft stage blocked by all exploration and decision tasks. A single-boundary plan gets one planning draft. A complex plan spanning multiple subsystems, domains, packages, apps, or integration boundaries gets two planning drafts concurrently. Use three concurrent drafts instead when the work is cross-layer, migration-sensitive, security-sensitive, or similarly high risk. Assign each draft through the task tool to the discovered planner agent with context "fork" so it receives the conversation and gathered evidence. If the planner agent is unavailable, assign the same draft task through the task tool with a focused inlineAgent. All children receive read, Bash, grep, find, ls, and configured MCP tools with artifacts disabled. Bash and MCP tools are for read-only inspection and must not modify files, external systems, or repository state. Doom Team runs asynchronously, so do not poll. After launch, continue non-overlapping exploration or end the turn and wait for completion notifications.\n\nAfter all planning drafts complete, compare the candidates, pick the strongest draft, cross-check it against gathered evidence and the other drafts, resolve conflicts and gaps, and ask the user only for product decisions. A child produces the draft, but the main agent owns and synthesizes the final plan. Do not modify files or repository state except through write_plan. Start the final plan with a meaningful Markdown H1 because write_plan derives the filename from it. Present the complete plan as visible Markdown, then call write_plan with no arguments. After write_plan succeeds, clear the completed durable task graph and call complete_plan so the user can review the plan and choose whether to begin implementation or continue planning. Do not exit plan mode without that approval.`}function r(e,n){return`[PLAN MODE ACTIVE: DEBUG]\nYou are in repository read-only adaptive debug planning. The dedicated write_plan tool may write one unique Markdown plan file under ${e}.\n\n${n?`A bounded debug evidence packet is recorded below. Cite its verified facts when making source findings. Keep verified facts and hypotheses distinct. Do not claim a verified root cause when reproduction or supporting evidence is unavailable.\n\n[DEBUG EVIDENCE]\n${t(n)}`:`No structured debug evidence packet is recorded yet. First understand the reported issue, then gather only the evidence relevant to it. Recording evidence is optional and must not block source exploration, delegation, writing a plan, or completing a plan.`}\n\nUse the exact read-only tools available for the issue. Bash is available for repository inspection, but commands must not modify files or repository state. Treat unavailable evidence as unavailable, never invent its contents, and keep verified facts separate from hypotheses. ${n?`The final plan must separate verified facts from hypotheses and must not present an unsupported root cause as verified.`:`You may call record_debug_evidence when structured notes would help, but continue investigating without it when it is not relevant.`}`}function i(e,t){return`[PLAN MODE ACTIVE: FABLE]\nYou are in repository read-only Fable planning. Pi owns final verification and synthesis. The dedicated write_plan tool may write one unique Markdown plan file under ${e}.\n\nUse Pi read-only exploration first. When the bounded packet is ready, call run_fable_plan. Fable runs one fresh draft with repository inspection access and returns untrusted text. Cross-check every Fable claim against repository evidence, keep verified findings separate from explicitly inferred findings, resolve conflicts yourself, and present the final visible plan before calling write_plan. Never treat Fable output as repository evidence and never expose credentials, transcripts, commands, tools, or session data in the packet.\n\nCurrent Fable stage: ${t}. An interrupted stage is not relaunched automatically.`}function a(e,t,a,o){return e===`debug`?r(t,a):e===`fable`?i(t,o):n(t)}export{r as buildDebugPlanningPrompt,i as buildFablePlanningPrompt,a as buildFlavorPlanningPrompt,n as buildNormalPlanningPrompt};
|
|
3
|
-
//# sourceMappingURL=prompts.mjs.map
|
|
1
|
+
import{buildDebugPlanningPrompt as e,buildFablePlanningPrompt as t,buildFlavorPlanningPrompt as n,buildNormalPlanningPrompt as r}from"./services/plan/prompts.mjs";export{e as buildDebugPlanningPrompt,t as buildFablePlanningPrompt,n as buildFlavorPlanningPrompt,r as buildNormalPlanningPrompt};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);let e=require(`@agimon-ai/doompi-config`);function t(t,n){let r=(0,e.parseDoomConfig)(t,n);return r.modes?{modes:r.modes}:{}}function n(t,n){let r=(0,e.mergeDoomConfigs)({...t,projectTrust:`ask`},{...n,projectTrust:`ask`});return r.modes?{modes:r.modes}:{}}function r(t,n){let r=(0,e.loadDoomConfig)(t,n);return r.modes?{modes:r.modes}:{}}exports.loadDoomConfig=r,exports.mergeDoomConfigs=n,exports.parseDoomConfig=t;
|
|
2
|
+
//# sourceMappingURL=config.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.cjs","names":[],"sources":["../../../src/schemas/plan/config.ts"],"sourcesContent":["import {\n getHarnessState,\n globalDoomConfigPath,\n loadHarnessState,\n loadDoomConfig as loadSharedDoomConfig,\n mergeDoomConfigs as mergeSharedDoomConfigs,\n type PlanningAgentConfig,\n type PlanningModeConfig,\n type PlanningThinkingLevel,\n parsePlanningModeConfig,\n parseDoomConfig as parseSharedDoomConfig,\n repositoryDoomConfigPath,\n resolvePlanningPlansDirectory,\n} from '@agimon-ai/doompi-config';\n\nexport type { PlanningAgentConfig, PlanningModeConfig, PlanningThinkingLevel };\n\nexport interface DoomConfig {\n modes?: {\n planning?: PlanningModeConfig;\n };\n}\n\nconst DEFAULT_PROJECT_TRUST = 'ask' as const;\n\nexport {\n getHarnessState,\n globalDoomConfigPath,\n loadHarnessState,\n parsePlanningModeConfig,\n repositoryDoomConfigPath,\n resolvePlanningPlansDirectory,\n};\n\nexport function parseDoomConfig(content: string, filePath: string): DoomConfig {\n const config = parseSharedDoomConfig(content, filePath);\n return config.modes ? { modes: config.modes } : {};\n}\n\nexport function mergeDoomConfigs(globalConfig: DoomConfig, repositoryConfig: DoomConfig): DoomConfig {\n const merged = mergeSharedDoomConfigs(\n { ...globalConfig, projectTrust: DEFAULT_PROJECT_TRUST },\n { ...repositoryConfig, projectTrust: DEFAULT_PROJECT_TRUST },\n );\n return merged.modes ? { modes: merged.modes } : {};\n}\n\nexport function loadDoomConfig(repoRoot: string, homeDirectory?: string): DoomConfig {\n const config = loadSharedDoomConfig(repoRoot, homeDirectory);\n return config.modes ? { modes: config.modes } : {};\n}\n"],"mappings":"0FAkCA,SAAgB,EAAgB,EAAiB,EAA8B,CAC7E,IAAM,GAAA,EAAA,EAAA,iBAA+B,EAAS,EAAS,CACvD,OAAO,EAAO,MAAQ,CAAE,MAAO,EAAO,MAAO,CAAG,EAAE,CAGpD,SAAgB,EAAiB,EAA0B,EAA0C,CACnG,IAAM,GAAA,EAAA,EAAA,kBACJ,CAAE,GAAG,EAAc,aAAc,MAAuB,CACxD,CAAE,GAAG,EAAkB,aAAc,MAAuB,CAC7D,CACD,OAAO,EAAO,MAAQ,CAAE,MAAO,EAAO,MAAO,CAAG,EAAE,CAGpD,SAAgB,EAAe,EAAkB,EAAoC,CACnF,IAAM,GAAA,EAAA,EAAA,gBAA8B,EAAU,EAAc,CAC5D,OAAO,EAAO,MAAQ,CAAE,MAAO,EAAO,MAAO,CAAG,EAAE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PlanningAgentConfig, PlanningModeConfig, PlanningThinkingLevel, getHarnessState, globalDoomConfigPath, loadHarnessState, parsePlanningModeConfig, repositoryDoomConfigPath, resolvePlanningPlansDirectory } from "@agimon-ai/doompi-config";
|
|
2
|
+
|
|
3
|
+
//#region src/schemas/plan/config.d.ts
|
|
4
|
+
interface DoomConfig {
|
|
5
|
+
modes?: {
|
|
6
|
+
planning?: PlanningModeConfig;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
declare function parseDoomConfig(content: string, filePath: string): DoomConfig;
|
|
10
|
+
declare function mergeDoomConfigs(globalConfig: DoomConfig, repositoryConfig: DoomConfig): DoomConfig;
|
|
11
|
+
declare function loadDoomConfig(repoRoot: string, homeDirectory?: string): DoomConfig;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { DoomConfig, type PlanningAgentConfig, type PlanningModeConfig, type PlanningThinkingLevel, getHarnessState, globalDoomConfigPath, loadDoomConfig, loadHarnessState, mergeDoomConfigs, parseDoomConfig, parsePlanningModeConfig, repositoryDoomConfigPath, resolvePlanningPlansDirectory };
|
|
14
|
+
//# sourceMappingURL=config.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.cts","names":[],"sources":["../../../src/schemas/plan/config.ts"],"mappings":";;;UAiBiB,UAAA;EACf,KAAA;IACE,QAAA,GAAW,kBAAA;EAAA;AAAA;AAAA,iBAeC,eAAA,CAAgB,OAAA,UAAiB,QAAA,WAAmB,UAAA;AAAA,iBAKpD,gBAAA,CAAiB,YAAA,EAAc,UAAA,EAAY,gBAAA,EAAkB,UAAA,GAAa,UAAA;AAAA,iBAQ1E,cAAA,CAAe,QAAA,UAAkB,aAAA,YAAyB,UAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PlanningAgentConfig, PlanningModeConfig, PlanningThinkingLevel, getHarnessState, globalDoomConfigPath as globalDoomConfigPath$1, loadHarnessState, parsePlanningModeConfig, repositoryDoomConfigPath, resolvePlanningPlansDirectory } from "@agimon-ai/doompi-config";
|
|
2
|
+
|
|
3
|
+
//#region src/schemas/plan/config.d.ts
|
|
4
|
+
interface DoomConfig {
|
|
5
|
+
modes?: {
|
|
6
|
+
planning?: PlanningModeConfig;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
declare function parseDoomConfig$1(content: string, filePath: string): DoomConfig;
|
|
10
|
+
declare function mergeDoomConfigs$1(globalConfig: DoomConfig, repositoryConfig: DoomConfig): DoomConfig;
|
|
11
|
+
declare function loadDoomConfig$1(repoRoot: string, homeDirectory?: string): DoomConfig;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { DoomConfig, type PlanningAgentConfig, type PlanningModeConfig, type PlanningThinkingLevel, getHarnessState, globalDoomConfigPath$1 as globalDoomConfigPath, loadDoomConfig$1 as loadDoomConfig, loadHarnessState, mergeDoomConfigs$1 as mergeDoomConfigs, parseDoomConfig$1 as parseDoomConfig, parsePlanningModeConfig, repositoryDoomConfigPath, resolvePlanningPlansDirectory };
|
|
14
|
+
//# sourceMappingURL=config.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.mts","names":[],"sources":["../../../src/schemas/plan/config.ts"],"mappings":";;;UAiBiB,UAAA;EACf,KAAA;IACE,QAAA,GAAW,kBAAA;EAAA;AAAA;AAAA,iBAeC,iBAAA,CAAgB,OAAA,UAAiB,QAAA,WAAmB,UAAA;AAAA,iBAKpD,kBAAA,CAAiB,YAAA,EAAc,UAAA,EAAY,gBAAA,EAAkB,UAAA,GAAa,UAAA;AAAA,iBAQ1E,gBAAA,CAAe,QAAA,UAAkB,aAAA,YAAyB,UAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{getHarnessState as e,globalDoomConfigPath as t,loadDoomConfig as n,loadHarnessState as r,mergeDoomConfigs as i,parseDoomConfig as a,parsePlanningModeConfig as o,repositoryDoomConfigPath as s,resolvePlanningPlansDirectory as c}from"@agimon-ai/doompi-config";function l(e,t){let n=a(e,t);return n.modes?{modes:n.modes}:{}}function u(e,t){let n=i({...e,projectTrust:`ask`},{...t,projectTrust:`ask`});return n.modes?{modes:n.modes}:{}}function d(e,t){let r=n(e,t);return r.modes?{modes:r.modes}:{}}export{e as getHarnessState,t as globalDoomConfigPath,d as loadDoomConfig,r as loadHarnessState,u as mergeDoomConfigs,l as parseDoomConfig,o as parsePlanningModeConfig,s as repositoryDoomConfigPath,c as resolvePlanningPlansDirectory};
|
|
2
|
+
//# sourceMappingURL=config.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.mjs","names":["parseDoomConfig","parseSharedDoomConfig","mergeDoomConfigs","mergeSharedDoomConfigs","loadDoomConfig","loadSharedDoomConfig"],"sources":["../../../src/schemas/plan/config.ts"],"sourcesContent":["import {\n getHarnessState,\n globalDoomConfigPath,\n loadHarnessState,\n loadDoomConfig as loadSharedDoomConfig,\n mergeDoomConfigs as mergeSharedDoomConfigs,\n type PlanningAgentConfig,\n type PlanningModeConfig,\n type PlanningThinkingLevel,\n parsePlanningModeConfig,\n parseDoomConfig as parseSharedDoomConfig,\n repositoryDoomConfigPath,\n resolvePlanningPlansDirectory,\n} from '@agimon-ai/doompi-config';\n\nexport type { PlanningAgentConfig, PlanningModeConfig, PlanningThinkingLevel };\n\nexport interface DoomConfig {\n modes?: {\n planning?: PlanningModeConfig;\n };\n}\n\nconst DEFAULT_PROJECT_TRUST = 'ask' as const;\n\nexport {\n getHarnessState,\n globalDoomConfigPath,\n loadHarnessState,\n parsePlanningModeConfig,\n repositoryDoomConfigPath,\n resolvePlanningPlansDirectory,\n};\n\nexport function parseDoomConfig(content: string, filePath: string): DoomConfig {\n const config = parseSharedDoomConfig(content, filePath);\n return config.modes ? { modes: config.modes } : {};\n}\n\nexport function mergeDoomConfigs(globalConfig: DoomConfig, repositoryConfig: DoomConfig): DoomConfig {\n const merged = mergeSharedDoomConfigs(\n { ...globalConfig, projectTrust: DEFAULT_PROJECT_TRUST },\n { ...repositoryConfig, projectTrust: DEFAULT_PROJECT_TRUST },\n );\n return merged.modes ? { modes: merged.modes } : {};\n}\n\nexport function loadDoomConfig(repoRoot: string, homeDirectory?: string): DoomConfig {\n const config = loadSharedDoomConfig(repoRoot, homeDirectory);\n return config.modes ? { modes: config.modes } : {};\n}\n"],"mappings":"wQAkCA,SAAgBA,EAAgB,EAAiB,EAA8B,CAC7E,IAAM,EAASC,EAAsB,EAAS,EAAS,CACvD,OAAO,EAAO,MAAQ,CAAE,MAAO,EAAO,MAAO,CAAG,EAAE,CAGpD,SAAgBC,EAAiB,EAA0B,EAA0C,CACnG,IAAM,EAASC,EACb,CAAE,GAAG,EAAc,aAAc,MAAuB,CACxD,CAAE,GAAG,EAAkB,aAAc,MAAuB,CAC7D,CACD,OAAO,EAAO,MAAQ,CAAE,MAAO,EAAO,MAAO,CAAG,EAAE,CAGpD,SAAgBC,EAAe,EAAkB,EAAoC,CACnF,IAAM,EAASC,EAAqB,EAAU,EAAc,CAC5D,OAAO,EAAO,MAAQ,CAAE,MAAO,EAAO,MAAO,CAAG,EAAE"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);let e=require(`@agimon-ai/doompi-config`),t=require(`@agimon-ai/doompi-ui/config`);const n=`planning`,r=[`modes`,n],i=`main`,a=`subagents`,o=`inherit the session model`,s=`inherit`,c=[{id:`main.model`,label:`main model`,keyPath:[...r,i,`model`],placeholder:o,detail:`Model the main agent switches to while plan mode is on.`,read:e=>e?.main?.model},{id:`main.thinking`,label:`main thinking`,keyPath:[...r,i,`thinking`],placeholder:s,detail:`Thinking level appended to the main model while planning.`,options:e.DOOM_PLANNING_THINKING_LEVELS,read:e=>e?.main?.thinking},{id:`subagents.model`,label:`subagent model`,keyPath:[...r,a,`model`],placeholder:o,detail:`Model forced onto delegated planning subagents.`,read:e=>e?.subagents?.model},{id:`subagents.thinking`,label:`subagent thinking`,keyPath:[...r,a,`thinking`],placeholder:s,detail:`Thinking level appended to the subagent model.`,options:e.DOOM_PLANNING_THINKING_LEVELS,read:e=>e?.subagents?.thinking},{id:`plansdirectory`,label:`plans directory`,keyPath:[...r,`plansDirectory`],placeholder:`~/.pi/plans`,detail:`Absolute, repo-relative, or under ~. Written plans land here.`,read:e=>e?.plansDirectory}];function l(e){return c.find(t=>t.id===e)}function u(e){return e.options?.map(e=>({id:e,label:e,action:t.CONFIG_ACTION.set}))}function d(e,t){return[{id:n,title:`planning`,order:30,detail:`plan mode`,fields:c.map(t=>{let n=t.read(e),r=u(t);return{id:t.id,label:t.label,kind:r?`enum`:`text`,keyPath:t.keyPath.join(`.`),placeholder:t.placeholder,detail:t.detail,...n?{value:n}:{},...r?{choices:r}:{}}}),...t?{notice:t,noticeLevel:`error`}:{}}]}exports.PLAN_CONFIG_SECTION_ID=n,exports.PLAN_SETTINGS=c,exports.planConfigSections=d,exports.planSettingByFieldId=l;
|
|
2
|
+
//# sourceMappingURL=planConfig.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planConfig.cjs","names":["DOOM_PLANNING_THINKING_LEVELS","CONFIG_ACTION"],"sources":["../../../src/schemas/plan/planConfig.ts"],"sourcesContent":["/**\n * Plan mode's slice of the `SPC e c` config panel.\n *\n * Plan mode reads `modes.planning` from disk on every activation, so an edit\n * here lands on the next time the mode is turned on with no restart and nothing\n * to invalidate.\n *\n * The descriptor table is the whole design: the panel renders it and the write\n * handler looks the key path back up in it, so adding a setting means adding a\n * row rather than a case.\n */\n\nimport { DOOM_PLANNING_THINKING_LEVELS } from '@agimon-ai/doompi-config';\nimport type { ConfigChoice, ConfigField, ConfigSection } from '@agimon-ai/doompi-ui/config';\nimport { CONFIG_ACTION } from '@agimon-ai/doompi-ui/config';\nimport type { PlanningModeConfig } from './config.ts';\n\nexport const PLAN_CONFIG_SECTION_ID = 'planning';\nconst SECTION_ORDER = 30;\nconst PLANNING_PATH = ['modes', PLAN_CONFIG_SECTION_ID] as const;\nconst MAIN_KEY = 'main';\nconst SUBAGENTS_KEY = 'subagents';\n/** Both agents fall back to the session's own settings when left unset. */\nconst INHERIT_MODEL = 'inherit the session model';\nconst INHERIT_THINKING = 'inherit';\n\ninterface PlanSettingDescriptor {\n readonly id: string;\n readonly label: string;\n readonly keyPath: readonly string[];\n readonly placeholder: string;\n readonly detail: string;\n /** Present for a closed set; the panel offers these rather than free text. */\n readonly options?: readonly string[];\n readonly read: (config: PlanningModeConfig | undefined) => string | undefined;\n}\n\nexport const PLAN_SETTINGS: readonly PlanSettingDescriptor[] = [\n {\n id: 'main.model',\n label: 'main model',\n keyPath: [...PLANNING_PATH, MAIN_KEY, 'model'],\n placeholder: INHERIT_MODEL,\n detail: 'Model the main agent switches to while plan mode is on.',\n read: (config) => config?.main?.model,\n },\n {\n id: 'main.thinking',\n label: 'main thinking',\n keyPath: [...PLANNING_PATH, MAIN_KEY, 'thinking'],\n placeholder: INHERIT_THINKING,\n detail: 'Thinking level appended to the main model while planning.',\n options: DOOM_PLANNING_THINKING_LEVELS,\n read: (config) => config?.main?.thinking,\n },\n {\n id: 'subagents.model',\n label: 'subagent model',\n keyPath: [...PLANNING_PATH, SUBAGENTS_KEY, 'model'],\n placeholder: INHERIT_MODEL,\n detail: 'Model forced onto delegated planning subagents.',\n read: (config) => config?.subagents?.model,\n },\n {\n id: 'subagents.thinking',\n label: 'subagent thinking',\n keyPath: [...PLANNING_PATH, SUBAGENTS_KEY, 'thinking'],\n placeholder: INHERIT_THINKING,\n detail: 'Thinking level appended to the subagent model.',\n options: DOOM_PLANNING_THINKING_LEVELS,\n read: (config) => config?.subagents?.thinking,\n },\n {\n id: 'plansdirectory',\n label: 'plans directory',\n keyPath: [...PLANNING_PATH, 'plansDirectory'],\n placeholder: '~/.pi/plans',\n detail: 'Absolute, repo-relative, or under ~. Written plans land here.',\n read: (config) => config?.plansDirectory,\n },\n];\n\nexport function planSettingByFieldId(fieldId: string): PlanSettingDescriptor | undefined {\n return PLAN_SETTINGS.find((setting) => setting.id === fieldId);\n}\n\nfunction choicesFor(setting: PlanSettingDescriptor): ConfigChoice[] | undefined {\n // `set` rather than a bespoke action: choosing a level is the same write as\n // typing one, so it shares the handler.\n return setting.options?.map((option) => ({ id: option, label: option, action: CONFIG_ACTION.set }));\n}\n\nexport function planConfigSections(config: PlanningModeConfig | undefined, notice?: string): readonly ConfigSection[] {\n const fields: ConfigField[] = PLAN_SETTINGS.map((setting) => {\n const value = setting.read(config);\n const choices = choicesFor(setting);\n return {\n id: setting.id,\n label: setting.label,\n kind: choices ? ('enum' as const) : ('text' as const),\n keyPath: setting.keyPath.join('.'),\n placeholder: setting.placeholder,\n detail: setting.detail,\n ...(value ? { value } : {}),\n ...(choices ? { choices } : {}),\n };\n });\n return [\n {\n id: PLAN_CONFIG_SECTION_ID,\n title: 'planning',\n order: SECTION_ORDER,\n detail: 'plan mode',\n fields,\n ...(notice ? { notice, noticeLevel: 'error' as const } : {}),\n },\n ];\n}\n"],"mappings":"mIAiBA,MAAa,EAAyB,WAEhC,EAAgB,CAAC,QAAS,EAAuB,CACjD,EAAW,OACX,EAAgB,YAEhB,EAAgB,4BAChB,EAAmB,UAaZ,EAAkD,CAC7D,CACE,GAAI,aACJ,MAAO,aACP,QAAS,CAAC,GAAG,EAAe,EAAU,QAAQ,CAC9C,YAAa,EACb,OAAQ,0DACR,KAAO,GAAW,GAAQ,MAAM,MACjC,CACD,CACE,GAAI,gBACJ,MAAO,gBACP,QAAS,CAAC,GAAG,EAAe,EAAU,WAAW,CACjD,YAAa,EACb,OAAQ,4DACR,QAASA,EAAAA,8BACT,KAAO,GAAW,GAAQ,MAAM,SACjC,CACD,CACE,GAAI,kBACJ,MAAO,iBACP,QAAS,CAAC,GAAG,EAAe,EAAe,QAAQ,CACnD,YAAa,EACb,OAAQ,kDACR,KAAO,GAAW,GAAQ,WAAW,MACtC,CACD,CACE,GAAI,qBACJ,MAAO,oBACP,QAAS,CAAC,GAAG,EAAe,EAAe,WAAW,CACtD,YAAa,EACb,OAAQ,iDACR,QAASA,EAAAA,8BACT,KAAO,GAAW,GAAQ,WAAW,SACtC,CACD,CACE,GAAI,iBACJ,MAAO,kBACP,QAAS,CAAC,GAAG,EAAe,iBAAiB,CAC7C,YAAa,cACb,OAAQ,gEACR,KAAO,GAAW,GAAQ,eAC3B,CACF,CAED,SAAgB,EAAqB,EAAoD,CACvF,OAAO,EAAc,KAAM,GAAY,EAAQ,KAAO,EAAQ,CAGhE,SAAS,EAAW,EAA4D,CAG9E,OAAO,EAAQ,SAAS,IAAK,IAAY,CAAE,GAAI,EAAQ,MAAO,EAAQ,OAAQC,EAAAA,cAAc,IAAK,EAAE,CAGrG,SAAgB,EAAmB,EAAwC,EAA2C,CAepH,MAAO,CACL,CACE,GAAI,EACJ,MAAO,WACP,MAAO,GACP,OAAQ,YACR,OApB0B,EAAc,IAAK,GAAY,CAC3D,IAAM,EAAQ,EAAQ,KAAK,EAAO,CAC5B,EAAU,EAAW,EAAQ,CACnC,MAAO,CACL,GAAI,EAAQ,GACZ,MAAO,EAAQ,MACf,KAAM,EAAW,OAAoB,OACrC,QAAS,EAAQ,QAAQ,KAAK,IAAI,CAClC,YAAa,EAAQ,YACrB,OAAQ,EAAQ,OAChB,GAAI,EAAQ,CAAE,QAAO,CAAG,EAAE,CAC1B,GAAI,EAAU,CAAE,UAAS,CAAG,EAAE,CAC/B,EAQO,CACN,GAAI,EAAS,CAAE,SAAQ,YAAa,QAAkB,CAAG,EAAE,CAC5D,CACF"}
|