@openma/cli 0.3.0-beta.1 → 0.3.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +346 -57
  2. package/package.json +4 -6
package/dist/index.js CHANGED
@@ -285,13 +285,15 @@ function wrap(open, close) {
285
285
  }
286
286
  function logo() {
287
287
  const lines = [
288
- " \u2584\u2584\u2588\u2588\u2588\u2588\u2584 \u2597\u258C",
289
- " \u2588 \u259F\u2598",
290
- " \u2588 \u259F\u2598",
291
- " \u2588 \u259F\u2598",
292
- " \u2588\u2584\u2584\u2584\u259F\u2598"
288
+ " \u2826 ",
289
+ " \u28F6\u2876\u2806 \u2830\u28B6\u28F6 ",
290
+ " \u28FF\u2847 \u28C0 \u28B8\u28FF ",
291
+ " \u28FF\u2847 \u2809 \u28B8\u28FF ",
292
+ " \u28FF\u2847 \u28B8\u28FF ",
293
+ " \u28FF\u28C7\u2840 \u2880\u28F8\u28FF ",
294
+ " \u2809\u2809\u2801 \u2808\u2809\u2809 "
293
295
  ];
294
- return lines.map((l) => c.cyan(c.bold(l))).join("\n");
296
+ return lines.map((l) => c.brand(c.bold(l))).join("\n");
295
297
  }
296
298
  function header(subtitle, version2) {
297
299
  return `${c.bold("oma bridge")} ${c.dim(`v${version2}`)}
@@ -319,7 +321,11 @@ var init_style = __esm({
319
321
  blue: wrap("34", "39"),
320
322
  magenta: wrap("35", "39"),
321
323
  cyan: wrap("36", "39"),
322
- gray: wrap("90", "39")
324
+ gray: wrap("90", "39"),
325
+ // OMA brand orange (#FF6B50) — sourced from apps/console/public/logo.svg.
326
+ // 24-bit ANSI; terminals without truecolor will silently drop the color
327
+ // (the wrap() noop already covers no-TTY / NO_COLOR).
328
+ brand: wrap("38;2;255;107;80", "39")
323
329
  };
324
330
  sym = {
325
331
  ok: () => c.green("\u2713"),
@@ -19308,6 +19314,24 @@ function flag(args, name) {
19308
19314
  }
19309
19315
  return void 0;
19310
19316
  }
19317
+ function readContentArg(args) {
19318
+ const inline = flag(args, "--content");
19319
+ const fromFile = flag(args, "--from-file");
19320
+ if (inline !== void 0 && fromFile !== void 0) {
19321
+ console.error("Pass either --content or --from-file, not both.");
19322
+ process.exit(1);
19323
+ }
19324
+ if (inline !== void 0) return inline;
19325
+ if (fromFile !== void 0) {
19326
+ if (fromFile === "-") {
19327
+ const fs2 = __require("fs");
19328
+ return fs2.readFileSync(0, "utf8");
19329
+ }
19330
+ const fs = __require("fs");
19331
+ return fs.readFileSync(fromFile, "utf8");
19332
+ }
19333
+ return void 0;
19334
+ }
19311
19335
  function table(rows) {
19312
19336
  if (!rows.length) return;
19313
19337
  const widths = rows[0].map((_, i) => Math.max(...rows.map((r) => (r[i] || "").length)));
@@ -21001,56 +21025,329 @@ Expires in ${r.expiresInDays} days.`);
21001
21025
  console.log(`Unpublished: ${args[0]}`);
21002
21026
  }
21003
21027
  },
