@autohq/cli 0.1.122 → 0.1.124
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 +24 -14
- package/dist/index.js +364 -138
- package/package.json +1 -1
package/dist/agent-bridge.js
CHANGED
|
@@ -20618,6 +20618,11 @@ function resourceApplySchema(spec) {
|
|
|
20618
20618
|
spec
|
|
20619
20619
|
});
|
|
20620
20620
|
}
|
|
20621
|
+
function resourceApplyDocumentSchema(kind, spec) {
|
|
20622
|
+
return resourceApplySchema(spec).extend({
|
|
20623
|
+
kind: external_exports.literal(kind)
|
|
20624
|
+
});
|
|
20625
|
+
}
|
|
20621
20626
|
|
|
20622
20627
|
// ../../packages/schemas/src/connections.ts
|
|
20623
20628
|
var ConnectionNameSchema = ResourceNameSchema;
|
|
@@ -21875,30 +21880,35 @@ function hasFilterValue(trigger, path2, expected) {
|
|
|
21875
21880
|
}
|
|
21876
21881
|
|
|
21877
21882
|
// ../../packages/schemas/src/project-resources.ts
|
|
21878
|
-
var EnvironmentApplyDocumentSchema =
|
|
21879
|
-
|
|
21880
|
-
|
|
21881
|
-
|
|
21882
|
-
|
|
21883
|
-
|
|
21884
|
-
|
|
21885
|
-
|
|
21886
|
-
|
|
21887
|
-
|
|
21888
|
-
|
|
21889
|
-
|
|
21883
|
+
var EnvironmentApplyDocumentSchema = resourceApplyDocumentSchema(
|
|
21884
|
+
RESOURCE_KIND_ENVIRONMENT,
|
|
21885
|
+
EnvironmentApplyRequestSchema.shape.spec
|
|
21886
|
+
);
|
|
21887
|
+
var ProfileApplyDocumentSchema = resourceApplyDocumentSchema(
|
|
21888
|
+
RESOURCE_KIND_PROFILE,
|
|
21889
|
+
ProfileApplyRequestSchema.shape.spec
|
|
21890
|
+
);
|
|
21891
|
+
var ToolApplyDocumentSchema = resourceApplyDocumentSchema(
|
|
21892
|
+
RESOURCE_KIND_TOOL,
|
|
21893
|
+
ToolApplyRequestSchema.shape.spec
|
|
21894
|
+
);
|
|
21895
|
+
var SessionApplyDocumentSchema = resourceApplyDocumentSchema(
|
|
21896
|
+
RESOURCE_KIND_SESSION,
|
|
21897
|
+
SessionApplyRequestSchema.shape.spec
|
|
21898
|
+
);
|
|
21890
21899
|
var ProjectApplyResourceSchema = external_exports.discriminatedUnion("kind", [
|
|
21891
21900
|
EnvironmentApplyDocumentSchema,
|
|
21892
21901
|
ProfileApplyDocumentSchema,
|
|
21893
21902
|
ToolApplyDocumentSchema,
|
|
21894
21903
|
SessionApplyDocumentSchema
|
|
21895
21904
|
]);
|
|
21896
|
-
var
|
|
21905
|
+
var PROJECT_RESOURCE_APPLY_ORDER = [
|
|
21897
21906
|
RESOURCE_KIND_ENVIRONMENT,
|
|
21898
21907
|
RESOURCE_KIND_PROFILE,
|
|
21899
21908
|
RESOURCE_KIND_TOOL,
|
|
21900
21909
|
RESOURCE_KIND_SESSION
|
|
21901
21910
|
];
|
|
21911
|
+
var PROJECT_RESOURCE_KINDS = PROJECT_RESOURCE_APPLY_ORDER;
|
|
21902
21912
|
var ProjectDeleteResourceSchema = external_exports.object({
|
|
21903
21913
|
kind: external_exports.enum(PROJECT_RESOURCE_KINDS),
|
|
21904
21914
|
name: external_exports.string().trim().min(1)
|
|
@@ -26259,7 +26269,7 @@ Object.assign(lookup, {
|
|
|
26259
26269
|
// package.json
|
|
26260
26270
|
var package_default = {
|
|
26261
26271
|
name: "@autohq/cli",
|
|
26262
|
-
version: "0.1.
|
|
26272
|
+
version: "0.1.124",
|
|
26263
26273
|
license: "SEE LICENSE IN README.md",
|
|
26264
26274
|
publishConfig: {
|
|
26265
26275
|
access: "public"
|
package/dist/index.js
CHANGED
|
@@ -17132,6 +17132,11 @@ function resourceApplySchema(spec) {
|
|
|
17132
17132
|
spec
|
|
17133
17133
|
});
|
|
17134
17134
|
}
|
|
17135
|
+
function resourceApplyDocumentSchema(kind, spec) {
|
|
17136
|
+
return resourceApplySchema(spec).extend({
|
|
17137
|
+
kind: external_exports.literal(kind)
|
|
17138
|
+
});
|
|
17139
|
+
}
|
|
17135
17140
|
var ResourceNameSchema, StringMapSchema, MetadataInputSchema, MetadataSchema;
|
|
17136
17141
|
var init_resources = __esm({
|
|
17137
17142
|
"../../packages/schemas/src/resources.ts"() {
|
|
@@ -18573,39 +18578,45 @@ var init_sessions = __esm({
|
|
|
18573
18578
|
});
|
|
18574
18579
|
|
|
18575
18580
|
// ../../packages/schemas/src/project-resources.ts
|
|
18576
|
-
var EnvironmentApplyDocumentSchema, ProfileApplyDocumentSchema, ToolApplyDocumentSchema, SessionApplyDocumentSchema, ProjectApplyResourceSchema, PROJECT_RESOURCE_KINDS, ProjectDeleteResourceSchema, AVATAR_ASSET_CONTENT_TYPES, MAX_AVATAR_ASSET_BASE64_LENGTH, ProjectApplyAssetSchema, ProjectApplyAssetsSchema, AvatarAssetUploadRequestSchema, AvatarAssetUploadResponseSchema, ProjectApplyRequestSchema, ProjectApplySystemConfigSchema, ProjectAppliedResourceSchema, ProjectApplyDiagnosticSchema, ProjectApplyResponseSchema;
|
|
18581
|
+
var EnvironmentApplyDocumentSchema, ProfileApplyDocumentSchema, ToolApplyDocumentSchema, SessionApplyDocumentSchema, ProjectApplyResourceSchema, PROJECT_RESOURCE_APPLY_ORDER, PROJECT_RESOURCE_KINDS, ProjectDeleteResourceSchema, AVATAR_ASSET_CONTENT_TYPES, MAX_AVATAR_ASSET_BASE64_LENGTH, ProjectApplyAssetSchema, ProjectApplyAssetsSchema, AvatarAssetUploadRequestSchema, AvatarAssetUploadResponseSchema, ProjectApplyRequestSchema, ProjectApplySystemConfigSchema, ProjectAppliedResourceSchema, ProjectApplyDiagnosticSchema, ProjectApplyResponseSchema;
|
|
18577
18582
|
var init_project_resources = __esm({
|
|
18578
18583
|
"../../packages/schemas/src/project-resources.ts"() {
|
|
18579
18584
|
"use strict";
|
|
18580
18585
|
init_zod();
|
|
18581
18586
|
init_environments();
|
|
18582
18587
|
init_profiles2();
|
|
18588
|
+
init_resources();
|
|
18583
18589
|
init_sessions();
|
|
18584
18590
|
init_tools();
|
|
18585
|
-
EnvironmentApplyDocumentSchema =
|
|
18586
|
-
|
|
18587
|
-
|
|
18588
|
-
|
|
18589
|
-
|
|
18590
|
-
|
|
18591
|
-
|
|
18592
|
-
|
|
18593
|
-
|
|
18594
|
-
|
|
18595
|
-
|
|
18596
|
-
|
|
18591
|
+
EnvironmentApplyDocumentSchema = resourceApplyDocumentSchema(
|
|
18592
|
+
RESOURCE_KIND_ENVIRONMENT,
|
|
18593
|
+
EnvironmentApplyRequestSchema.shape.spec
|
|
18594
|
+
);
|
|
18595
|
+
ProfileApplyDocumentSchema = resourceApplyDocumentSchema(
|
|
18596
|
+
RESOURCE_KIND_PROFILE,
|
|
18597
|
+
ProfileApplyRequestSchema.shape.spec
|
|
18598
|
+
);
|
|
18599
|
+
ToolApplyDocumentSchema = resourceApplyDocumentSchema(
|
|
18600
|
+
RESOURCE_KIND_TOOL,
|
|
18601
|
+
ToolApplyRequestSchema.shape.spec
|
|
18602
|
+
);
|
|
18603
|
+
SessionApplyDocumentSchema = resourceApplyDocumentSchema(
|
|
18604
|
+
RESOURCE_KIND_SESSION,
|
|
18605
|
+
SessionApplyRequestSchema.shape.spec
|
|
18606
|
+
);
|
|
18597
18607
|
ProjectApplyResourceSchema = external_exports.discriminatedUnion("kind", [
|
|
18598
18608
|
EnvironmentApplyDocumentSchema,
|
|
18599
18609
|
ProfileApplyDocumentSchema,
|
|
18600
18610
|
ToolApplyDocumentSchema,
|
|
18601
18611
|
SessionApplyDocumentSchema
|
|
18602
18612
|
]);
|
|
18603
|
-
|
|
18613
|
+
PROJECT_RESOURCE_APPLY_ORDER = [
|
|
18604
18614
|
RESOURCE_KIND_ENVIRONMENT,
|
|
18605
18615
|
RESOURCE_KIND_PROFILE,
|
|
18606
18616
|
RESOURCE_KIND_TOOL,
|
|
18607
18617
|
RESOURCE_KIND_SESSION
|
|
18608
18618
|
];
|
|
18619
|
+
PROJECT_RESOURCE_KINDS = PROJECT_RESOURCE_APPLY_ORDER;
|
|
18609
18620
|
ProjectDeleteResourceSchema = external_exports.object({
|
|
18610
18621
|
kind: external_exports.enum(PROJECT_RESOURCE_KINDS),
|
|
18611
18622
|
name: external_exports.string().trim().min(1)
|
|
@@ -18772,7 +18783,12 @@ var init_run_diagnostics = __esm({
|
|
|
18772
18783
|
});
|
|
18773
18784
|
|
|
18774
18785
|
// ../../packages/schemas/src/session-runs.ts
|
|
18775
|
-
|
|
18786
|
+
function isSessionRunTerminalStatus(status) {
|
|
18787
|
+
return SESSION_RUN_TERMINAL_STATUSES.some(
|
|
18788
|
+
(terminalStatus) => terminalStatus === status
|
|
18789
|
+
);
|
|
18790
|
+
}
|
|
18791
|
+
var SESSION_RUN_STATUSES, SESSION_RUN_TERMINAL_STATUSES, SESSION_RUN_DISPLAY_TITLE_MAX_LENGTH, SessionRunStatusSchema, SessionRunDisplayTitleSchema, SESSION_RUN_CHECK_STATUSES, SESSION_RUN_CHECK_CONCLUSIONS, SESSION_RUN_CHECK_TIMEOUT_PHASES, SessionRunCheckStatusSchema, SessionRunCheckConclusionSchema, SessionRunCheckTimeoutPhaseSchema, ManualSessionRunRequestSchema, SessionRunArchiveRequestSchema, SessionRunsArchiveRequestSchema, SessionRunRecordSchema, SessionRunsArchiveResponseSchema;
|
|
18776
18792
|
var init_session_runs = __esm({
|
|
18777
18793
|
"../../packages/schemas/src/session-runs.ts"() {
|
|
18778
18794
|
"use strict";
|
|
@@ -18791,6 +18807,7 @@ var init_session_runs = __esm({
|
|
|
18791
18807
|
"failed",
|
|
18792
18808
|
"stopped"
|
|
18793
18809
|
];
|
|
18810
|
+
SESSION_RUN_TERMINAL_STATUSES = ["failed", "stopped"];
|
|
18794
18811
|
SESSION_RUN_DISPLAY_TITLE_MAX_LENGTH = 64;
|
|
18795
18812
|
SessionRunStatusSchema = external_exports.enum(SESSION_RUN_STATUSES);
|
|
18796
18813
|
SessionRunDisplayTitleSchema = external_exports.string().trim().max(SESSION_RUN_DISPLAY_TITLE_MAX_LENGTH);
|
|
@@ -21220,7 +21237,7 @@ var init_package = __esm({
|
|
|
21220
21237
|
"package.json"() {
|
|
21221
21238
|
package_default = {
|
|
21222
21239
|
name: "@autohq/cli",
|
|
21223
|
-
version: "0.1.
|
|
21240
|
+
version: "0.1.124",
|
|
21224
21241
|
license: "SEE LICENSE IN README.md",
|
|
21225
21242
|
publishConfig: {
|
|
21226
21243
|
access: "public"
|
|
@@ -21564,7 +21581,7 @@ function appliedResourceKind(request, response, index) {
|
|
|
21564
21581
|
return kind;
|
|
21565
21582
|
}
|
|
21566
21583
|
function mcpOAuthToolConnectionsFromApplyRequest(request) {
|
|
21567
|
-
return request.resources.filter((resource) => resource.kind ===
|
|
21584
|
+
return request.resources.filter((resource) => resource.kind === RESOURCE_KIND_TOOL).flatMap((resource) => {
|
|
21568
21585
|
if (resource.spec.kind !== "mcp_remote" || resource.spec.auth.kind !== "mcp_oauth") {
|
|
21569
21586
|
return [];
|
|
21570
21587
|
}
|
|
@@ -21577,7 +21594,7 @@ function mcpOAuthToolConnectionsFromApplyRequest(request) {
|
|
|
21577
21594
|
});
|
|
21578
21595
|
}
|
|
21579
21596
|
function mcpOAuthToolConnectionsFromAppliedResources(resources) {
|
|
21580
|
-
return resources.filter((item) => item.kind ===
|
|
21597
|
+
return resources.filter((item) => item.kind === RESOURCE_KIND_TOOL).flatMap((item) => {
|
|
21581
21598
|
const resource = item.resource;
|
|
21582
21599
|
if (resource.spec.kind !== "mcp_remote" || resource.spec.auth.kind !== "mcp_oauth") {
|
|
21583
21600
|
return [];
|
|
@@ -21592,7 +21609,7 @@ function mcpOAuthToolConnectionsFromAppliedResources(resources) {
|
|
|
21592
21609
|
}
|
|
21593
21610
|
function applyFiles(root) {
|
|
21594
21611
|
const files = [];
|
|
21595
|
-
for (const kind of
|
|
21612
|
+
for (const kind of PROJECT_RESOURCE_APPLY_ORDER) {
|
|
21596
21613
|
const directory = APPLY_DIRECTORIES[kind];
|
|
21597
21614
|
const path2 = join3(root, directory);
|
|
21598
21615
|
let entries;
|
|
@@ -21654,7 +21671,7 @@ function readApplyDocument(document) {
|
|
|
21654
21671
|
function readApplyAssets(resources, projectRoot) {
|
|
21655
21672
|
const assets = {};
|
|
21656
21673
|
for (const resource of resources) {
|
|
21657
|
-
if (resource.kind !==
|
|
21674
|
+
if (resource.kind !== RESOURCE_KIND_SESSION) {
|
|
21658
21675
|
continue;
|
|
21659
21676
|
}
|
|
21660
21677
|
const avatarAsset = resource.spec.identity?.avatar?.asset;
|
|
@@ -21758,11 +21775,11 @@ function isInside(path2, parent) {
|
|
|
21758
21775
|
}
|
|
21759
21776
|
function applyCandidate(document) {
|
|
21760
21777
|
if (!isRecord(document) || !("kind" in document)) {
|
|
21761
|
-
return { kind:
|
|
21778
|
+
return { kind: RESOURCE_KIND_SESSION, value: document };
|
|
21762
21779
|
}
|
|
21763
|
-
if (!
|
|
21780
|
+
if (!PROJECT_RESOURCE_APPLY_ORDER.includes(document.kind)) {
|
|
21764
21781
|
throw new Error(
|
|
21765
|
-
`Unsupported apply resource kind "${String(document.kind)}"; supported kinds are ${
|
|
21782
|
+
`Unsupported apply resource kind "${String(document.kind)}"; supported kinds are ${PROJECT_RESOURCE_APPLY_ORDER.map((kind2) => `"${kind2}"`).join(", ")}`
|
|
21766
21783
|
);
|
|
21767
21784
|
}
|
|
21768
21785
|
const kind = document.kind;
|
|
@@ -21793,35 +21810,22 @@ function resourceApplyFiles(directory, entries) {
|
|
|
21793
21810
|
}
|
|
21794
21811
|
return files.sort((left, right) => left.localeCompare(right));
|
|
21795
21812
|
}
|
|
21796
|
-
var
|
|
21813
|
+
var APPLY_DIRECTORIES, APPLY_SCHEMAS, ALLOWED_AVATAR_EXTENSIONS;
|
|
21797
21814
|
var init_files = __esm({
|
|
21798
21815
|
"src/commands/apply/files.ts"() {
|
|
21799
21816
|
"use strict";
|
|
21800
21817
|
init_src();
|
|
21801
|
-
ResourceKind = /* @__PURE__ */ ((ResourceKind2) => {
|
|
21802
|
-
ResourceKind2["Environment"] = "environment";
|
|
21803
|
-
ResourceKind2["Profile"] = "profile";
|
|
21804
|
-
ResourceKind2["Tool"] = "tool";
|
|
21805
|
-
ResourceKind2["Session"] = "session";
|
|
21806
|
-
return ResourceKind2;
|
|
21807
|
-
})(ResourceKind || {});
|
|
21808
|
-
APPLY_RESOURCE_ORDER = [
|
|
21809
|
-
"environment" /* Environment */,
|
|
21810
|
-
"profile" /* Profile */,
|
|
21811
|
-
"tool" /* Tool */,
|
|
21812
|
-
"session" /* Session */
|
|
21813
|
-
];
|
|
21814
21818
|
APPLY_DIRECTORIES = {
|
|
21815
|
-
|
|
21816
|
-
|
|
21817
|
-
|
|
21818
|
-
|
|
21819
|
+
environment: "environments",
|
|
21820
|
+
profile: "profiles",
|
|
21821
|
+
tool: "tools",
|
|
21822
|
+
session: "sessions"
|
|
21819
21823
|
};
|
|
21820
21824
|
APPLY_SCHEMAS = {
|
|
21821
|
-
|
|
21822
|
-
|
|
21823
|
-
|
|
21824
|
-
|
|
21825
|
+
environment: EnvironmentApplyRequestSchema,
|
|
21826
|
+
profile: ProfileApplyRequestSchema,
|
|
21827
|
+
tool: ToolApplyRequestSchema,
|
|
21828
|
+
session: SessionApplyRequestSchema
|
|
21825
21829
|
};
|
|
21826
21830
|
ALLOWED_AVATAR_EXTENSIONS = /* @__PURE__ */ new Set([".jpg", ".jpeg", ".png"]);
|
|
21827
21831
|
}
|
|
@@ -22009,10 +22013,58 @@ async function requireProjectResource(client, reference, options) {
|
|
|
22009
22013
|
}
|
|
22010
22014
|
return resource;
|
|
22011
22015
|
}
|
|
22016
|
+
var PROJECT_RESOURCE_TUI_DEFINITION_BY_KIND, PROJECT_RESOURCE_TUI_ORDER, PROJECT_RESOURCE_TUI_DEFINITIONS, PROJECT_RESOURCE_TUI_DEFINITIONS_BY_SECTION, PROJECT_RESOURCE_TUI_DEFINITIONS_BY_KIND;
|
|
22012
22017
|
var init_resources3 = __esm({
|
|
22013
22018
|
"src/lib/resources.ts"() {
|
|
22014
22019
|
"use strict";
|
|
22015
22020
|
init_src();
|
|
22021
|
+
PROJECT_RESOURCE_TUI_DEFINITION_BY_KIND = {
|
|
22022
|
+
[RESOURCE_KIND_ENVIRONMENT]: {
|
|
22023
|
+
kind: RESOURCE_KIND_ENVIRONMENT,
|
|
22024
|
+
section: "environments",
|
|
22025
|
+
label: "Environment",
|
|
22026
|
+
pluralLabel: "Environments"
|
|
22027
|
+
},
|
|
22028
|
+
[RESOURCE_KIND_PROFILE]: {
|
|
22029
|
+
kind: RESOURCE_KIND_PROFILE,
|
|
22030
|
+
section: "profiles",
|
|
22031
|
+
label: "Profile",
|
|
22032
|
+
pluralLabel: "Profiles"
|
|
22033
|
+
},
|
|
22034
|
+
[RESOURCE_KIND_TOOL]: {
|
|
22035
|
+
kind: RESOURCE_KIND_TOOL,
|
|
22036
|
+
section: "tools",
|
|
22037
|
+
label: "Tool",
|
|
22038
|
+
pluralLabel: "Tools"
|
|
22039
|
+
},
|
|
22040
|
+
[RESOURCE_KIND_SESSION]: {
|
|
22041
|
+
kind: RESOURCE_KIND_SESSION,
|
|
22042
|
+
section: "sessions",
|
|
22043
|
+
label: "Session",
|
|
22044
|
+
pluralLabel: "Sessions"
|
|
22045
|
+
}
|
|
22046
|
+
};
|
|
22047
|
+
PROJECT_RESOURCE_TUI_ORDER = [
|
|
22048
|
+
RESOURCE_KIND_SESSION,
|
|
22049
|
+
RESOURCE_KIND_PROFILE,
|
|
22050
|
+
RESOURCE_KIND_ENVIRONMENT,
|
|
22051
|
+
RESOURCE_KIND_TOOL
|
|
22052
|
+
];
|
|
22053
|
+
PROJECT_RESOURCE_TUI_DEFINITIONS = PROJECT_RESOURCE_TUI_ORDER.map(
|
|
22054
|
+
(kind) => PROJECT_RESOURCE_TUI_DEFINITION_BY_KIND[kind]
|
|
22055
|
+
);
|
|
22056
|
+
PROJECT_RESOURCE_TUI_DEFINITIONS_BY_SECTION = new Map(
|
|
22057
|
+
PROJECT_RESOURCE_TUI_DEFINITIONS.map((definition) => [
|
|
22058
|
+
definition.section,
|
|
22059
|
+
definition
|
|
22060
|
+
])
|
|
22061
|
+
);
|
|
22062
|
+
PROJECT_RESOURCE_TUI_DEFINITIONS_BY_KIND = new Map(
|
|
22063
|
+
PROJECT_RESOURCE_TUI_DEFINITIONS.map((definition) => [
|
|
22064
|
+
definition.kind,
|
|
22065
|
+
definition
|
|
22066
|
+
])
|
|
22067
|
+
);
|
|
22016
22068
|
}
|
|
22017
22069
|
});
|
|
22018
22070
|
|
|
@@ -24861,6 +24913,39 @@ function useUnarchiveRuns(apiUrl) {
|
|
|
24861
24913
|
onSuccess: (result) => invalidateRunsQueries(queryClient, apiUrl, result.runs)
|
|
24862
24914
|
});
|
|
24863
24915
|
}
|
|
24916
|
+
function useStopRuns(apiUrl) {
|
|
24917
|
+
const client = useApiClient();
|
|
24918
|
+
const queryClient = useQueryClient();
|
|
24919
|
+
return useMutation({
|
|
24920
|
+
mutationFn: (runIds) => stopRunsBatch(
|
|
24921
|
+
(runId) => client.stopRun(runId, { apiBaseUrl: apiUrl }),
|
|
24922
|
+
runIds
|
|
24923
|
+
),
|
|
24924
|
+
// stopRun returns a command receipt, not run records, so invalidate the
|
|
24925
|
+
// run-list query families directly to pick up the new statuses.
|
|
24926
|
+
onSuccess: () => invalidateRunListQueries(queryClient, apiUrl)
|
|
24927
|
+
});
|
|
24928
|
+
}
|
|
24929
|
+
async function stopRunsBatch(stopRun, runIds) {
|
|
24930
|
+
const outcomes = await Promise.all(
|
|
24931
|
+
runIds.map(async (runId) => {
|
|
24932
|
+
try {
|
|
24933
|
+
await stopRun(runId);
|
|
24934
|
+
return { runId, ok: true, message: "" };
|
|
24935
|
+
} catch (error51) {
|
|
24936
|
+
return {
|
|
24937
|
+
runId,
|
|
24938
|
+
ok: false,
|
|
24939
|
+
message: error51 instanceof Error ? error51.message : String(error51)
|
|
24940
|
+
};
|
|
24941
|
+
}
|
|
24942
|
+
})
|
|
24943
|
+
);
|
|
24944
|
+
return {
|
|
24945
|
+
stopped: outcomes.filter((o) => o.ok).map((o) => o.runId),
|
|
24946
|
+
failed: outcomes.filter((o) => !o.ok).map((o) => ({ runId: o.runId, message: o.message }))
|
|
24947
|
+
};
|
|
24948
|
+
}
|
|
24864
24949
|
function sessionRunsQueryOptions(client, sessionName, apiUrl, includeArchived = false) {
|
|
24865
24950
|
return queryOptions({
|
|
24866
24951
|
queryKey: queryKeys.sessionRuns(sessionName ?? "", apiUrl, includeArchived),
|
|
@@ -25001,6 +25086,10 @@ function invalidateRunsQueries(queryClient, apiUrl, runs) {
|
|
|
25001
25086
|
});
|
|
25002
25087
|
}
|
|
25003
25088
|
}
|
|
25089
|
+
function invalidateRunListQueries(queryClient, apiUrl) {
|
|
25090
|
+
void queryClient.invalidateQueries({ queryKey: ["runs", apiUrl] });
|
|
25091
|
+
void queryClient.invalidateQueries({ queryKey: ["session-runs"] });
|
|
25092
|
+
}
|
|
25004
25093
|
var TUI_RUN_LIST_LIMIT, queryKeys, RUNS_REFETCH_INTERVAL_MS;
|
|
25005
25094
|
var init_queries = __esm({
|
|
25006
25095
|
"src/tui/hooks/queries.ts"() {
|
|
@@ -25442,41 +25531,59 @@ import { Box as Box13, Text as Text14, useApp as useApp2, useInput as useInput4,
|
|
|
25442
25531
|
import TextInput3 from "ink-text-input";
|
|
25443
25532
|
import { useCallback as useCallback2, useEffect as useEffect3, useMemo as useMemo3, useRef as useRef2, useState as useState3 } from "react";
|
|
25444
25533
|
import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
25534
|
+
function resourceNavItem(input) {
|
|
25535
|
+
const definition = PROJECT_RESOURCE_TUI_DEFINITIONS_BY_SECTION.get(
|
|
25536
|
+
input.section
|
|
25537
|
+
);
|
|
25538
|
+
if (!definition) {
|
|
25539
|
+
throw new Error(`Missing TUI resource definition for ${input.section}`);
|
|
25540
|
+
}
|
|
25541
|
+
return {
|
|
25542
|
+
k: input.k,
|
|
25543
|
+
label: definition.pluralLabel,
|
|
25544
|
+
activeSection: definition.section
|
|
25545
|
+
};
|
|
25546
|
+
}
|
|
25445
25547
|
function clampListIndex(index, length) {
|
|
25446
25548
|
return Math.min(Math.max(0, index), Math.max(0, length - 1));
|
|
25447
25549
|
}
|
|
25448
25550
|
function sectionForResourceShortcut(input) {
|
|
25449
|
-
return
|
|
25551
|
+
return DASHBOARD_NAV_ITEMS.find((resource) => resource.k === input)?.activeSection ?? null;
|
|
25450
25552
|
}
|
|
25451
25553
|
function inspectParentLabel(kind) {
|
|
25452
|
-
|
|
25453
|
-
|
|
25454
|
-
|
|
25455
|
-
case "profile":
|
|
25456
|
-
return "profiles";
|
|
25457
|
-
case "environment":
|
|
25458
|
-
return "environments";
|
|
25459
|
-
case "tool":
|
|
25460
|
-
return "tools";
|
|
25461
|
-
}
|
|
25554
|
+
return PROJECT_RESOURCE_TUI_DEFINITIONS.find(
|
|
25555
|
+
(definition) => definition.kind === kind
|
|
25556
|
+
)?.section ?? kind;
|
|
25462
25557
|
}
|
|
25463
|
-
function
|
|
25558
|
+
function isApplyResourceSection(section) {
|
|
25559
|
+
return PROJECT_RESOURCE_TUI_DEFINITIONS_BY_SECTION.has(
|
|
25560
|
+
section
|
|
25561
|
+
);
|
|
25562
|
+
}
|
|
25563
|
+
function selectedNamedResourceForSection(input) {
|
|
25464
25564
|
switch (input.activeSection) {
|
|
25465
|
-
case "sessions":
|
|
25466
|
-
return input.selectedSession ? { kind: "session", name: input.selectedSession.metadata.name } : null;
|
|
25467
|
-
case "profiles":
|
|
25468
|
-
return input.selectedProfile ? { kind: "profile", name: input.selectedProfile.metadata.name } : null;
|
|
25469
25565
|
case "environments":
|
|
25470
|
-
return input.selectedEnvironment
|
|
25471
|
-
|
|
25472
|
-
|
|
25473
|
-
|
|
25566
|
+
return input.selectedEnvironment ?? null;
|
|
25567
|
+
case "profiles":
|
|
25568
|
+
return input.selectedProfile ?? null;
|
|
25569
|
+
case "sessions":
|
|
25570
|
+
return input.selectedSession ?? null;
|
|
25474
25571
|
case "tools":
|
|
25475
|
-
return input.selectedTool
|
|
25572
|
+
return input.selectedTool ?? null;
|
|
25476
25573
|
default:
|
|
25477
25574
|
return null;
|
|
25478
25575
|
}
|
|
25479
25576
|
}
|
|
25577
|
+
function editableResourceForSelection(input) {
|
|
25578
|
+
if (!isApplyResourceSection(input.activeSection)) {
|
|
25579
|
+
return null;
|
|
25580
|
+
}
|
|
25581
|
+
const definition = PROJECT_RESOURCE_TUI_DEFINITIONS_BY_SECTION.get(
|
|
25582
|
+
input.activeSection
|
|
25583
|
+
);
|
|
25584
|
+
const selected = selectedNamedResourceForSection(input);
|
|
25585
|
+
return definition && selected ? { kind: definition.kind, name: selected.metadata.name } : null;
|
|
25586
|
+
}
|
|
25480
25587
|
function HomeView({ apiUrl, notice, returnToSession }) {
|
|
25481
25588
|
const client = useApiClient();
|
|
25482
25589
|
const queryClient = useQueryClient2();
|
|
@@ -25515,6 +25622,9 @@ function HomeView({ apiUrl, notice, returnToSession }) {
|
|
|
25515
25622
|
);
|
|
25516
25623
|
const [pendingArchiveRunKey, setPendingArchiveRunKey] = useState3(null);
|
|
25517
25624
|
const [pendingUnarchiveRunKey, setPendingUnarchiveRunKey] = useState3(null);
|
|
25625
|
+
const [pendingStopRunKey, setPendingStopRunKey] = useState3(
|
|
25626
|
+
null
|
|
25627
|
+
);
|
|
25518
25628
|
const [runNotice, setRunNotice] = useState3(null);
|
|
25519
25629
|
const [connectionIndex, setConnectionIndex] = useState3(0);
|
|
25520
25630
|
const [connectionProviderIndex, setConnectionProviderIndex] = useState3(0);
|
|
@@ -25580,6 +25690,7 @@ function HomeView({ apiUrl, notice, returnToSession }) {
|
|
|
25580
25690
|
const triggerRun = useTriggerRun(apiUrl);
|
|
25581
25691
|
const archiveRuns = useArchiveRuns(apiUrl);
|
|
25582
25692
|
const unarchiveRuns = useUnarchiveRuns(apiUrl);
|
|
25693
|
+
const stopRuns = useStopRuns(apiUrl);
|
|
25583
25694
|
const [connectionNotice, setConnectionNotice] = useState3(null);
|
|
25584
25695
|
const [serviceAccountNotice, setServiceAccountNotice] = useState3(null);
|
|
25585
25696
|
const [pendingRemoveConnectionKey, setPendingRemoveConnectionKey] = useState3(null);
|
|
@@ -25633,29 +25744,39 @@ function HomeView({ apiUrl, notice, returnToSession }) {
|
|
|
25633
25744
|
const selectedEnvironment = environments[environmentIndex];
|
|
25634
25745
|
const selectedTool = tools[toolIndex];
|
|
25635
25746
|
const selectedInspectableResource = useMemo3(() => {
|
|
25747
|
+
const selectedEditable = editableResourceForSelection({
|
|
25748
|
+
activeSection,
|
|
25749
|
+
selectedEnvironment,
|
|
25750
|
+
selectedProfile,
|
|
25751
|
+
selectedSession,
|
|
25752
|
+
selectedTool
|
|
25753
|
+
});
|
|
25754
|
+
if (!selectedEditable) {
|
|
25755
|
+
return null;
|
|
25756
|
+
}
|
|
25636
25757
|
switch (activeSection) {
|
|
25637
25758
|
case "sessions":
|
|
25638
25759
|
return selectedSession ? {
|
|
25639
|
-
kind:
|
|
25640
|
-
name:
|
|
25760
|
+
kind: selectedEditable.kind,
|
|
25761
|
+
name: selectedEditable.name,
|
|
25641
25762
|
spec: selectedSession.spec
|
|
25642
25763
|
} : null;
|
|
25643
25764
|
case "profiles":
|
|
25644
25765
|
return selectedProfile ? {
|
|
25645
|
-
kind:
|
|
25646
|
-
name:
|
|
25766
|
+
kind: selectedEditable.kind,
|
|
25767
|
+
name: selectedEditable.name,
|
|
25647
25768
|
spec: selectedProfile.spec
|
|
25648
25769
|
} : null;
|
|
25649
25770
|
case "environments":
|
|
25650
25771
|
return selectedEnvironment ? {
|
|
25651
|
-
kind:
|
|
25652
|
-
name:
|
|
25772
|
+
kind: selectedEditable.kind,
|
|
25773
|
+
name: selectedEditable.name,
|
|
25653
25774
|
spec: selectedEnvironment.spec
|
|
25654
25775
|
} : null;
|
|
25655
25776
|
case "tools":
|
|
25656
25777
|
return selectedTool ? {
|
|
25657
|
-
kind:
|
|
25658
|
-
name:
|
|
25778
|
+
kind: selectedEditable.kind,
|
|
25779
|
+
name: selectedEditable.name,
|
|
25659
25780
|
spec: selectedTool.spec
|
|
25660
25781
|
} : null;
|
|
25661
25782
|
default:
|
|
@@ -25767,8 +25888,10 @@ function HomeView({ apiUrl, notice, returnToSession }) {
|
|
|
25767
25888
|
const toggleSelectedRun = useCallback2(() => {
|
|
25768
25889
|
setPendingArchiveRunKey(null);
|
|
25769
25890
|
setPendingUnarchiveRunKey(null);
|
|
25891
|
+
setPendingStopRunKey(null);
|
|
25770
25892
|
archiveRuns.reset();
|
|
25771
25893
|
unarchiveRuns.reset();
|
|
25894
|
+
stopRuns.reset();
|
|
25772
25895
|
if (!selectedRun) {
|
|
25773
25896
|
setRunNotice("Select a run before marking it.");
|
|
25774
25897
|
return;
|
|
@@ -25786,11 +25909,13 @@ function HomeView({ apiUrl, notice, returnToSession }) {
|
|
|
25786
25909
|
setRunNotice(
|
|
25787
25910
|
wasSelected ? `Unmarked run ${shortRunId2(selectedRun.id)}.` : `Marked run ${shortRunId2(selectedRun.id)}.`
|
|
25788
25911
|
);
|
|
25789
|
-
}, [archiveRuns, selectedRun, selectedRunIds, unarchiveRuns]);
|
|
25912
|
+
}, [archiveRuns, selectedRun, selectedRunIds, stopRuns, unarchiveRuns]);
|
|
25790
25913
|
const archiveSelectedRun = useCallback2(() => {
|
|
25791
25914
|
archiveRuns.reset();
|
|
25792
25915
|
unarchiveRuns.reset();
|
|
25916
|
+
stopRuns.reset();
|
|
25793
25917
|
setPendingUnarchiveRunKey(null);
|
|
25918
|
+
setPendingStopRunKey(null);
|
|
25794
25919
|
const runIds = runIdsForArchiveAction({
|
|
25795
25920
|
markedRunIds,
|
|
25796
25921
|
selectedRun
|
|
@@ -25820,12 +25945,15 @@ function HomeView({ apiUrl, notice, returnToSession }) {
|
|
|
25820
25945
|
markedRunIds,
|
|
25821
25946
|
pendingArchiveRunKey,
|
|
25822
25947
|
selectedRun,
|
|
25948
|
+
stopRuns,
|
|
25823
25949
|
unarchiveRuns
|
|
25824
25950
|
]);
|
|
25825
25951
|
const unarchiveSelectedRun = useCallback2(() => {
|
|
25826
25952
|
archiveRuns.reset();
|
|
25827
25953
|
unarchiveRuns.reset();
|
|
25954
|
+
stopRuns.reset();
|
|
25828
25955
|
setPendingArchiveRunKey(null);
|
|
25956
|
+
setPendingStopRunKey(null);
|
|
25829
25957
|
const runIds = runIdsForArchiveAction({
|
|
25830
25958
|
markedRunIds,
|
|
25831
25959
|
selectedRun
|
|
@@ -25855,8 +25983,59 @@ function HomeView({ apiUrl, notice, returnToSession }) {
|
|
|
25855
25983
|
markedRunIds,
|
|
25856
25984
|
pendingUnarchiveRunKey,
|
|
25857
25985
|
selectedRun,
|
|
25986
|
+
stopRuns,
|
|
25858
25987
|
unarchiveRuns
|
|
25859
25988
|
]);
|
|
25989
|
+
const stopSelectedRuns = useCallback2(() => {
|
|
25990
|
+
stopRuns.reset();
|
|
25991
|
+
archiveRuns.reset();
|
|
25992
|
+
unarchiveRuns.reset();
|
|
25993
|
+
setPendingArchiveRunKey(null);
|
|
25994
|
+
setPendingUnarchiveRunKey(null);
|
|
25995
|
+
const runIds = runIdsForArchiveAction({ markedRunIds, selectedRun });
|
|
25996
|
+
if (runIds.length === 0) {
|
|
25997
|
+
setPendingStopRunKey(null);
|
|
25998
|
+
setRunNotice("Select a run before stopping.");
|
|
25999
|
+
return;
|
|
26000
|
+
}
|
|
26001
|
+
const runsById = new Map(visibleRuns.map((run) => [run.id, run]));
|
|
26002
|
+
const { stoppableRunIds, skippedRunIds } = partitionRunsForStop(
|
|
26003
|
+
runIds,
|
|
26004
|
+
runsById
|
|
26005
|
+
);
|
|
26006
|
+
if (stoppableRunIds.length === 0) {
|
|
26007
|
+
setPendingStopRunKey(null);
|
|
26008
|
+
setRunNotice(
|
|
26009
|
+
`Nothing to stop \u2014 ${pluralizeRunCount(skippedRunIds.length)} already stopped or failed.`
|
|
26010
|
+
);
|
|
26011
|
+
return;
|
|
26012
|
+
}
|
|
26013
|
+
const actionKey = runArchiveActionKey(stoppableRunIds);
|
|
26014
|
+
if (pendingStopRunKey !== actionKey) {
|
|
26015
|
+
setPendingStopRunKey(actionKey);
|
|
26016
|
+
const skipNote = skippedRunIds.length > 0 ? ` (skipping ${pluralizeRunCount(skippedRunIds.length)} already stopped or failed)` : "";
|
|
26017
|
+
setRunNotice(
|
|
26018
|
+
`Press s again to stop ${stopTargetLabel(stoppableRunIds, markedRunIds.length > 0)}${skipNote}.`
|
|
26019
|
+
);
|
|
26020
|
+
return;
|
|
26021
|
+
}
|
|
26022
|
+
setPendingStopRunKey(null);
|
|
26023
|
+
setRunNotice(null);
|
|
26024
|
+
stopRuns.mutate(stoppableRunIds, {
|
|
26025
|
+
onSuccess: (result) => {
|
|
26026
|
+
setSelectedRunIds(/* @__PURE__ */ new Set());
|
|
26027
|
+
setRunNotice(stopResultNotice(result, skippedRunIds.length));
|
|
26028
|
+
}
|
|
26029
|
+
});
|
|
26030
|
+
}, [
|
|
26031
|
+
archiveRuns,
|
|
26032
|
+
markedRunIds,
|
|
26033
|
+
pendingStopRunKey,
|
|
26034
|
+
selectedRun,
|
|
26035
|
+
stopRuns,
|
|
26036
|
+
unarchiveRuns,
|
|
26037
|
+
visibleRuns
|
|
26038
|
+
]);
|
|
25860
26039
|
const projectSelectionRequired = /No active (organization|project)/i.test(authErrorMessage ?? "") && projects.length > 0;
|
|
25861
26040
|
useEffect3(() => {
|
|
25862
26041
|
if (projectSelectionRequired) {
|
|
@@ -26017,6 +26196,7 @@ function HomeView({ apiUrl, notice, returnToSession }) {
|
|
|
26017
26196
|
setSelectedRunIds(/* @__PURE__ */ new Set());
|
|
26018
26197
|
setPendingArchiveRunKey(null);
|
|
26019
26198
|
setPendingUnarchiveRunKey(null);
|
|
26199
|
+
setPendingStopRunKey(null);
|
|
26020
26200
|
setRunNotice(null);
|
|
26021
26201
|
triggerRun.reset();
|
|
26022
26202
|
return;
|
|
@@ -26028,6 +26208,7 @@ function HomeView({ apiUrl, notice, returnToSession }) {
|
|
|
26028
26208
|
setSelectedRunIds(/* @__PURE__ */ new Set());
|
|
26029
26209
|
setPendingArchiveRunKey(null);
|
|
26030
26210
|
setPendingUnarchiveRunKey(null);
|
|
26211
|
+
setPendingStopRunKey(null);
|
|
26031
26212
|
setRunNotice(null);
|
|
26032
26213
|
setSection("runs");
|
|
26033
26214
|
triggerRun.reset();
|
|
@@ -26051,6 +26232,7 @@ function HomeView({ apiUrl, notice, returnToSession }) {
|
|
|
26051
26232
|
setSelectedRunIds(/* @__PURE__ */ new Set());
|
|
26052
26233
|
setPendingArchiveRunKey(null);
|
|
26053
26234
|
setPendingUnarchiveRunKey(null);
|
|
26235
|
+
setPendingStopRunKey(null);
|
|
26054
26236
|
setRunNotice(null);
|
|
26055
26237
|
setShowArchivedRuns(false);
|
|
26056
26238
|
}
|
|
@@ -26134,6 +26316,7 @@ function HomeView({ apiUrl, notice, returnToSession }) {
|
|
|
26134
26316
|
setSelectedRunIds(/* @__PURE__ */ new Set());
|
|
26135
26317
|
setPendingArchiveRunKey(null);
|
|
26136
26318
|
setPendingUnarchiveRunKey(null);
|
|
26319
|
+
setPendingStopRunKey(null);
|
|
26137
26320
|
setRunNotice(null);
|
|
26138
26321
|
setSection("runs");
|
|
26139
26322
|
triggerRun.reset();
|
|
@@ -26152,9 +26335,11 @@ function HomeView({ apiUrl, notice, returnToSession }) {
|
|
|
26152
26335
|
setSelectedRunIds(/* @__PURE__ */ new Set());
|
|
26153
26336
|
setPendingArchiveRunKey(null);
|
|
26154
26337
|
setPendingUnarchiveRunKey(null);
|
|
26338
|
+
setPendingStopRunKey(null);
|
|
26155
26339
|
setRunNotice(null);
|
|
26156
26340
|
archiveRuns.reset();
|
|
26157
26341
|
unarchiveRuns.reset();
|
|
26342
|
+
stopRuns.reset();
|
|
26158
26343
|
return;
|
|
26159
26344
|
}
|
|
26160
26345
|
if (input === " ") {
|
|
@@ -26169,6 +26354,10 @@ function HomeView({ apiUrl, notice, returnToSession }) {
|
|
|
26169
26354
|
archiveSelectedRun();
|
|
26170
26355
|
return;
|
|
26171
26356
|
}
|
|
26357
|
+
if (input === "s" && !showArchivedRuns) {
|
|
26358
|
+
stopSelectedRuns();
|
|
26359
|
+
return;
|
|
26360
|
+
}
|
|
26172
26361
|
if (input === "u" && showArchivedRuns) {
|
|
26173
26362
|
unarchiveSelectedRun();
|
|
26174
26363
|
return;
|
|
@@ -26176,12 +26365,14 @@ function HomeView({ apiUrl, notice, returnToSession }) {
|
|
|
26176
26365
|
if (key.upArrow) {
|
|
26177
26366
|
setPendingArchiveRunKey(null);
|
|
26178
26367
|
setPendingUnarchiveRunKey(null);
|
|
26368
|
+
setPendingStopRunKey(null);
|
|
26179
26369
|
setRunIndex((i) => Math.max(0, i - 1));
|
|
26180
26370
|
return;
|
|
26181
26371
|
}
|
|
26182
26372
|
if (key.downArrow) {
|
|
26183
26373
|
setPendingArchiveRunKey(null);
|
|
26184
26374
|
setPendingUnarchiveRunKey(null);
|
|
26375
|
+
setPendingStopRunKey(null);
|
|
26185
26376
|
setRunIndex((i) => clampListIndex(i + 1, visibleRuns.length));
|
|
26186
26377
|
return;
|
|
26187
26378
|
}
|
|
@@ -26195,7 +26386,7 @@ function HomeView({ apiUrl, notice, returnToSession }) {
|
|
|
26195
26386
|
return;
|
|
26196
26387
|
}
|
|
26197
26388
|
}
|
|
26198
|
-
if (activeSection
|
|
26389
|
+
if (isApplyResourceSection(activeSection) && activeSection !== "sessions" || activeSection === "serviceAccounts" || activeSection === "connections") {
|
|
26199
26390
|
if (key.escape) {
|
|
26200
26391
|
if (activeSection === "connections" && connectionMode === "providers") {
|
|
26201
26392
|
setConnectionMode("connections");
|
|
@@ -26502,8 +26693,10 @@ function HomeView({ apiUrl, notice, returnToSession }) {
|
|
|
26502
26693
|
);
|
|
26503
26694
|
}
|
|
26504
26695
|
const resourceColumns = [];
|
|
26505
|
-
for (let i = 0; i <
|
|
26506
|
-
resourceColumns.push(
|
|
26696
|
+
for (let i = 0; i < DASHBOARD_NAV_ITEMS.length; i += RESOURCES_PER_COLUMN) {
|
|
26697
|
+
resourceColumns.push(
|
|
26698
|
+
DASHBOARD_NAV_ITEMS.slice(i, i + RESOURCES_PER_COLUMN)
|
|
26699
|
+
);
|
|
26507
26700
|
}
|
|
26508
26701
|
let sectionTitle;
|
|
26509
26702
|
switch (activeSection) {
|
|
@@ -26517,14 +26710,13 @@ function HomeView({ apiUrl, notice, returnToSession }) {
|
|
|
26517
26710
|
sectionTitle = `Service Accounts[${serviceAccounts.length}]`;
|
|
26518
26711
|
break;
|
|
26519
26712
|
case "profiles":
|
|
26520
|
-
sectionTitle = `Profiles[${profiles.length}]`;
|
|
26521
|
-
break;
|
|
26522
26713
|
case "environments":
|
|
26523
|
-
|
|
26524
|
-
|
|
26525
|
-
|
|
26526
|
-
sectionTitle =
|
|
26714
|
+
case "tools": {
|
|
26715
|
+
const definition = PROJECT_RESOURCE_TUI_DEFINITIONS_BY_SECTION.get(activeSection);
|
|
26716
|
+
const count = activeSection === "profiles" ? profiles.length : activeSection === "environments" ? environments.length : tools.length;
|
|
26717
|
+
sectionTitle = `${definition?.pluralLabel ?? activeSection}[${count}]`;
|
|
26527
26718
|
break;
|
|
26719
|
+
}
|
|
26528
26720
|
case "connections":
|
|
26529
26721
|
sectionTitle = connectionMode === "providers" ? `Providers[${connectionProviderRowCount}]` : `Connections[${connectionRowCount}]`;
|
|
26530
26722
|
break;
|
|
@@ -26541,8 +26733,8 @@ function HomeView({ apiUrl, notice, returnToSession }) {
|
|
|
26541
26733
|
if (inspectedResource) {
|
|
26542
26734
|
sectionTitle = `Inspect ${inspectedResource.kind}/${inspectedResource.name}`;
|
|
26543
26735
|
}
|
|
26544
|
-
const runError = errorMessage2(triggerRun.error) ?? errorMessage2(archiveRuns.error) ?? errorMessage2(unarchiveRuns.error);
|
|
26545
|
-
const isRunMutationPending = triggerRun.isPending || archiveRuns.isPending || unarchiveRuns.isPending;
|
|
26736
|
+
const runError = errorMessage2(triggerRun.error) ?? errorMessage2(archiveRuns.error) ?? errorMessage2(unarchiveRuns.error) ?? errorMessage2(stopRuns.error);
|
|
26737
|
+
const isRunMutationPending = triggerRun.isPending || archiveRuns.isPending || unarchiveRuns.isPending || stopRuns.isPending;
|
|
26546
26738
|
const isConnectionMutationPending = startConnection.isPending || allowConnection.isPending || removeConnection.isPending;
|
|
26547
26739
|
const serviceAccountStatus = createServiceAccount2.error instanceof Error ? createServiceAccount2.error.message : rotateServiceAccount2.error instanceof Error ? rotateServiceAccount2.error.message : removeServiceAccount2.error instanceof Error ? removeServiceAccount2.error.message : serviceAccountNotice;
|
|
26548
26740
|
const isServiceAccountMutationPending = createServiceAccount2.isPending || rotateServiceAccount2.isPending || removeServiceAccount2.isPending;
|
|
@@ -26564,7 +26756,11 @@ function HomeView({ apiUrl, notice, returnToSession }) {
|
|
|
26564
26756
|
value: /* @__PURE__ */ jsx14(
|
|
26565
26757
|
Spinner,
|
|
26566
26758
|
{
|
|
26567
|
-
label:
|
|
26759
|
+
label: runMutationStatusLabel({
|
|
26760
|
+
starting: triggerRun.isPending,
|
|
26761
|
+
archiving: archiveRuns.isPending,
|
|
26762
|
+
stopping: stopRuns.isPending
|
|
26763
|
+
})
|
|
26568
26764
|
}
|
|
26569
26765
|
)
|
|
26570
26766
|
}
|
|
@@ -26601,13 +26797,13 @@ function HomeView({ apiUrl, notice, returnToSession }) {
|
|
|
26601
26797
|
{ k: "q", label: "Quit" }
|
|
26602
26798
|
]
|
|
26603
26799
|
}
|
|
26604
|
-
) : activeSection
|
|
26800
|
+
) : isApplyResourceSection(activeSection) || activeSection === "serviceAccounts" || activeSection === "connections" ? /* @__PURE__ */ jsx14(
|
|
26605
26801
|
ActionKeyColumns,
|
|
26606
26802
|
{
|
|
26607
26803
|
keys: [
|
|
26608
|
-
...activeSection
|
|
26804
|
+
...isApplyResourceSection(activeSection) || activeSection === "serviceAccounts" ? [{ k: "\u2191\u2193", label: "Navigate" }] : [],
|
|
26609
26805
|
...activeSection === "profiles" ? [{ k: "enter", label: "Environment" }] : [],
|
|
26610
|
-
...activeSection
|
|
26806
|
+
...isApplyResourceSection(activeSection) ? [
|
|
26611
26807
|
{ k: "i", label: "Inspect" },
|
|
26612
26808
|
{ k: "e", label: "Edit" }
|
|
26613
26809
|
] : [],
|
|
@@ -26653,6 +26849,7 @@ function HomeView({ apiUrl, notice, returnToSession }) {
|
|
|
26653
26849
|
},
|
|
26654
26850
|
...showArchivedRuns ? [{ k: "u", label: "Restore" }] : [
|
|
26655
26851
|
{ k: "a", label: "Archive" },
|
|
26852
|
+
{ k: "s", label: "Stop" },
|
|
26656
26853
|
...scopedSession ? [{ k: "n", label: "New run" }] : []
|
|
26657
26854
|
],
|
|
26658
26855
|
{ k: "esc", label: "Back" },
|
|
@@ -26886,6 +27083,38 @@ function selectedRunIdsForVisibleRuns(runs, selectedRunIds) {
|
|
|
26886
27083
|
function runIdsForArchiveAction(input) {
|
|
26887
27084
|
return input.markedRunIds.length > 0 ? input.markedRunIds : input.selectedRun ? [input.selectedRun.id] : [];
|
|
26888
27085
|
}
|
|
27086
|
+
function partitionRunsForStop(runIds, runsById) {
|
|
27087
|
+
const stoppableRunIds = [];
|
|
27088
|
+
const skippedRunIds = [];
|
|
27089
|
+
for (const runId of runIds) {
|
|
27090
|
+
const run = runsById.get(runId);
|
|
27091
|
+
if (run && isSessionRunTerminalStatus(run.status)) {
|
|
27092
|
+
skippedRunIds.push(runId);
|
|
27093
|
+
} else {
|
|
27094
|
+
stoppableRunIds.push(runId);
|
|
27095
|
+
}
|
|
27096
|
+
}
|
|
27097
|
+
return { stoppableRunIds, skippedRunIds };
|
|
27098
|
+
}
|
|
27099
|
+
function stopTargetLabel(runIds, bulk) {
|
|
27100
|
+
return bulk ? pluralizeRunCount(runIds.length) : `run ${shortRunId2(runIds[0] ?? "")}`;
|
|
27101
|
+
}
|
|
27102
|
+
function stopResultNotice(result, skippedCount) {
|
|
27103
|
+
const parts = [`Stopped ${pluralizeRunCount(result.stopped.length)}`];
|
|
27104
|
+
if (result.failed.length > 0) {
|
|
27105
|
+
parts.push(`failed to stop ${result.failed.length}`);
|
|
27106
|
+
}
|
|
27107
|
+
if (skippedCount > 0) {
|
|
27108
|
+
parts.push(`skipped ${skippedCount} already stopped or failed`);
|
|
27109
|
+
}
|
|
27110
|
+
return `${parts.join(", ")}.`;
|
|
27111
|
+
}
|
|
27112
|
+
function runMutationStatusLabel(pending) {
|
|
27113
|
+
if (pending.starting) return "starting\u2026";
|
|
27114
|
+
if (pending.archiving) return "archiving\u2026";
|
|
27115
|
+
if (pending.stopping) return "stopping\u2026";
|
|
27116
|
+
return "restoring\u2026";
|
|
27117
|
+
}
|
|
26889
27118
|
function runArchiveActionKey(runIds) {
|
|
26890
27119
|
return runIds.join("\0");
|
|
26891
27120
|
}
|
|
@@ -26995,13 +27224,15 @@ function ContentTopBorder({ title, width }) {
|
|
|
26995
27224
|
/* @__PURE__ */ jsx14(Text14, { color: "gray", children: `${"\u2500".repeat(right)}\u2510` })
|
|
26996
27225
|
] });
|
|
26997
27226
|
}
|
|
26998
|
-
var CONNECTION_REFRESH_INTERVAL_MS, CONNECTION_REFRESH_TIMEOUT_MS,
|
|
27227
|
+
var CONNECTION_REFRESH_INTERVAL_MS, CONNECTION_REFRESH_TIMEOUT_MS, DASHBOARD_NAV_ITEMS, RESOURCES_PER_COLUMN;
|
|
26999
27228
|
var init_HomeView = __esm({
|
|
27000
27229
|
"src/tui/HomeView.tsx"() {
|
|
27001
27230
|
"use strict";
|
|
27231
|
+
init_src();
|
|
27002
27232
|
init_login();
|
|
27003
27233
|
init_base_url();
|
|
27004
27234
|
init_browser();
|
|
27235
|
+
init_resources3();
|
|
27005
27236
|
init_ApiClientContext();
|
|
27006
27237
|
init_ConnectionProvidersView();
|
|
27007
27238
|
init_ConnectionsView();
|
|
@@ -27014,12 +27245,12 @@ var init_HomeView = __esm({
|
|
|
27014
27245
|
init_string();
|
|
27015
27246
|
CONNECTION_REFRESH_INTERVAL_MS = 1500;
|
|
27016
27247
|
CONNECTION_REFRESH_TIMEOUT_MS = 9e4;
|
|
27017
|
-
|
|
27018
|
-
{ k: "1",
|
|
27248
|
+
DASHBOARD_NAV_ITEMS = [
|
|
27249
|
+
resourceNavItem({ k: "1", section: "sessions" }),
|
|
27019
27250
|
{ k: "2", label: "Runs", activeSection: "runs" },
|
|
27020
|
-
{ k: "3",
|
|
27021
|
-
{ k: "4",
|
|
27022
|
-
{ k: "5",
|
|
27251
|
+
resourceNavItem({ k: "3", section: "profiles" }),
|
|
27252
|
+
resourceNavItem({ k: "4", section: "environments" }),
|
|
27253
|
+
resourceNavItem({ k: "5", section: "tools" }),
|
|
27023
27254
|
{ k: "6", label: "Projects", activeSection: "projects" },
|
|
27024
27255
|
{ k: "7", label: "Service Accounts", activeSection: "serviceAccounts" },
|
|
27025
27256
|
{ k: "8", label: "Connections", activeSection: "connections" }
|
|
@@ -27243,48 +27474,11 @@ async function launch(opts) {
|
|
|
27243
27474
|
}
|
|
27244
27475
|
}
|
|
27245
27476
|
async function refreshEditedResource(input) {
|
|
27246
|
-
|
|
27247
|
-
|
|
27248
|
-
|
|
27249
|
-
|
|
27250
|
-
|
|
27251
|
-
input.queryClient.setQueryData(
|
|
27252
|
-
queryKeys.sessions(input.apiUrl),
|
|
27253
|
-
sortSessions(response.sessions)
|
|
27254
|
-
);
|
|
27255
|
-
return;
|
|
27256
|
-
}
|
|
27257
|
-
case "profile": {
|
|
27258
|
-
const response = await input.apiClient.listProfiles({
|
|
27259
|
-
apiBaseUrl: input.apiUrl
|
|
27260
|
-
});
|
|
27261
|
-
input.queryClient.setQueryData(
|
|
27262
|
-
queryKeys.profiles(input.apiUrl),
|
|
27263
|
-
sortByResourceName(response.profiles)
|
|
27264
|
-
);
|
|
27265
|
-
return;
|
|
27266
|
-
}
|
|
27267
|
-
case "environment": {
|
|
27268
|
-
const response = await input.apiClient.listEnvironments({
|
|
27269
|
-
apiBaseUrl: input.apiUrl
|
|
27270
|
-
});
|
|
27271
|
-
input.queryClient.setQueryData(
|
|
27272
|
-
queryKeys.environments(input.apiUrl),
|
|
27273
|
-
sortByResourceName(response.environments)
|
|
27274
|
-
);
|
|
27275
|
-
return;
|
|
27276
|
-
}
|
|
27277
|
-
case "tool": {
|
|
27278
|
-
const response = await input.apiClient.listTools({
|
|
27279
|
-
apiBaseUrl: input.apiUrl
|
|
27280
|
-
});
|
|
27281
|
-
input.queryClient.setQueryData(
|
|
27282
|
-
queryKeys.tools(input.apiUrl),
|
|
27283
|
-
sortByResourceName(response.tools)
|
|
27284
|
-
);
|
|
27285
|
-
return;
|
|
27286
|
-
}
|
|
27287
|
-
}
|
|
27477
|
+
const definition = RESOURCE_REFRESH_DEFINITIONS[input.kind];
|
|
27478
|
+
input.queryClient.setQueryData(
|
|
27479
|
+
definition.queryKey(input.apiUrl),
|
|
27480
|
+
definition.sort(await definition.list(input))
|
|
27481
|
+
);
|
|
27288
27482
|
}
|
|
27289
27483
|
function sortByResourceName(resources) {
|
|
27290
27484
|
return resources.slice().sort(
|
|
@@ -27294,9 +27488,11 @@ function sortByResourceName(resources) {
|
|
|
27294
27488
|
function isEditSelection(selection) {
|
|
27295
27489
|
return "action" in selection && selection.action === "editResource";
|
|
27296
27490
|
}
|
|
27491
|
+
var RESOURCE_REFRESH_DEFINITIONS;
|
|
27297
27492
|
var init_launcher = __esm({
|
|
27298
27493
|
"src/tui/launcher.ts"() {
|
|
27299
27494
|
"use strict";
|
|
27495
|
+
init_src();
|
|
27300
27496
|
init_actions2();
|
|
27301
27497
|
init_base_url();
|
|
27302
27498
|
init_client();
|
|
@@ -27305,6 +27501,36 @@ var init_launcher = __esm({
|
|
|
27305
27501
|
init_HomeView();
|
|
27306
27502
|
init_SplashView();
|
|
27307
27503
|
init_queries();
|
|
27504
|
+
RESOURCE_REFRESH_DEFINITIONS = {
|
|
27505
|
+
[RESOURCE_KIND_ENVIRONMENT]: {
|
|
27506
|
+
async list({ apiClient, apiUrl }) {
|
|
27507
|
+
return (await apiClient.listEnvironments({ apiBaseUrl: apiUrl })).environments;
|
|
27508
|
+
},
|
|
27509
|
+
queryKey: queryKeys.environments,
|
|
27510
|
+
sort: sortByResourceName
|
|
27511
|
+
},
|
|
27512
|
+
[RESOURCE_KIND_PROFILE]: {
|
|
27513
|
+
async list({ apiClient, apiUrl }) {
|
|
27514
|
+
return (await apiClient.listProfiles({ apiBaseUrl: apiUrl })).profiles;
|
|
27515
|
+
},
|
|
27516
|
+
queryKey: queryKeys.profiles,
|
|
27517
|
+
sort: sortByResourceName
|
|
27518
|
+
},
|
|
27519
|
+
[RESOURCE_KIND_TOOL]: {
|
|
27520
|
+
async list({ apiClient, apiUrl }) {
|
|
27521
|
+
return (await apiClient.listTools({ apiBaseUrl: apiUrl })).tools;
|
|
27522
|
+
},
|
|
27523
|
+
queryKey: queryKeys.tools,
|
|
27524
|
+
sort: sortByResourceName
|
|
27525
|
+
},
|
|
27526
|
+
[RESOURCE_KIND_SESSION]: {
|
|
27527
|
+
async list({ apiClient, apiUrl }) {
|
|
27528
|
+
return (await apiClient.listSessions({ apiBaseUrl: apiUrl })).sessions;
|
|
27529
|
+
},
|
|
27530
|
+
queryKey: queryKeys.sessions,
|
|
27531
|
+
sort: (resources) => sortSessions(resources)
|
|
27532
|
+
}
|
|
27533
|
+
};
|
|
27308
27534
|
}
|
|
27309
27535
|
});
|
|
27310
27536
|
|