pi-better-goal 0.17.0 → 0.17.1
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/package.json +1 -1
- package/src/index.ts +8 -2
- package/src/task-context.ts +4 -2
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1296,7 +1296,13 @@ export default function (pi: ExtensionAPI): void {
|
|
|
1296
1296
|
if (latest?.goalId !== current.goalId || latest.status !== current.status) {
|
|
1297
1297
|
return { content: [{ type: "text", text: "Goal changed during the completion check. Read the current Goal." }], details: { ok: false, goal: latest } };
|
|
1298
1298
|
}
|
|
1299
|
-
|
|
1299
|
+
if (gated) {
|
|
1300
|
+
const owner = getWorkflow(ctx);
|
|
1301
|
+
if (owner?.name !== gated.name || owner.path !== gated.path) {
|
|
1302
|
+
return { content: [{ type: "text", text: "Workflow changed during the completion check. Read the current Goal." }], details: { ok: false, goal: latest } };
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
const audit = requestTaskContext(pi, { action: "audit", workflowOwnsPlan: !!gated }, current);
|
|
1300
1306
|
const criteria = audit.doneWhen?.length ? audit.doneWhen : audit.objective ? [audit.objective] : [];
|
|
1301
1307
|
const evidence = [...input.evidence ?? [], ...audit.evidence ?? []];
|
|
1302
1308
|
const missing = criteria.filter(criterion => !evidence.some(item => item.criterion === criterion && item.result.trim()));
|
|
@@ -1311,7 +1317,7 @@ export default function (pi: ExtensionAPI): void {
|
|
|
1311
1317
|
}
|
|
1312
1318
|
const goal = goalWithStatus(latest, "complete");
|
|
1313
1319
|
setGoal(goal, ctx, "tool");
|
|
1314
|
-
if (
|
|
1320
|
+
if (gated) recordWorkflow(null);
|
|
1315
1321
|
const warning = verdict?.allow ? verdict.warning : undefined;
|
|
1316
1322
|
return {
|
|
1317
1323
|
content: [{ type: "text", text: warning ? `Goal marked complete. ${warning}` : "Goal marked complete." }],
|
package/src/task-context.ts
CHANGED
|
@@ -50,6 +50,8 @@ export interface TaskContextRequest {
|
|
|
50
50
|
status?: GoalSnapshot["status"];
|
|
51
51
|
doneWhen?: readonly string[];
|
|
52
52
|
openSteps?: readonly string[];
|
|
53
|
+
/** The Goal delegated its checklist to the workflow checked by the completion gate. */
|
|
54
|
+
workflowOwnsPlan?: boolean;
|
|
53
55
|
/** Evidence retained by a finished workflow bound to this Goal. */
|
|
54
56
|
evidence?: readonly { criterion: string; result: string }[];
|
|
55
57
|
ledgerBlocker?: string;
|
|
@@ -75,12 +77,12 @@ export interface TaskContextRequest {
|
|
|
75
77
|
*/
|
|
76
78
|
export function requestTaskContext(
|
|
77
79
|
pi: Pick<ExtensionAPI, "events">,
|
|
78
|
-
action: TaskContextAction,
|
|
80
|
+
action: TaskContextAction | { action: "audit"; workflowOwnsPlan: boolean },
|
|
79
81
|
goal?: GoalSnapshot | null,
|
|
80
82
|
width?: number,
|
|
81
83
|
manual = false,
|
|
82
84
|
): TaskContextRequest {
|
|
83
|
-
const request: TaskContextRequest = { action };
|
|
85
|
+
const request: TaskContextRequest = typeof action === "string" ? { action } : { ...action };
|
|
84
86
|
if (manual) request.manual = true;
|
|
85
87
|
if (width !== undefined) request.width = width;
|
|
86
88
|
if (goal) {
|