21004
- // Memory
21028
+ // Memory stores (Anthropic Managed Agents Memory contract)
21005
21029
  {
21006
21030
  group: "Memory",
21007
- match: ["memory", "reconcile"],
21008
- usage: "oma memory reconcile [--store <id>] [--limit N] [--all]",
21009
- desc: "Re-embed memories whose Vectorize sync is stale (vector_synced_at IS NULL).",
21010
- http: "POST /v1/memory_stores/_reconcile {store_id?, limit?}",
21031
+ match: ["memory", "stores", "create"],
21032
+ needsArg: true,
21033
+ usage: "oma memory stores create <name> [--description <d>]",
21034
+ desc: "Create a memory store",
21035
+ http: "POST /v1/memory_stores {name, description?}",
21011
21036
  async run(config2, args) {
21012
- const storeId = flag(args, "--store");
21013
- const limitStr = flag(args, "--limit");
21014
- const all = args.includes("--all");
21015
- const limit = limitStr ? Number(limitStr) : 200;
21016
- if (!storeId && !all) {
21017
- console.error("Specify either --store <id> or --all (drains all stores in the tenant).");
21037
+ const name = args.find((a) => !a.startsWith("--"));
21038
+ const description = flag(args, "--description");
21039
+ if (!name) {
21040
+ console.error("Usage: oma memory stores create <name> [--description <d>]");
21018
21041
  process.exit(1);
21019
21042
  }
21020
- let totalScanned = 0, totalFixed = 0, totalFailing = 0;
21021
- const errors = [];
21022
- for (let pass = 1; pass <= 100; pass++) {
21023
- const body = { limit };
21024
- if (storeId) body.store_id = storeId;
21025
- const result = await apiFetch(config2, "/v1/memory_stores/_reconcile", {
21026
- method: "POST",
21027
- body: JSON.stringify(body)
21028
- });
21029
- totalScanned += result.scanned;
21030
- totalFixed += result.fixed;
21031
- totalFailing = result.still_failing;
21032
- for (const e of result.sample_errors) if (errors.length < 10) errors.push(e);
21033
- if (config2.json) {
21034
- console.log(JSON.stringify({ pass, ...result }));
21035
- } else {
21036
- console.log(`pass ${pass}: scanned=${result.scanned} fixed=${result.fixed} failing=${result.still_failing}`);
21037
- }
21038
- if (result.scanned === 0) break;
21039
- if (result.fixed === 0 && result.still_failing > 0) {
21040
- console.error("No progress this pass \u2014 remaining rows keep failing. Stopping.");
21041
- break;
21042
- }
21043
+ const store = await apiFetch(
21044
+ config2,
21045
+ "/v1/memory_stores",
21046
+ { method: "POST", body: JSON.stringify({ name, description }) }
21047
+ );
21048
+ if (config2.json) {
21049
+ console.log(JSON.stringify(store, null, 2));
21050
+ return;
21051
+ }
21052
+ console.log(`Created memory store: ${store.name} (${store.id})`);
21053
+ }
21054
+ },
21055
+ {
21056
+ group: "Memory",
21057
+ match: ["memory", "stores", "list"],
21058
+ usage: "oma memory stores list [--include-archived]",
21059
+ desc: "List memory stores",
21060
+ http: "GET /v1/memory_stores?include_archived=bool",
21061
+ async run(config2, args) {
21062
+ const includeArchived = args.includes("--include-archived");
21063
+ const { data } = await apiFetch(config2, `/v1/memory_stores?include_archived=${includeArchived}`);
21064
+ if (!data.length) {
21065
+ console.log("No memory stores. Create one with: oma memory stores create <name>");
21066
+ return;
21043
21067
  }
21044
21068
  if (config2.json) {
21045
- console.log(JSON.stringify({ totals: { scanned: totalScanned, fixed: totalFixed, failing: totalFailing }, errors }));
21046
- } else {
21047
- console.log(`
21048
- Done. scanned=${totalScanned} fixed=${totalFixed} still_failing=${totalFailing}`);
21049
- if (errors.length) {
21050
- console.log("\nSample errors:");
21051
- for (const e of errors) console.log(` ${e.memory_id}: ${e.error}`);
21052
- }
21069
+ console.log(JSON.stringify(data, null, 2));
21070
+ return;
21071
+ }
21072
+ table([
21073
+ ["NAME", "ID", "ARCHIVED", "CREATED"],
21074
+ ...data.map((s) => [
21075
+ s.name,
21076
+ s.id,
21077
+ s.archived_at ? "yes" : "",
21078
+ new Date(s.created_at).toLocaleDateString()
21079
+ ])
21080
+ ]);
21081
+ }
21082
+ },
21083
+ {
21084
+ group: "Memory",
21085
+ match: ["memory", "stores", "get"],
21086
+ needsArg: true,
21087
+ usage: "oma memory stores get <store-id>",
21088
+ desc: "Get a memory store",
21089
+ http: "GET /v1/memory_stores/:id",
21090
+ async run(config2, args) {
21091
+ const id = args[0];
21092
+ const store = await apiFetch(config2, `/v1/memory_stores/${id}`);
21093
+ console.log(JSON.stringify(store, null, 2));
21094
+ }
21095
+ },
21096
+ {
21097
+ group: "Memory",
21098
+ match: ["memory", "stores", "archive"],
21099
+ needsArg: true,
21100
+ usage: "oma memory stores archive <store-id>",
21101
+ desc: "Archive a memory store (one-way; can't be unarchived)",
21102
+ http: "POST /v1/memory_stores/:id/archive",
21103
+ async run(config2, args) {
21104
+ const id = args[0];
21105
+ const store = await apiFetch(
21106
+ config2,
21107
+ `/v1/memory_stores/${id}/archive`,
21108
+ { method: "POST" }
21109
+ );
21110
+ if (config2.json) {
21111
+ console.log(JSON.stringify(store, null, 2));
21112
+ return;
21113
+ }
21114
+ console.log(`Archived: ${store.name} (${store.id})`);
21115
+ }
21116
+ },
21117
+ {
21118
+ group: "Memory",
21119
+ match: ["memory", "stores", "delete"],
21120
+ needsArg: true,
21121
+ usage: "oma memory stores delete <store-id>",
21122
+ desc: "Delete a memory store + all its memories + versions",
21123
+ http: "DELETE /v1/memory_stores/:id",
21124
+ async run(config2, args) {
21125
+ const id = args[0];
21126
+ await apiFetch(config2, `/v1/memory_stores/${id}`, { method: "DELETE" });
21127
+ console.log(`Deleted memory store: ${id}`);
21128
+ }
21129
+ },
21130
+ // Memories within a store
21131
+ {
21132
+ group: "Memory",
21133
+ match: ["memory", "write"],
21134
+ needsArg: true,
21135
+ usage: "oma memory write <store-id> <path> (--content <c> | --from-file <f>) [--precondition-sha256 <h>]",
21136
+ desc: "Write a memory at a path (creates or updates; max 100KB)",
21137
+ http: "POST /v1/memory_stores/:id/memories {path, content, precondition?}",
21138
+ async run(config2, args) {
21139
+ const storeId = args[0];
21140
+ const path = args[1];
21141
+ const content = readContentArg(args);
21142
+ const sha = flag(args, "--precondition-sha256");
21143
+ if (!storeId || !path || content === void 0) {
21144
+ console.error("Usage: oma memory write <store-id> <path> (--content <c> | --from-file <f>) [--precondition-sha256 <h>]");
21145
+ process.exit(1);
21146
+ }
21147
+ const body = { path, content };
21148
+ if (sha) body.precondition = { type: "content_sha256", content_sha256: sha };
21149
+ const mem = await apiFetch(
21150
+ config2,
21151
+ `/v1/memory_stores/${storeId}/memories`,
21152
+ { method: "POST", body: JSON.stringify(body) }
21153
+ );
21154
+ if (config2.json) {
21155
+ console.log(JSON.stringify(mem, null, 2));
21156
+ return;
21157
+ }
21158
+ console.log(`Wrote memory: ${mem.path} (id=${mem.id}, sha256=${mem.content_sha256.slice(0, 16)}\u2026, size=${mem.size_bytes}B)`);
21159
+ }
21160
+ },
21161
+ {
21162
+ group: "Memory",
21163
+ match: ["memory", "read"],
21164
+ needsArg: true,
21165
+ usage: "oma memory read <store-id> <memory-id>",
21166
+ desc: "Read a memory's full content by ID",
21167
+ http: "GET /v1/memory_stores/:id/memories/:mid",
21168
+ async run(config2, args) {
21169
+ const storeId = args[0];
21170
+ const memId = args[1];
21171
+ if (!storeId || !memId) {
21172
+ console.error("Usage: oma memory read <store-id> <memory-id>");
21173
+ process.exit(1);
21174
+ }
21175
+ const mem = await apiFetch(
21176
+ config2,
21177
+ `/v1/memory_stores/${storeId}/memories/${memId}`
21178
+ );
21179
+ if (config2.json) {
21180
+ console.log(JSON.stringify(mem, null, 2));
21181
+ return;
21182
+ }
21183
+ console.error(`# ${mem.path} (sha256=${mem.content_sha256.slice(0, 16)}\u2026)`);
21184
+ process.stdout.write(mem.content);
21185
+ if (!mem.content.endsWith("\n")) process.stdout.write("\n");
21186
+ }
21187
+ },
21188
+ {
21189
+ group: "Memory",
21190
+ match: ["memory", "ls"],
21191
+ needsArg: true,
21192
+ usage: "oma memory ls <store-id> [--prefix <p>] [--depth N]",
21193
+ desc: "List memories in a store (metadata; no content)",
21194
+ http: "GET /v1/memory_stores/:id/memories?path_prefix=X&depth=N",
21195
+ async run(config2, args) {
21196
+ const storeId = args[0];
21197
+ const prefix = flag(args, "--prefix");
21198
+ const depth = flag(args, "--depth");
21199
+ const qs = new URLSearchParams();
21200
+ if (prefix) qs.set("path_prefix", prefix);
21201
+ if (depth) qs.set("depth", depth);
21202
+ const url2 = `/v1/memory_stores/${storeId}/memories${qs.toString() ? `?${qs}` : ""}`;
21203
+ const { data } = await apiFetch(config2, url2);
21204
+ if (!data.length) {
21205
+ console.log("(empty)");
21206
+ return;
21207
+ }
21208
+ if (config2.json) {
21209
+ console.log(JSON.stringify(data, null, 2));
21210
+ return;
21211
+ }
21212
+ table([
21213
+ ["PATH", "ID", "SIZE", "UPDATED"],
21214
+ ...data.map((m) => [m.path, m.id, `${m.size_bytes}B`, new Date(m.updated_at).toLocaleString()])
21215
+ ]);
21216
+ }
21217
+ },
21218
+ {
21219
+ group: "Memory",
21220
+ match: ["memory", "update"],
21221
+ needsArg: true,
21222
+ usage: "oma memory update <store-id> <memory-id> [--path <p>] [--content <c> | --from-file <f>] [--precondition-sha256 <h>]",
21223
+ desc: "Update a memory (rename and/or change content)",
21224
+ http: "POST /v1/memory_stores/:id/memories/:mid {path?, content?, precondition?}",
21225
+ async run(config2, args) {
21226
+ const storeId = args[0];
21227
+ const memId = args[1];
21228
+ const path = flag(args, "--path");
21229
+ const content = readContentArg(args);
21230
+ const sha = flag(args, "--precondition-sha256");
21231
+ if (!storeId || !memId) {
21232
+ console.error("Usage: oma memory update <store-id> <memory-id> [--path <p>] [--content <c> | --from-file <f>] [--precondition-sha256 <h>]");
21233
+ process.exit(1);
21234
+ }
21235
+ if (path === void 0 && content === void 0) {
21236
+ console.error("Pass at least --path or --content/--from-file.");
21237
+ process.exit(1);
21238
+ }
21239
+ const body = {};
21240
+ if (path !== void 0) body.path = path;
21241
+ if (content !== void 0) body.content = content;
21242
+ if (sha) body.precondition = { type: "content_sha256", content_sha256: sha };
21243
+ const mem = await apiFetch(
21244
+ config2,
21245
+ `/v1/memory_stores/${storeId}/memories/${memId}`,
21246
+ { method: "POST", body: JSON.stringify(body) }
21247
+ );
21248
+ if (config2.json) {
21249
+ console.log(JSON.stringify(mem, null, 2));
21250
+ return;
21251
+ }
21252
+ console.log(`Updated memory: ${mem.path} (sha256=${mem.content_sha256.slice(0, 16)}\u2026)`);
21253
+ }
21254
+ },
21255
+ {
21256
+ group: "Memory",
21257
+ match: ["memory", "rm"],
21258
+ needsArg: true,
21259
+ usage: "oma memory rm <store-id> <memory-id> [--expected-sha256 <h>]",
21260
+ desc: "Delete a memory by ID",
21261
+ http: "DELETE /v1/memory_stores/:id/memories/:mid?expected_content_sha256=...",
21262
+ async run(config2, args) {
21263
+ const storeId = args[0];
21264
+ const memId = args[1];
21265
+ const sha = flag(args, "--expected-sha256");
21266
+ if (!storeId || !memId) {
21267
+ console.error("Usage: oma memory rm <store-id> <memory-id> [--expected-sha256 <h>]");
21268
+ process.exit(1);
21269
+ }
21270
+ const url2 = sha ? `/v1/memory_stores/${storeId}/memories/${memId}?expected_content_sha256=${encodeURIComponent(sha)}` : `/v1/memory_stores/${storeId}/memories/${memId}`;
21271
+ await apiFetch(config2, url2, { method: "DELETE" });
21272
+ console.log(`Deleted memory: ${memId}`);
21273
+ }
21274
+ },
21275
+ // Versions
21276
+ {
21277
+ group: "Memory",
21278
+ match: ["memory", "versions"],
21279
+ needsArg: true,
21280
+ usage: "oma memory versions <store-id> [--memory-id <m>]",
21281
+ desc: "List version history for a store (or filtered to one memory)",
21282
+ http: "GET /v1/memory_stores/:id/memory_versions?memory_id=...",
21283
+ async run(config2, args) {
21284
+ const storeId = args[0];
21285
+ const memId = flag(args, "--memory-id");
21286
+ const url2 = memId ? `/v1/memory_stores/${storeId}/memory_versions?memory_id=${encodeURIComponent(memId)}` : `/v1/memory_stores/${storeId}/memory_versions`;
21287
+ const { data } = await apiFetch(config2, url2);
21288
+ if (!data.length) {
21289
+ console.log("(no versions)");
21290
+ return;
21291
+ }
21292
+ if (config2.json) {
21293
+ console.log(JSON.stringify(data, null, 2));
21294
+ return;
21295
+ }
21296
+ table([
21297
+ ["VERSION", "MEMORY", "OP", "ACTOR", "PATH", "WHEN"],
21298
+ ...data.map((v) => [
21299
+ v.id,
21300
+ v.memory_id,
21301
+ v.operation + (v.redacted ? " (redacted)" : ""),
21302
+ `${v.actor.type}:${v.actor.id}`,
21303
+ v.path ?? "",
21304
+ new Date(v.created_at).toLocaleString()
21305
+ ])
21306
+ ]);
21307
+ }
21308
+ },
21309
+ {
21310
+ group: "Memory",
21311
+ match: ["memory", "version"],
21312
+ needsArg: true,
21313
+ usage: "oma memory version <store-id> <version-id>",
21314
+ desc: "Get a memory version (includes content snapshot for rollback)",
21315
+ http: "GET /v1/memory_stores/:id/memory_versions/:ver_id",
21316
+ async run(config2, args) {
21317
+ const storeId = args[0];
21318
+ const verId = args[1];
21319
+ if (!storeId || !verId) {
21320
+ console.error("Usage: oma memory version <store-id> <version-id>");
21321
+ process.exit(1);
21322
+ }
21323
+ const v = await apiFetch(config2, `/v1/memory_stores/${storeId}/memory_versions/${verId}`);
21324
+ console.log(JSON.stringify(v, null, 2));
21325
+ }
21326
+ },
21327
+ {
21328
+ group: "Memory",
21329
+ match: ["memory", "redact"],
21330
+ needsArg: true,
21331
+ usage: "oma memory redact <store-id> <version-id>",
21332
+ desc: "Redact content of a prior version (refuses live head)",
21333
+ http: "POST /v1/memory_stores/:id/memory_versions/:ver_id/redact",
21334
+ async run(config2, args) {
21335
+ const storeId = args[0];
21336
+ const verId = args[1];
21337
+ if (!storeId || !verId) {
21338
+ console.error("Usage: oma memory redact <store-id> <version-id>");
21339
+ process.exit(1);
21340
+ }
21341
+ const v = await apiFetch(
21342
+ config2,
21343
+ `/v1/memory_stores/${storeId}/memory_versions/${verId}/redact`,
21344
+ { method: "POST" }
21345
+ );
21346
+ if (config2.json) {
21347
+ console.log(JSON.stringify(v, null, 2));
21348
+ return;
21053
21349
  }
21350
+ console.log(`Redacted version: ${v.id}`);
21054
21351
  }
21055
21352
  }
21056
21353
  ];
@@ -21090,14 +21387,6 @@ var extraEndpoints = [
21090
21387
  { group: "Files", http: "GET /v1/files/:id Get file metadata" },
21091
21388
  { group: "Files", http: "GET /v1/files/:id/content Download file content" },
21092
21389
  { group: "Files", http: "DELETE /v1/files/:id Delete file" },
21093
- { group: "Memory", http: "POST /v1/memory_stores Create store {name}" },
21094
- { group: "Memory", http: "GET /v1/memory_stores List stores" },
21095
- { group: "Memory", http: "DELETE /v1/memory_stores/:id Delete store" },
21096
- { group: "Memory", http: "POST /v1/memory_stores/:id/memories Write memory {path, content} (max 100KB)" },
21097
- { group: "Memory", http: "GET /v1/memory_stores/:id/memories?prefix=X List memories (metadata)" },
21098
- { group: "Memory", http: "GET /v1/memory_stores/:id/memories/:mid Get memory with content" },
21099
- { group: "Memory", http: "DELETE /v1/memory_stores/:id/memories/:mid Delete memory" },
21100
- { group: "Memory", http: "POST /v1/memory_stores/_reconcile {store_id?,limit?} Re-embed stale rows" },
21101
21390
  { group: "Evals", http: "POST /v1/evals/runs Create eval run {agent_id, environment_id, tasks:[...]}" },
21102
21391
  { group: "Evals", http: "GET /v1/evals/runs List eval runs" },
21103
21392
  { group: "Evals", http: "GET /v1/evals/runs/:id Get eval run results" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openma/cli",
3
- "version": "0.3.0-beta.1",
3
+ "version": "0.3.0-beta.4",
4
4
  "description": "CLI for the openma managed agents platform",
5
5
  "type": "module",
6
6
  "bin": {
@@ -29,17 +29,15 @@
29
29
  "bugs": {
30
30
  "url": "https://github.com/open-ma/open-managed-agents/issues"
31
31
  },
32
- "dependencies": {
32
+ "devDependencies": {
33
33
  "@agentclientprotocol/sdk": "^0.20.0",
34
34
  "@open-managed-agents/acp-runtime": "workspace:*",
35
- "ws": "^8.18.0"
36
- },
37
- "devDependencies": {
38
35
  "@open-managed-agents/api-types": "workspace:*",
39
36
  "@types/node": "^22.0.0",
40
37
  "@types/ws": "^8.5.0",
41
38
  "esbuild": "^0.25.0",
42
39
  "tsx": "^4.19.0",
43
- "typescript": "^5.8.0"
40
+ "typescript": "^5.8.0",
41
+ "ws": "^8.18.0"
44
42
  }
45
43
  }