@openwop/openwop 1.1.3 → 1.1.5

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/src/types.ts CHANGED
@@ -32,6 +32,10 @@ export interface Capabilities {
32
32
  schemaRounds: number;
33
33
  envelopesPerTurn: number;
34
34
  maxNodeExecutions?: number;
35
+ /** RFC 0058. Engine-side wall-clock ceiling per run (ms); upper bound for `RunConfigurable.runTimeoutMs`. */
36
+ maxRunDurationMs?: number;
37
+ /** RFC 0058. Engine-side agent-loop iteration ceiling; upper bound for `RunConfigurable.maxLoopIterations`. */
38
+ maxLoopIterations?: number;
35
39
  };
36
40
  extensions?: Record<string, unknown>;
37
41
  // Network-handshake superset (all `(future)` fields per capabilities.md)
@@ -44,6 +48,22 @@ export interface Capabilities {
44
48
  minClientVersion?: string;
45
49
  }
46
50
 
51
+ /**
52
+ * The `kind` discriminator on a `cap.breached` event payload
53
+ * (`run-event-payloads.schema.json#capBreached`). The four engine kinds, the
54
+ * RFC 0008 §K `wasm-*` runtime caps, and the RFC 0058 run-scoped bounds.
55
+ */
56
+ export type CapBreachedKind =
57
+ | 'clarification'
58
+ | 'schema'
59
+ | 'envelopes'
60
+ | 'node-executions'
61
+ | 'wasm-memory'
62
+ | 'wasm-fuel'
63
+ | 'wasm-execution-time'
64
+ | 'run-duration'
65
+ | 'loop-iterations';
66
+
47
67
  export interface RunSnapshot {
48
68
  runId: string;
49
69
  workflowId: string;
@@ -83,6 +103,15 @@ export interface RunSnapshot {
83
103
  export interface RunConfigurable {
84
104
  /** Override the per-run node-execution ceiling. Clamped server-side. */
85
105
  recursionLimit?: number;
106
+ /** RFC 0058. Wall-clock run deadline (ms from `run.started`); clamped to
107
+ * `Capabilities.limits.maxRunDurationMs`. Breach → `cap.breached
108
+ * { kind: 'run-duration' }` + `run_timeout`. */
109
+ runTimeoutMs?: number;
110
+ /** RFC 0058. Agent-loop iteration ceiling (one per orchestrator turn);
111
+ * clamped to `Capabilities.limits.maxLoopIterations`. Breach →
112
+ * `cap.breached { kind: 'loop-iterations' }` + `loop_limit_exceeded`.
113
+ * Ignored unless the host advertises `capabilities.agents.loop.supported`. */
114
+ maxLoopIterations?: number;
86
115
  /** Override AI model for nodes that consume `ctx.config.configurable.model`. */
87
116
  model?: string;
88
117
  /** Override AI temperature (server SHOULD enforce 0..2). */
@@ -254,6 +283,99 @@ export interface ForkRunResponse {
254
283
  eventsUrl: string;
255
284
  }
256
285
 
286
+ /** RFC 0056 — a non-blocking quality signal on a run/event/node. */
287
+ export type AnnotationSignal =
288
+ | { kind: 'rating'; rating: number }
289
+ | { kind: 'flag' }
290
+ | { kind: 'label'; label: string }
291
+ | { kind: 'correction'; correction: string };
292
+
293
+ /** RFC 0056 persisted annotation (`annotation.schema.json`). A side-resource —
294
+ * not a replayable run-event-log entry. */
295
+ export interface Annotation {
296
+ annotationId: string;
297
+ target: { runId: string; eventId?: string; nodeId?: string };
298
+ signal: AnnotationSignal;
299
+ actor: { principalRef: string };
300
+ note?: string;
301
+ createdAt: string;
302
+ }
303
+
304
+ /** RFC 0056 request body for `createAnnotation` (`annotation-create.schema.json`).
305
+ * The host assigns `annotationId`/`createdAt`/`actor` and binds `target.runId`. */
306
+ export interface CreateAnnotationRequest {
307
+ target?: { eventId?: string; nodeId?: string };
308
+ signal: AnnotationSignal;
309
+ note?: string;
310
+ }
311
+
312
+ /** RFC 0059 versioned, tenant·workspace-scoped ground-truth file
313
+ * (`workspace-file.schema.json`). The `list` endpoint returns this shape
314
+ * minus `content` (metadata only). */
315
+ export interface WorkspaceFile {
316
+ path: string;
317
+ content: string;
318
+ contentType?: string;
319
+ version: number;
320
+ etag?: string;
321
+ updatedAt: string;
322
+ }
323
+
324
+ /** RFC 0059 request body for `putWorkspaceFile` (`workspace-file-create.schema.json`).
325
+ * `path` is URL-bound; the host assigns `version`/`etag`/`updatedAt`.
326
+ * Optimistic concurrency is expressed via the `If-Match` header, not the body. */
327
+ export interface PutWorkspaceFileRequest {
328
+ content: string;
329
+ contentType?: string;
330
+ }
331
+
332
+ /**
333
+ * Response from `GET /v1/runs/{runId}/ancestry` — RFC 0040 §C cross-host
334
+ * composition parent. `parent: null` for top-level runs (not dispatched
335
+ * from any other run); otherwise `parent.wellKnownUrl` is set when the
336
+ * parent is on a different host so callers can walk the chain.
337
+ *
338
+ * Capability-gated: hosts not advertising
339
+ * `capabilities.multiAgent.executionModel.crossHostCausation.ancestryEndpointSupported: true`
340
+ * return 404; the SDK surfaces that as `null` via `runs.ancestry()`.
341
+ */
342
+ export interface RunAncestryResponse {
343
+ runId: string;
344
+ hostId: string;
345
+ parent: null | {
346
+ runId: string;
347
+ hostId: string;
348
+ wellKnownUrl?: string;
349
+ cause: 'mcp-tool-call' | 'a2a-message' | 'core.subWorkflow' | 'core.dispatch';
350
+ };
351
+ }
352
+
353
+ /** RFC 0054 — response from `GET /v1/runs/{runId}:diff?against={otherRunId}`.
354
+ * Mirror of `run-diff-response.schema.json`. Deterministic, replay-aware
355
+ * structured diff of two runs' event sequences + terminal states. */
356
+ export interface RunDiffEventDiff {
357
+ seq: number;
358
+ op: 'added' | 'removed' | 'changed';
359
+ /** Present unless `op === 'added'`. */
360
+ aEvent?: RunEventDoc;
361
+ /** Present unless `op === 'removed'`. */
362
+ bEvent?: RunEventDoc;
363
+ }
364
+
365
+ export interface RunDiffResponse {
366
+ /** The `{runId}` run. */
367
+ a: string;
368
+ /** The `against` run. */
369
+ b: string;
370
+ /** Sequence at which the logs first diverge; null if identical. */
371
+ divergedAtSeq: number | null;
372
+ eventDiffs: RunDiffEventDiff[];
373
+ /** Diff of terminal RunSnapshot states (redaction-safe). */
374
+ stateDiff: Record<string, unknown>;
375
+ /** True if either run was in-flight and only a prefix was compared. */
376
+ truncated?: boolean;
377
+ }
378
+
257
379
  export interface ResolveInterruptRequest {
258
380
  resumeValue: unknown;
259
381
  }
@@ -568,6 +690,19 @@ export interface AgentDecidedPayload {
568
690
  [key: string]: unknown;
569
691
  }
570
692
 
693
+ /** `memory.written` payload (RFC 0057). Content-free per-write attribution:
694
+ * identifiers + non-secret tags only — never the entry content (the read
695
+ * side serves that, already SR-1-redacted). `nodeId` is omitted for host
696
+ * session-end writes with no node attribution. */
697
+ export interface MemoryWrittenPayload {
698
+ memoryRef: string;
699
+ memoryId: string;
700
+ nodeId?: string;
701
+ agentId?: string;
702
+ tags?: string[];
703
+ [key: string]: unknown;
704
+ }
705
+
571
706
  /** A `RunEventDoc` narrowed to a specific event-type discriminator +
572
707
  * payload shape. Returned by the `isAgent*` type guards in
573
708
  * `event-helpers.ts`. */
@@ -892,3 +1027,30 @@ function extractTraceId(traceparent: string): string | undefined {
892
1027
  if (!traceId || !/^[0-9a-f]{32}$/i.test(traceId)) return undefined;
893
1028
  return traceId;
894
1029
  }
1030
+
1031
+ /**
1032
+ * One installed manifest agent, as projected by `GET /v1/agents` /
1033
+ * `GET /v1/agents/{agentId}` (RFC 0072 §A). Read-only — never carries the
1034
+ * system-prompt body, resolved handoff schemas, or credential material (SR-1).
1035
+ */
1036
+ export interface AgentInventoryEntry {
1037
+ agentId: string;
1038
+ persona: string;
1039
+ label: string;
1040
+ description?: string;
1041
+ modelClass: string;
1042
+ packName: string;
1043
+ packVersion: string;
1044
+ toolAllowlist: string[];
1045
+ hasHandoffSchemas: boolean;
1046
+ memoryShape?: { scratchpad?: boolean; conversation?: boolean; longTerm?: boolean };
1047
+ confidenceThreshold?: number;
1048
+ /** RFC 0072 §C — optional capability tiers this host does not satisfy, inert here. */
1049
+ degraded?: string[];
1050
+ }
1051
+
1052
+ /** Response body for `GET /v1/agents` (RFC 0072 §A). */
1053
+ export interface AgentInventoryResponse {
1054
+ agents: AgentInventoryEntry[];
1055
+ total: number;
1056
+ }