@aui.io/apollo 0.1.21 → 0.1.25

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 (110) hide show
  1. package/README.md +183 -0
  2. package/node_modules/@aui.io/apollo-cli/dist/src/commands/bundles.js +34 -9
  3. package/node_modules/@aui.io/apollo-cli/dist/src/commands/bundles.js.map +1 -1
  4. package/node_modules/@aui.io/apollo-cli/dist/src/commands/curl.d.ts +10 -0
  5. package/node_modules/@aui.io/apollo-cli/dist/src/commands/curl.js +63 -0
  6. package/node_modules/@aui.io/apollo-cli/dist/src/commands/curl.js.map +1 -0
  7. package/node_modules/@aui.io/apollo-cli/dist/src/commands/doctor.d.ts +13 -0
  8. package/node_modules/@aui.io/apollo-cli/dist/src/commands/doctor.js +89 -0
  9. package/node_modules/@aui.io/apollo-cli/dist/src/commands/doctor.js.map +1 -0
  10. package/node_modules/@aui.io/apollo-cli/dist/src/commands/hierarchy.js +24 -7
  11. package/node_modules/@aui.io/apollo-cli/dist/src/commands/hierarchy.js.map +1 -1
  12. package/node_modules/@aui.io/apollo-cli/dist/src/commands/runtime-version.d.ts +10 -0
  13. package/node_modules/@aui.io/apollo-cli/dist/src/commands/runtime-version.js +116 -0
  14. package/node_modules/@aui.io/apollo-cli/dist/src/commands/runtime-version.js.map +1 -0
  15. package/node_modules/@aui.io/apollo-cli/dist/src/commands/scenarios.js +3 -3
  16. package/node_modules/@aui.io/apollo-cli/dist/src/commands/scenarios.js.map +1 -1
  17. package/node_modules/@aui.io/apollo-cli/dist/src/commands/status.js +1 -0
  18. package/node_modules/@aui.io/apollo-cli/dist/src/commands/status.js.map +1 -1
  19. package/node_modules/@aui.io/apollo-cli/dist/src/index.d.ts +1 -0
  20. package/node_modules/@aui.io/apollo-cli/dist/src/index.js +26 -1
  21. package/node_modules/@aui.io/apollo-cli/dist/src/index.js.map +1 -1
  22. package/node_modules/@aui.io/apollo-cli/package.json +3 -3
  23. package/node_modules/@aui.io/apollo-core/dist/src/api/agent-settings.d.ts +166 -26
  24. package/node_modules/@aui.io/apollo-core/dist/src/api/agent-settings.js +106 -20
  25. package/node_modules/@aui.io/apollo-core/dist/src/api/agent-settings.js.map +1 -1
  26. package/node_modules/@aui.io/apollo-core/dist/src/api/capture.d.ts +22 -0
  27. package/node_modules/@aui.io/apollo-core/dist/src/api/capture.js +75 -0
  28. package/node_modules/@aui.io/apollo-core/dist/src/api/capture.js.map +1 -0
  29. package/node_modules/@aui.io/apollo-core/dist/src/api/management.d.ts +0 -1
  30. package/node_modules/@aui.io/apollo-core/dist/src/api/management.js +0 -6
  31. package/node_modules/@aui.io/apollo-core/dist/src/api/management.js.map +1 -1
  32. package/node_modules/@aui.io/apollo-core/dist/src/api/network.d.ts +19 -0
  33. package/node_modules/@aui.io/apollo-core/dist/src/api/network.js +53 -0
  34. package/node_modules/@aui.io/apollo-core/dist/src/api/network.js.map +1 -0
  35. package/node_modules/@aui.io/apollo-core/dist/src/api/transport.d.ts +14 -2
  36. package/node_modules/@aui.io/apollo-core/dist/src/api/transport.js +15 -28
  37. package/node_modules/@aui.io/apollo-core/dist/src/api/transport.js.map +1 -1
  38. package/node_modules/@aui.io/apollo-core/dist/src/config/index.d.ts +1 -1
  39. package/node_modules/@aui.io/apollo-core/dist/src/config/index.js +16 -1
  40. package/node_modules/@aui.io/apollo-core/dist/src/config/index.js.map +1 -1
  41. package/node_modules/@aui.io/apollo-core/dist/src/config/store.d.ts +10 -0
  42. package/node_modules/@aui.io/apollo-core/dist/src/config/store.js +24 -0
  43. package/node_modules/@aui.io/apollo-core/dist/src/config/store.js.map +1 -1
  44. package/node_modules/@aui.io/apollo-core/dist/src/config/types.d.ts +18 -1
  45. package/node_modules/@aui.io/apollo-core/dist/src/index.d.ts +10 -5
  46. package/node_modules/@aui.io/apollo-core/dist/src/index.js +9 -4
  47. package/node_modules/@aui.io/apollo-core/dist/src/index.js.map +1 -1
  48. package/node_modules/@aui.io/apollo-core/dist/src/runtime-version/index.d.ts +72 -0
  49. package/node_modules/@aui.io/apollo-core/dist/src/runtime-version/index.js +114 -0
  50. package/node_modules/@aui.io/apollo-core/dist/src/runtime-version/index.js.map +1 -0
  51. package/node_modules/@aui.io/apollo-core/dist/src/services/bundles.d.ts +47 -1
  52. package/node_modules/@aui.io/apollo-core/dist/src/services/bundles.js +60 -6
  53. package/node_modules/@aui.io/apollo-core/dist/src/services/bundles.js.map +1 -1
  54. package/node_modules/@aui.io/apollo-core/dist/src/services/clients.d.ts +4 -1
  55. package/node_modules/@aui.io/apollo-core/dist/src/services/clients.js +19 -0
  56. package/node_modules/@aui.io/apollo-core/dist/src/services/clients.js.map +1 -1
  57. package/node_modules/@aui.io/apollo-core/dist/src/services/doctor.d.ts +39 -0
  58. package/node_modules/@aui.io/apollo-core/dist/src/services/doctor.js +586 -0
  59. package/node_modules/@aui.io/apollo-core/dist/src/services/doctor.js.map +1 -0
  60. package/node_modules/@aui.io/apollo-core/dist/src/services/hierarchy.d.ts +78 -2
  61. package/node_modules/@aui.io/apollo-core/dist/src/services/hierarchy.js +177 -17
  62. package/node_modules/@aui.io/apollo-core/dist/src/services/hierarchy.js.map +1 -1
  63. package/node_modules/@aui.io/apollo-core/dist/src/services/requests.d.ts +22 -0
  64. package/node_modules/@aui.io/apollo-core/dist/src/services/requests.js +73 -0
  65. package/node_modules/@aui.io/apollo-core/dist/src/services/requests.js.map +1 -0
  66. package/node_modules/@aui.io/apollo-core/dist/src/services/scenarios.d.ts +15 -8
  67. package/node_modules/@aui.io/apollo-core/dist/src/services/scenarios.js +80 -58
  68. package/node_modules/@aui.io/apollo-core/dist/src/services/scenarios.js.map +1 -1
  69. package/node_modules/@aui.io/apollo-core/dist/src/services/status.service.d.ts +2 -0
  70. package/node_modules/@aui.io/apollo-core/dist/src/services/status.service.js +10 -2
  71. package/node_modules/@aui.io/apollo-core/dist/src/services/status.service.js.map +1 -1
  72. package/node_modules/@aui.io/apollo-core/package.json +1 -1
  73. package/node_modules/@aui.io/apollo-tui/dist/src/actions/registry.js +16 -2
  74. package/node_modules/@aui.io/apollo-tui/dist/src/actions/registry.js.map +1 -1
  75. package/node_modules/@aui.io/apollo-tui/dist/src/activity/ActivityDrawer.js +31 -16
  76. package/node_modules/@aui.io/apollo-tui/dist/src/activity/ActivityDrawer.js.map +1 -1
  77. package/node_modules/@aui.io/apollo-tui/dist/src/activity/requests.d.ts +19 -0
  78. package/node_modules/@aui.io/apollo-tui/dist/src/activity/requests.js +29 -0
  79. package/node_modules/@aui.io/apollo-tui/dist/src/activity/requests.js.map +1 -0
  80. package/node_modules/@aui.io/apollo-tui/dist/src/author/AuthorHome.d.ts +3 -1
  81. package/node_modules/@aui.io/apollo-tui/dist/src/author/AuthorHome.js +6 -18
  82. package/node_modules/@aui.io/apollo-tui/dist/src/author/AuthorHome.js.map +1 -1
  83. package/node_modules/@aui.io/apollo-tui/dist/src/author/ResourcesView.js +26 -4
  84. package/node_modules/@aui.io/apollo-tui/dist/src/author/ResourcesView.js.map +1 -1
  85. package/node_modules/@aui.io/apollo-tui/dist/src/context/ContextSwitcher.js +6 -2
  86. package/node_modules/@aui.io/apollo-tui/dist/src/context/ContextSwitcher.js.map +1 -1
  87. package/node_modules/@aui.io/apollo-tui/dist/src/lib/actions.js +95 -16
  88. package/node_modules/@aui.io/apollo-tui/dist/src/lib/actions.js.map +1 -1
  89. package/node_modules/@aui.io/apollo-tui/dist/src/lib/commands.d.ts +1 -1
  90. package/node_modules/@aui.io/apollo-tui/dist/src/lib/commands.js +20 -0
  91. package/node_modules/@aui.io/apollo-tui/dist/src/lib/commands.js.map +1 -1
  92. package/node_modules/@aui.io/apollo-tui/dist/src/lib/diagnostics.d.ts +8 -0
  93. package/node_modules/@aui.io/apollo-tui/dist/src/lib/diagnostics.js +109 -0
  94. package/node_modules/@aui.io/apollo-tui/dist/src/lib/diagnostics.js.map +1 -0
  95. package/node_modules/@aui.io/apollo-tui/dist/src/lib/scope.d.ts +2 -0
  96. package/node_modules/@aui.io/apollo-tui/dist/src/lib/scope.js +1 -0
  97. package/node_modules/@aui.io/apollo-tui/dist/src/lib/scope.js.map +1 -1
  98. package/node_modules/@aui.io/apollo-tui/dist/src/opentui-app.js +2 -2
  99. package/node_modules/@aui.io/apollo-tui/dist/src/opentui-app.js.map +1 -1
  100. package/node_modules/@aui.io/apollo-tui/dist/src/shell/Breadcrumb.d.ts +4 -2
  101. package/node_modules/@aui.io/apollo-tui/dist/src/shell/Breadcrumb.js +5 -3
  102. package/node_modules/@aui.io/apollo-tui/dist/src/shell/Breadcrumb.js.map +1 -1
  103. package/node_modules/@aui.io/apollo-tui/dist/src/ui/SplashCard.d.ts +5 -0
  104. package/node_modules/@aui.io/apollo-tui/dist/src/ui/SplashCard.js +56 -0
  105. package/node_modules/@aui.io/apollo-tui/dist/src/ui/SplashCard.js.map +1 -0
  106. package/node_modules/@aui.io/apollo-tui/dist/src/ui/wordmark.d.ts +73 -0
  107. package/node_modules/@aui.io/apollo-tui/dist/src/ui/wordmark.js +488 -0
  108. package/node_modules/@aui.io/apollo-tui/dist/src/ui/wordmark.js.map +1 -0
  109. package/node_modules/@aui.io/apollo-tui/package.json +2 -2
  110. package/package.json +4 -4
