@aionixone/client-agent 0.0.0-stage → 0.3.0-beta.3

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.
Files changed (44) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +11 -0
  3. package/README.md +42 -2
  4. package/dist/generated/catalog.d.ts +859 -0
  5. package/dist/generated/catalog.d.ts.map +1 -0
  6. package/dist/generated/catalog.js +855 -0
  7. package/dist/generated/catalog.js.map +1 -0
  8. package/dist/generated/index.d.ts +6 -0
  9. package/dist/generated/index.d.ts.map +1 -0
  10. package/dist/generated/index.js +7 -0
  11. package/dist/generated/index.js.map +1 -0
  12. package/dist/generated/schema_types.d.ts +133 -0
  13. package/dist/generated/schema_types.d.ts.map +1 -0
  14. package/dist/generated/schema_types.js +3 -0
  15. package/dist/generated/schema_types.js.map +1 -0
  16. package/dist/generated/service.d.ts +916 -0
  17. package/dist/generated/service.d.ts.map +1 -0
  18. package/dist/generated/service.js +1170 -0
  19. package/dist/generated/service.js.map +1 -0
  20. package/dist/generated/trn.d.ts +98 -0
  21. package/dist/generated/trn.d.ts.map +1 -0
  22. package/dist/generated/trn.js +359 -0
  23. package/dist/generated/trn.js.map +1 -0
  24. package/dist/generated/types.d.ts +427 -0
  25. package/dist/generated/types.d.ts.map +1 -0
  26. package/dist/generated/types.js +3 -0
  27. package/dist/generated/types.js.map +1 -0
  28. package/dist/index.d.ts +2 -0
  29. package/dist/index.d.ts.map +1 -0
  30. package/dist/index.js +2 -0
  31. package/dist/index.js.map +1 -0
  32. package/dist/session.d.ts +25 -0
  33. package/dist/session.d.ts.map +1 -0
  34. package/dist/session.js +67 -0
  35. package/dist/session.js.map +1 -0
  36. package/package.json +34 -4
  37. package/src/generated/catalog.ts +858 -0
  38. package/src/generated/index.ts +7 -0
  39. package/src/generated/schema_types.ts +134 -0
  40. package/src/generated/service.ts +1240 -0
  41. package/src/generated/trn.ts +517 -0
  42. package/src/generated/types.ts +500 -0
  43. package/src/index.ts +1 -0
  44. package/src/session.ts +124 -0
