@openagentpack/sdk 0.2.0-beta.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +230 -10
- package/dist/index.js +1330 -230
- package/dist/{session-event-CObCawiI.d.ts → session-event-CxLg_XqS.d.ts} +51 -7
- package/dist/session-events.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -35,9 +35,22 @@ var REQUIRED_METHODS_BY_KIND = {
|
|
|
35
35
|
skill: ["createSkill", "updateSkill", "deleteSkill"],
|
|
36
36
|
agent: ["createAgent", "updateAgent", "deleteAgent"],
|
|
37
37
|
template: ["createTemplate", "updateTemplate", "archiveTemplate"],
|
|
38
|
-
memory_store: [
|
|
38
|
+
memory_store: [
|
|
39
|
+
"createMemoryStore",
|
|
40
|
+
"deleteMemoryStore",
|
|
41
|
+
"listMemoryStores",
|
|
42
|
+
"getMemoryStore",
|
|
43
|
+
"updateMemoryStore",
|
|
44
|
+
"createMemory",
|
|
45
|
+
"listMemories",
|
|
46
|
+
"getMemory",
|
|
47
|
+
"updateMemory",
|
|
48
|
+
"deleteMemory"
|
|
49
|
+
],
|
|
39
50
|
deployment: ["createDeployment", "updateDeployment", "deleteDeployment", "runDeployment", "getDeployment"],
|
|
40
|
-
session: ["createSession", "listSessions", "getSession", "deleteSession", "sendSessionMessage"]
|
|
51
|
+
session: ["createSession", "listSessions", "getSession", "deleteSession", "sendSessionMessage"],
|
|
52
|
+
identity: ["createIdentity", "updateIdentity", "deleteIdentity"],
|
|
53
|
+
channel: ["createChannel", "updateChannel", "deleteChannel"]
|
|
41
54
|
};
|
|
42
55
|
|
|
43
56
|
// src/internal/providers/registry.ts
|
|
@@ -45,13 +58,13 @@ var registry = /* @__PURE__ */ new Map();
|
|
|
45
58
|
function registerProvider(def) {
|
|
46
59
|
registry.set(def.name, def);
|
|
47
60
|
}
|
|
48
|
-
function validateProviderFacets(def,
|
|
61
|
+
function validateProviderFacets(def, adapter2) {
|
|
49
62
|
const missing = [];
|
|
50
63
|
for (const [kind, methods] of Object.entries(REQUIRED_METHODS_BY_KIND)) {
|
|
51
64
|
if (!isSupported(def.capabilities, kind)) continue;
|
|
52
|
-
for (const
|
|
53
|
-
if (typeof
|
|
54
|
-
missing.push(`${kind}.${
|
|
65
|
+
for (const method2 of methods) {
|
|
66
|
+
if (typeof adapter2[method2] !== "function") {
|
|
67
|
+
missing.push(`${kind}.${method2}`);
|
|
55
68
|
}
|
|
56
69
|
}
|
|
57
70
|
}
|
|
@@ -75,9 +88,9 @@ function buildProviders(providersConfig, projectName) {
|
|
|
75
88
|
throw new UserError(`Unknown provider '${name}'. Registered: ${Array.from(registry.keys()).join(", ")}`);
|
|
76
89
|
}
|
|
77
90
|
const parsed = def.configSchema.parse(rawConfig);
|
|
78
|
-
const
|
|
79
|
-
validateProviderFacets(def,
|
|
80
|
-
adapters.set(name,
|
|
91
|
+
const adapter2 = def.createAdapter(parsed, projectName);
|
|
92
|
+
validateProviderFacets(def, adapter2);
|
|
93
|
+
adapters.set(name, adapter2);
|
|
81
94
|
}
|
|
82
95
|
return adapters;
|
|
83
96
|
}
|
|
@@ -144,9 +157,9 @@ function buildProviderFromEnv(providerName, projectName) {
|
|
|
144
157
|
}
|
|
145
158
|
const config = resolveProviderConfigFromEnv(providerName);
|
|
146
159
|
const parsed = def.configSchema.parse(config);
|
|
147
|
-
const
|
|
148
|
-
validateProviderFacets(def,
|
|
149
|
-
return
|
|
160
|
+
const adapter2 = def.createAdapter(parsed, projectName);
|
|
161
|
+
validateProviderFacets(def, adapter2);
|
|
162
|
+
return adapter2;
|
|
150
163
|
}
|
|
151
164
|
|
|
152
165
|
// src/internal/providers/claude/adapter.ts
|
|
@@ -352,6 +365,216 @@ function toRemoteResource(res) {
|
|
|
352
365
|
};
|
|
353
366
|
}
|
|
354
367
|
|
|
368
|
+
// src/internal/providers/memory-api.ts
|
|
369
|
+
function query(path, values) {
|
|
370
|
+
const params = new URLSearchParams();
|
|
371
|
+
for (const [key, value] of Object.entries(values)) {
|
|
372
|
+
if (value !== void 0 && value !== null) params.set(key, String(value));
|
|
373
|
+
}
|
|
374
|
+
const encoded = params.toString();
|
|
375
|
+
return encoded ? `${path}?${encoded}` : path;
|
|
376
|
+
}
|
|
377
|
+
function canonicalPath(path) {
|
|
378
|
+
return path.replace(/^\/+/, "");
|
|
379
|
+
}
|
|
380
|
+
function providerPath(path, style) {
|
|
381
|
+
const relative = canonicalPath(path);
|
|
382
|
+
return style === "absolute" ? `/${relative}` : relative;
|
|
383
|
+
}
|
|
384
|
+
function page(raw, map) {
|
|
385
|
+
const body = raw;
|
|
386
|
+
const data = (body.data ?? body.items ?? body.memories ?? body.memory_stores ?? body.memory_versions ?? []).map(map);
|
|
387
|
+
const next = body.next_cursor ?? body.next_page ?? body.last_id;
|
|
388
|
+
return { data, has_more: Boolean(body.has_more ?? next), ...next ? { next_cursor: next } : {} };
|
|
389
|
+
}
|
|
390
|
+
function mapMemoryStore(raw) {
|
|
391
|
+
return {
|
|
392
|
+
id: String(raw.id),
|
|
393
|
+
type: "memory_store",
|
|
394
|
+
name: String(raw.name ?? ""),
|
|
395
|
+
description: String(raw.description ?? ""),
|
|
396
|
+
metadata: raw.metadata ?? {},
|
|
397
|
+
...raw.status ? { status: String(raw.status) } : {},
|
|
398
|
+
...typeof (raw.entry_count ?? raw.memory_count) === "number" ? { entry_count: Number(raw.entry_count ?? raw.memory_count) } : {},
|
|
399
|
+
...typeof (raw.total_size ?? raw.storage_bytes) === "number" ? { total_size: Number(raw.total_size ?? raw.storage_bytes) } : {},
|
|
400
|
+
...typeof raw.session_count === "number" ? { session_count: raw.session_count } : {},
|
|
401
|
+
created_by: raw.created_by,
|
|
402
|
+
created_at: String(raw.created_at ?? ""),
|
|
403
|
+
updated_at: String(raw.updated_at ?? raw.created_at ?? ""),
|
|
404
|
+
archived_at: raw.archived_at ?? null
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
function mapMemory(raw) {
|
|
408
|
+
return {
|
|
409
|
+
id: String(raw.id),
|
|
410
|
+
type: "memory",
|
|
411
|
+
memory_store_id: String(raw.memory_store_id ?? raw.store_id ?? ""),
|
|
412
|
+
path: canonicalPath(String(raw.path ?? "")),
|
|
413
|
+
content: raw.content,
|
|
414
|
+
content_size_bytes: Number(raw.content_size_bytes ?? raw.size ?? 0),
|
|
415
|
+
content_sha256: String(raw.content_sha256 ?? ""),
|
|
416
|
+
...typeof raw.version === "number" ? { version: raw.version } : {},
|
|
417
|
+
...raw.memory_version_id ? { memory_version_id: String(raw.memory_version_id) } : {},
|
|
418
|
+
metadata: raw.metadata ?? {},
|
|
419
|
+
created_by: raw.created_by,
|
|
420
|
+
created_at: String(raw.created_at ?? ""),
|
|
421
|
+
updated_at: String(raw.updated_at ?? raw.created_at ?? "")
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
function mapMemoryListItem(raw) {
|
|
425
|
+
if (raw.type === "memory_prefix") return { type: "memory_prefix", path: canonicalPath(String(raw.path ?? "")) };
|
|
426
|
+
return mapMemory(raw);
|
|
427
|
+
}
|
|
428
|
+
function mapMemoryVersion(raw) {
|
|
429
|
+
const operation = String(raw.operation ?? raw.action ?? "updated");
|
|
430
|
+
return {
|
|
431
|
+
id: String(raw.id),
|
|
432
|
+
type: "memory_version",
|
|
433
|
+
memory_store_id: String(raw.memory_store_id ?? raw.store_id ?? ""),
|
|
434
|
+
memory_id: String(raw.memory_id ?? raw.entry_id ?? ""),
|
|
435
|
+
path: (raw.path ?? raw.entry_path) == null ? raw.path ?? raw.entry_path : canonicalPath(String(raw.path ?? raw.entry_path)),
|
|
436
|
+
content: raw.content,
|
|
437
|
+
content_size_bytes: raw.content_size_bytes ?? raw.size,
|
|
438
|
+
content_sha256: raw.content_sha256,
|
|
439
|
+
operation: operation === "modified" ? "updated" : operation,
|
|
440
|
+
...typeof raw.version === "number" ? { version: raw.version } : {},
|
|
441
|
+
...typeof raw.redacted === "boolean" ? { redacted: raw.redacted } : {},
|
|
442
|
+
redacted_at: raw.redacted_at,
|
|
443
|
+
created_by: raw.created_by,
|
|
444
|
+
created_at: String(raw.created_at ?? "")
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
var ProviderMemoryApi = class {
|
|
448
|
+
constructor(client, dialect) {
|
|
449
|
+
this.client = client;
|
|
450
|
+
this.dialect = dialect;
|
|
451
|
+
}
|
|
452
|
+
client;
|
|
453
|
+
dialect;
|
|
454
|
+
async listStores(options = {}) {
|
|
455
|
+
const raw = await this.client.get(
|
|
456
|
+
query("/memory_stores", {
|
|
457
|
+
limit: options.limit,
|
|
458
|
+
[this.dialect.cursorParam]: options.cursor,
|
|
459
|
+
include_archived: this.dialect.supportsIncludeArchived ? options.include_archived : void 0
|
|
460
|
+
})
|
|
461
|
+
);
|
|
462
|
+
return page(raw, mapMemoryStore);
|
|
463
|
+
}
|
|
464
|
+
async getStore(id) {
|
|
465
|
+
return mapMemoryStore(await this.client.get(`/memory_stores/${id}`));
|
|
466
|
+
}
|
|
467
|
+
async updateStore(id, input) {
|
|
468
|
+
let body = { ...input };
|
|
469
|
+
if (this.dialect.storeMetadataMode === "merge_patch" && input.metadata !== void 0) {
|
|
470
|
+
const current = await this.getStore(id);
|
|
471
|
+
body = {
|
|
472
|
+
...input,
|
|
473
|
+
metadata: {
|
|
474
|
+
...Object.fromEntries(Object.keys(current.metadata).map((key) => [key, null])),
|
|
475
|
+
...input.metadata
|
|
476
|
+
}
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
return mapMemoryStore(await this.client.post(`/memory_stores/${id}`, body));
|
|
480
|
+
}
|
|
481
|
+
async archiveStore(id) {
|
|
482
|
+
return mapMemoryStore(await this.client.post(`/memory_stores/${id}/archive`, {}));
|
|
483
|
+
}
|
|
484
|
+
async createMemory(storeId, input) {
|
|
485
|
+
const body = {
|
|
486
|
+
path: providerPath(input.path, this.dialect.pathStyle),
|
|
487
|
+
content: input.content,
|
|
488
|
+
...this.dialect.supportsMemoryMetadata && input.metadata ? { metadata: input.metadata } : {}
|
|
489
|
+
};
|
|
490
|
+
return mapMemory(await this.client.post(`/memory_stores/${storeId}/memories`, body));
|
|
491
|
+
}
|
|
492
|
+
async listMemories(storeId, options = {}) {
|
|
493
|
+
const raw = await this.client.get(
|
|
494
|
+
query(`/memory_stores/${storeId}/memories`, {
|
|
495
|
+
limit: options.limit,
|
|
496
|
+
[this.dialect.cursorParam]: options.cursor,
|
|
497
|
+
[this.dialect.prefixParam]: options.prefix ? providerPath(options.prefix, this.dialect.pathStyle) : void 0,
|
|
498
|
+
depth: options.depth,
|
|
499
|
+
view: this.dialect.supportsView ? options.view : void 0
|
|
500
|
+
})
|
|
501
|
+
);
|
|
502
|
+
return page(raw, mapMemoryListItem);
|
|
503
|
+
}
|
|
504
|
+
async getMemory(storeId, memoryId) {
|
|
505
|
+
const path = `/memory_stores/${storeId}/memories/${memoryId}${this.dialect.supportsView ? "?view=full" : ""}`;
|
|
506
|
+
return mapMemory(await this.client.get(path));
|
|
507
|
+
}
|
|
508
|
+
async updateMemory(storeId, memoryId, input) {
|
|
509
|
+
const { expected_content_sha256, ...values } = input;
|
|
510
|
+
const body = {
|
|
511
|
+
...values.content !== void 0 ? { content: values.content } : {},
|
|
512
|
+
...this.dialect.supportsMemoryMetadata && values.metadata ? { metadata: values.metadata } : {},
|
|
513
|
+
...this.dialect.supportsPathUpdate !== false && values.path ? { path: providerPath(values.path, this.dialect.pathStyle) } : {}
|
|
514
|
+
};
|
|
515
|
+
if (expected_content_sha256 && this.dialect.updatePrecondition !== "none") {
|
|
516
|
+
if (this.dialect.updatePrecondition === "precondition") {
|
|
517
|
+
body.precondition = { type: "content_sha256", content_sha256: expected_content_sha256 };
|
|
518
|
+
} else {
|
|
519
|
+
body[this.dialect.updatePrecondition] = expected_content_sha256;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
const path = `/memory_stores/${storeId}/memories/${memoryId}${this.dialect.supportsView ? "?view=full" : ""}`;
|
|
523
|
+
const raw = await this.client.post(path, body);
|
|
524
|
+
return mapMemory(raw);
|
|
525
|
+
}
|
|
526
|
+
async deleteMemory(storeId, memoryId, expected) {
|
|
527
|
+
await this.client.delete(
|
|
528
|
+
query(`/memory_stores/${storeId}/memories/${memoryId}`, {
|
|
529
|
+
expected_content_sha256: this.dialect.supportsDeletePrecondition ? expected : void 0
|
|
530
|
+
})
|
|
531
|
+
);
|
|
532
|
+
}
|
|
533
|
+
async listVersions(storeId, options = {}) {
|
|
534
|
+
const segment = this.dialect.versionsSegment ?? "memory_versions";
|
|
535
|
+
const raw = await this.client.get(
|
|
536
|
+
query(`/memory_stores/${storeId}/${segment}`, {
|
|
537
|
+
limit: options.limit,
|
|
538
|
+
[this.dialect.cursorParam]: options.cursor,
|
|
539
|
+
memory_id: options.memory_id,
|
|
540
|
+
view: this.dialect.supportsView ? options.view : void 0
|
|
541
|
+
})
|
|
542
|
+
);
|
|
543
|
+
return page(raw, mapMemoryVersion);
|
|
544
|
+
}
|
|
545
|
+
async getVersion(storeId, versionId) {
|
|
546
|
+
const segment = this.dialect.versionsSegment ?? "memory_versions";
|
|
547
|
+
return mapMemoryVersion(
|
|
548
|
+
await this.client.get(
|
|
549
|
+
`/memory_stores/${storeId}/${segment}/${versionId}${this.dialect.supportsView ? "?view=full" : ""}`
|
|
550
|
+
)
|
|
551
|
+
);
|
|
552
|
+
}
|
|
553
|
+
async redactVersion(storeId, versionId) {
|
|
554
|
+
const segment = this.dialect.versionsSegment ?? "memory_versions";
|
|
555
|
+
return mapMemoryVersion(
|
|
556
|
+
await this.client.post(`/memory_stores/${storeId}/${segment}/${versionId}/redact`, {})
|
|
557
|
+
);
|
|
558
|
+
}
|
|
559
|
+
async batchCreateMemories(storeId, input) {
|
|
560
|
+
const body = {
|
|
561
|
+
items: input.items.map((item) => ({
|
|
562
|
+
path: providerPath(item.path, this.dialect.pathStyle),
|
|
563
|
+
content: item.content
|
|
564
|
+
})),
|
|
565
|
+
on_conflict: input.on_conflict
|
|
566
|
+
};
|
|
567
|
+
const raw = await this.client.post(`/memory_stores/${storeId}/memories/batch_create`, body);
|
|
568
|
+
return {
|
|
569
|
+
results: (raw.results ?? []).map((item) => ({
|
|
570
|
+
path: canonicalPath(item.path),
|
|
571
|
+
...item.memory ? { memory: mapMemory(item.memory) } : {},
|
|
572
|
+
...item.error ? { error: item.error } : {}
|
|
573
|
+
}))
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
};
|
|
577
|
+
|
|
355
578
|
// src/internal/providers/session-event-response.ts
|
|
356
579
|
async function listSessionEventsPaged(client, sessionId, options, toEvent, config) {
|
|
357
580
|
const params = new URLSearchParams();
|
|
@@ -867,6 +1090,23 @@ function mapDeployment(name, decl, refs, projectName, uploadedFiles) {
|
|
|
867
1090
|
}
|
|
868
1091
|
return body;
|
|
869
1092
|
}
|
|
1093
|
+
function mapDeploymentUpdate(name, decl, refs, projectName, uploadedFiles, existingMetadata) {
|
|
1094
|
+
const body = mapDeployment(name, decl, refs, projectName, uploadedFiles);
|
|
1095
|
+
body.vault_ids = refs.vault_ids;
|
|
1096
|
+
body.resources = mapDeploymentResources(decl, refs, uploadedFiles);
|
|
1097
|
+
if (decl.schedule) {
|
|
1098
|
+
body.schedule = { type: "cron", expression: decl.schedule.expression, timezone: decl.schedule.timezone };
|
|
1099
|
+
}
|
|
1100
|
+
body.description = decl.description ?? "";
|
|
1101
|
+
const desiredMetadata = projectName ? injectMetadata(decl.metadata, projectName, name) : decl.metadata ?? {};
|
|
1102
|
+
body.metadata = {
|
|
1103
|
+
...Object.fromEntries(
|
|
1104
|
+
Object.keys(existingMetadata ?? {}).filter((key) => !(key in desiredMetadata)).map((key) => [key, null])
|
|
1105
|
+
),
|
|
1106
|
+
...desiredMetadata
|
|
1107
|
+
};
|
|
1108
|
+
return body;
|
|
1109
|
+
}
|
|
870
1110
|
function mapInitialEvents(events) {
|
|
871
1111
|
return events.map((ev) => {
|
|
872
1112
|
if (ev.type === "user.message" || ev.type === "system.message") {
|
|
@@ -1039,10 +1279,30 @@ function mapSession(bindings) {
|
|
|
1039
1279
|
var ClaudeAdapter = class _ClaudeAdapter {
|
|
1040
1280
|
name = "claude";
|
|
1041
1281
|
eventResume = false;
|
|
1282
|
+
memoryCapabilities = {
|
|
1283
|
+
archive_store: true,
|
|
1284
|
+
batch_create: false,
|
|
1285
|
+
versions: true,
|
|
1286
|
+
optimistic_concurrency: true,
|
|
1287
|
+
memory_metadata: false
|
|
1288
|
+
};
|
|
1042
1289
|
client;
|
|
1290
|
+
memoryClient;
|
|
1291
|
+
memoryApi;
|
|
1043
1292
|
projectName;
|
|
1044
1293
|
constructor(apiKey, beta, projectName) {
|
|
1045
1294
|
this.client = new ClaudeClient({ apiKey, beta });
|
|
1295
|
+
this.memoryClient = new ClaudeClient({ apiKey, beta: "agent-memory-2026-07-22" });
|
|
1296
|
+
this.memoryApi = new ProviderMemoryApi(this.memoryClient, {
|
|
1297
|
+
pathStyle: "absolute",
|
|
1298
|
+
cursorParam: "page",
|
|
1299
|
+
updatePrecondition: "precondition",
|
|
1300
|
+
prefixParam: "path_prefix",
|
|
1301
|
+
supportsView: true,
|
|
1302
|
+
supportsMemoryMetadata: false,
|
|
1303
|
+
supportsDeletePrecondition: true,
|
|
1304
|
+
supportsIncludeArchived: true
|
|
1305
|
+
});
|
|
1046
1306
|
this.projectName = projectName ?? "";
|
|
1047
1307
|
}
|
|
1048
1308
|
async validate() {
|
|
@@ -1058,7 +1318,13 @@ var ClaudeAdapter = class _ClaudeAdapter {
|
|
|
1058
1318
|
file: "/files"
|
|
1059
1319
|
};
|
|
1060
1320
|
async findResource(type, name, id) {
|
|
1061
|
-
const raw = await locateRemote(
|
|
1321
|
+
const raw = await locateRemote(
|
|
1322
|
+
type === "memory_store" ? this.memoryClient : this.client,
|
|
1323
|
+
_ClaudeAdapter.ENDPOINT_MAP[type],
|
|
1324
|
+
name,
|
|
1325
|
+
id,
|
|
1326
|
+
notArchived
|
|
1327
|
+
);
|
|
1062
1328
|
return raw ? toRemoteResource(raw) : null;
|
|
1063
1329
|
}
|
|
1064
1330
|
async listAgents(filter) {
|
|
@@ -1191,6 +1457,62 @@ var ClaudeAdapter = class _ClaudeAdapter {
|
|
|
1191
1457
|
async deleteAgent(id) {
|
|
1192
1458
|
await this.client.post(`/agents/${id}/archive`, {});
|
|
1193
1459
|
}
|
|
1460
|
+
async createMemoryStore(name, decl) {
|
|
1461
|
+
const res = await this.memoryClient.post("/memory_stores", {
|
|
1462
|
+
name,
|
|
1463
|
+
description: decl.description,
|
|
1464
|
+
metadata: decl.metadata
|
|
1465
|
+
});
|
|
1466
|
+
const storeId = String(res.id);
|
|
1467
|
+
try {
|
|
1468
|
+
for (const entry of decl.entries ?? []) {
|
|
1469
|
+
await this.memoryApi.createMemory(storeId, { path: entry.key, content: entry.content });
|
|
1470
|
+
}
|
|
1471
|
+
} catch (error) {
|
|
1472
|
+
await this.memoryClient.delete(`/memory_stores/${storeId}`).catch(() => void 0);
|
|
1473
|
+
throw error;
|
|
1474
|
+
}
|
|
1475
|
+
return toRemoteResource(res);
|
|
1476
|
+
}
|
|
1477
|
+
async deleteMemoryStore(id) {
|
|
1478
|
+
await this.memoryClient.delete(`/memory_stores/${id}`);
|
|
1479
|
+
}
|
|
1480
|
+
listMemoryStores(options) {
|
|
1481
|
+
return this.memoryApi.listStores(options);
|
|
1482
|
+
}
|
|
1483
|
+
getMemoryStore(id) {
|
|
1484
|
+
return this.memoryApi.getStore(id);
|
|
1485
|
+
}
|
|
1486
|
+
updateMemoryStore(id, input) {
|
|
1487
|
+
return this.memoryApi.updateStore(id, input);
|
|
1488
|
+
}
|
|
1489
|
+
archiveMemoryStore(id) {
|
|
1490
|
+
return this.memoryApi.archiveStore(id);
|
|
1491
|
+
}
|
|
1492
|
+
createMemory(storeId, input) {
|
|
1493
|
+
return this.memoryApi.createMemory(storeId, input);
|
|
1494
|
+
}
|
|
1495
|
+
listMemories(storeId, options) {
|
|
1496
|
+
return this.memoryApi.listMemories(storeId, options);
|
|
1497
|
+
}
|
|
1498
|
+
getMemory(storeId, memoryId) {
|
|
1499
|
+
return this.memoryApi.getMemory(storeId, memoryId);
|
|
1500
|
+
}
|
|
1501
|
+
updateMemory(storeId, memoryId, input) {
|
|
1502
|
+
return this.memoryApi.updateMemory(storeId, memoryId, input);
|
|
1503
|
+
}
|
|
1504
|
+
deleteMemory(storeId, memoryId, expected) {
|
|
1505
|
+
return this.memoryApi.deleteMemory(storeId, memoryId, expected);
|
|
1506
|
+
}
|
|
1507
|
+
listMemoryVersions(storeId, options) {
|
|
1508
|
+
return this.memoryApi.listVersions(storeId, options);
|
|
1509
|
+
}
|
|
1510
|
+
getMemoryVersion(storeId, versionId) {
|
|
1511
|
+
return this.memoryApi.getVersion(storeId, versionId);
|
|
1512
|
+
}
|
|
1513
|
+
redactMemoryVersion(storeId, versionId) {
|
|
1514
|
+
return this.memoryApi.redactVersion(storeId, versionId);
|
|
1515
|
+
}
|
|
1194
1516
|
async createDeployment(name, decl, refs, basePath) {
|
|
1195
1517
|
const uploaded = await this.uploadDeploymentFiles(decl, basePath);
|
|
1196
1518
|
const body = mapDeployment(name, decl, refs, this.projectName, uploaded);
|
|
@@ -1199,7 +1521,20 @@ var ClaudeAdapter = class _ClaudeAdapter {
|
|
|
1199
1521
|
}
|
|
1200
1522
|
async updateDeployment(id, name, decl, refs, basePath) {
|
|
1201
1523
|
const uploaded = await this.uploadDeploymentFiles(decl, basePath);
|
|
1202
|
-
const
|
|
1524
|
+
const current = await this.client.get(`/deployments/${id}`);
|
|
1525
|
+
if (current.schedule && !decl.schedule) {
|
|
1526
|
+
throw new UserError(
|
|
1527
|
+
`Deployment '${name}' cannot remove its schedule through the documented Claude update API; archive and recreate it as a manual deployment.`
|
|
1528
|
+
);
|
|
1529
|
+
}
|
|
1530
|
+
const body = mapDeploymentUpdate(
|
|
1531
|
+
name,
|
|
1532
|
+
decl,
|
|
1533
|
+
refs,
|
|
1534
|
+
this.projectName,
|
|
1535
|
+
uploaded,
|
|
1536
|
+
current.metadata
|
|
1537
|
+
);
|
|
1203
1538
|
const res = await this.client.post(`/deployments/${id}`, body);
|
|
1204
1539
|
return toRemoteResource(res);
|
|
1205
1540
|
}
|
|
@@ -1251,6 +1586,36 @@ var ClaudeAdapter = class _ClaudeAdapter {
|
|
|
1251
1586
|
attributes: res
|
|
1252
1587
|
};
|
|
1253
1588
|
}
|
|
1589
|
+
async listDeployments(filter) {
|
|
1590
|
+
const params = new URLSearchParams();
|
|
1591
|
+
if (filter?.agent_id) params.set("agent_id", filter.agent_id);
|
|
1592
|
+
if (filter?.status) params.set("status", filter.status);
|
|
1593
|
+
if (filter?.include_archived) params.set("include_archived", "true");
|
|
1594
|
+
if (filter?.limit) params.set("limit", String(filter.limit));
|
|
1595
|
+
if (filter?.page) params.set("page", filter.page);
|
|
1596
|
+
if (filter?.created_at_gte) params.set("created_at[gte]", filter.created_at_gte);
|
|
1597
|
+
if (filter?.created_at_lte) params.set("created_at[lte]", filter.created_at_lte);
|
|
1598
|
+
const query2 = params.toString();
|
|
1599
|
+
const res = await this.client.get(`/deployments${query2 ? `?${query2}` : ""}`);
|
|
1600
|
+
const nextPage = res.next_page ?? void 0;
|
|
1601
|
+
return {
|
|
1602
|
+
deployments: (res.data ?? []).map(toDeploymentInfo),
|
|
1603
|
+
has_more: nextPage !== void 0,
|
|
1604
|
+
next_page: nextPage
|
|
1605
|
+
};
|
|
1606
|
+
}
|
|
1607
|
+
async pauseDeployment(ctx) {
|
|
1608
|
+
return this.setDeploymentPaused(ctx, true);
|
|
1609
|
+
}
|
|
1610
|
+
async unpauseDeployment(ctx) {
|
|
1611
|
+
return this.setDeploymentPaused(ctx, false);
|
|
1612
|
+
}
|
|
1613
|
+
async setDeploymentPaused(ctx, paused) {
|
|
1614
|
+
if (!ctx.id) throw new UserError(`Deployment '${ctx.name}' has no remote id; run \`agents apply\` first.`);
|
|
1615
|
+
const action = paused ? "pause" : "unpause";
|
|
1616
|
+
const res = await this.client.post(`/deployments/${ctx.id}/${action}`, {});
|
|
1617
|
+
return toDeploymentInfo(res);
|
|
1618
|
+
}
|
|
1254
1619
|
async createSession(bindings) {
|
|
1255
1620
|
if (bindings.delivery === "forward") throw new UserError("Claude does not support Forward sessions.");
|
|
1256
1621
|
const body = mapSession(bindings);
|
|
@@ -1322,6 +1687,16 @@ var ClaudeAdapter = class _ClaudeAdapter {
|
|
|
1322
1687
|
await this.client.delete(`/files/${id}`);
|
|
1323
1688
|
}
|
|
1324
1689
|
};
|
|
1690
|
+
function toDeploymentInfo(res) {
|
|
1691
|
+
const sched = res.schedule;
|
|
1692
|
+
return {
|
|
1693
|
+
id: res.id ?? null,
|
|
1694
|
+
status: res.status ?? "unknown",
|
|
1695
|
+
paused_reason: res.paused_reason ?? void 0,
|
|
1696
|
+
schedule: sched ? { expression: sched.expression, timezone: sched.timezone } : void 0,
|
|
1697
|
+
attributes: res
|
|
1698
|
+
};
|
|
1699
|
+
}
|
|
1325
1700
|
function toSessionInfo(res) {
|
|
1326
1701
|
return buildSessionInfo(
|
|
1327
1702
|
res,
|
|
@@ -1353,15 +1728,13 @@ var CLAUDE_CAPABILITIES = {
|
|
|
1353
1728
|
skill: { tier: "native", reason: "skills API with files[] upload" },
|
|
1354
1729
|
agent: { tier: "native", reason: "managed agents API" },
|
|
1355
1730
|
template: { tier: "unsupported", reason: "no Forward Template equivalent on Claude" },
|
|
1356
|
-
memory_store: {
|
|
1357
|
-
tier: "unsupported",
|
|
1358
|
-
reason: "Claude exposes Memory Stores, but the OpenAgentPack adapter has not implemented them yet",
|
|
1359
|
-
remediation: "use skill knowledge or MCP until Claude Memory Store support is added to the adapter"
|
|
1360
|
-
},
|
|
1731
|
+
memory_store: { tier: "native", reason: "beta memory_stores API" },
|
|
1361
1732
|
mcp_server: { tier: "native", reason: "mcp_servers field on agent" },
|
|
1362
1733
|
multiagent: { tier: "native", reason: "coordinator + roster topology" },
|
|
1363
1734
|
deployment: { tier: "native", reason: "deployments API" },
|
|
1364
|
-
session: { tier: "native", reason: "sessions API" }
|
|
1735
|
+
session: { tier: "native", reason: "sessions API" },
|
|
1736
|
+
identity: { tier: "unsupported", reason: "no mapped Identity primitive on Claude" },
|
|
1737
|
+
channel: { tier: "unsupported", reason: "no mapped messaging Channel primitive on Claude" }
|
|
1365
1738
|
};
|
|
1366
1739
|
|
|
1367
1740
|
// src/internal/providers/claude/config.ts
|
|
@@ -1606,10 +1979,11 @@ function agentToDecl2(raw) {
|
|
|
1606
1979
|
metadata: stripAgentsMetadata(raw.metadata)
|
|
1607
1980
|
});
|
|
1608
1981
|
}
|
|
1609
|
-
function
|
|
1982
|
+
function mapMemoryStore2(name, decl) {
|
|
1610
1983
|
return {
|
|
1611
1984
|
name,
|
|
1612
|
-
description: decl.description
|
|
1985
|
+
description: decl.description,
|
|
1986
|
+
metadata: decl.metadata
|
|
1613
1987
|
};
|
|
1614
1988
|
}
|
|
1615
1989
|
function mapDeployment2(name, decl, refs, projectName, uploadedFiles) {
|
|
@@ -1630,6 +2004,7 @@ function mapDeployment2(name, decl, refs, projectName, uploadedFiles) {
|
|
|
1630
2004
|
};
|
|
1631
2005
|
}
|
|
1632
2006
|
if (decl.description) body.description = decl.description;
|
|
2007
|
+
if (decl.environment_variables !== void 0) body.environment_variables = decl.environment_variables;
|
|
1633
2008
|
if (projectName) {
|
|
1634
2009
|
body.metadata = injectMetadata(decl.metadata, projectName, name);
|
|
1635
2010
|
} else if (decl.metadata) {
|
|
@@ -1637,6 +2012,24 @@ function mapDeployment2(name, decl, refs, projectName, uploadedFiles) {
|
|
|
1637
2012
|
}
|
|
1638
2013
|
return body;
|
|
1639
2014
|
}
|
|
2015
|
+
function mapDeploymentUpdate2(name, decl, refs, projectName, uploadedFiles, existingMetadata) {
|
|
2016
|
+
const body = mapDeployment2(name, decl, refs, projectName, uploadedFiles);
|
|
2017
|
+
body.vault_ids = refs.vault_ids;
|
|
2018
|
+
body.resources = mapDeploymentResources2(decl, refs, uploadedFiles);
|
|
2019
|
+
if (decl.schedule) {
|
|
2020
|
+
body.schedule = { type: "cron", expression: decl.schedule.expression, timezone: decl.schedule.timezone };
|
|
2021
|
+
}
|
|
2022
|
+
body.description = decl.description ?? "";
|
|
2023
|
+
body.environment_variables = decl.environment_variables ?? null;
|
|
2024
|
+
const desiredMetadata = projectName ? injectMetadata(decl.metadata, projectName, name) : decl.metadata ?? {};
|
|
2025
|
+
body.metadata = {
|
|
2026
|
+
...Object.fromEntries(
|
|
2027
|
+
Object.keys(existingMetadata ?? {}).filter((key) => !(key in desiredMetadata)).map((key) => [key, null])
|
|
2028
|
+
),
|
|
2029
|
+
...desiredMetadata
|
|
2030
|
+
};
|
|
2031
|
+
return body;
|
|
2032
|
+
}
|
|
1640
2033
|
function mapDeploymentInitialEvents(events) {
|
|
1641
2034
|
return events.map((ev) => {
|
|
1642
2035
|
if (ev.type === "user.message" || ev.type === "system.message") {
|
|
@@ -1930,17 +2323,46 @@ function deriveForwardGateway(cloudGateway) {
|
|
|
1930
2323
|
const trimmed = cloudGateway.replace(/\/$/, "");
|
|
1931
2324
|
return trimmed.endsWith("/cloud") ? `${trimmed.slice(0, -"/cloud".length)}/forward` : `${trimmed}/forward`;
|
|
1932
2325
|
}
|
|
1933
|
-
|
|
2326
|
+
function toDeploymentInfo2(res) {
|
|
2327
|
+
const sched = res.schedule;
|
|
2328
|
+
return {
|
|
2329
|
+
id: res.id ?? null,
|
|
2330
|
+
status: res.status ?? "unknown",
|
|
2331
|
+
paused_reason: res.paused_reason ?? void 0,
|
|
2332
|
+
schedule: sched ? { expression: sched.expression, timezone: sched.timezone } : void 0,
|
|
2333
|
+
attributes: res
|
|
2334
|
+
};
|
|
2335
|
+
}
|
|
1934
2336
|
var QoderAdapter = class _QoderAdapter {
|
|
1935
2337
|
name = "qoder";
|
|
1936
2338
|
eventResume = true;
|
|
2339
|
+
memoryCapabilities = {
|
|
2340
|
+
archive_store: true,
|
|
2341
|
+
batch_create: false,
|
|
2342
|
+
versions: true,
|
|
2343
|
+
optimistic_concurrency: true,
|
|
2344
|
+
memory_metadata: true
|
|
2345
|
+
};
|
|
1937
2346
|
client;
|
|
2347
|
+
memoryApi;
|
|
1938
2348
|
forwardClient;
|
|
1939
2349
|
projectName;
|
|
1940
2350
|
forwardSessionIds = /* @__PURE__ */ new Set();
|
|
1941
|
-
defaultForwardIdentityId;
|
|
1942
2351
|
constructor(apiKey, gateway, projectName, forwardGateway) {
|
|
1943
2352
|
this.client = new QoderClient({ apiKey, gateway });
|
|
2353
|
+
this.memoryApi = new ProviderMemoryApi(this.client, {
|
|
2354
|
+
pathStyle: "relative",
|
|
2355
|
+
cursorParam: "after_id",
|
|
2356
|
+
updatePrecondition: "content_sha256",
|
|
2357
|
+
prefixParam: "prefix",
|
|
2358
|
+
versionsSegment: "versions",
|
|
2359
|
+
storeMetadataMode: "merge_patch",
|
|
2360
|
+
supportsView: false,
|
|
2361
|
+
supportsMemoryMetadata: true,
|
|
2362
|
+
supportsPathUpdate: false,
|
|
2363
|
+
supportsDeletePrecondition: false,
|
|
2364
|
+
supportsIncludeArchived: true
|
|
2365
|
+
});
|
|
1944
2366
|
this.forwardClient = new QoderClient({
|
|
1945
2367
|
apiKey,
|
|
1946
2368
|
gateway: forwardGateway ?? deriveForwardGateway(gateway)
|
|
@@ -1956,14 +2378,29 @@ var QoderAdapter = class _QoderAdapter {
|
|
|
1956
2378
|
vault: "/vaults",
|
|
1957
2379
|
skill: "/skills",
|
|
1958
2380
|
memory_store: "/memory_stores",
|
|
1959
|
-
file: "/files"
|
|
1960
|
-
|
|
2381
|
+
file: "/files",
|
|
2382
|
+
deployment: "/deployments"
|
|
1961
2383
|
};
|
|
1962
2384
|
async findResource(type, name, id) {
|
|
1963
2385
|
if (type === "template") {
|
|
1964
2386
|
const raw2 = await locateRemote(this.forwardClient, "/templates", name, id, (item) => item.status !== "archived");
|
|
1965
2387
|
return raw2 ? toRemoteResource(raw2) : null;
|
|
1966
2388
|
}
|
|
2389
|
+
if (type === "identity") {
|
|
2390
|
+
try {
|
|
2391
|
+
if (id) return toRemoteResource(await this.forwardClient.get(`/identities/${id}`));
|
|
2392
|
+
const res = await this.forwardClient.get(`/identities?external_id=${encodeURIComponent(name)}&limit=100`);
|
|
2393
|
+
const raw2 = (res.data ?? []).find((item) => item.external_id === name);
|
|
2394
|
+
return raw2 ? toRemoteResource(raw2) : null;
|
|
2395
|
+
} catch (err) {
|
|
2396
|
+
if (ApiError.isNotFound(err)) return null;
|
|
2397
|
+
throw err;
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
if (type === "channel") {
|
|
2401
|
+
const raw2 = await locateRemote(this.forwardClient, "/channels", name, id, () => true);
|
|
2402
|
+
return raw2 ? toRemoteResource(raw2) : null;
|
|
2403
|
+
}
|
|
1967
2404
|
const raw = await locateRemote(this.client, _QoderAdapter.ENDPOINT_MAP[type], name, id, notArchived);
|
|
1968
2405
|
return raw ? toRemoteResource(raw) : null;
|
|
1969
2406
|
}
|
|
@@ -2009,12 +2446,23 @@ var QoderAdapter = class _QoderAdapter {
|
|
|
2009
2446
|
return toRestSkillInfo(res);
|
|
2010
2447
|
}
|
|
2011
2448
|
getDriftSupport(type) {
|
|
2012
|
-
if (type === "agent" || type === "environment" || type === "template"
|
|
2449
|
+
if (type === "agent" || type === "environment" || type === "template" || type === "identity" || type === "channel")
|
|
2450
|
+
return "full";
|
|
2013
2451
|
if (type === "deployment") return "unsupported";
|
|
2014
2452
|
return _QoderAdapter.ENDPOINT_MAP[type] ? "existence" : "unsupported";
|
|
2015
2453
|
}
|
|
2016
2454
|
async readComparableResource(type, id, name) {
|
|
2017
|
-
if (type !== "agent" && type !== "environment" && type !== "template"
|
|
2455
|
+
if (type !== "agent" && type !== "environment" && type !== "template" && type !== "identity" && type !== "channel")
|
|
2456
|
+
return null;
|
|
2457
|
+
if (type === "identity" || type === "channel") {
|
|
2458
|
+
const remote = await this.findResource(type, name, id);
|
|
2459
|
+
if (!remote?.id) return null;
|
|
2460
|
+
const raw2 = await this.forwardClient.get(
|
|
2461
|
+
`/${type === "identity" ? "identities" : "channels"}/${remote.id}`
|
|
2462
|
+
);
|
|
2463
|
+
const comparable2 = this.normalizeRemote(type, raw2);
|
|
2464
|
+
return { id: remote.id, type, comparable: comparable2, snapshot: comparable2 };
|
|
2465
|
+
}
|
|
2018
2466
|
const isTemplate = type === "template";
|
|
2019
2467
|
const endpoint = type === "agent" ? "/agents" : type === "environment" ? "/environments" : "/templates";
|
|
2020
2468
|
const raw = await locateRemote(
|
|
@@ -2048,6 +2496,16 @@ var QoderAdapter = class _QoderAdapter {
|
|
|
2048
2496
|
);
|
|
2049
2497
|
}
|
|
2050
2498
|
if (type === "template") return null;
|
|
2499
|
+
if (type === "identity") {
|
|
2500
|
+
const identity = decl;
|
|
2501
|
+
if (identity.identity_id) return null;
|
|
2502
|
+
return this.normalizeRemote(type, {
|
|
2503
|
+
external_id: identity.external_id,
|
|
2504
|
+
name: identity.name ?? name,
|
|
2505
|
+
enabled: identity.enabled ?? true,
|
|
2506
|
+
metadata: identity.metadata ?? {}
|
|
2507
|
+
});
|
|
2508
|
+
}
|
|
2051
2509
|
return null;
|
|
2052
2510
|
}
|
|
2053
2511
|
normalizeRemote(type, raw) {
|
|
@@ -2081,6 +2539,27 @@ var QoderAdapter = class _QoderAdapter {
|
|
|
2081
2539
|
metadata: stripAgentsMetadata(raw.metadata)
|
|
2082
2540
|
});
|
|
2083
2541
|
}
|
|
2542
|
+
if (type === "identity") {
|
|
2543
|
+
return compactDeep({
|
|
2544
|
+
external_id: raw.external_id,
|
|
2545
|
+
name: raw.name,
|
|
2546
|
+
enabled: raw.enabled,
|
|
2547
|
+
metadata: raw.metadata ?? {}
|
|
2548
|
+
});
|
|
2549
|
+
}
|
|
2550
|
+
if (type === "channel") {
|
|
2551
|
+
const channelConfig = raw.channel_config ?? {};
|
|
2552
|
+
return compactDeep({
|
|
2553
|
+
identity_id: raw.identity_id,
|
|
2554
|
+
template_id: raw.template_id,
|
|
2555
|
+
channel_type: raw.channel_type,
|
|
2556
|
+
name: raw.name,
|
|
2557
|
+
enabled: raw.enabled,
|
|
2558
|
+
channel_config: {
|
|
2559
|
+
response_options: channelConfig.response_options ?? {}
|
|
2560
|
+
}
|
|
2561
|
+
});
|
|
2562
|
+
}
|
|
2084
2563
|
return compactDeep({
|
|
2085
2564
|
description: raw.description,
|
|
2086
2565
|
model: normalizeModel(raw.model),
|
|
@@ -2190,6 +2669,71 @@ var QoderAdapter = class _QoderAdapter {
|
|
|
2190
2669
|
async archiveTemplate(id) {
|
|
2191
2670
|
await this.forwardClient.post(`/templates/${id}/archive`, {});
|
|
2192
2671
|
}
|
|
2672
|
+
async createIdentity(name, decl) {
|
|
2673
|
+
if (decl.identity_id) return { id: decl.identity_id, type: "identity" };
|
|
2674
|
+
const res = await this.forwardClient.post("/identities", {
|
|
2675
|
+
external_id: decl.external_id,
|
|
2676
|
+
name: decl.name ?? name,
|
|
2677
|
+
enabled: decl.enabled ?? true,
|
|
2678
|
+
metadata: decl.metadata ?? {}
|
|
2679
|
+
});
|
|
2680
|
+
return toRemoteResource(res);
|
|
2681
|
+
}
|
|
2682
|
+
async updateIdentity(id, name, decl) {
|
|
2683
|
+
if (decl.identity_id) return { id: decl.identity_id, type: "identity" };
|
|
2684
|
+
const current = await this.forwardClient.get(`/identities/${id}`);
|
|
2685
|
+
const currentMetadata = current.metadata ?? {};
|
|
2686
|
+
const desiredMetadata = decl.metadata ?? {};
|
|
2687
|
+
const metadata = { ...desiredMetadata };
|
|
2688
|
+
for (const key of Object.keys(currentMetadata)) {
|
|
2689
|
+
if (!(key in desiredMetadata)) metadata[key] = "";
|
|
2690
|
+
}
|
|
2691
|
+
const res = await this.forwardClient.post(`/identities/${id}`, {
|
|
2692
|
+
external_id: decl.external_id,
|
|
2693
|
+
name: decl.name ?? name,
|
|
2694
|
+
enabled: decl.enabled ?? true,
|
|
2695
|
+
metadata
|
|
2696
|
+
});
|
|
2697
|
+
return toRemoteResource(res);
|
|
2698
|
+
}
|
|
2699
|
+
async deleteIdentity(id) {
|
|
2700
|
+
await this.forwardClient.delete(`/identities/${id}`);
|
|
2701
|
+
}
|
|
2702
|
+
async createChannel(name, decl, refs) {
|
|
2703
|
+
const res = await this.forwardClient.post("/channels", this.mapChannel(name, decl, refs));
|
|
2704
|
+
return toRemoteResource(res);
|
|
2705
|
+
}
|
|
2706
|
+
async updateChannel(id, name, decl, refs) {
|
|
2707
|
+
const current = await this.forwardClient.get(`/channels/${id}`);
|
|
2708
|
+
if (current.channel_type !== decl.type) {
|
|
2709
|
+
await this.deleteChannel(id);
|
|
2710
|
+
return this.createChannel(name, decl, refs);
|
|
2711
|
+
}
|
|
2712
|
+
const body = this.mapChannel(name, decl, refs);
|
|
2713
|
+
delete body.channel_type;
|
|
2714
|
+
const res = await this.forwardClient.post(`/channels/${id}`, body);
|
|
2715
|
+
return toRemoteResource(res);
|
|
2716
|
+
}
|
|
2717
|
+
async deleteChannel(id) {
|
|
2718
|
+
await this.forwardClient.delete(`/channels/${id}`);
|
|
2719
|
+
}
|
|
2720
|
+
mapChannel(name, decl, refs) {
|
|
2721
|
+
return {
|
|
2722
|
+
identity_id: refs.identity_id,
|
|
2723
|
+
template_id: refs.agent_id,
|
|
2724
|
+
channel_type: decl.type,
|
|
2725
|
+
name: decl.name ?? name,
|
|
2726
|
+
enabled: decl.enabled ?? true,
|
|
2727
|
+
channel_config: {
|
|
2728
|
+
credentials: decl.credentials,
|
|
2729
|
+
response_options: {
|
|
2730
|
+
include_tool_calls: false,
|
|
2731
|
+
include_thinking: false,
|
|
2732
|
+
...decl.options ?? {}
|
|
2733
|
+
}
|
|
2734
|
+
}
|
|
2735
|
+
};
|
|
2736
|
+
}
|
|
2193
2737
|
async registerForwardVaults(vaultIds) {
|
|
2194
2738
|
for (const id of vaultIds) {
|
|
2195
2739
|
await this.forwardClient.post("/resources/registry", {
|
|
@@ -2199,22 +2743,58 @@ var QoderAdapter = class _QoderAdapter {
|
|
|
2199
2743
|
}
|
|
2200
2744
|
}
|
|
2201
2745
|
async createMemoryStore(name, decl) {
|
|
2202
|
-
const body =
|
|
2746
|
+
const body = mapMemoryStore2(name, decl);
|
|
2203
2747
|
const res = await this.client.post("/memory_stores", body);
|
|
2204
2748
|
const storeId = res.id;
|
|
2205
|
-
|
|
2206
|
-
for (const entry of decl.entries) {
|
|
2207
|
-
await this.
|
|
2208
|
-
content: entry.content,
|
|
2209
|
-
path: entry.key
|
|
2210
|
-
});
|
|
2749
|
+
try {
|
|
2750
|
+
for (const entry of decl.entries ?? []) {
|
|
2751
|
+
await this.memoryApi.createMemory(storeId, { content: entry.content, path: entry.key });
|
|
2211
2752
|
}
|
|
2753
|
+
} catch (error) {
|
|
2754
|
+
await this.client.delete(`/memory_stores/${storeId}`).catch(() => void 0);
|
|
2755
|
+
throw error;
|
|
2212
2756
|
}
|
|
2213
2757
|
return toRemoteResource(res);
|
|
2214
2758
|
}
|
|
2215
2759
|
async deleteMemoryStore(id) {
|
|
2216
2760
|
await this.client.delete(`/memory_stores/${id}`);
|
|
2217
2761
|
}
|
|
2762
|
+
listMemoryStores(options) {
|
|
2763
|
+
return this.memoryApi.listStores(options);
|
|
2764
|
+
}
|
|
2765
|
+
getMemoryStore(id) {
|
|
2766
|
+
return this.memoryApi.getStore(id);
|
|
2767
|
+
}
|
|
2768
|
+
updateMemoryStore(id, input) {
|
|
2769
|
+
return this.memoryApi.updateStore(id, input);
|
|
2770
|
+
}
|
|
2771
|
+
archiveMemoryStore(id) {
|
|
2772
|
+
return this.memoryApi.archiveStore(id);
|
|
2773
|
+
}
|
|
2774
|
+
createMemory(storeId, input) {
|
|
2775
|
+
return this.memoryApi.createMemory(storeId, input);
|
|
2776
|
+
}
|
|
2777
|
+
listMemories(storeId, options) {
|
|
2778
|
+
return this.memoryApi.listMemories(storeId, options);
|
|
2779
|
+
}
|
|
2780
|
+
getMemory(storeId, memoryId) {
|
|
2781
|
+
return this.memoryApi.getMemory(storeId, memoryId);
|
|
2782
|
+
}
|
|
2783
|
+
updateMemory(storeId, memoryId, input) {
|
|
2784
|
+
return this.memoryApi.updateMemory(storeId, memoryId, input);
|
|
2785
|
+
}
|
|
2786
|
+
deleteMemory(storeId, memoryId, expected) {
|
|
2787
|
+
return this.memoryApi.deleteMemory(storeId, memoryId, expected);
|
|
2788
|
+
}
|
|
2789
|
+
listMemoryVersions(storeId, options) {
|
|
2790
|
+
return this.memoryApi.listVersions(storeId, options);
|
|
2791
|
+
}
|
|
2792
|
+
getMemoryVersion(storeId, versionId) {
|
|
2793
|
+
return this.memoryApi.getVersion(storeId, versionId);
|
|
2794
|
+
}
|
|
2795
|
+
redactMemoryVersion(storeId, versionId) {
|
|
2796
|
+
return this.memoryApi.redactVersion(storeId, versionId);
|
|
2797
|
+
}
|
|
2218
2798
|
async createDeployment(name, decl, refs, basePath) {
|
|
2219
2799
|
const uploaded = await this.uploadDeploymentFiles(decl, basePath);
|
|
2220
2800
|
const body = mapDeployment2(name, decl, refs, this.projectName, uploaded);
|
|
@@ -2223,7 +2803,20 @@ var QoderAdapter = class _QoderAdapter {
|
|
|
2223
2803
|
}
|
|
2224
2804
|
async updateDeployment(id, name, decl, refs, basePath) {
|
|
2225
2805
|
const uploaded = await this.uploadDeploymentFiles(decl, basePath);
|
|
2226
|
-
const
|
|
2806
|
+
const current = await this.client.get(`/deployments/${id}`);
|
|
2807
|
+
if (current.schedule && !decl.schedule) {
|
|
2808
|
+
throw new UserError(
|
|
2809
|
+
`Deployment '${name}' cannot remove its schedule through the documented Qoder update API; archive and recreate it as a manual deployment.`
|
|
2810
|
+
);
|
|
2811
|
+
}
|
|
2812
|
+
const body = mapDeploymentUpdate2(
|
|
2813
|
+
name,
|
|
2814
|
+
decl,
|
|
2815
|
+
refs,
|
|
2816
|
+
this.projectName,
|
|
2817
|
+
uploaded,
|
|
2818
|
+
current.metadata
|
|
2819
|
+
);
|
|
2227
2820
|
const res = await this.client.post(`/deployments/${id}`, body);
|
|
2228
2821
|
return toRemoteResource(res);
|
|
2229
2822
|
}
|
|
@@ -2258,6 +2851,35 @@ var QoderAdapter = class _QoderAdapter {
|
|
|
2258
2851
|
attributes: res
|
|
2259
2852
|
};
|
|
2260
2853
|
}
|
|
2854
|
+
async listDeployments(filter) {
|
|
2855
|
+
const params = new URLSearchParams();
|
|
2856
|
+
if (filter?.agent_id) params.set("agent_id", filter.agent_id);
|
|
2857
|
+
if (filter?.status) params.set("status", filter.status);
|
|
2858
|
+
if (filter?.include_archived) params.set("include_archived", "true");
|
|
2859
|
+
if (filter?.limit) params.set("limit", String(filter.limit));
|
|
2860
|
+
if (filter?.page) params.set("page", filter.page);
|
|
2861
|
+
if (filter?.created_at_gte) params.set("created_at[gte]", filter.created_at_gte);
|
|
2862
|
+
if (filter?.created_at_lte) params.set("created_at[lte]", filter.created_at_lte);
|
|
2863
|
+
const query2 = params.toString();
|
|
2864
|
+
const res = await this.client.get(`/deployments${query2 ? `?${query2}` : ""}`);
|
|
2865
|
+
return {
|
|
2866
|
+
deployments: (res.data ?? []).map(toDeploymentInfo2),
|
|
2867
|
+
has_more: Boolean(res.has_more),
|
|
2868
|
+
next_page: res.next_page ?? void 0
|
|
2869
|
+
};
|
|
2870
|
+
}
|
|
2871
|
+
async pauseDeployment(ctx) {
|
|
2872
|
+
return this.setDeploymentPaused(ctx, true);
|
|
2873
|
+
}
|
|
2874
|
+
async unpauseDeployment(ctx) {
|
|
2875
|
+
return this.setDeploymentPaused(ctx, false);
|
|
2876
|
+
}
|
|
2877
|
+
async setDeploymentPaused(ctx, paused) {
|
|
2878
|
+
if (!ctx.id) throw new UserError(`Deployment '${ctx.name}' has no remote id; run \`agents apply\` first.`);
|
|
2879
|
+
const action = paused ? "pause" : "unpause";
|
|
2880
|
+
const res = await this.client.post(`/deployments/${ctx.id}/${action}`, {});
|
|
2881
|
+
return toDeploymentInfo2(res);
|
|
2882
|
+
}
|
|
2261
2883
|
async uploadDeploymentFiles(decl, basePath) {
|
|
2262
2884
|
const map = /* @__PURE__ */ new Map();
|
|
2263
2885
|
for (const r of decl.resources ?? []) {
|
|
@@ -2278,9 +2900,11 @@ var QoderAdapter = class _QoderAdapter {
|
|
|
2278
2900
|
}
|
|
2279
2901
|
async createSession(bindings) {
|
|
2280
2902
|
if (bindings.delivery === "forward") {
|
|
2281
|
-
|
|
2903
|
+
if (!bindings.identity_id) {
|
|
2904
|
+
throw new UserError("Qoder Forward sessions require an explicit resolved identity_id.");
|
|
2905
|
+
}
|
|
2282
2906
|
const body2 = {
|
|
2283
|
-
identity_id:
|
|
2907
|
+
identity_id: bindings.identity_id,
|
|
2284
2908
|
template_id: bindings.template_id,
|
|
2285
2909
|
incremental_streaming_enabled: false
|
|
2286
2910
|
};
|
|
@@ -2302,30 +2926,6 @@ var QoderAdapter = class _QoderAdapter {
|
|
|
2302
2926
|
const res = await this.client.post("/sessions", body);
|
|
2303
2927
|
return toSessionInfo2(res);
|
|
2304
2928
|
}
|
|
2305
|
-
async resolveDefaultForwardIdentityId() {
|
|
2306
|
-
if (this.defaultForwardIdentityId) return this.defaultForwardIdentityId;
|
|
2307
|
-
let afterId;
|
|
2308
|
-
do {
|
|
2309
|
-
const params = new URLSearchParams({ limit: "100" });
|
|
2310
|
-
if (afterId) params.set("after_id", afterId);
|
|
2311
|
-
const res = await this.forwardClient.get(`/identities?${params}`);
|
|
2312
|
-
const identities = res.data ?? [];
|
|
2313
|
-
const match = identities.find(
|
|
2314
|
-
(identity) => identity.external_id === QODER_DEFAULT_IDENTITY_EXTERNAL_ID && identity.enabled !== false && identity.archived !== true
|
|
2315
|
-
);
|
|
2316
|
-
if (typeof match?.id === "string") {
|
|
2317
|
-
this.defaultForwardIdentityId = match.id;
|
|
2318
|
-
return match.id;
|
|
2319
|
-
}
|
|
2320
|
-
const hasMore = res.has_more ?? false;
|
|
2321
|
-
const nextId = hasMore ? res.last_id ?? void 0 : void 0;
|
|
2322
|
-
if (!nextId || nextId === afterId) break;
|
|
2323
|
-
afterId = nextId;
|
|
2324
|
-
} while (afterId);
|
|
2325
|
-
throw new UserError(
|
|
2326
|
-
`Qoder default Forward Identity '${QODER_DEFAULT_IDENTITY_EXTERNAL_ID}' was not found. Ask Qoder to provision it, set defaults.session.qoder.identity_id, or pass --identity-id.`
|
|
2327
|
-
);
|
|
2328
|
-
}
|
|
2329
2929
|
async listSessions(filter) {
|
|
2330
2930
|
if (filter?.agent_id?.startsWith("tmpl_")) {
|
|
2331
2931
|
const params2 = new URLSearchParams({ template_id: filter.agent_id });
|
|
@@ -2448,8 +3048,8 @@ var QoderAdapter = class _QoderAdapter {
|
|
|
2448
3048
|
if (options?.order) params.set("order", options.order);
|
|
2449
3049
|
const afterId = options?.after_id ?? options?.page_token ?? options?.page;
|
|
2450
3050
|
if (afterId) params.set("after_id", afterId);
|
|
2451
|
-
const
|
|
2452
|
-
const res = await this.forwardClient.get(`/sessions/${sessionId}/events${
|
|
3051
|
+
const query2 = params.toString();
|
|
3052
|
+
const res = await this.forwardClient.get(`/sessions/${sessionId}/events${query2 ? `?${query2}` : ""}`);
|
|
2453
3053
|
const data = res.data ?? [];
|
|
2454
3054
|
const hasMore = res.has_more ?? false;
|
|
2455
3055
|
return {
|
|
@@ -2573,7 +3173,9 @@ var QODER_CAPABILITIES = {
|
|
|
2573
3173
|
tier: "native",
|
|
2574
3174
|
reason: "deployments API with scheduled and manual runs"
|
|
2575
3175
|
},
|
|
2576
|
-
session: { tier: "native", reason: "sessions API" }
|
|
3176
|
+
session: { tier: "native", reason: "sessions API" },
|
|
3177
|
+
identity: { tier: "native", reason: "Forward Identities API" },
|
|
3178
|
+
channel: { tier: "native", reason: "Forward Channels API" }
|
|
2577
3179
|
};
|
|
2578
3180
|
|
|
2579
3181
|
// src/internal/providers/qoder/config.ts
|
|
@@ -3494,7 +4096,9 @@ var BAILIAN_CAPABILITIES = {
|
|
|
3494
4096
|
reason: "no deployment primitive on Bailian; expanded into a session at run time",
|
|
3495
4097
|
remediation: "scheduling and outcome rubrics are not enforced server-side \u2014 use external cron/CI for always-on or scheduled runs"
|
|
3496
4098
|
},
|
|
3497
|
-
session: { tier: "native", reason: "sessions API" }
|
|
4099
|
+
session: { tier: "native", reason: "sessions API" },
|
|
4100
|
+
identity: { tier: "unsupported", reason: "no mapped Identity primitive on Bailian" },
|
|
4101
|
+
channel: { tier: "unsupported", reason: "no mapped messaging Channel primitive on Bailian" }
|
|
3498
4102
|
};
|
|
3499
4103
|
|
|
3500
4104
|
// src/internal/providers/bailian/config.ts
|
|
@@ -3713,10 +4317,11 @@ function mapEnvironment4(name, decl, projectName, wireName) {
|
|
|
3713
4317
|
if (decl.description) body.description = decl.description;
|
|
3714
4318
|
return body;
|
|
3715
4319
|
}
|
|
3716
|
-
function
|
|
4320
|
+
function mapMemoryStore3(name, decl) {
|
|
3717
4321
|
return {
|
|
3718
4322
|
name,
|
|
3719
|
-
description: decl.description
|
|
4323
|
+
description: decl.description,
|
|
4324
|
+
metadata: decl.metadata
|
|
3720
4325
|
};
|
|
3721
4326
|
}
|
|
3722
4327
|
function mapAgent4(name, decl, refs, version, projectName) {
|
|
@@ -3915,10 +4520,28 @@ function mapSession4(bindings) {
|
|
|
3915
4520
|
var ArkAdapter = class _ArkAdapter {
|
|
3916
4521
|
name = "ark";
|
|
3917
4522
|
eventResume = false;
|
|
4523
|
+
memoryCapabilities = {
|
|
4524
|
+
archive_store: false,
|
|
4525
|
+
batch_create: true,
|
|
4526
|
+
versions: false,
|
|
4527
|
+
optimistic_concurrency: false,
|
|
4528
|
+
memory_metadata: false
|
|
4529
|
+
};
|
|
3918
4530
|
client;
|
|
4531
|
+
memoryApi;
|
|
3919
4532
|
projectName;
|
|
3920
4533
|
constructor(apiKey, projectName) {
|
|
3921
4534
|
this.client = new ArkClient({ apiKey });
|
|
4535
|
+
this.memoryApi = new ProviderMemoryApi(this.client, {
|
|
4536
|
+
pathStyle: "absolute",
|
|
4537
|
+
cursorParam: "page",
|
|
4538
|
+
updatePrecondition: "none",
|
|
4539
|
+
prefixParam: "path_prefix",
|
|
4540
|
+
supportsView: false,
|
|
4541
|
+
supportsMemoryMetadata: false,
|
|
4542
|
+
supportsDeletePrecondition: false,
|
|
4543
|
+
supportsIncludeArchived: false
|
|
4544
|
+
});
|
|
3922
4545
|
this.projectName = projectName ?? "";
|
|
3923
4546
|
}
|
|
3924
4547
|
async validate() {
|
|
@@ -4071,22 +4694,49 @@ var ArkAdapter = class _ArkAdapter {
|
|
|
4071
4694
|
await this.client.delete(`/agents/${id}`);
|
|
4072
4695
|
}
|
|
4073
4696
|
async createMemoryStore(name, decl) {
|
|
4074
|
-
const body =
|
|
4697
|
+
const body = mapMemoryStore3(name, decl);
|
|
4075
4698
|
const res = await this.client.post("/memory_stores", body);
|
|
4076
4699
|
const storeId = res.id;
|
|
4077
|
-
|
|
4078
|
-
for (const entry of decl.entries) {
|
|
4079
|
-
await this.
|
|
4080
|
-
content: entry.content,
|
|
4081
|
-
path: entry.key
|
|
4082
|
-
});
|
|
4700
|
+
try {
|
|
4701
|
+
for (const entry of decl.entries ?? []) {
|
|
4702
|
+
await this.memoryApi.createMemory(storeId, { content: entry.content, path: entry.key });
|
|
4083
4703
|
}
|
|
4704
|
+
} catch (error) {
|
|
4705
|
+
await this.client.delete(`/memory_stores/${storeId}`).catch(() => void 0);
|
|
4706
|
+
throw error;
|
|
4084
4707
|
}
|
|
4085
4708
|
return toRemoteResource(res);
|
|
4086
4709
|
}
|
|
4087
4710
|
async deleteMemoryStore(id) {
|
|
4088
4711
|
await this.client.delete(`/memory_stores/${id}`);
|
|
4089
4712
|
}
|
|
4713
|
+
listMemoryStores(options) {
|
|
4714
|
+
return this.memoryApi.listStores(options);
|
|
4715
|
+
}
|
|
4716
|
+
getMemoryStore(id) {
|
|
4717
|
+
return this.memoryApi.getStore(id);
|
|
4718
|
+
}
|
|
4719
|
+
updateMemoryStore(id, input) {
|
|
4720
|
+
return this.memoryApi.updateStore(id, input);
|
|
4721
|
+
}
|
|
4722
|
+
createMemory(storeId, input) {
|
|
4723
|
+
return this.memoryApi.createMemory(storeId, input);
|
|
4724
|
+
}
|
|
4725
|
+
batchCreateMemories(storeId, input) {
|
|
4726
|
+
return this.memoryApi.batchCreateMemories(storeId, input);
|
|
4727
|
+
}
|
|
4728
|
+
listMemories(storeId, options) {
|
|
4729
|
+
return this.memoryApi.listMemories(storeId, options);
|
|
4730
|
+
}
|
|
4731
|
+
getMemory(storeId, memoryId) {
|
|
4732
|
+
return this.memoryApi.getMemory(storeId, memoryId);
|
|
4733
|
+
}
|
|
4734
|
+
updateMemory(storeId, memoryId, input) {
|
|
4735
|
+
return this.memoryApi.updateMemory(storeId, memoryId, input);
|
|
4736
|
+
}
|
|
4737
|
+
deleteMemory(storeId, memoryId, expected) {
|
|
4738
|
+
return this.memoryApi.deleteMemory(storeId, memoryId, expected);
|
|
4739
|
+
}
|
|
4090
4740
|
// --- Deployment (emulated) ---
|
|
4091
4741
|
// Ark has no /deployments endpoint. A deployment is recorded in state with
|
|
4092
4742
|
// remote_id = null and materialized into a session at run time (mirrors qoder).
|
|
@@ -4248,7 +4898,9 @@ var ARK_CAPABILITIES = {
|
|
|
4248
4898
|
tier: "emulated",
|
|
4249
4899
|
reason: "no deployment primitive on Ark; expanded into a session at run time"
|
|
4250
4900
|
},
|
|
4251
|
-
session: { tier: "native", reason: "sessions API" }
|
|
4901
|
+
session: { tier: "native", reason: "sessions API" },
|
|
4902
|
+
identity: { tier: "unsupported", reason: "no mapped Identity primitive on Ark" },
|
|
4903
|
+
channel: { tier: "unsupported", reason: "no mapped messaging Channel primitive on Ark" }
|
|
4252
4904
|
};
|
|
4253
4905
|
|
|
4254
4906
|
// src/internal/providers/ark/config.ts
|
|
@@ -4308,11 +4960,11 @@ async function writeProjectRuntime(input, fn) {
|
|
|
4308
4960
|
);
|
|
4309
4961
|
}
|
|
4310
4962
|
function getRuntimeProvider(ctx, providerName) {
|
|
4311
|
-
const
|
|
4312
|
-
if (!
|
|
4963
|
+
const adapter2 = ctx.providers.get(providerName);
|
|
4964
|
+
if (!adapter2) {
|
|
4313
4965
|
throw new UserError(`Provider '${providerName}' not configured.`);
|
|
4314
4966
|
}
|
|
4315
|
-
return
|
|
4967
|
+
return adapter2;
|
|
4316
4968
|
}
|
|
4317
4969
|
|
|
4318
4970
|
// src/internal/parser/file-resolver.ts
|
|
@@ -4444,6 +5096,7 @@ var memoryEntrySchema = z5.object({
|
|
|
4444
5096
|
var memoryStoreSchema = z5.object({
|
|
4445
5097
|
description: z5.string(),
|
|
4446
5098
|
provider: z5.string().optional(),
|
|
5099
|
+
metadata: z5.record(z5.string(), z5.string()).optional(),
|
|
4447
5100
|
entries: z5.array(memoryEntrySchema).optional()
|
|
4448
5101
|
});
|
|
4449
5102
|
var skillSchema = z5.object({
|
|
@@ -4460,6 +5113,23 @@ var fileSchema = z5.object({
|
|
|
4460
5113
|
purpose: z5.string().optional(),
|
|
4461
5114
|
provider: z5.string().optional()
|
|
4462
5115
|
});
|
|
5116
|
+
var managedIdentitySchema = z5.object({
|
|
5117
|
+
provider: z5.string().optional(),
|
|
5118
|
+
external_id: z5.string().trim().min(1),
|
|
5119
|
+
name: z5.string().trim().min(1).optional(),
|
|
5120
|
+
enabled: z5.boolean().optional(),
|
|
5121
|
+
metadata: z5.record(z5.string(), z5.string()).optional(),
|
|
5122
|
+
identity_id: z5.never().optional()
|
|
5123
|
+
});
|
|
5124
|
+
var externalIdentitySchema = z5.object({
|
|
5125
|
+
provider: z5.string().optional(),
|
|
5126
|
+
identity_id: z5.string().trim().min(1),
|
|
5127
|
+
external_id: z5.never().optional(),
|
|
5128
|
+
name: z5.never().optional(),
|
|
5129
|
+
enabled: z5.never().optional(),
|
|
5130
|
+
metadata: z5.never().optional()
|
|
5131
|
+
});
|
|
5132
|
+
var identitySchema = z5.union([managedIdentitySchema, externalIdentitySchema]);
|
|
4463
5133
|
var urlMcpServerSchema = z5.object({
|
|
4464
5134
|
name: z5.string(),
|
|
4465
5135
|
type: z5.enum(["url", "http"]).optional(),
|
|
@@ -4540,6 +5210,16 @@ var agentSchema = z5.object({
|
|
|
4540
5210
|
metadata: z5.record(z5.string(), z5.string()).optional(),
|
|
4541
5211
|
delivery: z5.record(z5.string(), agentDeliverySchema).optional()
|
|
4542
5212
|
});
|
|
5213
|
+
var channelSchema = z5.object({
|
|
5214
|
+
provider: z5.string().optional(),
|
|
5215
|
+
agent: z5.string().min(1),
|
|
5216
|
+
identity: z5.string().min(1).optional(),
|
|
5217
|
+
type: z5.string().min(1),
|
|
5218
|
+
name: z5.string().trim().min(1).optional(),
|
|
5219
|
+
enabled: z5.boolean().optional(),
|
|
5220
|
+
credentials: z5.record(z5.string(), coerceString).optional(),
|
|
5221
|
+
options: z5.record(z5.string(), z5.unknown()).optional()
|
|
5222
|
+
});
|
|
4543
5223
|
var deploymentFileResourceSchema = z5.object({
|
|
4544
5224
|
type: z5.literal("file"),
|
|
4545
5225
|
file_id: z5.string().optional(),
|
|
@@ -4593,18 +5273,15 @@ var deploymentSchema = z5.object({
|
|
|
4593
5273
|
schedule: scheduleSchema.optional(),
|
|
4594
5274
|
description: z5.string().optional(),
|
|
4595
5275
|
provider: z5.string().optional(),
|
|
4596
|
-
metadata: z5.record(z5.string(), z5.string()).optional()
|
|
5276
|
+
metadata: z5.record(z5.string(), z5.string()).optional(),
|
|
5277
|
+
environment_variables: z5.string().optional()
|
|
4597
5278
|
});
|
|
4598
5279
|
var projectConfigSchema = z5.object({
|
|
4599
5280
|
version: z5.string(),
|
|
4600
5281
|
providers: z5.record(z5.string(), z5.unknown()),
|
|
4601
5282
|
defaults: z5.object({
|
|
4602
5283
|
provider: z5.string().optional(),
|
|
4603
|
-
|
|
4604
|
-
qoder: z5.object({
|
|
4605
|
-
identity_id: z5.string().min(1).optional()
|
|
4606
|
-
}).optional()
|
|
4607
|
-
}).optional()
|
|
5284
|
+
identity: z5.string().min(1).optional()
|
|
4608
5285
|
}).optional(),
|
|
4609
5286
|
environments: z5.record(z5.string(), environmentSchema).optional(),
|
|
4610
5287
|
tunnels: z5.record(z5.string(), tunnelSchema).optional(),
|
|
@@ -4612,7 +5289,9 @@ var projectConfigSchema = z5.object({
|
|
|
4612
5289
|
memory_stores: z5.record(z5.string(), memoryStoreSchema).optional(),
|
|
4613
5290
|
skills: z5.record(z5.string(), skillSchema).optional(),
|
|
4614
5291
|
files: z5.record(z5.string(), fileSchema).optional(),
|
|
5292
|
+
identities: z5.record(z5.string(), identitySchema).optional(),
|
|
4615
5293
|
agents: z5.record(z5.string(), agentSchema).optional(),
|
|
5294
|
+
channels: z5.record(z5.string(), channelSchema).optional(),
|
|
4616
5295
|
deployments: z5.record(z5.string(), deploymentSchema).optional()
|
|
4617
5296
|
});
|
|
4618
5297
|
|
|
@@ -4728,6 +5407,10 @@ function getResourceDeclaration(address, config) {
|
|
|
4728
5407
|
return config.agents?.[name] ?? null;
|
|
4729
5408
|
case "file":
|
|
4730
5409
|
return config.files?.[name] ?? null;
|
|
5410
|
+
case "identity":
|
|
5411
|
+
return config.identities?.[name] ?? null;
|
|
5412
|
+
case "channel":
|
|
5413
|
+
return config.channels?.[name] ?? null;
|
|
4731
5414
|
case "deployment":
|
|
4732
5415
|
return config.deployments?.[name] ?? null;
|
|
4733
5416
|
default:
|
|
@@ -4784,8 +5467,26 @@ async function computeResourceHash(address, config, basePath, state) {
|
|
|
4784
5467
|
const refs = resolveTemplateReferenceIds(decl, config, address.provider, state);
|
|
4785
5468
|
return contentHash({ decl, refs });
|
|
4786
5469
|
}
|
|
5470
|
+
if (address.type === "channel") {
|
|
5471
|
+
const refs = resolveChannelReferenceIds(
|
|
5472
|
+
decl,
|
|
5473
|
+
config,
|
|
5474
|
+
address.provider,
|
|
5475
|
+
state
|
|
5476
|
+
);
|
|
5477
|
+
return contentHash({ decl, refs });
|
|
5478
|
+
}
|
|
4787
5479
|
return contentHash(decl);
|
|
4788
5480
|
}
|
|
5481
|
+
function resolveChannelReferenceIds(decl, config, provider, state) {
|
|
5482
|
+
const agent = config.agents?.[decl.agent];
|
|
5483
|
+
const agentType = agent?.delivery?.[provider]?.type === "forward" ? "template" : "agent";
|
|
5484
|
+
const identity = decl.identity ?? config.defaults?.identity;
|
|
5485
|
+
return {
|
|
5486
|
+
agent_id: state?.getResource({ type: agentType, name: decl.agent, provider })?.remote_id,
|
|
5487
|
+
identity_id: identity ? state?.getResource({ type: "identity", name: identity, provider })?.remote_id : void 0
|
|
5488
|
+
};
|
|
5489
|
+
}
|
|
4789
5490
|
function resolveTemplateReferenceIds(decl, config, provider, state) {
|
|
4790
5491
|
const environment = decl.environment ? config.environments?.[decl.environment] : void 0;
|
|
4791
5492
|
const tunnel = decl.tunnel ? config.tunnels?.[decl.tunnel] : void 0;
|
|
@@ -4884,14 +5585,14 @@ function structurallyEqual(left, right) {
|
|
|
4884
5585
|
}
|
|
4885
5586
|
|
|
4886
5587
|
// src/internal/providers/drift-support.ts
|
|
4887
|
-
function supportsFullDrift(
|
|
4888
|
-
return
|
|
5588
|
+
function supportsFullDrift(adapter2, type) {
|
|
5589
|
+
return adapter2.getDriftSupport?.(type) === "full" && typeof adapter2.readComparableResource === "function";
|
|
4889
5590
|
}
|
|
4890
|
-
async function readComparableIfSupported(
|
|
4891
|
-
if (!supportsFullDrift(
|
|
4892
|
-
if (typeof
|
|
5591
|
+
async function readComparableIfSupported(adapter2, type, id, name) {
|
|
5592
|
+
if (!supportsFullDrift(adapter2, type)) return null;
|
|
5593
|
+
if (typeof adapter2.readComparableResource !== "function") return null;
|
|
4893
5594
|
try {
|
|
4894
|
-
return await
|
|
5595
|
+
return await adapter2.readComparableResource(type, id, name);
|
|
4895
5596
|
} catch {
|
|
4896
5597
|
return null;
|
|
4897
5598
|
}
|
|
@@ -5026,6 +5727,20 @@ function resolveDeploymentRefs(deploymentName, config, provider, state) {
|
|
|
5026
5727
|
memory_store_ids
|
|
5027
5728
|
};
|
|
5028
5729
|
}
|
|
5730
|
+
function resolveChannelRefs(channelName, config, provider, state) {
|
|
5731
|
+
const channel = config.channels?.[channelName];
|
|
5732
|
+
if (!channel) throw new UserError(`Channel '${channelName}' not found in config`);
|
|
5733
|
+
const agent = config.agents?.[channel.agent];
|
|
5734
|
+
if (!agent) throw new UserError(`Channel '${channelName}' references unknown agent '${channel.agent}'`);
|
|
5735
|
+
const agentType = agent.delivery?.[provider]?.type === "forward" ? "template" : "agent";
|
|
5736
|
+
const agent_id = requireRef(state, { type: agentType, name: channel.agent, provider });
|
|
5737
|
+
const identityName = channel.identity ?? config.defaults?.identity;
|
|
5738
|
+
if (!identityName) {
|
|
5739
|
+
throw new UserError(`Channel '${channelName}' must declare identity or use defaults.identity.`);
|
|
5740
|
+
}
|
|
5741
|
+
const identity_id = requireRef(state, { type: "identity", name: identityName, provider });
|
|
5742
|
+
return { identity_id, agent_id };
|
|
5743
|
+
}
|
|
5029
5744
|
function resolveTunnelIdFromConfig(config, tunnelName, provider) {
|
|
5030
5745
|
if (provider !== "qoder") {
|
|
5031
5746
|
throw new UserError("Tunnels are supported only by Qoder BYOC sessions.");
|
|
@@ -5078,10 +5793,10 @@ async function executePlan(plan, ctx, options = {}) {
|
|
|
5078
5793
|
const failed = /* @__PURE__ */ new Set();
|
|
5079
5794
|
let stateUpdated = false;
|
|
5080
5795
|
for (const action of plan.actions) {
|
|
5081
|
-
if (action.address.type !== "environment") continue;
|
|
5082
|
-
const decl = ctx.config.environments?.[action.address.name];
|
|
5796
|
+
if (action.address.type !== "environment" && action.address.type !== "identity") continue;
|
|
5083
5797
|
const existing = ctx.state.getResource(action.address);
|
|
5084
|
-
|
|
5798
|
+
const externalId = action.address.type === "environment" ? ctx.config.environments?.[action.address.name]?.environment_id : ctx.config.identities?.[action.address.name]?.identity_id;
|
|
5799
|
+
if (externalId && existing && !existing.externally_managed) {
|
|
5085
5800
|
ctx.state.setResource({ ...existing, externally_managed: true });
|
|
5086
5801
|
stateUpdated = true;
|
|
5087
5802
|
}
|
|
@@ -5225,9 +5940,9 @@ async function executeActionInner(action, provider, ctx) {
|
|
|
5225
5940
|
const existing = ctx.state.getResource(address);
|
|
5226
5941
|
if (!existing) return false;
|
|
5227
5942
|
const id = existing.remote_id;
|
|
5228
|
-
if (type === "environment") {
|
|
5229
|
-
const
|
|
5230
|
-
if (existing.externally_managed ||
|
|
5943
|
+
if (type === "environment" || type === "identity") {
|
|
5944
|
+
const externalReference = type === "environment" ? ctx.config.environments?.[name]?.environment_id : ctx.config.identities?.[name]?.identity_id;
|
|
5945
|
+
if (existing.externally_managed || externalReference) {
|
|
5231
5946
|
ctx.state.removeResource(address);
|
|
5232
5947
|
return false;
|
|
5233
5948
|
}
|
|
@@ -5262,6 +5977,16 @@ async function executeActionInner(action, provider, ctx) {
|
|
|
5262
5977
|
case "file":
|
|
5263
5978
|
await provider.deleteFile(id);
|
|
5264
5979
|
break;
|
|
5980
|
+
case "identity":
|
|
5981
|
+
if (!provider.deleteIdentity)
|
|
5982
|
+
throw new UserError(`Provider '${address.provider}' does not support identities`);
|
|
5983
|
+
await provider.deleteIdentity(id);
|
|
5984
|
+
break;
|
|
5985
|
+
case "channel":
|
|
5986
|
+
if (!provider.deleteChannel)
|
|
5987
|
+
throw new UserError(`Provider '${address.provider}' does not support channels`);
|
|
5988
|
+
await provider.deleteChannel(id);
|
|
5989
|
+
break;
|
|
5265
5990
|
}
|
|
5266
5991
|
} catch (err) {
|
|
5267
5992
|
if (!ApiError.isNotFound(err)) throw err;
|
|
@@ -5383,27 +6108,51 @@ async function executeActionInner(action, provider, ctx) {
|
|
|
5383
6108
|
break;
|
|
5384
6109
|
}
|
|
5385
6110
|
case "memory_store": {
|
|
5386
|
-
const
|
|
5387
|
-
const
|
|
5388
|
-
if (!
|
|
6111
|
+
const createMemoryStore2 = provider.createMemoryStore?.bind(provider);
|
|
6112
|
+
const deleteMemoryStore2 = provider.deleteMemoryStore?.bind(provider);
|
|
6113
|
+
if (!createMemoryStore2 || !deleteMemoryStore2) throw memoryStoreUnsupported(address.provider);
|
|
5389
6114
|
const decl = ctx.config.memory_stores[name];
|
|
5390
|
-
if (
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
6115
|
+
if (!provider.updateMemoryStore || !provider.listMemories || !provider.createMemory || !provider.updateMemory) {
|
|
6116
|
+
throw memoryStoreUnsupported(address.provider);
|
|
6117
|
+
}
|
|
6118
|
+
const reconcile = async (storeId) => {
|
|
6119
|
+
const store = await provider.updateMemoryStore(storeId, {
|
|
6120
|
+
name,
|
|
6121
|
+
description: decl.description,
|
|
6122
|
+
metadata: decl.metadata ?? {}
|
|
6123
|
+
});
|
|
6124
|
+
const current = /* @__PURE__ */ new Map();
|
|
6125
|
+
let cursor;
|
|
6126
|
+
do {
|
|
6127
|
+
const page2 = await provider.listMemories(storeId, { limit: 100, cursor, view: "basic" });
|
|
6128
|
+
for (const memory of page2.data) {
|
|
6129
|
+
if (memory.type === "memory") current.set(memory.path, memory);
|
|
6130
|
+
}
|
|
6131
|
+
cursor = page2.has_more ? page2.next_cursor : void 0;
|
|
6132
|
+
} while (cursor);
|
|
6133
|
+
for (const entry of decl.entries ?? []) {
|
|
6134
|
+
const existing = current.get(entry.key.replace(/^\/+/, ""));
|
|
6135
|
+
if (existing) {
|
|
6136
|
+
if (existing.content_sha256 !== sha256(entry.content)) {
|
|
6137
|
+
await provider.updateMemory(storeId, existing.id, {
|
|
6138
|
+
content: entry.content,
|
|
6139
|
+
expected_content_sha256: existing.content_sha256
|
|
6140
|
+
});
|
|
6141
|
+
}
|
|
6142
|
+
} else {
|
|
6143
|
+
await provider.createMemory(storeId, { path: entry.key, content: entry.content });
|
|
6144
|
+
}
|
|
5397
6145
|
}
|
|
6146
|
+
return store;
|
|
6147
|
+
};
|
|
6148
|
+
if (isUpdate) {
|
|
6149
|
+
result = await reconcile(existingId);
|
|
5398
6150
|
} else {
|
|
5399
6151
|
try {
|
|
5400
|
-
result = await
|
|
6152
|
+
result = await createMemoryStore2(name, decl);
|
|
5401
6153
|
} catch (err) {
|
|
5402
6154
|
result = await adoptOnConflict(err, address, provider, ctx.onFeedback, {
|
|
5403
|
-
onExisting: async (existing) =>
|
|
5404
|
-
await deleteMemoryStore(existing.id);
|
|
5405
|
-
return createMemoryStore(name, decl);
|
|
5406
|
-
}
|
|
6155
|
+
onExisting: async (existing) => reconcile(existing.id)
|
|
5407
6156
|
});
|
|
5408
6157
|
adopted = true;
|
|
5409
6158
|
}
|
|
@@ -5451,6 +6200,63 @@ async function executeActionInner(action, provider, ctx) {
|
|
|
5451
6200
|
}
|
|
5452
6201
|
break;
|
|
5453
6202
|
}
|
|
6203
|
+
case "identity": {
|
|
6204
|
+
const createIdentity = provider.createIdentity?.bind(provider);
|
|
6205
|
+
const updateIdentity = provider.updateIdentity?.bind(provider);
|
|
6206
|
+
if (!createIdentity || !updateIdentity) {
|
|
6207
|
+
throw new UserError(`Provider '${address.provider}' does not support identities`);
|
|
6208
|
+
}
|
|
6209
|
+
const decl = ctx.config.identities[name];
|
|
6210
|
+
if (decl.identity_id) {
|
|
6211
|
+
const remote2 = await provider.findResource("identity", name, decl.identity_id);
|
|
6212
|
+
if (!remote2?.id) {
|
|
6213
|
+
throw new UserError(
|
|
6214
|
+
`External identity.${name} '${decl.identity_id}' was not found on provider '${address.provider}'.`
|
|
6215
|
+
);
|
|
6216
|
+
}
|
|
6217
|
+
result = remote2;
|
|
6218
|
+
break;
|
|
6219
|
+
}
|
|
6220
|
+
if (isUpdate) {
|
|
6221
|
+
if (ctx.state.getResource(address)?.externally_managed) {
|
|
6222
|
+
throw new UserError(`identity.${name} is recorded as an external reference; refusing to modify it remotely.`);
|
|
6223
|
+
}
|
|
6224
|
+
result = await updateIdentity(existingId, name, decl);
|
|
6225
|
+
} else {
|
|
6226
|
+
try {
|
|
6227
|
+
result = await createIdentity(name, decl);
|
|
6228
|
+
} catch (err) {
|
|
6229
|
+
if (!(err instanceof ConflictError)) throw err;
|
|
6230
|
+
const existing = await provider.findResource("identity", decl.external_id);
|
|
6231
|
+
if (!existing?.id) throw err;
|
|
6232
|
+
result = await updateIdentity(existing.id, name, decl);
|
|
6233
|
+
adopted = true;
|
|
6234
|
+
}
|
|
6235
|
+
}
|
|
6236
|
+
break;
|
|
6237
|
+
}
|
|
6238
|
+
case "channel": {
|
|
6239
|
+
const createChannel = provider.createChannel?.bind(provider);
|
|
6240
|
+
const updateChannel = provider.updateChannel?.bind(provider);
|
|
6241
|
+
if (!createChannel || !updateChannel) {
|
|
6242
|
+
throw new UserError(`Provider '${address.provider}' does not support channels`);
|
|
6243
|
+
}
|
|
6244
|
+
const decl = ctx.config.channels[name];
|
|
6245
|
+
const refs = resolveChannelRefs(name, ctx.config, address.provider, ctx.state);
|
|
6246
|
+
if (isUpdate) {
|
|
6247
|
+
result = await updateChannel(existingId, name, decl, refs);
|
|
6248
|
+
} else {
|
|
6249
|
+
try {
|
|
6250
|
+
result = await createChannel(name, decl, refs);
|
|
6251
|
+
} catch (err) {
|
|
6252
|
+
result = await adoptOnConflict(err, address, provider, ctx.onFeedback, {
|
|
6253
|
+
onExisting: (existing) => updateChannel(existing.id, name, decl, refs)
|
|
6254
|
+
});
|
|
6255
|
+
adopted = true;
|
|
6256
|
+
}
|
|
6257
|
+
}
|
|
6258
|
+
break;
|
|
6259
|
+
}
|
|
5454
6260
|
case "deployment": {
|
|
5455
6261
|
const decl = ctx.config.deployments[name];
|
|
5456
6262
|
const refs = resolveDeploymentRefs(name, ctx.config, address.provider, ctx.state);
|
|
@@ -5503,7 +6309,7 @@ async function executeActionInner(action, provider, ctx) {
|
|
|
5503
6309
|
ctx.state.setResource({
|
|
5504
6310
|
address,
|
|
5505
6311
|
remote_id: result.id,
|
|
5506
|
-
externally_managed: priorResource?.externally_managed || type === "environment" && ctx.config.environments?.[name]?.environment_id ? true : void 0,
|
|
6312
|
+
externally_managed: priorResource?.externally_managed || type === "environment" && ctx.config.environments?.[name]?.environment_id || type === "identity" && ctx.config.identities?.[name]?.identity_id ? true : void 0,
|
|
5507
6313
|
version: result.version,
|
|
5508
6314
|
content_hash: hash,
|
|
5509
6315
|
desired_hash: hash,
|
|
@@ -5637,6 +6443,13 @@ function collectReferenceDiagnostics(config, diagnostics) {
|
|
|
5637
6443
|
const vaultNames = new Set(Object.keys(config.vaults ?? {}));
|
|
5638
6444
|
const memoryNames = new Set(Object.keys(config.memory_stores ?? {}));
|
|
5639
6445
|
const agentNames = new Set(Object.keys(config.agents ?? {}));
|
|
6446
|
+
const identityNames = new Set(Object.keys(config.identities ?? {}));
|
|
6447
|
+
if (config.defaults?.identity && !identityNames.has(config.defaults.identity)) {
|
|
6448
|
+
diagnostics.error(
|
|
6449
|
+
"config.defaults.identity.unknown",
|
|
6450
|
+
`defaults.identity references unknown identity '${config.defaults.identity}'`
|
|
6451
|
+
);
|
|
6452
|
+
}
|
|
5640
6453
|
for (const [name, agent] of Object.entries(config.agents ?? {})) {
|
|
5641
6454
|
if (agent.environment && !envNames.has(agent.environment)) {
|
|
5642
6455
|
diagnostics.error(
|
|
@@ -5686,6 +6499,23 @@ function collectReferenceDiagnostics(config, diagnostics) {
|
|
|
5686
6499
|
);
|
|
5687
6500
|
}
|
|
5688
6501
|
}
|
|
6502
|
+
for (const [name, channel] of Object.entries(config.channels ?? {})) {
|
|
6503
|
+
if (!agentNames.has(channel.agent)) {
|
|
6504
|
+
diagnostics.error("config.channel.agent.unknown", `channel.${name}: references unknown agent '${channel.agent}'`);
|
|
6505
|
+
}
|
|
6506
|
+
const identity = channel.identity ?? config.defaults?.identity;
|
|
6507
|
+
if (!identity) {
|
|
6508
|
+
diagnostics.error(
|
|
6509
|
+
"config.channel.identity.required",
|
|
6510
|
+
`channel.${name}: declare identity or configure defaults.identity`
|
|
6511
|
+
);
|
|
6512
|
+
} else if (!identityNames.has(identity)) {
|
|
6513
|
+
diagnostics.error(
|
|
6514
|
+
"config.channel.identity.unknown",
|
|
6515
|
+
`channel.${name}: references unknown identity '${identity}'`
|
|
6516
|
+
);
|
|
6517
|
+
}
|
|
6518
|
+
}
|
|
5689
6519
|
}
|
|
5690
6520
|
function collectProviderCapabilities(config, providers, diagnostics) {
|
|
5691
6521
|
for (const providerName of providers) {
|
|
@@ -5698,6 +6528,80 @@ function collectProviderCapabilities(config, providers, diagnostics) {
|
|
|
5698
6528
|
continue;
|
|
5699
6529
|
}
|
|
5700
6530
|
const caps = def.capabilities;
|
|
6531
|
+
for (const [name, identity] of Object.entries(config.identities ?? {})) {
|
|
6532
|
+
if (identity.provider && identity.provider !== providerName) continue;
|
|
6533
|
+
if (!isSupported(caps, "identity")) {
|
|
6534
|
+
diagnostics.error(
|
|
6535
|
+
`${providerName}.identity.unsupported`,
|
|
6536
|
+
`${caps.identity.reason}. ${caps.identity.remediation ?? ""}`.trim(),
|
|
6537
|
+
{ type: "identity", name, provider: providerName }
|
|
6538
|
+
);
|
|
6539
|
+
}
|
|
6540
|
+
}
|
|
6541
|
+
for (const [name, channel] of Object.entries(config.channels ?? {})) {
|
|
6542
|
+
if (channel.provider && channel.provider !== providerName) continue;
|
|
6543
|
+
if (!isSupported(caps, "channel")) {
|
|
6544
|
+
diagnostics.error(
|
|
6545
|
+
`${providerName}.channel.unsupported`,
|
|
6546
|
+
`${caps.channel.reason}. ${caps.channel.remediation ?? ""}`.trim(),
|
|
6547
|
+
{ type: "channel", name, provider: providerName }
|
|
6548
|
+
);
|
|
6549
|
+
continue;
|
|
6550
|
+
}
|
|
6551
|
+
if (providerName === "qoder") {
|
|
6552
|
+
const agent = config.agents?.[channel.agent];
|
|
6553
|
+
if (agent?.provider && agent.provider !== providerName) {
|
|
6554
|
+
diagnostics.error(
|
|
6555
|
+
"config.channel.agent.provider_mismatch",
|
|
6556
|
+
`channel.${name}: agent '${channel.agent}' is pinned to provider '${agent.provider}'.`,
|
|
6557
|
+
{ type: "channel", name, provider: providerName }
|
|
6558
|
+
);
|
|
6559
|
+
}
|
|
6560
|
+
const identityName = channel.identity ?? config.defaults?.identity;
|
|
6561
|
+
const identity = identityName ? config.identities?.[identityName] : void 0;
|
|
6562
|
+
if (identity?.provider && identity.provider !== providerName) {
|
|
6563
|
+
diagnostics.error(
|
|
6564
|
+
"config.channel.identity.provider_mismatch",
|
|
6565
|
+
`channel.${name}: identity '${identityName}' is pinned to provider '${identity.provider}'.`,
|
|
6566
|
+
{ type: "channel", name, provider: providerName }
|
|
6567
|
+
);
|
|
6568
|
+
}
|
|
6569
|
+
if (agent && agent.delivery?.qoder?.type !== "forward") {
|
|
6570
|
+
diagnostics.error(
|
|
6571
|
+
"qoder.channel.forward_template.required",
|
|
6572
|
+
`channel.${name}: Qoder Channels require agent '${channel.agent}' to use delivery.qoder.type: forward.`,
|
|
6573
|
+
{ type: "channel", name, provider: providerName }
|
|
6574
|
+
);
|
|
6575
|
+
}
|
|
6576
|
+
const requiredCredentials = {
|
|
6577
|
+
dingtalk: ["client_id", "client_secret"],
|
|
6578
|
+
feishu: ["app_id", "app_secret"],
|
|
6579
|
+
wecom: ["bot_id", "secret"]
|
|
6580
|
+
};
|
|
6581
|
+
if (channel.type === "wechat") {
|
|
6582
|
+
diagnostics.error(
|
|
6583
|
+
"qoder.channel.wechat.credentials.unsupported",
|
|
6584
|
+
`channel.${name}: personal WeChat supports QR binding only; credential-based apply is unavailable.`,
|
|
6585
|
+
{ type: "channel", name, provider: providerName }
|
|
6586
|
+
);
|
|
6587
|
+
} else if (!requiredCredentials[channel.type]) {
|
|
6588
|
+
diagnostics.error(
|
|
6589
|
+
"qoder.channel.type.unsupported",
|
|
6590
|
+
`channel.${name}: unsupported Qoder channel type '${channel.type}'.`,
|
|
6591
|
+
{ type: "channel", name, provider: providerName }
|
|
6592
|
+
);
|
|
6593
|
+
} else {
|
|
6594
|
+
const missing = requiredCredentials[channel.type].filter((key) => !channel.credentials?.[key]);
|
|
6595
|
+
if (missing.length) {
|
|
6596
|
+
diagnostics.error(
|
|
6597
|
+
"qoder.channel.credentials.required",
|
|
6598
|
+
`channel.${name}: '${channel.type}' requires credentials: ${missing.join(", ")}.`,
|
|
6599
|
+
{ type: "channel", name, provider: providerName }
|
|
6600
|
+
);
|
|
6601
|
+
}
|
|
6602
|
+
}
|
|
6603
|
+
}
|
|
6604
|
+
}
|
|
5701
6605
|
for (const [name, agent] of Object.entries(config.agents ?? {})) {
|
|
5702
6606
|
if (agent.provider && agent.provider !== providerName) continue;
|
|
5703
6607
|
const delivery = agent.delivery?.[providerName]?.type ?? "managed";
|
|
@@ -5774,6 +6678,14 @@ function collectProviderCapabilities(config, providers, diagnostics) {
|
|
|
5774
6678
|
}
|
|
5775
6679
|
}
|
|
5776
6680
|
for (const [name, deployment] of Object.entries(config.deployments ?? {})) {
|
|
6681
|
+
if (deployment.provider && deployment.provider !== providerName) continue;
|
|
6682
|
+
if (deployment.environment_variables !== void 0) {
|
|
6683
|
+
diagnostics.error(
|
|
6684
|
+
`${providerName}.deployment.environment_variables.unsupported`,
|
|
6685
|
+
`deployment.${name}: environment_variables is supported only by Qoder deployments; remove it or pin this deployment to the qoder provider.`,
|
|
6686
|
+
{ type: "deployment", name, provider: providerName }
|
|
6687
|
+
);
|
|
6688
|
+
}
|
|
5777
6689
|
if (deployment.tunnel && (!deployment.provider || deployment.provider === providerName)) {
|
|
5778
6690
|
diagnostics.error(
|
|
5779
6691
|
`${providerName}.deployment.tunnel.unsupported`,
|
|
@@ -5911,6 +6823,13 @@ function buildDependencyGraph(config, targetProviders) {
|
|
|
5911
6823
|
addNode({ type: "file", name, provider });
|
|
5912
6824
|
}
|
|
5913
6825
|
}
|
|
6826
|
+
if (config.identities && isSupported(caps, "identity")) {
|
|
6827
|
+
for (const name of Object.keys(config.identities)) {
|
|
6828
|
+
const decl = config.identities[name];
|
|
6829
|
+
if (decl.provider && decl.provider !== provider) continue;
|
|
6830
|
+
addNode({ type: "identity", name, provider });
|
|
6831
|
+
}
|
|
6832
|
+
}
|
|
5914
6833
|
if (config.agents) {
|
|
5915
6834
|
for (const name of Object.keys(config.agents)) {
|
|
5916
6835
|
const decl = config.agents[name];
|
|
@@ -6002,6 +6921,23 @@ function buildDependencyGraph(config, targetProviders) {
|
|
|
6002
6921
|
}
|
|
6003
6922
|
}
|
|
6004
6923
|
}
|
|
6924
|
+
if (config.channels && isSupported(caps, "channel")) {
|
|
6925
|
+
for (const name of Object.keys(config.channels)) {
|
|
6926
|
+
const decl = config.channels[name];
|
|
6927
|
+
if (decl.provider && decl.provider !== provider) continue;
|
|
6928
|
+
const channelAddr = { type: "channel", name, provider };
|
|
6929
|
+
addNode(channelAddr);
|
|
6930
|
+
const agentDecl = config.agents?.[decl.agent];
|
|
6931
|
+
const agentType = agentDecl ? resolveAgentMaterialization(provider, agentDecl).resourceType : "agent";
|
|
6932
|
+
const agentAddr = { type: agentType, name: decl.agent, provider };
|
|
6933
|
+
if (nodes.has(addressKey(agentAddr))) addEdge(channelAddr, agentAddr);
|
|
6934
|
+
const identityName = decl.identity ?? config.defaults?.identity;
|
|
6935
|
+
if (identityName) {
|
|
6936
|
+
const identityAddr = { type: "identity", name: identityName, provider };
|
|
6937
|
+
if (nodes.has(addressKey(identityAddr))) addEdge(channelAddr, identityAddr);
|
|
6938
|
+
}
|
|
6939
|
+
}
|
|
6940
|
+
}
|
|
6005
6941
|
}
|
|
6006
6942
|
return { nodes, edges };
|
|
6007
6943
|
}
|
|
@@ -6071,9 +7007,28 @@ async function buildPlan(config, state, options = {}) {
|
|
|
6071
7007
|
);
|
|
6072
7008
|
}
|
|
6073
7009
|
}
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
7010
|
+
if (address.type === "identity" && existing) {
|
|
7011
|
+
const identityDecl = config.identities?.[address.name];
|
|
7012
|
+
if (existing.externally_managed && identityDecl && !identityDecl.identity_id) {
|
|
7013
|
+
diagnostics.error(
|
|
7014
|
+
"plan.identity.ownership_transition",
|
|
7015
|
+
`identity.${address.name} is recorded as an external reference (${existing.remote_id ?? "unknown id"}); replacing identity_id with a managed declaration would modify and eventually delete an Identity this project does not own. Restore identity_id or release the state reference first.`,
|
|
7016
|
+
address
|
|
7017
|
+
);
|
|
7018
|
+
stateIndex.delete(key);
|
|
7019
|
+
continue;
|
|
7020
|
+
}
|
|
7021
|
+
if (!existing.externally_managed && existing.remote_id && identityDecl?.identity_id && identityDecl.identity_id !== existing.remote_id) {
|
|
7022
|
+
diagnostics.warning(
|
|
7023
|
+
"plan.identity.ownership_orphan",
|
|
7024
|
+
`identity.${address.name}: switching to external reference '${identityDecl.identity_id}' orphans the previously managed Identity '${existing.remote_id}'.`,
|
|
7025
|
+
address
|
|
7026
|
+
);
|
|
7027
|
+
}
|
|
7028
|
+
}
|
|
7029
|
+
const isExternalReference2 = address.type === "environment" && Boolean(config.environments?.[address.name]?.environment_id) || address.type === "identity" && Boolean(config.identities?.[address.name]?.identity_id);
|
|
7030
|
+
const createReason = isExternalReference2 ? `Record external ${address.type} reference (no remote mutation)` : "Resource does not exist in state";
|
|
7031
|
+
const updateSuffix = isExternalReference2 ? " \u2014 external reference, no remote mutation" : "";
|
|
6077
7032
|
if (!existing) {
|
|
6078
7033
|
actions.push({
|
|
6079
7034
|
action: "create",
|
|
@@ -6319,7 +7274,9 @@ var IMPORTABLE_RESOURCE_TYPES = /* @__PURE__ */ new Set([
|
|
|
6319
7274
|
"memory_store",
|
|
6320
7275
|
"skill",
|
|
6321
7276
|
"agent",
|
|
6322
|
-
"template"
|
|
7277
|
+
"template",
|
|
7278
|
+
"identity",
|
|
7279
|
+
"channel"
|
|
6323
7280
|
]);
|
|
6324
7281
|
async function importResource(ctx, address, remoteId, options = {}) {
|
|
6325
7282
|
if (!IMPORTABLE_RESOURCE_TYPES.has(address.type)) {
|
|
@@ -6482,25 +7439,25 @@ function resolveSyncProvider(config, explicitProvider) {
|
|
|
6482
7439
|
);
|
|
6483
7440
|
}
|
|
6484
7441
|
async function syncProviderResourcesFromEnv(opts) {
|
|
6485
|
-
const
|
|
7442
|
+
const adapter2 = buildProviderFromEnv(opts.provider);
|
|
6486
7443
|
const providers = await providersBlockFromFile(opts.configPath, opts.provider);
|
|
6487
|
-
return assembleSyncedConfig(
|
|
7444
|
+
return assembleSyncedConfig(adapter2, opts.provider, {
|
|
6488
7445
|
types: opts.types,
|
|
6489
7446
|
version: "1",
|
|
6490
7447
|
providers
|
|
6491
7448
|
});
|
|
6492
7449
|
}
|
|
6493
7450
|
async function syncProviderResourcesFromContext(ctx, opts) {
|
|
6494
|
-
const
|
|
7451
|
+
const adapter2 = getRuntimeProvider(ctx, opts.provider);
|
|
6495
7452
|
const providers = await providersBlockFromFile(ctx.configPath ?? opts.configPath, opts.provider);
|
|
6496
|
-
return assembleSyncedConfig(
|
|
7453
|
+
return assembleSyncedConfig(adapter2, opts.provider, {
|
|
6497
7454
|
types: opts.types,
|
|
6498
7455
|
version: ctx.config.version ?? "1",
|
|
6499
7456
|
providers
|
|
6500
7457
|
});
|
|
6501
7458
|
}
|
|
6502
|
-
async function assembleSyncedConfig(
|
|
6503
|
-
if (!
|
|
7459
|
+
async function assembleSyncedConfig(adapter2, provider, opts) {
|
|
7460
|
+
if (!adapter2.exportResources) {
|
|
6504
7461
|
throw new UserError(`Provider '${provider}' does not support sync (no exportResources).`);
|
|
6505
7462
|
}
|
|
6506
7463
|
const types = opts.types ?? ["environment", "vault", "file", "skill", "agent"];
|
|
@@ -6511,7 +7468,7 @@ async function assembleSyncedConfig(adapter, provider, opts) {
|
|
|
6511
7468
|
if (!groupKey) {
|
|
6512
7469
|
throw new UserError(`Resource type '${type}' is not syncable yet.`);
|
|
6513
7470
|
}
|
|
6514
|
-
const exported = await
|
|
7471
|
+
const exported = await adapter2.exportResources(type);
|
|
6515
7472
|
let group = groups[groupKey];
|
|
6516
7473
|
if (!group) {
|
|
6517
7474
|
group = {};
|
|
@@ -6523,8 +7480,8 @@ async function assembleSyncedConfig(adapter, provider, opts) {
|
|
|
6523
7480
|
}
|
|
6524
7481
|
}
|
|
6525
7482
|
let skillFiles;
|
|
6526
|
-
if (types.includes("skill") &&
|
|
6527
|
-
skillFiles = await
|
|
7483
|
+
if (types.includes("skill") && adapter2.downloadAllSkillFiles) {
|
|
7484
|
+
skillFiles = await adapter2.downloadAllSkillFiles();
|
|
6528
7485
|
}
|
|
6529
7486
|
const config = {
|
|
6530
7487
|
version: opts.version ?? "1",
|
|
@@ -6691,6 +7648,12 @@ async function readYaml(path) {
|
|
|
6691
7648
|
}
|
|
6692
7649
|
|
|
6693
7650
|
// src/internal/core/deployment-runtime.ts
|
|
7651
|
+
async function listRemoteDeploymentsForContext(ctx, provider, filter) {
|
|
7652
|
+
const adapter2 = getRuntimeProvider(ctx, provider);
|
|
7653
|
+
if (!adapter2.listDeployments)
|
|
7654
|
+
throw new UserError(`Provider '${provider}' does not support remote deployment listing.`);
|
|
7655
|
+
return adapter2.listDeployments(filter);
|
|
7656
|
+
}
|
|
6694
7657
|
function listDeploymentsForContext(ctx, providerFilter) {
|
|
6695
7658
|
let rows = ctx.state.listResources().filter((resource) => resource.address.type === "deployment");
|
|
6696
7659
|
if (providerFilter) {
|
|
@@ -6709,9 +7672,9 @@ function listDeploymentsForContext(ctx, providerFilter) {
|
|
|
6709
7672
|
};
|
|
6710
7673
|
});
|
|
6711
7674
|
}
|
|
6712
|
-
async function getDeploymentDetailsForContext(ctx, name,
|
|
7675
|
+
async function getDeploymentDetailsForContext(ctx, name, adapter2, resolvedProvider) {
|
|
6713
7676
|
const provider = resolvedProvider ?? resolveDeploymentProvider(name, ctx.config);
|
|
6714
|
-
const effectiveAdapter =
|
|
7677
|
+
const effectiveAdapter = adapter2 ?? getRuntimeProvider(ctx, provider);
|
|
6715
7678
|
const depCtx = buildDeploymentContext(ctx, name, provider);
|
|
6716
7679
|
return {
|
|
6717
7680
|
name,
|
|
@@ -6725,9 +7688,9 @@ async function getDeploymentDetailsForContext(ctx, name, adapter, resolvedProvid
|
|
|
6725
7688
|
info: await effectiveAdapter.getDeployment(depCtx)
|
|
6726
7689
|
};
|
|
6727
7690
|
}
|
|
6728
|
-
async function runDeploymentForContext(ctx, name,
|
|
7691
|
+
async function runDeploymentForContext(ctx, name, adapter2, resolvedProvider) {
|
|
6729
7692
|
const provider = resolvedProvider ?? resolveDeploymentProvider(name, ctx.config);
|
|
6730
|
-
const effectiveAdapter =
|
|
7693
|
+
const effectiveAdapter = adapter2 ?? getRuntimeProvider(ctx, provider);
|
|
6731
7694
|
const depCtx = buildDeploymentContext(ctx, name, provider);
|
|
6732
7695
|
return {
|
|
6733
7696
|
name,
|
|
@@ -6735,6 +7698,14 @@ async function runDeploymentForContext(ctx, name, adapter, resolvedProvider) {
|
|
|
6735
7698
|
result: await effectiveAdapter.runDeployment(depCtx)
|
|
6736
7699
|
};
|
|
6737
7700
|
}
|
|
7701
|
+
async function pauseDeploymentForContext(ctx, name, paused, resolvedProvider) {
|
|
7702
|
+
const provider = resolvedProvider ?? resolveDeploymentProvider(name, ctx.config);
|
|
7703
|
+
const adapter2 = getRuntimeProvider(ctx, provider);
|
|
7704
|
+
const operation = paused ? adapter2.pauseDeployment : adapter2.unpauseDeployment;
|
|
7705
|
+
if (!operation)
|
|
7706
|
+
throw new UserError(`Provider '${provider}' does not support ${paused ? "pausing" : "unpausing"} deployments.`);
|
|
7707
|
+
return operation.call(adapter2, buildDeploymentContext(ctx, name, provider));
|
|
7708
|
+
}
|
|
6738
7709
|
function getDeploymentRuntimeProviderForContext(ctx, name, overrideProvider) {
|
|
6739
7710
|
return resolveDeploymentProvider(name, ctx.config, overrideProvider);
|
|
6740
7711
|
}
|
|
@@ -6774,13 +7745,15 @@ function buildDeploymentContext(ctx, name, provider) {
|
|
|
6774
7745
|
// src/internal/core/destroy-runtime.ts
|
|
6775
7746
|
var destroyOrder = {
|
|
6776
7747
|
deployment: 0,
|
|
7748
|
+
channel: 0,
|
|
6777
7749
|
agent: 1,
|
|
6778
7750
|
template: 1,
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
|
|
7751
|
+
identity: 2,
|
|
7752
|
+
skill: 3,
|
|
7753
|
+
memory_store: 4,
|
|
7754
|
+
vault: 5,
|
|
7755
|
+
file: 6,
|
|
7756
|
+
environment: 7
|
|
6784
7757
|
};
|
|
6785
7758
|
function planDestroyProjectContext(ctx) {
|
|
6786
7759
|
const resources = [...ctx.state.listResources()].sort(
|
|
@@ -6811,7 +7784,7 @@ async function destroyPlannedProjectResources(planned, options = {}) {
|
|
|
6811
7784
|
};
|
|
6812
7785
|
}
|
|
6813
7786
|
async function destroyOneResource(ctx, resource, options) {
|
|
6814
|
-
if (
|
|
7787
|
+
if (isExternalReference(ctx, resource)) {
|
|
6815
7788
|
ctx.state.removeResource(resource.address);
|
|
6816
7789
|
return successResult(resource, "reference_removed");
|
|
6817
7790
|
}
|
|
@@ -6875,8 +7848,15 @@ async function destroyOneResource(ctx, resource, options) {
|
|
|
6875
7848
|
return failureResult(resource, error);
|
|
6876
7849
|
}
|
|
6877
7850
|
}
|
|
6878
|
-
function
|
|
6879
|
-
|
|
7851
|
+
function isExternalReference(ctx, resource) {
|
|
7852
|
+
if (resource.externally_managed) return true;
|
|
7853
|
+
if (resource.address.type === "environment") {
|
|
7854
|
+
return Boolean(ctx.config.environments?.[resource.address.name]?.environment_id);
|
|
7855
|
+
}
|
|
7856
|
+
if (resource.address.type === "identity") {
|
|
7857
|
+
return Boolean(ctx.config.identities?.[resource.address.name]?.identity_id);
|
|
7858
|
+
}
|
|
7859
|
+
return false;
|
|
6880
7860
|
}
|
|
6881
7861
|
function successResult(resource, reason) {
|
|
6882
7862
|
return { resource, status: "success", reason };
|
|
@@ -6916,6 +7896,17 @@ async function deleteRemoteResource(provider, type, id, cascade) {
|
|
|
6916
7896
|
case "deployment":
|
|
6917
7897
|
await provider.deleteDeployment(id);
|
|
6918
7898
|
return;
|
|
7899
|
+
case "identity":
|
|
7900
|
+
if (!provider.deleteIdentity) throw new UserError(`Provider does not support identities`);
|
|
7901
|
+
await provider.deleteIdentity(id);
|
|
7902
|
+
return;
|
|
7903
|
+
case "channel":
|
|
7904
|
+
if (!provider.deleteChannel) throw new UserError(`Provider does not support channels`);
|
|
7905
|
+
await provider.deleteChannel(id);
|
|
7906
|
+
return;
|
|
7907
|
+
case "file":
|
|
7908
|
+
await provider.deleteFile(id);
|
|
7909
|
+
return;
|
|
6919
7910
|
}
|
|
6920
7911
|
}
|
|
6921
7912
|
function isReferencedError(error) {
|
|
@@ -6930,11 +7921,11 @@ async function listProviderModelsForContext(providers, providerFilter) {
|
|
|
6930
7921
|
const targetProviders = providerFilter ? [providerFilter] : Array.from(providers.keys());
|
|
6931
7922
|
const result = [];
|
|
6932
7923
|
for (const name of targetProviders) {
|
|
6933
|
-
const
|
|
6934
|
-
if (!
|
|
7924
|
+
const adapter2 = providers.get(name);
|
|
7925
|
+
if (!adapter2) {
|
|
6935
7926
|
throw new UserError(`Provider '${name}' is not configured.`);
|
|
6936
7927
|
}
|
|
6937
|
-
if (!
|
|
7928
|
+
if (!adapter2.listModels) {
|
|
6938
7929
|
result.push({
|
|
6939
7930
|
provider: name,
|
|
6940
7931
|
supportsDynamicListing: false,
|
|
@@ -6945,7 +7936,7 @@ async function listProviderModelsForContext(providers, providerFilter) {
|
|
|
6945
7936
|
result.push({
|
|
6946
7937
|
provider: name,
|
|
6947
7938
|
supportsDynamicListing: true,
|
|
6948
|
-
models: await
|
|
7939
|
+
models: await adapter2.listModels()
|
|
6949
7940
|
});
|
|
6950
7941
|
}
|
|
6951
7942
|
return result;
|
|
@@ -6960,6 +7951,89 @@ function listProviderDiscovery() {
|
|
|
6960
7951
|
})).sort((a, b) => a.name.localeCompare(b.name));
|
|
6961
7952
|
}
|
|
6962
7953
|
|
|
7954
|
+
// src/internal/core/memory-runtime.ts
|
|
7955
|
+
function adapter(providers, provider) {
|
|
7956
|
+
const value = providers.get(provider);
|
|
7957
|
+
if (!value) throw new UserError(`Provider '${provider}' is not configured.`);
|
|
7958
|
+
return value;
|
|
7959
|
+
}
|
|
7960
|
+
function method(value, name) {
|
|
7961
|
+
const fn = value[name];
|
|
7962
|
+
if (typeof fn !== "function")
|
|
7963
|
+
throw new UserError(`Provider '${value.name}' does not support memory operation '${String(name)}'.`);
|
|
7964
|
+
return fn.bind(value);
|
|
7965
|
+
}
|
|
7966
|
+
function listMemoryStores(providers, provider, options) {
|
|
7967
|
+
const value = adapter(providers, provider);
|
|
7968
|
+
return method(value, "listMemoryStores")(options);
|
|
7969
|
+
}
|
|
7970
|
+
function getMemoryProviderCapabilities(providers, provider) {
|
|
7971
|
+
const value = adapter(providers, provider);
|
|
7972
|
+
if (!value.memoryCapabilities) throw new UserError(`Provider '${provider}' does not support memory stores.`);
|
|
7973
|
+
return value.memoryCapabilities;
|
|
7974
|
+
}
|
|
7975
|
+
async function createMemoryStore(providers, provider, input) {
|
|
7976
|
+
const value = adapter(providers, provider);
|
|
7977
|
+
const created = await method(value, "createMemoryStore")(input.name, {
|
|
7978
|
+
description: input.description ?? "",
|
|
7979
|
+
metadata: input.metadata
|
|
7980
|
+
});
|
|
7981
|
+
if (!created.id) throw new UserError(`Provider '${provider}' returned no memory store id.`);
|
|
7982
|
+
return method(value, "getMemoryStore")(created.id);
|
|
7983
|
+
}
|
|
7984
|
+
function deleteMemoryStore(providers, provider, id) {
|
|
7985
|
+
const value = adapter(providers, provider);
|
|
7986
|
+
return method(value, "deleteMemoryStore")(id);
|
|
7987
|
+
}
|
|
7988
|
+
function getMemoryStore(providers, provider, id) {
|
|
7989
|
+
const value = adapter(providers, provider);
|
|
7990
|
+
return method(value, "getMemoryStore")(id);
|
|
7991
|
+
}
|
|
7992
|
+
function updateMemoryStore(providers, provider, id, input) {
|
|
7993
|
+
const value = adapter(providers, provider);
|
|
7994
|
+
return method(value, "updateMemoryStore")(id, input);
|
|
7995
|
+
}
|
|
7996
|
+
function archiveMemoryStore(providers, provider, id) {
|
|
7997
|
+
const value = adapter(providers, provider);
|
|
7998
|
+
return method(value, "archiveMemoryStore")(id);
|
|
7999
|
+
}
|
|
8000
|
+
function createMemory(providers, provider, storeId, input) {
|
|
8001
|
+
const value = adapter(providers, provider);
|
|
8002
|
+
return method(value, "createMemory")(storeId, input);
|
|
8003
|
+
}
|
|
8004
|
+
function batchCreateMemories(providers, provider, storeId, input) {
|
|
8005
|
+
const value = adapter(providers, provider);
|
|
8006
|
+
return method(value, "batchCreateMemories")(storeId, input);
|
|
8007
|
+
}
|
|
8008
|
+
function listMemories(providers, provider, storeId, options) {
|
|
8009
|
+
const value = adapter(providers, provider);
|
|
8010
|
+
return method(value, "listMemories")(storeId, options);
|
|
8011
|
+
}
|
|
8012
|
+
function getMemory(providers, provider, storeId, memoryId) {
|
|
8013
|
+
const value = adapter(providers, provider);
|
|
8014
|
+
return method(value, "getMemory")(storeId, memoryId);
|
|
8015
|
+
}
|
|
8016
|
+
function updateMemory(providers, provider, storeId, memoryId, input) {
|
|
8017
|
+
const value = adapter(providers, provider);
|
|
8018
|
+
return method(value, "updateMemory")(storeId, memoryId, input);
|
|
8019
|
+
}
|
|
8020
|
+
function deleteMemory(providers, provider, storeId, memoryId, expected) {
|
|
8021
|
+
const value = adapter(providers, provider);
|
|
8022
|
+
return method(value, "deleteMemory")(storeId, memoryId, expected);
|
|
8023
|
+
}
|
|
8024
|
+
function listMemoryVersions(providers, provider, storeId, options) {
|
|
8025
|
+
const value = adapter(providers, provider);
|
|
8026
|
+
return method(value, "listMemoryVersions")(storeId, options);
|
|
8027
|
+
}
|
|
8028
|
+
function getMemoryVersion(providers, provider, storeId, versionId) {
|
|
8029
|
+
const value = adapter(providers, provider);
|
|
8030
|
+
return method(value, "getMemoryVersion")(storeId, versionId);
|
|
8031
|
+
}
|
|
8032
|
+
function redactMemoryVersion(providers, provider, storeId, versionId) {
|
|
8033
|
+
const value = adapter(providers, provider);
|
|
8034
|
+
return method(value, "redactMemoryVersion")(storeId, versionId);
|
|
8035
|
+
}
|
|
8036
|
+
|
|
6963
8037
|
// src/internal/core/agent-builder.ts
|
|
6964
8038
|
function buildAgentDecl(base, input) {
|
|
6965
8039
|
const model = input.model ?? base?.model;
|
|
@@ -7035,11 +8109,17 @@ function buildSessionBindings(agentName, config, provider, state, options = {})
|
|
|
7035
8109
|
}
|
|
7036
8110
|
if (resolveAgentMaterialization(provider, agent).resourceType === "template") {
|
|
7037
8111
|
const templateId = requireRef(state, { type: "template", name: agentName, provider });
|
|
7038
|
-
const
|
|
8112
|
+
const defaultIdentity = config.defaults?.identity;
|
|
8113
|
+
const identityId = options.identityId ?? (defaultIdentity ? requireRef(state, { type: "identity", name: defaultIdentity, provider }) : void 0);
|
|
8114
|
+
if (!identityId) {
|
|
8115
|
+
throw new UserError(
|
|
8116
|
+
`Forward session for '${agentName}' requires an Identity. Configure defaults.identity or pass --identity-id.`
|
|
8117
|
+
);
|
|
8118
|
+
}
|
|
7039
8119
|
return {
|
|
7040
8120
|
delivery: "forward",
|
|
7041
8121
|
template_id: templateId,
|
|
7042
|
-
|
|
8122
|
+
identity_id: identityId,
|
|
7043
8123
|
files: (options.files ?? []).map((file) => ({ file_id: file.fileId, mount_path: file.mountPath })),
|
|
7044
8124
|
title: options.title,
|
|
7045
8125
|
metadata: options.metadata
|
|
@@ -7123,9 +8203,9 @@ async function listCloudAgents(ctx, options = {}) {
|
|
|
7123
8203
|
throw new UserError("Multiple providers configured. Pass `provider` to list cloud agents.");
|
|
7124
8204
|
}
|
|
7125
8205
|
}
|
|
7126
|
-
const
|
|
7127
|
-
if (!
|
|
7128
|
-
return
|
|
8206
|
+
const adapter2 = getRuntimeProvider(ctx, provider);
|
|
8207
|
+
if (!adapter2.listAgents) return [];
|
|
8208
|
+
return adapter2.listAgents({ prefix: options.prefix, limit: options.limit });
|
|
7129
8209
|
}
|
|
7130
8210
|
function resolveSingleProvider(ctx, provider) {
|
|
7131
8211
|
if (provider) return provider;
|
|
@@ -7134,55 +8214,55 @@ function resolveSingleProvider(ctx, provider) {
|
|
|
7134
8214
|
throw new UserError("Multiple providers configured. Pass `provider` to target one.");
|
|
7135
8215
|
}
|
|
7136
8216
|
async function listCloudEnvironments(ctx, options = {}) {
|
|
7137
|
-
const
|
|
8217
|
+
const adapter2 = getRuntimeProvider(
|
|
7138
8218
|
ctx,
|
|
7139
8219
|
resolveSingleProvider(ctx, options.provider)
|
|
7140
8220
|
);
|
|
7141
|
-
if (!
|
|
7142
|
-
return
|
|
8221
|
+
if (!adapter2.listEnvironments) return [];
|
|
8222
|
+
return adapter2.listEnvironments({ limit: options.limit });
|
|
7143
8223
|
}
|
|
7144
8224
|
async function createCloudEnvironment(ctx, name, decl, options = {}) {
|
|
7145
|
-
const
|
|
8225
|
+
const adapter2 = getRuntimeProvider(
|
|
7146
8226
|
ctx,
|
|
7147
8227
|
resolveSingleProvider(ctx, options.provider)
|
|
7148
8228
|
);
|
|
7149
|
-
return
|
|
8229
|
+
return adapter2.createEnvironment(name, decl);
|
|
7150
8230
|
}
|
|
7151
8231
|
async function deleteCloudEnvironment(ctx, id, options = {}) {
|
|
7152
|
-
const
|
|
8232
|
+
const adapter2 = getRuntimeProvider(
|
|
7153
8233
|
ctx,
|
|
7154
8234
|
resolveSingleProvider(ctx, options.provider)
|
|
7155
8235
|
);
|
|
7156
|
-
await
|
|
8236
|
+
await adapter2.deleteEnvironment(id);
|
|
7157
8237
|
}
|
|
7158
8238
|
async function listCloudVaults(ctx, options = {}) {
|
|
7159
|
-
const
|
|
8239
|
+
const adapter2 = getRuntimeProvider(
|
|
7160
8240
|
ctx,
|
|
7161
8241
|
resolveSingleProvider(ctx, options.provider)
|
|
7162
8242
|
);
|
|
7163
|
-
if (!
|
|
7164
|
-
return
|
|
8243
|
+
if (!adapter2.listVaults) return [];
|
|
8244
|
+
return adapter2.listVaults({ limit: options.limit });
|
|
7165
8245
|
}
|
|
7166
8246
|
async function createCloudVault(ctx, name, decl, options = {}) {
|
|
7167
|
-
const
|
|
8247
|
+
const adapter2 = getRuntimeProvider(
|
|
7168
8248
|
ctx,
|
|
7169
8249
|
resolveSingleProvider(ctx, options.provider)
|
|
7170
8250
|
);
|
|
7171
|
-
return
|
|
8251
|
+
return adapter2.createVault(name, decl);
|
|
7172
8252
|
}
|
|
7173
8253
|
async function deleteCloudVault(ctx, id, options = {}) {
|
|
7174
|
-
const
|
|
8254
|
+
const adapter2 = getRuntimeProvider(
|
|
7175
8255
|
ctx,
|
|
7176
8256
|
resolveSingleProvider(ctx, options.provider)
|
|
7177
8257
|
);
|
|
7178
|
-
await
|
|
8258
|
+
await adapter2.deleteVault(id);
|
|
7179
8259
|
}
|
|
7180
8260
|
async function archiveCloudAgent(ctx, id, options = {}) {
|
|
7181
|
-
const
|
|
8261
|
+
const adapter2 = getRuntimeProvider(
|
|
7182
8262
|
ctx,
|
|
7183
8263
|
resolveSingleProvider(ctx, options.provider)
|
|
7184
8264
|
);
|
|
7185
|
-
await
|
|
8265
|
+
await adapter2.deleteAgent(id);
|
|
7186
8266
|
}
|
|
7187
8267
|
function getAgent(ctx, agentId) {
|
|
7188
8268
|
const agent = ctx.config.agents?.[agentId];
|
|
@@ -7469,11 +8549,11 @@ function isTerminalSessionStatus(status) {
|
|
|
7469
8549
|
function resolveSessionRuntime(ctx, target = {}) {
|
|
7470
8550
|
const agentName = resolveAgentName(ctx.config.agents, target.agent);
|
|
7471
8551
|
const provider = resolveSessionProvider(agentName, ctx.config, target.provider);
|
|
7472
|
-
const
|
|
7473
|
-
return { agentName, provider, adapter };
|
|
8552
|
+
const adapter2 = getRuntimeProvider(ctx, provider);
|
|
8553
|
+
return { agentName, provider, adapter: adapter2 };
|
|
7474
8554
|
}
|
|
7475
8555
|
async function createSessionForAgent(ctx, options = {}) {
|
|
7476
|
-
const { agentName, provider, adapter } = resolveSessionRuntime(ctx, options);
|
|
8556
|
+
const { agentName, provider, adapter: adapter2 } = resolveSessionRuntime(ctx, options);
|
|
7477
8557
|
const bindings = buildSessionBindings(agentName, ctx.config, provider, ctx.state, {
|
|
7478
8558
|
identityId: options.identityId,
|
|
7479
8559
|
environment: options.environment,
|
|
@@ -7487,11 +8567,11 @@ async function createSessionForAgent(ctx, options = {}) {
|
|
|
7487
8567
|
title: options.title,
|
|
7488
8568
|
metadata: options.metadata
|
|
7489
8569
|
});
|
|
7490
|
-
const session = await
|
|
8570
|
+
const session = await adapter2.createSession(bindings);
|
|
7491
8571
|
return { agentName, provider, session };
|
|
7492
8572
|
}
|
|
7493
8573
|
async function startSessionRun(ctx, prompt, options = {}) {
|
|
7494
|
-
const { agentName, provider, adapter } = resolveSessionRuntime(ctx, options);
|
|
8574
|
+
const { agentName, provider, adapter: adapter2 } = resolveSessionRuntime(ctx, options);
|
|
7495
8575
|
const bindings = buildSessionBindings(agentName, ctx.config, provider, ctx.state, {
|
|
7496
8576
|
identityId: options.identityId,
|
|
7497
8577
|
environment: options.environment,
|
|
@@ -7505,48 +8585,48 @@ async function startSessionRun(ctx, prompt, options = {}) {
|
|
|
7505
8585
|
title: options.title,
|
|
7506
8586
|
metadata: options.metadata
|
|
7507
8587
|
});
|
|
7508
|
-
const session = await
|
|
8588
|
+
const session = await adapter2.createSession(bindings);
|
|
7509
8589
|
return {
|
|
7510
8590
|
agentName,
|
|
7511
8591
|
provider,
|
|
7512
8592
|
session,
|
|
7513
|
-
events: streamMessageEvents(
|
|
8593
|
+
events: streamMessageEvents(adapter2, session.id, preparePromptForProvider(prompt, bindings.files, provider))
|
|
7514
8594
|
};
|
|
7515
8595
|
}
|
|
7516
|
-
function streamMessageEvents(
|
|
7517
|
-
if (
|
|
7518
|
-
return streamWithResume(
|
|
8596
|
+
function streamMessageEvents(adapter2, sessionId, message) {
|
|
8597
|
+
if (adapter2.eventResume) {
|
|
8598
|
+
return streamWithResume(adapter2, sessionId, message);
|
|
7519
8599
|
}
|
|
7520
|
-
return streamConnectBeforeSend(
|
|
8600
|
+
return streamConnectBeforeSend(adapter2, sessionId, message);
|
|
7521
8601
|
}
|
|
7522
8602
|
async function sendSessionMessageStreaming(ctx, sessionId, message, options = {}) {
|
|
7523
|
-
const
|
|
7524
|
-
return streamMessageEvents(
|
|
8603
|
+
const adapter2 = resolveDirectAdapter(ctx, options.provider);
|
|
8604
|
+
return streamMessageEvents(adapter2, sessionId, message);
|
|
7525
8605
|
}
|
|
7526
8606
|
async function startSessionRunPolling(ctx, prompt, options = {}) {
|
|
7527
8607
|
const run = await createSessionForAgent(ctx, options);
|
|
7528
|
-
const
|
|
8608
|
+
const adapter2 = getRuntimeProvider(ctx, run.provider);
|
|
7529
8609
|
const hintedPrompt = preparePromptForProvider(
|
|
7530
8610
|
prompt,
|
|
7531
8611
|
options.files?.map((f) => ({ mount_path: f.mountPath })),
|
|
7532
8612
|
run.provider
|
|
7533
8613
|
);
|
|
7534
|
-
const collected = await sendSessionMessageAndCollectEvents(
|
|
8614
|
+
const collected = await sendSessionMessageAndCollectEvents(adapter2, run.session.id, hintedPrompt, options);
|
|
7535
8615
|
return { ...run, ...collected };
|
|
7536
8616
|
}
|
|
7537
|
-
async function sendSessionMessageAndCollectEvents(
|
|
7538
|
-
const eventId = await
|
|
7539
|
-
return collectEventsUntilTerminal(
|
|
7540
|
-
afterId:
|
|
8617
|
+
async function sendSessionMessageAndCollectEvents(adapter2, sessionId, message, options = {}) {
|
|
8618
|
+
const eventId = await adapter2.sendSessionMessage(sessionId, message);
|
|
8619
|
+
return collectEventsUntilTerminal(adapter2, sessionId, {
|
|
8620
|
+
afterId: adapter2.eventResume ? eventId : void 0,
|
|
7541
8621
|
pollIntervalMs: options.pollIntervalMs,
|
|
7542
8622
|
pollTimeoutMs: options.pollTimeoutMs
|
|
7543
8623
|
}).then((result) => ({ eventId, ...result }));
|
|
7544
8624
|
}
|
|
7545
8625
|
async function sendSessionMessagePolling(ctx, sessionId, message, options = {}) {
|
|
7546
|
-
const
|
|
7547
|
-
return sendSessionMessageAndCollectEvents(
|
|
8626
|
+
const adapter2 = resolveDirectAdapter(ctx, options.provider);
|
|
8627
|
+
return sendSessionMessageAndCollectEvents(adapter2, sessionId, message, options);
|
|
7548
8628
|
}
|
|
7549
|
-
async function collectEventsUntilTerminal(
|
|
8629
|
+
async function collectEventsUntilTerminal(adapter2, sessionId, options = {}) {
|
|
7550
8630
|
const start = Date.now();
|
|
7551
8631
|
const pollIntervalMs = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
|
7552
8632
|
const pollTimeoutMs = options.pollTimeoutMs ?? DEFAULT_POLL_TIMEOUT_MS;
|
|
@@ -7555,7 +8635,7 @@ async function collectEventsUntilTerminal(adapter, sessionId, options = {}) {
|
|
|
7555
8635
|
if (options.afterId) {
|
|
7556
8636
|
while (true) {
|
|
7557
8637
|
assertNotTimedOut(start, pollTimeoutMs);
|
|
7558
|
-
result = await
|
|
8638
|
+
result = await adapter2.listSessionEvents(sessionId, {
|
|
7559
8639
|
limit: 100,
|
|
7560
8640
|
after_id: options.afterId
|
|
7561
8641
|
});
|
|
@@ -7571,14 +8651,14 @@ async function collectEventsUntilTerminal(adapter, sessionId, options = {}) {
|
|
|
7571
8651
|
} else {
|
|
7572
8652
|
while (true) {
|
|
7573
8653
|
assertNotTimedOut(start, pollTimeoutMs);
|
|
7574
|
-
const session = await
|
|
8654
|
+
const session = await adapter2.getSession(sessionId);
|
|
7575
8655
|
if (isTerminalSessionStatus(session.status)) {
|
|
7576
8656
|
terminalStatus = session.status;
|
|
7577
8657
|
break;
|
|
7578
8658
|
}
|
|
7579
8659
|
await delay(pollIntervalMs);
|
|
7580
8660
|
}
|
|
7581
|
-
result = await
|
|
8661
|
+
result = await adapter2.listSessionEvents(sessionId, { limit: 100 });
|
|
7582
8662
|
}
|
|
7583
8663
|
return { terminalStatus, result };
|
|
7584
8664
|
}
|
|
@@ -7613,9 +8693,9 @@ async function listSessionsForProject(ctx, options = {}) {
|
|
|
7613
8693
|
throw new UserError("Multiple providers configured. Use --provider to specify one.");
|
|
7614
8694
|
}
|
|
7615
8695
|
}
|
|
7616
|
-
const
|
|
7617
|
-
const result = await
|
|
7618
|
-
return { provider, adapter, agentId, agentName, result };
|
|
8696
|
+
const adapter2 = getRuntimeProvider(ctx, provider);
|
|
8697
|
+
const result = await adapter2.listSessions(agentId ? { ...options.filter, agent_id: agentId } : options.filter);
|
|
8698
|
+
return { provider, adapter: adapter2, agentId, agentName, result };
|
|
7619
8699
|
}
|
|
7620
8700
|
async function listSessionSummaries(ctx, options = {}) {
|
|
7621
8701
|
const listed = await listSessionsForProject(ctx, options);
|
|
@@ -7653,48 +8733,48 @@ async function listSessionEvents(ctx, sessionId, options = {}) {
|
|
|
7653
8733
|
);
|
|
7654
8734
|
}
|
|
7655
8735
|
async function uploadFile(ctx, content, filename, options = {}) {
|
|
7656
|
-
const
|
|
7657
|
-
const purpose = options.purpose ?? defaultFileUploadPurpose(
|
|
7658
|
-
const info = await
|
|
8736
|
+
const adapter2 = resolveDirectAdapter(ctx, options.provider);
|
|
8737
|
+
const purpose = options.purpose ?? defaultFileUploadPurpose(adapter2.name);
|
|
8738
|
+
const info = await adapter2.uploadFileContent(content, filename, {
|
|
7659
8739
|
mimeType: options.mimeType,
|
|
7660
8740
|
purpose
|
|
7661
8741
|
});
|
|
7662
|
-
return enrichProviderFileInfo(
|
|
8742
|
+
return enrichProviderFileInfo(adapter2.name, info);
|
|
7663
8743
|
}
|
|
7664
8744
|
async function deleteFile(ctx, id, options = {}) {
|
|
7665
8745
|
await resolveDirectAdapter(ctx, options.provider).deleteFile(id);
|
|
7666
8746
|
}
|
|
7667
8747
|
async function getFileInfo(ctx, id, options = {}) {
|
|
7668
|
-
const
|
|
7669
|
-
if (!
|
|
7670
|
-
const info = await
|
|
7671
|
-
return enrichProviderFileInfo(
|
|
8748
|
+
const adapter2 = resolveDirectAdapter(ctx, options.provider);
|
|
8749
|
+
if (!adapter2.getFileInfo) throw new UserError("Provider does not support file metadata lookup");
|
|
8750
|
+
const info = await adapter2.getFileInfo(id);
|
|
8751
|
+
return enrichProviderFileInfo(adapter2.name, info);
|
|
7672
8752
|
}
|
|
7673
8753
|
async function getFileDownloadUrl(ctx, id, options = {}) {
|
|
7674
|
-
const
|
|
7675
|
-
if (!
|
|
7676
|
-
return
|
|
8754
|
+
const adapter2 = resolveDirectAdapter(ctx, options.provider);
|
|
8755
|
+
if (!adapter2.getFileDownloadUrl) throw new UserError("Provider does not support file downloads");
|
|
8756
|
+
return adapter2.getFileDownloadUrl(id);
|
|
7677
8757
|
}
|
|
7678
8758
|
async function listFiles(ctx, options = {}) {
|
|
7679
|
-
const
|
|
7680
|
-
if (!
|
|
7681
|
-
const all = await
|
|
7682
|
-
return all.map((info) => enrichProviderFileInfo(
|
|
8759
|
+
const adapter2 = resolveDirectAdapter(ctx, options.provider);
|
|
8760
|
+
if (!adapter2.listFiles) return [];
|
|
8761
|
+
const all = await adapter2.listFiles();
|
|
8762
|
+
return all.map((info) => enrichProviderFileInfo(adapter2.name, info));
|
|
7683
8763
|
}
|
|
7684
8764
|
async function listSkills(ctx, options = {}) {
|
|
7685
|
-
const
|
|
7686
|
-
if (!
|
|
7687
|
-
return
|
|
8765
|
+
const adapter2 = resolveDirectAdapter(ctx, options.provider);
|
|
8766
|
+
if (!adapter2.listSkills) return [];
|
|
8767
|
+
return adapter2.listSkills(options.source);
|
|
7688
8768
|
}
|
|
7689
8769
|
async function getSkillInfo(ctx, id, options = {}) {
|
|
7690
|
-
const
|
|
7691
|
-
if (!
|
|
7692
|
-
return
|
|
8770
|
+
const adapter2 = resolveDirectAdapter(ctx, options.provider);
|
|
8771
|
+
if (!adapter2.getSkillInfo) throw new UserError("Provider does not support skill metadata lookup");
|
|
8772
|
+
return adapter2.getSkillInfo(id);
|
|
7693
8773
|
}
|
|
7694
8774
|
async function createSkillFromFileId(ctx, fileId, options = {}) {
|
|
7695
|
-
const
|
|
7696
|
-
if (!
|
|
7697
|
-
return
|
|
8775
|
+
const adapter2 = resolveDirectAdapter(ctx, options.provider);
|
|
8776
|
+
if (!adapter2.createSkillFromFileId) throw new UserError("Provider does not support skill creation");
|
|
8777
|
+
return adapter2.createSkillFromFileId(fileId);
|
|
7698
8778
|
}
|
|
7699
8779
|
async function deleteSkill(ctx, id, options = {}) {
|
|
7700
8780
|
await resolveDirectAdapter(ctx, options.provider).deleteSkill(id);
|
|
@@ -7722,19 +8802,19 @@ function buildAgentNameByRemoteId(ctx, provider) {
|
|
|
7722
8802
|
}
|
|
7723
8803
|
return names;
|
|
7724
8804
|
}
|
|
7725
|
-
async function* streamWithResume(
|
|
7726
|
-
const eventId = await
|
|
7727
|
-
yield*
|
|
8805
|
+
async function* streamWithResume(adapter2, sessionId, message) {
|
|
8806
|
+
const eventId = await adapter2.sendSessionMessage(sessionId, message);
|
|
8807
|
+
yield* adapter2.streamSessionEvents(sessionId, eventId ? { after_id: eventId } : void 0);
|
|
7728
8808
|
}
|
|
7729
|
-
async function* streamConnectBeforeSend(
|
|
7730
|
-
const iterator =
|
|
8809
|
+
async function* streamConnectBeforeSend(adapter2, sessionId, message) {
|
|
8810
|
+
const iterator = adapter2.streamSessionEvents(sessionId)[Symbol.asyncIterator]();
|
|
7731
8811
|
let sent = false;
|
|
7732
8812
|
try {
|
|
7733
8813
|
while (true) {
|
|
7734
8814
|
const next = iterator.next();
|
|
7735
8815
|
if (!sent) {
|
|
7736
8816
|
sent = true;
|
|
7737
|
-
await
|
|
8817
|
+
await adapter2.sendSessionMessage(sessionId, message);
|
|
7738
8818
|
}
|
|
7739
8819
|
const item = await next;
|
|
7740
8820
|
if (item.done) return;
|
|
@@ -7979,11 +9059,11 @@ var StateManager = class _StateManager {
|
|
|
7979
9059
|
listResources() {
|
|
7980
9060
|
return [...this.state.resources];
|
|
7981
9061
|
}
|
|
7982
|
-
findResource(
|
|
9062
|
+
findResource(query2) {
|
|
7983
9063
|
return this.state.resources.find((resource) => {
|
|
7984
|
-
const matchType = resource.address.type ===
|
|
7985
|
-
const matchName = resource.address.name ===
|
|
7986
|
-
const matchProvider = !
|
|
9064
|
+
const matchType = resource.address.type === query2.type;
|
|
9065
|
+
const matchName = resource.address.name === query2.name;
|
|
9066
|
+
const matchProvider = !query2.provider || resource.address.provider === query2.provider;
|
|
7987
9067
|
return matchType && matchName && matchProvider;
|
|
7988
9068
|
});
|
|
7989
9069
|
}
|
|
@@ -8066,11 +9146,11 @@ var InMemoryStateManager = class _InMemoryStateManager {
|
|
|
8066
9146
|
listResources() {
|
|
8067
9147
|
return [...this.state.resources];
|
|
8068
9148
|
}
|
|
8069
|
-
findResource(
|
|
9149
|
+
findResource(query2) {
|
|
8070
9150
|
return this.state.resources.find((resource) => {
|
|
8071
|
-
const matchType = resource.address.type ===
|
|
8072
|
-
const matchName = resource.address.name ===
|
|
8073
|
-
const matchProvider = !
|
|
9151
|
+
const matchType = resource.address.type === query2.type;
|
|
9152
|
+
const matchName = resource.address.name === query2.name;
|
|
9153
|
+
const matchProvider = !query2.provider || resource.address.provider === query2.provider;
|
|
8074
9154
|
return matchType && matchName && matchProvider;
|
|
8075
9155
|
});
|
|
8076
9156
|
}
|
|
@@ -8117,7 +9197,9 @@ var ResourceTypeSchema = z6.enum([
|
|
|
8117
9197
|
"agent",
|
|
8118
9198
|
"template",
|
|
8119
9199
|
"deployment",
|
|
8120
|
-
"file"
|
|
9200
|
+
"file",
|
|
9201
|
+
"identity",
|
|
9202
|
+
"channel"
|
|
8121
9203
|
]);
|
|
8122
9204
|
var ResourceAddressSchema = z6.object({
|
|
8123
9205
|
type: ResourceTypeSchema,
|
|
@@ -8408,13 +9490,17 @@ export {
|
|
|
8408
9490
|
UserError,
|
|
8409
9491
|
applyProviderConfigToEnv,
|
|
8410
9492
|
archiveCloudAgent,
|
|
9493
|
+
archiveMemoryStore,
|
|
8411
9494
|
areRuntimeCredentialsReady,
|
|
9495
|
+
batchCreateMemories,
|
|
8412
9496
|
bootstrapRuntimeCredentials,
|
|
8413
9497
|
bootstrapRuntimeCredentialsSync,
|
|
8414
9498
|
buildAgentDecl,
|
|
8415
9499
|
collectConfigReferences,
|
|
8416
9500
|
createCloudEnvironment,
|
|
8417
9501
|
createCloudVault,
|
|
9502
|
+
createMemory,
|
|
9503
|
+
createMemoryStore,
|
|
8418
9504
|
createProjectRuntime,
|
|
8419
9505
|
createSessionForAgent,
|
|
8420
9506
|
createSkillFromFileId,
|
|
@@ -8422,6 +9508,8 @@ export {
|
|
|
8422
9508
|
deleteCloudEnvironment,
|
|
8423
9509
|
deleteCloudVault,
|
|
8424
9510
|
deleteFile,
|
|
9511
|
+
deleteMemory,
|
|
9512
|
+
deleteMemoryStore,
|
|
8425
9513
|
deleteSession,
|
|
8426
9514
|
deleteSkill,
|
|
8427
9515
|
destroyPlannedProjectResources,
|
|
@@ -8432,6 +9520,10 @@ export {
|
|
|
8432
9520
|
getDeploymentRuntimeProviderForContext,
|
|
8433
9521
|
getFileDownloadUrl,
|
|
8434
9522
|
getFileInfo,
|
|
9523
|
+
getMemory,
|
|
9524
|
+
getMemoryProviderCapabilities,
|
|
9525
|
+
getMemoryStore,
|
|
9526
|
+
getMemoryVersion,
|
|
8435
9527
|
getSession,
|
|
8436
9528
|
getSkillInfo,
|
|
8437
9529
|
importResource,
|
|
@@ -8442,8 +9534,12 @@ export {
|
|
|
8442
9534
|
listCloudVaults,
|
|
8443
9535
|
listDeploymentsForContext,
|
|
8444
9536
|
listFiles,
|
|
9537
|
+
listMemories,
|
|
9538
|
+
listMemoryStores,
|
|
9539
|
+
listMemoryVersions,
|
|
8445
9540
|
listProviderModelsForContext,
|
|
8446
9541
|
listProviderNames,
|
|
9542
|
+
listRemoteDeploymentsForContext,
|
|
8447
9543
|
listSessionEvents,
|
|
8448
9544
|
listSessionSummaries,
|
|
8449
9545
|
listSkills,
|
|
@@ -8452,12 +9548,14 @@ export {
|
|
|
8452
9548
|
loadProviderConfigIntoEnvSync,
|
|
8453
9549
|
migrateConfig,
|
|
8454
9550
|
parseStateAddress,
|
|
9551
|
+
pauseDeploymentForContext,
|
|
8455
9552
|
planDestroyProjectContext,
|
|
8456
9553
|
planProjectContext,
|
|
8457
9554
|
preparePromptForProvider,
|
|
8458
9555
|
prependFileHint,
|
|
8459
9556
|
providerConfigPath,
|
|
8460
9557
|
readProjectRuntime,
|
|
9558
|
+
redactMemoryVersion,
|
|
8461
9559
|
resolveActiveProvider,
|
|
8462
9560
|
resolveProjectConfig,
|
|
8463
9561
|
resolveProjectConfigFromObject,
|
|
@@ -8475,6 +9573,8 @@ export {
|
|
|
8475
9573
|
syncProjectResourcesWithStateBackend,
|
|
8476
9574
|
syncProviderResourcesFromContext,
|
|
8477
9575
|
syncProviderResourcesFromEnv,
|
|
9576
|
+
updateMemory,
|
|
9577
|
+
updateMemoryStore,
|
|
8478
9578
|
uploadFile,
|
|
8479
9579
|
validateProjectConfig,
|
|
8480
9580
|
writeProjectRuntime
|