notesoup 0.51.6 → 0.51.7
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/dist/plugins/pi/tool-result.d.ts +1 -0
- package/dist/plugins/pi/tool-result.js +3 -1
- package/dist/test/boot.integration.test.js +3 -1
- package/dist/test/reset-lifecycle.test.js +1 -0
- package/package.json +1 -1
- package/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/plugins/paseo/client/brain-empty-transformer.ts +4 -1
- package/plugins/paseo/test/brain-empty.test.ts +1 -1
- package/plugins/pi/tool-result.ts +3 -1
|
@@ -4,6 +4,7 @@ import type { Static, TSchema } from "typebox";
|
|
|
4
4
|
import { type Operation, type Outcome } from "../../src/tools/result.js";
|
|
5
5
|
/** Pi's JSON envelope for reset and budget tools; details carry only log/UI metadata. */
|
|
6
6
|
export declare function output(value: unknown, details?: unknown, terminate?: boolean): {
|
|
7
|
+
isError?: boolean | undefined;
|
|
7
8
|
content: {
|
|
8
9
|
type: "text";
|
|
9
10
|
text: string;
|
|
@@ -3,7 +3,9 @@ import { defineTool } from "@earendil-works/pi-coding-agent";
|
|
|
3
3
|
import { wireResult } from "../../src/tools/result.js";
|
|
4
4
|
/** Pi's JSON envelope for reset and budget tools; details carry only log/UI metadata. */
|
|
5
5
|
export function output(value, details, terminate = false) {
|
|
6
|
-
|
|
6
|
+
// A refusal is a failed tool call, not a successful answer carrying an error string: the host UI only flags isError.
|
|
7
|
+
const refused = typeof value === "object" && value !== null && typeof value.error === "string";
|
|
8
|
+
return { content: [{ type: "text", text: JSON.stringify(value) }], details, terminate, ...(refused ? { isError: true } : {}) };
|
|
7
9
|
}
|
|
8
10
|
/** Operation data is schema-derived JSON; only the unresolved generic needs a JsonValue assertion. */
|
|
9
11
|
function piOperationResult(render, outcome) {
|
|
@@ -349,7 +349,9 @@ test("notesoup command toggles future work, /empty schedules a turn-end reset, a
|
|
|
349
349
|
assert.equal(sentOf(captured, GUIDANCE_TYPE).length, 0, "no guidance persisted while off");
|
|
350
350
|
await runHandlers(captured, "session_start", { reason: "startup" }, low);
|
|
351
351
|
assert.equal(captured.sent.length, 1, "no new boot block is persisted while off");
|
|
352
|
-
const
|
|
352
|
+
const offResultRaw = await call(captured, "empty_brain", {}, low);
|
|
353
|
+
assert.equal(offResultRaw.isError, true, "a refusal is a failed tool call, not a successful answer");
|
|
354
|
+
const offResult = resultJson(offResultRaw);
|
|
353
355
|
assert.match(offResult.error ?? "", /off/, "empty_brain refuses while off");
|
|
354
356
|
notices = await runCommand(captured, "notesoup", "on", low);
|
|
355
357
|
assert.match(notices[0]?.message ?? "", /on/);
|
|
@@ -897,6 +897,7 @@ test("empty_brain trims the last word, refuses an oversized one, and a blank per
|
|
|
897
897
|
const over = harness();
|
|
898
898
|
over.sessionManager.appendMessage({ role: "user", content: [{ type: "text", text: "before reset" }], timestamp: Date.now() });
|
|
899
899
|
const refused = await over.callTool("empty_brain", { last_word: "x".repeat(MAX_LAST_WORD_CHARS + 1) });
|
|
900
|
+
assert.equal(refused.isError, true, "an oversized note fails the tool call so the host flags it");
|
|
900
901
|
assert.match(JSON.stringify(refused), /error/, "an oversized note is refused, not truncated");
|
|
901
902
|
assert.match(JSON.stringify(refused), new RegExp(`${MAX_LAST_WORD_CHARS + 1} characters`), "the refusal names the actual size and the limit");
|
|
902
903
|
const refusedAstral = await over.callTool("empty_brain", { last_word: "\u{1F41F}".repeat(MAX_LAST_WORD_CHARS + 1) });
|
package/package.json
CHANGED
|
@@ -27,7 +27,10 @@ function brainEmptyData(item: ToolCallItem): BrainEmpty | undefined {
|
|
|
27
27
|
if (item.status === "running") return { status: "running" };
|
|
28
28
|
const wire = resultJson(item.detail.output);
|
|
29
29
|
if (wire && typeof wire.error === "string") return { status: item.status === "failed" ? "failed" : "completed", error: wire.error };
|
|
30
|
-
if (item.status === "failed")
|
|
30
|
+
if (item.status === "failed") {
|
|
31
|
+
const hostError = isRecord(item.error) && typeof item.error.message === "string" ? item.error.message : undefined;
|
|
32
|
+
return { status: "failed", error: hostError ?? "failed" };
|
|
33
|
+
}
|
|
31
34
|
if (wire && typeof wire.status === "string") return { status: "completed", outcome: wire.status };
|
|
32
35
|
return { status: "completed" };
|
|
33
36
|
}
|
|
@@ -42,7 +42,7 @@ test("already-pending is an outcome, not an error", () => {
|
|
|
42
42
|
|
|
43
43
|
test("a failed transport call without a payload still fails", () => {
|
|
44
44
|
const result = transform({ status: "failed", error: { message: "boom" }, detail: { type: "unknown", input: {}, output: null } });
|
|
45
|
-
assert.deepEqual(brainEmptySchema.parse(result!.items[0]!.data), { status: "failed", error: "
|
|
45
|
+
assert.deepEqual(brainEmptySchema.parse(result!.items[0]!.data), { status: "failed", error: "boom" });
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
test("other tools and non-tool items stay untouched", () => {
|
|
@@ -7,7 +7,9 @@ import { wireResult, type Operation, type Outcome, type Renderer } from "../../s
|
|
|
7
7
|
|
|
8
8
|
/** Pi's JSON envelope for reset and budget tools; details carry only log/UI metadata. */
|
|
9
9
|
export function output(value: unknown, details?: unknown, terminate = false) {
|
|
10
|
-
|
|
10
|
+
// A refusal is a failed tool call, not a successful answer carrying an error string: the host UI only flags isError.
|
|
11
|
+
const refused = typeof value === "object" && value !== null && typeof (value as { error?: unknown }).error === "string";
|
|
12
|
+
return { content: [{ type: "text" as const, text: JSON.stringify(value) }], details, terminate, ...(refused ? { isError: true } : {}) };
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
/** Operation data is schema-derived JSON; only the unresolved generic needs a JsonValue assertion. */
|