@polpo-ai/server 0.11.1 → 0.12.0
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/deps.d.ts +4 -4
- package/dist/deps.d.ts.map +1 -1
- package/dist/routes/completions/agent-step-runner.d.ts +49 -0
- package/dist/routes/completions/agent-step-runner.d.ts.map +1 -0
- package/dist/routes/completions/agent-step-runner.js +166 -0
- package/dist/routes/completions/agent-step-runner.js.map +1 -0
- package/dist/routes/completions/chat-handler.d.ts +51 -0
- package/dist/routes/completions/chat-handler.d.ts.map +1 -0
- package/dist/routes/completions/chat-handler.js +710 -0
- package/dist/routes/completions/chat-handler.js.map +1 -0
- package/dist/routes/completions/message-mapping.d.ts +21 -0
- package/dist/routes/completions/message-mapping.d.ts.map +1 -0
- package/dist/routes/completions/message-mapping.js +156 -0
- package/dist/routes/completions/message-mapping.js.map +1 -0
- package/dist/routes/completions/project-loop-runner.d.ts +65 -0
- package/dist/routes/completions/project-loop-runner.d.ts.map +1 -0
- package/dist/routes/completions/project-loop-runner.js +482 -0
- package/dist/routes/completions/project-loop-runner.js.map +1 -0
- package/dist/routes/completions/schemas.d.ts +242 -0
- package/dist/routes/completions/schemas.d.ts.map +1 -0
- package/dist/routes/completions/schemas.js +148 -0
- package/dist/routes/completions/schemas.js.map +1 -0
- package/dist/routes/completions/sse.d.ts +57 -0
- package/dist/routes/completions/sse.d.ts.map +1 -0
- package/dist/routes/completions/sse.js +96 -0
- package/dist/routes/completions/sse.js.map +1 -0
- package/dist/routes/completions/tool-mapping.d.ts +44 -0
- package/dist/routes/completions/tool-mapping.d.ts.map +1 -0
- package/dist/routes/completions/tool-mapping.js +154 -0
- package/dist/routes/completions/tool-mapping.js.map +1 -0
- package/dist/routes/completions.d.ts +13 -20
- package/dist/routes/completions.d.ts.map +1 -1
- package/dist/routes/completions.js +49 -1882
- package/dist/routes/completions.js.map +1 -1
- package/dist/routes/missions.d.ts +2 -2
- package/dist/routes/missions.d.ts.map +1 -1
- package/dist/routes/missions.js +2 -2
- package/dist/routes/missions.js.map +1 -1
- package/dist/routes/playbooks.d.ts +1 -1
- package/dist/routes/playbooks.d.ts.map +1 -1
- package/dist/routes/playbooks.js +1 -1
- package/dist/routes/playbooks.js.map +1 -1
- package/dist/routes/tasks.d.ts +1 -1
- package/dist/routes/tasks.d.ts.map +1 -1
- package/dist/routes/tasks.js +3 -3
- package/dist/routes/tasks.js.map +1 -1
- package/dist/schemas.d.ts +0 -13
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +1 -11
- package/dist/schemas.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Polpo tool → AI SDK tool mapping for the chat completions endpoint,
|
|
3
|
+
* plus tool-call side effects shared by the chat loop and the loop
|
|
4
|
+
* runtimes: file:changed events, vault credential redaction, and
|
|
5
|
+
* provider-executed tool-call bookkeeping.
|
|
6
|
+
*/
|
|
7
|
+
import { jsonSchema } from "ai";
|
|
8
|
+
/** Tools that write/modify files — emit file:changed after successful execution */
|
|
9
|
+
const FILE_WRITE_TOOLS = {
|
|
10
|
+
write_file: "created",
|
|
11
|
+
edit_file: "modified",
|
|
12
|
+
};
|
|
13
|
+
/** Emit file:changed if a file-writing tool succeeded */
|
|
14
|
+
export function emitFileChanged(toolName, args, result, emit) {
|
|
15
|
+
const action = FILE_WRITE_TOOLS[toolName];
|
|
16
|
+
if (!action || result.startsWith("Error:"))
|
|
17
|
+
return;
|
|
18
|
+
const path = args.path;
|
|
19
|
+
if (!path)
|
|
20
|
+
return;
|
|
21
|
+
const dir = path.includes("/") ? path.substring(0, path.lastIndexOf("/")) : ".";
|
|
22
|
+
emit("file:changed", { path, dir, action, source: "chat" });
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Redact sensitive credential values from vault tool call arguments before persistence.
|
|
26
|
+
* Returns a sanitized copy — original is NOT mutated.
|
|
27
|
+
*/
|
|
28
|
+
export function redactVaultToolCalls(toolCalls) {
|
|
29
|
+
// @ts-ignore — ToolCallInfo shape preserved via duck typing
|
|
30
|
+
return toolCalls.map(tc => {
|
|
31
|
+
if ((tc.name !== "set_vault_entry" && tc.name !== "update_vault_credentials") || !tc.arguments)
|
|
32
|
+
return tc;
|
|
33
|
+
const args = { ...tc.arguments };
|
|
34
|
+
if (args.credentials && typeof args.credentials === "object") {
|
|
35
|
+
// Replace each credential value with a redacted marker, preserve keys for display
|
|
36
|
+
const redacted = {};
|
|
37
|
+
for (const key of Object.keys(args.credentials)) {
|
|
38
|
+
redacted[key] = "[REDACTED]";
|
|
39
|
+
}
|
|
40
|
+
args.credentials = redacted;
|
|
41
|
+
}
|
|
42
|
+
return { ...tc, arguments: args };
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
export function indexToolResultsByCallId(toolResults) {
|
|
46
|
+
const indexed = new Map();
|
|
47
|
+
for (const result of toolResults ?? []) {
|
|
48
|
+
if (result?.toolCallId)
|
|
49
|
+
indexed.set(result.toolCallId, result);
|
|
50
|
+
}
|
|
51
|
+
return indexed;
|
|
52
|
+
}
|
|
53
|
+
export function providerToolCallEvent(call, toolResults) {
|
|
54
|
+
const toolResult = toolResults.get(call.toolCallId);
|
|
55
|
+
const output = toolResult?.output ?? toolResult?.result ?? toolResult?.error;
|
|
56
|
+
return {
|
|
57
|
+
id: call.toolCallId,
|
|
58
|
+
name: call.toolName,
|
|
59
|
+
arguments: call.input,
|
|
60
|
+
result: output === undefined ? undefined : typeof output === "string" ? output : JSON.stringify(output),
|
|
61
|
+
state: toolResult?.type === "tool-error" || toolResult?.error ? "error" : "completed",
|
|
62
|
+
providerExecuted: true,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export function recordProviderToolCall(toolCallsAccum, call, toolResults) {
|
|
66
|
+
toolCallsAccum.push(providerToolCallEvent(call, toolResults));
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Convert Polpo tools to AI SDK tool format (without execute functions).
|
|
70
|
+
*
|
|
71
|
+
* AI SDK tools: Record<string, { description, inputSchema }>
|
|
72
|
+
* Tools without execute are "manual" — tool calls are returned but not auto-executed.
|
|
73
|
+
*/
|
|
74
|
+
export function toAITools(tools) {
|
|
75
|
+
if (!tools.length)
|
|
76
|
+
return {};
|
|
77
|
+
return Object.fromEntries(tools.map(t => [t.name, {
|
|
78
|
+
description: t.description,
|
|
79
|
+
inputSchema: jsonSchema(t.parameters),
|
|
80
|
+
}]));
|
|
81
|
+
}
|
|
82
|
+
export function toAIToolChoice(choice) {
|
|
83
|
+
if (!choice)
|
|
84
|
+
return undefined;
|
|
85
|
+
if (choice === "auto" || choice === "none" || choice === "required")
|
|
86
|
+
return choice;
|
|
87
|
+
if (typeof choice !== "object")
|
|
88
|
+
return undefined;
|
|
89
|
+
const c = choice;
|
|
90
|
+
if (c.mode === "auto" || c.mode === "none")
|
|
91
|
+
return c.mode;
|
|
92
|
+
if (c.mode === "required" && typeof c.tool === "string" && c.tool.trim()) {
|
|
93
|
+
return { type: "tool", toolName: c.tool };
|
|
94
|
+
}
|
|
95
|
+
if (c.mode === "required")
|
|
96
|
+
return "required";
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
// ── Client-side tools ────────────────────────────────────────────────────
|
|
100
|
+
// These tools have NO server-side execute. When the LLM calls them, the
|
|
101
|
+
// server stops the tool loop and returns the tool call to the client via
|
|
102
|
+
// standard OpenAI finish_reason: "tool_calls". The client handles them
|
|
103
|
+
// (shows UI, collects input) and sends the result back as a tool message.
|
|
104
|
+
export const CLIENT_SIDE_TOOLS = {
|
|
105
|
+
ask_user_question: {
|
|
106
|
+
description: [
|
|
107
|
+
"Ask the user clarifying questions before proceeding.",
|
|
108
|
+
"Use when the request is ambiguous or has multiple valid interpretations.",
|
|
109
|
+
"Each question has pre-populated selectable options the user can pick from.",
|
|
110
|
+
"Do NOT ask for information you can infer from context or memory.",
|
|
111
|
+
"Do NOT ask obvious questions — if there's one clear interpretation, just do it.",
|
|
112
|
+
"Pre-populate options with the most likely choices. Be concise (1-5 words per label).",
|
|
113
|
+
"If you recommend one option, put it first and add '(Recommended)' to its label.",
|
|
114
|
+
"After receiving answers, proceed immediately — don't summarize the answers back.",
|
|
115
|
+
"Max 5 questions per call. Prefer fewer, more focused questions.",
|
|
116
|
+
].join(" "),
|
|
117
|
+
inputSchema: jsonSchema({
|
|
118
|
+
type: "object",
|
|
119
|
+
properties: {
|
|
120
|
+
questions: {
|
|
121
|
+
type: "array",
|
|
122
|
+
description: "List of questions to ask the user",
|
|
123
|
+
items: {
|
|
124
|
+
type: "object",
|
|
125
|
+
properties: {
|
|
126
|
+
id: { type: "string", description: "Unique question key for matching answers (e.g. 'auth-method')" },
|
|
127
|
+
question: { type: "string", description: "The question text" },
|
|
128
|
+
header: { type: "string", description: "Short label for compact display (max 30 chars)" },
|
|
129
|
+
options: {
|
|
130
|
+
type: "array",
|
|
131
|
+
description: "Pre-populated selectable options",
|
|
132
|
+
items: {
|
|
133
|
+
type: "object",
|
|
134
|
+
properties: {
|
|
135
|
+
label: { type: "string", description: "Option label (1-5 words)" },
|
|
136
|
+
description: { type: "string", description: "Optional longer description" },
|
|
137
|
+
},
|
|
138
|
+
required: ["label"],
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
multiple: { type: "boolean", description: "Allow selecting multiple options (default: false)" },
|
|
142
|
+
custom: { type: "boolean", description: "Show a 'Type your own answer' input (default: true)" },
|
|
143
|
+
},
|
|
144
|
+
required: ["id", "question", "options"],
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
required: ["questions"],
|
|
149
|
+
}),
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
/** Set of tool names that are client-side (no server execute). */
|
|
153
|
+
export const CLIENT_SIDE_TOOL_NAMES = new Set(Object.keys(CLIENT_SIDE_TOOLS));
|
|
154
|
+
//# sourceMappingURL=tool-mapping.js.map
|
|
@@ -0,0 +1 @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AI,EAAE,QAAQ,EAAE,WAAW,EAAE,6BAA6B,EAAE;qCAC5E;oCACD,QAAQ,EAAE,CAAC,OAAO,CAAC;iCACpB;6BACF;4BACD,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,mDAAmD,EAAE;4BAC/F,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,qDAAqD,EAAE;yBAChG;wBACD,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,CAAC;qBACxC;iBACF;aACF;YACD,QAAQ,EAAE,CAAC,WAAW,CAAC;SACxB,CAAC;KACH;CACF,CAAC;AAEF,kEAAkE;AAClE,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC"}
|
|
@@ -17,23 +17,22 @@
|
|
|
17
17
|
* LLM calls use Vercel AI SDK's streamText/generateText directly.
|
|
18
18
|
* Tools are passed WITHOUT execute functions — execution is manual via
|
|
19
19
|
* the effectiveToolExecutor callback from deps.
|
|
20
|
+
*
|
|
21
|
+
* This file owns request handling only (auth, mode resolution, session
|
|
22
|
+
* persistence, dispatch). The moving parts live in ./completions/:
|
|
23
|
+
* - schemas.ts — Zod schemas + OpenAPI route definition
|
|
24
|
+
* - message-mapping.ts — OpenAI ⇄ AI SDK message conversion
|
|
25
|
+
* - sse.ts — SSE chunks, error envelopes, response shapes
|
|
26
|
+
* - tool-mapping.ts — Polpo → AI SDK tool mapping, vault redaction
|
|
27
|
+
* - agent-step-runner.ts — single agent-step execution for loop runtimes
|
|
28
|
+
* - project-loop-runner.ts — deterministic project loop runtime + resume
|
|
29
|
+
* - chat-handler.ts — streaming/non-streaming multi-turn chat loop
|
|
20
30
|
*/
|
|
21
31
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
22
|
-
import { type
|
|
32
|
+
import { type LoopRunStore, type ProjectLoopConfig } from "@polpo-ai/core";
|
|
23
33
|
import type { ApprovalStore } from "@polpo-ai/core/approval-store";
|
|
24
|
-
import {
|
|
25
|
-
|
|
26
|
-
* Minimal model info needed by the completions route.
|
|
27
|
-
* Matches the shape returned by resolveAgentModel.
|
|
28
|
-
*/
|
|
29
|
-
interface ResolvedModelInfo {
|
|
30
|
-
/** Model identifier (e.g. "claude-sonnet-4.5") — optional for backwards compat. */
|
|
31
|
-
id?: string;
|
|
32
|
-
aiModel: LanguageModel;
|
|
33
|
-
provider: string;
|
|
34
|
-
contextWindow: number;
|
|
35
|
-
maxTokens: number;
|
|
36
|
-
}
|
|
34
|
+
import type { ResolvedModelInfo } from "./completions/agent-step-runner.js";
|
|
35
|
+
export { resumeProjectLoopRun } from "./completions/project-loop-runner.js";
|
|
37
36
|
/**
|
|
38
37
|
* Completion route dependencies.
|
|
39
38
|
*
|
|
@@ -103,11 +102,5 @@ export interface CompletionRouteDeps {
|
|
|
103
102
|
isInteractive: (name: string) => boolean;
|
|
104
103
|
}>;
|
|
105
104
|
}
|
|
106
|
-
export declare function resumeProjectLoopRun(options: {
|
|
107
|
-
deps: CompletionRouteDeps;
|
|
108
|
-
runId: string;
|
|
109
|
-
resolvedBy?: string;
|
|
110
|
-
}): Promise<LoopRunRecord>;
|
|
111
105
|
export declare function completionRoutes(getDeps: () => CompletionRouteDeps, apiKeys?: string[]): OpenAPIHono;
|
|
112
|
-
export {};
|
|
113
106
|
//# sourceMappingURL=completions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completions.d.ts","sourceRoot":"","sources":["../../src/routes/completions.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"completions.d.ts","sourceRoot":"","sources":["../../src/routes/completions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,i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