@agent-plan/pi-adapter 0.2.22-next.3 → 0.2.22-next.4

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,iCAAiC,CAAC;AA40BtF,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CAu6H9D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,iCAAiC,CAAC;AA40BtF,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CAs6H9D"}
package/dist/index.js CHANGED
@@ -4188,14 +4188,14 @@ export default function planPiExtension(pi) {
4188
4188
  pi.registerTool({
4189
4189
  name: "task_recommend",
4190
4190
  label: "Task Recommend",
4191
- description: "Return the recommended next task without starting work: continue one active task, otherwise choose ready work by feature → phase → task priority. Reports approved deviation/resume context and never blocks an explicit user choice.",
4191
+ description: "Return the recommended next task without starting work: continue one active task or the current phase, otherwise choose ready work by feature → phase → task priority. Reports approved deviation/resume context and never blocks an explicit user choice.",
4192
4192
  parameters: Type.Object({}),
4193
4193
  async execute(_id, _params, _signal, _onUpdate, ctx) {
4194
4194
  const st = await requirePlan(ctx);
4195
4195
  if (!st)
4196
4196
  return { content: [{ type: "text", text: "No .planner/ found." }], details: {} };
4197
- const [features, phases, project] = await Promise.all([st.loadFeatures(), st.loadAllPhases(), st.loadProject()]);
4198
- const result = recommendNextTask(features.features, phases, project.workDeviations);
4197
+ const [features, phases, project, resume] = await Promise.all([st.loadFeatures(), st.loadAllPhases(), st.loadProject(), st.loadResume()]);
4198
+ const result = recommendNextTask(features.features, phases, project.workDeviations, resume?.currentPhaseId);
4199
4199
  if (!result.candidate)
4200
4200
  return { content: [{ type: "text", text: `No task recommendation: ${result.reason}` }], details: result };
4201
4201
  const { candidate } = result;
@@ -4219,11 +4219,11 @@ export default function planPiExtension(pi) {
4219
4219
  const st = await requirePlan(ctx);
4220
4220
  if (!st)
4221
4221
  return { content: [{ type: "text", text: "No .planner/ found." }], details: {} };
4222
- const [features, phases, project] = await Promise.all([st.loadFeatures(), st.loadAllPhases(), st.loadProject()]);
4222
+ const [features, phases, project, focus] = await Promise.all([st.loadFeatures(), st.loadAllPhases(), st.loadProject(), st.loadResume()]);
4223
4223
  const temporary = findTaskByRef(phases, features.features, params.temporary_task.trim());
4224
4224
  if (!temporary)
4225
4225
  return { content: [{ type: "text", text: `Task not found: ${params.temporary_task}` }], details: {} };
4226
- const selected = recommendNextTask(features.features, phases, project.workDeviations);
4226
+ const selected = recommendNextTask(features.features, phases, project.workDeviations, focus?.currentPhaseId);
4227
4227
  const resume = params.resume_task ? findTaskByRef(phases, features.features, params.resume_task.trim()) : selected.candidate;
4228
4228
  if (!resume)
4229
4229
  return { content: [{ type: "text", text: `No resume task is available. Provide resume_task explicitly. ${selected.reason}` }], details: selected };
@@ -4319,7 +4319,7 @@ export default function planPiExtension(pi) {
4319
4319
  const st = await requirePlan(ctx);
4320
4320
  if (!st)
4321
4321
  return { content: [{ type: "text", text: "No .planner/ found." }], details: {} };
4322
- const [featuresDoc, phases, project] = await Promise.all([st.loadFeatures(), st.loadAllPhases(), st.loadProject()]);
4322
+ const [featuresDoc, phases, project, focus] = await Promise.all([st.loadFeatures(), st.loadAllPhases(), st.loadProject(), st.loadResume()]);
4323
4323
  const features = featuresDoc.features;
4324
4324
  const source = findTaskByRef(phases, features, params.from_task.trim());
4325
4325
  const target = findTaskByRef(phases, features, params.to_task.trim());
@@ -4352,7 +4352,7 @@ export default function planPiExtension(pi) {
4352
4352
  resumeLocation: params.resume_location.trim(), howToResume: params.how_to_resume.trim(),
4353
4353
  relatedTaskId: target.task.id, pausedAt: timestamp, pausedBy: params.switched_by?.trim() ?? "",
4354
4354
  };
4355
- const selection = recommendNextTask(features, phases, project.workDeviations);
4355
+ const selection = recommendNextTask(features, phases, project.workDeviations, focus?.currentPhaseId);
4356
4356
  const record = {
4357
4357
  id: crypto.randomUUID(), recommendedTaskId: selection.candidate?.task.id ?? source.task.id,
4358
4358
  temporaryTaskId: target.task.id, resumeTaskId: source.task.id, reason: snapshot.reason, snapshot,
@@ -4477,12 +4477,11 @@ export default function planPiExtension(pi) {
4477
4477
  if (!hasReadRequirements(linkedRequirementIds)) {
4478
4478
  return { content: [{ type: "text", text: "Task start denied: read the requirements linked to the task's phase and feature first." }], details: { requirementIds: linkedRequirementIds } };
4479
4479
  }
4480
- const project = await st.loadProject();
4481
- const phases = await st.loadAllPhases();
4480
+ const [project, phases, focus] = await Promise.all([st.loadProject(), st.loadAllPhases(), st.loadResume()]);
4482
4481
  const eligibility = checkExplicitTaskStart(features, phases, task.id, project.workDeviations);
4483
4482
  if (!eligibility.eligible)
4484
4483
  return { content: [{ type: "text", text: `Task start denied: ${eligibility.reason}` }], details: eligibility };
4485
- const selection = recommendNextTask(features, phases, project.workDeviations);
4484
+ const selection = recommendNextTask(features, phases, project.workDeviations, focus?.currentPhaseId);
4486
4485
  if (selection.kind === "conflict") {
4487
4486
  return { content: [{ type: "text", text: `${selection.reason} Pause/reconcile active tasks before starting another task.` }], details: selection };
4488
4487
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-plan/pi-adapter",
3
- "version": "0.2.22-next.3",
3
+ "version": "0.2.22-next.4",
4
4
  "private": false,
5
5
  "description": "Pi agent extension for Agent Plan — structured project planning in .planner/",
6
6
  "keywords": [
@@ -28,8 +28,8 @@
28
28
  "dependencies": {
29
29
  "typebox": "^1.1.24",
30
30
  "zod": "^3.24.0",
31
- "@agent-plan/core": "0.2.22-next.3",
32
- "@agent-plan/server": "0.2.22-next.3"
31
+ "@agent-plan/core": "0.2.22-next.4",
32
+ "@agent-plan/server": "0.2.22-next.4"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@earendil-works/pi-coding-agent": "^0.74.0",