@astrosheep/pi-goal-next 0.1.8 → 0.1.9

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/tools.ts +4 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrosheep/pi-goal-next",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Persistent autonomous goals for pi, with Codex-verbatim goal semantics: continuation prompts, self-audited completion, budgets, and CAS-journaled state.",
5
5
  "type": "module",
6
6
  "files": [
package/src/tools.ts CHANGED
@@ -9,7 +9,7 @@ export type PiLike = { registerTool(tool: any): void };
9
9
 
10
10
  const text = (value: unknown) => typeof value === "string" ? value : JSON.stringify(value);
11
11
  const tokensUsed = (goal: Goal) => goal.usage.input + goal.usage.output + goal.usage.cacheRead + goal.usage.cacheWrite;
12
- function result(message: string, terminate = false): any { return { content: [{ type: "text", text: message }], ...(terminate ? { terminate: true } : {}) }; }
12
+ function result(message: string): any { return { content: [{ type: "text", text: message }] }; }
13
13
  function commitMessage(r: CommitResult): string {
14
14
  if (r.kind === "conflict") return "Goal update conflict: goal changed; retry with the current goal.";
15
15
  if (r.kind === "error") return `Goal update failed: ${r.error instanceof Error ? r.error.message : text(r.error)}`;
@@ -57,11 +57,11 @@ export function registerGoalTools(piLike: PiLike, deps: GoalToolDeps): void {
57
57
  if (!current) return result("Goal update failed: no goal exists.");
58
58
  if (!expected) return result(`Invalid status: ${text(params?.status)} is not complete or blocked.`);
59
59
  const r = await goalCommit.commit({ type: "transition", to: status, by: "agent" }, current.revision);
60
- if (r.kind !== "ok") return result(commitMessage(r), expected);
61
- if (status === "blocked") return result("Goal marked blocked.", true);
60
+ if (r.kind !== "ok") return result(commitMessage(r));
61
+ if (status === "blocked") return result("Goal marked blocked.");
62
62
  const u = (r.snapshot?.goal ?? current.goal).usage;
63
63
  const total = u.input + u.output + u.cacheRead + u.cacheWrite;
64
- return result(`Goal marked complete. Final token usage: input=${u.input} output=${u.output} cacheRead=${u.cacheRead} cacheWrite=${u.cacheWrite} (total=${total}).`, true);
64
+ return result(`Goal marked complete. Final token usage: input=${u.input} output=${u.output} cacheRead=${u.cacheRead} cacheWrite=${u.cacheWrite} (total=${total}).`);
65
65
  }
66
66
  });
67
67
  }