@oyasmi/pipiclaw 0.9.3-beta.5 → 0.9.3
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.en.md +1 -1
- package/README.md +1 -1
- package/dist/agent/channel-runner.d.ts +4 -8
- package/dist/agent/channel-runner.js +14 -34
- package/dist/agent/job-manager.d.ts +12 -0
- package/dist/agent/job-manager.js +42 -1
- package/dist/agent/prompt/sections.js +2 -2
- package/dist/agent/runner-factory.d.ts +2 -2
- package/dist/agent/types.d.ts +11 -7
- package/dist/channel/channel-index.d.ts +9 -2
- package/dist/channel/channel-index.js +25 -6
- package/dist/channel/project-scope-store.d.ts +20 -0
- package/dist/channel/project-scope-store.js +22 -7
- package/dist/commands/catalog.js +6 -12
- package/dist/events/event-commands.js +2 -2
- package/dist/events/events.d.ts +51 -30
- package/dist/events/events.js +70 -98
- package/dist/memory/journal.d.ts +2 -3
- package/dist/memory/journal.js +2 -3
- package/dist/memory/maintenance-tuning.d.ts +0 -1
- package/dist/memory/maintenance-tuning.js +0 -1
- package/dist/memory/scheduler.js +8 -16
- package/dist/memory/search.js +2 -3
- package/dist/memory/session-search.js +3 -9
- package/dist/memory/store.d.ts +1 -1
- package/dist/memory/store.js +9 -1
- package/dist/memory/task-digest.js +10 -11
- package/dist/memory/tombstones.js +2 -4
- package/dist/models/provider-login.d.ts +1 -1
- package/dist/models/provider-login.js +1 -1
- package/dist/playbooks/agent-delegation.md +6 -6
- package/dist/playbooks/background-jobs.md +1 -1
- package/dist/playbooks/event-scheduling.md +22 -13
- package/dist/playbooks/memory-and-learning.md +2 -2
- package/dist/playbooks/outbound-media.md +1 -1
- package/dist/playbooks/runtime-orientation.md +3 -3
- package/dist/playbooks/task-lead.md +82 -0
- package/dist/runtime/bootstrap.js +94 -187
- package/dist/runtime/durable-dispatch.js +30 -3
- package/dist/runtime/report-commands.d.ts +30 -0
- package/dist/runtime/report-commands.js +71 -0
- package/dist/runtime/subagent-commands.js +1 -1
- package/dist/runtime/task-commands.d.ts +0 -8
- package/dist/runtime/task-commands.js +48 -85
- package/dist/runtime/task-driver.d.ts +15 -10
- package/dist/runtime/task-driver.js +36 -41
- package/dist/runtime/task-migration.d.ts +23 -29
- package/dist/runtime/task-migration.js +364 -183
- package/dist/runtime/task-spawn.d.ts +24 -0
- package/dist/runtime/task-spawn.js +49 -0
- package/dist/runtime/task-wake.d.ts +33 -46
- package/dist/runtime/task-wake.js +15 -90
- package/dist/security/network.js +44 -9
- package/dist/settings.d.ts +1 -8
- package/dist/settings.js +1 -8
- package/dist/subagents/discovery.js +3 -15
- package/dist/subagents/external/run.d.ts +3 -1
- package/dist/subagents/external/run.js +2 -20
- package/dist/subagents/external/settlement.d.ts +4 -16
- package/dist/subagents/external/settlement.js +16 -67
- package/dist/subagents/runs.d.ts +15 -29
- package/dist/subagents/runs.js +70 -158
- package/dist/subagents/tool.d.ts +20 -4
- package/dist/subagents/tool.js +63 -87
- package/dist/subagents/verification-outcome.d.ts +13 -19
- package/dist/subagents/verification-outcome.js +8 -22
- package/dist/subagents/workspace-summary.d.ts +8 -0
- package/dist/subagents/workspace-summary.js +29 -0
- package/dist/tasks/board.d.ts +43 -0
- package/dist/tasks/board.js +134 -0
- package/dist/tasks/brief.d.ts +10 -5
- package/dist/tasks/brief.js +78 -26
- package/dist/tasks/budget.d.ts +13 -14
- package/dist/tasks/budget.js +21 -40
- package/dist/tasks/contract-input.d.ts +19 -0
- package/dist/tasks/contract-input.js +55 -0
- package/dist/tasks/create.d.ts +17 -0
- package/dist/tasks/create.js +36 -0
- package/dist/tasks/frontmatter.d.ts +20 -27
- package/dist/tasks/frontmatter.js +18 -31
- package/dist/tasks/ledger.d.ts +61 -117
- package/dist/tasks/ledger.js +78 -223
- package/dist/tasks/log.d.ts +62 -35
- package/dist/tasks/log.js +51 -29
- package/dist/tasks/session-path.d.ts +3 -3
- package/dist/tasks/session-path.js +4 -5
- package/dist/tasks/store.d.ts +27 -28
- package/dist/tasks/store.js +89 -83
- package/dist/tasks/ticket.d.ts +33 -66
- package/dist/tasks/ticket.js +31 -120
- package/dist/tasks/work-log.d.ts +20 -0
- package/dist/tasks/work-log.js +42 -0
- package/dist/tools/bash.d.ts +1 -1
- package/dist/tools/bash.js +1 -1
- package/dist/tools/event-manage.d.ts +16 -2
- package/dist/tools/event-manage.js +30 -12
- package/dist/tools/index.d.ts +5 -3
- package/dist/tools/index.js +5 -5
- package/dist/tools/registry.d.ts +6 -4
- package/dist/tools/registry.js +1 -4
- package/dist/tools/subagent-manage.js +4 -2
- package/dist/tools/task-manage/create.js +11 -27
- package/dist/tools/task-manage/lifecycle.d.ts +6 -7
- package/dist/tools/task-manage/lifecycle.js +23 -106
- package/dist/tools/task-manage/log-view.d.ts +3 -2
- package/dist/tools/task-manage/log-view.js +6 -6
- package/dist/tools/task-manage/schema.d.ts +10 -30
- package/dist/tools/task-manage/schema.js +33 -49
- package/dist/tools/task-manage/shared.d.ts +35 -42
- package/dist/tools/task-manage/shared.js +53 -192
- package/dist/tools/task-manage/step-end.d.ts +6 -6
- package/dist/tools/task-manage/step-end.js +61 -98
- package/dist/tools/task-manage/types.d.ts +8 -9
- package/dist/tools/task-manage.js +5 -5
- package/dist/tui/app.js +11 -38
- package/dist/tui/commands.d.ts +18 -8
- package/dist/tui/commands.js +2 -9
- package/dist/tui/turn-controller.d.ts +2 -14
- package/dist/tui/turn-controller.js +1 -17
- package/dist/web/client.js +9 -1
- package/examples/sub-agents/README.md +7 -4
- package/examples/sub-agents/agents/codex-flash.md +2 -2
- package/examples/sub-agents/agents/codex-high.md +1 -1
- package/examples/sub-agents/agents/codex-main.md +1 -1
- package/examples/sub-agents/agents/codex-review.md +23 -0
- package/examples/sub-agents/roles/verifier.md +1 -1
- package/package.json +1 -1
- package/dist/memory/maintenance-migration.d.ts +0 -5
- package/dist/memory/maintenance-migration.js +0 -91
- package/dist/memory/migrate.d.ts +0 -15
- package/dist/memory/migrate.js +0 -364
- package/dist/playbooks/task-loop.md +0 -90
- package/dist/tasks/artifact-subject.d.ts +0 -40
- package/dist/tasks/artifact-subject.js +0 -334
- package/dist/tasks/cycle.d.ts +0 -48
- package/dist/tasks/cycle.js +0 -94
- package/dist/tasks/rounds.d.ts +0 -41
- package/dist/tasks/rounds.js +0 -53
- package/dist/tasks/task-events.d.ts +0 -6
- package/dist/tasks/task-events.js +0 -14
- package/dist/tasks/task-schedule.d.ts +0 -18
- package/dist/tasks/task-schedule.js +0 -50
- package/dist/tasks/verification.d.ts +0 -114
- package/dist/tasks/verification.js +0 -226
|
@@ -3,7 +3,9 @@ import { isPlainObject } from "../shared/type-guards.js";
|
|
|
3
3
|
import { parseTicket } from "./ticket.js";
|
|
4
4
|
const STATES = ["open", "parked", "done"];
|
|
5
5
|
/** Fixed render order, so a diff of a task file reads the same way every time. */
|
|
6
|
-
const FIELD_ORDER = ["state", "paused", "
|
|
6
|
+
const FIELD_ORDER = ["state", "paused", "origin", "ticket", "usage", "budget"];
|
|
7
|
+
/** v3 frontmatter keys; their presence means the one-time conversion has not run on this file. */
|
|
8
|
+
const LEGACY_KEYS = new Set(["status", "enabled", "control", "wake", "schedule"]);
|
|
7
9
|
function parseJsonObject(raw) {
|
|
8
10
|
try {
|
|
9
11
|
const value = JSON.parse(raw);
|
|
@@ -27,15 +29,13 @@ function parsePaused(raw) {
|
|
|
27
29
|
function nonNegativeNumber(value, fallback) {
|
|
28
30
|
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : fallback;
|
|
29
31
|
}
|
|
30
|
-
function
|
|
32
|
+
function parseUsage(raw) {
|
|
31
33
|
const value = parseJsonObject(raw);
|
|
32
|
-
if (!value
|
|
34
|
+
if (!value)
|
|
33
35
|
return undefined;
|
|
34
36
|
return {
|
|
35
|
-
id: value.id.trim(),
|
|
36
37
|
startedAt: typeof value.startedAt === "string" && value.startedAt ? value.startedAt : formatLocalTime(),
|
|
37
38
|
steps: nonNegativeNumber(value.steps, 0),
|
|
38
|
-
rounds: nonNegativeNumber(value.rounds, 0),
|
|
39
39
|
usd: nonNegativeNumber(value.usd, 0),
|
|
40
40
|
usdEstimated: value.usdEstimated === true,
|
|
41
41
|
expired: nonNegativeNumber(value.expired, 0),
|
|
@@ -48,22 +48,16 @@ function parseBudget(raw) {
|
|
|
48
48
|
const budget = {};
|
|
49
49
|
if (typeof value.steps === "number" && value.steps > 0)
|
|
50
50
|
budget.steps = value.steps;
|
|
51
|
-
if (typeof value.wallMin === "number" && value.wallMin > 0)
|
|
52
|
-
budget.wallMin = value.wallMin;
|
|
53
51
|
if (typeof value.usd === "number" && value.usd > 0)
|
|
54
52
|
budget.usd = value.usd;
|
|
55
|
-
if (typeof value.rounds === "number" && value.rounds > 0)
|
|
56
|
-
budget.rounds = value.rounds;
|
|
57
|
-
if (typeof value.until === "string" && value.until.trim())
|
|
58
|
-
budget.until = value.until.trim();
|
|
59
53
|
return Object.keys(budget).length > 0 ? budget : undefined;
|
|
60
54
|
}
|
|
61
55
|
/**
|
|
62
56
|
* Read the leading frontmatter block. Unreadable input fails **open** to a live `open` task: a
|
|
63
57
|
* corrupt file has to surface as work the runtime tries to touch, not silently disappear from the
|
|
64
|
-
* ledger
|
|
58
|
+
* ledger.
|
|
65
59
|
*/
|
|
66
|
-
export function
|
|
60
|
+
export function parseTaskFrontmatter(content) {
|
|
67
61
|
if (!content.startsWith("---"))
|
|
68
62
|
return { fields: { state: "open" }, readable: false, legacy: false };
|
|
69
63
|
const end = content.indexOf("\n---", 3);
|
|
@@ -88,21 +82,17 @@ export function parseTaskFrontmatterV4(content) {
|
|
|
88
82
|
case "paused":
|
|
89
83
|
fields.paused = parsePaused(value);
|
|
90
84
|
break;
|
|
91
|
-
case "schedule":
|
|
92
|
-
fields.schedule = value || undefined;
|
|
93
|
-
break;
|
|
94
85
|
case "ticket":
|
|
95
86
|
fields.ticket = parseTicket(value);
|
|
96
87
|
break;
|
|
97
|
-
case "
|
|
98
|
-
fields.
|
|
88
|
+
case "usage":
|
|
89
|
+
fields.usage = parseUsage(value);
|
|
99
90
|
break;
|
|
100
91
|
case "budget":
|
|
101
92
|
fields.budget = parseBudget(value);
|
|
102
93
|
break;
|
|
103
|
-
case "
|
|
104
|
-
|
|
105
|
-
fields.verify = "required";
|
|
94
|
+
case "origin":
|
|
95
|
+
fields.origin = value || undefined;
|
|
106
96
|
break;
|
|
107
97
|
case "outcome":
|
|
108
98
|
if (value === "completed" || value === "cancelled")
|
|
@@ -111,20 +101,15 @@ export function parseTaskFrontmatterV4(content) {
|
|
|
111
101
|
case "closedAt":
|
|
112
102
|
fields.closedAt = value || undefined;
|
|
113
103
|
break;
|
|
114
|
-
// v3 leftovers: their presence is the migrator's trigger, their values are its input.
|
|
115
|
-
case "status":
|
|
116
|
-
case "enabled":
|
|
117
|
-
case "control":
|
|
118
|
-
case "wake":
|
|
119
|
-
legacy = true;
|
|
120
|
-
break;
|
|
121
104
|
default:
|
|
105
|
+
if (LEGACY_KEYS.has(key))
|
|
106
|
+
legacy = true;
|
|
122
107
|
break;
|
|
123
108
|
}
|
|
124
109
|
}
|
|
125
110
|
if (fields.outcome)
|
|
126
111
|
fields.state = "done";
|
|
127
|
-
// A file with no recognizable
|
|
112
|
+
// A file with no recognizable marker is not frontmatter we understand.
|
|
128
113
|
const readable = sawState || fields.outcome !== undefined || legacy;
|
|
129
114
|
return { fields: normalizeTaskFrontmatter(fields), readable, legacy };
|
|
130
115
|
}
|
|
@@ -155,8 +140,10 @@ export function renderTaskFrontmatter(fields) {
|
|
|
155
140
|
lines.push(`outcome: ${document.outcome}`);
|
|
156
141
|
if (document.closedAt)
|
|
157
142
|
lines.push(`closedAt: ${document.closedAt}`);
|
|
158
|
-
if (document.
|
|
159
|
-
lines.push(`
|
|
143
|
+
if (document.origin)
|
|
144
|
+
lines.push(`origin: ${document.origin}`);
|
|
145
|
+
if (document.usage)
|
|
146
|
+
lines.push(`usage: ${JSON.stringify(document.usage)}`);
|
|
160
147
|
lines.push("---");
|
|
161
148
|
return lines.join("\n");
|
|
162
149
|
}
|
package/dist/tasks/ledger.d.ts
CHANGED
|
@@ -1,145 +1,95 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type TaskFrontmatter } from "./frontmatter.js";
|
|
2
2
|
/**
|
|
3
3
|
* Shared reader for the task ledger (`workspace/<channelId>/tasks/*.md`).
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* and must degrade toward "wake me up so I can be fixed". `/tasks`, the task digest, and
|
|
9
|
-
* `task_list` all read through here.
|
|
5
|
+
* The parsing stays deliberately literal (flat `key: value` fields, live-vs-archived, fail-open
|
|
6
|
+
* on unreadable frontmatter) because task files are hand-editable and must degrade toward "wake
|
|
7
|
+
* me up so I can be fixed". `/tasks`, the task digest, and `task_list` all read through here.
|
|
10
8
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* Frontmatter lives in `frontmatter.ts` and the waiting claim in `ticket.ts`; what stays here is
|
|
10
|
+
* the *body*: sections, Work Items, DoD, and the skeleton.
|
|
13
11
|
*/
|
|
14
12
|
export interface TaskLedgerEntry {
|
|
15
13
|
/** Filename without `.md`; the task id. */
|
|
16
14
|
id: string;
|
|
17
15
|
/** First `# ` heading in the body, or the id when none. */
|
|
18
16
|
title: string;
|
|
19
|
-
fields:
|
|
17
|
+
fields: TaskFrontmatter;
|
|
20
18
|
/** false => frontmatter could not be read; the task is surfaced rather than skipped. */
|
|
21
19
|
readable: boolean;
|
|
22
|
-
/** True when this file still carries v3
|
|
20
|
+
/** True when this file still carries v3 frontmatter the conversion should have removed; it is never run. */
|
|
23
21
|
legacy: boolean;
|
|
24
22
|
/** The driver may schedule a step for this task right now. */
|
|
25
23
|
runnable: boolean;
|
|
26
|
-
/** When a driver-polled
|
|
24
|
+
/** When a driver-polled `time` ticket comes due, if it has not already. */
|
|
27
25
|
dueMs?: number;
|
|
28
|
-
/** True when a parked task's backstop has passed and the runtime owes it a reopen
|
|
26
|
+
/** True when a parked task's backstop has passed and the runtime owes it a reopen. */
|
|
29
27
|
expired: boolean;
|
|
30
|
-
/** Parsed `##
|
|
31
|
-
|
|
28
|
+
/** Parsed `## Work Items` section, if the task has one. */
|
|
29
|
+
items?: TaskItemsSummary;
|
|
32
30
|
}
|
|
33
|
-
export interface
|
|
31
|
+
export interface TaskContractInput {
|
|
34
32
|
title: string;
|
|
35
33
|
goal: string;
|
|
36
34
|
dod: string;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
plan?: string;
|
|
35
|
+
/** Initial Work Items; ids are assigned `W1…Wn` in order. */
|
|
36
|
+
items?: readonly {
|
|
37
|
+
text: string;
|
|
38
|
+
}[];
|
|
42
39
|
}
|
|
43
|
-
export declare const DEFAULT_TASK_MANUAL = "- Follow the DoD, record evidence in every step note, and park on a ticket when waiting.";
|
|
44
|
-
export declare const STANDARD_TASK_SECTIONS: readonly [{
|
|
45
|
-
readonly label: "Goal";
|
|
46
|
-
readonly names: readonly ["Goal", "目标"];
|
|
47
|
-
}, {
|
|
48
|
-
readonly label: "DoD";
|
|
49
|
-
readonly names: readonly ["DoD"];
|
|
50
|
-
}, {
|
|
51
|
-
readonly label: "Manual";
|
|
52
|
-
readonly names: readonly ["Manual", "手册"];
|
|
53
|
-
}, {
|
|
54
|
-
readonly label: "Verification";
|
|
55
|
-
readonly names: readonly ["Verification", "验收"];
|
|
56
|
-
}];
|
|
57
|
-
/**
|
|
58
|
-
* The single historical paragraph a v4 contract keeps (spec 051, D5). Declared here rather than
|
|
59
|
-
* in `cycle.ts` so `taskContractSegment` can end the contract at it without a circular import.
|
|
60
|
-
*/
|
|
61
|
-
export declare const LAST_RESULT_SECTION_NAMES: readonly ["上次结果", "Last Result"];
|
|
62
40
|
/** Validate/normalize a task id (filename without `.md`), rejecting path traversal. */
|
|
63
41
|
export declare function normalizeTaskId(id: string): string;
|
|
64
42
|
/** The document body after the leading frontmatter block, or the whole content when there is none. */
|
|
65
43
|
export declare function taskBody(content: string): string;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
* Verification (spec 029, D4).
|
|
70
|
-
*
|
|
71
|
-
* Verification PASS binds to this segment, not the whole body, so routine `progress` notes
|
|
72
|
-
* (Current Cycle, and — spec 037, D1 — Plan step status) never invalidate a PASS; only a change
|
|
73
|
-
* to what the task promises to do and how it is checked does.
|
|
74
|
-
* Plan is deliberately excluded from the contract even though it always precedes Current Cycle
|
|
75
|
-
* in a freshly rendered skeleton: it is the task's *means*, not its promise, and is meant to be
|
|
76
|
-
* revised without re-triggering verification. This also means a task with an existing PASS can
|
|
77
|
-
* have `## Plan` inserted between Verification and Current Cycle with the contract segment
|
|
78
|
-
* unchanged byte-for-byte, as long as nothing before it changed.
|
|
79
|
-
* A body without either heading (non-standard) falls back to the whole body.
|
|
80
|
-
*/
|
|
81
|
-
export declare function taskContractSegment(body: string): string;
|
|
82
|
-
/**
|
|
83
|
-
* Hash the task's *contract* segment (Goal/DoD/Manual/Verification), not the whole body, so a
|
|
84
|
-
* verification PASS survives routine step logging and only breaks when the contract itself
|
|
85
|
-
* changes (spec 029, D4). Lives next to `taskContractSegment` because it is that function's
|
|
86
|
-
* only real consumer.
|
|
87
|
-
*/
|
|
88
|
-
export declare function taskBodyHash(body: string): string;
|
|
89
|
-
export type TaskPlanStepStatus = "todo" | "done" | "blocked" | "dropped";
|
|
90
|
-
export interface TaskPlanStep {
|
|
91
|
-
/** `P<n>` by convention; a hand-written step without one gets its position as a fallback. */
|
|
44
|
+
export type TaskItemStatus = "todo" | "done" | "blocked" | "dropped";
|
|
45
|
+
export interface TaskItem {
|
|
46
|
+
/** `W<n>` (a task converted from v3 may still carry `P<n>`). */
|
|
92
47
|
id: string;
|
|
93
|
-
status:
|
|
48
|
+
status: TaskItemStatus;
|
|
94
49
|
text: string;
|
|
95
|
-
/** DoD
|
|
50
|
+
/** DoD checklist items (1-based) this item delivers, from a trailing `→ dod:1,2`. */
|
|
96
51
|
dodRefs: number[];
|
|
52
|
+
/** Line index within the parsed content; used to patch a line in place. */
|
|
97
53
|
lineIndex: number;
|
|
98
54
|
}
|
|
99
|
-
export interface
|
|
100
|
-
|
|
101
|
-
/** Count of
|
|
55
|
+
export interface TaskItemsSummary {
|
|
56
|
+
items: TaskItem[];
|
|
57
|
+
/** Count of items, excluding `dropped` ones. */
|
|
102
58
|
total: number;
|
|
103
59
|
done: number;
|
|
104
|
-
/** The first `todo` or `blocked`
|
|
105
|
-
current?:
|
|
60
|
+
/** The first `todo` or `blocked` item in document order; `undefined` once nothing is left to do. */
|
|
61
|
+
current?: TaskItem;
|
|
106
62
|
}
|
|
107
63
|
/**
|
|
108
|
-
* Parse the optional `##
|
|
109
|
-
*
|
|
64
|
+
* Parse the optional `## Work Items` section: the leader's hand-maintained list of independently
|
|
65
|
+
* deliverable pieces of the project. Four checkbox states — `[ ]` todo, `[x]` done, `[!]`
|
|
66
|
+
* blocked, `[~]` dropped — and no separate "doing" marker: the current item is *derived* (first
|
|
67
|
+
* `todo`/`blocked` in document order), not self-reported. The runtime never ticks an item itself
|
|
68
|
+
* (spec 052, D4): "the delegate says it is done" and "the leader checked it" are different facts.
|
|
110
69
|
*
|
|
111
|
-
*
|
|
112
|
-
* "doing" marker: the current step is *derived* (first `todo`/`blocked` in document order), not
|
|
113
|
-
* self-reported, for the same reason `task-driver.ts`'s fingerprint excludes the model's own
|
|
114
|
-
* progress notes — a runtime-derived signal cannot be talked into lying about itself.
|
|
115
|
-
*
|
|
116
|
-
* Returns `undefined` when there is no Plan heading, or the heading has no checkbox lines under
|
|
117
|
-
* it (nothing to summarize) — both read the same as "this task has no Plan yet".
|
|
70
|
+
* Returns `undefined` when there is no such heading, or it has no checkbox lines under it.
|
|
118
71
|
*/
|
|
119
|
-
export declare function
|
|
120
|
-
export interface
|
|
72
|
+
export declare function parseTaskItems(content: string): TaskItemsSummary | undefined;
|
|
73
|
+
export interface TaskItemPatch {
|
|
121
74
|
id: string;
|
|
122
|
-
status?:
|
|
75
|
+
status?: TaskItemStatus;
|
|
123
76
|
text?: string;
|
|
124
77
|
}
|
|
125
|
-
export interface
|
|
78
|
+
export interface ApplyTaskItemsPatchResult {
|
|
126
79
|
body: string;
|
|
127
|
-
/** Human-readable delta
|
|
80
|
+
/** Human-readable delta for the tool's notice; `""` if nothing changed. */
|
|
128
81
|
summary: string;
|
|
129
82
|
}
|
|
130
83
|
/**
|
|
131
|
-
* Update or append
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
* The returned `summary` is deliberately not a new persisted field (see the file-level doc on
|
|
138
|
-
* `TaskPlanSummary`): it is meant to be appended to the caller's own Current Cycle note, so the
|
|
139
|
-
* change history rides on the log `startTaskCycle` already folds into History — no second,
|
|
140
|
-
* unconsumed revision counter.
|
|
84
|
+
* Update or append Work Items by id. An id that already exists gets its status/text patched in
|
|
85
|
+
* place, preserving its `dod` refs and position; an unseen id is appended as a new item (`text`
|
|
86
|
+
* is then required — there is nothing sensible to append otherwise). A task with no section yet
|
|
87
|
+
* gets an empty one first, so the very first `items` call on a task is also the one that creates
|
|
88
|
+
* its list.
|
|
141
89
|
*/
|
|
142
|
-
export declare function
|
|
90
|
+
export declare function applyTaskItemsPatch(body: string, patches: readonly TaskItemPatch[]): ApplyTaskItemsPatchResult;
|
|
91
|
+
/** Whether `id` names an existing Work Item of the task body (case-insensitive). */
|
|
92
|
+
export declare function findTaskItem(body: string, id: string): TaskItem | undefined;
|
|
143
93
|
/** First `# ` heading after the frontmatter block, or the id when there is none. */
|
|
144
94
|
export declare function extractTaskTitle(content: string, fallbackId: string): string;
|
|
145
95
|
export declare function matchesTaskSectionTitle(title: string, names: readonly string[]): boolean;
|
|
@@ -154,33 +104,27 @@ export interface TaskSectionBounds {
|
|
|
154
104
|
/**
|
|
155
105
|
* Find the first heading matching one of `names` and the exclusive end of its body — the next
|
|
156
106
|
* heading at the same or a shallower level, or end of document. Every task-document section scan
|
|
157
|
-
* (
|
|
107
|
+
* (Work Items, DoD) shares this exact rule; only what a caller does with
|
|
158
108
|
* the bounds differs.
|
|
159
109
|
*/
|
|
160
110
|
export declare function findTaskSectionBounds(lines: readonly string[], names: readonly string[]): TaskSectionBounds | undefined;
|
|
161
|
-
export declare function hasTaskHeading(content: string, names: readonly string[]): boolean;
|
|
162
|
-
export declare function missingStandardTaskSections(content: string): string[];
|
|
163
|
-
export declare function uncheckedTaskAcceptanceItems(content: string): string[];
|
|
164
111
|
/**
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
*
|
|
171
|
-
* gone — the per-step record lives in `<id>.jsonl`, and the one paragraph the contract keeps
|
|
172
|
-
* (`## 上次结果`) is written by the cycle-close path, not by the skeleton.
|
|
112
|
+
* Unchecked Markdown acceptance boxes under the DoD section, plus a synthetic entry when DoD has
|
|
113
|
+
* content but no checkbox syntax at all.
|
|
114
|
+
*
|
|
115
|
+
* Without the "no checklist items" case, a DoD written as prose or a numbered list (no `- [ ]`
|
|
116
|
+
* anywhere) makes this function return an empty array — indistinguishable from "everything is
|
|
117
|
+
* checked" — which would silently let a task close with nothing ever actually checked.
|
|
173
118
|
*/
|
|
174
|
-
export declare function
|
|
175
|
-
/** Serialize a task document: v4 frontmatter block plus the body, unchanged. */
|
|
176
|
-
export declare function renderTaskDocument(fields: TaskFrontmatterV4, rawBody: string): string;
|
|
119
|
+
export declare function uncheckedTaskAcceptanceItems(content: string): string[];
|
|
177
120
|
/**
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
* merely finished, and a new cycle should not resurrect it.
|
|
121
|
+
* The task skeleton: Goal, DoD and (optionally) Work Items (spec 052, §3.4). The runtime never
|
|
122
|
+
* rewrites the body afterwards, so there is no history section here — the per-step record lives
|
|
123
|
+
* in `<id>.jsonl`.
|
|
182
124
|
*/
|
|
183
|
-
export declare function
|
|
125
|
+
export declare function renderStandardTaskBody(input: TaskContractInput): string;
|
|
126
|
+
/** Serialize a task document: frontmatter block plus the body, unchanged. */
|
|
127
|
+
export declare function renderTaskDocument(fields: TaskFrontmatter, rawBody: string): string;
|
|
184
128
|
/**
|
|
185
129
|
* Runnable first; then a parked task whose backstop already expired (the runtime owes it a
|
|
186
130
|
* reopen); then earliest due ticket; then id. Sorting expired parks ahead of ordinary parks is
|