@openwop/openwop 1.1.5 → 1.2.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/client.d.ts +78 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +252 -14
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +238 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +265 -14
- package/src/index.ts +30 -0
- package/src/types.ts +275 -1
package/src/client.ts
CHANGED
|
@@ -51,6 +51,19 @@ import {
|
|
|
51
51
|
type RunSnapshot,
|
|
52
52
|
type AgentInventoryEntry,
|
|
53
53
|
type AgentInventoryResponse,
|
|
54
|
+
type AgentRosterEntry,
|
|
55
|
+
type AgentRosterResponse,
|
|
56
|
+
type AgentOrgChart,
|
|
57
|
+
type OrgChartResponsibilityView,
|
|
58
|
+
type EvalSummary,
|
|
59
|
+
type ToolDescriptor,
|
|
60
|
+
type AgentDeployment,
|
|
61
|
+
type AgentDeploymentTransition,
|
|
62
|
+
type CreateUserAgentRequest,
|
|
63
|
+
type UserAgentRecord,
|
|
64
|
+
type AgentPackRegistryResponse,
|
|
65
|
+
type InstallAgentPackRequest,
|
|
66
|
+
type InstallAgentPackResponse,
|
|
54
67
|
} from './types.js';
|
|
55
68
|
|
|
56
69
|
export interface OpenwopClientOptions {
|
|
@@ -150,7 +163,7 @@ export class OpenwopClient {
|
|
|
150
163
|
} catch (err) {
|
|
151
164
|
// Host doesn't advertise the capability → 404. Surface as null so callers
|
|
152
165
|
// can branch on capability discovery without try/catch.
|
|
153
|
-
if (err instanceof
|
|
166
|
+
if (err instanceof WopError && err.status === 404) return null;
|
|
154
167
|
throw err;
|
|
155
168
|
}
|
|
156
169
|
},
|
|
@@ -254,7 +267,7 @@ export class OpenwopClient {
|
|
|
254
267
|
});
|
|
255
268
|
return res.annotations;
|
|
256
269
|
} catch (err) {
|
|
257
|
-
if (err instanceof
|
|
270
|
+
if (err instanceof WopError && (err.status === 404 || err.status === 501)) return null;
|
|
258
271
|
throw err;
|
|
259
272
|
}
|
|
260
273
|
},
|
|
@@ -277,7 +290,7 @@ export class OpenwopClient {
|
|
|
277
290
|
path: `/v1/runs/${encodeURIComponent(runId)}/ancestry`,
|
|
278
291
|
});
|
|
279
292
|
} catch (err) {
|
|
280
|
-
if (err instanceof
|
|
293
|
+
if (err instanceof WopError && err.status === 404) return null;
|
|
281
294
|
throw err;
|
|
282
295
|
}
|
|
283
296
|
},
|
|
@@ -297,7 +310,44 @@ export class OpenwopClient {
|
|
|
297
310
|
path: `/v1/runs/${encodeURIComponent(runId)}:diff?against=${encodeURIComponent(against)}`,
|
|
298
311
|
});
|
|
299
312
|
} catch (err) {
|
|
300
|
-
if (err instanceof
|
|
313
|
+
if (err instanceof WopError && err.status === 404) return null;
|
|
314
|
+
throw err;
|
|
315
|
+
}
|
|
316
|
+
},
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* RFC 0081 §C — the `EvalSummary` scorecard for a terminal eval run (one
|
|
320
|
+
* started via `runs.create({ mode: 'eval', evalSuiteRef, agentId })`):
|
|
321
|
+
* aggregate + per-task scores, cost, latency, schema-validity, and
|
|
322
|
+
* redaction-safe safety findings. Returns `null` when the host doesn't
|
|
323
|
+
* advertise `capabilities.agents.evalSuite` or the run isn't an eval run
|
|
324
|
+
* (404). Throws `409` while the run is still in progress.
|
|
325
|
+
*/
|
|
326
|
+
evalSummary: async (runId: string): Promise<EvalSummary | null> => {
|
|
327
|
+
try {
|
|
328
|
+
return await this.#request<EvalSummary>({
|
|
329
|
+
method: 'GET',
|
|
330
|
+
path: `/v1/runs/${encodeURIComponent(runId)}/eval-summary`,
|
|
331
|
+
});
|
|
332
|
+
} catch (err) {
|
|
333
|
+
if (err instanceof WopError && err.status === 404) return null;
|
|
334
|
+
throw err;
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Read a run-produced artifact by id (`GET /v1/runs/{runId}/artifacts/{artifactId}`).
|
|
340
|
+
* The artifact body is implementation-defined per the host. Returns `null`
|
|
341
|
+
* on 404 (no such artifact, or the host doesn't store artifacts).
|
|
342
|
+
*/
|
|
343
|
+
getArtifact: async (runId: string, artifactId: string): Promise<Record<string, unknown> | null> => {
|
|
344
|
+
try {
|
|
345
|
+
return await this.#request<Record<string, unknown>>({
|
|
346
|
+
method: 'GET',
|
|
347
|
+
path: `/v1/runs/${encodeURIComponent(runId)}/artifacts/${encodeURIComponent(artifactId)}`,
|
|
348
|
+
});
|
|
349
|
+
} catch (err) {
|
|
350
|
+
if (err instanceof WopError && err.status === 404) return null;
|
|
301
351
|
throw err;
|
|
302
352
|
}
|
|
303
353
|
},
|
|
@@ -339,7 +389,7 @@ export class OpenwopClient {
|
|
|
339
389
|
try {
|
|
340
390
|
return await this.#request<AgentInventoryResponse>({ method: 'GET', path: '/v1/agents' });
|
|
341
391
|
} catch (err) {
|
|
342
|
-
if (err instanceof
|
|
392
|
+
if (err instanceof WopError && err.status === 404) return null;
|
|
343
393
|
throw err;
|
|
344
394
|
}
|
|
345
395
|
},
|
|
@@ -351,12 +401,204 @@ export class OpenwopClient {
|
|
|
351
401
|
path: `/v1/agents/${encodeURIComponent(agentId)}`,
|
|
352
402
|
});
|
|
353
403
|
} catch (err) {
|
|
354
|
-
if (err instanceof
|
|
404
|
+
if (err instanceof WopError && err.status === 404) return null;
|
|
405
|
+
throw err;
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* RFC 0082 §C/§E — list a manifest agent's deployment records (per-(agentId,
|
|
411
|
+
* version) lifecycle state + channels + canary + rollback pointer). Returns
|
|
412
|
+
* `null` when the host doesn't advertise `capabilities.agents.deployment`
|
|
413
|
+
* (the endpoint 404s).
|
|
414
|
+
*/
|
|
415
|
+
listDeployments: async (agentId: string): Promise<readonly AgentDeployment[] | null> => {
|
|
416
|
+
try {
|
|
417
|
+
return await this.#request<AgentDeployment[]>({
|
|
418
|
+
method: 'GET',
|
|
419
|
+
path: `/v1/agents/${encodeURIComponent(agentId)}/deployments`,
|
|
420
|
+
});
|
|
421
|
+
} catch (err) {
|
|
422
|
+
if (err instanceof WopError && err.status === 404) return null;
|
|
423
|
+
throw err;
|
|
424
|
+
}
|
|
425
|
+
},
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* RFC 0082 §E — request a deployment state transition (promote / pause /
|
|
429
|
+
* deprecate / rollback / adjust-canary). The host authorizes fail-closed
|
|
430
|
+
* against the RFC 0049 `deploy:*` scope, runs any RFC 0051 approvalGate, and
|
|
431
|
+
* enforces RFC 0081 `requiredEval` before emitting `deployment.promoted`.
|
|
432
|
+
* Returns the updated deployment record. Throws on non-2xx (`403` fail-closed
|
|
433
|
+
* / `eval_gate_unmet`; `400` `no_active_deployment` / unsupported state).
|
|
434
|
+
*/
|
|
435
|
+
transitionDeployment: (
|
|
436
|
+
agentId: string,
|
|
437
|
+
body: AgentDeploymentTransition,
|
|
438
|
+
opts: MutationOptions = {},
|
|
439
|
+
): Promise<AgentDeployment> =>
|
|
440
|
+
this.#request<AgentDeployment>({
|
|
441
|
+
method: 'POST',
|
|
442
|
+
path: `/v1/agents/${encodeURIComponent(agentId)}/deployments`,
|
|
443
|
+
body,
|
|
444
|
+
headers: this.#mutationHeaders(opts),
|
|
445
|
+
}),
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* RFC 0086 §B — list the standing agent roster (named instances + their
|
|
449
|
+
* workflow portfolios) visible to the caller. Returns `null` when the host
|
|
450
|
+
* doesn't advertise `capabilities.agents.roster` (the endpoint 404s).
|
|
451
|
+
*/
|
|
452
|
+
listRoster: async (): Promise<AgentRosterResponse | null> => {
|
|
453
|
+
try {
|
|
454
|
+
return await this.#request<AgentRosterResponse>({ method: 'GET', path: '/v1/agents/roster' });
|
|
455
|
+
} catch (err) {
|
|
456
|
+
if (err instanceof WopError && err.status === 404) return null;
|
|
457
|
+
throw err;
|
|
458
|
+
}
|
|
459
|
+
},
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* RFC 0086 §B — return one standing roster entry. Returns `null` on 404
|
|
463
|
+
* (no such entry, cross-tenant, or the capability is unadvertised).
|
|
464
|
+
*/
|
|
465
|
+
getRosterEntry: async (rosterId: string): Promise<AgentRosterEntry | null> => {
|
|
466
|
+
try {
|
|
467
|
+
return await this.#request<AgentRosterEntry>({
|
|
468
|
+
method: 'GET',
|
|
469
|
+
path: `/v1/agents/roster/${encodeURIComponent(rosterId)}`,
|
|
470
|
+
});
|
|
471
|
+
} catch (err) {
|
|
472
|
+
if (err instanceof WopError && err.status === 404) return null;
|
|
473
|
+
throw err;
|
|
474
|
+
}
|
|
475
|
+
},
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* RFC 0087 §C — return the caller's agent org-chart (departments + roles +
|
|
479
|
+
* `reportsTo` over roster members; descriptive — confers no authority).
|
|
480
|
+
* Returns `null` when the host doesn't advertise `capabilities.agents.orgChart`.
|
|
481
|
+
*/
|
|
482
|
+
getOrgChart: async (): Promise<AgentOrgChart | null> => {
|
|
483
|
+
try {
|
|
484
|
+
return await this.#request<AgentOrgChart>({ method: 'GET', path: '/v1/agents/org-chart' });
|
|
485
|
+
} catch (err) {
|
|
486
|
+
if (err instanceof WopError && err.status === 404) return null;
|
|
487
|
+
throw err;
|
|
488
|
+
}
|
|
489
|
+
},
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* RFC 0087 §D — one department's subtree + responsibility roll-up (the
|
|
493
|
+
* union of its members' RFC 0086 portfolios). `recursive: false` scopes the
|
|
494
|
+
* roll-up to direct members. Returns `null` on 404 (unknown/cross-tenant
|
|
495
|
+
* department, or the capability is unadvertised).
|
|
496
|
+
*/
|
|
497
|
+
getOrgChartDepartment: async (
|
|
498
|
+
departmentId: string,
|
|
499
|
+
opts: { recursive?: boolean } = {},
|
|
500
|
+
): Promise<OrgChartResponsibilityView | null> => {
|
|
501
|
+
const qs = opts.recursive === false ? '?recursive=false' : '';
|
|
502
|
+
try {
|
|
503
|
+
return await this.#request<OrgChartResponsibilityView>({
|
|
504
|
+
method: 'GET',
|
|
505
|
+
path: `/v1/agents/org-chart/${encodeURIComponent(departmentId)}${qs}`,
|
|
506
|
+
});
|
|
507
|
+
} catch (err) {
|
|
508
|
+
if (err instanceof WopError && err.status === 404) return null;
|
|
355
509
|
throw err;
|
|
356
510
|
}
|
|
357
511
|
},
|
|
358
512
|
};
|
|
359
513
|
|
|
514
|
+
// RFC 0078 — portable tool catalog (spec/v1/tool-catalog.md). The host
|
|
515
|
+
// projects every node-pack / workflow / mcp / connector / host-extension
|
|
516
|
+
// tool visible to the caller onto a uniform `ToolDescriptor`.
|
|
517
|
+
readonly tools = {
|
|
518
|
+
/**
|
|
519
|
+
* RFC 0078 §B — list the portable `ToolDescriptor`s visible to the caller.
|
|
520
|
+
* Returns `null` when the host doesn't advertise `capabilities.toolCatalog`
|
|
521
|
+
* (the endpoint 404s), so callers can branch on capability discovery.
|
|
522
|
+
*/
|
|
523
|
+
list: async (): Promise<readonly ToolDescriptor[] | null> => {
|
|
524
|
+
try {
|
|
525
|
+
return await this.#request<ToolDescriptor[]>({ method: 'GET', path: '/v1/tools' });
|
|
526
|
+
} catch (err) {
|
|
527
|
+
if (err instanceof WopError && err.status === 404) return null;
|
|
528
|
+
throw err;
|
|
529
|
+
}
|
|
530
|
+
},
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* RFC 0078 §B — return one `ToolDescriptor` by its stable `toolId`. Returns
|
|
534
|
+
* `null` on 404 (no such tool, or the capability is unadvertised).
|
|
535
|
+
*/
|
|
536
|
+
get: async (toolId: string): Promise<ToolDescriptor | null> => {
|
|
537
|
+
try {
|
|
538
|
+
return await this.#request<ToolDescriptor>({
|
|
539
|
+
method: 'GET',
|
|
540
|
+
path: `/v1/tools/${encodeURIComponent(toolId)}`,
|
|
541
|
+
});
|
|
542
|
+
} catch (err) {
|
|
543
|
+
if (err instanceof WopError && err.status === 404) return null;
|
|
544
|
+
throw err;
|
|
545
|
+
}
|
|
546
|
+
},
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
// ── User-authored agents (sample-extension; non-normative) ───────────
|
|
550
|
+
// Backs the workflow-engine sample app's Agents tab. Pack-installed
|
|
551
|
+
// agents come through the `.agents` inventory above (RFC 0072 §A).
|
|
552
|
+
// These methods wrap the `POST/DELETE /v1/host/sample/agents` +
|
|
553
|
+
// `GET/POST /v1/host/sample/registry/agent-packs` host extensions.
|
|
554
|
+
// Returns `null` on 404 (capability absent — matches the `.agents`
|
|
555
|
+
// surface pattern); throws on other failures.
|
|
556
|
+
readonly userAgents = {
|
|
557
|
+
create: async (body: CreateUserAgentRequest, opts: MutationOptions = {}): Promise<UserAgentRecord> => {
|
|
558
|
+
return await this.#request<UserAgentRecord>({
|
|
559
|
+
method: 'POST',
|
|
560
|
+
path: '/v1/host/sample/agents',
|
|
561
|
+
body,
|
|
562
|
+
...(opts.idempotencyKey ? { idempotencyKey: opts.idempotencyKey } : {}),
|
|
563
|
+
});
|
|
564
|
+
},
|
|
565
|
+
|
|
566
|
+
delete: async (agentId: string): Promise<boolean> => {
|
|
567
|
+
try {
|
|
568
|
+
await this.#request<void>({
|
|
569
|
+
method: 'DELETE',
|
|
570
|
+
path: `/v1/host/sample/agents/${encodeURIComponent(agentId)}`,
|
|
571
|
+
});
|
|
572
|
+
return true;
|
|
573
|
+
} catch (err) {
|
|
574
|
+
if (err instanceof WopError && err.status === 404) return false;
|
|
575
|
+
throw err;
|
|
576
|
+
}
|
|
577
|
+
},
|
|
578
|
+
|
|
579
|
+
listAvailablePacks: async (): Promise<AgentPackRegistryResponse | null> => {
|
|
580
|
+
try {
|
|
581
|
+
return await this.#request<AgentPackRegistryResponse>({
|
|
582
|
+
method: 'GET',
|
|
583
|
+
path: '/v1/host/sample/registry/agent-packs',
|
|
584
|
+
});
|
|
585
|
+
} catch (err) {
|
|
586
|
+
if (err instanceof WopError && err.status === 404) return null;
|
|
587
|
+
throw err;
|
|
588
|
+
}
|
|
589
|
+
},
|
|
590
|
+
|
|
591
|
+
installPack: async (
|
|
592
|
+
body: InstallAgentPackRequest,
|
|
593
|
+
): Promise<InstallAgentPackResponse> => {
|
|
594
|
+
return await this.#request<InstallAgentPackResponse>({
|
|
595
|
+
method: 'POST',
|
|
596
|
+
path: '/v1/host/sample/registry/agent-packs/install',
|
|
597
|
+
body,
|
|
598
|
+
});
|
|
599
|
+
},
|
|
600
|
+
};
|
|
601
|
+
|
|
360
602
|
// ── HITL interrupts (run-scoped + signed-token) ──────────────────────
|
|
361
603
|
readonly interrupts = {
|
|
362
604
|
resolveByRun: (
|
|
@@ -484,15 +726,24 @@ export class OpenwopClient {
|
|
|
484
726
|
* `version`; supply `libraryId` to disambiguate when multiple installed
|
|
485
727
|
* packs ship the same templateId.
|
|
486
728
|
*/
|
|
487
|
-
get: (req: GetPromptRequest): Promise<PromptTemplate> => {
|
|
729
|
+
get: async (req: GetPromptRequest): Promise<PromptTemplate | null> => {
|
|
488
730
|
const search = new URLSearchParams();
|
|
489
731
|
if (req.version) search.set('version', req.version);
|
|
490
732
|
if (req.libraryId) search.set('libraryId', req.libraryId);
|
|
491
733
|
const query = search.toString();
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
734
|
+
try {
|
|
735
|
+
return await this.#request<PromptTemplate>({
|
|
736
|
+
method: 'GET',
|
|
737
|
+
path: `/v1/prompts/${encodeURIComponent(req.templateId)}${query ? `?${query}` : ''}`,
|
|
738
|
+
});
|
|
739
|
+
} catch (err) {
|
|
740
|
+
// Return null on 404 (no such template), consistent with the other
|
|
741
|
+
// get-by-id methods (`agents.get`, `tools.get`, …) and the Python/Go
|
|
742
|
+
// SDKs; a `400 prompt_ref_ambiguous` and other errors still throw so
|
|
743
|
+
// callers can distinguish "not found" from "ambiguous reference".
|
|
744
|
+
if (err instanceof WopError && err.status === 404) return null;
|
|
745
|
+
throw err;
|
|
746
|
+
}
|
|
496
747
|
},
|
|
497
748
|
|
|
498
749
|
/**
|
|
@@ -606,7 +857,7 @@ export class OpenwopClient {
|
|
|
606
857
|
});
|
|
607
858
|
return res.files;
|
|
608
859
|
} catch (err) {
|
|
609
|
-
if (err instanceof
|
|
860
|
+
if (err instanceof WopError && err.status === 501) return null;
|
|
610
861
|
throw err;
|
|
611
862
|
}
|
|
612
863
|
},
|
|
@@ -627,7 +878,7 @@ export class OpenwopClient {
|
|
|
627
878
|
path: `/v1/host/workspace/files/${encodeURIComponent(path)}${qs ? `?${qs}` : ''}`,
|
|
628
879
|
});
|
|
629
880
|
} catch (err) {
|
|
630
|
-
if (err instanceof
|
|
881
|
+
if (err instanceof WopError && (err.status === 404 || err.status === 501)) return null;
|
|
631
882
|
throw err;
|
|
632
883
|
}
|
|
633
884
|
},
|
|
@@ -668,7 +919,7 @@ export class OpenwopClient {
|
|
|
668
919
|
});
|
|
669
920
|
return true;
|
|
670
921
|
} catch (err) {
|
|
671
|
-
if (err instanceof
|
|
922
|
+
if (err instanceof WopError && (err.status === 404 || err.status === 501)) return false;
|
|
672
923
|
throw err;
|
|
673
924
|
}
|
|
674
925
|
},
|
package/src/index.ts
CHANGED
|
@@ -69,6 +69,36 @@ export type {
|
|
|
69
69
|
PromptVariable,
|
|
70
70
|
RenderPromptRequest,
|
|
71
71
|
RenderPromptResponse,
|
|
72
|
+
// RFC 0072 §A — Manifest-agent inventory (GET /v1/agents).
|
|
73
|
+
// Consumed by the workflow-engine sample app's Agents tab + chat
|
|
74
|
+
// `@` mention picker (2026-05-28 mention-symbol swap).
|
|
75
|
+
AgentInventoryEntry,
|
|
76
|
+
AgentInventoryResponse,
|
|
77
|
+
// RFC 0081 — Agent evaluation (spec/v1/agent-evaluation.md). EvalSummary
|
|
78
|
+
// scorecard read via `client.runs.evalSummary(runId)` for a `mode:'eval'` run.
|
|
79
|
+
AgentModelClass,
|
|
80
|
+
EvalSafetyFinding,
|
|
81
|
+
EvalTaskResult,
|
|
82
|
+
EvalRegression,
|
|
83
|
+
EvalSummary,
|
|
84
|
+
// RFC 0078 — Portable tool catalog (spec/v1/tool-catalog.md).
|
|
85
|
+
// `client.tools.list` / `client.tools.get`.
|
|
86
|
+
ToolDescriptor,
|
|
87
|
+
// RFC 0082 — Agent deployment lifecycle (spec/v1/agent-deployment.md).
|
|
88
|
+
// `client.agents.listDeployments` / `transitionDeployment`.
|
|
89
|
+
DeploymentState,
|
|
90
|
+
AgentDeployment,
|
|
91
|
+
AgentDeploymentTransition,
|
|
92
|
+
// Sample-extension surface — user-authored agents
|
|
93
|
+
// (`POST /v1/host/sample/agents`) + agent-pack registry browser
|
|
94
|
+
// (`GET/POST /v1/host/sample/registry/agent-packs`). Non-normative;
|
|
95
|
+
// wraps host-extension routes the sample app authors against.
|
|
96
|
+
CreateUserAgentRequest,
|
|
97
|
+
UserAgentRecord,
|
|
98
|
+
AgentPackSummary,
|
|
99
|
+
AgentPackRegistryResponse,
|
|
100
|
+
InstallAgentPackRequest,
|
|
101
|
+
InstallAgentPackResponse,
|
|
72
102
|
} from './types.js';
|
|
73
103
|
export { streamEvents } from './sse.js';
|
|
74
104
|
export type { EventsStreamContext, EventsStreamOptions } from './sse.js';
|
package/src/types.ts
CHANGED
|
@@ -125,7 +125,12 @@ export interface RunConfigurable {
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
export interface CreateRunRequest {
|
|
128
|
-
|
|
128
|
+
/**
|
|
129
|
+
* The workflow to run. Required for a normal run; OMITTED for an eval run
|
|
130
|
+
* (`mode: 'eval'`), which targets `agentId` + `evalSuiteRef` instead
|
|
131
|
+
* (RFC 0081 §B). The server enforces the conditional requirement.
|
|
132
|
+
*/
|
|
133
|
+
workflowId?: string;
|
|
129
134
|
inputs?: Record<string, unknown>;
|
|
130
135
|
tenantId?: string;
|
|
131
136
|
scopeId?: string;
|
|
@@ -133,6 +138,12 @@ export interface CreateRunRequest {
|
|
|
133
138
|
configurable?: RunConfigurable;
|
|
134
139
|
tags?: readonly string[];
|
|
135
140
|
metadata?: Record<string, unknown>;
|
|
141
|
+
/** RFC 0081 §B. `'eval'` makes this run an eval-suite projection (see `evalSuiteRef` + `agentId`). Omit for a normal workflow run. */
|
|
142
|
+
mode?: 'eval';
|
|
143
|
+
/** RFC 0081. URI of the `AgentEvalSuite` to run. Required when `mode === 'eval'`. */
|
|
144
|
+
evalSuiteRef?: string;
|
|
145
|
+
/** RFC 0081. The manifest agent the eval suite targets. Required when `mode === 'eval'`. */
|
|
146
|
+
agentId?: string;
|
|
136
147
|
}
|
|
137
148
|
|
|
138
149
|
export interface CreateRunResponse {
|
|
@@ -1054,3 +1065,266 @@ export interface AgentInventoryResponse {
|
|
|
1054
1065
|
agents: AgentInventoryEntry[];
|
|
1055
1066
|
total: number;
|
|
1056
1067
|
}
|
|
1068
|
+
|
|
1069
|
+
/* ── Standing agent roster + org-chart (RFC 0086 / 0087) ──────────────── */
|
|
1070
|
+
|
|
1071
|
+
/** RFC 0086 §A — a standing agent INSTANCE: a `host:<id>` AgentRef that
|
|
1072
|
+
* references a manifest/deployment and owns a workflow portfolio. */
|
|
1073
|
+
export interface AgentRosterEntry {
|
|
1074
|
+
rosterId: string;
|
|
1075
|
+
persona: string;
|
|
1076
|
+
agentRef: { agentId: string; version?: string; channel?: string };
|
|
1077
|
+
workflows?: string[];
|
|
1078
|
+
owner: { tenantId: string; workspaceId?: string };
|
|
1079
|
+
enabled?: boolean;
|
|
1080
|
+
label?: string;
|
|
1081
|
+
description?: string;
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
/** Response for `GET /v1/agents/roster` (RFC 0086 §B). */
|
|
1085
|
+
export interface AgentRosterResponse {
|
|
1086
|
+
roster: AgentRosterEntry[];
|
|
1087
|
+
total: number;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
/** RFC 0087 §A — an org-chart department (a tree node via `parentDepartmentId`). */
|
|
1091
|
+
export interface OrgChartDepartment {
|
|
1092
|
+
departmentId: string;
|
|
1093
|
+
name: string;
|
|
1094
|
+
parentDepartmentId: string | null;
|
|
1095
|
+
roles: { roleId: string; name: string }[];
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
/** RFC 0087 §A — an org-chart member (a roster instance placed in a dept/role). */
|
|
1099
|
+
export interface OrgChartMember {
|
|
1100
|
+
rosterId: string;
|
|
1101
|
+
departmentId: string;
|
|
1102
|
+
roleId: string;
|
|
1103
|
+
reportsTo: string | null;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
/** RFC 0087 §A — the descriptive org-chart over roster members. Carries no
|
|
1107
|
+
* authority-bearing field by design (§B `org-position-no-authority-escalation`). */
|
|
1108
|
+
export interface AgentOrgChart {
|
|
1109
|
+
owner: { tenantId: string; workspaceId?: string };
|
|
1110
|
+
departments: OrgChartDepartment[];
|
|
1111
|
+
members: OrgChartMember[];
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
/** Response for `GET /v1/agents/org-chart/{departmentId}` (RFC 0087 §D) — the
|
|
1115
|
+
* department subtree + the responsibility roll-up (union of member portfolios). */
|
|
1116
|
+
export interface OrgChartResponsibilityView {
|
|
1117
|
+
department: OrgChartDepartment;
|
|
1118
|
+
members: OrgChartMember[];
|
|
1119
|
+
responsibilities: string[];
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
/* ── User-authored agents (sample-extension; non-normative) ─────────────
|
|
1123
|
+
* Backs the workflow-engine sample app's Agents tab. Pack-installed
|
|
1124
|
+
* agents come through `AgentInventoryEntry` above (RFC 0072 §A
|
|
1125
|
+
* normative inventory). The types below mirror the sample-host
|
|
1126
|
+
* `POST /v1/host/sample/agents` create surface — they're scoped to
|
|
1127
|
+
* the sample-extension and may evolve independently of the
|
|
1128
|
+
* normative agent surface. Future RFC promotion would migrate these
|
|
1129
|
+
* to the normative wire shape.
|
|
1130
|
+
*/
|
|
1131
|
+
|
|
1132
|
+
/** Body for `POST /v1/host/sample/agents`. The server synthesises
|
|
1133
|
+
* the agentId as `user.<tenantId>.<persona-slug>`. */
|
|
1134
|
+
export interface CreateUserAgentRequest {
|
|
1135
|
+
/** Short name; becomes the `@`-mention slug and chat panel label.
|
|
1136
|
+
* Required, ≤64 chars. */
|
|
1137
|
+
persona: string;
|
|
1138
|
+
/** Longer display name; defaults to the persona when omitted. */
|
|
1139
|
+
label?: string;
|
|
1140
|
+
description?: string;
|
|
1141
|
+
/** One of: `chat`, `reasoning`, `coding`, `extraction`. */
|
|
1142
|
+
modelClass: string;
|
|
1143
|
+
/** Inline system prompt body; ≤16 000 chars. The sample-host stores
|
|
1144
|
+
* it directly (no pack-file ref). */
|
|
1145
|
+
systemPrompt: string;
|
|
1146
|
+
/** Capability ids the agent is allowed to call; ≤32 entries. */
|
|
1147
|
+
toolAllowlist?: string[];
|
|
1148
|
+
memoryShape?: {
|
|
1149
|
+
scratchpad?: boolean;
|
|
1150
|
+
conversation?: boolean;
|
|
1151
|
+
longTerm?: boolean;
|
|
1152
|
+
};
|
|
1153
|
+
/** 0.0-1.0; decisions below this are surfaced as low-confidence. */
|
|
1154
|
+
confidenceThreshold?: number;
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
/** Response body for `POST /v1/host/sample/agents` — shaped to
|
|
1158
|
+
* match `AgentInventoryEntry` minus normative-only fields, so a
|
|
1159
|
+
* follow-up `GET /v1/agents` returns a row of the same shape. */
|
|
1160
|
+
export interface UserAgentRecord {
|
|
1161
|
+
agentId: string;
|
|
1162
|
+
persona: string;
|
|
1163
|
+
label: string;
|
|
1164
|
+
description?: string;
|
|
1165
|
+
modelClass: string;
|
|
1166
|
+
packName: string;
|
|
1167
|
+
packVersion: string;
|
|
1168
|
+
toolAllowlist: string[];
|
|
1169
|
+
memoryShape: {
|
|
1170
|
+
scratchpad: boolean;
|
|
1171
|
+
conversation: boolean;
|
|
1172
|
+
longTerm: boolean;
|
|
1173
|
+
};
|
|
1174
|
+
confidenceThreshold?: number;
|
|
1175
|
+
hasHandoffSchemas: false;
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
/** One installable agent-pack summary from the sample host's local
|
|
1179
|
+
* registry mirror (`GET /v1/host/sample/registry/agent-packs`). */
|
|
1180
|
+
export interface AgentPackSummary {
|
|
1181
|
+
/** Pack name, e.g. `core.openwop.agents.code-reviewer`. */
|
|
1182
|
+
name: string;
|
|
1183
|
+
version: string;
|
|
1184
|
+
description?: string;
|
|
1185
|
+
/** Personas declared by the pack's `agents[]` (per RFC 0003). */
|
|
1186
|
+
personas: string[];
|
|
1187
|
+
/** True when at least one of the pack's agents is registered in
|
|
1188
|
+
* this host's in-process AgentRegistry. */
|
|
1189
|
+
installed: boolean;
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
export interface AgentPackRegistryResponse {
|
|
1193
|
+
packs: AgentPackSummary[];
|
|
1194
|
+
total: number;
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
export interface InstallAgentPackRequest {
|
|
1198
|
+
/** Must start with `core.openwop.agents.` — the sample's install
|
|
1199
|
+
* route filters to that namespace. */
|
|
1200
|
+
name: string;
|
|
1201
|
+
/** Defaults to `1.0.0` when omitted. */
|
|
1202
|
+
version?: string;
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
export interface InstallAgentPackResponse {
|
|
1206
|
+
name: string;
|
|
1207
|
+
version: string;
|
|
1208
|
+
/** True when the pack was newly installed; false when it was
|
|
1209
|
+
* already present in the registry. */
|
|
1210
|
+
installed: boolean;
|
|
1211
|
+
alreadyInstalled: boolean;
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
// ── RFC 0081 — Agent evaluation (eval-summary.schema.json) ─────────────
|
|
1215
|
+
|
|
1216
|
+
/** Abstract model class (RFC 0002 / RFC 0003 manifest vocabulary). */
|
|
1217
|
+
export type AgentModelClass =
|
|
1218
|
+
| 'reasoning'
|
|
1219
|
+
| 'writing'
|
|
1220
|
+
| 'coding'
|
|
1221
|
+
| 'research'
|
|
1222
|
+
| 'classification'
|
|
1223
|
+
| 'general';
|
|
1224
|
+
|
|
1225
|
+
/** A redaction-safe safety finding ({kind, severity} descriptor — never excerpted content). */
|
|
1226
|
+
export interface EvalSafetyFinding {
|
|
1227
|
+
kind: string;
|
|
1228
|
+
severity: 'low' | 'medium' | 'high' | 'critical';
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
/** Per-task result on an `EvalSummary` (content-free: scores + scalars + ids). */
|
|
1232
|
+
export interface EvalTaskResult {
|
|
1233
|
+
taskId: string;
|
|
1234
|
+
score: number;
|
|
1235
|
+
passed: boolean;
|
|
1236
|
+
costUsd?: number;
|
|
1237
|
+
latencyMs?: number;
|
|
1238
|
+
schemaValid?: boolean;
|
|
1239
|
+
safetyFindings?: readonly EvalSafetyFinding[];
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
/** The regression block on an `EvalSummary` (RFC 0081 §D `regression` mode). */
|
|
1243
|
+
export interface EvalRegression {
|
|
1244
|
+
baselineRunId: string;
|
|
1245
|
+
scoreDelta: number;
|
|
1246
|
+
diffRef?: string;
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
/**
|
|
1250
|
+
* RFC 0081 §C — the terminal scorecard of an eval run, read via
|
|
1251
|
+
* `client.runs.evalSummary(runId)`. Content-free: scores, scalars, ids, and
|
|
1252
|
+
* redaction-safe safety descriptors only (`eval-summary-no-content-leak`).
|
|
1253
|
+
*/
|
|
1254
|
+
export interface EvalSummary {
|
|
1255
|
+
suiteId: string;
|
|
1256
|
+
suiteVersion: string;
|
|
1257
|
+
evaluatedModelClass?: AgentModelClass;
|
|
1258
|
+
aggregateScore: number;
|
|
1259
|
+
passed: boolean;
|
|
1260
|
+
taskCount: number;
|
|
1261
|
+
passedCount: number;
|
|
1262
|
+
totalCostUsd?: number;
|
|
1263
|
+
tasks: readonly EvalTaskResult[];
|
|
1264
|
+
regression?: EvalRegression;
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
// ── RFC 0082 — Agent deployment lifecycle ─────────────────────────────
|
|
1268
|
+
|
|
1269
|
+
/** The seven-state deployment lifecycle (RFC 0082 §C). */
|
|
1270
|
+
export type DeploymentState =
|
|
1271
|
+
| 'draft'
|
|
1272
|
+
| 'test'
|
|
1273
|
+
| 'staged'
|
|
1274
|
+
| 'active'
|
|
1275
|
+
| 'paused'
|
|
1276
|
+
| 'deprecated'
|
|
1277
|
+
| 'rolled-back';
|
|
1278
|
+
|
|
1279
|
+
/**
|
|
1280
|
+
* RFC 0078 §B — a portable tool descriptor as projected onto the host's
|
|
1281
|
+
* `GET /v1/tools` catalog. Source-agnostic (node-pack / workflow / mcp /
|
|
1282
|
+
* connector / host-extension); `safetyTier`, `egress`, and `approval` let a
|
|
1283
|
+
* caller reason about a tool's blast radius before invoking it.
|
|
1284
|
+
*/
|
|
1285
|
+
export interface ToolDescriptor {
|
|
1286
|
+
toolId: string;
|
|
1287
|
+
source: 'node-pack' | 'workflow' | 'mcp' | 'connector' | 'host-extension';
|
|
1288
|
+
title?: string;
|
|
1289
|
+
description?: string;
|
|
1290
|
+
inputSchema?: Record<string, unknown>;
|
|
1291
|
+
outputSchema?: Record<string, unknown>;
|
|
1292
|
+
auth?: Record<string, unknown>;
|
|
1293
|
+
egress?: 'none' | 'safe-fetch' | 'host-mediated' | 'host-owned';
|
|
1294
|
+
approval?: 'never' | 'conditional' | 'always';
|
|
1295
|
+
replayPolicy?: 'deterministic' | 'idempotent' | 'non-deterministic';
|
|
1296
|
+
safetyTier: 'pure' | 'read' | 'write' | 'exec';
|
|
1297
|
+
costHint?: string;
|
|
1298
|
+
latencyHint?: string;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
/**
|
|
1302
|
+
* RFC 0082 §C — a per-(agentId, version) deployment record, returned by
|
|
1303
|
+
* `client.agents.listDeployments` / `transitionDeployment`. Host-runtime state
|
|
1304
|
+
* distinct from the immutable manifest and the registry's published tags.
|
|
1305
|
+
*/
|
|
1306
|
+
export interface AgentDeployment {
|
|
1307
|
+
agentId: string;
|
|
1308
|
+
version: string;
|
|
1309
|
+
state: DeploymentState;
|
|
1310
|
+
canaryPercent?: number;
|
|
1311
|
+
rollbackPointer?: string;
|
|
1312
|
+
channels?: readonly string[];
|
|
1313
|
+
evalRunId?: string;
|
|
1314
|
+
approvalGateId?: string;
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
/**
|
|
1318
|
+
* RFC 0082 §E — the `transitionDeployment` request body. The host authorizes it
|
|
1319
|
+
* fail-closed (RFC 0049 `deploy:*`), runs any RFC 0051 approvalGate, and enforces
|
|
1320
|
+
* RFC 0081 `requiredEval` before emitting `deployment.promoted`.
|
|
1321
|
+
*/
|
|
1322
|
+
export interface AgentDeploymentTransition {
|
|
1323
|
+
version: string;
|
|
1324
|
+
transition: 'promote' | 'pause' | 'deprecate' | 'rollback' | 'adjust-canary';
|
|
1325
|
+
toState?: DeploymentState;
|
|
1326
|
+
channel?: string;
|
|
1327
|
+
canaryPercent?: number;
|
|
1328
|
+
evalRunId?: string;
|
|
1329
|
+
reason?: string;
|
|
1330
|
+
}
|