@circuitwall/jarela 2.5.1 → 2.5.2
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/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/app-path-routes-manifest.json +5 -5
- package/.next/standalone/.next/build-manifest.json +2 -2
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/chats/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/chats/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/lookup/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/lookup/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/pair/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/pair/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/status/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/bridges/[id]/status/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/builtin-tools/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/builtin-tools/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/credentials/[id]/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/credentials/[id]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/credentials/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/credentials/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/dashboard/pricing-task/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/dashboard/pricing-task/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/delegations/codex/[job_id]/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/delegations/codex/[job_id]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/reindex/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/reindex/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/documents/sources/[id]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/documents/sources/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/documents/sources/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/events/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/events/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/extension/agents/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/extension/agents/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/extension/fill/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/extension/fill/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/extension/refine/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/extension/refine/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/extension/turn/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/extension/turn/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/extensions/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/extensions/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/config/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/config/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/secrets/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/extensions/tools/[name]/secrets/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/health/probes/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/health/probes/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/integrations/[name]/test/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/integrations/[name]/test/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/callback/route.js +22 -1
- package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/start/route.js +22 -1
- package/.next/standalone/.next/server/app/api/v1/integrations/gmail/oauth/status/route.js +22 -1
- package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/callback/route.js +19 -2
- package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/start/route.js +19 -2
- package/.next/standalone/.next/server/app/api/v1/integrations/outlook/oauth/status/route.js +19 -2
- package/.next/standalone/.next/server/app/api/v1/packages/defaults/[id]/route.js +12 -2
- package/.next/standalone/.next/server/app/api/v1/packages/defaults/[id]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/packages/install/[id]/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/packages/install/[id]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/packages/install/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/packages/install/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/enabled/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/enabled/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/packages/manifests/[name]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/packages/manifests/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/packages/manifests/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/packages/reload/route.js +12 -2
- package/.next/standalone/.next/server/app/api/v1/packages/reload/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/packages/route.js +12 -2
- package/.next/standalone/.next/server/app/api/v1/packages/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/page-capture/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/page-capture/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/approve/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/approve/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/deny/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/pending-actions/[id]/deny/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/pending-actions/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/pending-actions/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/run/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/scheduled-tasks/[id]/run/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/system/restart/route.js +7 -0
- package/.next/standalone/.next/server/app/api/v1/system/restart/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js +52 -45
- package/.next/standalone/.next/server/app/api/v1/threads/[thread_id]/run/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/tools/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/tools/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/update/apply/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/watchers/[id]/run/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/watchers/[id]/run/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/v1/watchers/route.js +8 -1
- package/.next/standalone/.next/server/app/api/v1/watchers/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page.js +72982 -72980
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app-paths-manifest.json +5 -5
- package/.next/standalone/.next/server/chunks/1433.js +1 -1
- package/.next/standalone/.next/server/chunks/210.js +6 -6
- package/.next/standalone/.next/server/chunks/2471.js +17 -17
- package/.next/standalone/.next/server/chunks/3524.js +31 -15
- package/.next/standalone/.next/server/chunks/3566.js +1 -1
- package/.next/standalone/.next/server/chunks/4189.js +1 -1
- package/.next/standalone/.next/server/chunks/{9590.js → 423.js} +10 -3
- package/.next/standalone/.next/server/chunks/4508.js +2 -2
- package/.next/standalone/.next/server/chunks/4596.js +5 -2
- package/.next/standalone/.next/server/chunks/46.js +7 -0
- package/.next/standalone/.next/server/chunks/540.js +29 -5
- package/.next/standalone/.next/server/chunks/5585.js +41 -3
- package/.next/standalone/.next/server/chunks/5908.js +10 -10
- package/.next/standalone/.next/server/chunks/{3399.js → 6058.js} +882 -400
- package/.next/standalone/.next/server/chunks/{9164.js → 6190.js} +13777 -13530
- package/.next/standalone/.next/server/chunks/6649.js +1 -1
- package/.next/standalone/.next/server/chunks/{1388.js → 8842.js} +5961 -5793
- package/.next/standalone/.next/server/chunks/9032.js +5 -5
- package/.next/standalone/.next/server/chunks/{7547.js → 9217.js} +485 -3
- package/.next/standalone/.next/server/instrumentation.js +7 -0
- package/.next/standalone/.next/server/middleware-build-manifest.js +2 -2
- package/.next/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/standalone/.next/server/middleware.js +7 -0
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/preview-props.json +3 -3
- package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/static/chunks/app/{page-dd05bcb5f5b81157.js → page-4112e14360a9909e.js} +1576 -1574
- package/.next/standalone/docs/adoption/changesets.json +139 -0
- package/.next/standalone/package.json +2 -1
- package/CHANGELOG.md +38 -0
- package/browser-extension/background.js +5 -539
- package/browser-extension/lib/form-editing.mjs +541 -0
- package/components/chat/MessageBubble.tsx +4 -736
- package/components/chat/MessageContent.tsx +749 -0
- package/components/layout/MenuPanel.tsx +1 -1
- package/hooks/useSSE.test.ts +46 -0
- package/lib/agents/llm.ts +1 -1
- package/lib/agents/output-validator/validator.test.ts +4 -0
- package/lib/agents/output-validator/validator.ts +1 -1
- package/lib/agents/prompt-registry.test.ts +11 -0
- package/lib/agents/prompt-registry.ts +13 -0
- package/lib/agents/retry-prompts.ts +17 -0
- package/lib/agents/run-retry.ts +671 -0
- package/lib/agents/run-thread.retry.test.ts +176 -2
- package/lib/agents/run-thread.test.ts +6 -6
- package/lib/agents/run-thread.ts +9 -717
- package/lib/agents/stream-collector.test.ts +28 -4
- package/lib/agents/stream-collector.ts +5 -28
- package/lib/agents/tool-outcomes.ts +61 -0
- package/lib/documents/remote/confluence.test.ts +65 -0
- package/lib/documents/remote/confluence.ts +35 -9
- package/lib/documents/remote/jira.ts +1 -1
- package/lib/health/probes.test.ts +32 -0
- package/lib/health/probes.ts +29 -14
- package/lib/integrations/atlassian/manifest.ts +5 -3
- package/lib/integrations/github/manifest.ts +7 -4
- package/lib/integrations/gmail-oauth.ts +16 -1
- package/lib/integrations/microsoft-oauth.ts +17 -2
- package/lib/integrations/outlook/manifest.ts +10 -8
- package/lib/stores/integrations.ts +1 -0
- package/lib/tools/communications/calendar-aliases.test.ts +77 -1
- package/lib/tools/communications/gmail.test.ts +13 -0
- package/lib/tools/communications/ms-graph.test.ts +26 -3
- package/lib/tools/communications/ms-graph.ts +9 -11
- package/lib/tools/communications/outlook-calendar.ts +94 -17
- package/lib/tools/packages/default-packages/atlassian.ts +8 -2
- package/package.json +2 -1
- package/scripts/standalone-footprint.mjs +1 -1
- /package/.next/standalone/.next/static/{XFZTDssHBZKKX2mzH2ld0 → VZXMorlOmSmi3dUr7K5UX}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{XFZTDssHBZKKX2mzH2ld0 → VZXMorlOmSmi3dUr7K5UX}/_ssgManifest.js +0 -0
|
@@ -289,7 +289,7 @@ export function MenuPanel({
|
|
|
289
289
|
|
|
290
290
|
return (
|
|
291
291
|
<div
|
|
292
|
-
className="glass-elevated fixed right-0 bottom-0 w-full sm:w-[26rem] max-w-full border-l border-border/60 z-
|
|
292
|
+
className="glass-elevated fixed right-0 bottom-0 w-full sm:w-[26rem] max-w-full border-l border-border/60 z-[60] flex flex-col pb-safe"
|
|
293
293
|
style={{ top: "calc(3rem + var(--app-safe-top))" }}
|
|
294
294
|
>
|
|
295
295
|
{/* Common navigation — the day-to-day surface. */}
|
package/hooks/useSSE.test.ts
CHANGED
|
@@ -110,6 +110,52 @@ describe("useSSE contract", () => {
|
|
|
110
110
|
expect(result.current.streamingContent).not.toContain("flagged reply");
|
|
111
111
|
});
|
|
112
112
|
|
|
113
|
+
it.each(["success", "failure"])("keeps the comparison visible while correction is pending (%s)", async (outcome) => {
|
|
114
|
+
const table = "| Option | Cost |\n| --- | --- |\n| A | 10 |\n| B | 20 |\n| C | 30 |\n| D | 40 |\n| E | 50 |";
|
|
115
|
+
const draft = `${table}\nI saved the comparison.`;
|
|
116
|
+
const corrected = `${table}\nThe comparison has not been saved.`;
|
|
117
|
+
let release!: () => void;
|
|
118
|
+
const gate = new Promise<void>((resolve) => { release = resolve; });
|
|
119
|
+
subscribeRunMock.mockReturnValue({
|
|
120
|
+
async *[Symbol.asyncIterator]() {
|
|
121
|
+
yield JSON.stringify({ type: "text_delta", delta: draft });
|
|
122
|
+
yield JSON.stringify({ type: "tool_call", id: "read-1", name: "memory_read", arguments: {} });
|
|
123
|
+
yield JSON.stringify({ type: "tool_result", id: "read-1", name: "memory_read", result: null });
|
|
124
|
+
yield JSON.stringify({ type: "status", label: "Checking answer..." });
|
|
125
|
+
await gate;
|
|
126
|
+
if (outcome === "failure") {
|
|
127
|
+
yield JSON.stringify({ type: "error", code: "correction_failed", message: "Correction failed; draft remains unverified." });
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
yield JSON.stringify({ type: "reset_text" });
|
|
131
|
+
yield JSON.stringify({ type: "text_delta", delta: corrected });
|
|
132
|
+
yield JSON.stringify({ type: "done" });
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
submitRunMock.mockResolvedValue({ accepted: true });
|
|
136
|
+
const onDone = vi.fn();
|
|
137
|
+
const { result } = renderHook(() => useSSE(onDone));
|
|
138
|
+
let run!: Promise<{ accepted: boolean }>;
|
|
139
|
+
try {
|
|
140
|
+
act(() => { run = result.current.start("comparison-thread", "Compare five options."); });
|
|
141
|
+
await waitFor(() => expect(result.current.streamingContent).toBe(draft));
|
|
142
|
+
expect(result.current.streaming).toBe(true);
|
|
143
|
+
expect(onDone).not.toHaveBeenCalled();
|
|
144
|
+
expect(result.current.toolEvents).toHaveLength(2);
|
|
145
|
+
|
|
146
|
+
await act(async () => { release(); await run; });
|
|
147
|
+
expect(result.current.streaming).toBe(false);
|
|
148
|
+
expect(result.current.streamingContent).toBe(outcome === "success" ? corrected : draft);
|
|
149
|
+
expect(result.current.streamingContent).toContain(table);
|
|
150
|
+
expect(onDone).toHaveBeenCalledTimes(1);
|
|
151
|
+
expect(result.current.toolEvents).toHaveLength(2);
|
|
152
|
+
expect(result.current.error).toBe(outcome === "failure" ? "Correction failed; draft remains unverified." : null);
|
|
153
|
+
} finally {
|
|
154
|
+
release();
|
|
155
|
+
await act(async () => { await run; });
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
|
|
113
159
|
it("records tool_progress events alongside tool_call/tool_result (ADR-0073)", async () => {
|
|
114
160
|
submitRunMock.mockResolvedValue({ accepted: true });
|
|
115
161
|
subscribeRunMock.mockReturnValue(streamWithProgress());
|
package/lib/agents/llm.ts
CHANGED
|
@@ -450,7 +450,7 @@ async function* streamWithConfigImpl(
|
|
|
450
450
|
}
|
|
451
451
|
yield {
|
|
452
452
|
type: "tool_result",
|
|
453
|
-
data: { id: chunk.tool_call_id, name: chunk.name ?? "", result },
|
|
453
|
+
data: { id: chunk.tool_call_id, name: chunk.name ?? "", result, status: chunk.status },
|
|
454
454
|
};
|
|
455
455
|
// Next AI text should be visually separated from the pre-tool prose.
|
|
456
456
|
needsParagraphBreak = true;
|
|
@@ -206,6 +206,10 @@ describe("validateAssistantOutput", () => {
|
|
|
206
206
|
});
|
|
207
207
|
|
|
208
208
|
describe("summary_without_action", () => {
|
|
209
|
+
it("allows an ordinary summary that makes no action claim", () => {
|
|
210
|
+
expect(validateAssistantOutput("## Summary\nOption A costs 10 units; option B costs 20 units.", [], [])).toEqual({ ok: true });
|
|
211
|
+
});
|
|
212
|
+
|
|
209
213
|
it("flags 'Summary of changes' in zero-tool turn", () => {
|
|
210
214
|
const r = validateAssistantOutput(
|
|
211
215
|
"## Summary of changes\nI made the following edits...",
|
|
@@ -4,7 +4,7 @@ import type { ValidationResult } from "./types";
|
|
|
4
4
|
import { isWriteToolNameSegment } from "@/lib/agents/action-vocabulary";
|
|
5
5
|
|
|
6
6
|
const SUMMARY_PATTERNS: RegExp[] = [
|
|
7
|
-
/^#{1,6}\s*Summary
|
|
7
|
+
/^#{1,6}\s*Summary\s+of\s+changes\b/im,
|
|
8
8
|
/\bI(?:'ve|\s+have)\s+completed\b/i,
|
|
9
9
|
/\bWhat\s+I\s+did\b/i,
|
|
10
10
|
];
|
|
@@ -137,6 +137,7 @@ describe("prompt registry coverage", () => {
|
|
|
137
137
|
"lib/agents/prepare/system-prompt.ts",
|
|
138
138
|
"lib/agents/harness/presets.ts",
|
|
139
139
|
"lib/lifecycle/system-signals.ts",
|
|
140
|
+
"lib/agents/retry-prompts.ts",
|
|
140
141
|
];
|
|
141
142
|
for (const source of declaring) {
|
|
142
143
|
expect(registered, `${source} declares a prompt but is not in prompt-registry.ts`).toContain(source);
|
|
@@ -159,6 +160,16 @@ describe("prompt registry coverage", () => {
|
|
|
159
160
|
}
|
|
160
161
|
});
|
|
161
162
|
|
|
163
|
+
it("requires correction retries to preserve the complete answer", () => {
|
|
164
|
+
for (const id of ["agent.retry-fabrication", "agent.retry-citation"]) {
|
|
165
|
+
const prompt = staticPrompts.find((entry) => entry.id === id)?.text ?? "";
|
|
166
|
+
expect(prompt).toContain("complete corrected answer to the original user request");
|
|
167
|
+
expect(prompt).toContain("Preserve all valid explanations, calculations, tables, and conclusions");
|
|
168
|
+
expect(prompt).toContain("Do not return only a correction or a tool confirmation");
|
|
169
|
+
expect(prompt).not.toContain("Do NOT restate");
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
|
|
162
173
|
it("keeps prompt ids unique", () => {
|
|
163
174
|
const ids = staticPrompts.map((p) => p.id);
|
|
164
175
|
expect(new Set(ids).size).toBe(ids.length);
|
|
@@ -19,6 +19,7 @@ import { SYSTEM_SIGNAL_WAKE_PROMPT } from "@/lib/lifecycle/system-signals";
|
|
|
19
19
|
import { buildConversationSummaryMessages, type SummaryTopicSegment } from "@/lib/agents/conversation-summary";
|
|
20
20
|
import { buildTopicGroupingMessages, buildTopicRecapMessages } from "@/lib/agents/compaction-pipeline";
|
|
21
21
|
import type { ProviderMessage } from "@/lib/providers/types";
|
|
22
|
+
import { buildFabricationNudge, buildCitationRetryNudge } from "./retry-prompts";
|
|
22
23
|
|
|
23
24
|
export interface StaticPrompt {
|
|
24
25
|
id: string;
|
|
@@ -57,6 +58,18 @@ export function listStaticPrompts(): StaticPrompt[] {
|
|
|
57
58
|
const channelGroup = renderMessages(buildTopicGroupingMessages(sampleNewMessages, [sampleTopic], "scheduled_task"));
|
|
58
59
|
const channelRecap = renderMessages(buildTopicRecapMessages({ title: sampleTopic.title, continues: "t1", seqs: [50, 51] }, sampleTopic, sampleNewMessages, "scheduled_task"));
|
|
59
60
|
const prompts: StaticPrompt[] = [
|
|
61
|
+
{
|
|
62
|
+
id: "agent.retry-fabrication",
|
|
63
|
+
source: "lib/agents/retry-prompts.ts",
|
|
64
|
+
purpose: "Repairs an unsupported action claim while retaining the complete substantive answer.",
|
|
65
|
+
text: buildFabricationNudge("Example action claim has no confirmed tool result"),
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: "agent.retry-citation",
|
|
69
|
+
source: "lib/agents/retry-prompts.ts",
|
|
70
|
+
purpose: "Repairs unsupported citations while retaining the complete substantive answer.",
|
|
71
|
+
text: buildCitationRetryNudge([{ text: "Example claim", reason: "No verified source" }]),
|
|
72
|
+
},
|
|
60
73
|
{
|
|
61
74
|
id: "agent.system-signal-wakeup",
|
|
62
75
|
source: "lib/lifecycle/system-signals.ts",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface CitationRepairClaim {
|
|
2
|
+
text: string;
|
|
3
|
+
reason: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
const COMPLETE_ANSWER_REPAIR = "Return a complete corrected answer to the original user request. Preserve all valid explanations, calculations, tables, and conclusions. Correct unsupported action claims: call the missing tool if the user authorized that action, or state honestly that it was not performed. Do not return only a correction or a tool confirmation. Your completed answer will replace the draft; the user must not lose the substantive answer.";
|
|
7
|
+
|
|
8
|
+
export function buildFabricationNudge(reason: string): string {
|
|
9
|
+
return `\u21bb Auto-retry: output validator flagged your reply${reason ? ` \u2014 ${reason}` : ""}. ${COMPLETE_ANSWER_REPAIR}`;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function buildCitationRetryNudge(claims: readonly CitationRepairClaim[]): string {
|
|
13
|
+
const details = claims.slice(0, 5).map((claim, index) =>
|
|
14
|
+
` ${index + 1}. ${claim.text}${claim.reason ? ` \u2014 ${claim.reason}` : ""}`,
|
|
15
|
+
).join("\n");
|
|
16
|
+
return `\u21bb Auto-retry: the citation audit flagged ${claims.length} high-impact claim${claims.length === 1 ? "" : "s"} without a verified source:\n${details}\n\nFix each claim in exactly ONE of these three ways:\n (a) cite an existing source from the manifest by appending the marker \`[N]\` to the claim,\n (b) call a tool now (file_read, web_search, fetch_webpage, memory_read) to actually ground the claim before stating it,\n (c) rephrase plainly: drop the specific number/fact, or say "I don't have a source for this" so the claim is no longer load-bearing.\n\n${COMPLETE_ANSWER_REPAIR} Do NOT invent a marker number that isn't in the manifest.`;
|
|
17
|
+
}
|