@agimon-ai/doompi-goal 0.0.1-alpha.21 → 0.0.1-alpha.23
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 +2 -2
- package/dist/adapters/pi/extension.cjs +1 -1
- package/dist/adapters/pi/extension.cjs.map +1 -1
- package/dist/adapters/pi/extension.d.cts.map +1 -1
- package/dist/adapters/pi/extension.d.mts.map +1 -1
- package/dist/adapters/pi/extension.mjs +1 -1
- package/dist/adapters/pi/extension.mjs.map +1 -1
- package/package.json +3 -3
- package/src/prompts/doompi-use-goal/SKILL.md +1 -1
package/README.md
CHANGED
|
@@ -38,8 +38,8 @@ pi install npm:@agimon-ai/doompi-goal
|
|
|
38
38
|
Budgets accept compact values such as `100k` and `1.5m`. Goal adds `goal_complete` and
|
|
39
39
|
`goal_blocked` only while host policy permits and the objective is operational.
|
|
40
40
|
|
|
41
|
-
In DoomPi, `SPC g
|
|
42
|
-
opens history. These views require a TUI; slash commands and tools support headless operation.
|
|
41
|
+
In DoomPi, `SPC g e` starts a goal and ends and archives the one being worked, `SPC g g` shows
|
|
42
|
+
status, and `SPC g l` opens history. These views require a TUI; slash commands and tools support headless operation.
|
|
43
43
|
|
|
44
44
|
## Experimental queue
|
|
45
45
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./runtimeActivation.cjs"),t=require("../../tui/goalHistoryOverlay.cjs");let n=require("@agimon-ai/doompi-extension-contracts/cordis-host"),r=require("@agimon-ai/doompi-extension-contracts/help"),i=require("@agimon-ai/doompi-extension-contracts/mode"),a=require("@agimon-ai/doompi-extension-contracts/ui-hub");const o=`@agimon-ai/doompi-goal`,s={show:`goal.show`,start:`goal.start`,end:`goal.end`,history:`goal.history`};function c(t){let n={key:`g`,label:`goal`,order:100},r=[{id:s.
|
|
1
|
+
const e=require("./runtimeActivation.cjs"),t=require("../../tui/goalHistoryOverlay.cjs");let n=require("@agimon-ai/doompi-extension-contracts/cordis-host"),r=require("@agimon-ai/doompi-extension-contracts/help"),i=require("@agimon-ai/doompi-extension-contracts/mode"),a=require("@agimon-ai/doompi-extension-contracts/ui-hub");const o=`@agimon-ai/doompi-goal`,s={show:`goal.show`,start:`goal.start`,end:`goal.end`,history:`goal.history`};function c(t){let n={key:`g`,label:`goal`,detail:`session objective`,order:100},r=e.isRetainedGoalStatus(t),i=[r?{id:s.end,path:[n,{key:`e`,label:`exit`,detail:`end the current goal`,tone:`exit`}],action:{name:s.end}}:{id:s.start,path:[n,{key:`e`,label:`enter`,detail:`start a session goal`}],action:{name:s.start}},{id:s.history,path:[n,{key:`l`,label:`list`,detail:`goals in this repository`}],action:{name:s.history}}];return r&&i.push({id:s.show,path:[n,{key:`g`,label:`current`,detail:`the goal being worked`}],action:{name:s.show}}),i}function l(n,{pi:l,dependencies:u}){n.inject([r.DOOM_HELP_SERVICE],e=>{let t=(0,r.requireDoomHelpService)(e).register({source:o,moduleUrl:require("url").pathToFileURL(__filename).href,skills:[{name:`doompi-use-goal`,description:`Use Doom Pi Goal to start, budget, pause, resume, complete, block, and inspect persistent repository goals.`}]});return()=>t.dispose()}),n.effect(function*(){let r=e.activateGoalRuntime(l,u);yield()=>r.dispose();let d=r.manager;n.inject([i.DOOM_MINOR_MODE_CATALOG_SERVICE],t=>e.registerGoalMinorMode((0,i.requireMinorModeCatalog)(t),d)),n.inject([a.DOOM_UI_HUB_SERVICE],e=>{let n=(0,a.requireDoomUiHub)(e),r=n.registerLeader({source:o,bindings:c(d.snapshot().goal?.status)}),i=d.subscribeState(e=>r.update(c(e.status))),l=n.registerLeaderActions({source:o,handlers:{[s.show]:e=>d.showFromLeader(e),[s.start]:e=>d.startFromLeader(e),[s.end]:e=>d.endFromLeader(e),[s.history]:e=>t.openGoalHistoryOverlay(e,d)},onError:(e,t,n)=>{n.hasUI&&n.ui.notify(e instanceof Error?e.message:String(e),`error`)}});return()=>{i(),l(),r.dispose()}})},o)}async function u(e,t){let r=await(0,n.connectDoomCordisHost)(e,o),i=r.root.plugin(l,{pi:e,dependencies:t});try{await i}catch(e){try{await i.dispose()}finally{await r.dispose()}throw e}let a;e.on(`session_shutdown`,()=>a??=(async()=>{try{await i.dispose()}finally{await r.dispose()}})())}exports.registerGoalExtension=u;
|
|
2
2
|
//# sourceMappingURL=extension.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension.cjs","names":["isRetainedGoalStatus","DOOM_HELP_SERVICE","requireDoomHelpService","activateGoalRuntime","DOOM_MINOR_MODE_CATALOG_SERVICE","registerGoalMinorMode","requireMinorModeCatalog","DOOM_UI_HUB_SERVICE","requireDoomUiHub","openGoalHistoryOverlay","connectDoomCordisHost"],"sources":["../../../src/adapters/pi/extension.ts"],"sourcesContent":["import { connectDoomCordisHost } from '@agimon-ai/doompi-extension-contracts/cordis-host';\nimport { DOOM_HELP_SERVICE, requireDoomHelpService } from '@agimon-ai/doompi-extension-contracts/help';\nimport { DOOM_MINOR_MODE_CATALOG_SERVICE, requireMinorModeCatalog } from '@agimon-ai/doompi-extension-contracts/mode';\nimport { DOOM_UI_HUB_SERVICE, requireDoomUiHub } from '@agimon-ai/doompi-extension-contracts/ui-hub';\nimport { type LeaderBinding } from '@agimon-ai/doompi-extension-contracts/leader';\nimport type { Context } from '@deepseek-ai/cordis';\nimport type { ExtensionAPI, ExtensionContext } from '@earendil-works/pi-coding-agent';\nimport {\n activateGoalRuntime,\n isRetainedGoalStatus,\n registerGoalMinorMode,\n} from '../../adapters/pi/runtimeActivation.ts';\nimport { openGoalHistoryOverlay } from '../../tui/goalHistoryOverlay.ts';\nimport type { GoalExtensionDependencies } from '../../types/extension.ts';\n\nconst PACKAGE_SOURCE = '@agimon-ai/doompi-goal';\nconst LEADER_ORDER = 100;\nconst GOAL_ACTION = {\n show: 'goal.show',\n start: 'goal.start',\n end: 'goal.end',\n history: 'goal.history',\n} as const;\n\nfunction goalLeaderBindings(status: unknown): LeaderBinding[] {\n const group = { key: 'g', label: 'goal', order: LEADER_ORDER } as const;\n const bindings: LeaderBinding[] = [\n {\n
|
|
1
|
+
{"version":3,"file":"extension.cjs","names":["isRetainedGoalStatus","DOOM_HELP_SERVICE","requireDoomHelpService","activateGoalRuntime","DOOM_MINOR_MODE_CATALOG_SERVICE","registerGoalMinorMode","requireMinorModeCatalog","DOOM_UI_HUB_SERVICE","requireDoomUiHub","openGoalHistoryOverlay","connectDoomCordisHost"],"sources":["../../../src/adapters/pi/extension.ts"],"sourcesContent":["import { connectDoomCordisHost } from '@agimon-ai/doompi-extension-contracts/cordis-host';\nimport { DOOM_HELP_SERVICE, requireDoomHelpService } from '@agimon-ai/doompi-extension-contracts/help';\nimport { DOOM_MINOR_MODE_CATALOG_SERVICE, requireMinorModeCatalog } from '@agimon-ai/doompi-extension-contracts/mode';\nimport { DOOM_UI_HUB_SERVICE, requireDoomUiHub } from '@agimon-ai/doompi-extension-contracts/ui-hub';\nimport { type LeaderBinding } from '@agimon-ai/doompi-extension-contracts/leader';\nimport type { Context } from '@deepseek-ai/cordis';\nimport type { ExtensionAPI, ExtensionContext } from '@earendil-works/pi-coding-agent';\nimport {\n activateGoalRuntime,\n isRetainedGoalStatus,\n registerGoalMinorMode,\n} from '../../adapters/pi/runtimeActivation.ts';\nimport { openGoalHistoryOverlay } from '../../tui/goalHistoryOverlay.ts';\nimport type { GoalExtensionDependencies } from '../../types/extension.ts';\n\nconst PACKAGE_SOURCE = '@agimon-ai/doompi-goal';\nconst LEADER_ORDER = 100;\nconst GOAL_ACTION = {\n show: 'goal.show',\n start: 'goal.start',\n end: 'goal.end',\n history: 'goal.history',\n} as const;\n\n/**\n * The goal menu as it stands with a goal held or not.\n *\n * One entry on `e`, the way every other minor mode publishes its toggle: with no\n * goal it starts one, with a goal held it ends that one. Printing `start` beside\n * `end` made the reader check the mode line to find out which of the two did\n * anything.\n */\nfunction goalLeaderBindings(status: unknown): LeaderBinding[] {\n const group = { key: 'g', label: 'goal', detail: 'session objective', order: LEADER_ORDER } as const;\n const retained = isRetainedGoalStatus(status);\n const bindings: LeaderBinding[] = [\n retained\n ? {\n id: GOAL_ACTION.end,\n path: [group, { key: 'e', label: 'exit', detail: 'end the current goal', tone: 'exit' }],\n action: { name: GOAL_ACTION.end },\n }\n : {\n id: GOAL_ACTION.start,\n path: [group, { key: 'e', label: 'enter', detail: 'start a session goal' }],\n action: { name: GOAL_ACTION.start },\n },\n {\n id: GOAL_ACTION.history,\n path: [group, { key: 'l', label: 'list', detail: 'goals in this repository' }],\n action: { name: GOAL_ACTION.history },\n },\n ];\n if (retained) {\n bindings.push({\n id: GOAL_ACTION.show,\n path: [group, { key: 'g', label: 'current', detail: 'the goal being worked' }],\n action: { name: GOAL_ACTION.show },\n });\n }\n return bindings;\n}\n\ninterface GoalPluginConfig {\n readonly pi: ExtensionAPI;\n readonly dependencies?: GoalExtensionDependencies;\n}\n\nfunction goalPlugin(cordis: Context, { pi, dependencies }: GoalPluginConfig): void {\n cordis.inject([DOOM_HELP_SERVICE], (helpContext) => {\n const contribution = requireDoomHelpService(helpContext).register({\n source: PACKAGE_SOURCE,\n moduleUrl: import.meta.url,\n skills: [\n {\n name: 'doompi-use-goal',\n description:\n 'Use Doom Pi Goal to start, budget, pause, resume, complete, block, and inspect persistent repository goals.',\n },\n ],\n });\n return () => contribution.dispose();\n });\n\n cordis.effect(function* () {\n const activation = activateGoalRuntime(pi, dependencies);\n yield () => activation.dispose();\n\n const manager = activation.manager;\n cordis.inject([DOOM_MINOR_MODE_CATALOG_SERVICE], (modeContext) =>\n registerGoalMinorMode(requireMinorModeCatalog(modeContext), manager),\n );\n cordis.inject([DOOM_UI_HUB_SERVICE], (uiContext) => {\n const hub = requireDoomUiHub(uiContext);\n const leader = hub.registerLeader({\n source: PACKAGE_SOURCE,\n bindings: goalLeaderBindings(manager.snapshot().goal?.status),\n });\n const stateDisposer = manager.subscribeState((event) => leader.update(goalLeaderBindings(event.status)));\n const actions = hub.registerLeaderActions<ExtensionContext>({\n source: PACKAGE_SOURCE,\n handlers: {\n [GOAL_ACTION.show]: (ctx) => manager.showFromLeader(ctx),\n [GOAL_ACTION.start]: (ctx) => manager.startFromLeader(ctx),\n [GOAL_ACTION.end]: (ctx) => manager.endFromLeader(ctx),\n [GOAL_ACTION.history]: (ctx) => openGoalHistoryOverlay(ctx, manager),\n },\n onError: (error, _action, ctx) => {\n if (ctx.hasUI) ctx.ui.notify(error instanceof Error ? error.message : String(error), 'error');\n },\n });\n return () => {\n stateDisposer();\n actions();\n leader.dispose();\n };\n });\n }, PACKAGE_SOURCE);\n}\n\n/** The package's single standard Pi factory, with optional typed host integrations included. */\nexport async function registerGoalExtension(pi: ExtensionAPI, dependencies?: GoalExtensionDependencies): Promise<void> {\n const connection = await connectDoomCordisHost(pi, PACKAGE_SOURCE);\n const fiber = connection.root.plugin(goalPlugin, { pi, dependencies });\n try {\n await fiber;\n } catch (error) {\n try {\n await fiber.dispose();\n } finally {\n await connection.dispose();\n }\n throw error;\n }\n let disposal: Promise<void> | undefined;\n pi.on(\n 'session_shutdown',\n () =>\n (disposal ??= (async () => {\n try {\n await fiber.dispose();\n } finally {\n await connection.dispose();\n }\n })()),\n );\n}\n"],"mappings":"sUAeA,MAAM,EAAiB,yBAEjB,EAAc,CAClB,KAAM,YACN,MAAO,aACP,IAAK,WACL,QAAS,cACX,EAUA,SAAS,EAAmB,EAAkC,CAC5D,IAAM,EAAQ,CAAE,IAAK,IAAK,MAAO,OAAQ,OAAQ,oBAAqB,MAAO,GAAa,EACpF,EAAWA,EAAAA,qBAAqB,CAAM,EACtC,EAA4B,CAChC,EACI,CACE,GAAI,EAAY,IAChB,KAAM,CAAC,EAAO,CAAE,IAAK,IAAK,MAAO,OAAQ,OAAQ,uBAAwB,KAAM,MAAO,CAAC,EACvF,OAAQ,CAAE,KAAM,EAAY,GAAI,CAClC,EACA,CACE,GAAI,EAAY,MAChB,KAAM,CAAC,EAAO,CAAE,IAAK,IAAK,MAAO,QAAS,OAAQ,sBAAuB,CAAC,EAC1E,OAAQ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,CAAC,EACjG,EAAU,EAAI,sBAAwC,CAC1D,OAAQ,EACR,SAAU,EACP,EAAY,MAAQ,GAAQ,EAAQ,eAAe,CAAG,GACtD,EAAY,OAAS,GAAQ,EAAQ,gBAAgB,CAAG,GACxD,EAAY,KAAO,GAAQ,EAAQ,cAAc,CAAG,GACpD,EAAY,SAAW,GAAQC,EAAAA,uBAAuB,EAAK,CAAO,CACrE,EACA,SAAU,EAAO,EAAS,IAAQ,CAC5B,EAAI,OAAO,EAAI,GAAG,OAAO,aAAiB,MAAQ,EAAM,QAAU,OAAO,CAAK,EAAG,OAAO,CAC9F,CACF,CAAC,EACD,UAAa,CACX,EAAc,EACd,EAAQ,EACR,EAAO,QAAQ,CACjB,CACF,CAAC,CACH,EAAG,CAAc,CACnB,CAGA,eAAsB,EAAsB,EAAkB,EAAyD,CACrH,IAAM,EAAa,MAAA,EAAMC,EAAAA,sBAAAA,CAAsB,EAAI,CAAc,EAC3D,EAAQ,EAAW,KAAK,OAAO,EAAY,CAAE,KAAI,cAAa,CAAC,EACrE,GAAI,CACF,MAAM,CACR,OAAS,EAAO,CACd,GAAI,CACF,MAAM,EAAM,QAAQ,CACtB,QAAU,CACR,MAAM,EAAW,QAAQ,CAC3B,CACA,MAAM,CACR,CACA,IAAI,EACJ,EAAG,GACD,uBAEG,KAAc,SAAY,CACzB,GAAI,CACF,MAAM,EAAM,QAAQ,CACtB,QAAU,CACR,MAAM,EAAW,QAAQ,CAC3B,CACF,EAAA,CAAG,CACP,CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension.d.cts","names":[],"sources":["../../../src/adapters/pi/extension.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"extension.d.cts","names":[],"sources":["../../../src/adapters/pi/extension.ts"],"mappings":";;;;iBAyHsB,sBAAsB,IAAI,cAAc,eAAe,4BAA4B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension.d.mts","names":[],"sources":["../../../src/adapters/pi/extension.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"extension.d.mts","names":[],"sources":["../../../src/adapters/pi/extension.ts"],"mappings":";;;;iBAyHsB,sBAAsB,IAAI,cAAc,eAAe,4BAA4B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{activateGoalRuntime as e,isRetainedGoalStatus as t,registerGoalMinorMode as n}from"./runtimeActivation.mjs";import{openGoalHistoryOverlay as r}from"../../tui/goalHistoryOverlay.mjs";import{connectDoomCordisHost as i}from"@agimon-ai/doompi-extension-contracts/cordis-host";import{DOOM_HELP_SERVICE as a,requireDoomHelpService as o}from"@agimon-ai/doompi-extension-contracts/help";import{DOOM_MINOR_MODE_CATALOG_SERVICE as s,requireMinorModeCatalog as c}from"@agimon-ai/doompi-extension-contracts/mode";import{DOOM_UI_HUB_SERVICE as l,requireDoomUiHub as u}from"@agimon-ai/doompi-extension-contracts/ui-hub";const d=`@agimon-ai/doompi-goal`,f={show:`goal.show`,start:`goal.start`,end:`goal.end`,history:`goal.history`};function p(e){let n={key:`g`,label:`goal`,order:100},r=[{id:f.
|
|
1
|
+
import{activateGoalRuntime as e,isRetainedGoalStatus as t,registerGoalMinorMode as n}from"./runtimeActivation.mjs";import{openGoalHistoryOverlay as r}from"../../tui/goalHistoryOverlay.mjs";import{connectDoomCordisHost as i}from"@agimon-ai/doompi-extension-contracts/cordis-host";import{DOOM_HELP_SERVICE as a,requireDoomHelpService as o}from"@agimon-ai/doompi-extension-contracts/help";import{DOOM_MINOR_MODE_CATALOG_SERVICE as s,requireMinorModeCatalog as c}from"@agimon-ai/doompi-extension-contracts/mode";import{DOOM_UI_HUB_SERVICE as l,requireDoomUiHub as u}from"@agimon-ai/doompi-extension-contracts/ui-hub";const d=`@agimon-ai/doompi-goal`,f={show:`goal.show`,start:`goal.start`,end:`goal.end`,history:`goal.history`};function p(e){let n={key:`g`,label:`goal`,detail:`session objective`,order:100},r=t(e),i=[r?{id:f.end,path:[n,{key:`e`,label:`exit`,detail:`end the current goal`,tone:`exit`}],action:{name:f.end}}:{id:f.start,path:[n,{key:`e`,label:`enter`,detail:`start a session goal`}],action:{name:f.start}},{id:f.history,path:[n,{key:`l`,label:`list`,detail:`goals in this repository`}],action:{name:f.history}}];return r&&i.push({id:f.show,path:[n,{key:`g`,label:`current`,detail:`the goal being worked`}],action:{name:f.show}}),i}function m(t,{pi:i,dependencies:m}){t.inject([a],e=>{let t=o(e).register({source:d,moduleUrl:import.meta.url,skills:[{name:`doompi-use-goal`,description:`Use Doom Pi Goal to start, budget, pause, resume, complete, block, and inspect persistent repository goals.`}]});return()=>t.dispose()}),t.effect(function*(){let a=e(i,m);yield()=>a.dispose();let o=a.manager;t.inject([s],e=>n(c(e),o)),t.inject([l],e=>{let t=u(e),n=t.registerLeader({source:d,bindings:p(o.snapshot().goal?.status)}),i=o.subscribeState(e=>n.update(p(e.status))),a=t.registerLeaderActions({source:d,handlers:{[f.show]:e=>o.showFromLeader(e),[f.start]:e=>o.startFromLeader(e),[f.end]:e=>o.endFromLeader(e),[f.history]:e=>r(e,o)},onError:(e,t,n)=>{n.hasUI&&n.ui.notify(e instanceof Error?e.message:String(e),`error`)}});return()=>{i(),a(),n.dispose()}})},d)}async function h(e,t){let n=await i(e,d),r=n.root.plugin(m,{pi:e,dependencies:t});try{await r}catch(e){try{await r.dispose()}finally{await n.dispose()}throw e}let a;e.on(`session_shutdown`,()=>a??=(async()=>{try{await r.dispose()}finally{await n.dispose()}})())}export{h as registerGoalExtension};
|
|
2
2
|
//# sourceMappingURL=extension.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension.mjs","names":[],"sources":["../../../src/adapters/pi/extension.ts"],"sourcesContent":["import { connectDoomCordisHost } from '@agimon-ai/doompi-extension-contracts/cordis-host';\nimport { DOOM_HELP_SERVICE, requireDoomHelpService } from '@agimon-ai/doompi-extension-contracts/help';\nimport { DOOM_MINOR_MODE_CATALOG_SERVICE, requireMinorModeCatalog } from '@agimon-ai/doompi-extension-contracts/mode';\nimport { DOOM_UI_HUB_SERVICE, requireDoomUiHub } from '@agimon-ai/doompi-extension-contracts/ui-hub';\nimport { type LeaderBinding } from '@agimon-ai/doompi-extension-contracts/leader';\nimport type { Context } from '@deepseek-ai/cordis';\nimport type { ExtensionAPI, ExtensionContext } from '@earendil-works/pi-coding-agent';\nimport {\n activateGoalRuntime,\n isRetainedGoalStatus,\n registerGoalMinorMode,\n} from '../../adapters/pi/runtimeActivation.ts';\nimport { openGoalHistoryOverlay } from '../../tui/goalHistoryOverlay.ts';\nimport type { GoalExtensionDependencies } from '../../types/extension.ts';\n\nconst PACKAGE_SOURCE = '@agimon-ai/doompi-goal';\nconst LEADER_ORDER = 100;\nconst GOAL_ACTION = {\n show: 'goal.show',\n start: 'goal.start',\n end: 'goal.end',\n history: 'goal.history',\n} as const;\n\nfunction goalLeaderBindings(status: unknown): LeaderBinding[] {\n const group = { key: 'g', label: 'goal', order: LEADER_ORDER } as const;\n const bindings: LeaderBinding[] = [\n {\n
|
|
1
|
+
{"version":3,"file":"extension.mjs","names":[],"sources":["../../../src/adapters/pi/extension.ts"],"sourcesContent":["import { connectDoomCordisHost } from '@agimon-ai/doompi-extension-contracts/cordis-host';\nimport { DOOM_HELP_SERVICE, requireDoomHelpService } from '@agimon-ai/doompi-extension-contracts/help';\nimport { DOOM_MINOR_MODE_CATALOG_SERVICE, requireMinorModeCatalog } from '@agimon-ai/doompi-extension-contracts/mode';\nimport { DOOM_UI_HUB_SERVICE, requireDoomUiHub } from '@agimon-ai/doompi-extension-contracts/ui-hub';\nimport { type LeaderBinding } from '@agimon-ai/doompi-extension-contracts/leader';\nimport type { Context } from '@deepseek-ai/cordis';\nimport type { ExtensionAPI, ExtensionContext } from '@earendil-works/pi-coding-agent';\nimport {\n activateGoalRuntime,\n isRetainedGoalStatus,\n registerGoalMinorMode,\n} from '../../adapters/pi/runtimeActivation.ts';\nimport { openGoalHistoryOverlay } from '../../tui/goalHistoryOverlay.ts';\nimport type { GoalExtensionDependencies } from '../../types/extension.ts';\n\nconst PACKAGE_SOURCE = '@agimon-ai/doompi-goal';\nconst LEADER_ORDER = 100;\nconst GOAL_ACTION = {\n show: 'goal.show',\n start: 'goal.start',\n end: 'goal.end',\n history: 'goal.history',\n} as const;\n\n/**\n * The goal menu as it stands with a goal held or not.\n *\n * One entry on `e`, the way every other minor mode publishes its toggle: with no\n * goal it starts one, with a goal held it ends that one. Printing `start` beside\n * `end` made the reader check the mode line to find out which of the two did\n * anything.\n */\nfunction goalLeaderBindings(status: unknown): LeaderBinding[] {\n const group = { key: 'g', label: 'goal', detail: 'session objective', order: LEADER_ORDER } as const;\n const retained = isRetainedGoalStatus(status);\n const bindings: LeaderBinding[] = [\n retained\n ? {\n id: GOAL_ACTION.end,\n path: [group, { key: 'e', label: 'exit', detail: 'end the current goal', tone: 'exit' }],\n action: { name: GOAL_ACTION.end },\n }\n : {\n id: GOAL_ACTION.start,\n path: [group, { key: 'e', label: 'enter', detail: 'start a session goal' }],\n action: { name: GOAL_ACTION.start },\n },\n {\n id: GOAL_ACTION.history,\n path: [group, { key: 'l', label: 'list', detail: 'goals in this repository' }],\n action: { name: GOAL_ACTION.history },\n },\n ];\n if (retained) {\n bindings.push({\n id: GOAL_ACTION.show,\n path: [group, { key: 'g', label: 'current', detail: 'the goal being worked' }],\n action: { name: GOAL_ACTION.show },\n });\n }\n return bindings;\n}\n\ninterface GoalPluginConfig {\n readonly pi: ExtensionAPI;\n readonly dependencies?: GoalExtensionDependencies;\n}\n\nfunction goalPlugin(cordis: Context, { pi, dependencies }: GoalPluginConfig): void {\n cordis.inject([DOOM_HELP_SERVICE], (helpContext) => {\n const contribution = requireDoomHelpService(helpContext).register({\n source: PACKAGE_SOURCE,\n moduleUrl: import.meta.url,\n skills: [\n {\n name: 'doompi-use-goal',\n description:\n 'Use Doom Pi Goal to start, budget, pause, resume, complete, block, and inspect persistent repository goals.',\n },\n ],\n });\n return () => contribution.dispose();\n });\n\n cordis.effect(function* () {\n const activation = activateGoalRuntime(pi, dependencies);\n yield () => activation.dispose();\n\n const manager = activation.manager;\n cordis.inject([DOOM_MINOR_MODE_CATALOG_SERVICE], (modeContext) =>\n registerGoalMinorMode(requireMinorModeCatalog(modeContext), manager),\n );\n cordis.inject([DOOM_UI_HUB_SERVICE], (uiContext) => {\n const hub = requireDoomUiHub(uiContext);\n const leader = hub.registerLeader({\n source: PACKAGE_SOURCE,\n bindings: goalLeaderBindings(manager.snapshot().goal?.status),\n });\n const stateDisposer = manager.subscribeState((event) => leader.update(goalLeaderBindings(event.status)));\n const actions = hub.registerLeaderActions<ExtensionContext>({\n source: PACKAGE_SOURCE,\n handlers: {\n [GOAL_ACTION.show]: (ctx) => manager.showFromLeader(ctx),\n [GOAL_ACTION.start]: (ctx) => manager.startFromLeader(ctx),\n [GOAL_ACTION.end]: (ctx) => manager.endFromLeader(ctx),\n [GOAL_ACTION.history]: (ctx) => openGoalHistoryOverlay(ctx, manager),\n },\n onError: (error, _action, ctx) => {\n if (ctx.hasUI) ctx.ui.notify(error instanceof Error ? error.message : String(error), 'error');\n },\n });\n return () => {\n stateDisposer();\n actions();\n leader.dispose();\n };\n });\n }, PACKAGE_SOURCE);\n}\n\n/** The package's single standard Pi factory, with optional typed host integrations included. */\nexport async function registerGoalExtension(pi: ExtensionAPI, dependencies?: GoalExtensionDependencies): Promise<void> {\n const connection = await connectDoomCordisHost(pi, PACKAGE_SOURCE);\n const fiber = connection.root.plugin(goalPlugin, { pi, dependencies });\n try {\n await fiber;\n } catch (error) {\n try {\n await fiber.dispose();\n } finally {\n await connection.dispose();\n }\n throw error;\n }\n let disposal: Promise<void> | undefined;\n pi.on(\n 'session_shutdown',\n () =>\n (disposal ??= (async () => {\n try {\n await fiber.dispose();\n } finally {\n await connection.dispose();\n }\n })()),\n );\n}\n"],"mappings":"qmBAeA,MAAM,EAAiB,yBAEjB,EAAc,CAClB,KAAM,YACN,MAAO,aACP,IAAK,WACL,QAAS,cACX,EAUA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on-ai/doompi-goal",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.23",
|
|
4
4
|
"description": "Pi minor mode for persistent agent goals, token budgets, and goal history.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent-goals",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@deepseek-ai/cordis": "4.0.1",
|
|
50
|
-
"@agimon-ai/doompi-extension-contracts": "0.0.1-alpha.
|
|
51
|
-
"@agimon-ai/doompi-ui": "0.0.1-alpha.
|
|
50
|
+
"@agimon-ai/doompi-extension-contracts": "0.0.1-alpha.33",
|
|
51
|
+
"@agimon-ai/doompi-ui": "0.0.1-alpha.33"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@earendil-works/pi-coding-agent": "0.84.2",
|
|
@@ -14,7 +14,7 @@ Use Goal when work must persist across turns with an explicit objective, optiona
|
|
|
14
14
|
- Use `/goal pause` and `/goal resume` when work should stop and continue without losing the objective.
|
|
15
15
|
- Use `/goal edit [--tokens <budget>] <objective>` when the objective or budget changes.
|
|
16
16
|
- Use `/goal clear` only when the active objective should be removed without being completed.
|
|
17
|
-
- In a TUI,
|
|
17
|
+
- In a TUI, `SPC g e` starts a goal and ends and archives the one being worked, and `SPC g l` inspects repository history.
|
|
18
18
|
|
|
19
19
|
## Finish accurately
|
|
20
20
|
|