@@ -0,0 +1,1240 @@
1
+ // @generated by xtask ts-client-export; DO NOT EDIT
2
+
3
+ import { encodePathParam, withQuery } from '@aionixone/client-core';
4
+ import type { CallEngine, CallOptions, ExecutionCallOptions } from '@aionixone/client-core';
5
+ import { OPERATIONS } from './catalog.js';
6
+ import type { AgentMcpEndpointAccessRequirementListResponse, AgentMcpEndpointListQuery, AgentMcpEndpointListResponse, AgentMcpEndpointReadResponse, AgentProfileAccessRequirementListResponse, AgentProfileContextBudgetResolveResponse, AgentProfileInvokeResponse, AgentProfileListQuery, AgentProfileListResponse, AgentProfileReadResponse, AgentProfileStatisticsListQuery, AgentProfileStatisticsListResponse, AgentProfileStatisticsReadQuery, AgentProfileStatisticsReadResponse, AgentProfileThreadCreationRequirementReadResponse, AgentProfileToolStatisticsReadQuery, AgentProfileToolStatisticsReadResponse, AgentProfileVersionDeleteResponse, AgentProfileVersionListQuery, AgentProfileVersionListResponse, AgentProfileVersionReadResponse, AgentProfileVersionSetCurrentResponse, AgentPromptListQuery, AgentPromptListResponse, AgentPromptReadResponse, AgentPromptRuntimeReadResponse, AgentPromptRuntimeResolveResponse, AgentPromptVersionDeleteResponse, AgentPromptVersionListQuery, AgentPromptVersionListResponse, AgentPromptVersionReadResponse, AgentPromptVersionSetCurrentResponse, AgentSessionConnectResponse, AgentSkillListQuery, AgentSkillListResponse, AgentSkillReadResponse, AgentSkillVersionDeleteResponse, AgentSkillVersionFileReadQuery, AgentSkillVersionFileReadResponse, AgentSkillVersionListQuery, AgentSkillVersionListResponse, AgentSkillVersionPackageReadResponse, AgentSkillVersionReadResponse, AgentSkillVersionSetCurrentResponse, AgentThreadArchiveResponse, AgentThreadDeleteResponse, AgentThreadInterruptResponse, AgentThreadItemListQuery, AgentThreadItemListResponse, AgentThreadListQuery, AgentThreadListResponse, AgentThreadNotificationStreamQuery, AgentThreadNotificationStreamResponse, AgentThreadPendingInteractionAnswerResponse, AgentThreadPendingInteractionListResponse, AgentThreadReadResponse, AgentThreadRenameResponse, AgentThreadShutdownResponse, AgentThreadStatisticsReadQuery, AgentThreadStatisticsReadResponse, AgentThreadStatusReadResponse, AgentThreadStatusStreamQuery, AgentThreadStatusStreamResponse, AgentThreadToolStatisticsReadQuery, AgentThreadToolStatisticsReadResponse, AgentThreadTurnListQuery, AgentThreadTurnListResponse, AgentThreadUnarchiveResponse, AgentThreadUsageListQuery, AgentThreadUsageListResponse, AgentTurnAttachmentReadResponse, AgentTurnReadResponse } from './types.js';
7
+ import type { AgentProfileAccessRequirementsRequest, AgentProfileContextBudgetRequest, AgentProfileInvokeRequest, ArchiveThreadRequest, ConnectAgentSessionRequest, InterruptThreadRequest, McpEndpointAccessRequirementsRequest, ReadPromptRequest, RenameThreadRequest, ResolvePromptRequest, ResolveThreadInteractionRequest, ShutdownThreadRequest } from "@aionixone/client-types/agent";
8
+
9
+ /** The `agent` service. */
10
+ export class AgentService {
11
+ readonly mcpEndpoint: AgentMcpEndpointResource;
12
+ readonly profile: AgentProfileResource;
13
+ readonly prompt: AgentPromptResource;
14
+ readonly session: AgentSessionResource;
15
+ readonly skill: AgentSkillResource;
16
+ readonly thread: AgentThreadResource;
17
+ readonly turn: AgentTurnResource;
18
+
19
+ /** Not part of the public API: `AionixOne` constructs every service. */
20
+ constructor(engine: CallEngine) {
21
+ this.mcpEndpoint = new AgentMcpEndpointResource(engine);
22
+ this.profile = new AgentProfileResource(engine);
23
+ this.prompt = new AgentPromptResource(engine);
24
+ this.session = new AgentSessionResource(engine);
25
+ this.skill = new AgentSkillResource(engine);
26
+ this.thread = new AgentThreadResource(engine);
27
+ this.turn = new AgentTurnResource(engine);
28
+ }
29
+ }
30
+
31
+ /** The `mcpEndpoint` operations of the `agent` service. */
32
+ export class AgentMcpEndpointResource {
33
+ readonly #engine: CallEngine;
34
+
35
+ /** Not part of the public API. */
36
+ constructor(engine: CallEngine) {
37
+ this.#engine = engine;
38
+ }
39
+
40
+ /**
41
+ * List MCP endpoint access requirements
42
+ *
43
+ * List the permissions an MCP endpoint's runtime identity needs
44
+ *
45
+ * List the permissions an MCP endpoint's runtime identity needs, calculated from the saved endpoint or unsaved content.
46
+ *
47
+ * Replay: has no effect; retried after an attempt with an unknown result.
48
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Internal_PayloadTooLarge`, `Internal_UnsupportedMediaType`, `Agent_McpEndpointNotFound`.
49
+ *
50
+ * @param trn Agent TRN in the route path, for example trn:agent:tenant:test0001:profile/runtime-assistant, trn:agent:tenant:test0001:prompt/support-core, trn:agent:tenant:test0001:skill/support-docs, or trn:agent:tenant:test0001:thread/runtime-assistant/<thread_id> depending on the command
51
+ * @param body The request body.
52
+ * @param options Call options.
53
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
54
+ */
55
+ accessRequirementList(trn: string, body: McpEndpointAccessRequirementsRequest, options?: CallOptions): Promise<AgentMcpEndpointAccessRequirementListResponse> {
56
+ return this.#engine.call<AgentMcpEndpointAccessRequirementListResponse>(OPERATIONS.agent_mcp_endpoint_access_requirement_list, { path: `/mcp-endpoints/${encodePathParam(trn)}/access-requirements`, body, primaryResourceTrn: trn }, options);
57
+ }
58
+
59
+ /**
60
+ * List MCP endpoints
61
+ *
62
+ * List declarative agent MCP endpoints with optional tag filters and pagination.
63
+ *
64
+ * Replay: has no effect; retried after an attempt with an unknown result.
65
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`.
66
+ *
67
+ * @param query The query, by wire names.
68
+ * @param options Call options.
69
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
70
+ */
71
+ list(query?: AgentMcpEndpointListQuery, options?: CallOptions): Promise<AgentMcpEndpointListResponse> {
72
+ return this.#engine.call<AgentMcpEndpointListResponse>(OPERATIONS.agent_mcp_endpoint_list, { path: withQuery(`/mcp-endpoints`, query) }, options);
73
+ }
74
+
75
+ /**
76
+ * Every item of `agent.mcp-endpoint.list`, page after page, starting from `query`.
77
+ * Each page is one call with its own time budget and retries.
78
+ *
79
+ * @param query The query of the first page; `limit` is the size of every page.
80
+ * @param options Call options of every page.
81
+ */
82
+ async *listIter(query?: AgentMcpEndpointListQuery, options?: CallOptions): AsyncGenerator<AgentMcpEndpointListResponse['items'][number], void, undefined> {
83
+ let offset = query?.offset ?? 0;
84
+ for (;;) {
85
+ const response = await this.list({ ...query, offset }, options);
86
+ const page = response;
87
+ yield* page.items;
88
+ if (!page.hasMore) return;
89
+ offset += page.items.length;
90
+ }
91
+ }
92
+
93
+ /**
94
+ * Read MCP endpoint
95
+ *
96
+ * Get MCP endpoint
97
+ *
98
+ * Read one declarative MCP endpoint by TRN, including its tools and runtime ServiceAccount.
99
+ *
100
+ * Replay: has no effect; retried after an attempt with an unknown result.
101
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_McpEndpointNotFound`.
102
+ *
103
+ * @param trn Agent TRN in the route path, for example trn:agent:tenant:test0001:profile/runtime-assistant, trn:agent:tenant:test0001:prompt/support-core, trn:agent:tenant:test0001:skill/support-docs, or trn:agent:tenant:test0001:thread/runtime-assistant/<thread_id> depending on the command
104
+ * @param options Call options.
105
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
106
+ */
107
+ read(trn: string, options?: CallOptions): Promise<AgentMcpEndpointReadResponse> {
108
+ return this.#engine.call<AgentMcpEndpointReadResponse>(OPERATIONS.agent_mcp_endpoint_read, { path: `/mcp-endpoints/${encodePathParam(trn)}`, primaryResourceTrn: trn }, options);
109
+ }
110
+ }
111
+
112
+ /** The `profile` operations of the `agent` service. */
113
+ export class AgentProfileResource {
114
+ readonly #engine: CallEngine;
115
+
116
+ /** Not part of the public API. */
117
+ constructor(engine: CallEngine) {
118
+ this.#engine = engine;
119
+ }
120
+
121
+ /**
122
+ * List agent profile access requirements
123
+ *
124
+ * List the permissions an agent profile's runtime identity needs
125
+ *
126
+ * List the permissions an agent profile's runtime identity needs, calculated from the saved profile or unsaved content.
127
+ *
128
+ * Replay: has no effect; retried after an attempt with an unknown result.
129
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Internal_PayloadTooLarge`, `Internal_UnsupportedMediaType`, `Agent_ProfileNotFound`.
130
+ *
131
+ * @param trn Agent TRN in the route path, for example trn:agent:tenant:test0001:profile/runtime-assistant, trn:agent:tenant:test0001:prompt/support-core, trn:agent:tenant:test0001:skill/support-docs, or trn:agent:tenant:test0001:thread/runtime-assistant/<thread_id> depending on the command
132
+ * @param body The request body.
133
+ * @param options Call options.
134
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
135
+ */
136
+ accessRequirementList(trn: string, body: AgentProfileAccessRequirementsRequest, options?: CallOptions): Promise<AgentProfileAccessRequirementListResponse> {
137
+ return this.#engine.call<AgentProfileAccessRequirementListResponse>(OPERATIONS.agent_profile_access_requirement_list, { path: `/profiles/${encodePathParam(trn)}/access-requirements`, body, primaryResourceTrn: trn }, options);
138
+ }
139
+
140
+ /**
141
+ * Resolve Profile context budgets
142
+ *
143
+ * Resolve context budgets for a Profile draft
144
+ *
145
+ * Replay: has no effect; retried after an attempt with an unknown result.
146
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Internal_PayloadTooLarge`, `Internal_UnsupportedMediaType`.
147
+ *
148
+ * @param body The request body.
149
+ * @param options Call options.
150
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
151
+ */
152
+ contextBudgetResolve(body: AgentProfileContextBudgetRequest, options?: CallOptions): Promise<AgentProfileContextBudgetResolveResponse> {
153
+ return this.#engine.call<AgentProfileContextBudgetResolveResponse>(OPERATIONS.agent_profile_context_budget_resolve, { path: `/profiles:context-budget-resolve`, body }, options);
154
+ }
155
+
156
+ /**
157
+ * Invoke Profile
158
+ *
159
+ * Invoke an Agent Profile
160
+ *
161
+ * Submit a Turn to a Profile, optionally continuing an existing Thread.
162
+ *
163
+ * Replay: the idempotency key replays the accepted execution for 604800 seconds.
164
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Internal_PayloadTooLarge`, `Internal_UnsupportedMediaType`, `Agent_ThreadNotFound`, `Agent_ProfileNotFound`, `Agent_PromptNotFound`, `Agent_SkillNotFound`, `Agent_VersionNotFound`, `Internal_IdempotencyKeyReused`, `Internal_Conflict`.
165
+ *
166
+ * @param trn Agent TRN in the route path, for example trn:agent:tenant:test0001:profile/runtime-assistant, trn:agent:tenant:test0001:prompt/support-core, trn:agent:tenant:test0001:skill/support-docs, or trn:agent:tenant:test0001:thread/runtime-assistant/<thread_id> depending on the command
167
+ * @param body The request body.
168
+ * @param options Call options.
169
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
170
+ */
171
+ invoke(trn: string, body: AgentProfileInvokeRequest, options?: ExecutionCallOptions): Promise<AgentProfileInvokeResponse> {
172
+ return this.#engine.call<AgentProfileInvokeResponse>(OPERATIONS.agent_profile_invoke, { path: `/profiles/${encodePathParam(trn)}/invoke`, body, primaryResourceTrn: trn }, options);
173
+ }
174
+
175
+ /**
176
+ * List agent profiles
177
+ *
178
+ * List runtime-ready agent profiles with optional tag filters and pagination.
179
+ *
180
+ * Replay: has no effect; retried after an attempt with an unknown result.
181
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`.
182
+ *
183
+ * @param query The query, by wire names.
184
+ * @param options Call options.
185
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
186
+ */
187
+ list(query?: AgentProfileListQuery, options?: CallOptions): Promise<AgentProfileListResponse> {
188
+ return this.#engine.call<AgentProfileListResponse>(OPERATIONS.agent_profile_list, { path: withQuery(`/profiles`, query) }, options);
189
+ }
190
+
191
+ /**
192
+ * Every item of `agent.profile.list`, page after page, starting from `query`.
193
+ * Each page is one call with its own time budget and retries.
194
+ *
195
+ * @param query The query of the first page; `limit` is the size of every page.
196
+ * @param options Call options of every page.
197
+ */
198
+ async *listIter(query?: AgentProfileListQuery, options?: CallOptions): AsyncGenerator<AgentProfileListResponse['items'][number], void, undefined> {
199
+ let offset = query?.offset ?? 0;
200
+ for (;;) {
201
+ const response = await this.list({ ...query, offset }, options);
202
+ const page = response;
203
+ yield* page.items;
204
+ if (!page.hasMore) return;
205
+ offset += page.items.length;
206
+ }
207
+ }
208
+
209
+ /**
210
+ * Read agent profile
211
+ *
212
+ * Get agent profile
213
+ *
214
+ * Read one agent profile resource by TRN, including language model, prompt, skills, tools, and runtime policy.
215
+ *
216
+ * Replay: has no effect; retried after an attempt with an unknown result.
217
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_ProfileNotFound`.
218
+ *
219
+ * @param trn Agent TRN in the route path, for example trn:agent:tenant:test0001:profile/runtime-assistant, trn:agent:tenant:test0001:prompt/support-core, trn:agent:tenant:test0001:skill/support-docs, or trn:agent:tenant:test0001:thread/runtime-assistant/<thread_id> depending on the command
220
+ * @param options Call options.
221
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
222
+ */
223
+ read(trn: string, options?: CallOptions): Promise<AgentProfileReadResponse> {
224
+ return this.#engine.call<AgentProfileReadResponse>(OPERATIONS.agent_profile_read, { path: `/profiles/${encodePathParam(trn)}`, primaryResourceTrn: trn }, options);
225
+ }
226
+
227
+ /**
228
+ * List per-Agent statistics
229
+ *
230
+ * One row per Agent Profile with a Turn that ended in the window: outcomes, tokens and estimated cost.
231
+ *
232
+ * Replay: has no effect; retried after an attempt with an unknown result.
233
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_ProfileNotFound`, `Agent_StatisticsWindowRejected`, `Agent_QueryDeadlineExceeded`.
234
+ *
235
+ * @param query The query, by wire names.
236
+ * @param options Call options.
237
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
238
+ */
239
+ statisticsList(query?: AgentProfileStatisticsListQuery, options?: CallOptions): Promise<AgentProfileStatisticsListResponse> {
240
+ return this.#engine.call<AgentProfileStatisticsListResponse>(OPERATIONS.agent_profile_statistics_list, { path: withQuery(`/profiles:statistics`, query) }, options);
241
+ }
242
+
243
+ /**
244
+ * Every item of `agent.profile.statistics_list`, page after page, starting from `query`.
245
+ * Each page is one call with its own time budget and retries.
246
+ *
247
+ * @param query The query of the first page; `limit` is the size of every page.
248
+ * @param options Call options of every page.
249
+ */
250
+ async *statisticsListIter(query?: AgentProfileStatisticsListQuery, options?: CallOptions): AsyncGenerator<AgentProfileStatisticsListResponse['items'][number], void, undefined> {
251
+ let offset = query?.offset ?? 0;
252
+ for (;;) {
253
+ const response = await this.statisticsList({ ...query, offset }, options);
254
+ const page = response;
255
+ yield* page.items;
256
+ if (!page.hasMore) return;
257
+ offset += page.items.length;
258
+ }
259
+ }
260
+
261
+ /**
262
+ * Summarize one Agent over a window
263
+ *
264
+ * The figures of one Agent Profile, with a comparison of its Profile versions.
265
+ *
266
+ * Replay: has no effect; retried after an attempt with an unknown result.
267
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_ProfileNotFound`, `Agent_StatisticsWindowRejected`, `Agent_QueryDeadlineExceeded`.
268
+ *
269
+ * @param trn Agent TRN in the route path, for example trn:agent:tenant:test0001:profile/runtime-assistant, trn:agent:tenant:test0001:prompt/support-core, trn:agent:tenant:test0001:skill/support-docs, or trn:agent:tenant:test0001:thread/runtime-assistant/<thread_id> depending on the command
270
+ * @param query The query, by wire names.
271
+ * @param options Call options.
272
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
273
+ */
274
+ statisticsRead(trn: string, query: AgentProfileStatisticsReadQuery, options?: CallOptions): Promise<AgentProfileStatisticsReadResponse> {
275
+ return this.#engine.call<AgentProfileStatisticsReadResponse>(OPERATIONS.agent_profile_statistics_read, { path: withQuery(`/profiles/${encodePathParam(trn)}/statistics`, query), primaryResourceTrn: trn }, options);
276
+ }
277
+
278
+ /**
279
+ * Read Thread creation requirements
280
+ *
281
+ * Get new Thread creation requirements for an Agent Profile
282
+ *
283
+ * Read the workspace requirements for creating a new Thread under one Agent Profile.
284
+ *
285
+ * Replay: has no effect; retried after an attempt with an unknown result.
286
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_ProfileNotFound`.
287
+ *
288
+ * @param trn Agent TRN in the route path, for example trn:agent:tenant:test0001:profile/runtime-assistant, trn:agent:tenant:test0001:prompt/support-core, trn:agent:tenant:test0001:skill/support-docs, or trn:agent:tenant:test0001:thread/runtime-assistant/<thread_id> depending on the command
289
+ * @param options Call options.
290
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
291
+ */
292
+ threadCreationRequirementRead(trn: string, options?: CallOptions): Promise<AgentProfileThreadCreationRequirementReadResponse> {
293
+ return this.#engine.call<AgentProfileThreadCreationRequirementReadResponse>(OPERATIONS.agent_profile_thread_creation_requirement_read, { path: `/profiles/${encodePathParam(trn)}/thread-creation-requirements`, primaryResourceTrn: trn }, options);
294
+ }
295
+
296
+ /**
297
+ * Summarize tool calls for one Agent
298
+ *
299
+ * Tool outcomes in the selected window, queried on demand. At most 50 groups, by tool, operation and resource; a truncated list cannot provide a global failure rate.
300
+ *
301
+ * Replay: has no effect; retried after an attempt with an unknown result.
302
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_ProfileNotFound`, `Agent_StatisticsWindowRejected`, `Agent_QueryDeadlineExceeded`.
303
+ *
304
+ * @param trn Agent TRN in the route path, for example trn:agent:tenant:test0001:profile/runtime-assistant, trn:agent:tenant:test0001:prompt/support-core, trn:agent:tenant:test0001:skill/support-docs, or trn:agent:tenant:test0001:thread/runtime-assistant/<thread_id> depending on the command
305
+ * @param query The query, by wire names.
306
+ * @param options Call options.
307
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
308
+ */
309
+ toolStatisticsRead(trn: string, query: AgentProfileToolStatisticsReadQuery, options?: CallOptions): Promise<AgentProfileToolStatisticsReadResponse> {
310
+ return this.#engine.call<AgentProfileToolStatisticsReadResponse>(OPERATIONS.agent_profile_tool_statistics_read, { path: withQuery(`/profiles/${encodePathParam(trn)}/tool-statistics`, query), primaryResourceTrn: trn }, options);
311
+ }
312
+
313
+ /**
314
+ * Delete agent profile version
315
+ *
316
+ * Delete one Agent profile version that is not current; make another version current first to delete the current one.
317
+ *
318
+ * Replay: not declared; an attempt with an unknown result is not retried.
319
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_ProfileNotFound`, `Agent_VersionNotFound`, `Declarative_RemovalBlocked`, `Internal_Conflict`.
320
+ *
321
+ * @param trn Version TRN: the resource TRN with the v<n> qualifier of one version
322
+ * @param options Call options.
323
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
324
+ */
325
+ versionDelete(trn: string, options?: CallOptions): Promise<AgentProfileVersionDeleteResponse> {
326
+ return this.#engine.call<AgentProfileVersionDeleteResponse>(OPERATIONS.agent_profile_version_delete, { path: `/profiles/${encodePathParam(trn)}/version`, primaryResourceTrn: trn }, options);
327
+ }
328
+
329
+ /**
330
+ * List agent profile versions
331
+ *
332
+ * List the versions of one Agent profile.
333
+ *
334
+ * Replay: has no effect; retried after an attempt with an unknown result.
335
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_ProfileNotFound`.
336
+ *
337
+ * @param trn Stable TRN of the versioned resource, without a version qualifier
338
+ * @param query The query, by wire names.
339
+ * @param options Call options.
340
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
341
+ */
342
+ versionList(trn: string, query?: AgentProfileVersionListQuery, options?: CallOptions): Promise<AgentProfileVersionListResponse> {
343
+ return this.#engine.call<AgentProfileVersionListResponse>(OPERATIONS.agent_profile_version_list, { path: withQuery(`/profiles/${encodePathParam(trn)}/versions`, query), primaryResourceTrn: trn }, options);
344
+ }
345
+
346
+ /**
347
+ * Every item of `agent.profile.version_list`, page after page, starting from `query`.
348
+ * Each page is one call with its own time budget and retries.
349
+ *
350
+ * @param trn Stable TRN of the versioned resource, without a version qualifier
351
+ * @param query The query of the first page; `limit` is the size of every page.
352
+ * @param options Call options of every page.
353
+ */
354
+ async *versionListIter(trn: string, query?: AgentProfileVersionListQuery, options?: CallOptions): AsyncGenerator<AgentProfileVersionListResponse['items'][number], void, undefined> {
355
+ let offset = query?.offset ?? 0;
356
+ for (;;) {
357
+ const response = await this.versionList(trn, { ...query, offset }, options);
358
+ const page = response;
359
+ yield* page.items;
360
+ if (!page.hasMore) return;
361
+ offset += page.items.length;
362
+ }
363
+ }
364
+
365
+ /**
366
+ * Read agent profile version
367
+ *
368
+ * Get agent profile version
369
+ *
370
+ * Read one Agent profile version and its spec by exact version TRN.
371
+ *
372
+ * Replay: has no effect; retried after an attempt with an unknown result.
373
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_ProfileNotFound`, `Agent_VersionNotFound`.
374
+ *
375
+ * @param trn Version TRN: the resource TRN with the v<n> qualifier of one version
376
+ * @param options Call options.
377
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
378
+ */
379
+ versionRead(trn: string, options?: CallOptions): Promise<AgentProfileVersionReadResponse> {
380
+ return this.#engine.call<AgentProfileVersionReadResponse>(OPERATIONS.agent_profile_version_read, { path: `/profiles/${encodePathParam(trn)}/version`, primaryResourceTrn: trn }, options);
381
+ }
382
+
383
+ /**
384
+ * Set the current agent profile version
385
+ *
386
+ * Point a Agent profile at one of its versions; new operations use it from now on.
387
+ *
388
+ * Replay: not idempotent; an attempt answered with `Agent_ProfileNotFound`, `Agent_VersionNotFound` did not run.
389
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_ProfileNotFound`, `Agent_VersionNotFound`, `Internal_Conflict`.
390
+ *
391
+ * @param trn Version TRN: the resource TRN with the v<n> qualifier of one version
392
+ * @param options Call options.
393
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
394
+ */
395
+ versionSetCurrent(trn: string, options?: CallOptions): Promise<AgentProfileVersionSetCurrentResponse> {
396
+ return this.#engine.call<AgentProfileVersionSetCurrentResponse>(OPERATIONS.agent_profile_version_set_current, { path: `/profiles/${encodePathParam(trn)}/version/set-current`, primaryResourceTrn: trn }, options);
397
+ }
398
+ }
399
+
400
+ /** The `prompt` operations of the `agent` service. */
401
+ export class AgentPromptResource {
402
+ readonly #engine: CallEngine;
403
+
404
+ /** Not part of the public API. */
405
+ constructor(engine: CallEngine) {
406
+ this.#engine = engine;
407
+ }
408
+
409
+ /**
410
+ * List prompts
411
+ *
412
+ * List declarative prompt resources with optional tag filters and pagination.
413
+ *
414
+ * Replay: has no effect; retried after an attempt with an unknown result.
415
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`.
416
+ *
417
+ * @param query The query, by wire names.
418
+ * @param options Call options.
419
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
420
+ */
421
+ list(query?: AgentPromptListQuery, options?: CallOptions): Promise<AgentPromptListResponse> {
422
+ return this.#engine.call<AgentPromptListResponse>(OPERATIONS.agent_prompt_list, { path: withQuery(`/prompts`, query) }, options);
423
+ }
424
+
425
+ /**
426
+ * Every item of `agent.prompt.list`, page after page, starting from `query`.
427
+ * Each page is one call with its own time budget and retries.
428
+ *
429
+ * @param query The query of the first page; `limit` is the size of every page.
430
+ * @param options Call options of every page.
431
+ */
432
+ async *listIter(query?: AgentPromptListQuery, options?: CallOptions): AsyncGenerator<AgentPromptListResponse['items'][number], void, undefined> {
433
+ let offset = query?.offset ?? 0;
434
+ for (;;) {
435
+ const response = await this.list({ ...query, offset }, options);
436
+ const page = response;
437
+ yield* page.items;
438
+ if (!page.hasMore) return;
439
+ offset += page.items.length;
440
+ }
441
+ }
442
+
443
+ /**
444
+ * Get prompt
445
+ *
446
+ * Read one Prompt occurrence by TRN, including its metadata and current immutable Version pointer.
447
+ *
448
+ * Replay: has no effect; retried after an attempt with an unknown result.
449
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_PromptNotFound`.
450
+ *
451
+ * @param trn Agent TRN in the route path, for example trn:agent:tenant:test0001:profile/runtime-assistant, trn:agent:tenant:test0001:prompt/support-core, trn:agent:tenant:test0001:skill/support-docs, or trn:agent:tenant:test0001:thread/runtime-assistant/<thread_id> depending on the command
452
+ * @param options Call options.
453
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
454
+ */
455
+ read(trn: string, options?: CallOptions): Promise<AgentPromptReadResponse> {
456
+ return this.#engine.call<AgentPromptReadResponse>(OPERATIONS.agent_prompt_read, { path: `/prompts/${encodePathParam(trn)}`, primaryResourceTrn: trn }, options);
457
+ }
458
+
459
+ /**
460
+ * Read prompt runtime
461
+ *
462
+ * Read resolved prompt runtime view
463
+ *
464
+ * Render and read the resolved prompt runtime view, including selected prompt identity, request messages, and trace details.
465
+ *
466
+ * Replay: has no effect; retried after an attempt with an unknown result.
467
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Internal_PayloadTooLarge`, `Internal_UnsupportedMediaType`, `Agent_PromptNotFound`, `Agent_VersionNotFound`, `Agent_ThreadNotFound`, `Agent_TurnNotFound`, `Agent_InvalidState`, `Agent_RequestTemplateInvalid`, `Internal_NotFound`.
468
+ *
469
+ * @param body The request body.
470
+ * @param options Call options.
471
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
472
+ */
473
+ runtimeRead(body: ReadPromptRequest, options?: CallOptions): Promise<AgentPromptRuntimeReadResponse> {
474
+ return this.#engine.call<AgentPromptRuntimeReadResponse>(OPERATIONS.agent_prompt_runtime_read, { path: `/prompts:read`, body }, options);
475
+ }
476
+
477
+ /**
478
+ * Resolve prompt runtime
479
+ *
480
+ * Resolve prompt runtime identity
481
+ *
482
+ * Resolve prompt runtime identity from a prepared turn, prompt, or prompt version reference without rendering the final request body.
483
+ *
484
+ * Replay: has no effect; retried after an attempt with an unknown result.
485
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Internal_PayloadTooLarge`, `Internal_UnsupportedMediaType`, `Agent_PromptNotFound`, `Agent_VersionNotFound`, `Agent_ThreadNotFound`, `Agent_TurnNotFound`, `Agent_InvalidState`, `Internal_NotFound`.
486
+ *
487
+ * @param body The request body.
488
+ * @param options Call options.
489
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
490
+ */
491
+ runtimeResolve(body: ResolvePromptRequest, options?: CallOptions): Promise<AgentPromptRuntimeResolveResponse> {
492
+ return this.#engine.call<AgentPromptRuntimeResolveResponse>(OPERATIONS.agent_prompt_runtime_resolve, { path: `/prompts:resolve`, body }, options);
493
+ }
494
+
495
+ /**
496
+ * Delete prompt version
497
+ *
498
+ * Delete Prompt version
499
+ *
500
+ * Delete one Prompt version that is not current; make another version current first to delete the current one.
501
+ *
502
+ * Replay: not declared; an attempt with an unknown result is not retried.
503
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_PromptNotFound`, `Agent_VersionNotFound`, `Declarative_RemovalBlocked`, `Internal_Conflict`.
504
+ *
505
+ * @param trn Version TRN: the resource TRN with the v<n> qualifier of one version
506
+ * @param options Call options.
507
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
508
+ */
509
+ versionDelete(trn: string, options?: CallOptions): Promise<AgentPromptVersionDeleteResponse> {
510
+ return this.#engine.call<AgentPromptVersionDeleteResponse>(OPERATIONS.agent_prompt_version_delete, { path: `/prompts/${encodePathParam(trn)}/version`, primaryResourceTrn: trn }, options);
511
+ }
512
+
513
+ /**
514
+ * List prompt versions
515
+ *
516
+ * List published, undeleted versions for one Prompt occurrence.
517
+ *
518
+ * Replay: has no effect; retried after an attempt with an unknown result.
519
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_PromptNotFound`.
520
+ *
521
+ * @param trn Stable TRN of the versioned resource, without a version qualifier
522
+ * @param query The query, by wire names.
523
+ * @param options Call options.
524
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
525
+ */
526
+ versionList(trn: string, query?: AgentPromptVersionListQuery, options?: CallOptions): Promise<AgentPromptVersionListResponse> {
527
+ return this.#engine.call<AgentPromptVersionListResponse>(OPERATIONS.agent_prompt_version_list, { path: withQuery(`/prompts/${encodePathParam(trn)}/versions`, query), primaryResourceTrn: trn }, options);
528
+ }
529
+
530
+ /**
531
+ * Every item of `agent.prompt.version_list`, page after page, starting from `query`.
532
+ * Each page is one call with its own time budget and retries.
533
+ *
534
+ * @param trn Stable TRN of the versioned resource, without a version qualifier
535
+ * @param query The query of the first page; `limit` is the size of every page.
536
+ * @param options Call options of every page.
537
+ */
538
+ async *versionListIter(trn: string, query?: AgentPromptVersionListQuery, options?: CallOptions): AsyncGenerator<AgentPromptVersionListResponse['items'][number], void, undefined> {
539
+ let offset = query?.offset ?? 0;
540
+ for (;;) {
541
+ const response = await this.versionList(trn, { ...query, offset }, options);
542
+ const page = response;
543
+ yield* page.items;
544
+ if (!page.hasMore) return;
545
+ offset += page.items.length;
546
+ }
547
+ }
548
+
549
+ /**
550
+ * Read prompt version
551
+ *
552
+ * Get prompt version
553
+ *
554
+ * Read one published Prompt version by exact parent qualifier TRN.
555
+ *
556
+ * Replay: has no effect; retried after an attempt with an unknown result.
557
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_PromptNotFound`, `Agent_VersionNotFound`, `Internal_NotFound`.
558
+ *
559
+ * @param trn Version TRN: the resource TRN with the v<n> qualifier of one version
560
+ * @param options Call options.
561
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
562
+ */
563
+ versionRead(trn: string, options?: CallOptions): Promise<AgentPromptVersionReadResponse> {
564
+ return this.#engine.call<AgentPromptVersionReadResponse>(OPERATIONS.agent_prompt_version_read, { path: `/prompts/${encodePathParam(trn)}/version`, primaryResourceTrn: trn }, options);
565
+ }
566
+
567
+ /**
568
+ * Set the current prompt version
569
+ *
570
+ * Point a Prompt at one of its versions; new Turns use it from now on.
571
+ *
572
+ * Replay: not idempotent; an attempt answered with `Agent_PromptNotFound`, `Agent_VersionNotFound` did not run.
573
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_PromptNotFound`, `Agent_VersionNotFound`, `Internal_Conflict`.
574
+ *
575
+ * @param trn Version TRN: the resource TRN with the v<n> qualifier of one version
576
+ * @param options Call options.
577
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
578
+ */
579
+ versionSetCurrent(trn: string, options?: CallOptions): Promise<AgentPromptVersionSetCurrentResponse> {
580
+ return this.#engine.call<AgentPromptVersionSetCurrentResponse>(OPERATIONS.agent_prompt_version_set_current, { path: `/prompts/${encodePathParam(trn)}/version/set-current`, primaryResourceTrn: trn }, options);
581
+ }
582
+ }
583
+
584
+ /** The `session` operations of the `agent` service. */
585
+ export class AgentSessionResource {
586
+ readonly #engine: CallEngine;
587
+
588
+ /** Not part of the public API. */
589
+ constructor(engine: CallEngine) {
590
+ this.#engine = engine;
591
+ }
592
+
593
+ /**
594
+ * Connect agent session
595
+ *
596
+ * Issue a short-lived bootstrap for a live Agent session attached to one existing Thread.
597
+ *
598
+ * Replay: not declared; an attempt with an unknown result is not retried.
599
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Internal_PayloadTooLarge`, `Internal_UnsupportedMediaType`, `Agent_ThreadNotFound`, `Internal_Conflict`.
600
+ *
601
+ * @param body The request body.
602
+ * @param options Call options.
603
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
604
+ */
605
+ connect(body: ConnectAgentSessionRequest, options?: CallOptions): Promise<AgentSessionConnectResponse> {
606
+ return this.#engine.call<AgentSessionConnectResponse>(OPERATIONS.agent_session_connect, { path: `/session/connect`, body }, options);
607
+ }
608
+ }
609
+
610
+ /** The `skill` operations of the `agent` service. */
611
+ export class AgentSkillResource {
612
+ readonly #engine: CallEngine;
613
+
614
+ /** Not part of the public API. */
615
+ constructor(engine: CallEngine) {
616
+ this.#engine = engine;
617
+ }
618
+
619
+ /**
620
+ * List skills
621
+ *
622
+ * List registered agent skill packages with optional tag filters and pagination.
623
+ *
624
+ * Replay: has no effect; retried after an attempt with an unknown result.
625
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`.
626
+ *
627
+ * @param query The query, by wire names.
628
+ * @param options Call options.
629
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
630
+ */
631
+ list(query?: AgentSkillListQuery, options?: CallOptions): Promise<AgentSkillListResponse> {
632
+ return this.#engine.call<AgentSkillListResponse>(OPERATIONS.agent_skill_list, { path: withQuery(`/skills`, query) }, options);
633
+ }
634
+
635
+ /**
636
+ * Every item of `agent.skill.list`, page after page, starting from `query`.
637
+ * Each page is one call with its own time budget and retries.
638
+ *
639
+ * @param query The query of the first page; `limit` is the size of every page.
640
+ * @param options Call options of every page.
641
+ */
642
+ async *listIter(query?: AgentSkillListQuery, options?: CallOptions): AsyncGenerator<AgentSkillListResponse['items'][number], void, undefined> {
643
+ let offset = query?.offset ?? 0;
644
+ for (;;) {
645
+ const response = await this.list({ ...query, offset }, options);
646
+ const page = response;
647
+ yield* page.items;
648
+ if (!page.hasMore) return;
649
+ offset += page.items.length;
650
+ }
651
+ }
652
+
653
+ /**
654
+ * Read skill
655
+ *
656
+ * Get skill
657
+ *
658
+ * Read one registered skill package resource by TRN, including package artifact metadata.
659
+ *
660
+ * Replay: has no effect; retried after an attempt with an unknown result.
661
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_SkillNotFound`.
662
+ *
663
+ * @param trn Agent TRN in the route path, for example trn:agent:tenant:test0001:profile/runtime-assistant, trn:agent:tenant:test0001:prompt/support-core, trn:agent:tenant:test0001:skill/support-docs, or trn:agent:tenant:test0001:thread/runtime-assistant/<thread_id> depending on the command
664
+ * @param options Call options.
665
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
666
+ */
667
+ read(trn: string, options?: CallOptions): Promise<AgentSkillReadResponse> {
668
+ return this.#engine.call<AgentSkillReadResponse>(OPERATIONS.agent_skill_read, { path: `/skills/${encodePathParam(trn)}`, primaryResourceTrn: trn }, options);
669
+ }
670
+
671
+ /**
672
+ * Delete skill version
673
+ *
674
+ * Delete Skill version
675
+ *
676
+ * Delete one Skill version that is not current; make another version current first to delete the current one.
677
+ *
678
+ * Replay: not declared; an attempt with an unknown result is not retried.
679
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_SkillNotFound`, `Agent_VersionNotFound`, `Declarative_RemovalBlocked`, `Internal_Conflict`.
680
+ *
681
+ * @param trn Version TRN: the resource TRN with the v<n> qualifier of one version
682
+ * @param options Call options.
683
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
684
+ */
685
+ versionDelete(trn: string, options?: CallOptions): Promise<AgentSkillVersionDeleteResponse> {
686
+ return this.#engine.call<AgentSkillVersionDeleteResponse>(OPERATIONS.agent_skill_version_delete, { path: `/skills/${encodePathParam(trn)}/version`, primaryResourceTrn: trn }, options);
687
+ }
688
+
689
+ /**
690
+ * Read skill version file
691
+ *
692
+ * Read one verified file from an immutable Agent Skill package version
693
+ *
694
+ * Read the verified bytes of one file from an exact Skill version.
695
+ *
696
+ * Replay: has no effect; retried after an attempt with an unknown result.
697
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_SkillNotFound`, `Agent_VersionNotFound`, `Internal_NotFound`.
698
+ *
699
+ * @param trn Agent TRN in the route path, for example trn:agent:tenant:test0001:profile/runtime-assistant, trn:agent:tenant:test0001:prompt/support-core, trn:agent:tenant:test0001:skill/support-docs, or trn:agent:tenant:test0001:thread/runtime-assistant/<thread_id> depending on the command
700
+ * @param query The query, by wire names.
701
+ * @param options Call options.
702
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
703
+ */
704
+ versionFileRead(trn: string, query: AgentSkillVersionFileReadQuery, options?: CallOptions): Promise<AgentSkillVersionFileReadResponse> {
705
+ return this.#engine.call<AgentSkillVersionFileReadResponse>(OPERATIONS.agent_skill_version_file_read, { path: withQuery(`/skills/${encodePathParam(trn)}/version/file`, query), primaryResourceTrn: trn }, options);
706
+ }
707
+
708
+ /**
709
+ * List skill versions
710
+ *
711
+ * List immutable package versions for one Agent Skill
712
+ *
713
+ * List immutable package versions for one Agent Skill occurrence.
714
+ *
715
+ * Replay: has no effect; retried after an attempt with an unknown result.
716
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_SkillNotFound`.
717
+ *
718
+ * @param trn Stable TRN of the versioned resource, without a version qualifier
719
+ * @param query The query, by wire names.
720
+ * @param options Call options.
721
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
722
+ */
723
+ versionList(trn: string, query?: AgentSkillVersionListQuery, options?: CallOptions): Promise<AgentSkillVersionListResponse> {
724
+ return this.#engine.call<AgentSkillVersionListResponse>(OPERATIONS.agent_skill_version_list, { path: withQuery(`/skills/${encodePathParam(trn)}/versions`, query), primaryResourceTrn: trn }, options);
725
+ }
726
+
727
+ /**
728
+ * Every item of `agent.skill.version_list`, page after page, starting from `query`.
729
+ * Each page is one call with its own time budget and retries.
730
+ *
731
+ * @param trn Stable TRN of the versioned resource, without a version qualifier
732
+ * @param query The query of the first page; `limit` is the size of every page.
733
+ * @param options Call options of every page.
734
+ */
735
+ async *versionListIter(trn: string, query?: AgentSkillVersionListQuery, options?: CallOptions): AsyncGenerator<AgentSkillVersionListResponse['items'][number], void, undefined> {
736
+ let offset = query?.offset ?? 0;
737
+ for (;;) {
738
+ const response = await this.versionList(trn, { ...query, offset }, options);
739
+ const page = response;
740
+ yield* page.items;
741
+ if (!page.hasMore) return;
742
+ offset += page.items.length;
743
+ }
744
+ }
745
+
746
+ /**
747
+ * Download Skill version package
748
+ *
749
+ * Read the exact immutable Agent Skill package bytes
750
+ *
751
+ * Replay: has no effect; retried after an attempt with an unknown result.
752
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_SkillNotFound`, `Agent_VersionNotFound`, `Internal_NotFound`.
753
+ *
754
+ * @param trn Agent TRN in the route path, for example trn:agent:tenant:test0001:profile/runtime-assistant, trn:agent:tenant:test0001:prompt/support-core, trn:agent:tenant:test0001:skill/support-docs, or trn:agent:tenant:test0001:thread/runtime-assistant/<thread_id> depending on the command
755
+ * @param options Call options.
756
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
757
+ */
758
+ versionPackageRead(trn: string, options?: CallOptions): Promise<AgentSkillVersionPackageReadResponse> {
759
+ return this.#engine.call<AgentSkillVersionPackageReadResponse>(OPERATIONS.agent_skill_version_package_read, { path: `/skills/${encodePathParam(trn)}/version/package`, primaryResourceTrn: trn }, options);
760
+ }
761
+
762
+ /**
763
+ * Read skill version
764
+ *
765
+ * Get one immutable Agent Skill package version
766
+ *
767
+ * Read one immutable Agent Skill package version and its validated manifest.
768
+ *
769
+ * Replay: has no effect; retried after an attempt with an unknown result.
770
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_SkillNotFound`, `Agent_VersionNotFound`, `Internal_NotFound`.
771
+ *
772
+ * @param trn Version TRN: the resource TRN with the v<n> qualifier of one version
773
+ * @param options Call options.
774
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
775
+ */
776
+ versionRead(trn: string, options?: CallOptions): Promise<AgentSkillVersionReadResponse> {
777
+ return this.#engine.call<AgentSkillVersionReadResponse>(OPERATIONS.agent_skill_version_read, { path: `/skills/${encodePathParam(trn)}/version`, primaryResourceTrn: trn }, options);
778
+ }
779
+
780
+ /**
781
+ * Set the current skill version
782
+ *
783
+ * Point a Skill at one of its versions; new Turns use it from now on.
784
+ *
785
+ * Replay: not idempotent; an attempt answered with `Agent_SkillNotFound`, `Agent_VersionNotFound` did not run.
786
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_SkillNotFound`, `Agent_VersionNotFound`, `Internal_Conflict`.
787
+ *
788
+ * @param trn Version TRN: the resource TRN with the v<n> qualifier of one version
789
+ * @param options Call options.
790
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
791
+ */
792
+ versionSetCurrent(trn: string, options?: CallOptions): Promise<AgentSkillVersionSetCurrentResponse> {
793
+ return this.#engine.call<AgentSkillVersionSetCurrentResponse>(OPERATIONS.agent_skill_version_set_current, { path: `/skills/${encodePathParam(trn)}/version/set-current`, primaryResourceTrn: trn }, options);
794
+ }
795
+ }
796
+
797
+ /** The `thread` operations of the `agent` service. */
798
+ export class AgentThreadResource {
799
+ readonly #engine: CallEngine;
800
+
801
+ /** Not part of the public API. */
802
+ constructor(engine: CallEngine) {
803
+ this.#engine = engine;
804
+ }
805
+
806
+ /**
807
+ * Archive thread
808
+ *
809
+ * Archive one thread so it is hidden from the default active thread list.
810
+ *
811
+ * Replay: not declared; an attempt with an unknown result is not retried.
812
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Internal_PayloadTooLarge`, `Internal_UnsupportedMediaType`, `Agent_ThreadNotFound`, `Agent_InvalidState`.
813
+ *
814
+ * @param trn Agent TRN in the route path, for example trn:agent:tenant:test0001:profile/runtime-assistant, trn:agent:tenant:test0001:prompt/support-core, trn:agent:tenant:test0001:skill/support-docs, or trn:agent:tenant:test0001:thread/runtime-assistant/<thread_id> depending on the command
815
+ * @param body The request body.
816
+ * @param options Call options.
817
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
818
+ */
819
+ archive(trn: string, body: ArchiveThreadRequest, options?: CallOptions): Promise<AgentThreadArchiveResponse> {
820
+ return this.#engine.call<AgentThreadArchiveResponse>(OPERATIONS.agent_thread_archive, { path: `/threads/${encodePathParam(trn)}/archive`, body, primaryResourceTrn: trn }, options);
821
+ }
822
+
823
+ /**
824
+ * Delete thread
825
+ *
826
+ * Permanently delete one archived idle thread and its thread-owned state.
827
+ *
828
+ * Replay: not declared; an attempt with an unknown result is not retried.
829
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_ThreadNotFound`, `Agent_InvalidState`.
830
+ *
831
+ * @param trn Agent TRN in the route path, for example trn:agent:tenant:test0001:profile/runtime-assistant, trn:agent:tenant:test0001:prompt/support-core, trn:agent:tenant:test0001:skill/support-docs, or trn:agent:tenant:test0001:thread/runtime-assistant/<thread_id> depending on the command
832
+ * @param options Call options.
833
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
834
+ */
835
+ delete(trn: string, options?: CallOptions): Promise<AgentThreadDeleteResponse> {
836
+ return this.#engine.call<AgentThreadDeleteResponse>(OPERATIONS.agent_thread_delete, { path: `/threads/${encodePathParam(trn)}`, primaryResourceTrn: trn }, options);
837
+ }
838
+
839
+ /**
840
+ * Interrupt thread turn
841
+ *
842
+ * Submit durable thread interrupt command
843
+ *
844
+ * Submit a durable interrupt command for one thread. Execution is handled by the agent worker command plane.
845
+ *
846
+ * Replay: not declared; an attempt with an unknown result is not retried.
847
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Internal_PayloadTooLarge`, `Internal_UnsupportedMediaType`, `Agent_ThreadNotFound`, `Internal_IdempotencyKeyReused`, `Internal_Conflict`.
848
+ *
849
+ * @param trn Agent TRN in the route path, for example trn:agent:tenant:test0001:profile/runtime-assistant, trn:agent:tenant:test0001:prompt/support-core, trn:agent:tenant:test0001:skill/support-docs, or trn:agent:tenant:test0001:thread/runtime-assistant/<thread_id> depending on the command
850
+ * @param body The request body.
851
+ * @param options Call options.
852
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
853
+ */
854
+ interrupt(trn: string, body: InterruptThreadRequest, options?: CallOptions): Promise<AgentThreadInterruptResponse> {
855
+ return this.#engine.call<AgentThreadInterruptResponse>(OPERATIONS.agent_thread_interrupt, { path: `/threads/${encodePathParam(trn)}/interrupt`, body, primaryResourceTrn: trn }, options);
856
+ }
857
+
858
+ /**
859
+ * List thread items
860
+ *
861
+ * Page through projected thread items, optionally scoped to one turn.
862
+ *
863
+ * Replay: has no effect; retried after an attempt with an unknown result.
864
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_ThreadNotFound`, `Agent_TurnNotFound`, `Agent_InvalidState`.
865
+ *
866
+ * @param trn Thread TRN such as trn:agent:tenant:test0001:thread/runtime-assistant/<thread_id>
867
+ * @param query The query, by wire names.
868
+ * @param options Call options.
869
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
870
+ */
871
+ itemList(trn: string, query?: AgentThreadItemListQuery, options?: CallOptions): Promise<AgentThreadItemListResponse> {
872
+ return this.#engine.call<AgentThreadItemListResponse>(OPERATIONS.agent_thread_item_list, { path: withQuery(`/threads/${encodePathParam(trn)}/items`, query), primaryResourceTrn: trn }, options);
873
+ }
874
+
875
+ /**
876
+ * Every item of `agent.thread.item_list`, page after page, starting from `query`.
877
+ * Each page is one call with its own time budget and retries.
878
+ *
879
+ * @param trn Thread TRN such as trn:agent:tenant:test0001:thread/runtime-assistant/<thread_id>
880
+ * @param query The query of the first page; `limit` is the size of every page.
881
+ * @param options Call options of every page.
882
+ */
883
+ async *itemListIter(trn: string, query?: AgentThreadItemListQuery, options?: CallOptions): AsyncGenerator<AgentThreadItemListResponse['items'][number], void, undefined> {
884
+ const backward = query?.direction === 'backward';
885
+ let cursor = query?.cursor;
886
+ for (;;) {
887
+ const response = await this.itemList(trn, { ...query, cursor }, options);
888
+ const page = response;
889
+ yield* page.items;
890
+ if (!(backward ? page.pageInfo.hasPrevious : page.pageInfo.hasNext)) return;
891
+ cursor = backward ? page.pageInfo.firstCursor : page.pageInfo.lastCursor;
892
+ if (cursor == null) throw new Error('agent.thread.item_list reported more items without a cursor to them');
893
+ }
894
+ }
895
+
896
+ /**
897
+ * List threads
898
+ *
899
+ * List agent threads with pagination, archived filtering, free-text search, and sort controls.
900
+ *
901
+ * Replay: has no effect; retried after an attempt with an unknown result.
902
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_ProfileNotFound`.
903
+ *
904
+ * @param query The query, by wire names.
905
+ * @param options Call options.
906
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
907
+ */
908
+ list(query?: AgentThreadListQuery, options?: CallOptions): Promise<AgentThreadListResponse> {
909
+ return this.#engine.call<AgentThreadListResponse>(OPERATIONS.agent_thread_list, { path: withQuery(`/threads`, query) }, options);
910
+ }
911
+
912
+ /**
913
+ * Every item of `agent.thread.list`, page after page, starting from `query`.
914
+ * Each page is one call with its own time budget and retries.
915
+ *
916
+ * @param query The query of the first page; `limit` is the size of every page.
917
+ * @param options Call options of every page.
918
+ */
919
+ async *listIter(query?: AgentThreadListQuery, options?: CallOptions): AsyncGenerator<AgentThreadListResponse['items'][number], void, undefined> {
920
+ let offset = query?.offset ?? 0;
921
+ for (;;) {
922
+ const response = await this.list({ ...query, offset }, options);
923
+ const page = response;
924
+ yield* page.items;
925
+ if (!page.hasMore) return;
926
+ offset += page.items.length;
927
+ }
928
+ }
929
+
930
+ /**
931
+ * Stream thread notifications
932
+ *
933
+ * Stream durable thread notifications
934
+ *
935
+ * Stream durable notification events for one thread from the session fanout projection.
936
+ *
937
+ * Replay: has no effect; retried after an attempt with an unknown result.
938
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_ThreadNotFound`.
939
+ *
940
+ * @param trn Agent thread TRN whose durable rollout stream is observed
941
+ * @param query The query, by wire names.
942
+ * @param options Call options.
943
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
944
+ */
945
+ notificationStream(trn: string, query?: AgentThreadNotificationStreamQuery, options?: CallOptions): AsyncIterable<AgentThreadNotificationStreamResponse> {
946
+ return this.#engine.stream<AgentThreadNotificationStreamResponse>(OPERATIONS.agent_thread_notification_stream, { path: withQuery(`/threads/${encodePathParam(trn)}/notifications/stream`, query), primaryResourceTrn: trn }, options);
947
+ }
948
+
949
+ /**
950
+ * Resolve thread interaction
951
+ *
952
+ * Resolve one pending approval or user-input request through the resource/admin surface. Websocket-attached live session clients must answer live callback requests on the websocket session path instead of using this operation.
953
+ *
954
+ * Replay: not declared; an attempt with an unknown result is not retried.
955
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Internal_PayloadTooLarge`, `Internal_UnsupportedMediaType`, `Agent_ThreadNotFound`, `Agent_TurnNotFound`, `Agent_InteractionNotFound`, `Agent_InvalidState`, `Internal_Conflict`.
956
+ *
957
+ * @param trn Agent TRN in the route path, for example trn:agent:tenant:test0001:profile/runtime-assistant, trn:agent:tenant:test0001:prompt/support-core, trn:agent:tenant:test0001:skill/support-docs, or trn:agent:tenant:test0001:thread/runtime-assistant/<thread_id> depending on the command
958
+ * @param body The request body.
959
+ * @param options Call options.
960
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
961
+ */
962
+ pendingInteractionAnswer(trn: string, body: ResolveThreadInteractionRequest, options?: CallOptions): Promise<AgentThreadPendingInteractionAnswerResponse> {
963
+ return this.#engine.call<AgentThreadPendingInteractionAnswerResponse>(OPERATIONS.agent_thread_pending_interaction_answer, { path: `/threads/${encodePathParam(trn)}/interactions/answer`, body, primaryResourceTrn: trn }, options);
964
+ }
965
+
966
+ /**
967
+ * Read thread pending interactions
968
+ *
969
+ * Get thread pending interactions
970
+ *
971
+ * Read unresolved approvals or user-input requests for one thread as a resource/admin surface. Websocket-attached live session clients must complete live callback flows on the websocket session path instead.
972
+ *
973
+ * Replay: has no effect; retried after an attempt with an unknown result.
974
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_ThreadNotFound`.
975
+ *
976
+ * @param trn Agent TRN in the route path, for example trn:agent:tenant:test0001:profile/runtime-assistant, trn:agent:tenant:test0001:prompt/support-core, trn:agent:tenant:test0001:skill/support-docs, or trn:agent:tenant:test0001:thread/runtime-assistant/<thread_id> depending on the command
977
+ * @param options Call options.
978
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
979
+ */
980
+ pendingInteractionList(trn: string, options?: CallOptions): Promise<AgentThreadPendingInteractionListResponse> {
981
+ return this.#engine.call<AgentThreadPendingInteractionListResponse>(OPERATIONS.agent_thread_pending_interaction_list, { path: `/threads/${encodePathParam(trn)}/interactions/pending`, primaryResourceTrn: trn }, options);
982
+ }
983
+
984
+ /**
985
+ * Read thread
986
+ *
987
+ * Get thread
988
+ *
989
+ * Read one thread by TRN without loading historical turns.
990
+ *
991
+ * Replay: has no effect; retried after an attempt with an unknown result.
992
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_ThreadNotFound`.
993
+ *
994
+ * @param trn Thread TRN such as trn:agent:tenant:test0001:thread/runtime-assistant/<thread_id>
995
+ * @param options Call options.
996
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
997
+ */
998
+ read(trn: string, options?: CallOptions): Promise<AgentThreadReadResponse> {
999
+ return this.#engine.call<AgentThreadReadResponse>(OPERATIONS.agent_thread_read, { path: `/threads/${encodePathParam(trn)}`, primaryResourceTrn: trn }, options);
1000
+ }
1001
+
1002
+ /**
1003
+ * Rename thread
1004
+ *
1005
+ * Rename one thread so list and read surfaces show a clearer human title.
1006
+ *
1007
+ * Replay: not declared; an attempt with an unknown result is not retried.
1008
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Internal_PayloadTooLarge`, `Internal_UnsupportedMediaType`, `Agent_ThreadNotFound`.
1009
+ *
1010
+ * @param trn Agent TRN in the route path, for example trn:agent:tenant:test0001:profile/runtime-assistant, trn:agent:tenant:test0001:prompt/support-core, trn:agent:tenant:test0001:skill/support-docs, or trn:agent:tenant:test0001:thread/runtime-assistant/<thread_id> depending on the command
1011
+ * @param body The request body.
1012
+ * @param options Call options.
1013
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
1014
+ */
1015
+ rename(trn: string, body: RenameThreadRequest, options?: CallOptions): Promise<AgentThreadRenameResponse> {
1016
+ return this.#engine.call<AgentThreadRenameResponse>(OPERATIONS.agent_thread_rename, { path: `/threads/${encodePathParam(trn)}/rename`, body, primaryResourceTrn: trn }, options);
1017
+ }
1018
+
1019
+ /**
1020
+ * Shutdown thread
1021
+ *
1022
+ * Submit durable thread shutdown command
1023
+ *
1024
+ * Submit a durable shutdown command for one thread and prevent future turn claims for that thread.
1025
+ *
1026
+ * Replay: not declared; an attempt with an unknown result is not retried.
1027
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Internal_PayloadTooLarge`, `Internal_UnsupportedMediaType`, `Agent_ThreadNotFound`, `Internal_IdempotencyKeyReused`, `Internal_Conflict`.
1028
+ *
1029
+ * @param trn Agent TRN in the route path, for example trn:agent:tenant:test0001:profile/runtime-assistant, trn:agent:tenant:test0001:prompt/support-core, trn:agent:tenant:test0001:skill/support-docs, or trn:agent:tenant:test0001:thread/runtime-assistant/<thread_id> depending on the command
1030
+ * @param body The request body.
1031
+ * @param options Call options.
1032
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
1033
+ */
1034
+ shutdown(trn: string, body: ShutdownThreadRequest, options?: CallOptions): Promise<AgentThreadShutdownResponse> {
1035
+ return this.#engine.call<AgentThreadShutdownResponse>(OPERATIONS.agent_thread_shutdown, { path: `/threads/${encodePathParam(trn)}/shutdown`, body, primaryResourceTrn: trn }, options);
1036
+ }
1037
+
1038
+ /**
1039
+ * Summarize Agent Turns over a window
1040
+ *
1041
+ * Turn outcomes, failures, estimated cost, model usage, current waits for people and a trend by bucket across the tenant. Completion means a Turn ended normally, not that its task was achieved.
1042
+ *
1043
+ * Replay: has no effect; retried after an attempt with an unknown result.
1044
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_ProfileNotFound`, `Agent_StatisticsWindowRejected`, `Agent_QueryDeadlineExceeded`.
1045
+ *
1046
+ * @param query The query, by wire names.
1047
+ * @param options Call options.
1048
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
1049
+ */
1050
+ statisticsRead(query: AgentThreadStatisticsReadQuery, options?: CallOptions): Promise<AgentThreadStatisticsReadResponse> {
1051
+ return this.#engine.call<AgentThreadStatisticsReadResponse>(OPERATIONS.agent_thread_statistics_read, { path: withQuery(`/threads:statistics`, query) }, options);
1052
+ }
1053
+
1054
+ /**
1055
+ * Get thread status
1056
+ *
1057
+ * Read the current projected runtime status for one thread without loading the full thread detail.
1058
+ *
1059
+ * Replay: has no effect; retried after an attempt with an unknown result.
1060
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_ThreadNotFound`.
1061
+ *
1062
+ * @param trn Agent TRN in the route path, for example trn:agent:tenant:test0001:profile/runtime-assistant, trn:agent:tenant:test0001:prompt/support-core, trn:agent:tenant:test0001:skill/support-docs, or trn:agent:tenant:test0001:thread/runtime-assistant/<thread_id> depending on the command
1063
+ * @param options Call options.
1064
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
1065
+ */
1066
+ statusRead(trn: string, options?: CallOptions): Promise<AgentThreadStatusReadResponse> {
1067
+ return this.#engine.call<AgentThreadStatusReadResponse>(OPERATIONS.agent_thread_status_read, { path: `/threads/${encodePathParam(trn)}/status`, primaryResourceTrn: trn }, options);
1068
+ }
1069
+
1070
+ /**
1071
+ * Stream thread status
1072
+ *
1073
+ * Stream durable thread status events
1074
+ *
1075
+ * Stream durable status events for one thread from the session fanout projection.
1076
+ *
1077
+ * Replay: has no effect; retried after an attempt with an unknown result.
1078
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_ThreadNotFound`.
1079
+ *
1080
+ * @param trn Agent thread TRN whose durable rollout stream is observed
1081
+ * @param query The query, by wire names.
1082
+ * @param options Call options.
1083
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
1084
+ */
1085
+ statusStream(trn: string, query?: AgentThreadStatusStreamQuery, options?: CallOptions): AsyncIterable<AgentThreadStatusStreamResponse> {
1086
+ return this.#engine.stream<AgentThreadStatusStreamResponse>(OPERATIONS.agent_thread_status_stream, { path: withQuery(`/threads/${encodePathParam(trn)}/status/stream`, query), primaryResourceTrn: trn }, options);
1087
+ }
1088
+
1089
+ /**
1090
+ * Summarize tool calls across the tenant
1091
+ *
1092
+ * Tool outcomes in the selected window, queried on demand. At most 50 groups, by tool, operation and resource; a truncated list cannot provide a global failure rate.
1093
+ *
1094
+ * Replay: has no effect; retried after an attempt with an unknown result.
1095
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_ProfileNotFound`, `Agent_StatisticsWindowRejected`, `Agent_QueryDeadlineExceeded`.
1096
+ *
1097
+ * @param query The query, by wire names.
1098
+ * @param options Call options.
1099
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
1100
+ */
1101
+ toolStatisticsRead(query: AgentThreadToolStatisticsReadQuery, options?: CallOptions): Promise<AgentThreadToolStatisticsReadResponse> {
1102
+ return this.#engine.call<AgentThreadToolStatisticsReadResponse>(OPERATIONS.agent_thread_tool_statistics_read, { path: withQuery(`/threads:tool-statistics`, query) }, options);
1103
+ }
1104
+
1105
+ /**
1106
+ * List thread turns
1107
+ *
1108
+ * Page through one thread's turn history with an item detail view.
1109
+ *
1110
+ * Replay: has no effect; retried after an attempt with an unknown result.
1111
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_ThreadNotFound`, `Agent_InvalidState`.
1112
+ *
1113
+ * @param trn Thread TRN such as trn:agent:tenant:test0001:thread/runtime-assistant/<thread_id>
1114
+ * @param query The query, by wire names.
1115
+ * @param options Call options.
1116
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
1117
+ */
1118
+ turnList(trn: string, query?: AgentThreadTurnListQuery, options?: CallOptions): Promise<AgentThreadTurnListResponse> {
1119
+ return this.#engine.call<AgentThreadTurnListResponse>(OPERATIONS.agent_thread_turn_list, { path: withQuery(`/threads/${encodePathParam(trn)}/turns`, query), primaryResourceTrn: trn }, options);
1120
+ }
1121
+
1122
+ /**
1123
+ * Every item of `agent.thread.turn_list`, page after page, starting from `query`.
1124
+ * Each page is one call with its own time budget and retries.
1125
+ *
1126
+ * @param trn Thread TRN such as trn:agent:tenant:test0001:thread/runtime-assistant/<thread_id>
1127
+ * @param query The query of the first page; `limit` is the size of every page.
1128
+ * @param options Call options of every page.
1129
+ */
1130
+ async *turnListIter(trn: string, query?: AgentThreadTurnListQuery, options?: CallOptions): AsyncGenerator<AgentThreadTurnListResponse['items'][number], void, undefined> {
1131
+ const backward = query?.direction === 'backward';
1132
+ let cursor = query?.cursor;
1133
+ for (;;) {
1134
+ const response = await this.turnList(trn, { ...query, cursor }, options);
1135
+ const page = response;
1136
+ yield* page.items;
1137
+ if (!(backward ? page.pageInfo.hasPrevious : page.pageInfo.hasNext)) return;
1138
+ cursor = backward ? page.pageInfo.firstCursor : page.pageInfo.lastCursor;
1139
+ if (cursor == null) throw new Error('agent.thread.turn_list reported more items without a cursor to them');
1140
+ }
1141
+ }
1142
+
1143
+ /**
1144
+ * Unarchive thread
1145
+ *
1146
+ * Restore one archived thread back into the active thread list.
1147
+ *
1148
+ * Replay: not declared; an attempt with an unknown result is not retried.
1149
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Internal_PayloadTooLarge`, `Internal_UnsupportedMediaType`, `Agent_ThreadNotFound`, `Agent_InvalidState`.
1150
+ *
1151
+ * @param trn Agent TRN in the route path, for example trn:agent:tenant:test0001:profile/runtime-assistant, trn:agent:tenant:test0001:prompt/support-core, trn:agent:tenant:test0001:skill/support-docs, or trn:agent:tenant:test0001:thread/runtime-assistant/<thread_id> depending on the command
1152
+ * @param body The request body.
1153
+ * @param options Call options.
1154
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
1155
+ */
1156
+ unarchive(trn: string, body: ArchiveThreadRequest, options?: CallOptions): Promise<AgentThreadUnarchiveResponse> {
1157
+ return this.#engine.call<AgentThreadUnarchiveResponse>(OPERATIONS.agent_thread_unarchive, { path: `/threads/${encodePathParam(trn)}/unarchive`, body, primaryResourceTrn: trn }, options);
1158
+ }
1159
+
1160
+ /**
1161
+ * List thread usage
1162
+ *
1163
+ * List bounded per-Turn usage facts
1164
+ *
1165
+ * List bounded per-Turn token usage facts with an exact total.
1166
+ *
1167
+ * Replay: has no effect; retried after an attempt with an unknown result.
1168
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_ThreadNotFound`.
1169
+ *
1170
+ * @param trn Thread TRN whose bounded Turn usage facts should be listed
1171
+ * @param query The query, by wire names.
1172
+ * @param options Call options.
1173
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
1174
+ */
1175
+ usageList(trn: string, query?: AgentThreadUsageListQuery, options?: CallOptions): Promise<AgentThreadUsageListResponse> {
1176
+ return this.#engine.call<AgentThreadUsageListResponse>(OPERATIONS.agent_thread_usage_list, { path: withQuery(`/threads/${encodePathParam(trn)}/usage`, query), primaryResourceTrn: trn }, options);
1177
+ }
1178
+
1179
+ /**
1180
+ * Every item of `agent.thread.usage_list`, page after page, starting from `query`.
1181
+ * Each page is one call with its own time budget and retries.
1182
+ *
1183
+ * @param trn Thread TRN whose bounded Turn usage facts should be listed
1184
+ * @param query The query of the first page; `limit` is the size of every page.
1185
+ * @param options Call options of every page.
1186
+ */
1187
+ async *usageListIter(trn: string, query?: AgentThreadUsageListQuery, options?: CallOptions): AsyncGenerator<AgentThreadUsageListResponse['items'][number], void, undefined> {
1188
+ let offset = query?.offset ?? 0;
1189
+ for (;;) {
1190
+ const response = await this.usageList(trn, { ...query, offset }, options);
1191
+ const page = response;
1192
+ yield* page.items;
1193
+ if (!page.hasMore) return;
1194
+ offset += page.items.length;
1195
+ }
1196
+ }
1197
+ }
1198
+
1199
+ /** The `turn` operations of the `agent` service. */
1200
+ export class AgentTurnResource {
1201
+ readonly #engine: CallEngine;
1202
+
1203
+ /** Not part of the public API. */
1204
+ constructor(engine: CallEngine) {
1205
+ this.#engine = engine;
1206
+ }
1207
+
1208
+ /**
1209
+ * Download Turn attachment
1210
+ *
1211
+ * Read the exact admitted bytes of one Turn attachment
1212
+ *
1213
+ * Replay: has no effect; retried after an attempt with an unknown result.
1214
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_ThreadNotFound`, `Agent_TurnNotFound`, `Agent_AttachmentNotFound`, `Internal_NotFound`.
1215
+ *
1216
+ * @param trn Agent turn TRN whose admitted attachment is read
1217
+ * @param index Zero-based position of the attachment in the Turn's input
1218
+ * @param options Call options.
1219
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
1220
+ */
1221
+ attachmentRead(trn: string, index: bigint, options?: CallOptions): Promise<AgentTurnAttachmentReadResponse> {
1222
+ return this.#engine.call<AgentTurnAttachmentReadResponse>(OPERATIONS.agent_turn_attachment_read, { path: `/turns/${encodePathParam(trn)}/attachments/${encodePathParam(index)}`, primaryResourceTrn: trn }, options);
1223
+ }
1224
+
1225
+ /**
1226
+ * Read Turn status
1227
+ *
1228
+ * Read durable agent turn invocation status
1229
+ *
1230
+ * Replay: has no effect; retried after an attempt with an unknown result.
1231
+ * Declared errors: `Internal_Unauthorized`, `Internal_PermissionDenied`, `Internal_ValidationFailed`, `Internal_ServiceUnavailable`, `Internal_SystemError`, `Internal_DatabaseError`, `Internal_DatabaseConnectionError`, `Agent_ThreadNotFound`, `Agent_TurnNotFound`.
1232
+ *
1233
+ * @param trn Agent TRN in the route path, for example trn:agent:tenant:test0001:profile/runtime-assistant, trn:agent:tenant:test0001:prompt/support-core, trn:agent:tenant:test0001:skill/support-docs, or trn:agent:tenant:test0001:thread/runtime-assistant/<thread_id> depending on the command
1234
+ * @param options Call options.
1235
+ * @throws {AionixCallError} when the call fails, summarized over its attempts.
1236
+ */
1237
+ read(trn: string, options?: CallOptions): Promise<AgentTurnReadResponse> {
1238
+ return this.#engine.call<AgentTurnReadResponse>(OPERATIONS.agent_turn_read, { path: `/turns/${encodePathParam(trn)}`, primaryResourceTrn: trn }, options);
1239
+ }
1240
+ }