@autohq/cli 0.1.101 → 0.1.102
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/agent-bridge.js +7 -6
- package/dist/index.js +80 -122
- package/package.json +1 -1
package/dist/agent-bridge.js
CHANGED
|
@@ -21815,13 +21815,14 @@ var ProjectApplyResourceSchema = external_exports.discriminatedUnion("kind", [
|
|
|
21815
21815
|
ToolApplyDocumentSchema,
|
|
21816
21816
|
SessionApplyDocumentSchema
|
|
21817
21817
|
]);
|
|
21818
|
+
var PROJECT_RESOURCE_KINDS = [
|
|
21819
|
+
RESOURCE_KIND_ENVIRONMENT,
|
|
21820
|
+
RESOURCE_KIND_PROFILE,
|
|
21821
|
+
RESOURCE_KIND_TOOL,
|
|
21822
|
+
RESOURCE_KIND_SESSION
|
|
21823
|
+
];
|
|
21818
21824
|
var ProjectDeleteResourceSchema = external_exports.object({
|
|
21819
|
-
kind: external_exports.enum(
|
|
21820
|
-
RESOURCE_KIND_ENVIRONMENT,
|
|
21821
|
-
RESOURCE_KIND_PROFILE,
|
|
21822
|
-
RESOURCE_KIND_TOOL,
|
|
21823
|
-
RESOURCE_KIND_SESSION
|
|
21824
|
-
]),
|
|
21825
|
+
kind: external_exports.enum(PROJECT_RESOURCE_KINDS),
|
|
21825
21826
|
name: external_exports.string().trim().min(1)
|
|
21826
21827
|
});
|
|
21827
21828
|
var AVATAR_ASSET_CONTENT_TYPES = ["image/png", "image/jpeg"];
|
package/dist/index.js
CHANGED
|
@@ -17628,7 +17628,7 @@ var init_sessions = __esm({
|
|
|
17628
17628
|
});
|
|
17629
17629
|
|
|
17630
17630
|
// ../../packages/schemas/src/project-resources.ts
|
|
17631
|
-
var EnvironmentApplyDocumentSchema, ProfileApplyDocumentSchema, ToolApplyDocumentSchema, SessionApplyDocumentSchema, ProjectApplyResourceSchema, ProjectDeleteResourceSchema, AVATAR_ASSET_CONTENT_TYPES, MAX_AVATAR_ASSET_BASE64_LENGTH, ProjectApplyAssetSchema, ProjectApplyAssetsSchema, ProjectApplyRequestSchema, ProjectApplySystemConfigSchema, ProjectAppliedResourceSchema, ProjectApplyDiagnosticSchema, ProjectApplyResponseSchema;
|
|
17631
|
+
var EnvironmentApplyDocumentSchema, ProfileApplyDocumentSchema, ToolApplyDocumentSchema, SessionApplyDocumentSchema, ProjectApplyResourceSchema, PROJECT_RESOURCE_KINDS, ProjectDeleteResourceSchema, AVATAR_ASSET_CONTENT_TYPES, MAX_AVATAR_ASSET_BASE64_LENGTH, ProjectApplyAssetSchema, ProjectApplyAssetsSchema, ProjectApplyRequestSchema, ProjectApplySystemConfigSchema, ProjectAppliedResourceSchema, ProjectApplyDiagnosticSchema, ProjectApplyResponseSchema;
|
|
17632
17632
|
var init_project_resources = __esm({
|
|
17633
17633
|
"../../packages/schemas/src/project-resources.ts"() {
|
|
17634
17634
|
"use strict";
|
|
@@ -17655,13 +17655,14 @@ var init_project_resources = __esm({
|
|
|
17655
17655
|
ToolApplyDocumentSchema,
|
|
17656
17656
|
SessionApplyDocumentSchema
|
|
17657
17657
|
]);
|
|
17658
|
+
PROJECT_RESOURCE_KINDS = [
|
|
17659
|
+
RESOURCE_KIND_ENVIRONMENT,
|
|
17660
|
+
RESOURCE_KIND_PROFILE,
|
|
17661
|
+
RESOURCE_KIND_TOOL,
|
|
17662
|
+
RESOURCE_KIND_SESSION
|
|
17663
|
+
];
|
|
17658
17664
|
ProjectDeleteResourceSchema = external_exports.object({
|
|
17659
|
-
kind: external_exports.enum(
|
|
17660
|
-
RESOURCE_KIND_ENVIRONMENT,
|
|
17661
|
-
RESOURCE_KIND_PROFILE,
|
|
17662
|
-
RESOURCE_KIND_TOOL,
|
|
17663
|
-
RESOURCE_KIND_SESSION
|
|
17664
|
-
]),
|
|
17665
|
+
kind: external_exports.enum(PROJECT_RESOURCE_KINDS),
|
|
17665
17666
|
name: external_exports.string().trim().min(1)
|
|
17666
17667
|
});
|
|
17667
17668
|
AVATAR_ASSET_CONTENT_TYPES = ["image/png", "image/jpeg"];
|
|
@@ -20373,14 +20374,25 @@ var init_client = __esm({
|
|
|
20373
20374
|
// src/lib/browser.ts
|
|
20374
20375
|
import { spawn } from "child_process";
|
|
20375
20376
|
function openBrowser(url2) {
|
|
20376
|
-
const
|
|
20377
|
-
const args = process.platform === "win32" ? ["/c", "start", "", url2] : [url2];
|
|
20378
|
-
const child = spawn(command, args, {
|
|
20377
|
+
const child = spawn(openCommand(), openArgs(url2), {
|
|
20379
20378
|
detached: true,
|
|
20380
20379
|
stdio: "ignore"
|
|
20381
20380
|
});
|
|
20382
20381
|
child.unref();
|
|
20383
20382
|
}
|
|
20383
|
+
function openCommand() {
|
|
20384
|
+
switch (process.platform) {
|
|
20385
|
+
case "darwin":
|
|
20386
|
+
return "open";
|
|
20387
|
+
case "win32":
|
|
20388
|
+
return "cmd";
|
|
20389
|
+
default:
|
|
20390
|
+
return "xdg-open";
|
|
20391
|
+
}
|
|
20392
|
+
}
|
|
20393
|
+
function openArgs(url2) {
|
|
20394
|
+
return process.platform === "win32" ? ["/c", "start", "", url2] : [url2];
|
|
20395
|
+
}
|
|
20384
20396
|
var init_browser = __esm({
|
|
20385
20397
|
"src/lib/browser.ts"() {
|
|
20386
20398
|
"use strict";
|
|
@@ -21482,6 +21494,48 @@ var init_login = __esm({
|
|
|
21482
21494
|
}
|
|
21483
21495
|
});
|
|
21484
21496
|
|
|
21497
|
+
// src/lib/resources.ts
|
|
21498
|
+
function parseProjectResourceReference(resource) {
|
|
21499
|
+
const [kind, name, extra] = resource.split("/");
|
|
21500
|
+
if (!kind || !name || extra) {
|
|
21501
|
+
throw new Error('Resource must be formatted as "kind/name"');
|
|
21502
|
+
}
|
|
21503
|
+
if (!PROJECT_RESOURCE_KINDS.includes(kind)) {
|
|
21504
|
+
throw new Error(
|
|
21505
|
+
`Unsupported resource kind "${kind}"; supported kinds are ${PROJECT_RESOURCE_KINDS.map((value) => `"${value}"`).join(", ")}`
|
|
21506
|
+
);
|
|
21507
|
+
}
|
|
21508
|
+
return { kind, name };
|
|
21509
|
+
}
|
|
21510
|
+
async function listProjectResources2(client, kind, options) {
|
|
21511
|
+
switch (kind) {
|
|
21512
|
+
case RESOURCE_KIND_ENVIRONMENT:
|
|
21513
|
+
return (await client.listEnvironments(options)).environments;
|
|
21514
|
+
case RESOURCE_KIND_PROFILE:
|
|
21515
|
+
return (await client.listProfiles(options)).profiles;
|
|
21516
|
+
case RESOURCE_KIND_TOOL:
|
|
21517
|
+
return (await client.listTools(options)).tools;
|
|
21518
|
+
case RESOURCE_KIND_SESSION:
|
|
21519
|
+
return (await client.listSessions(options)).sessions;
|
|
21520
|
+
}
|
|
21521
|
+
}
|
|
21522
|
+
async function requireProjectResource(client, reference, options) {
|
|
21523
|
+
const resources = await listProjectResources2(client, reference.kind, options);
|
|
21524
|
+
const resource = resources.find(
|
|
21525
|
+
(item) => item.metadata.name === reference.name
|
|
21526
|
+
);
|
|
21527
|
+
if (!resource) {
|
|
21528
|
+
throw new Error(`Resource not found: ${reference.kind}/${reference.name}`);
|
|
21529
|
+
}
|
|
21530
|
+
return resource;
|
|
21531
|
+
}
|
|
21532
|
+
var init_resources3 = __esm({
|
|
21533
|
+
"src/lib/resources.ts"() {
|
|
21534
|
+
"use strict";
|
|
21535
|
+
init_src();
|
|
21536
|
+
}
|
|
21537
|
+
});
|
|
21538
|
+
|
|
21485
21539
|
// src/commands/edit/actions.ts
|
|
21486
21540
|
import { spawn as spawn2 } from "child_process";
|
|
21487
21541
|
import { mkdtempSync, readFileSync as readFileSync4, rmSync, writeFileSync as writeFileSync3 } from "fs";
|
|
@@ -21489,13 +21543,13 @@ import { tmpdir } from "os";
|
|
|
21489
21543
|
import { join as join5 } from "path";
|
|
21490
21544
|
import { parseAllDocuments as parseYamlDocuments2, stringify as stringify2 } from "yaml";
|
|
21491
21545
|
async function editResource(input) {
|
|
21492
|
-
const reference =
|
|
21546
|
+
const reference = parseProjectResourceReference(input.resource);
|
|
21493
21547
|
const editor = resolveEditor({
|
|
21494
21548
|
canFallbackToVi: input.canFallbackToVi,
|
|
21495
21549
|
env: input.env,
|
|
21496
21550
|
explicit: input.commandOptions.editor
|
|
21497
21551
|
});
|
|
21498
|
-
const current = await
|
|
21552
|
+
const current = await requireProjectResource(input.client, reference, {
|
|
21499
21553
|
apiBaseUrl: input.commandOptions.apiBaseUrl
|
|
21500
21554
|
});
|
|
21501
21555
|
const document = editableResourceDocument(reference.kind, current);
|
|
@@ -21543,18 +21597,6 @@ Edited file retained at ${filePath}`);
|
|
|
21543
21597
|
}
|
|
21544
21598
|
}
|
|
21545
21599
|
}
|
|
21546
|
-
function parseEditableResource(resource) {
|
|
21547
|
-
const [kind, name, extra] = resource.split("/");
|
|
21548
|
-
if (!kind || !name || extra) {
|
|
21549
|
-
throw new Error('Resource must be formatted as "kind/name"');
|
|
21550
|
-
}
|
|
21551
|
-
if (!RESOURCE_KINDS3.includes(kind)) {
|
|
21552
|
-
throw new Error(
|
|
21553
|
-
`Unsupported resource kind "${kind}"; supported kinds are ${RESOURCE_KINDS3.map((value) => `"${value}"`).join(", ")}`
|
|
21554
|
-
);
|
|
21555
|
-
}
|
|
21556
|
-
return { kind, name };
|
|
21557
|
-
}
|
|
21558
21600
|
function resolveEditor(input) {
|
|
21559
21601
|
const explicit = input.explicit?.trim();
|
|
21560
21602
|
if (explicit) {
|
|
@@ -21629,44 +21671,12 @@ function editableResourceDocument(kind, resource) {
|
|
|
21629
21671
|
spec: resource.spec
|
|
21630
21672
|
};
|
|
21631
21673
|
}
|
|
21632
|
-
async function getEditableResource(client, reference, options) {
|
|
21633
|
-
const resources = await listEditableResources(
|
|
21634
|
-
client,
|
|
21635
|
-
reference.kind,
|
|
21636
|
-
options
|
|
21637
|
-
);
|
|
21638
|
-
const resource = resources.find(
|
|
21639
|
-
(item) => item.metadata.name === reference.name
|
|
21640
|
-
);
|
|
21641
|
-
if (!resource) {
|
|
21642
|
-
throw new Error(`Resource not found: ${reference.kind}/${reference.name}`);
|
|
21643
|
-
}
|
|
21644
|
-
return resource;
|
|
21645
|
-
}
|
|
21646
|
-
async function listEditableResources(client, kind, options) {
|
|
21647
|
-
switch (kind) {
|
|
21648
|
-
case RESOURCE_KIND_ENVIRONMENT:
|
|
21649
|
-
return (await client.listEnvironments(options)).environments;
|
|
21650
|
-
case RESOURCE_KIND_PROFILE:
|
|
21651
|
-
return (await client.listProfiles(options)).profiles;
|
|
21652
|
-
case RESOURCE_KIND_TOOL:
|
|
21653
|
-
return (await client.listTools(options)).tools;
|
|
21654
|
-
case RESOURCE_KIND_SESSION:
|
|
21655
|
-
return (await client.listSessions(options)).sessions;
|
|
21656
|
-
}
|
|
21657
|
-
}
|
|
21658
|
-
var RESOURCE_KINDS3;
|
|
21659
21674
|
var init_actions2 = __esm({
|
|
21660
21675
|
"src/commands/edit/actions.ts"() {
|
|
21661
21676
|
"use strict";
|
|
21662
21677
|
init_src();
|
|
21678
|
+
init_resources3();
|
|
21663
21679
|
init_actions();
|
|
21664
|
-
RESOURCE_KINDS3 = [
|
|
21665
|
-
RESOURCE_KIND_ENVIRONMENT,
|
|
21666
|
-
RESOURCE_KIND_PROFILE,
|
|
21667
|
-
RESOURCE_KIND_TOOL,
|
|
21668
|
-
RESOURCE_KIND_SESSION
|
|
21669
|
-
];
|
|
21670
21680
|
}
|
|
21671
21681
|
});
|
|
21672
21682
|
|
|
@@ -21761,7 +21771,7 @@ var init_package = __esm({
|
|
|
21761
21771
|
"package.json"() {
|
|
21762
21772
|
package_default = {
|
|
21763
21773
|
name: "@autohq/cli",
|
|
21764
|
-
version: "0.1.
|
|
21774
|
+
version: "0.1.102",
|
|
21765
21775
|
license: "SEE LICENSE IN README.md",
|
|
21766
21776
|
publishConfig: {
|
|
21767
21777
|
access: "public"
|
|
@@ -29828,15 +29838,9 @@ function registerConnectionCommands(program, context) {
|
|
|
29828
29838
|
}
|
|
29829
29839
|
|
|
29830
29840
|
// src/commands/delete/actions.ts
|
|
29831
|
-
|
|
29832
|
-
var RESOURCE_KINDS = [
|
|
29833
|
-
RESOURCE_KIND_ENVIRONMENT,
|
|
29834
|
-
RESOURCE_KIND_PROFILE,
|
|
29835
|
-
RESOURCE_KIND_TOOL,
|
|
29836
|
-
RESOURCE_KIND_SESSION
|
|
29837
|
-
];
|
|
29841
|
+
init_resources3();
|
|
29838
29842
|
async function deleteResource(input) {
|
|
29839
|
-
const request =
|
|
29843
|
+
const request = parseProjectResourceReference(input.resource);
|
|
29840
29844
|
const response = await input.client.deleteProjectResource(request, {
|
|
29841
29845
|
apiBaseUrl: input.commandOptions.apiBaseUrl
|
|
29842
29846
|
});
|
|
@@ -29848,18 +29852,6 @@ async function deleteResource(input) {
|
|
|
29848
29852
|
`deleted ${response.deleted.kind}/${response.deleted.name}`
|
|
29849
29853
|
);
|
|
29850
29854
|
}
|
|
29851
|
-
function parseDeleteResource(resource) {
|
|
29852
|
-
const [kind, name, extra] = resource.split("/");
|
|
29853
|
-
if (!kind || !name || extra) {
|
|
29854
|
-
throw new Error('Resource must be formatted as "kind/name"');
|
|
29855
|
-
}
|
|
29856
|
-
if (!RESOURCE_KINDS.includes(kind)) {
|
|
29857
|
-
throw new Error(
|
|
29858
|
-
`Unsupported resource kind "${kind}"; supported kinds are ${RESOURCE_KINDS.map((value) => `"${value}"`).join(", ")}`
|
|
29859
|
-
);
|
|
29860
|
-
}
|
|
29861
|
-
return { kind, name };
|
|
29862
|
-
}
|
|
29863
29855
|
|
|
29864
29856
|
// src/commands/delete/commands.ts
|
|
29865
29857
|
function registerDeleteCommands(program, context) {
|
|
@@ -29881,55 +29873,15 @@ function registerDeleteCommands(program, context) {
|
|
|
29881
29873
|
}
|
|
29882
29874
|
|
|
29883
29875
|
// src/commands/describe/actions.ts
|
|
29884
|
-
|
|
29876
|
+
init_resources3();
|
|
29885
29877
|
import { stringify } from "yaml";
|
|
29886
|
-
var RESOURCE_KINDS2 = [
|
|
29887
|
-
RESOURCE_KIND_ENVIRONMENT,
|
|
29888
|
-
RESOURCE_KIND_PROFILE,
|
|
29889
|
-
RESOURCE_KIND_TOOL,
|
|
29890
|
-
RESOURCE_KIND_SESSION
|
|
29891
|
-
];
|
|
29892
29878
|
async function inspectResource(input) {
|
|
29893
|
-
const request =
|
|
29894
|
-
const resource = await
|
|
29879
|
+
const request = parseProjectResourceReference(input.resource);
|
|
29880
|
+
const resource = await requireProjectResource(input.client, request, {
|
|
29895
29881
|
apiBaseUrl: input.commandOptions.apiBaseUrl
|
|
29896
29882
|
});
|
|
29897
29883
|
input.writeOutput(stringify(resource.spec).trimEnd());
|
|
29898
29884
|
}
|
|
29899
|
-
function parseInspectResource(resource) {
|
|
29900
|
-
const [kind, name, extra] = resource.split("/");
|
|
29901
|
-
if (!kind || !name || extra) {
|
|
29902
|
-
throw new Error('Resource must be formatted as "kind/name"');
|
|
29903
|
-
}
|
|
29904
|
-
if (!RESOURCE_KINDS2.includes(kind)) {
|
|
29905
|
-
throw new Error(
|
|
29906
|
-
`Unsupported resource kind "${kind}"; supported kinds are ${RESOURCE_KINDS2.map((value) => `"${value}"`).join(", ")}`
|
|
29907
|
-
);
|
|
29908
|
-
}
|
|
29909
|
-
return { kind, name };
|
|
29910
|
-
}
|
|
29911
|
-
async function getResource(client, request, options) {
|
|
29912
|
-
const resources = await listResources(client, request.kind, options);
|
|
29913
|
-
const resource = resources.find(
|
|
29914
|
-
(item) => item.metadata.name === request.name
|
|
29915
|
-
);
|
|
29916
|
-
if (!resource) {
|
|
29917
|
-
throw new Error(`Resource not found: ${request.kind}/${request.name}`);
|
|
29918
|
-
}
|
|
29919
|
-
return resource;
|
|
29920
|
-
}
|
|
29921
|
-
async function listResources(client, kind, options) {
|
|
29922
|
-
switch (kind) {
|
|
29923
|
-
case RESOURCE_KIND_ENVIRONMENT:
|
|
29924
|
-
return (await client.listEnvironments(options)).environments;
|
|
29925
|
-
case RESOURCE_KIND_PROFILE:
|
|
29926
|
-
return (await client.listProfiles(options)).profiles;
|
|
29927
|
-
case RESOURCE_KIND_TOOL:
|
|
29928
|
-
return (await client.listTools(options)).tools;
|
|
29929
|
-
case RESOURCE_KIND_SESSION:
|
|
29930
|
-
return (await client.listSessions(options)).sessions;
|
|
29931
|
-
}
|
|
29932
|
-
}
|
|
29933
29885
|
|
|
29934
29886
|
// src/commands/describe/commands.ts
|
|
29935
29887
|
function registerDescribeCommands(program, context) {
|
|
@@ -31136,7 +31088,7 @@ function formatToolsText(result, writeLine) {
|
|
|
31136
31088
|
}
|
|
31137
31089
|
for (const exchange of result.exchanges) {
|
|
31138
31090
|
const duration4 = exchange.durationMs === null ? "-" : `${exchange.durationMs}ms`;
|
|
31139
|
-
const outcome = exchange.isError
|
|
31091
|
+
const outcome = exchangeOutcome(exchange.isError);
|
|
31140
31092
|
writeLine(
|
|
31141
31093
|
`${exchange.callSequence} ${exchange.name} ${duration4} ${outcome}: ${preview(exchange.input)}`
|
|
31142
31094
|
);
|
|
@@ -31147,6 +31099,12 @@ function formatToolsText(result, writeLine) {
|
|
|
31147
31099
|
);
|
|
31148
31100
|
}
|
|
31149
31101
|
}
|
|
31102
|
+
function exchangeOutcome(isError) {
|
|
31103
|
+
if (isError === null) {
|
|
31104
|
+
return "pending";
|
|
31105
|
+
}
|
|
31106
|
+
return isError ? "ERR" : "ok";
|
|
31107
|
+
}
|
|
31150
31108
|
async function handleRunsTriggers(context, runId, options = {}) {
|
|
31151
31109
|
const client = createContextApiClient(context);
|
|
31152
31110
|
const response = await client.listRunTriggers(runId, {
|