@agent-plan/core 0.2.25 → 0.2.26

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.
Files changed (48) hide show
  1. package/dist/display-status.d.ts +3 -3
  2. package/dist/display-status.d.ts.map +1 -1
  3. package/dist/display-status.js +5 -4
  4. package/dist/handoff-context.d.ts +91 -1
  5. package/dist/handoff-context.d.ts.map +1 -1
  6. package/dist/handoff-context.js +134 -2
  7. package/dist/index.d.ts +5 -1
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +4 -0
  10. package/dist/naming.d.ts +3 -0
  11. package/dist/naming.d.ts.map +1 -1
  12. package/dist/naming.js +7 -0
  13. package/dist/payload-fallback.d.ts +38 -0
  14. package/dist/payload-fallback.d.ts.map +1 -0
  15. package/dist/payload-fallback.js +73 -0
  16. package/dist/plan-store.d.ts +65 -8
  17. package/dist/plan-store.d.ts.map +1 -1
  18. package/dist/plan-store.js +391 -39
  19. package/dist/planner-rules.d.ts.map +1 -1
  20. package/dist/planner-rules.js +4 -2
  21. package/dist/planner-skill.d.ts +24 -0
  22. package/dist/planner-skill.d.ts.map +1 -0
  23. package/dist/planner-skill.js +113 -0
  24. package/dist/project-context-migration.d.ts +47 -0
  25. package/dist/project-context-migration.d.ts.map +1 -0
  26. package/dist/project-context-migration.js +168 -0
  27. package/dist/read-tracking.d.ts +20 -10
  28. package/dist/read-tracking.d.ts.map +1 -1
  29. package/dist/read-tracking.js +35 -29
  30. package/dist/recap.d.ts.map +1 -1
  31. package/dist/recap.js +1 -0
  32. package/dist/refs.d.ts +6 -1
  33. package/dist/refs.d.ts.map +1 -1
  34. package/dist/refs.js +25 -0
  35. package/dist/renderer.d.ts.map +1 -1
  36. package/dist/renderer.js +24 -1
  37. package/dist/requirement-macro-tasks.d.ts +18 -0
  38. package/dist/requirement-macro-tasks.d.ts.map +1 -0
  39. package/dist/requirement-macro-tasks.js +55 -0
  40. package/dist/schema.d.ts +1088 -273
  41. package/dist/schema.d.ts.map +1 -1
  42. package/dist/schema.js +65 -0
  43. package/dist/task-start-outcome.d.ts +1 -1
  44. package/dist/task-start-outcome.d.ts.map +1 -1
  45. package/dist/task-start-outcome.js +1 -0
  46. package/package.json +3 -1
  47. package/planner-skill.md +210 -0
  48. package/skills/grill-me/SKILL.md +10 -0
package/dist/refs.js CHANGED
@@ -1,5 +1,30 @@
1
1
  // P00x or P00x(F00x) — accept 1+ digits so "p1" == "p001".
2
2
  const PHASE_REF_RE = /^p(\d+)(?:\(f(\d+)\))?$/;