@@ -1,23 +1,34 @@
1
1
  /**
2
- * agent-settings client — scenarios only. The v1 service keeps exactly one
3
- * job in the v3 console: evaluation suites (build bundles) and their scores.
4
- * Program schemas moved to runtime-api; everything else management-shaped
5
- * lives on apollo-api. When these two resources move to the gateway, this
6
- * file is the only thing that changes.
2
+ * agent-settings client — three jobs. Everything else management-shaped lives
3
+ * on apollo-api, and program schemas moved to runtime-api.
4
+ *
5
+ * 1. Scenarios: evaluation suites (build bundles) and their scores.
7
6
  *
8
7
  * POST /v1/agents/{agent_id}/build-bundles/push (multipart)
9
8
  * GET /v1/agents/{agent_id}/build-bundles/pull
10
9
  * POST /v1/agents/{agent_id}/evaluation-scores/push (JSON)
11
10
  * GET /v1/agents/{agent_id}/evaluation-scores/pull (array)
12
11
  *
13
- * A build bundle is exactly one scenarios JSON + zero-or-more flat intent
14
- * files. On the wire the scenarios file is named `scenarios.aui.json` (the
15
- * server contract); the local checkout spells it `scenarios/scenarios.json`
16
- * the mapping lives here so nothing above sees the v1 name.
12
+ * 2. Agent creation: `agent create` runs the clone-from-template sequence
13
+ * itself instead of posting to apollo's create endpoint, so a checkout
14
+ * starts from a named template rather than whatever the environment's
15
+ * default category happens to hold (see `services/hierarchy.ts`).
16
+ *
17
+ * GET /v1/agents/{agent_id}
18
+ * POST /v1/agents
19
+ * POST /v1/agents/{agent_id}/versions
20
+ * POST /v1/agents/{agent_id}/versions/{version_id}/publish
21
+ * PUT /v1/agents/{agent_id}/active-version
22
+ *
23
+ * 3. The runtime-version catalog — which engine builds exist and which one a
24
+ * checkout should pin (see `runtime-version/index.ts`).
25
+ *
26
+ * GET /v1/runtime-versions
27
+ *
28
+ * A build bundle is an opaque tree of relative POSIX paths. Local checkouts
29
+ * still live under `scenarios/`; the wire uses those relative paths as-is.
17
30
  */
