@polpo-ai/sdk 0.3.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/LICENSE +21 -0
- package/dist/client/errors.d.ts +12 -0
- package/dist/client/errors.d.ts.map +1 -0
- package/dist/client/errors.js +25 -0
- package/dist/client/errors.js.map +1 -0
- package/dist/client/event-source.d.ts +29 -0
- package/dist/client/event-source.d.ts.map +1 -0
- package/dist/client/event-source.js +129 -0
- package/dist/client/event-source.js.map +1 -0
- package/dist/client/index.d.ts +7 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +4 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/polpo-client.d.ts +300 -0
- package/dist/client/polpo-client.d.ts.map +1 -0
- package/dist/client/polpo-client.js +602 -0
- package/dist/client/polpo-client.js.map +1 -0
- package/dist/client/types.d.ts +1160 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/types.js +7 -0
- package/dist/client/types.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/store/event-reducer.d.ts +8 -0
- package/dist/store/event-reducer.d.ts.map +1 -0
- package/dist/store/event-reducer.js +301 -0
- package/dist/store/event-reducer.js.map +1 -0
- package/dist/store/index.d.ts +6 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +4 -0
- package/dist/store/index.js.map +1 -0
- package/dist/store/polpo-store.d.ts +31 -0
- package/dist/store/polpo-store.d.ts.map +1 -0
- package/dist/store/polpo-store.js +136 -0
- package/dist/store/polpo-store.js.map +1 -0
- package/dist/store/selectors.d.ts +18 -0
- package/dist/store/selectors.d.ts.map +1 -0
- package/dist/store/selectors.js +91 -0
- package/dist/store/selectors.js.map +1 -0
- package/dist/store/types.d.ts +51 -0
- package/dist/store/types.d.ts.map +1 -0
- package/dist/store/types.js +2 -0
- package/dist/store/types.js.map +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,1160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenPolpo API types — mirrors the server contract.
|
|
3
|
+
* Intentionally decoupled from @polpo-ai/core to avoid pulling
|
|
4
|
+
* server-side dependencies (blessed, sqlite, etc.) into the client bundle.
|
|
5
|
+
*/
|
|
6
|
+
export type TaskStatus = "draft" | "pending" | "awaiting_approval" | "assigned" | "in_progress" | "review" | "done" | "failed";
|
|
7
|
+
export interface EvalDimension {
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
weight: number;
|
|
11
|
+
rubric?: Record<number, string>;
|
|
12
|
+
}
|
|
13
|
+
export interface DimensionScoreEvidence {
|
|
14
|
+
file: string;
|
|
15
|
+
line: number;
|
|
16
|
+
note: string;
|
|
17
|
+
}
|
|
18
|
+
export interface DimensionScore {
|
|
19
|
+
dimension: string;
|
|
20
|
+
score: number;
|
|
21
|
+
reasoning: string;
|
|
22
|
+
weight: number;
|
|
23
|
+
evidence?: DimensionScoreEvidence[];
|
|
24
|
+
}
|
|
25
|
+
export interface TaskExpectation {
|
|
26
|
+
type: "test" | "file_exists" | "script" | "llm_review";
|
|
27
|
+
command?: string;
|
|
28
|
+
paths?: string[];
|
|
29
|
+
criteria?: string;
|
|
30
|
+
dimensions?: EvalDimension[];
|
|
31
|
+
threshold?: number;
|
|
32
|
+
confidence?: "firm" | "estimated";
|
|
33
|
+
}
|
|
34
|
+
export interface TaskMetric {
|
|
35
|
+
name: string;
|
|
36
|
+
command: string;
|
|
37
|
+
threshold: number;
|
|
38
|
+
}
|
|
39
|
+
export interface RetryPolicy {
|
|
40
|
+
escalateAfter?: number;
|
|
41
|
+
fallbackAgent?: string;
|
|
42
|
+
escalateModel?: string;
|
|
43
|
+
}
|
|
44
|
+
export type TaskPhase = "execution" | "review" | "fix" | "clarification";
|
|
45
|
+
export type OutcomeType = "file" | "text" | "url" | "json" | "media";
|
|
46
|
+
export interface TaskOutcome {
|
|
47
|
+
id: string;
|
|
48
|
+
type: OutcomeType;
|
|
49
|
+
label: string;
|
|
50
|
+
path?: string;
|
|
51
|
+
mimeType?: string;
|
|
52
|
+
size?: number;
|
|
53
|
+
text?: string;
|
|
54
|
+
url?: string;
|
|
55
|
+
data?: unknown;
|
|
56
|
+
producedBy?: string;
|
|
57
|
+
producedAt: string;
|
|
58
|
+
tags?: string[];
|
|
59
|
+
}
|
|
60
|
+
export interface ExpectedOutcome {
|
|
61
|
+
type: OutcomeType;
|
|
62
|
+
label: string;
|
|
63
|
+
description?: string;
|
|
64
|
+
path?: string;
|
|
65
|
+
mimeType?: string;
|
|
66
|
+
required?: boolean;
|
|
67
|
+
tags?: string[];
|
|
68
|
+
}
|
|
69
|
+
export interface Task {
|
|
70
|
+
id: string;
|
|
71
|
+
title: string;
|
|
72
|
+
description: string;
|
|
73
|
+
assignTo: string;
|
|
74
|
+
group?: string;
|
|
75
|
+
dependsOn: string[];
|
|
76
|
+
status: TaskStatus;
|
|
77
|
+
expectations: TaskExpectation[];
|
|
78
|
+
metrics: TaskMetric[];
|
|
79
|
+
retries: number;
|
|
80
|
+
maxRetries: number;
|
|
81
|
+
maxDuration?: number;
|
|
82
|
+
retryPolicy?: RetryPolicy;
|
|
83
|
+
result?: TaskResult;
|
|
84
|
+
phase?: TaskPhase;
|
|
85
|
+
fixAttempts?: number;
|
|
86
|
+
questionRounds?: number;
|
|
87
|
+
resolutionAttempts?: number;
|
|
88
|
+
originalDescription?: string;
|
|
89
|
+
sessionId?: string;
|
|
90
|
+
/** Absolute deadline (ISO timestamp). */
|
|
91
|
+
deadline?: string;
|
|
92
|
+
/** Priority weight for quality scoring. Default: 1.0 */
|
|
93
|
+
priority?: number;
|
|
94
|
+
expectedOutcomes?: ExpectedOutcome[];
|
|
95
|
+
outcomes?: TaskOutcome[];
|
|
96
|
+
/** Number of approval revision rounds. */
|
|
97
|
+
revisionCount?: number;
|
|
98
|
+
/** Scoped notification rules for this task. */
|
|
99
|
+
notifications?: ScopedNotificationRules;
|
|
100
|
+
/** Whether this task produces irreversible side effects. Blocks automatic retry/fix. */
|
|
101
|
+
sideEffects?: boolean;
|
|
102
|
+
createdAt: string;
|
|
103
|
+
updatedAt: string;
|
|
104
|
+
}
|
|
105
|
+
export interface TaskResult {
|
|
106
|
+
exitCode: number;
|
|
107
|
+
stdout: string;
|
|
108
|
+
stderr: string;
|
|
109
|
+
duration: number;
|
|
110
|
+
assessment?: AssessmentResult;
|
|
111
|
+
/** All previous assessments (oldest first). Current assessment is always in `assessment`. */
|
|
112
|
+
assessmentHistory?: AssessmentResult[];
|
|
113
|
+
}
|
|
114
|
+
/** Stdio-based MCP server — spawns a child process */
|
|
115
|
+
export interface McpStdioServerConfig {
|
|
116
|
+
type?: "stdio";
|
|
117
|
+
command: string;
|
|
118
|
+
args?: string[];
|
|
119
|
+
env?: Record<string, string>;
|
|
120
|
+
}
|
|
121
|
+
/** SSE-based MCP server (legacy, prefer HTTP) */
|
|
122
|
+
export interface McpSseServerConfig {
|
|
123
|
+
type: "sse";
|
|
124
|
+
url: string;
|
|
125
|
+
headers?: Record<string, string>;
|
|
126
|
+
}
|
|
127
|
+
/** HTTP-based MCP server (streamable HTTP, recommended for remote) */
|
|
128
|
+
export interface McpHttpServerConfig {
|
|
129
|
+
type: "http";
|
|
130
|
+
url: string;
|
|
131
|
+
headers?: Record<string, string>;
|
|
132
|
+
}
|
|
133
|
+
/** Union of all supported MCP server configs */
|
|
134
|
+
export type McpServerConfig = McpStdioServerConfig | McpSseServerConfig | McpHttpServerConfig;
|
|
135
|
+
/** Agent identity — who this agent is and how it behaves */
|
|
136
|
+
/** A structured responsibility area */
|
|
137
|
+
export interface AgentResponsibility {
|
|
138
|
+
area: string;
|
|
139
|
+
description: string;
|
|
140
|
+
priority?: "critical" | "high" | "medium" | "low";
|
|
141
|
+
}
|
|
142
|
+
export interface AgentIdentity {
|
|
143
|
+
displayName?: string;
|
|
144
|
+
title?: string;
|
|
145
|
+
company?: string;
|
|
146
|
+
email?: string;
|
|
147
|
+
bio?: string;
|
|
148
|
+
timezone?: string;
|
|
149
|
+
/** Avatar image path relative to project root, served via /api/v1/files/read?path=<avatar> */
|
|
150
|
+
avatar?: string;
|
|
151
|
+
/** Responsibilities — simple strings or structured objects with area/description/priority */
|
|
152
|
+
responsibilities?: (string | AgentResponsibility)[];
|
|
153
|
+
/** Communication tone — HOW the agent communicates */
|
|
154
|
+
tone?: string;
|
|
155
|
+
/** Personality traits — WHO the agent IS as a persona */
|
|
156
|
+
personality?: string;
|
|
157
|
+
/** Social & web accounts — keys are platform names, values are handles/URLs */
|
|
158
|
+
socials?: Record<string, string>;
|
|
159
|
+
}
|
|
160
|
+
export interface AgentConfig {
|
|
161
|
+
name: string;
|
|
162
|
+
/** ISO timestamp of when this agent was created / added to the team. */
|
|
163
|
+
createdAt?: string;
|
|
164
|
+
role?: string;
|
|
165
|
+
model?: string;
|
|
166
|
+
allowedTools?: string[];
|
|
167
|
+
/** MCP servers to connect to. */
|
|
168
|
+
mcpServers?: Record<string, McpServerConfig>;
|
|
169
|
+
/** Filesystem sandbox — directories the agent is allowed to access.
|
|
170
|
+
* When omitted, defaults to the project workDir. */
|
|
171
|
+
allowedPaths?: string[];
|
|
172
|
+
/** Agent's identity — persona, responsibilities, communication style */
|
|
173
|
+
identity?: AgentIdentity;
|
|
174
|
+
/** Agent this one reports to — org chart hierarchy for escalation */
|
|
175
|
+
reportsTo?: string;
|
|
176
|
+
systemPrompt?: string;
|
|
177
|
+
skills?: string[];
|
|
178
|
+
maxTurns?: number;
|
|
179
|
+
/** Max concurrent tasks for this agent. Default: unlimited. */
|
|
180
|
+
maxConcurrency?: number;
|
|
181
|
+
/** Reasoning / deep thinking level for this agent's LLM calls. */
|
|
182
|
+
reasoning?: ReasoningLevel;
|
|
183
|
+
volatile?: boolean;
|
|
184
|
+
missionGroup?: string;
|
|
185
|
+
/** Browser profile name for persistent context (cookies, auth). Used with agent-browser --profile. */
|
|
186
|
+
browserProfile?: string;
|
|
187
|
+
/** Allowed recipient email domains for email_send. Overrides global setting. */
|
|
188
|
+
emailAllowedDomains?: string[];
|
|
189
|
+
}
|
|
190
|
+
export interface AgentActivity {
|
|
191
|
+
lastTool?: string;
|
|
192
|
+
lastFile?: string;
|
|
193
|
+
filesCreated: string[];
|
|
194
|
+
filesEdited: string[];
|
|
195
|
+
toolCalls: number;
|
|
196
|
+
totalTokens: number;
|
|
197
|
+
lastUpdate: string;
|
|
198
|
+
summary?: string;
|
|
199
|
+
sessionId?: string;
|
|
200
|
+
}
|
|
201
|
+
export interface AgentProcess {
|
|
202
|
+
agentName: string;
|
|
203
|
+
pid: number;
|
|
204
|
+
taskId: string;
|
|
205
|
+
startedAt: string;
|
|
206
|
+
alive: boolean;
|
|
207
|
+
activity: AgentActivity;
|
|
208
|
+
}
|
|
209
|
+
export interface Team {
|
|
210
|
+
name: string;
|
|
211
|
+
description?: string;
|
|
212
|
+
agents: AgentConfig[];
|
|
213
|
+
}
|
|
214
|
+
/** Serializable representation of a single message in the reviewer's conversation */
|
|
215
|
+
export interface ReviewerMessage {
|
|
216
|
+
role: "user" | "assistant" | "toolResult";
|
|
217
|
+
/** For user/assistant: text content. For toolResult: the tool output text. */
|
|
218
|
+
content: string;
|
|
219
|
+
/** Tool calls made by the assistant (if role === "assistant") */
|
|
220
|
+
toolCalls?: {
|
|
221
|
+
id: string;
|
|
222
|
+
name: string;
|
|
223
|
+
arguments: Record<string, unknown>;
|
|
224
|
+
}[];
|
|
225
|
+
/** For toolResult messages */
|
|
226
|
+
toolCallId?: string;
|
|
227
|
+
toolName?: string;
|
|
228
|
+
isError?: boolean;
|
|
229
|
+
timestamp: number;
|
|
230
|
+
}
|
|
231
|
+
/** Phase 1 exploration trace from a single reviewer */
|
|
232
|
+
export interface ReviewerExploration {
|
|
233
|
+
/** Full analysis text produced by the reviewer during exploration */
|
|
234
|
+
analysis: string;
|
|
235
|
+
/** Files read by the reviewer during exploration */
|
|
236
|
+
filesRead: string[];
|
|
237
|
+
/** Complete conversation (user prompts, assistant responses, tool calls & results) */
|
|
238
|
+
messages: ReviewerMessage[];
|
|
239
|
+
}
|
|
240
|
+
/** Individual reviewer result from llm_review multi-evaluator consensus */
|
|
241
|
+
export interface ReviewerResult {
|
|
242
|
+
index: number;
|
|
243
|
+
scores: {
|
|
244
|
+
dimension: string;
|
|
245
|
+
score: number;
|
|
246
|
+
reasoning: string;
|
|
247
|
+
evidence?: {
|
|
248
|
+
file: string;
|
|
249
|
+
line: number;
|
|
250
|
+
note: string;
|
|
251
|
+
}[];
|
|
252
|
+
}[];
|
|
253
|
+
summary: string;
|
|
254
|
+
globalScore: number;
|
|
255
|
+
/** Phase 1 exploration trace (analysis, files read, full conversation) */
|
|
256
|
+
exploration?: ReviewerExploration;
|
|
257
|
+
/** Errors from scoring strategy attempts (Phase 2 fallback chain) */
|
|
258
|
+
scoringAttemptErrors?: string[];
|
|
259
|
+
}
|
|
260
|
+
export interface CheckResult {
|
|
261
|
+
type: TaskExpectation["type"];
|
|
262
|
+
passed: boolean;
|
|
263
|
+
message: string;
|
|
264
|
+
details?: string;
|
|
265
|
+
scores?: DimensionScore[];
|
|
266
|
+
globalScore?: number;
|
|
267
|
+
/** Individual reviewer results (llm_review only) — shows how each reviewer voted */
|
|
268
|
+
reviewers?: ReviewerResult[];
|
|
269
|
+
}
|
|
270
|
+
export interface MetricResult {
|
|
271
|
+
name: string;
|
|
272
|
+
value: number;
|
|
273
|
+
threshold: number;
|
|
274
|
+
passed: boolean;
|
|
275
|
+
}
|
|
276
|
+
export type AssessmentTrigger = "initial" | "reassess" | "fix" | "retry" | "auto-correct" | "judge";
|
|
277
|
+
export interface AssessmentResult {
|
|
278
|
+
passed: boolean;
|
|
279
|
+
checks: CheckResult[];
|
|
280
|
+
metrics: MetricResult[];
|
|
281
|
+
llmReview?: string;
|
|
282
|
+
scores?: DimensionScore[];
|
|
283
|
+
globalScore?: number;
|
|
284
|
+
timestamp: string;
|
|
285
|
+
/** What triggered this assessment. */
|
|
286
|
+
trigger?: AssessmentTrigger;
|
|
287
|
+
}
|
|
288
|
+
export type MissionStatus = "draft" | "scheduled" | "recurring" | "active" | "paused" | "completed" | "failed" | "cancelled";
|
|
289
|
+
export interface Mission {
|
|
290
|
+
id: string;
|
|
291
|
+
name: string;
|
|
292
|
+
data: string;
|
|
293
|
+
prompt?: string;
|
|
294
|
+
status: MissionStatus;
|
|
295
|
+
/** Absolute deadline (ISO timestamp). */
|
|
296
|
+
deadline?: string;
|
|
297
|
+
/** Cron expression or ISO timestamp for scheduled execution. */
|
|
298
|
+
schedule?: string;
|
|
299
|
+
/** End date for recurring schedules (ISO timestamp). After this date the schedule stops. */
|
|
300
|
+
endDate?: string;
|
|
301
|
+
/** Minimum average score for the mission to pass. */
|
|
302
|
+
qualityThreshold?: number;
|
|
303
|
+
/** Mission-level scoped notification rules. */
|
|
304
|
+
notifications?: ScopedNotificationRules;
|
|
305
|
+
/** How many times this mission has been executed. */
|
|
306
|
+
executionCount?: number;
|
|
307
|
+
createdAt: string;
|
|
308
|
+
updatedAt: string;
|
|
309
|
+
}
|
|
310
|
+
/** Checkpoint defined within a mission — planned stopping point for human review.
|
|
311
|
+
* Pauses the mission when afterTasks complete; blocked tasks wait until resumed. */
|
|
312
|
+
export interface MissionCheckpoint {
|
|
313
|
+
/** Checkpoint name (unique within the mission, used in events and resume calls). */
|
|
314
|
+
name: string;
|
|
315
|
+
/** Task titles that must all complete before this checkpoint triggers. */
|
|
316
|
+
afterTasks: string[];
|
|
317
|
+
/** Task titles that are blocked until the checkpoint is resumed. */
|
|
318
|
+
blocksTasks: string[];
|
|
319
|
+
/** Optional message shown when the checkpoint activates. */
|
|
320
|
+
message?: string;
|
|
321
|
+
/** Notification channels to alert when the checkpoint is reached. */
|
|
322
|
+
notifyChannels?: string[];
|
|
323
|
+
}
|
|
324
|
+
/** Delay defined within a mission — timed wait between task groups.
|
|
325
|
+
* Unlike checkpoints (which pause until a human resumes), delays automatically
|
|
326
|
+
* resume after a specified duration elapses. */
|
|
327
|
+
export interface MissionDelay {
|
|
328
|
+
/** Delay name (unique within the mission). */
|
|
329
|
+
name: string;
|
|
330
|
+
/** Task titles that must all complete before the delay timer starts. */
|
|
331
|
+
afterTasks: string[];
|
|
332
|
+
/** Task titles that are blocked until the delay timer expires. */
|
|
333
|
+
blocksTasks: string[];
|
|
334
|
+
/** ISO 8601 duration (e.g. "PT2H" = 2 hours, "PT30M" = 30 minutes, "P1D" = 1 day). */
|
|
335
|
+
duration: string;
|
|
336
|
+
/** Optional message shown when the delay starts. */
|
|
337
|
+
message?: string;
|
|
338
|
+
/** Notification channels to alert when the delay starts / expires. */
|
|
339
|
+
notifyChannels?: string[];
|
|
340
|
+
}
|
|
341
|
+
/** Runtime state of an active delay (timer started, waiting to expire). */
|
|
342
|
+
export interface ActiveDelay {
|
|
343
|
+
/** Mission group name. */
|
|
344
|
+
group: string;
|
|
345
|
+
/** Delay name. */
|
|
346
|
+
delayName: string;
|
|
347
|
+
/** Full delay definition. */
|
|
348
|
+
delay: MissionDelay;
|
|
349
|
+
/** ISO timestamp when the delay timer started. */
|
|
350
|
+
startedAt: string;
|
|
351
|
+
/** ISO timestamp when the delay will expire. */
|
|
352
|
+
expiresAt: string;
|
|
353
|
+
}
|
|
354
|
+
/** Quality gate defined within a mission — automatic score-based blocking between task phases. */
|
|
355
|
+
export interface MissionQualityGate {
|
|
356
|
+
/** Gate name (unique within the mission). */
|
|
357
|
+
name: string;
|
|
358
|
+
/** Task titles whose assessment scores are evaluated. */
|
|
359
|
+
afterTasks: string[];
|
|
360
|
+
/** Task titles blocked until the gate passes. */
|
|
361
|
+
blocksTasks: string[];
|
|
362
|
+
/** Minimum average score (1-5) of afterTasks required to pass. */
|
|
363
|
+
minScore?: number;
|
|
364
|
+
/** If true, all afterTasks must be "done" (not "failed") to pass. */
|
|
365
|
+
requireAllPassed?: boolean;
|
|
366
|
+
/** Custom condition expression. */
|
|
367
|
+
condition?: string;
|
|
368
|
+
/** Notification channels for pass/fail events. */
|
|
369
|
+
notifyChannels?: string[];
|
|
370
|
+
}
|
|
371
|
+
export interface MissionReport {
|
|
372
|
+
missionId: string;
|
|
373
|
+
group: string;
|
|
374
|
+
allPassed: boolean;
|
|
375
|
+
totalDuration: number;
|
|
376
|
+
tasks: {
|
|
377
|
+
title: string;
|
|
378
|
+
status: "done" | "failed";
|
|
379
|
+
duration: number;
|
|
380
|
+
score?: number;
|
|
381
|
+
filesCreated: string[];
|
|
382
|
+
filesEdited: string[];
|
|
383
|
+
outcomes?: TaskOutcome[];
|
|
384
|
+
}[];
|
|
385
|
+
filesCreated: string[];
|
|
386
|
+
filesEdited: string[];
|
|
387
|
+
outcomes?: TaskOutcome[];
|
|
388
|
+
avgScore?: number;
|
|
389
|
+
}
|
|
390
|
+
export type NotificationSeverity = "info" | "warning" | "critical";
|
|
391
|
+
export type NotificationChannelType = "slack" | "email" | "telegram" | "whatsapp" | "webhook";
|
|
392
|
+
export type NotificationStatus = "sent" | "failed";
|
|
393
|
+
export type DmPolicy = "pairing" | "allowlist" | "open" | "disabled";
|
|
394
|
+
export interface ChannelGatewayConfig {
|
|
395
|
+
dmPolicy?: DmPolicy;
|
|
396
|
+
allowFrom?: string[];
|
|
397
|
+
enableInbound?: boolean;
|
|
398
|
+
sessionIdleMinutes?: number;
|
|
399
|
+
}
|
|
400
|
+
export interface NotificationChannelConfig {
|
|
401
|
+
type: NotificationChannelType;
|
|
402
|
+
webhookUrl?: string;
|
|
403
|
+
to?: string[];
|
|
404
|
+
provider?: string;
|
|
405
|
+
apiKey?: string;
|
|
406
|
+
botToken?: string;
|
|
407
|
+
chatId?: string;
|
|
408
|
+
profileDir?: string;
|
|
409
|
+
url?: string;
|
|
410
|
+
headers?: Record<string, string>;
|
|
411
|
+
host?: string;
|
|
412
|
+
port?: number;
|
|
413
|
+
from?: string;
|
|
414
|
+
gateway?: ChannelGatewayConfig;
|
|
415
|
+
}
|
|
416
|
+
export interface NotificationRule {
|
|
417
|
+
id: string;
|
|
418
|
+
name: string;
|
|
419
|
+
events: string[];
|
|
420
|
+
condition?: unknown;
|
|
421
|
+
channels: string[];
|
|
422
|
+
severity?: NotificationSeverity;
|
|
423
|
+
template?: string;
|
|
424
|
+
cooldownMs?: number;
|
|
425
|
+
includeOutcomes?: boolean;
|
|
426
|
+
outcomeFilter?: OutcomeType[];
|
|
427
|
+
maxAttachmentSize?: number;
|
|
428
|
+
}
|
|
429
|
+
export interface ScopedNotificationRules {
|
|
430
|
+
rules: NotificationRule[];
|
|
431
|
+
/** If true, rules are added on top of parent scope. If false (default), they replace. */
|
|
432
|
+
inherit?: boolean;
|
|
433
|
+
}
|
|
434
|
+
export interface NotificationRecord {
|
|
435
|
+
id: string;
|
|
436
|
+
timestamp: string;
|
|
437
|
+
ruleId: string;
|
|
438
|
+
ruleName: string;
|
|
439
|
+
channel: string;
|
|
440
|
+
channelType: string;
|
|
441
|
+
status: NotificationStatus;
|
|
442
|
+
error?: string;
|
|
443
|
+
title: string;
|
|
444
|
+
body: string;
|
|
445
|
+
severity: NotificationSeverity;
|
|
446
|
+
sourceEvent: string;
|
|
447
|
+
attachmentCount: number;
|
|
448
|
+
attachmentTypes?: OutcomeType[];
|
|
449
|
+
}
|
|
450
|
+
export interface NotificationStats {
|
|
451
|
+
total: number;
|
|
452
|
+
sent: number;
|
|
453
|
+
failed: number;
|
|
454
|
+
}
|
|
455
|
+
export interface SendNotificationRequest {
|
|
456
|
+
channel: string;
|
|
457
|
+
title: string;
|
|
458
|
+
body: string;
|
|
459
|
+
severity?: NotificationSeverity;
|
|
460
|
+
delayMs?: number;
|
|
461
|
+
}
|
|
462
|
+
export interface SendNotificationResult {
|
|
463
|
+
id: string;
|
|
464
|
+
scheduledAt: string;
|
|
465
|
+
firesAt: string;
|
|
466
|
+
}
|
|
467
|
+
export type ApprovalGateHandler = "auto" | "human";
|
|
468
|
+
export type ApprovalStatus = "pending" | "approved" | "rejected" | "timeout";
|
|
469
|
+
export interface ApprovalRequest {
|
|
470
|
+
id: string;
|
|
471
|
+
gateId: string;
|
|
472
|
+
gateName: string;
|
|
473
|
+
taskId?: string;
|
|
474
|
+
missionId?: string;
|
|
475
|
+
status: ApprovalStatus;
|
|
476
|
+
payload: unknown;
|
|
477
|
+
requestedAt: string;
|
|
478
|
+
resolvedAt?: string;
|
|
479
|
+
resolvedBy?: string;
|
|
480
|
+
note?: string;
|
|
481
|
+
}
|
|
482
|
+
export interface ScheduleEntry {
|
|
483
|
+
id: string;
|
|
484
|
+
missionId: string;
|
|
485
|
+
expression: string;
|
|
486
|
+
recurring: boolean;
|
|
487
|
+
enabled: boolean;
|
|
488
|
+
lastRunAt?: string;
|
|
489
|
+
nextRunAt?: string;
|
|
490
|
+
deadlineOffsetMs?: number;
|
|
491
|
+
createdAt: string;
|
|
492
|
+
}
|
|
493
|
+
export interface QualityMetrics {
|
|
494
|
+
entityId: string;
|
|
495
|
+
entityType: "task" | "agent" | "mission";
|
|
496
|
+
totalAssessments: number;
|
|
497
|
+
passedAssessments: number;
|
|
498
|
+
avgScore?: number;
|
|
499
|
+
minScore?: number;
|
|
500
|
+
maxScore?: number;
|
|
501
|
+
dimensionScores: Record<string, number>;
|
|
502
|
+
totalRetries: number;
|
|
503
|
+
totalFixes: number;
|
|
504
|
+
deadlinesMet: number;
|
|
505
|
+
deadlinesMissed: number;
|
|
506
|
+
updatedAt: string;
|
|
507
|
+
}
|
|
508
|
+
export interface PlaybookParameter {
|
|
509
|
+
/** Parameter name — used as {{name}} in the mission playbook. */
|
|
510
|
+
name: string;
|
|
511
|
+
/** Human-readable description. */
|
|
512
|
+
description: string;
|
|
513
|
+
/** Value type. Default: "string". */
|
|
514
|
+
type?: "string" | "number" | "boolean";
|
|
515
|
+
/** Whether the parameter must be provided. Default: false. */
|
|
516
|
+
required?: boolean;
|
|
517
|
+
/** Default value when not provided. */
|
|
518
|
+
default?: string | number | boolean;
|
|
519
|
+
/** Allowed values (enum constraint). */
|
|
520
|
+
enum?: (string | number)[];
|
|
521
|
+
}
|
|
522
|
+
/** Lightweight playbook metadata (no mission body). */
|
|
523
|
+
export interface PlaybookInfo {
|
|
524
|
+
name: string;
|
|
525
|
+
description: string;
|
|
526
|
+
parameters: PlaybookParameter[];
|
|
527
|
+
/** Absolute path to the playbook directory. */
|
|
528
|
+
path: string;
|
|
529
|
+
}
|
|
530
|
+
/** Full playbook definition including the mission body. */
|
|
531
|
+
export interface PlaybookDefinition {
|
|
532
|
+
name: string;
|
|
533
|
+
description: string;
|
|
534
|
+
mission: Record<string, unknown>;
|
|
535
|
+
parameters?: PlaybookParameter[];
|
|
536
|
+
}
|
|
537
|
+
/** Result of running a playbook. */
|
|
538
|
+
export interface PlaybookRunResult {
|
|
539
|
+
mission: Mission;
|
|
540
|
+
tasks: number;
|
|
541
|
+
group: string;
|
|
542
|
+
/** Non-blocking validation warnings (e.g. unknown parameters). */
|
|
543
|
+
warnings?: string[];
|
|
544
|
+
}
|
|
545
|
+
/** @deprecated Use PlaybookParameter instead. */
|
|
546
|
+
export type TemplateParameter = PlaybookParameter;
|
|
547
|
+
/** @deprecated Use PlaybookInfo instead. */
|
|
548
|
+
export type TemplateInfo = PlaybookInfo;
|
|
549
|
+
/** @deprecated Use PlaybookDefinition instead. */
|
|
550
|
+
export type TemplateDefinition = PlaybookDefinition;
|
|
551
|
+
/** @deprecated Use PlaybookRunResult instead. */
|
|
552
|
+
export type TemplateRunResult = PlaybookRunResult;
|
|
553
|
+
/** Reasoning level for LLM calls. */
|
|
554
|
+
export type ReasoningLevel = "off" | "minimal" | "low" | "medium" | "high" | "xhigh";
|
|
555
|
+
/** Primary model with ordered fallbacks. */
|
|
556
|
+
export interface ModelConfig {
|
|
557
|
+
/** Primary model spec (e.g. "anthropic:claude-opus-4-6"). */
|
|
558
|
+
primary?: string;
|
|
559
|
+
/** Ordered fallback models — tried when primary fails. */
|
|
560
|
+
fallbacks?: string[];
|
|
561
|
+
}
|
|
562
|
+
/** Model allowlist entry with optional alias and parameter overrides. */
|
|
563
|
+
export interface ModelAllowlistEntry {
|
|
564
|
+
/** Display alias for this model (e.g. "Sonnet", "GPT"). */
|
|
565
|
+
alias?: string;
|
|
566
|
+
/** Per-model parameter overrides. */
|
|
567
|
+
params?: Record<string, unknown>;
|
|
568
|
+
}
|
|
569
|
+
/** Custom model definition for non-catalog providers (Ollama, vLLM, LM Studio, etc.) */
|
|
570
|
+
export interface CustomModelDef {
|
|
571
|
+
/** Model ID used in API calls. */
|
|
572
|
+
id: string;
|
|
573
|
+
/** Human-readable name. */
|
|
574
|
+
name: string;
|
|
575
|
+
/** Whether the model supports extended thinking / reasoning. */
|
|
576
|
+
reasoning?: boolean;
|
|
577
|
+
/** Supported input types. Default: ["text"] */
|
|
578
|
+
input?: ("text" | "image")[];
|
|
579
|
+
/** Cost per million tokens. Default: all zeros (free/local). */
|
|
580
|
+
cost?: {
|
|
581
|
+
input: number;
|
|
582
|
+
output: number;
|
|
583
|
+
cacheRead: number;
|
|
584
|
+
cacheWrite: number;
|
|
585
|
+
};
|
|
586
|
+
/** Context window size in tokens. Default: 200000 */
|
|
587
|
+
contextWindow?: number;
|
|
588
|
+
/** Max output tokens. Default: 8192 */
|
|
589
|
+
maxTokens?: number;
|
|
590
|
+
}
|
|
591
|
+
export interface PolpoSettings {
|
|
592
|
+
maxRetries: number;
|
|
593
|
+
workDir: string;
|
|
594
|
+
logLevel: "quiet" | "normal" | "verbose";
|
|
595
|
+
taskTimeout?: number;
|
|
596
|
+
staleThreshold?: number;
|
|
597
|
+
defaultRetryPolicy?: RetryPolicy;
|
|
598
|
+
enableVolatileTeams?: boolean;
|
|
599
|
+
volatileCleanup?: "on_complete" | "manual";
|
|
600
|
+
maxFixAttempts?: number;
|
|
601
|
+
maxQuestionRounds?: number;
|
|
602
|
+
maxResolutionAttempts?: number;
|
|
603
|
+
autoCorrectExpectations?: boolean;
|
|
604
|
+
/** Skills to load into the orchestrator's system prompt. Resolved against the orchestrator skill pool. */
|
|
605
|
+
orchestratorSkills?: string[];
|
|
606
|
+
/** Model for orchestrator LLM calls. Can be a string or a ModelConfig with fallbacks. */
|
|
607
|
+
orchestratorModel?: string | ModelConfig;
|
|
608
|
+
imageModel?: string;
|
|
609
|
+
modelAllowlist?: Record<string, ModelAllowlistEntry>;
|
|
610
|
+
/** Global reasoning / deep thinking level. */
|
|
611
|
+
reasoning?: ReasoningLevel;
|
|
612
|
+
storage?: "file" | "sqlite";
|
|
613
|
+
maxAssessmentRetries?: number;
|
|
614
|
+
maxConcurrency?: number;
|
|
615
|
+
approvalGates?: Array<Record<string, unknown>>;
|
|
616
|
+
notifications?: Record<string, unknown>;
|
|
617
|
+
escalationPolicy?: Record<string, unknown>;
|
|
618
|
+
sla?: Record<string, unknown>;
|
|
619
|
+
enableScheduler?: boolean;
|
|
620
|
+
defaultQualityThreshold?: number;
|
|
621
|
+
emailAllowedDomains?: string[];
|
|
622
|
+
mcpToolAllowlist?: Record<string, string[]>;
|
|
623
|
+
}
|
|
624
|
+
export interface ProviderConfig {
|
|
625
|
+
baseUrl?: string;
|
|
626
|
+
/** API compatibility mode for custom endpoints. */
|
|
627
|
+
api?: "openai-completions" | "openai-responses" | "anthropic-messages";
|
|
628
|
+
/** Custom model definitions for this provider. */
|
|
629
|
+
models?: CustomModelDef[];
|
|
630
|
+
}
|
|
631
|
+
export interface PolpoConfig {
|
|
632
|
+
version: string;
|
|
633
|
+
project: string;
|
|
634
|
+
teams: Team[];
|
|
635
|
+
tasks: Omit<Task, "status" | "retries" | "result" | "createdAt" | "updatedAt">[];
|
|
636
|
+
settings: PolpoSettings;
|
|
637
|
+
providers?: Record<string, ProviderConfig>;
|
|
638
|
+
}
|
|
639
|
+
export interface PolpoState {
|
|
640
|
+
project: string;
|
|
641
|
+
teams: Team[];
|
|
642
|
+
tasks: Task[];
|
|
643
|
+
processes: AgentProcess[];
|
|
644
|
+
startedAt?: string;
|
|
645
|
+
completedAt?: string;
|
|
646
|
+
}
|
|
647
|
+
export interface AddTeamRequest {
|
|
648
|
+
name: string;
|
|
649
|
+
description?: string;
|
|
650
|
+
}
|
|
651
|
+
export type ErrorCode = "NOT_FOUND" | "INVALID_STATE" | "VALIDATION_ERROR" | "AUTH_REQUIRED" | "FORBIDDEN" | "CONFLICT" | "INTERNAL_ERROR";
|
|
652
|
+
export interface ApiResponse<T> {
|
|
653
|
+
ok: true;
|
|
654
|
+
data: T;
|
|
655
|
+
}
|
|
656
|
+
export interface ApiError {
|
|
657
|
+
ok: false;
|
|
658
|
+
error: string;
|
|
659
|
+
code: ErrorCode;
|
|
660
|
+
details?: unknown;
|
|
661
|
+
}
|
|
662
|
+
export type ApiResult<T> = ApiResponse<T> | ApiError;
|
|
663
|
+
export interface CreateTaskRequest {
|
|
664
|
+
title: string;
|
|
665
|
+
description: string;
|
|
666
|
+
assignTo: string;
|
|
667
|
+
/** Create task as draft (won't be picked up until queued). Default: false. */
|
|
668
|
+
draft?: boolean;
|
|
669
|
+
expectations?: TaskExpectation[];
|
|
670
|
+
expectedOutcomes?: ExpectedOutcome[];
|
|
671
|
+
dependsOn?: string[];
|
|
672
|
+
group?: string;
|
|
673
|
+
maxDuration?: number;
|
|
674
|
+
retryPolicy?: RetryPolicy;
|
|
675
|
+
notifications?: ScopedNotificationRules;
|
|
676
|
+
}
|
|
677
|
+
export interface UpdateTaskRequest {
|
|
678
|
+
description?: string;
|
|
679
|
+
assignTo?: string;
|
|
680
|
+
status?: TaskStatus;
|
|
681
|
+
expectations?: TaskExpectation[];
|
|
682
|
+
}
|
|
683
|
+
export interface CreateMissionRequest {
|
|
684
|
+
data: string;
|
|
685
|
+
prompt?: string;
|
|
686
|
+
name?: string;
|
|
687
|
+
status?: MissionStatus;
|
|
688
|
+
notifications?: ScopedNotificationRules;
|
|
689
|
+
}
|
|
690
|
+
export interface UpdateMissionRequest {
|
|
691
|
+
data?: string;
|
|
692
|
+
status?: MissionStatus;
|
|
693
|
+
name?: string;
|
|
694
|
+
}
|
|
695
|
+
export interface AddMissionTaskRequest {
|
|
696
|
+
title: string;
|
|
697
|
+
description: string;
|
|
698
|
+
assignTo?: string;
|
|
699
|
+
dependsOn?: string[];
|
|
700
|
+
expectations?: TaskExpectation[];
|
|
701
|
+
expectedOutcomes?: ExpectedOutcome[];
|
|
702
|
+
maxDuration?: number;
|
|
703
|
+
retryPolicy?: RetryPolicy;
|
|
704
|
+
notifications?: ScopedNotificationRules;
|
|
705
|
+
}
|
|
706
|
+
export interface UpdateMissionTaskRequest {
|
|
707
|
+
title?: string;
|
|
708
|
+
description?: string;
|
|
709
|
+
assignTo?: string;
|
|
710
|
+
dependsOn?: string[];
|
|
711
|
+
expectations?: TaskExpectation[];
|
|
712
|
+
expectedOutcomes?: ExpectedOutcome[];
|
|
713
|
+
maxDuration?: number;
|
|
714
|
+
retryPolicy?: RetryPolicy;
|
|
715
|
+
notifications?: ScopedNotificationRules;
|
|
716
|
+
}
|
|
717
|
+
export interface ReorderMissionTasksRequest {
|
|
718
|
+
titles: string[];
|
|
719
|
+
}
|
|
720
|
+
export interface AddMissionCheckpointRequest {
|
|
721
|
+
name: string;
|
|
722
|
+
afterTasks: string[];
|
|
723
|
+
blocksTasks: string[];
|
|
724
|
+
message?: string;
|
|
725
|
+
notifyChannels?: string[];
|
|
726
|
+
}
|
|
727
|
+
export interface UpdateMissionCheckpointRequest {
|
|
728
|
+
name?: string;
|
|
729
|
+
afterTasks?: string[];
|
|
730
|
+
blocksTasks?: string[];
|
|
731
|
+
message?: string;
|
|
732
|
+
notifyChannels?: string[];
|
|
733
|
+
}
|
|
734
|
+
export interface AddMissionDelayRequest {
|
|
735
|
+
name: string;
|
|
736
|
+
afterTasks: string[];
|
|
737
|
+
blocksTasks: string[];
|
|
738
|
+
duration: string;
|
|
739
|
+
message?: string;
|
|
740
|
+
notifyChannels?: string[];
|
|
741
|
+
}
|
|
742
|
+
export interface UpdateMissionDelayRequest {
|
|
743
|
+
name?: string;
|
|
744
|
+
afterTasks?: string[];
|
|
745
|
+
blocksTasks?: string[];
|
|
746
|
+
duration?: string;
|
|
747
|
+
message?: string;
|
|
748
|
+
notifyChannels?: string[];
|
|
749
|
+
}
|
|
750
|
+
export interface AddMissionQualityGateRequest {
|
|
751
|
+
name: string;
|
|
752
|
+
afterTasks: string[];
|
|
753
|
+
blocksTasks: string[];
|
|
754
|
+
minScore?: number;
|
|
755
|
+
requireAllPassed?: boolean;
|
|
756
|
+
condition?: string;
|
|
757
|
+
notifyChannels?: string[];
|
|
758
|
+
}
|
|
759
|
+
export interface UpdateMissionQualityGateRequest {
|
|
760
|
+
name?: string;
|
|
761
|
+
afterTasks?: string[];
|
|
762
|
+
blocksTasks?: string[];
|
|
763
|
+
minScore?: number;
|
|
764
|
+
requireAllPassed?: boolean;
|
|
765
|
+
condition?: string;
|
|
766
|
+
notifyChannels?: string[];
|
|
767
|
+
}
|
|
768
|
+
export interface AddMissionTeamMemberRequest {
|
|
769
|
+
name: string;
|
|
770
|
+
role?: string;
|
|
771
|
+
model?: string;
|
|
772
|
+
systemPrompt?: string;
|
|
773
|
+
allowedTools?: string[];
|
|
774
|
+
}
|
|
775
|
+
export interface UpdateMissionTeamMemberRequest {
|
|
776
|
+
name?: string;
|
|
777
|
+
role?: string;
|
|
778
|
+
model?: string;
|
|
779
|
+
systemPrompt?: string;
|
|
780
|
+
allowedTools?: string[];
|
|
781
|
+
}
|
|
782
|
+
export interface UpdateMissionNotificationsRequest {
|
|
783
|
+
notifications: ScopedNotificationRules | null;
|
|
784
|
+
}
|
|
785
|
+
export interface AddAgentRequest {
|
|
786
|
+
name: string;
|
|
787
|
+
role?: string;
|
|
788
|
+
model?: string;
|
|
789
|
+
allowedTools?: string[];
|
|
790
|
+
systemPrompt?: string;
|
|
791
|
+
skills?: string[];
|
|
792
|
+
maxTurns?: number;
|
|
793
|
+
/** Max concurrent tasks for this agent. */
|
|
794
|
+
maxConcurrency?: number;
|
|
795
|
+
/** MCP servers to connect to. */
|
|
796
|
+
mcpServers?: Record<string, McpServerConfig>;
|
|
797
|
+
/** Filesystem sandbox — directories the agent is allowed to access. */
|
|
798
|
+
allowedPaths?: string[];
|
|
799
|
+
/** Agent identity (display name, bio, avatar). */
|
|
800
|
+
identity?: AgentIdentity;
|
|
801
|
+
/** Org chart: who this agent reports to. */
|
|
802
|
+
reportsTo?: string;
|
|
803
|
+
/** Allowed email recipient domains (overrides global setting). */
|
|
804
|
+
emailAllowedDomains?: string[];
|
|
805
|
+
}
|
|
806
|
+
export interface UpdateAgentRequest {
|
|
807
|
+
role?: string;
|
|
808
|
+
model?: string;
|
|
809
|
+
allowedTools?: string[];
|
|
810
|
+
allowedPaths?: string[];
|
|
811
|
+
systemPrompt?: string;
|
|
812
|
+
skills?: string[];
|
|
813
|
+
maxTurns?: number;
|
|
814
|
+
maxConcurrency?: number;
|
|
815
|
+
identity?: AgentIdentity;
|
|
816
|
+
reportsTo?: string;
|
|
817
|
+
reasoning?: string;
|
|
818
|
+
browserProfile?: string;
|
|
819
|
+
emailAllowedDomains?: string[];
|
|
820
|
+
/** Move agent to a different team. */
|
|
821
|
+
team?: string;
|
|
822
|
+
}
|
|
823
|
+
export interface UpdateSettingsRequest {
|
|
824
|
+
orchestratorModel?: string | ModelConfig;
|
|
825
|
+
imageModel?: string | null;
|
|
826
|
+
reasoning?: ReasoningLevel;
|
|
827
|
+
}
|
|
828
|
+
export interface SSEEvent {
|
|
829
|
+
id: string;
|
|
830
|
+
event: string;
|
|
831
|
+
data: unknown;
|
|
832
|
+
timestamp: string;
|
|
833
|
+
}
|
|
834
|
+
export interface HealthResponse {
|
|
835
|
+
status: string;
|
|
836
|
+
version: string;
|
|
837
|
+
uptime: number;
|
|
838
|
+
}
|
|
839
|
+
export interface TaskFilters {
|
|
840
|
+
status?: TaskStatus;
|
|
841
|
+
group?: string;
|
|
842
|
+
assignTo?: string;
|
|
843
|
+
}
|
|
844
|
+
export interface ExecuteMissionResult {
|
|
845
|
+
tasks: Task[];
|
|
846
|
+
group: string;
|
|
847
|
+
}
|
|
848
|
+
export interface ResumeMissionResult {
|
|
849
|
+
retried: number;
|
|
850
|
+
pending: number;
|
|
851
|
+
}
|
|
852
|
+
export interface LogSession {
|
|
853
|
+
sessionId: string;
|
|
854
|
+
startedAt: string;
|
|
855
|
+
entries: number;
|
|
856
|
+
}
|
|
857
|
+
export interface LogEntry {
|
|
858
|
+
ts: string;
|
|
859
|
+
event: string;
|
|
860
|
+
data: unknown;
|
|
861
|
+
}
|
|
862
|
+
/** A single entry from the per-run JSONL activity log. */
|
|
863
|
+
export interface RunActivityEntry {
|
|
864
|
+
/** ISO timestamp (present on all entries except the header) */
|
|
865
|
+
ts?: string;
|
|
866
|
+
/** Event type: "spawning", "spawned", "activity", "sigterm", "done", "error" */
|
|
867
|
+
event?: string;
|
|
868
|
+
/** Transcript type: "stdout", "tool_use", "tool_result", "assistant", "error", "result" */
|
|
869
|
+
type?: string;
|
|
870
|
+
/** Agent output text (for stdout/assistant entries) */
|
|
871
|
+
text?: string;
|
|
872
|
+
/** Payload data (activity snapshot, lifecycle info, etc.) */
|
|
873
|
+
data?: unknown;
|
|
874
|
+
/** Tool name (present on tool_use and tool_result entries) */
|
|
875
|
+
tool?: string;
|
|
876
|
+
/** Tool call ID (present on tool_use and tool_result entries) */
|
|
877
|
+
toolId?: string;
|
|
878
|
+
/** Tool input arguments (present on tool_use entries) */
|
|
879
|
+
input?: Record<string, unknown>;
|
|
880
|
+
/** Tool output content (present on tool_result entries) */
|
|
881
|
+
content?: string;
|
|
882
|
+
/** Whether the tool call errored (present on tool_result entries) */
|
|
883
|
+
isError?: boolean;
|
|
884
|
+
/** Present on the header line only */
|
|
885
|
+
_run?: boolean;
|
|
886
|
+
runId?: string;
|
|
887
|
+
taskId?: string;
|
|
888
|
+
agentName?: string;
|
|
889
|
+
startedAt?: string;
|
|
890
|
+
pid?: number;
|
|
891
|
+
}
|
|
892
|
+
/** A discovered skill from the project skill pool. */
|
|
893
|
+
export interface SkillInfo {
|
|
894
|
+
name: string;
|
|
895
|
+
description: string;
|
|
896
|
+
allowedTools?: string[];
|
|
897
|
+
/** Where this skill was discovered from. */
|
|
898
|
+
source: "project" | "global" | "polpo" | "claude" | "home";
|
|
899
|
+
/** Absolute path to the skill directory. */
|
|
900
|
+
path: string;
|
|
901
|
+
/** Freeform tags for search and filtering (from skills-index.json). */
|
|
902
|
+
tags?: string[];
|
|
903
|
+
/** Macro-category for grouping (from skills-index.json). */
|
|
904
|
+
category?: string;
|
|
905
|
+
}
|
|
906
|
+
/** Skill with full content loaded (returned by GET /skills/:name/content). */
|
|
907
|
+
export interface LoadedSkill extends SkillInfo {
|
|
908
|
+
/** Full SKILL.md content (markdown body without frontmatter). */
|
|
909
|
+
content: string;
|
|
910
|
+
}
|
|
911
|
+
/** Skill with agent assignment info (returned by GET /skills). */
|
|
912
|
+
export interface SkillWithAssignment extends SkillInfo {
|
|
913
|
+
/** Agent names that have this skill assigned. */
|
|
914
|
+
assignedTo: string[];
|
|
915
|
+
}
|
|
916
|
+
/** A single entry in the skills index file (.polpo/skills-index.json). */
|
|
917
|
+
export interface SkillIndexEntry {
|
|
918
|
+
/** Freeform tags for search and filtering. */
|
|
919
|
+
tags?: string[];
|
|
920
|
+
/** Macro-category for grouping. */
|
|
921
|
+
category?: string;
|
|
922
|
+
}
|
|
923
|
+
/** The full skills index: maps skill names to their index metadata. */
|
|
924
|
+
export type SkillIndex = Record<string, SkillIndexEntry>;
|
|
925
|
+
export interface ChatSession {
|
|
926
|
+
id: string;
|
|
927
|
+
title?: string;
|
|
928
|
+
createdAt: string;
|
|
929
|
+
updatedAt: string;
|
|
930
|
+
messageCount: number;
|
|
931
|
+
/** Agent name when this session targets a specific agent (agent-direct mode). Absent for orchestrator sessions. */
|
|
932
|
+
agent?: string;
|
|
933
|
+
}
|
|
934
|
+
export interface ChatMessage {
|
|
935
|
+
id: string;
|
|
936
|
+
role: "user" | "assistant";
|
|
937
|
+
content: string;
|
|
938
|
+
ts: string;
|
|
939
|
+
/** Tool calls executed during this assistant message (only for role=assistant) */
|
|
940
|
+
toolCalls?: ToolCallEvent[];
|
|
941
|
+
}
|
|
942
|
+
/** A text content part. */
|
|
943
|
+
export interface TextContentPart {
|
|
944
|
+
type: "text";
|
|
945
|
+
text: string;
|
|
946
|
+
}
|
|
947
|
+
/** An image content part (data URL or HTTPS URL). */
|
|
948
|
+
export interface ImageUrlContentPart {
|
|
949
|
+
type: "image_url";
|
|
950
|
+
image_url: {
|
|
951
|
+
url: string;
|
|
952
|
+
detail?: "auto" | "low" | "high";
|
|
953
|
+
};
|
|
954
|
+
}
|
|
955
|
+
export type ContentPart = TextContentPart | ImageUrlContentPart;
|
|
956
|
+
export interface ChatCompletionMessage {
|
|
957
|
+
role: "system" | "user" | "assistant";
|
|
958
|
+
/** Plain string or multimodal content parts (text + images). */
|
|
959
|
+
content: string | ContentPart[];
|
|
960
|
+
}
|
|
961
|
+
export interface ChatCompletionRequest {
|
|
962
|
+
messages: ChatCompletionMessage[];
|
|
963
|
+
stream?: boolean;
|
|
964
|
+
/** Polpo extension: target a specific project by ID. If omitted, uses the first registered project. */
|
|
965
|
+
project?: string;
|
|
966
|
+
/** Ignored — Polpo uses its configured orchestrator model. */
|
|
967
|
+
model?: string;
|
|
968
|
+
/** Session ID for conversation persistence. If omitted, server auto-selects or creates one. */
|
|
969
|
+
sessionId?: string;
|
|
970
|
+
/** Target a specific agent by name for direct conversation. Uses the agent's own model, system prompt, and coding tools. Omit to talk to the orchestrator (default). */
|
|
971
|
+
agent?: string;
|
|
972
|
+
}
|
|
973
|
+
export interface ChatCompletionChoice {
|
|
974
|
+
index: number;
|
|
975
|
+
message: {
|
|
976
|
+
role: "assistant";
|
|
977
|
+
content: string;
|
|
978
|
+
};
|
|
979
|
+
finish_reason: "stop" | "length" | "ask_user" | "mission_preview" | "vault_preview" | "open_file" | "navigate_to" | "open_tab";
|
|
980
|
+
/** Present when finish_reason is "ask_user" — structured questions for the user. */
|
|
981
|
+
ask_user?: AskUserPayload;
|
|
982
|
+
/** Present when finish_reason is "mission_preview" — proposed mission for user review. */
|
|
983
|
+
mission_preview?: MissionPreviewPayload;
|
|
984
|
+
/** Present when finish_reason is "vault_preview" — proposed vault entry for user review. */
|
|
985
|
+
vault_preview?: VaultPreviewPayload;
|
|
986
|
+
/** Present when finish_reason is "open_file" — file path to open in preview dialog. */
|
|
987
|
+
open_file?: OpenFilePayload;
|
|
988
|
+
/** Present when finish_reason is "navigate_to" — navigate the UI to a specific page. */
|
|
989
|
+
navigate_to?: NavigateToPayload;
|
|
990
|
+
/** Present when finish_reason is "open_tab" — open a URL in a new browser tab. */
|
|
991
|
+
open_tab?: OpenTabPayload;
|
|
992
|
+
}
|
|
993
|
+
export interface ChatCompletionResponse {
|
|
994
|
+
id: string;
|
|
995
|
+
object: "chat.completion";
|
|
996
|
+
created: number;
|
|
997
|
+
model: string;
|
|
998
|
+
choices: ChatCompletionChoice[];
|
|
999
|
+
usage: {
|
|
1000
|
+
prompt_tokens: number;
|
|
1001
|
+
completion_tokens: number;
|
|
1002
|
+
total_tokens: number;
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
1005
|
+
export interface ChatCompletionChunkDelta {
|
|
1006
|
+
role?: string;
|
|
1007
|
+
content?: string;
|
|
1008
|
+
}
|
|
1009
|
+
export type ToolCallState = "preparing" | "calling" | "completed" | "error" | "interrupted";
|
|
1010
|
+
export interface ToolCallEvent {
|
|
1011
|
+
/** Tool call ID from the LLM */
|
|
1012
|
+
id: string;
|
|
1013
|
+
/** Tool name (e.g. "create_task", "get_status") */
|
|
1014
|
+
name: string;
|
|
1015
|
+
/** Tool input arguments (present when state is "calling") */
|
|
1016
|
+
arguments?: Record<string, unknown>;
|
|
1017
|
+
/** Tool execution result (present when state is "completed" or "error") */
|
|
1018
|
+
result?: string;
|
|
1019
|
+
/** Current state of the tool call */
|
|
1020
|
+
state: ToolCallState;
|
|
1021
|
+
}
|
|
1022
|
+
export interface ChatCompletionChunk {
|
|
1023
|
+
id: string;
|
|
1024
|
+
object: "chat.completion.chunk";
|
|
1025
|
+
created: number;
|
|
1026
|
+
model: string;
|
|
1027
|
+
choices: Array<{
|
|
1028
|
+
index: number;
|
|
1029
|
+
delta: ChatCompletionChunkDelta;
|
|
1030
|
+
finish_reason: string | null;
|
|
1031
|
+
/** Present when finish_reason is "ask_user" — structured questions for the user. */
|
|
1032
|
+
ask_user?: AskUserPayload;
|
|
1033
|
+
/** Present when finish_reason is "mission_preview" — proposed mission for user review. */
|
|
1034
|
+
mission_preview?: MissionPreviewPayload;
|
|
1035
|
+
/** Present when finish_reason is "vault_preview" — proposed vault entry for user review. */
|
|
1036
|
+
vault_preview?: VaultPreviewPayload;
|
|
1037
|
+
/** Present when finish_reason is "open_file" — file path to open in preview dialog. */
|
|
1038
|
+
open_file?: OpenFilePayload;
|
|
1039
|
+
/** Present when finish_reason is "navigate_to" — navigate the UI to a specific page. */
|
|
1040
|
+
navigate_to?: NavigateToPayload;
|
|
1041
|
+
/** Present when finish_reason is "open_tab" — open a URL in a new browser tab. */
|
|
1042
|
+
open_tab?: OpenTabPayload;
|
|
1043
|
+
/** Present when the server is executing a tool call. */
|
|
1044
|
+
tool_call?: ToolCallEvent;
|
|
1045
|
+
}>;
|
|
1046
|
+
}
|
|
1047
|
+
export interface AskUserOption {
|
|
1048
|
+
label: string;
|
|
1049
|
+
description?: string;
|
|
1050
|
+
}
|
|
1051
|
+
export interface AskUserQuestion {
|
|
1052
|
+
/** Unique question key for matching answers */
|
|
1053
|
+
id: string;
|
|
1054
|
+
/** The full question text */
|
|
1055
|
+
question: string;
|
|
1056
|
+
/** Short label for compact display (max 30 chars) */
|
|
1057
|
+
header?: string;
|
|
1058
|
+
/** Pre-populated selectable options */
|
|
1059
|
+
options: AskUserOption[];
|
|
1060
|
+
/** Allow selecting multiple options (default: false) */
|
|
1061
|
+
multiple?: boolean;
|
|
1062
|
+
/** Show custom text input (default: true) */
|
|
1063
|
+
custom?: boolean;
|
|
1064
|
+
}
|
|
1065
|
+
export interface AskUserPayload {
|
|
1066
|
+
questions: AskUserQuestion[];
|
|
1067
|
+
}
|
|
1068
|
+
export interface AskUserAnswer {
|
|
1069
|
+
questionId: string;
|
|
1070
|
+
/** Labels of selected options */
|
|
1071
|
+
selected: string[];
|
|
1072
|
+
/** Custom text typed by user */
|
|
1073
|
+
customText?: string;
|
|
1074
|
+
}
|
|
1075
|
+
export interface MissionPreviewPayload {
|
|
1076
|
+
/** Proposed mission name */
|
|
1077
|
+
name: string;
|
|
1078
|
+
/** Parsed mission document (tasks, qualityGates, etc.) */
|
|
1079
|
+
data: unknown;
|
|
1080
|
+
/** Original user prompt that generated this mission */
|
|
1081
|
+
prompt?: string;
|
|
1082
|
+
}
|
|
1083
|
+
export interface VaultEntryMeta {
|
|
1084
|
+
/** Service name (vault key, e.g. "gmail", "stripe") */
|
|
1085
|
+
service: string;
|
|
1086
|
+
/** Credential type */
|
|
1087
|
+
type: "smtp" | "imap" | "oauth" | "api_key" | "login" | "custom";
|
|
1088
|
+
/** Human-readable label */
|
|
1089
|
+
label?: string;
|
|
1090
|
+
/** Credential field names (e.g. ["host", "port", "user", "pass"]) — values are NOT exposed */
|
|
1091
|
+
keys: string[];
|
|
1092
|
+
}
|
|
1093
|
+
export type AuthProfileStatus = "active" | "cooldown" | "billing_disabled" | "expired";
|
|
1094
|
+
export type AuthProfileType = "oauth" | "api_key";
|
|
1095
|
+
/** Metadata for a single auth profile — tokens are NEVER exposed. */
|
|
1096
|
+
export interface AuthProfileMeta {
|
|
1097
|
+
id: string;
|
|
1098
|
+
type: AuthProfileType;
|
|
1099
|
+
email?: string;
|
|
1100
|
+
expires?: number;
|
|
1101
|
+
expired: boolean;
|
|
1102
|
+
hasRefresh: boolean;
|
|
1103
|
+
lastUsed?: string;
|
|
1104
|
+
createdAt: string;
|
|
1105
|
+
status: AuthProfileStatus;
|
|
1106
|
+
cooldownUntil?: number;
|
|
1107
|
+
disabledUntil?: number;
|
|
1108
|
+
lastErrorReason?: string;
|
|
1109
|
+
disabledReason?: string;
|
|
1110
|
+
errorCount?: number;
|
|
1111
|
+
}
|
|
1112
|
+
/** Per-provider auth health info. */
|
|
1113
|
+
export interface ProviderAuthInfo {
|
|
1114
|
+
hasEnvKey: boolean;
|
|
1115
|
+
envVar?: string;
|
|
1116
|
+
profiles: AuthProfileMeta[];
|
|
1117
|
+
oauthAvailable: boolean;
|
|
1118
|
+
oauthProviderName?: string;
|
|
1119
|
+
oauthFlow?: string;
|
|
1120
|
+
}
|
|
1121
|
+
/** Full auth status response — all providers. */
|
|
1122
|
+
export interface AuthStatusResponse {
|
|
1123
|
+
providers: Record<string, ProviderAuthInfo>;
|
|
1124
|
+
}
|
|
1125
|
+
export interface VaultPreviewPayload {
|
|
1126
|
+
/** Agent name */
|
|
1127
|
+
agent: string;
|
|
1128
|
+
/** Service name (vault key, e.g. "gmail", "stripe") */
|
|
1129
|
+
service: string;
|
|
1130
|
+
/** Credential type */
|
|
1131
|
+
type: "smtp" | "imap" | "oauth" | "api_key" | "login" | "custom";
|
|
1132
|
+
/** Human-readable label */
|
|
1133
|
+
label?: string;
|
|
1134
|
+
/** Credential key-value pairs — user can edit before confirming */
|
|
1135
|
+
credentials: Record<string, string>;
|
|
1136
|
+
}
|
|
1137
|
+
export interface OpenFilePayload {
|
|
1138
|
+
/** File path relative to project root */
|
|
1139
|
+
path: string;
|
|
1140
|
+
}
|
|
1141
|
+
export interface NavigateToPayload {
|
|
1142
|
+
/** Target page: dashboard, tasks, task, missions, mission, agents, agent, skills, skill, files, activity, chat, memory, settings */
|
|
1143
|
+
target: string;
|
|
1144
|
+
/** Entity ID for detail pages (task, mission) */
|
|
1145
|
+
id?: string;
|
|
1146
|
+
/** Entity name for detail pages (agent, skill) */
|
|
1147
|
+
name?: string;
|
|
1148
|
+
/** Directory path for files target */
|
|
1149
|
+
path?: string;
|
|
1150
|
+
/** File to highlight/select for files target */
|
|
1151
|
+
highlight?: string;
|
|
1152
|
+
}
|
|
1153
|
+
/** Payload for open_tab — opens a URL in a new browser tab. */
|
|
1154
|
+
export interface OpenTabPayload {
|
|
1155
|
+
/** The URL to open */
|
|
1156
|
+
url: string;
|
|
1157
|
+
/** Optional human-readable label */
|
|
1158
|
+
label?: string;
|
|
1159
|
+
}
|
|
1160
|
+
//# sourceMappingURL=types.d.ts.map
|