3
+ const IDEA_REF_RE = /^i(\d+)$/;
4
+ /**
5
+ * Resolve an idea by UUID, I00x number, shortId, exact title, then title
6
+ * inclusion. Ideas are top-level and never require feature/phase context.
7
+ */
8
+ export function findIdeaByRef(ideas, ref) {
9
+ const normalized = ref.trim().toLowerCase();
10
+ if (!normalized)
11
+ return undefined;
12
+ const byId = ideas.find((idea) => idea.id.toLowerCase() === normalized);
13
+ if (byId)
14
+ return byId;
15
+ const match = normalized.match(IDEA_REF_RE);
16
+ if (match) {
17
+ const number = parseInt(match[1], 10);
18
+ const byNumber = ideas.find((idea) => idea.number === number);
19
+ if (byNumber)
20
+ return byNumber;
21
+ }
22
+ const byShortId = ideas.find((idea) => idea.shortId.toLowerCase() === normalized);
23
+ if (byShortId)
24
+ return byShortId;
25
+ return ideas.find((idea) => idea.title.toLowerCase() === normalized)
26
+ ?? ideas.find((idea) => idea.title.toLowerCase().includes(normalized));
27
+ }
3
28
  /**
4
29
  * Resolve a phase reference to a Phase. Returns `undefined` when not found or
5
30
  * when a composite (F00x) parent does not match the phase's featureId.
@@ -1 +1 @@
1
- {"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../src/renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,OAAO,EAAE,KAAK,EAAE,aAAa,EAAqB,MAAM,aAAa,CAAC;AAmBtG,qBAAa,YAAY;IACvB,UAAU,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM;IA2KvC,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;IAIjC,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,gBAAgB;IA6BxB,OAAO,CAAC,eAAe;IA2GvB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM;IAmDxD,mEAAmE;IACnE,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;CAejD"}
1
+ {"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../src/renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,OAAO,EAAQ,KAAK,EAAE,aAAa,EAAqB,MAAM,aAAa,CAAC;AAuB5G,qBAAa,YAAY;IACvB,UAAU,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM;IAgMvC,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;IAIjC,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,gBAAgB;IA6BxB,OAAO,CAAC,eAAe;IA2GvB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM;IAmDxD,mEAAmE;IACnE,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;CAejD"}
package/dist/renderer.js CHANGED
@@ -11,9 +11,12 @@ function phaseLabel(phase) {
11
11
  function taskLabel(task) {
12
12
  return `T${seq(task.number)} — ${task.title}`;
13
13
  }
14
+ function ideaLabel(idea) {
15
+ return `I${seq(idea.number)} — ${idea.title}`;
16
+ }
14
17
  export class PlanRenderer {
15
18
  renderPlan(plan) {
16
- const { project, manifest, features, requirements, phases } = plan;
19
+ const { project, manifest, features, requirements, ideas, phases } = plan;
17
20
  const lines = [];
18
21
  lines.push(`# ${project.name} — Project Plan`);
19
22
  lines.push("");
@@ -72,6 +75,13 @@ export class PlanRenderer {
72
75
  lines.push(...renderAcceptedDecisions(project.acceptedDecisions));
73
76
  lines.push("");
74
77
  }
78
+ // ── Project Guidelines ──────────────────────────────────────────
79
+ if (project.projectGuidelines.content.trim()) {
80
+ lines.push("## Project Guidelines");
81
+ lines.push("");
82
+ lines.push(project.projectGuidelines.content.trim());
83
+ lines.push("");
84
+ }
75
85
  // ── Global Rules ─────────────────────────────────────────────────
76
86
  if (project.globalRules.length > 0) {
77
87
  lines.push("## Global Rules");
@@ -98,6 +108,19 @@ export class PlanRenderer {
98
108
  lines.push(bullet(wr.afterPhaseComplete));
99
109
  lines.push("");
100
110
  }
111
+ // ── Ideas Inbox ─────────────────────────────────────────────────
112
+ if (ideas.ideas.length > 0) {
113
+ lines.push("---");
114
+ lines.push("## Ideas Inbox");
115
+ lines.push("");
116
+ for (const idea of ideas.ideas) {
117
+ const promotion = idea.promotion ? ` → ${idea.promotion.targetRef}` : "";
118
+ lines.push(`- **${ideaLabel(idea)}**${promotion}`);
119
+ if (idea.description)
120
+ lines.push(` - ${idea.description}`);
121
+ }
122
+ lines.push("");
123
+ }
101
124
  // ── Features ────────────────────────────────────────────────────
102
125
  if (features.features.length > 0) {
103
126
  lines.push("---");
@@ -0,0 +1,18 @@
1
+ import type { MacroTask, RequirementStatus } from "./schema.js";
2
+ export interface MacroTaskMutationInput {
3
+ /** Existing persisted ID only. Omit it for a new macro task. */
4
+ id?: string;
5
+ title: string;
6
+ description?: string;
7
+ status: RequirementStatus;
8
+ }
9
+ export declare class RequirementMacroTaskError extends Error {
10
+ constructor(message: string);
11
+ }
12
+ /**
13
+ * Reconciles user-authored macro-task fields while retaining all system-owned
14
+ * identity and timestamp values. The input array order is canonical, so a
15
+ * successful mutation also performs an explicit reorder atomically.
16
+ */
17
+ export declare function reconcileRequirementMacroTasks(existing: readonly MacroTask[], inputs: readonly MacroTaskMutationInput[], timestamp: string): MacroTask[];
18
+ //# sourceMappingURL=requirement-macro-tasks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requirement-macro-tasks.d.ts","sourceRoot":"","sources":["../src/requirement-macro-tasks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAMhE,MAAM,WAAW,sBAAsB;IACrC,gEAAgE;IAChE,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,iBAAiB,CAAC;CAC3B;AAED,qBAAa,yBAA0B,SAAQ,KAAK;gBACtC,OAAO,EAAE,MAAM;CAI5B;AAUD;;;;GAIG;AACH,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,SAAS,SAAS,EAAE,EAC9B,MAAM,EAAE,SAAS,sBAAsB,EAAE,EACzC,SAAS,EAAE,MAAM,GAChB,SAAS,EAAE,CA+Bb"}
@@ -0,0 +1,55 @@
1
+ const REQUIREMENT_STATUSES = new Set([
2
+ "planned", "in-progress", "done", "blocked", "canceled", "rejected", "deferred", "waiting",
3
+ ]);
4
+ export class RequirementMacroTaskError extends Error {
5
+ constructor(message) {
6
+ super(message);
7
+ this.name = "RequirementMacroTaskError";
8
+ }
9
+ }
10
+ function nextMacroTaskId(used) {
11
+ for (let number = 1; number <= 999; number += 1) {
12
+ const candidate = `MT-${String(number).padStart(3, "0")}`;
13
+ if (!used.has(candidate))
14
+ return candidate;
15
+ }
16
+ throw new RequirementMacroTaskError("A requirement cannot contain more than 999 macro tasks.");
17
+ }
18
+ /**
19
+ * Reconciles user-authored macro-task fields while retaining all system-owned
20
+ * identity and timestamp values. The input array order is canonical, so a
21
+ * successful mutation also performs an explicit reorder atomically.
22
+ */
23
+ export function reconcileRequirementMacroTasks(existing, inputs, timestamp) {
24
+ const existingById = new Map(existing.map((task) => [task.id, task]));
25
+ const usedIds = new Set(existingById.keys());
26
+ const seenIds = new Set();
27
+ return inputs.map((input, index) => {
28
+ const title = input.title.trim();
29
+ if (!title)
30
+ throw new RequirementMacroTaskError(`Macro task ${index + 1} requires a title.`);
31
+ if (!REQUIREMENT_STATUSES.has(input.status)) {
32
+ throw new RequirementMacroTaskError(`Macro task ${index + 1} has an invalid status: ${input.status}.`);
33
+ }
34
+ const requestedId = input.id?.trim();
35
+ if (requestedId && seenIds.has(requestedId)) {
36
+ throw new RequirementMacroTaskError(`Macro task ID ${requestedId} appears more than once.`);
37
+ }
38
+ if (requestedId)
39
+ seenIds.add(requestedId);
40
+ const previous = requestedId ? existingById.get(requestedId) : undefined;
41
+ if (requestedId && !previous) {
42
+ throw new RequirementMacroTaskError(`Macro task ID ${requestedId} is not owned by this requirement.`);
43
+ }
44
+ const id = previous?.id ?? nextMacroTaskId(usedIds);
45
+ usedIds.add(id);
46
+ return {
47
+ id,
48
+ title,
49
+ description: input.description?.trim() ?? "",
50
+ status: input.status,
51
+ createdAt: previous?.createdAt ?? timestamp,
52
+ updatedAt: timestamp,
53
+ };
54
+ });
55
+ }