18
31
  import type { HttpClient } from "./client-types.js";
19
- /** Wire filename of the scenarios file inside a build bundle. */
20
- export declare const WIRE_SCENARIOS_FILE = "scenarios.aui.json";
21
32
  /** A single scenario inside the bundle. */
22
33
  export interface Scenario {
23
34
  /** Stable identifier, unique within the bundle. */
@@ -27,13 +38,19 @@ export interface Scenario {
27
38
  /** Extra per-scenario keys preserved verbatim on the server. */
28
39
  extra?: Record<string, unknown>;
29
40
  }
41
+ /** One file listed on a pulled build bundle. */
42
+ export interface BuildBundleFile {
43
+ path: string;
44
+ size: number;
45
+ }
30
46
  /** 201 response body from `build-bundles/push`. */
31
47
  export interface BuildBundlePushResponse {
32
48
  agent_id: string;
33
49
  bundle_id: string;
34
50
  version: number;
35
- scenarios_count: number;
36
- intents_count: number;
51
+ /** Optional on the wire: older deployments omit it, so callers count
52
+ * what they uploaded instead. */
53
+ files_count?: number;
37
54
  created_at: string;
38
55
  }
39
56
  /** The bundle document returned by `build-bundles/pull`. */
@@ -41,11 +58,7 @@ export interface BuildBundle {
41
58
  id: string;
42
59
  agent_id: string;
43
60
  version: number;
44
- scenarios: Scenario[];
45
- intents: {
46
- filename: string;
47
- size: number;
48
- }[];
61
+ files?: BuildBundleFile[];
49
62
  notes?: string | null;
50
63
  created_at: string;
51
64
  created_by: string;
@@ -53,8 +66,9 @@ export interface BuildBundle {
53
66
  /** 200 response body from `build-bundles/pull`. */
54
67
  export interface BuildBundlePullResponse {
55
68
  bundle: BuildBundle;
56
- /** Map of intent filename → short-lived signed GCS URL. */
57
- intent_urls: Record<string, string>;
69
+ /** Relative POSIX path → short-lived signed GCS URL. Optional on the wire:
70
+ * an empty bundle omits the map rather than sending `{}`. */
71
+ file_urls?: Record<string, string>;
58
72
  expires_at: string;
59
73
  }
60
74
  export type ScenarioResultStatus = "pass" | "open";
@@ -139,23 +153,149 @@ export interface EvaluationScoreRead extends ScoreReportBlocks {
139
153
  }
140
154
  /** A file to upload inside a build-bundle push. */
141
155
  export interface BundleUploadFile {
142
- /** Filename on the wire (basename only — no path separators). */
143
- filename: string;
156
+ /** Relative POSIX path inside the bundle (e.g. `scenarios.json`, `intent/faq.md`). */
157
+ path: string;
144
158
  content: Uint8Array;
145
159
  contentType?: string;
146
160
  }
161
+ /**
162
+ * `regular` = a runtime agent, scoped to a network. `template` = a clone
163
+ * source, scoped to a category and never executed. The kind and the scope type
164
+ * are validated against each other server-side.
165
+ */
166
+ export type AgentRecordKind = "regular" | "template";
167
+ /** Scope of an agent-settings record. Uppercase on the wire, unlike `kind`. */
168
+ export interface AgentRecordScope {
169
+ type: "NETWORK" | "NETWORK_CATEGORY";
170
+ network_id?: string | null;
171
+ account_id?: string | null;
172
+ organization_id?: string | null;
173
+ network_category_id?: string | null;
174
+ }
175
+ /**
176
+ * Server-computed stats for the agent's active bundle. `runtime_version` is
177
+ * the engine build that bundle was authored against — the record's own answer
178
+ * to "which runtime is this agent on", independent of the catalog.
179
+ */
180
+ export interface AgentBlobStats {
181
+ aui_file_count?: number;
182
+ total_bytes?: number;
183
+ aui_schema_version?: string | null;
184
+ runtime_version?: string | null;
185
+ [key: string]: unknown;
186
+ }
187
+ /**
188
+ * The raw agent-settings Agent record. Apollo republishes a narrower shape
189
+ * (`api/management.ts` `Agent`), where `project_id` is `scope.account_id` and
190
+ * `live_version_id` is `active_version_tag`. Apollo's projection drops
191
+ * `active_blob_stats` entirely, so the runtime an agent is on is only
192
+ * readable here.
193
+ */
194
+ export interface AgentRecord {
195
+ id: string;
196
+ name: string;
197
+ scope: AgentRecordScope;
198
+ kind: AgentRecordKind;
199
+ /** False = legacy DB-managed records; true = blob mode (push/pull). */
200
+ bundle_mode: boolean;
201
+ active_version_id?: string | null;
202
+ active_version_tag?: string | null;
203
+ active_blob_stats?: AgentBlobStats | null;
204
+ agent_metadata?: Record<string, unknown> | null;
205
+ created_at: string;
206
+ updated_at: string;
207
+ }
208
+ /**
209
+ * One runtime-version catalog record. A record names a runtime FAMILY, not a
210
+ * single build: `runtime_version` is the immutable family id and
211
+ * `latest_version` is the exact build the gateway currently routes that
212
+ * family to — so pinning a family keeps following its patches.
213
+ */
214
+ export interface RuntimeVersionRecord {
215
+ id: string;
216
+ /** Immutable family id, e.g. "0.2.0". Patch numbers do not name a family. */
217
+ runtime_version: string;
218
+ /** The build to route to — the `runtime-version` header value, e.g. "0.2.4". */
219
+ latest_version: string;
220
+ /** What operators see, e.g. "v0.2". */
221
+ display_name: string;
222
+ description?: string | null;
223
+ notes?: string[];
224
+ /** `published` = an official release; `custom` = a bespoke build. */
225
+ type: "published" | "custom";
226
+ /** Custom entries are served by their own deployment, not the gateway. */
227
+ custom_link?: string | null;
228
+ /** false = retired from selection; still listed for history. */
229
+ is_visible: boolean;
230
+ created_at?: string;
231
+ updated_at?: string;
232
+ }
233
+ /** The raw agent-settings AgentVersion record. */
234
+ export interface AgentVersionRecord {
235
+ id: string;
236
+ agent_id: string;
237
+ version_number: number;
238
+ version_revision_number: number;
239
+ version_tag: string;
240
+ status: "draft" | "published" | "archived";
241
+ parent_version_id?: string | null;
242
+ label?: string | null;
243
+ tags: string[];
244
+ notes?: string | null;
245
+ created_at: string;
246
+ }
147
247
  export declare class AgentSettingsClient {
148
248
  private readonly http;
149
249
  constructor(http: HttpClient);
150
- /** Push one bundle version: the scenarios JSON + every intent file. */
250
+ /** One agent record the template lookup behind `agent create`. */
251
+ getAgent(agentId: string): Promise<AgentRecord>;
252
+ /**
253
+ * Create the agent root. `scope` must carry all four ids for a `regular`
254
+ * agent, and the record's uniqueness key is derived from `network_id` — a
255
+ * network that already hosts an agent is rejected with a 409.
256
+ */
257
+ createAgent(input: {
258
+ name: string;
259
+ scope: AgentRecordScope;
260
+ kind: AgentRecordKind;
261
+ bundleMode: boolean;
262
+ createdBy: string;
263
+ agentMetadata?: Record<string, unknown>;
264
+ }): Promise<AgentRecord>;
265
+ /**
266
+ * Create a draft version. `template` clones the template agent's active
267
+ * version (bundle, build bundle and evaluation scores); `version` clones
268
+ * another version of this same agent; `empty` bootstraps a minimal bundle.
269
+ * The response is read back after the clone commits, so `version_tag`
270
+ * already carries the committed revision.
271
+ */
272
+ createDraft(agentId: string, input: {
273
+ source: "template" | "version" | "empty";
274
+ fromTemplate?: string;
275
+ fromVersion?: string;
276
+ createdBy: string;
277
+ label?: string;
278
+ tags?: string[];
279
+ notes?: string;
280
+ }): Promise<AgentVersionRecord>;
281
+ /** Freeze a draft. Publishing does not make it live — activate does. */
282
+ publishVersion(agentId: string, versionId: string, publishedBy: string): Promise<AgentVersionRecord>;
283
+ /** Point the agent at a published version; returns the updated agent. */
284
+ activateVersion(agentId: string, versionId: string): Promise<AgentRecord>;
285
+ /**
286
+ * The runtime-version catalog, newest first. Paged under an `items`
287
+ * envelope rather than apollo's `results` one — this is agent-settings'
288
+ * own surface, not a republished apollo route.
289
+ */
290
+ listRuntimeVersions(size?: number): Promise<RuntimeVersionRecord[]>;
291
+ /** Push one bundle version: every file under the local scenarios tree. */
151
292
  pushBuildBundle(agentId: string, input: {
152
- scenariosJson: string;
153
- intents: BundleUploadFile[];
293
+ files: BundleUploadFile[];
154
294
  createdBy: string;
155
295
  notes?: string;
156
296
  }): Promise<BuildBundlePushResponse>;
157
297
  /**
158
- * Pull a bundle (latest by default). Intent bytes are NOT proxied — the
298
+ * Pull a bundle (latest by default). File bytes are NOT proxied — the
159
299
  * response carries short-lived signed URLs the caller downloads directly.
160
300
  * 404 = the agent has no bundle yet; callers map it to "nothing to pull".
161
301
  */
@@ -1,40 +1,126 @@
1
- /** Wire filename of the scenarios file inside a build bundle. */
2
- export const WIRE_SCENARIOS_FILE = "scenarios.aui.json";
1
+ /**
2
+ * Normalize one catalog row. A record without an id or a routable build
3
+ * cannot be pinned, so it is dropped rather than surfaced half-formed.
4
+ */
5
+ function runtimeVersionRecord(raw) {
6
+ const id = typeof raw.id === "string" ? raw.id : undefined;
7
+ const latest = typeof raw.latest_version === "string" ? raw.latest_version : "";
8
+ if (!id || !latest)
9
+ return undefined;
10
+ const family = typeof raw.runtime_version === "string" && raw.runtime_version
11
+ ? raw.runtime_version
12
+ : latest;
13
+ return {
14
+ id,
15
+ runtime_version: family,
16
+ latest_version: latest,
17
+ display_name: typeof raw.display_name === "string" && raw.display_name
18
+ ? raw.display_name
19
+ : latest,
20
+ description: typeof raw.description === "string" ? raw.description : null,
21
+ notes: Array.isArray(raw.notes) ? raw.notes : [],
22
+ type: raw.type === "custom" ? "custom" : "published",
23
+ custom_link: typeof raw.custom_link === "string" ? raw.custom_link : null,
24
+ is_visible: raw.is_visible !== false,
25
+ ...(typeof raw.created_at === "string" ? { created_at: raw.created_at } : {}),
26
+ ...(typeof raw.updated_at === "string" ? { updated_at: raw.updated_at } : {}),
27
+ };
28
+ }
3
29
  export class AgentSettingsClient {
4
30
  http;
5
31
  constructor(http) {
6
32
  this.http = http;
7
33
  }
8
- /** Push one bundle version: the scenarios JSON + every intent file. */
34
+ /** One agent record the template lookup behind `agent create`. */
35
+ getAgent(agentId) {
36
+ return this.http.request(`/v1/agents/${encodeURIComponent(agentId)}`);
37
+ }
38
+ /**
39
+ * Create the agent root. `scope` must carry all four ids for a `regular`
40
+ * agent, and the record's uniqueness key is derived from `network_id` — a
41
+ * network that already hosts an agent is rejected with a 409.
42
+ */
43
+ createAgent(input) {
44
+ return this.http.request("/v1/agents", {
45
+ method: "POST",
46
+ body: {
47
+ name: input.name,
48
+ scope: input.scope,
49
+ kind: input.kind,
50
+ bundle_mode: input.bundleMode,
51
+ created_by: input.createdBy,
52
+ agent_metadata: input.agentMetadata ?? {},
53
+ },
54
+ });
55
+ }
56
+ /**
57
+ * Create a draft version. `template` clones the template agent's active
58
+ * version (bundle, build bundle and evaluation scores); `version` clones
59
+ * another version of this same agent; `empty` bootstraps a minimal bundle.
60
+ * The response is read back after the clone commits, so `version_tag`
61
+ * already carries the committed revision.
62
+ */
63
+ createDraft(agentId, input) {
64
+ return this.http.request(`/v1/agents/${encodeURIComponent(agentId)}/versions`, {
65
+ method: "POST",
66
+ body: {
67
+ source: input.source,
68
+ ...(input.fromTemplate === undefined
69
+ ? {}
70
+ : { from_template: input.fromTemplate }),
71
+ ...(input.fromVersion === undefined
72
+ ? {}
73
+ : { from_version: input.fromVersion }),
74
+ bump_mode: "version_number",
75
+ created_by: input.createdBy,
76
+ ...(input.label === undefined ? {} : { label: input.label }),
77
+ tags: input.tags ?? [],
78
+ ...(input.notes === undefined ? {} : { notes: input.notes }),
79
+ },
80
+ });
81
+ }
82
+ /** Freeze a draft. Publishing does not make it live — activate does. */
83
+ publishVersion(agentId, versionId, publishedBy) {
84
+ return this.http.request(`/v1/agents/${encodeURIComponent(agentId)}/versions/${encodeURIComponent(versionId)}/publish`, { method: "POST", body: { published_by: publishedBy } });
85
+ }
86
+ /** Point the agent at a published version; returns the updated agent. */
87
+ activateVersion(agentId, versionId) {
88
+ return this.http.request(`/v1/agents/${encodeURIComponent(agentId)}/active-version`, { method: "PUT", body: { active_version_id: versionId } });
89
+ }
90
+ /**
91
+ * The runtime-version catalog, newest first. Paged under an `items`
92
+ * envelope rather than apollo's `results` one — this is agent-settings'
93
+ * own surface, not a republished apollo route.
94
+ */
95
+ async listRuntimeVersions(size = 100) {
96
+ const page = await this.http.request("/v1/runtime-versions", { query: { size } });
97
+ return (page.items ?? [])
98
+ .map((item) => runtimeVersionRecord(item))
99
+ .filter((record) => record !== undefined);
100
+ }
101
+ /** Push one bundle version: every file under the local scenarios tree. */
9
102
  async pushBuildBundle(agentId, input) {
10
103
  return this.http.request(`/v1/agents/${encodeURIComponent(agentId)}/build-bundles/push`, {
11
104
  method: "POST",
12
105
  form: {
13
- files: [
14
- {
15
- field: "files",
16
- filename: WIRE_SCENARIOS_FILE,
17
- content: input.scenariosJson,
18
- contentType: "application/json",
19
- },
20
- ...input.intents.map((file) => ({
21
- field: "files",
22
- filename: file.filename,
23
- content: file.content,
24
- ...(file.contentType === undefined
25
- ? {}
26
- : { contentType: file.contentType }),
27
- })),
28
- ],
106
+ files: input.files.map((file) => ({
107
+ field: "files",
108
+ filename: file.path,
109
+ content: file.content,
110
+ ...(file.contentType === undefined
111
+ ? {}
112
+ : { contentType: file.contentType }),
113
+ })),
29
114
  fields: {
30
115
  created_by: input.createdBy,
116
+ paths: JSON.stringify(input.files.map((file) => file.path)),
31
117
  ...(input.notes === undefined ? {} : { notes: input.notes }),
32
118
  },
33
119
  },
34
120
  });
35
121
  }
36
122
  /**
37
- * Pull a bundle (latest by default). Intent bytes are NOT proxied — the
123
+ * Pull a bundle (latest by default). File bytes are NOT proxied — the
38
124
  * response carries short-lived signed URLs the caller downloads directly.
39
125
  * 404 = the agent has no bundle yet; callers map it to "nothing to pull".
40
126
  */
@@ -1 +1 @@
1
- {"version":3,"file":"agent-settings.js","sourceRoot":"","sources":["../../../src/api/agent-settings.ts"],"names":[],"mappings":"AAmBA,iEAAiE;AACjE,MAAM,CAAC,MAAM,mBAAmB,GAAG,oBAAoB,CAAC;AAwIxD,MAAM,OAAO,mBAAmB;IACM;IAApC,YAAoC,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IA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AM,EAAE,MAAM,EAAE,IAAI,EAAE,CACzB,CAAC;IACJ,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,oBAAoB,CAC/B,OAAe,EACf,OAA4E;QAE5E,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CACtB,cAAc,kBAAkB,CAAC,OAAO,CAAC,yBAAyB,EAClE;YACE,KAAK,EAAE;gBACL,UAAU,EAAE,OAAO,CAAC,SAAS;gBAC7B,WAAW,EAAE,OAAO,CAAC,UAAU;gBAC/B,0BAA0B,EAAE,OAAO,CAAC,aAAa;aAClD;SACF,CACF,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,22 @@
1
+ import type { RequestCapture } from "./transport.js";
2
+ /** What a Transport needs from its capture destination. */
3
+ export interface CaptureSink {
4
+ add(entry: RequestCapture): Promise<void>;
5
+ }
6
+ export declare function defaultCapturePath(): string;
7
+ export declare class CaptureLog implements CaptureSink {
8
+ private readonly filePath?;
9
+ private entries;
10
+ private readonly listeners;
11
+ /** Per-write suffix — see `persist`. */
12
+ private writeSeq;
13
+ /** No path = default file with the test-env guard; a string pins it. */
14
+ constructor(filePath?: string | undefined);
15
+ /** Stable reference between mutations — safe for useSyncExternalStore. */
16
+ snapshot: () => readonly RequestCapture[];
17
+ subscribe: (listener: () => void) => (() => void);
18
+ add(entry: RequestCapture): Promise<void>;
19
+ private persist;
20
+ }
21
+ /** The one log — module-level so the CLI process and TUI session share it. */
22
+ export declare const captureLog: CaptureLog;
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Shared request-capture log — the single sink every Transport feeds.
3
+ *
4
+ * One process gets one log, so a command's requests survive across all six
5
+ * service transports instead of each transport overwriting the capture file
6
+ * with only its own buffer (the wart CONFIGURATION.md used to warn about).
7
+ *
8
+ * Consumers:
9
+ * - `apollo curl` reads the flushed file after the fact
10
+ * - `--verbose` subscribes and streams one line per finished request
11
+ * - the TUI activity drawer subscribes for its live "api requests" tail
12
+ *
13
+ * Entries arrive already redacted (transport.ts) — nothing here may ever
14
+ * see a raw secret. Persistence mirrors the old per-transport behavior:
15
+ * atomic tmp+rename, dir 0700 / file 0600, best-effort (a failed write can
16
+ * never fail an API request), and disabled under NODE_ENV=test unless a
17
+ * path is pinned explicitly.
18
+ */
19
+ import { mkdir, rename, writeFile } from "node:fs/promises";
20
+ import { homedir } from "node:os";
21
+ import path from "node:path";
22
+ /** Ring size — six services share one log, so roomier than the old 50 each. */
23
+ const CAPTURE_CAP = 100;
24
+ export function defaultCapturePath() {
25
+ return path.join(homedir(), ".apollo", "last-requests.json");
26
+ }
27
+ export class CaptureLog {
28
+ filePath;
29
+ entries = [];
30
+ listeners = new Set();
31
+ /** Per-write suffix — see `persist`. */
32
+ writeSeq = 0;
33
+ /** No path = default file with the test-env guard; a string pins it. */
34
+ constructor(filePath) {
35
+ this.filePath = filePath;
36
+ }
37
+ /** Stable reference between mutations — safe for useSyncExternalStore. */
38
+ snapshot = () => this.entries;
39
+ subscribe = (listener) => {
40
+ this.listeners.add(listener);
41
+ return () => this.listeners.delete(listener);
42
+ };
43
+ async add(entry) {
44
+ this.entries = [...this.entries, entry].slice(-CAPTURE_CAP);
45
+ for (const listener of this.listeners)
46
+ listener();
47
+ await this.persist();
48
+ }
49
+ async persist() {
50
+ const target = this.filePath ??
51
+ (process.env.NODE_ENV === "test" ? undefined : defaultCapturePath());
52
+ if (target === undefined)
53
+ return;
54
+ try {
55
+ await mkdir(path.dirname(target), { recursive: true, mode: 0o700 });
56
+ // Concurrent requests persist concurrently, so each write needs its
57
+ // own scratch file: sharing one truncates a write already in flight
58
+ // and renames the spliced result into place. Renames stay atomic, so
59
+ // the target always holds a whole snapshot — at worst one entry stale
60
+ // if an older write lands last, which the next request corrects.
61
+ const temporary = `${target}.${process.pid}.${++this.writeSeq}.tmp`;
62
+ await writeFile(temporary, `${JSON.stringify(this.entries, null, 2)}\n`, {
63
+ encoding: "utf8",
64
+ mode: 0o600,
65
+ });
66
+ await rename(temporary, target);
67
+ }
68
+ catch {
69
+ // Request capture must never make a successful API request fail.
70
+ }
71
+ }
72
+ }
73
+ /** The one log — module-level so the CLI process and TUI session share it. */
74
+ export const captureLog = new CaptureLog();
75
+ //# sourceMappingURL=capture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capture.js","sourceRoot":"","sources":["../../../src/api/capture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAI7B,+EAA+E;AAC/E,MAAM,WAAW,GAAG,GAAG,CAAC;AAOxB,MAAM,UAAU,kBAAkB;IAChC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,oBAAoB,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,OAAO,UAAU;IAOQ;IANrB,OAAO,GAA8B,EAAE,CAAC;IAC/B,SAAS,GAAG,IAAI,GAAG,EAAc,CAAC;IACnD,wCAAwC;IAChC,QAAQ,GAAG,CAAC,CAAC;IAErB,wEAAwE;IACxE,YAA6B,QAAiB;QAAjB,aAAQ,GAAR,QAAQ,CAAS;IAAG,CAAC;IAElD,0EAA0E;IAC1E,QAAQ,GAAG,GAA8B,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC;IAEzD,SAAS,GAAG,CAAC,QAAoB,EAAgB,EAAE;QACjD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC7B,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC/C,CAAC,CAAC;IAEF,KAAK,CAAC,GAAG,CAAC,KAAqB;QAC7B,IAAI,CAAC,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,CAAC;QAC5D,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS;YAAE,QAAQ,EAAE,CAAC;QAClD,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;IACvB,CAAC;IAEO,KAAK,CAAC,OAAO;QACnB,MAAM,MAAM,GACV,IAAI,CAAC,QAAQ;YACb,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,kBAAkB,EAAE,CAAC,CAAC;QACvE,IAAI,MAAM,KAAK,SAAS;YAAE,OAAO;QACjC,IAAI,CAAC;YACH,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;YACpE,oEAAoE;YACpE,oEAAoE;YACpE,qEAAqE;YACrE,sEAAsE;YACtE,iEAAiE;YACjE,MAAM,SAAS,GAAG,GAAG,MAAM,IAAI,OAAO,CAAC,GAAG,IAAI,EAAE,IAAI,CAAC,QAAQ,MAAM,CAAC;YACpE,MAAM,SAAS,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;gBACvE,QAAQ,EAAE,MAAM;gBAChB,IAAI,EAAE,KAAK;aACZ,CAAC,CAAC;YACH,MAAM,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAClC,CAAC;QAAC,MAAM,CAAC;YACP,iEAAiE;QACnE,CAAC;IACH,CAAC;CACF;AAED,8EAA8E;AAC9E,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC"}
@@ -65,7 +65,6 @@ export declare class ManagementClient {
65
65
  createProject(name: string): Promise<Project>;
66
66
  listAgents(projectId: string, name?: string): Promise<Page<Agent>>;
67
67
  getAgent(agentId: string): Promise<Agent>;
68
- createAgent(projectId: string, name: string): Promise<Agent>;
69
68
  listVersions(agentId: string, filters?: {
70
69
  status?: VersionStatus;
71
70
  tag?: string;
@@ -37,12 +37,6 @@ export class ManagementClient {
37
37
  getAgent(agentId) {
38
38
  return this.http.request(`/management/v1/agents/${agentId}`);
39
39
  }
40
- createAgent(projectId, name) {
41
- return this.http.request(`/management/v1/projects/${projectId}/agents`, {
42
- method: "POST",
43
- body: { name },
44
- });
45
- }
46
40
  listVersions(agentId, filters = {}) {
47
41
  return this.http.request(`/management/v1/agents/${agentId}/versions`, {
48
42
  query: {
@@ -1 +1 @@
1
- {"version":3,"file":"management.js","sourceRoot":"","sources":["../../../src/api/management.ts"],"names":[],"mappings":"AA0DA;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAC7B,KAAqC,EACrC,QAAwB;IAExB,MAAM,IAAI,GAAG,KAAK,CAAC,eAAe,CAAC;IACnC,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAC;IAC5B,OAAO,QAAQ,CAAC,IAAI,CAClB,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,IAAI,IAAI,OAAO,CAAC,WAAW,KAAK,IAAI,CACjE,CAAC;AACJ,CAAC;AAED,MAAM,OAAO,gBAAgB;IACS;IAApC,YAAoC,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD,YAAY;QACjB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAEM,UAAU,CAAC,SAAiB;QACjC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,2BAA2B,SAAS,EAAE,CAAC,CAAC;IACnE,CAAC;IAEM,aAAa,CAAC,IAAY;QAC/B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,yBAAyB,EAAE;YAClD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,EAAE,IAAI,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IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACnD,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS;QAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC7C,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAClC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC;QAAE,OAAO,SAAS,CAAC;IACtD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AAC7B,CAAC;AAED,SAAS,UAAU,CAAC,QAAwB,EAAE,KAAa;IACzD,MAAM,IAAI,GAAG,QAAQ;SAClB,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,cAAc,KAAK,KAAK,CAAC;SACrD,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,uBAAuB,GAAG,IAAI,CAAC,uBAAuB,CAAC,CAAC;IACvF,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;AACjB,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { HttpClient } from "./client-types.js";
2
+ export interface Network {
3
+ id: string;
4
+ name: string;
5
+ }
6
+ export declare class NetworkClient {
7
+ private readonly http;
8
+ constructor(http: HttpClient);
9
+ /**
10
+ * Create an ACTIVE network and return its id. Not retried: the transport
11
+ * only replays GETs, and a replayed create would leak a second network.
12
+ */
13
+ create(input: {
14
+ name: string;
15
+ organizationId: string;
16
+ accountId: string;
17
+ categoryId: string;
18
+ }): Promise<Network>;
19
+ }
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Network service — one call, one reason: `agent create` needs a network for
3
+ * the new agent's scope. agent-settings refuses a `regular`-kind agent unless
4
+ * `scope` carries all four ids (network, account, organization, category), and
5
+ * it derives the record's unique `scope_id` from the network id alone — so an
6
+ * agent cannot share a network with another agent, and every create allocates
7
+ * its own. This is the same call apollo-api makes inside its own create
8
+ * endpoint; the console makes it directly (see docs/ARCHITECTURE.md §2.5).
9
+ *
10
+ * POST /v1/network
11
+ *
12
+ * Auth is the odd one out on the platform: this service reads the session
13
+ * token from `x-access-token` (like identity), not `Authorization: Bearer`,
14
+ * and spells the org header `organization-id`. A valid user token makes its
15
+ * service-api-key check step aside, so no key rides along.
16
+ */
17
+ import { CliError } from "../errors/index.js";
18
+ export class NetworkClient {
19
+ http;
20
+ constructor(http) {
21
+ this.http = http;
22
+ }
23
+ /**
24
+ * Create an ACTIVE network and return its id. Not retried: the transport
25
+ * only replays GETs, and a replayed create would leak a second network.
26
+ */
27
+ async create(input) {
28
+ // `| undefined`: an empty response body parses to undefined, and a
29
+ // network create that answered with nothing is exactly the case below.
30
+ const response = await this.http.request("/v1/network", {
31
+ method: "POST",
32
+ // Sent by every other client of this service (browser, aui CLI); the
33
+ // route reads scope from the body, so this is context, not auth.
34
+ headers: { "account-id": input.accountId },
35
+ body: {
36
+ name: input.name,
37
+ organization: input.organizationId,
38
+ account: input.accountId,
39
+ category: input.categoryId,
40
+ status: "ACTIVE",
41
+ },
42
+ });
43
+ const id = response?.data?.id ?? response?.data?._id;
44
+ if (!id) {
45
+ throw new CliError("The network service did not return a network id.", {
46
+ code: "NETWORK_CREATE_EMPTY",
47
+ suggestion: "Re-run `apollo agent create`; inspect `apollo curl --last`.",
48
+ });
49
+ }
50
+ return { id, name: input.name };
51
+ }
52
+ }
53
+ //# sourceMappingURL=network.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"network.js","sourceRoot":"","sources":["../../../src/api/network.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAa9C,MAAM,OAAO,aAAa;IACY;IAApC,YAAoC,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAExD;;;OAGG;IACI,KAAK,CAAC,MAAM,CAAC,KAKnB;QACC,mEAAmE;QACnE,uEAAuE;QACvE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAA8B,aAAa,EAAE;YACnF,MAAM,EAAE,MAAM;YACd,qEAAqE;YACrE,iEAAiE;YACjE,OAAO,EAAE,EAAE,YAAY,EAAE,KAAK,CAAC,SAAS,EAAE;YAC1C,IAAI,EAAE;gBACJ,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,YAAY,EAAE,KAAK,CAAC,cAAc;gBAClC,OAAO,EAAE,KAAK,CAAC,SAAS;gBACxB,QAAQ,EAAE,KAAK,CAAC,UAAU;gBAC1B,MAAM,EAAE,QAAQ;aACjB;SACF,CAAC,CAAC;QACH,MAAM,EAAE,GAAG,QAAQ,EAAE,IAAI,EAAE,EAAE,IAAI,QAAQ,EAAE,IAAI,EAAE,GAAG,CAAC;QACrD,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,MAAM,IAAI,QAAQ,CAAC,kDAAkD,EAAE;gBACrE,IAAI,EAAE,sBAAsB;gBAC5B,UAAU,EAAE,6DAA6D;aAC1E,CAAC,CAAC;QACL,CAAC;QACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;IAClC,CAAC;CACF"}