polpo-ai 0.10.3 → 0.10.4
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/README.md +40 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -215,6 +215,43 @@ Use `type: "tool"` for deterministic sandbox/tool actions without an LLM turn, a
|
|
|
215
215
|
|
|
216
216
|
Loop guards use Polpo's safe expression evaluator instead of JavaScript `eval` or `new Function`. Step outputs are available in the shared context bag by step id or `saveAs` path, e.g. `classify.route`, `review.approved`, or `timing.start`. `saveAs` writes context data; it does not create shell variables inside later `bash` commands. The OSS surface validates and round-trips the contract through core types, API schemas, SDK types, `polpo deploy`, and `polpo pull`.
|
|
217
217
|
|
|
218
|
+
You can also keep loops as code and compile them to the same canonical contract:
|
|
219
|
+
|
|
220
|
+
```ts
|
|
221
|
+
// .polpo/loops/router-flow.ts
|
|
222
|
+
import { defineProjectLoop } from "@polpo-ai/core/loop-code";
|
|
223
|
+
|
|
224
|
+
export default defineProjectLoop({
|
|
225
|
+
version: "1",
|
|
226
|
+
kind: "graph",
|
|
227
|
+
name: "router-flow",
|
|
228
|
+
context: "shared",
|
|
229
|
+
start: "classify",
|
|
230
|
+
steps: {
|
|
231
|
+
classify: {
|
|
232
|
+
type: "agent",
|
|
233
|
+
systemPrompt: "Classify the incoming request.",
|
|
234
|
+
tools: ["read"],
|
|
235
|
+
next: "answer",
|
|
236
|
+
},
|
|
237
|
+
answer: {
|
|
238
|
+
type: "agent",
|
|
239
|
+
systemPrompt: "Answer using the selected route.",
|
|
240
|
+
tools: ["write"],
|
|
241
|
+
next: "end",
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
});
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
CLI support:
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
polpo loops validate
|
|
251
|
+
polpo loops compile .polpo/loops/router-flow.ts --out .polpo/loops/router-flow.json
|
|
252
|
+
polpo deploy
|
|
253
|
+
```
|
|
254
|
+
|
|
218
255
|
Agent-direct chat can target a loop explicitly:
|
|
219
256
|
|
|
220
257
|
```json
|
|
@@ -281,7 +318,9 @@ Project loops also support governance fields:
|
|
|
281
318
|
|
|
282
319
|
Lifecycle hooks are deterministic tool actions run by the host runtime at `loop:start`, `step:before`, `model:before`, `tool:before`, `tool:after`, `step:after`, `loop:transition`, and `loop:end`. Hook `when` guards are evaluated against the shared context plus lifecycle payload such as `step.name`, `step.type`, `tool.name`, `tool.input`, and `transition.from/to`. Hook outputs are saved into the context bag with `saveAs`; `onError: "continue"` turns a failed hook into trace-only telemetry, while the default is fail-closed.
|
|
283
320
|
|
|
284
|
-
Policies are evaluated before hook actions at the same lifecycle point. `deny` fails the loop
|
|
321
|
+
Policies are evaluated before hook actions at the same lifecycle point. `deny` fails the loop with `LoopPolicyDeniedError`, `approval` raises `LoopApprovalRequiredError`, and `allow` policies form an allow-list for that lifecycle point when at least one exists. If an allow-list is present and no allow rule matches, the loop is blocked.
|
|
322
|
+
|
|
323
|
+
When the host wires `LoopRunStore`, chat completions create durable loop runs, append every `loop_trace` event, and return `loop_run_id`. When the host also wires `ApprovalStore`, approval policies create a pending approval request and mark the loop run as `awaiting_approval` with `approvalRequestId`. The SDK exposes `getLoopRuns()` and `getLoopRun(id)` for audit/history surfaces. Streaming completions still emit each trace incrementally.
|
|
285
324
|
|
|
286
325
|
## SDK
|
|
287
326
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "polpo-ai",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.4",
|
|
4
4
|
"description": "The open backend for AI agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -66,10 +66,10 @@
|
|
|
66
66
|
"nanoid": "^5.1.2",
|
|
67
67
|
"yaml": "^2.7.0",
|
|
68
68
|
"zod": "^4.3.6",
|
|
69
|
-
"@polpo-ai/core": "0.10.
|
|
70
|
-
"@polpo-ai/
|
|
71
|
-
"@polpo-ai/llm": "0.10.
|
|
72
|
-
"@polpo-ai/
|
|
69
|
+
"@polpo-ai/core": "0.10.4",
|
|
70
|
+
"@polpo-ai/server": "0.10.4",
|
|
71
|
+
"@polpo-ai/llm": "0.10.4",
|
|
72
|
+
"@polpo-ai/vault-crypto": "0.10.4"
|
|
73
73
|
},
|
|
74
74
|
"optionalDependencies": {
|
|
75
75
|
"better-sqlite3": "^12.6.2",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"nodemailer": "^8.0.1",
|
|
78
78
|
"playwright-core": "^1.52.0",
|
|
79
79
|
"postgres": "^3.4.0",
|
|
80
|
-
"@polpo-ai/drizzle": "0.10.
|
|
80
|
+
"@polpo-ai/drizzle": "0.10.4"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@types/better-sqlite3": "^7.6.13",
|