@pmate/cli 0.20.7 → 0.20.9
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.js +34 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19429,14 +19429,13 @@ var AgentCommandHandler = class {
|
|
|
19429
19429
|
return;
|
|
19430
19430
|
}
|
|
19431
19431
|
case "list": {
|
|
19432
|
-
const
|
|
19433
|
-
const response = await this.request(
|
|
19432
|
+
const items = args.namespace ? (await this.request(
|
|
19434
19433
|
baseUrl,
|
|
19435
19434
|
token,
|
|
19436
19435
|
"GET",
|
|
19437
|
-
`/agents
|
|
19438
|
-
);
|
|
19439
|
-
this.renderList(
|
|
19436
|
+
`/agents?namespace=${encodeURIComponent(args.namespace)}`
|
|
19437
|
+
)).items : await this.listAgentsAcrossNamespaces(baseUrl, token);
|
|
19438
|
+
this.renderList(items, args.json);
|
|
19440
19439
|
return;
|
|
19441
19440
|
}
|
|
19442
19441
|
case "get":
|
|
@@ -19568,6 +19567,35 @@ var AgentCommandHandler = class {
|
|
|
19568
19567
|
}
|
|
19569
19568
|
return payload.data;
|
|
19570
19569
|
}
|
|
19570
|
+
async listAgentsAcrossNamespaces(baseUrl, token) {
|
|
19571
|
+
const namespacesResponse = await this.request(
|
|
19572
|
+
baseUrl,
|
|
19573
|
+
token,
|
|
19574
|
+
"GET",
|
|
19575
|
+
"/agents/namespaces"
|
|
19576
|
+
);
|
|
19577
|
+
const namespaces = namespacesResponse.items.map((item) => item.namespace?.trim()).filter((value) => Boolean(value));
|
|
19578
|
+
if (namespaces.length === 0) {
|
|
19579
|
+
return [];
|
|
19580
|
+
}
|
|
19581
|
+
const listResponses = await Promise.all(
|
|
19582
|
+
namespaces.map(async (namespace) => {
|
|
19583
|
+
const response = await this.request(
|
|
19584
|
+
baseUrl,
|
|
19585
|
+
token,
|
|
19586
|
+
"GET",
|
|
19587
|
+
`/agents?namespace=${encodeURIComponent(namespace)}`
|
|
19588
|
+
);
|
|
19589
|
+
return response.items;
|
|
19590
|
+
})
|
|
19591
|
+
);
|
|
19592
|
+
const merged = listResponses.flat();
|
|
19593
|
+
const deduped = /* @__PURE__ */ new Map();
|
|
19594
|
+
for (const item of merged) {
|
|
19595
|
+
deduped.set(item.id, item);
|
|
19596
|
+
}
|
|
19597
|
+
return Array.from(deduped.values());
|
|
19598
|
+
}
|
|
19571
19599
|
renderList(items, asJson) {
|
|
19572
19600
|
if (asJson) {
|
|
19573
19601
|
ui.plain(JSON.stringify(items, null, 2));
|
|
@@ -20105,10 +20133,6 @@ var ServiceRuntimeRunner = class {
|
|
|
20105
20133
|
}
|
|
20106
20134
|
}
|
|
20107
20135
|
async log(service, options = {}) {
|
|
20108
|
-
if (service.runtimeType === "rust" || service.runtimeType === "python") {
|
|
20109
|
-
await this.showScriptLogs(service);
|
|
20110
|
-
return;
|
|
20111
|
-
}
|
|
20112
20136
|
const namespace = service.namespace;
|
|
20113
20137
|
const appName = service.name;
|
|
20114
20138
|
const page = await this.fetchLogPage(namespace, appName, {
|
|
@@ -22791,7 +22815,7 @@ var HELP_TEXT = [
|
|
|
22791
22815
|
` ${import_chalk4.default.gray(" update <ns:objectId> --file <path> [--base-url <url>] [--json]")}`,
|
|
22792
22816
|
` ${import_chalk4.default.gray(" rename --from <id> --to <id> --ns <namespace> [--base-url <url>] [--json]")}`,
|
|
22793
22817
|
` ${import_chalk4.default.gray(" delete <ns:objectId> [--base-url <url>] [--json]")}`,
|
|
22794
|
-
` ${import_chalk4.default.gray("
|
|
22818
|
+
` ${import_chalk4.default.gray(" list defaults to all namespaces; create defaults to namespace: pmate; default base URL: https://agent-api.pmate.chat")}`,
|
|
22795
22819
|
` ${import_chalk4.default.cyan("ns")} Manage registered namespaces`,
|
|
22796
22820
|
` ${import_chalk4.default.gray(" list [--chain <chain>] [--base-url <url>] [--json]")}`,
|
|
22797
22821
|
` ${import_chalk4.default.gray(" get <namespace> [--chain <chain>] [--base-url <url>] [--json]")}`,
|