@ancplua/qyl-api-schema 7.0.0 → 7.1.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.
@@ -76,6 +76,18 @@ export type WorkflowEdgeCursor = string & {
76
76
  export type WorkflowCommandId = string & {
77
77
  readonly __brand: "WorkflowCommandId";
78
78
  };
79
+ export type AgentDiagnosticVariableName = string & {
80
+ readonly __brand: "AgentDiagnosticVariableName";
81
+ };
82
+ export type AgentDiagnosticCheckId = string & {
83
+ readonly __brand: "AgentDiagnosticCheckId";
84
+ };
85
+ export type AgentDiagnosticSnapshotId = string & {
86
+ readonly __brand: "AgentDiagnosticSnapshotId";
87
+ };
88
+ export type AgentDiagnosticProbeId = string & {
89
+ readonly __brand: "AgentDiagnosticProbeId";
90
+ };
79
91
  export declare const ProblemDetailsMediaType: "application/problem+json";
80
92
  export type ProblemDetailsMediaType = typeof ProblemDetailsMediaType;
81
93
  export declare const SortOrderValues: {
@@ -510,6 +522,56 @@ export declare const WorkflowToolCallStatusValues: {
510
522
  readonly rejected: "rejected";
511
523
  };
512
524
  export type WorkflowToolCallStatus = typeof WorkflowToolCallStatusValues[keyof typeof WorkflowToolCallStatusValues];
525
+ export declare const AgentDiagnosticValueTypeValues: {
526
+ readonly null: "null";
527
+ readonly boolean: "boolean";
528
+ readonly integer: "integer";
529
+ readonly number: "number";
530
+ readonly string: "string";
531
+ readonly json: "json";
532
+ };
533
+ export type AgentDiagnosticValueType = typeof AgentDiagnosticValueTypeValues[keyof typeof AgentDiagnosticValueTypeValues];
534
+ export declare const AgentDiagnosticClassificationValues: {
535
+ readonly public: "public";
536
+ readonly internal: "internal";
537
+ readonly sensitive: "sensitive";
538
+ readonly secret: "secret";
539
+ };
540
+ export type AgentDiagnosticClassification = typeof AgentDiagnosticClassificationValues[keyof typeof AgentDiagnosticClassificationValues];
541
+ export declare const AgentDiagnosticOperatorValues: {
542
+ readonly equal: "equal";
543
+ readonly notEqual: "not_equal";
544
+ readonly exists: "exists";
545
+ readonly typeIs: "type_is";
546
+ readonly contains: "contains";
547
+ readonly lessThan: "less_than";
548
+ readonly greaterThan: "greater_than";
549
+ };
550
+ export type AgentDiagnosticOperator = typeof AgentDiagnosticOperatorValues[keyof typeof AgentDiagnosticOperatorValues];
551
+ export declare const AgentDiagnosticCheckOutcomeValues: {
552
+ readonly pass: "pass";
553
+ readonly fail: "fail";
554
+ readonly unknownResult: "unknown";
555
+ };
556
+ export type AgentDiagnosticCheckOutcome = typeof AgentDiagnosticCheckOutcomeValues[keyof typeof AgentDiagnosticCheckOutcomeValues];
557
+ export declare const AgentDiagnosticExtensionIdValues: {
558
+ readonly snapshot: "qyl.agent.diagnostic.snapshot";
559
+ };
560
+ export type AgentDiagnosticExtensionId = typeof AgentDiagnosticExtensionIdValues[keyof typeof AgentDiagnosticExtensionIdValues];
561
+ export declare const AgentDiagnosticPhaseValues: {
562
+ readonly input: "input";
563
+ readonly output: "output";
564
+ readonly error: "error";
565
+ readonly checkpoint: "checkpoint";
566
+ };
567
+ export type AgentDiagnosticPhase = typeof AgentDiagnosticPhaseValues[keyof typeof AgentDiagnosticPhaseValues];
568
+ export declare const AgentDiagnosticOutcomeValues: {
569
+ readonly pass: "pass";
570
+ readonly fail: "fail";
571
+ readonly unknownResult: "unknown";
572
+ readonly notEvaluated: "not_evaluated";
573
+ };
574
+ export type AgentDiagnosticOutcome = typeof AgentDiagnosticOutcomeValues[keyof typeof AgentDiagnosticOutcomeValues];
513
575
  export declare const McpDataModeValues: {
514
576
  readonly live: "live";
515
577
  readonly demo: "demo";
@@ -542,6 +604,7 @@ export type WorkbenchExecutionUpdateEvents = WorkbenchExecutionRecord;
542
604
  export type WorkflowEdgeProvenance = RecordedWorkflowEdgeProvenance | DerivedWorkflowEdgeProvenance;
543
605
  export type WorkflowProjectionStatus = CommittedWorkflowProjectionStatus | RebuildingWorkflowProjectionStatus | UnavailableWorkflowProjectionStatus | CorruptWorkflowProjectionStatus;
544
606
  export type WorkflowStreamEvents = WorkflowJournalEvent | WorkflowHeartbeatEvent | WorkflowCursorGapEvent;
607
+ export type AgentDiagnosticVariable = CapturedAgentDiagnosticVariable | RedactedAgentDiagnosticVariable | OmittedAgentDiagnosticVariable;
545
608
  export type LogEvents = LogStreamEvent | HeartbeatEvent;
546
609
  export interface AttributeBytesValue {
547
610
  "type": "bytes";
@@ -1590,6 +1653,52 @@ export interface WorkflowProjectionCorruptError extends ProblemDetails {
1590
1653
  "title": "Workflow Projection Corrupt";
1591
1654
  "projection_status": WorkflowProjectionStatus;
1592
1655
  }
1656
+ export interface AgentDiagnosticVariableBase {
1657
+ "name": AgentDiagnosticVariableName;
1658
+ "type": AgentDiagnosticValueType;
1659
+ "classification": AgentDiagnosticClassification;
1660
+ }
1661
+ export interface CapturedAgentDiagnosticVariable extends AgentDiagnosticVariableBase {
1662
+ "capture": "value";
1663
+ "value": unknown | null;
1664
+ }
1665
+ export interface RedactedAgentDiagnosticVariable extends AgentDiagnosticVariableBase {
1666
+ "capture": "redacted";
1667
+ }
1668
+ export interface OmittedAgentDiagnosticVariable extends AgentDiagnosticVariableBase {
1669
+ "capture": "omitted";
1670
+ }
1671
+ export interface AgentDiagnosticCheckResult {
1672
+ "check_id": AgentDiagnosticCheckId;
1673
+ "operator": AgentDiagnosticOperator;
1674
+ "actual": AgentDiagnosticVariableName;
1675
+ "expected"?: AgentDiagnosticVariableName;
1676
+ "expected_type"?: AgentDiagnosticValueType;
1677
+ "outcome": AgentDiagnosticCheckOutcome;
1678
+ }
1679
+ export interface AgentDiagnosticSnapshot {
1680
+ "extension_id": AgentDiagnosticExtensionId;
1681
+ "format_version": number;
1682
+ "snapshot_id": AgentDiagnosticSnapshotId;
1683
+ "capture_nonce": string;
1684
+ "probe_id": AgentDiagnosticProbeId;
1685
+ "phase": AgentDiagnosticPhase;
1686
+ "variables": AgentDiagnosticVariable[];
1687
+ "checks": AgentDiagnosticCheckResult[];
1688
+ "outcome": AgentDiagnosticOutcome;
1689
+ }
1690
+ export interface AgentDiagnosticSnapshotSummary {
1691
+ "extension_id": AgentDiagnosticExtensionId;
1692
+ "format_version": number;
1693
+ "snapshot_id": AgentDiagnosticSnapshotId;
1694
+ "probe_id": AgentDiagnosticProbeId;
1695
+ "phase": AgentDiagnosticPhase;
1696
+ "outcome": AgentDiagnosticOutcome;
1697
+ "variable_count": number;
1698
+ "check_count": number;
1699
+ "failed_check_count": number;
1700
+ "content_ref": WorkflowContentRef;
1701
+ }
1593
1702
  export interface DisplayTracesInput {
1594
1703
  "trace_id"?: TraceId;
1595
1704
  "session_id"?: SessionId;
@@ -1719,6 +1828,41 @@ export interface FetchTelemetryOutput {
1719
1828
  "stats"?: McpDashboardStats;
1720
1829
  "mode": McpDataMode;
1721
1830
  }
1831
+ export interface GetActiveWorkflowRunInput {
1832
+ }
1833
+ export interface GetActiveWorkflowRunOutput {
1834
+ "active": boolean;
1835
+ "live_controls_available": boolean;
1836
+ "run_id"?: WorkflowRunId;
1837
+ "thread_id"?: string;
1838
+ "started_at"?: string;
1839
+ }
1840
+ export interface RecordDiagnosticSnapshotVariableInput {
1841
+ "name": AgentDiagnosticVariableName;
1842
+ "classification": AgentDiagnosticClassification;
1843
+ "value": unknown | null;
1844
+ }
1845
+ export interface RecordDiagnosticSnapshotCheckInput {
1846
+ "check_id": AgentDiagnosticCheckId;
1847
+ "operator": AgentDiagnosticOperator;
1848
+ "actual": AgentDiagnosticVariableName;
1849
+ "expected"?: AgentDiagnosticVariableName;
1850
+ "expected_type"?: AgentDiagnosticValueType;
1851
+ }
1852
+ export interface RecordDiagnosticSnapshotInput {
1853
+ "snapshot_id": AgentDiagnosticSnapshotId;
1854
+ "probe_id": AgentDiagnosticProbeId;
1855
+ "phase": AgentDiagnosticPhase;
1856
+ "variables": RecordDiagnosticSnapshotVariableInput[];
1857
+ "checks"?: RecordDiagnosticSnapshotCheckInput[];
1858
+ }
1859
+ export interface RecordDiagnosticSnapshotOutput {
1860
+ "recorded": boolean;
1861
+ "code": string;
1862
+ "snapshot_id": AgentDiagnosticSnapshotId;
1863
+ "event_id"?: WorkflowEventId;
1864
+ "field"?: string;
1865
+ }
1722
1866
  export interface ListWorkflowRunsInput {
1723
1867
  "status"?: WorkflowRunStatus;
1724
1868
  "cursor"?: WorkflowRunCursor;
@@ -1770,6 +1914,17 @@ export interface FetchWorkflowGraphUpdatesOutput {
1770
1914
  "content"?: WorkflowContent;
1771
1915
  "mode": McpDataMode;
1772
1916
  }
1917
+ export interface InspectWorkflowEventsInput {
1918
+ "run_id": WorkflowRunId;
1919
+ "after_sequence": WorkflowJournalPosition;
1920
+ "limit"?: number;
1921
+ "content_ref"?: WorkflowContentRef;
1922
+ }
1923
+ export interface InspectWorkflowEventsOutput {
1924
+ "page": WorkflowEventPage;
1925
+ "content"?: WorkflowContent;
1926
+ "mode": McpDataMode;
1927
+ }
1773
1928
  export interface ControlWorkflowRunInput {
1774
1929
  "run_id": WorkflowRunId;
1775
1930
  "action": WorkflowControlAction;
@@ -385,6 +385,49 @@ export const WorkflowToolCallStatusValues = {
385
385
  "failed": "failed",
386
386
  "rejected": "rejected",
387
387
  };
388
+ export const AgentDiagnosticValueTypeValues = {
389
+ "null": "null",
390
+ "boolean": "boolean",
391
+ "integer": "integer",
392
+ "number": "number",
393
+ "string": "string",
394
+ "json": "json",
395
+ };
396
+ export const AgentDiagnosticClassificationValues = {
397
+ "public": "public",
398
+ "internal": "internal",
399
+ "sensitive": "sensitive",
400
+ "secret": "secret",
401
+ };
402
+ export const AgentDiagnosticOperatorValues = {
403
+ "equal": "equal",
404
+ "notEqual": "not_equal",
405
+ "exists": "exists",
406
+ "typeIs": "type_is",
407
+ "contains": "contains",
408
+ "lessThan": "less_than",
409
+ "greaterThan": "greater_than",
410
+ };
411
+ export const AgentDiagnosticCheckOutcomeValues = {
412
+ "pass": "pass",
413
+ "fail": "fail",
414
+ "unknownResult": "unknown",
415
+ };
416
+ export const AgentDiagnosticExtensionIdValues = {
417
+ "snapshot": "qyl.agent.diagnostic.snapshot",
418
+ };
419
+ export const AgentDiagnosticPhaseValues = {
420
+ "input": "input",
421
+ "output": "output",
422
+ "error": "error",
423
+ "checkpoint": "checkpoint",
424
+ };
425
+ export const AgentDiagnosticOutcomeValues = {
426
+ "pass": "pass",
427
+ "fail": "fail",
428
+ "unknownResult": "unknown",
429
+ "notEvaluated": "not_evaluated",
430
+ };
388
431
  export const McpDataModeValues = {
389
432
  "live": "live",
390
433
  "demo": "demo",
@@ -402,4 +445,4 @@ export const FetchTelemetryViewValues = {
402
445
  };
403
446
  // --- contract revision (scripts/emit-contract-revision.mjs) ---
404
447
  /** Revision of the API contract these types were emitted from; compare against HealthReport.contract_revision. */
405
- export const CONTRACT_REVISION = "sha256:53278018c62ed547";
448
+ export const CONTRACT_REVISION = "sha256:72545708596baccd";
package/index.tsp CHANGED
@@ -22,6 +22,7 @@ import "./models/health.tsp";
22
22
  import "./models/runner.tsp";
23
23
  import "./models/workbench.tsp";
24
24
  import "./models/workflow.tsp";
25
+ import "./models/diagnostics.tsp";
25
26
  import "./models/mcp-tools.tsp";
26
27
 
27
28
  import "./api/routes.tsp";
@@ -0,0 +1,204 @@
1
+ import "./workflow.tsp";
2
+
3
+ using Qyl.Api.Contracts.Workflow;
4
+
5
+ namespace Qyl.Api.Contracts.Diagnostics;
6
+
7
+ @doc("The versioned extension discriminator for a protected agent diagnostic snapshot.")
8
+ enum AgentDiagnosticExtensionId {
9
+ snapshot: "qyl.agent.diagnostic.snapshot",
10
+ }
11
+
12
+ @doc("Wire-format version of an agent diagnostic snapshot. Version 1 is the only accepted format.")
13
+ @minValue(1)
14
+ @maxValue(1)
15
+ scalar AgentDiagnosticFormatVersion extends int32;
16
+
17
+ @doc("Stable machine identifier of one diagnostic snapshot. This identifier is a value and must never be promoted to a telemetry key.")
18
+ @pattern("^[A-Za-z0-9_][A-Za-z0-9._:/\\[\\]-]{0,127}$")
19
+ @minLength(1)
20
+ @maxLength(128)
21
+ scalar AgentDiagnosticSnapshotId extends string;
22
+
23
+ @doc("Stable machine identifier of the probe that captured a diagnostic snapshot. This identifier is a value and must never be promoted to a telemetry key.")
24
+ @pattern("^[A-Za-z0-9_][A-Za-z0-9._:/\\[\\]-]{0,127}$")
25
+ @minLength(1)
26
+ @maxLength(128)
27
+ scalar AgentDiagnosticProbeId extends string;
28
+
29
+ @doc("Stable machine identifier of one diagnostic check. This identifier is a value and must never be promoted to a telemetry key.")
30
+ @pattern("^[A-Za-z0-9_][A-Za-z0-9._:/\\[\\]-]{0,127}$")
31
+ @minLength(1)
32
+ @maxLength(128)
33
+ scalar AgentDiagnosticCheckId extends string;
34
+
35
+ @doc("Stable machine name of one dynamically captured variable. Names are data values, never telemetry attribute keys, event names, or span names.")
36
+ @pattern("^[A-Za-z0-9_][A-Za-z0-9._:/\\[\\]-]{0,127}$")
37
+ @minLength(1)
38
+ @maxLength(128)
39
+ scalar AgentDiagnosticVariableName extends string;
40
+
41
+ @doc("Execution boundary at which the state frame was captured.")
42
+ enum AgentDiagnosticPhase {
43
+ input: "input",
44
+ output: "output",
45
+ error: "error",
46
+ checkpoint: "checkpoint",
47
+ }
48
+
49
+ @doc("Machine-computed aggregate result of a diagnostic snapshot. unknown reports one or more unknown check outcomes. not_evaluated is reserved for a snapshot whose checks array is empty.")
50
+ enum AgentDiagnosticOutcome {
51
+ pass: "pass",
52
+ fail: "fail",
53
+ unknownResult: "unknown",
54
+ notEvaluated: "not_evaluated",
55
+ }
56
+
57
+ @doc("Machine-computed result of one diagnostic check. For exists, an absent or null actual variable produces fail. For every other operator, missing required operands produce unknown; incompatible operand types also produce unknown. not_evaluated is deliberately not a check outcome.")
58
+ enum AgentDiagnosticCheckOutcome {
59
+ pass: "pass",
60
+ fail: "fail",
61
+ unknownResult: "unknown",
62
+ }
63
+
64
+ @doc("Declared JSON-level type of a diagnostic variable.")
65
+ enum AgentDiagnosticValueType {
66
+ null: "null",
67
+ boolean: "boolean",
68
+ integer: "integer",
69
+ number: "number",
70
+ string: "string",
71
+ json: "json",
72
+ }
73
+
74
+ @doc("Data-handling classification assigned before a diagnostic variable is captured.")
75
+ enum AgentDiagnosticClassification {
76
+ public: "public",
77
+ internal: "internal",
78
+ sensitive: "sensitive",
79
+ secret: "secret",
80
+ }
81
+
82
+ @doc("Closed operation evaluated by a diagnostic check. Checks are structural and never carry expression strings.")
83
+ enum AgentDiagnosticOperator {
84
+ equal: "equal",
85
+ notEqual: "not_equal",
86
+ exists: "exists",
87
+ typeIs: "type_is",
88
+ contains: "contains",
89
+ lessThan: "less_than",
90
+ greaterThan: "greater_than",
91
+ }
92
+
93
+ @doc("Common identity and policy fields for one dynamic diagnostic variable.")
94
+ model AgentDiagnosticVariableBase {
95
+ name: AgentDiagnosticVariableName;
96
+ type: AgentDiagnosticValueType;
97
+ classification: AgentDiagnosticClassification;
98
+ }
99
+
100
+ @doc("A variable whose typed JSON value is present in protected snapshot content. The value is required and must match type: null is JSON null; boolean is a JSON boolean; integer is a signed 64-bit JSON integer; number is a finite JSON number; string is a JSON string; json is a JSON object or array. The protected content boundary, not this model, controls access to all captured values.")
101
+ model CapturedAgentDiagnosticVariable extends AgentDiagnosticVariableBase {
102
+ capture: "value";
103
+ value: unknown | null;
104
+ }
105
+
106
+ @doc("A variable observed by the probe whose value was replaced by policy. A value field is forbidden.")
107
+ model RedactedAgentDiagnosticVariable extends AgentDiagnosticVariableBase {
108
+ capture: "redacted";
109
+ }
110
+
111
+ @doc("A variable whose value was unavailable or deliberately not captured. A value field is forbidden.")
112
+ model OmittedAgentDiagnosticVariable extends AgentDiagnosticVariableBase {
113
+ capture: "omitted";
114
+ }
115
+
116
+ @doc("One dynamically named variable in a protected diagnostic snapshot. Capture is the discriminator and makes value presence unambiguous.")
117
+ union AgentDiagnosticVariable {
118
+ value: CapturedAgentDiagnosticVariable,
119
+ redacted: RedactedAgentDiagnosticVariable,
120
+ omitted: OmittedAgentDiagnosticVariable,
121
+ }
122
+
123
+ @doc("One structural, machine-computed check result. actual and expected reference variable names only. For equal, not_equal, contains, less_than, and greater_than, expected is required and expected_type is omitted. For exists, both are omitted and an absent or null actual variable produces fail. For type_is, expected is omitted and expected_type is required. For operators other than exists, missing required operands produce unknown; incompatible operand types also produce unknown. not_evaluated is reserved for the snapshot aggregate when checks is empty and is not emitted for an individual check.")
124
+ model AgentDiagnosticCheckResult {
125
+ @encodedName("application/json", "check_id")
126
+ checkId: AgentDiagnosticCheckId;
127
+
128
+ operator: AgentDiagnosticOperator;
129
+ actual: AgentDiagnosticVariableName;
130
+ expected?: AgentDiagnosticVariableName;
131
+
132
+ @encodedName("application/json", "expected_type")
133
+ expectedType?: AgentDiagnosticValueType;
134
+
135
+ outcome: AgentDiagnosticCheckOutcome;
136
+ }
137
+
138
+ @doc("Version 1 protected JSON state frame captured for an artificial-intelligence agent. extension_id and format_version are its schema identity. capture_nonce is fresh entropy and is not a stable identifier. Variables and checks are bounded, dynamic names remain values, and no human-oriented message or expression text is part of the contract. Overall outcome is not_evaluated only when checks is empty. For a non-empty checks array it is fail if any check fails, otherwise unknown if any check is unknown, otherwise pass.")
139
+ model AgentDiagnosticSnapshot {
140
+ @encodedName("application/json", "extension_id")
141
+ extensionId: AgentDiagnosticExtensionId;
142
+
143
+ @encodedName("application/json", "format_version")
144
+ formatVersion: AgentDiagnosticFormatVersion;
145
+
146
+ @encodedName("application/json", "snapshot_id")
147
+ snapshotId: AgentDiagnosticSnapshotId;
148
+
149
+ @doc("Fresh 128-bit random nonce encoded as exactly 32 lowercase hexadecimal characters. It prevents equality inference across otherwise identical protected captures and must not be used as an identity key.")
150
+ @encodedName("application/json", "capture_nonce")
151
+ @pattern("^[0-9a-f]{32}$")
152
+ @minLength(32)
153
+ @maxLength(32)
154
+ captureNonce: string;
155
+
156
+ @encodedName("application/json", "probe_id")
157
+ probeId: AgentDiagnosticProbeId;
158
+
159
+ phase: AgentDiagnosticPhase;
160
+
161
+ @maxItems(64)
162
+ variables: AgentDiagnosticVariable[];
163
+
164
+ @maxItems(64)
165
+ checks: AgentDiagnosticCheckResult[];
166
+
167
+ outcome: AgentDiagnosticOutcome;
168
+ }
169
+
170
+ @doc("Value-free event-data projection for a protected agent diagnostic snapshot. Encode this shape in WorkflowEventAppend.data on the existing content_captured event kind. content_ref must also occur in that event's content_refs and identifies UTF-8 JSON conforming to AgentDiagnosticSnapshot. Counts are computed from the referenced snapshot; failed_check_count counts checks whose outcome is fail. No variable names, values, human messages, expressions, nonce, or classifications may appear in this summary.")
171
+ model AgentDiagnosticSnapshotSummary {
172
+ @encodedName("application/json", "extension_id")
173
+ extensionId: AgentDiagnosticExtensionId;
174
+
175
+ @encodedName("application/json", "format_version")
176
+ formatVersion: AgentDiagnosticFormatVersion;
177
+
178
+ @encodedName("application/json", "snapshot_id")
179
+ snapshotId: AgentDiagnosticSnapshotId;
180
+
181
+ @encodedName("application/json", "probe_id")
182
+ probeId: AgentDiagnosticProbeId;
183
+
184
+ phase: AgentDiagnosticPhase;
185
+ outcome: AgentDiagnosticOutcome;
186
+
187
+ @encodedName("application/json", "variable_count")
188
+ @minValue(0)
189
+ @maxValue(64)
190
+ variableCount: int32;
191
+
192
+ @encodedName("application/json", "check_count")
193
+ @minValue(0)
194
+ @maxValue(64)
195
+ checkCount: int32;
196
+
197
+ @encodedName("application/json", "failed_check_count")
198
+ @minValue(0)
199
+ @maxValue(64)
200
+ failedCheckCount: int32;
201
+
202
+ @encodedName("application/json", "content_ref")
203
+ contentRef: WorkflowContentRef;
204
+ }
@@ -1,10 +1,12 @@
1
1
  import "../common/types.tsp";
2
2
  import "../otel/logs.tsp";
3
3
  import "../otel/span.tsp";
4
+ import "./diagnostics.tsp";
4
5
  import "./session.tsp";
5
6
  import "./workflow.tsp";
6
7
 
7
8
  using Qyl.Api.Contracts.Common;
9
+ using Qyl.Api.Contracts.Diagnostics;
8
10
  using Qyl.Api.Contracts.Domains.Observe.Session;
9
11
  using Qyl.Api.Contracts.OTel.Logs;
10
12
  using Qyl.Api.Contracts.OTel.Traces;
@@ -218,6 +220,77 @@ model FetchTelemetryOutput {
218
220
  mode: McpDataMode;
219
221
  }
220
222
 
223
+ @doc("Input for get_active_workflow_run.")
224
+ model GetActiveWorkflowRunInput {}
225
+
226
+ @doc("Structured output for get_active_workflow_run.")
227
+ model GetActiveWorkflowRunOutput {
228
+ active: boolean;
229
+
230
+ @encodedName("application/json", "live_controls_available")
231
+ liveControlsAvailable: boolean;
232
+
233
+ @encodedName("application/json", "run_id")
234
+ runId?: WorkflowRunId;
235
+
236
+ @encodedName("application/json", "thread_id")
237
+ threadId?: string;
238
+
239
+ @encodedName("application/json", "started_at")
240
+ startedAt?: utcDateTime;
241
+ }
242
+
243
+ @doc("One dynamically named JSON value submitted for protected diagnostic capture. Classification is applied before the frame leaves the observer bridge.")
244
+ model RecordDiagnosticSnapshotVariableInput {
245
+ name: AgentDiagnosticVariableName;
246
+ classification: AgentDiagnosticClassification;
247
+ value: unknown | null;
248
+ }
249
+
250
+ @doc("One structural diagnostic check submitted for evaluation. equal, not_equal, contains, less_than, and greater_than require expected and forbid expected_type; type_is requires expected_type and forbids expected; exists forbids both.")
251
+ model RecordDiagnosticSnapshotCheckInput {
252
+ @encodedName("application/json", "check_id")
253
+ checkId: AgentDiagnosticCheckId;
254
+
255
+ operator: AgentDiagnosticOperator;
256
+ actual: AgentDiagnosticVariableName;
257
+ expected?: AgentDiagnosticVariableName;
258
+
259
+ @encodedName("application/json", "expected_type")
260
+ expectedType?: AgentDiagnosticValueType;
261
+ }
262
+
263
+ @doc("Input for record_diagnostic_snapshot. Reuse the same snapshot_id and semantic payload when retrying; changing the payload under an existing snapshot_id is a conflict.")
264
+ model RecordDiagnosticSnapshotInput {
265
+ @encodedName("application/json", "snapshot_id")
266
+ snapshotId: AgentDiagnosticSnapshotId;
267
+
268
+ @encodedName("application/json", "probe_id")
269
+ probeId: AgentDiagnosticProbeId;
270
+
271
+ phase: AgentDiagnosticPhase;
272
+
273
+ @maxItems(64)
274
+ variables: RecordDiagnosticSnapshotVariableInput[];
275
+
276
+ @maxItems(64)
277
+ checks?: RecordDiagnosticSnapshotCheckInput[] = #[];
278
+ }
279
+
280
+ @doc("Structured output for record_diagnostic_snapshot.")
281
+ model RecordDiagnosticSnapshotOutput {
282
+ recorded: boolean;
283
+ code: string;
284
+
285
+ @encodedName("application/json", "snapshot_id")
286
+ snapshotId: AgentDiagnosticSnapshotId;
287
+
288
+ @encodedName("application/json", "event_id")
289
+ eventId?: WorkflowEventId;
290
+
291
+ field?: string;
292
+ }
293
+
221
294
  @doc("Input for list_workflow_runs.")
222
295
  model ListWorkflowRunsInput {
223
296
  status?: WorkflowRunStatus;
@@ -354,6 +427,30 @@ model FetchWorkflowGraphUpdatesOutput {
354
427
  mode: McpDataMode;
355
428
  }
356
429
 
430
+ @doc("Input for inspect_workflow_events.")
431
+ model InspectWorkflowEventsInput {
432
+ @encodedName("application/json", "run_id")
433
+ runId: WorkflowRunId;
434
+
435
+ @encodedName("application/json", "after_sequence")
436
+ afterSequence: WorkflowJournalPosition;
437
+
438
+ @minValue(1)
439
+ @maxValue(1000)
440
+ limit?: int32 = 250;
441
+
442
+ @doc("Optional captured payload to retrieve lazily for the selected run.")
443
+ @encodedName("application/json", "content_ref")
444
+ contentRef?: WorkflowContentRef;
445
+ }
446
+
447
+ @doc("Structured output for inspect_workflow_events.")
448
+ model InspectWorkflowEventsOutput {
449
+ page: WorkflowEventPage;
450
+ content?: WorkflowContent;
451
+ mode: McpDataMode;
452
+ }
453
+
357
454
  @doc("Input for control_workflow_run.")
358
455
  model ControlWorkflowRunInput {
359
456
  @encodedName("application/json", "run_id")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ancplua/qyl-api-schema",
3
- "version": "7.0.0",
3
+ "version": "7.1.0",
4
4
  "description": "TypeSpec source of truth for qyl API contracts. Emits OpenAPI, JSON Schema, Qyl.Api.Contracts DTOs, and TypeScript contract types; not an OpenTelemetry package, storage schema, or server implementation.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -62,6 +62,7 @@
62
62
  "models/runner.tsp",
63
63
  "models/workbench.tsp",
64
64
  "models/workflow.tsp",
65
+ "models/diagnostics.tsp",
65
66
  "models/mcp-tools.tsp",
66
67
  "models/session.tsp",
67
68
  "otel/enums.tsp",
@@ -87,10 +88,11 @@
87
88
  "build:emitters": "tsc -p emitters/csharp && tsc -p emitters/ts-types && tsc -p emitters/qyl-lint",
88
89
  "build:ts-runtime": "tsc -p tsconfig.contracts.json",
89
90
  "build:json-schema": "node scripts/openapi-to-json-schema.mjs",
91
+ "emit:mcp-tool-schemas": "node scripts/emit-mcp-tool-schemas.mjs",
90
92
  "emit:contract-revision": "node scripts/emit-contract-revision.mjs",
91
93
  "prepare": "npm run build:emitters",
92
94
  "prepack": "npm run compile",
93
- "compile": "npm run clean:generated && npm run build:emitters && tsp compile main.tsp && npm run emit:contract-revision && npm run build:json-schema && npm run build:ts-runtime",
95
+ "compile": "npm run clean:generated && npm run build:emitters && tsp compile main.tsp && npm run emit:contract-revision && npm run build:json-schema && npm run emit:mcp-tool-schemas && npm run build:ts-runtime",
94
96
  "format": "tsp format **/*.tsp",
95
97
  "lint": "npm run build:emitters && tsp compile main.tsp --no-emit --warn-as-error",
96
98
  "lint:public": "npm run build:emitters && tsp compile index.tsp --no-emit --warn-as-error",
@@ -100,11 +102,11 @@
100
102
  },
101
103
  "peerDependencies": {
102
104
  "@typespec/compiler": "^1.13.0 || >=1.13.0-dev.0",
103
- "@typespec/events": "^0.83.0 || ^0.84.0",
105
+ "@typespec/events": "^0.83.0 || ^0.84.0 || ^0.85.0",
104
106
  "@typespec/http": "^1.13.0",
105
107
  "@typespec/openapi": "^1.13.0",
106
108
  "@typespec/openapi3": "^1.13.0",
107
- "@typespec/sse": ">=0.83.0 <0.85.0"
109
+ "@typespec/sse": ">=0.83.0 <0.86.0"
108
110
  },
109
111
  "peerDependenciesMeta": {
110
112
  "@typespec/compiler": {