| 124 | `; |
| 125 | |
| 126 | const createPolicyCode = (input: { |
| 127 | readonly pattern: string; |
| 128 | readonly action: "approve" | "require_approval" | "block"; |
| 129 | }) => ` |
| 130 | const created = await tools.executor.coreTools.policies.create({ |
| 131 | owner: "user", |
| 132 | pattern: ${JSON.stringify(input.pattern)}, |
| 133 | action: ${JSON.stringify(input.action)}, |
| 134 | }); |
| 135 | return JSON.stringify({ ok: created.ok, data: created.ok ? created.data : null, error: created.ok ? null : created.error }); |
| 136 | `; |
| 137 | |
| 138 | const assertCallOk = (value: Record<string, unknown>, label: string) => { |
| 139 | expect(value.ok, `${label}: ${JSON.stringify(value)}`).toBe(true); |