@autohq/cli 0.1.82 → 0.1.84
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 +43 -10
- package/dist/index.js +121 -21
- package/package.json +1 -1
package/dist/agent-bridge.js
CHANGED
|
@@ -19605,7 +19605,6 @@ var AuthScopeSchema = external_exports.enum([
|
|
|
19605
19605
|
"environments:write",
|
|
19606
19606
|
"profiles:read",
|
|
19607
19607
|
"profiles:write",
|
|
19608
|
-
"resources:apply_dry_run",
|
|
19609
19608
|
"runs:read",
|
|
19610
19609
|
"runs:write",
|
|
19611
19610
|
"events:write",
|
|
@@ -19696,6 +19695,24 @@ var AuthWhoamiResponseSchema = external_exports.object({
|
|
|
19696
19695
|
})
|
|
19697
19696
|
}).optional()
|
|
19698
19697
|
});
|
|
19698
|
+
var SERVICE_ACCOUNT_READ_ONLY_SCOPES = [
|
|
19699
|
+
"environments:read",
|
|
19700
|
+
"profiles:read",
|
|
19701
|
+
"tools:read",
|
|
19702
|
+
"sessions:read",
|
|
19703
|
+
"runs:read"
|
|
19704
|
+
];
|
|
19705
|
+
var SERVICE_ACCOUNT_SCOPE_PRESETS = {
|
|
19706
|
+
"read-only": SERVICE_ACCOUNT_READ_ONLY_SCOPES,
|
|
19707
|
+
applier: [
|
|
19708
|
+
...SERVICE_ACCOUNT_READ_ONLY_SCOPES,
|
|
19709
|
+
"environments:write",
|
|
19710
|
+
"profiles:write",
|
|
19711
|
+
"tools:write",
|
|
19712
|
+
"sessions:write"
|
|
19713
|
+
]
|
|
19714
|
+
};
|
|
19715
|
+
var ServiceAccountScopePresetSchema = external_exports.enum(["read-only", "applier"]);
|
|
19699
19716
|
|
|
19700
19717
|
// ../../packages/schemas/src/primitives.ts
|
|
19701
19718
|
var JsonValueSchema2 = external_exports.lazy(
|
|
@@ -20867,16 +20884,12 @@ var ProjectServiceAccountSchema = external_exports.object({
|
|
|
20867
20884
|
scopes: external_exports.array(AuthScopeSchema),
|
|
20868
20885
|
createdAt: external_exports.string().datetime()
|
|
20869
20886
|
});
|
|
20870
|
-
var ProjectServiceAccountScopeInputSchema = external_exports.union([
|
|
20871
|
-
AuthScopeSchema,
|
|
20872
|
-
external_exports.literal("members:none")
|
|
20873
|
-
]);
|
|
20874
20887
|
var ProjectServiceAccountCreateRequestSchema = external_exports.object({
|
|
20875
20888
|
name: ResourceNameSchema,
|
|
20876
|
-
scopes: external_exports.array(
|
|
20889
|
+
scopes: external_exports.array(AuthScopeSchema).min(1)
|
|
20877
20890
|
});
|
|
20878
20891
|
var ProjectServiceAccountUpdateRequestSchema = external_exports.object({
|
|
20879
|
-
scopes: external_exports.array(
|
|
20892
|
+
scopes: external_exports.array(AuthScopeSchema).min(1)
|
|
20880
20893
|
});
|
|
20881
20894
|
var ProjectServiceAccountTokenResponseSchema = external_exports.object({
|
|
20882
20895
|
serviceAccount: ProjectServiceAccountSchema,
|
|
@@ -21767,7 +21780,8 @@ var SESSION_RUN_DISPATCH_COMMAND_KINDS = [
|
|
|
21767
21780
|
"start",
|
|
21768
21781
|
"startWithMessage",
|
|
21769
21782
|
"message",
|
|
21770
|
-
"answer"
|
|
21783
|
+
"answer",
|
|
21784
|
+
"stop"
|
|
21771
21785
|
];
|
|
21772
21786
|
var SESSION_RUN_PERSISTED_COMMAND_KINDS = [
|
|
21773
21787
|
...SESSION_RUN_COMMAND_KINDS,
|
|
@@ -21972,13 +21986,18 @@ var SessionRunDispatchAnswerCommandPayloadSchema = external_exports.object({
|
|
|
21972
21986
|
answers: external_exports.record(external_exports.string(), external_exports.string()),
|
|
21973
21987
|
response: external_exports.string().trim().min(1).optional()
|
|
21974
21988
|
}).strict();
|
|
21989
|
+
var SessionRunDispatchStopCommandPayloadSchema = external_exports.object({
|
|
21990
|
+
kind: external_exports.literal("stop"),
|
|
21991
|
+
reason: external_exports.string().trim().min(1).optional()
|
|
21992
|
+
}).strict();
|
|
21975
21993
|
var SessionRunDispatchCommandPayloadSchema = external_exports.discriminatedUnion(
|
|
21976
21994
|
"kind",
|
|
21977
21995
|
[
|
|
21978
21996
|
SessionRunStartCommandPayloadSchema,
|
|
21979
21997
|
SessionRunStartWithMessageCommandPayloadSchema,
|
|
21980
21998
|
SessionRunDispatchMessageCommandPayloadSchema,
|
|
21981
|
-
SessionRunDispatchAnswerCommandPayloadSchema
|
|
21999
|
+
SessionRunDispatchAnswerCommandPayloadSchema,
|
|
22000
|
+
SessionRunDispatchStopCommandPayloadSchema
|
|
21982
22001
|
]
|
|
21983
22002
|
);
|
|
21984
22003
|
var SessionRunDispatchCommandRecordBaseSchema = external_exports.object({
|
|
@@ -22014,6 +22033,10 @@ var SessionRunDispatchCommandRecordSchema = external_exports.discriminatedUnion(
|
|
|
22014
22033
|
SessionRunDispatchCommandRecordBaseSchema.extend({
|
|
22015
22034
|
kind: external_exports.literal("answer"),
|
|
22016
22035
|
payload: SessionRunDispatchAnswerCommandPayloadSchema
|
|
22036
|
+
}),
|
|
22037
|
+
SessionRunDispatchCommandRecordBaseSchema.extend({
|
|
22038
|
+
kind: external_exports.literal("stop"),
|
|
22039
|
+
payload: SessionRunDispatchStopCommandPayloadSchema
|
|
22017
22040
|
})
|
|
22018
22041
|
]
|
|
22019
22042
|
);
|
|
@@ -22040,7 +22063,8 @@ var SESSION_RUN_STATUSES = [
|
|
|
22040
22063
|
"queued",
|
|
22041
22064
|
"running",
|
|
22042
22065
|
"awaiting",
|
|
22043
|
-
"failed"
|
|
22066
|
+
"failed",
|
|
22067
|
+
"stopped"
|
|
22044
22068
|
];
|
|
22045
22069
|
var SESSION_RUN_DISPLAY_TITLE_MAX_LENGTH = 64;
|
|
22046
22070
|
var SessionRunStatusSchema = external_exports.enum(SESSION_RUN_STATUSES);
|
|
@@ -46385,6 +46409,15 @@ var ClaudeCodeCommandHandler = class {
|
|
|
46385
46409
|
if (delivery.kind === "answer") {
|
|
46386
46410
|
return this.handleAnswerCommand(delivery, activeContext, socketId);
|
|
46387
46411
|
}
|
|
46412
|
+
if (delivery.kind === "stop") {
|
|
46413
|
+
this.injectedCommands.add(delivery.commandId);
|
|
46414
|
+
this.shutdown();
|
|
46415
|
+
return commandAck({
|
|
46416
|
+
delivery,
|
|
46417
|
+
socketId,
|
|
46418
|
+
status: "injected"
|
|
46419
|
+
});
|
|
46420
|
+
}
|
|
46388
46421
|
if (delivery.kind !== "message") {
|
|
46389
46422
|
return commandAck({
|
|
46390
46423
|
delivery,
|
package/dist/index.js
CHANGED
|
@@ -15196,7 +15196,7 @@ var init_ids = __esm({
|
|
|
15196
15196
|
});
|
|
15197
15197
|
|
|
15198
15198
|
// ../../packages/schemas/src/auth.ts
|
|
15199
|
-
var AuthRoleSchema, AuthIdentityProviderSchema, AuthScopeSchema, AUTH_SCOPES, PrincipalSchema, AuthClientSchema, AuthActorSchema, AuthContextSchema, AuthWhoamiResponseSchema;
|
|
15199
|
+
var AuthRoleSchema, AuthIdentityProviderSchema, AuthScopeSchema, AUTH_SCOPES, PrincipalSchema, AuthClientSchema, AuthActorSchema, AuthContextSchema, AuthWhoamiResponseSchema, SERVICE_ACCOUNT_READ_ONLY_SCOPES, SERVICE_ACCOUNT_SCOPE_PRESETS, ServiceAccountScopePresetSchema;
|
|
15200
15200
|
var init_auth = __esm({
|
|
15201
15201
|
"../../packages/schemas/src/auth.ts"() {
|
|
15202
15202
|
"use strict";
|
|
@@ -15213,7 +15213,6 @@ var init_auth = __esm({
|
|
|
15213
15213
|
"environments:write",
|
|
15214
15214
|
"profiles:read",
|
|
15215
15215
|
"profiles:write",
|
|
15216
|
-
"resources:apply_dry_run",
|
|
15217
15216
|
"runs:read",
|
|
15218
15217
|
"runs:write",
|
|
15219
15218
|
"events:write",
|
|
@@ -15304,6 +15303,24 @@ var init_auth = __esm({
|
|
|
15304
15303
|
})
|
|
15305
15304
|
}).optional()
|
|
15306
15305
|
});
|
|
15306
|
+
SERVICE_ACCOUNT_READ_ONLY_SCOPES = [
|
|
15307
|
+
"environments:read",
|
|
15308
|
+
"profiles:read",
|
|
15309
|
+
"tools:read",
|
|
15310
|
+
"sessions:read",
|
|
15311
|
+
"runs:read"
|
|
15312
|
+
];
|
|
15313
|
+
SERVICE_ACCOUNT_SCOPE_PRESETS = {
|
|
15314
|
+
"read-only": SERVICE_ACCOUNT_READ_ONLY_SCOPES,
|
|
15315
|
+
applier: [
|
|
15316
|
+
...SERVICE_ACCOUNT_READ_ONLY_SCOPES,
|
|
15317
|
+
"environments:write",
|
|
15318
|
+
"profiles:write",
|
|
15319
|
+
"tools:write",
|
|
15320
|
+
"sessions:write"
|
|
15321
|
+
]
|
|
15322
|
+
};
|
|
15323
|
+
ServiceAccountScopePresetSchema = external_exports.enum(["read-only", "applier"]);
|
|
15307
15324
|
}
|
|
15308
15325
|
});
|
|
15309
15326
|
|
|
@@ -16646,7 +16663,7 @@ var init_mounts = __esm({
|
|
|
16646
16663
|
});
|
|
16647
16664
|
|
|
16648
16665
|
// ../../packages/schemas/src/project-service-accounts.ts
|
|
16649
|
-
var ProjectServiceAccountSchema,
|
|
16666
|
+
var ProjectServiceAccountSchema, ProjectServiceAccountCreateRequestSchema, ProjectServiceAccountUpdateRequestSchema, ProjectServiceAccountTokenResponseSchema, ProjectServiceAccountUpdateResponseSchema, ProjectServiceAccountRemoveResponseSchema, ProjectServiceAccountListResponseSchema;
|
|
16650
16667
|
var init_project_service_accounts = __esm({
|
|
16651
16668
|
"../../packages/schemas/src/project-service-accounts.ts"() {
|
|
16652
16669
|
"use strict";
|
|
@@ -16662,16 +16679,12 @@ var init_project_service_accounts = __esm({
|
|
|
16662
16679
|
scopes: external_exports.array(AuthScopeSchema),
|
|
16663
16680
|
createdAt: external_exports.string().datetime()
|
|
16664
16681
|
});
|
|
16665
|
-
ProjectServiceAccountScopeInputSchema = external_exports.union([
|
|
16666
|
-
AuthScopeSchema,
|
|
16667
|
-
external_exports.literal("members:none")
|
|
16668
|
-
]);
|
|
16669
16682
|
ProjectServiceAccountCreateRequestSchema = external_exports.object({
|
|
16670
16683
|
name: ResourceNameSchema,
|
|
16671
|
-
scopes: external_exports.array(
|
|
16684
|
+
scopes: external_exports.array(AuthScopeSchema).min(1)
|
|
16672
16685
|
});
|
|
16673
16686
|
ProjectServiceAccountUpdateRequestSchema = external_exports.object({
|
|
16674
|
-
scopes: external_exports.array(
|
|
16687
|
+
scopes: external_exports.array(AuthScopeSchema).min(1)
|
|
16675
16688
|
});
|
|
16676
16689
|
ProjectServiceAccountTokenResponseSchema = external_exports.object({
|
|
16677
16690
|
serviceAccount: ProjectServiceAccountSchema,
|
|
@@ -17622,7 +17635,7 @@ var init_run_diagnostics = __esm({
|
|
|
17622
17635
|
});
|
|
17623
17636
|
|
|
17624
17637
|
// ../../packages/schemas/src/session-run-commands.ts
|
|
17625
|
-
var SESSION_RUN_COMMAND_KINDS, SESSION_RUN_DISPATCH_COMMAND_KINDS, SESSION_RUN_PERSISTED_COMMAND_KINDS, SESSION_RUN_LIFECYCLE_COMMAND_KINDS, SESSION_RUN_COMMAND_STATUSES, SESSION_RUN_DISPATCH_COMMAND_STATUSES, SessionRunCommandKindSchema2, SessionRunPersistedCommandKindSchema, SessionRunDispatchCommandKindSchema, SessionRunLifecycleCommandKindSchema, SessionRunCommandStatusSchema, SessionRunDispatchCommandStatusSchema, SessionRunCommandSenderSchema, SessionRunMessageCommandPayloadSchema, SessionRunAnswerCommandPayloadSchema, SessionRunLifecycleCommandPayloadSchema, SessionRunCommandPayloadSchema, CreateSessionRunMessageCommandRequestSchema, CreateSessionRunAnswerCommandRequestSchema, CreateSessionRunLifecycleCommandRequestSchema, CreateSessionRunCommandRequestSchema, SessionRunResolutionPolicySchema, SessionAddressedCommandTargetSchema, SessionRunCommandRecordBaseSchema, SessionRunStartCommandPayloadSchema, SessionRunStartWithMessageCommandPayloadSchema, SessionRunPersistedCommandPayloadSchema, SessionRunCommandRecordSchema, SessionRunDispatchMessageCommandPayloadSchema, SessionRunDispatchAnswerCommandPayloadSchema, SessionRunDispatchCommandPayloadSchema, SessionRunDispatchCommandRecordBaseSchema, SessionRunDispatchCommandRecordSchema;
|
|
17638
|
+
var SESSION_RUN_COMMAND_KINDS, SESSION_RUN_DISPATCH_COMMAND_KINDS, SESSION_RUN_PERSISTED_COMMAND_KINDS, SESSION_RUN_LIFECYCLE_COMMAND_KINDS, SESSION_RUN_COMMAND_STATUSES, SESSION_RUN_DISPATCH_COMMAND_STATUSES, SessionRunCommandKindSchema2, SessionRunPersistedCommandKindSchema, SessionRunDispatchCommandKindSchema, SessionRunLifecycleCommandKindSchema, SessionRunCommandStatusSchema, SessionRunDispatchCommandStatusSchema, SessionRunCommandSenderSchema, SessionRunMessageCommandPayloadSchema, SessionRunAnswerCommandPayloadSchema, SessionRunLifecycleCommandPayloadSchema, SessionRunCommandPayloadSchema, CreateSessionRunMessageCommandRequestSchema, CreateSessionRunAnswerCommandRequestSchema, CreateSessionRunLifecycleCommandRequestSchema, CreateSessionRunCommandRequestSchema, SessionRunResolutionPolicySchema, SessionAddressedCommandTargetSchema, SessionRunCommandRecordBaseSchema, SessionRunStartCommandPayloadSchema, SessionRunStartWithMessageCommandPayloadSchema, SessionRunPersistedCommandPayloadSchema, SessionRunCommandRecordSchema, SessionRunDispatchMessageCommandPayloadSchema, SessionRunDispatchAnswerCommandPayloadSchema, SessionRunDispatchStopCommandPayloadSchema, SessionRunDispatchCommandPayloadSchema, SessionRunDispatchCommandRecordBaseSchema, SessionRunDispatchCommandRecordSchema;
|
|
17626
17639
|
var init_session_run_commands = __esm({
|
|
17627
17640
|
"../../packages/schemas/src/session-run-commands.ts"() {
|
|
17628
17641
|
"use strict";
|
|
@@ -17643,7 +17656,8 @@ var init_session_run_commands = __esm({
|
|
|
17643
17656
|
"start",
|
|
17644
17657
|
"startWithMessage",
|
|
17645
17658
|
"message",
|
|
17646
|
-
"answer"
|
|
17659
|
+
"answer",
|
|
17660
|
+
"stop"
|
|
17647
17661
|
];
|
|
17648
17662
|
SESSION_RUN_PERSISTED_COMMAND_KINDS = [
|
|
17649
17663
|
...SESSION_RUN_COMMAND_KINDS,
|
|
@@ -17848,13 +17862,18 @@ var init_session_run_commands = __esm({
|
|
|
17848
17862
|
answers: external_exports.record(external_exports.string(), external_exports.string()),
|
|
17849
17863
|
response: external_exports.string().trim().min(1).optional()
|
|
17850
17864
|
}).strict();
|
|
17865
|
+
SessionRunDispatchStopCommandPayloadSchema = external_exports.object({
|
|
17866
|
+
kind: external_exports.literal("stop"),
|
|
17867
|
+
reason: external_exports.string().trim().min(1).optional()
|
|
17868
|
+
}).strict();
|
|
17851
17869
|
SessionRunDispatchCommandPayloadSchema = external_exports.discriminatedUnion(
|
|
17852
17870
|
"kind",
|
|
17853
17871
|
[
|
|
17854
17872
|
SessionRunStartCommandPayloadSchema,
|
|
17855
17873
|
SessionRunStartWithMessageCommandPayloadSchema,
|
|
17856
17874
|
SessionRunDispatchMessageCommandPayloadSchema,
|
|
17857
|
-
SessionRunDispatchAnswerCommandPayloadSchema
|
|
17875
|
+
SessionRunDispatchAnswerCommandPayloadSchema,
|
|
17876
|
+
SessionRunDispatchStopCommandPayloadSchema
|
|
17858
17877
|
]
|
|
17859
17878
|
);
|
|
17860
17879
|
SessionRunDispatchCommandRecordBaseSchema = external_exports.object({
|
|
@@ -17890,6 +17909,10 @@ var init_session_run_commands = __esm({
|
|
|
17890
17909
|
SessionRunDispatchCommandRecordBaseSchema.extend({
|
|
17891
17910
|
kind: external_exports.literal("answer"),
|
|
17892
17911
|
payload: SessionRunDispatchAnswerCommandPayloadSchema
|
|
17912
|
+
}),
|
|
17913
|
+
SessionRunDispatchCommandRecordBaseSchema.extend({
|
|
17914
|
+
kind: external_exports.literal("stop"),
|
|
17915
|
+
payload: SessionRunDispatchStopCommandPayloadSchema
|
|
17893
17916
|
})
|
|
17894
17917
|
]
|
|
17895
17918
|
);
|
|
@@ -17938,7 +17961,8 @@ var init_session_runs = __esm({
|
|
|
17938
17961
|
"queued",
|
|
17939
17962
|
"running",
|
|
17940
17963
|
"awaiting",
|
|
17941
|
-
"failed"
|
|
17964
|
+
"failed",
|
|
17965
|
+
"stopped"
|
|
17942
17966
|
];
|
|
17943
17967
|
SESSION_RUN_DISPLAY_TITLE_MAX_LENGTH = 64;
|
|
17944
17968
|
SessionRunStatusSchema = external_exports.enum(SESSION_RUN_STATUSES);
|
|
@@ -19632,7 +19656,7 @@ function createApiClient(input) {
|
|
|
19632
19656
|
},
|
|
19633
19657
|
body: JSON.stringify({
|
|
19634
19658
|
kind: "stop",
|
|
19635
|
-
payload: {}
|
|
19659
|
+
payload: options.reason ? { reason: options.reason } : {}
|
|
19636
19660
|
})
|
|
19637
19661
|
},
|
|
19638
19662
|
options.apiBaseUrl
|
|
@@ -21103,7 +21127,7 @@ var init_package = __esm({
|
|
|
21103
21127
|
"package.json"() {
|
|
21104
21128
|
package_default = {
|
|
21105
21129
|
name: "@autohq/cli",
|
|
21106
|
-
version: "0.1.
|
|
21130
|
+
version: "0.1.84",
|
|
21107
21131
|
license: "SEE LICENSE IN README.md",
|
|
21108
21132
|
publishConfig: {
|
|
21109
21133
|
access: "public"
|
|
@@ -23617,7 +23641,11 @@ function useCreateServiceAccount(apiUrl) {
|
|
|
23617
23641
|
const client = useApiClient();
|
|
23618
23642
|
const queryClient = useQueryClient();
|
|
23619
23643
|
return useMutation({
|
|
23620
|
-
mutationFn: (name) => client.createProjectServiceAccount(
|
|
23644
|
+
mutationFn: (name) => client.createProjectServiceAccount(
|
|
23645
|
+
// The TUI has no scope picker yet; mint with the applier preset.
|
|
23646
|
+
{ name, scopes: [...SERVICE_ACCOUNT_SCOPE_PRESETS.applier] },
|
|
23647
|
+
{ apiBaseUrl: apiUrl }
|
|
23648
|
+
),
|
|
23621
23649
|
onSuccess: () => queryClient.invalidateQueries({
|
|
23622
23650
|
queryKey: queryKeys.serviceAccounts(apiUrl)
|
|
23623
23651
|
})
|
|
@@ -23916,6 +23944,7 @@ var queryKeys, RUNS_REFETCH_INTERVAL_MS;
|
|
|
23916
23944
|
var init_queries = __esm({
|
|
23917
23945
|
"src/tui/hooks/queries.ts"() {
|
|
23918
23946
|
"use strict";
|
|
23947
|
+
init_src();
|
|
23919
23948
|
init_ApiClientContext();
|
|
23920
23949
|
queryKeys = {
|
|
23921
23950
|
environments: (apiUrl) => ["environments", apiUrl],
|
|
@@ -27581,6 +27610,15 @@ var ClaudeCodeCommandHandler = class {
|
|
|
27581
27610
|
if (delivery.kind === "answer") {
|
|
27582
27611
|
return this.handleAnswerCommand(delivery, activeContext, socketId);
|
|
27583
27612
|
}
|
|
27613
|
+
if (delivery.kind === "stop") {
|
|
27614
|
+
this.injectedCommands.add(delivery.commandId);
|
|
27615
|
+
this.shutdown();
|
|
27616
|
+
return commandAck({
|
|
27617
|
+
delivery,
|
|
27618
|
+
socketId,
|
|
27619
|
+
status: "injected"
|
|
27620
|
+
});
|
|
27621
|
+
}
|
|
27584
27622
|
if (delivery.kind !== "message") {
|
|
27585
27623
|
return commandAck({
|
|
27586
27624
|
delivery,
|
|
@@ -29899,6 +29937,32 @@ async function unarchiveRunsAction(context, runIds, commandOptions) {
|
|
|
29899
29937
|
context.writeOutput(`run_id ${run.id} archived ${Boolean(run.archivedAt)}`);
|
|
29900
29938
|
}
|
|
29901
29939
|
}
|
|
29940
|
+
async function stopRunsAction(context, runIds, commandOptions) {
|
|
29941
|
+
const client = createRunServiceClient(context);
|
|
29942
|
+
const apiBaseUrl = apiUrlFromOptions(context, commandOptions);
|
|
29943
|
+
const failedRunIds = [];
|
|
29944
|
+
for (const runId of runIds) {
|
|
29945
|
+
try {
|
|
29946
|
+
const command = await client.stopRun(runId, {
|
|
29947
|
+
apiBaseUrl,
|
|
29948
|
+
reason: commandOptions.reason
|
|
29949
|
+
});
|
|
29950
|
+
context.writeOutput(
|
|
29951
|
+
`run_id ${runId} command_id ${command.command_id} status ${command.status}`
|
|
29952
|
+
);
|
|
29953
|
+
} catch (error51) {
|
|
29954
|
+
failedRunIds.push(runId);
|
|
29955
|
+
context.writeOutput(
|
|
29956
|
+
`run_id ${runId} error ${error51 instanceof Error ? error51.message : String(error51)}`
|
|
29957
|
+
);
|
|
29958
|
+
}
|
|
29959
|
+
}
|
|
29960
|
+
if (failedRunIds.length > 0) {
|
|
29961
|
+
throw new Error(
|
|
29962
|
+
`Failed to stop ${failedRunIds.length} of ${runIds.length} run(s): ${failedRunIds.join(", ")}`
|
|
29963
|
+
);
|
|
29964
|
+
}
|
|
29965
|
+
}
|
|
29902
29966
|
async function consoleRunAction(context, runId, commandOptions) {
|
|
29903
29967
|
await runConsole({
|
|
29904
29968
|
client: createRunServiceClient(context),
|
|
@@ -30197,6 +30261,9 @@ function registerRunCommands(program, context) {
|
|
|
30197
30261
|
}
|
|
30198
30262
|
await unarchiveRunsAction(context, runIds, commandOptions);
|
|
30199
30263
|
});
|
|
30264
|
+
runs.command("stop").description("Stop live runs and shut down their agent sessions.").argument("<run-ids...>", "run id(s)").option("--reason <reason>", "reason recorded with the stop").option("--api-url <url>", "Auto API base URL").option("--api-base-url <url>", "Auto API base URL").action(async (runIds, commandOptions) => {
|
|
30265
|
+
await stopRunsAction(context, runIds, commandOptions);
|
|
30266
|
+
});
|
|
30200
30267
|
runs.command("benchmark-startup").description("Launch a session run and measure time until awaiting.").requiredOption("--session <name>", "session name").option("-m, --message <message>", "initial message for the run").option(
|
|
30201
30268
|
"--interactive",
|
|
30202
30269
|
"start without the default initial prompt unless --message is provided"
|
|
@@ -30387,16 +30454,17 @@ function withApiBaseUrl(context, commandOptions) {
|
|
|
30387
30454
|
}
|
|
30388
30455
|
|
|
30389
30456
|
// src/commands/service-accounts/actions.ts
|
|
30457
|
+
init_src();
|
|
30390
30458
|
async function createServiceAccount(input) {
|
|
30391
30459
|
const response = await input.client.createProjectServiceAccount(
|
|
30392
|
-
{ name: input.name, scopes: input.commandOptions
|
|
30460
|
+
{ name: input.name, scopes: requestedScopes(input.commandOptions) },
|
|
30393
30461
|
{ apiBaseUrl: input.commandOptions.apiBaseUrl }
|
|
30394
30462
|
);
|
|
30395
30463
|
writeServiceAccountTokenResponse(response, input);
|
|
30396
30464
|
}
|
|
30397
30465
|
async function updateServiceAccount(input) {
|
|
30398
30466
|
const response = await input.client.updateProjectServiceAccount(
|
|
30399
|
-
{ name: input.name, scopes: input.commandOptions
|
|
30467
|
+
{ name: input.name, scopes: requestedScopes(input.commandOptions) },
|
|
30400
30468
|
{ apiBaseUrl: input.commandOptions.apiBaseUrl }
|
|
30401
30469
|
);
|
|
30402
30470
|
if (input.commandOptions.json) {
|
|
@@ -30423,6 +30491,33 @@ async function removeServiceAccount(input) {
|
|
|
30423
30491
|
}
|
|
30424
30492
|
input.writeOutput(`removed service-account ${response.serviceAccount.name}`);
|
|
30425
30493
|
}
|
|
30494
|
+
function requestedScopes(options) {
|
|
30495
|
+
const presetNames = Object.keys(SERVICE_ACCOUNT_SCOPE_PRESETS).join(", ");
|
|
30496
|
+
const scopes = [];
|
|
30497
|
+
if (options.preset !== void 0) {
|
|
30498
|
+
const preset = ServiceAccountScopePresetSchema.safeParse(options.preset);
|
|
30499
|
+
if (!preset.success) {
|
|
30500
|
+
throw new Error(
|
|
30501
|
+
`Unknown preset "${options.preset}". Available presets: ${presetNames}.`
|
|
30502
|
+
);
|
|
30503
|
+
}
|
|
30504
|
+
scopes.push(...SERVICE_ACCOUNT_SCOPE_PRESETS[preset.data]);
|
|
30505
|
+
}
|
|
30506
|
+
for (const scope of options.scope ?? []) {
|
|
30507
|
+
if (!AuthScopeSchema.safeParse(scope).success) {
|
|
30508
|
+
throw new Error(
|
|
30509
|
+
`Unknown scope "${scope}". Valid scopes: ${AUTH_SCOPES.join(", ")}.`
|
|
30510
|
+
);
|
|
30511
|
+
}
|
|
30512
|
+
scopes.push(scope);
|
|
30513
|
+
}
|
|
30514
|
+
if (scopes.length === 0) {
|
|
30515
|
+
throw new Error(
|
|
30516
|
+
`Provide --preset <preset> (${presetNames}) or at least one --scope.`
|
|
30517
|
+
);
|
|
30518
|
+
}
|
|
30519
|
+
return [...new Set(scopes)];
|
|
30520
|
+
}
|
|
30426
30521
|
function writeServiceAccountTokenResponse(response, input) {
|
|
30427
30522
|
if (input.commandOptions.json) {
|
|
30428
30523
|
input.writeOutput(JSON.stringify(response));
|
|
@@ -30445,6 +30540,9 @@ function writeServiceAccountScopesResponse(response, writeOutput) {
|
|
|
30445
30540
|
function registerServiceAccountCommands(program, context) {
|
|
30446
30541
|
const serviceAccount = program.command("service-account").description("Manage Auto project service accounts.");
|
|
30447
30542
|
serviceAccount.command("create").description("Create a project service account and print its token.").argument("<name>", "service account name").option(
|
|
30543
|
+
"--preset <preset>",
|
|
30544
|
+
"grant a named scope bundle (read-only, applier)"
|
|
30545
|
+
).option(
|
|
30448
30546
|
"--scope <scope>",
|
|
30449
30547
|
"grant a scope; repeat to grant multiple scopes",
|
|
30450
30548
|
collectScopes
|
|
@@ -30458,11 +30556,13 @@ function registerServiceAccountCommands(program, context) {
|
|
|
30458
30556
|
});
|
|
30459
30557
|
}
|
|
30460
30558
|
);
|
|
30461
|
-
serviceAccount.command("update").description("Update project service account scopes.").argument("<name>", "service account name").
|
|
30559
|
+
serviceAccount.command("update").description("Update project service account scopes.").argument("<name>", "service account name").option(
|
|
30560
|
+
"--preset <preset>",
|
|
30561
|
+
"grant a named scope bundle (read-only, applier)"
|
|
30562
|
+
).option(
|
|
30462
30563
|
"--scope <scope>",
|
|
30463
30564
|
"grant a scope; repeat to grant multiple scopes",
|
|
30464
|
-
collectScopes
|
|
30465
|
-
[]
|
|
30565
|
+
collectScopes
|
|
30466
30566
|
).option("--json", "print the updated service account as JSON").option("--api-url <url>", "Auto API base URL").option("--api-base-url <url>", "Auto API base URL").action(
|
|
30467
30567
|
async (name, commandOptions) => {
|
|
30468
30568
|
await updateServiceAccount({
|