@autohq/cli 0.1.562 → 0.1.564
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 +123 -22
- package/dist/index.js +530 -24
- package/package.json +1 -1
package/dist/agent-bridge.js
CHANGED
|
@@ -30870,7 +30870,7 @@ Object.assign(lookup, {
|
|
|
30870
30870
|
// package.json
|
|
30871
30871
|
var package_default = {
|
|
30872
30872
|
name: "@autohq/cli",
|
|
30873
|
-
version: "0.1.
|
|
30873
|
+
version: "0.1.564",
|
|
30874
30874
|
license: "SEE LICENSE IN README.md",
|
|
30875
30875
|
publishConfig: {
|
|
30876
30876
|
access: "public"
|
|
@@ -30973,7 +30973,8 @@ var AgentBridgeOutputAckTimeoutError = class extends Error {
|
|
|
30973
30973
|
this.name = "AgentBridgeOutputAckTimeoutError";
|
|
30974
30974
|
}
|
|
30975
30975
|
};
|
|
30976
|
-
var
|
|
30976
|
+
var AGENT_BRIDGE_TERMINAL_AUTH_DRAIN_NO_PROGRESS_TIMEOUT_MS = 6e4;
|
|
30977
|
+
var AGENT_BRIDGE_TERMINAL_AUTH_DRAIN_ABSOLUTE_TIMEOUT_MS = 30 * 6e4;
|
|
30977
30978
|
var AGENT_BRIDGE_TERMINAL_AUTH_DRAIN_REDIAL_MS = 1e3;
|
|
30978
30979
|
async function runAgentBridgeSocket(options) {
|
|
30979
30980
|
const socket = lookup(`${options.bridgeUrl}${RUNTIME_BRIDGE_NAMESPACE}`, {
|
|
@@ -31050,6 +31051,7 @@ async function runAgentBridgeSocket(options) {
|
|
|
31050
31051
|
onBootstrap: options.onBootstrap,
|
|
31051
31052
|
createHandler: (bootstrap) => options.createHandler({
|
|
31052
31053
|
emitOutput: (output) => emitOutputWithAck(socket, output, options.runtimeLogger),
|
|
31054
|
+
onOutputAckProgress: terminalAuthDrain.handleOutputAckProgress,
|
|
31053
31055
|
cycleSocket: () => {
|
|
31054
31056
|
options.writeOutput?.(
|
|
31055
31057
|
"agent_bridge_socket_cycle reason=output_ack_retries_exhausted"
|
|
@@ -31336,7 +31338,12 @@ function createTerminalAuthDrainController(input) {
|
|
|
31336
31338
|
if (!current) {
|
|
31337
31339
|
return;
|
|
31338
31340
|
}
|
|
31339
|
-
|
|
31341
|
+
if (current.absoluteTimeout) {
|
|
31342
|
+
clearTimeout(current.absoluteTimeout);
|
|
31343
|
+
}
|
|
31344
|
+
if (current.noProgressTimeout) {
|
|
31345
|
+
clearTimeout(current.noProgressTimeout);
|
|
31346
|
+
}
|
|
31340
31347
|
if (current.redialTimer) {
|
|
31341
31348
|
clearTimeout(current.redialTimer);
|
|
31342
31349
|
}
|
|
@@ -31362,6 +31369,34 @@ function createTerminalAuthDrainController(input) {
|
|
|
31362
31369
|
context
|
|
31363
31370
|
);
|
|
31364
31371
|
};
|
|
31372
|
+
const timeoutDrain = (current, input2) => {
|
|
31373
|
+
if (state !== current) {
|
|
31374
|
+
return;
|
|
31375
|
+
}
|
|
31376
|
+
logDroppedPendingOutputs(input2.reason);
|
|
31377
|
+
settle(() => current.reject(new Error(input2.error)));
|
|
31378
|
+
};
|
|
31379
|
+
const scheduleNoProgressTimeout = (current) => {
|
|
31380
|
+
if (current.noProgressTimeout) {
|
|
31381
|
+
clearTimeout(current.noProgressTimeout);
|
|
31382
|
+
}
|
|
31383
|
+
current.noProgressTimeout = setTimeout(() => {
|
|
31384
|
+
timeoutDrain(current, {
|
|
31385
|
+
reason: "drain_no_progress_timeout",
|
|
31386
|
+
error: `Timed out draining pending bridge output after terminal auth with no output ack progress for ${AGENT_BRIDGE_TERMINAL_AUTH_DRAIN_NO_PROGRESS_TIMEOUT_MS}ms`
|
|
31387
|
+
});
|
|
31388
|
+
}, AGENT_BRIDGE_TERMINAL_AUTH_DRAIN_NO_PROGRESS_TIMEOUT_MS);
|
|
31389
|
+
current.noProgressTimeout.unref?.();
|
|
31390
|
+
};
|
|
31391
|
+
const scheduleAbsoluteTimeout = (current) => {
|
|
31392
|
+
current.absoluteTimeout = setTimeout(() => {
|
|
31393
|
+
timeoutDrain(current, {
|
|
31394
|
+
reason: "drain_absolute_timeout",
|
|
31395
|
+
error: `Timed out draining pending bridge output after terminal auth at the ${AGENT_BRIDGE_TERMINAL_AUTH_DRAIN_ABSOLUTE_TIMEOUT_MS}ms absolute safety bound`
|
|
31396
|
+
});
|
|
31397
|
+
}, AGENT_BRIDGE_TERMINAL_AUTH_DRAIN_ABSOLUTE_TIMEOUT_MS);
|
|
31398
|
+
current.absoluteTimeout.unref?.();
|
|
31399
|
+
};
|
|
31365
31400
|
const scheduleRedial = () => {
|
|
31366
31401
|
const current = state;
|
|
31367
31402
|
if (!current || current.redialTimer) {
|
|
@@ -31401,25 +31436,18 @@ function createTerminalAuthDrainController(input) {
|
|
|
31401
31436
|
resolveDrain = resolve4;
|
|
31402
31437
|
rejectDrain = reject;
|
|
31403
31438
|
});
|
|
31404
|
-
const
|
|
31405
|
-
|
|
31406
|
-
|
|
31407
|
-
rejectDrain(
|
|
31408
|
-
new Error(
|
|
31409
|
-
`Timed out draining pending bridge output after terminal auth in ${AGENT_BRIDGE_TERMINAL_AUTH_DRAIN_TIMEOUT_MS}ms`
|
|
31410
|
-
)
|
|
31411
|
-
);
|
|
31412
|
-
});
|
|
31413
|
-
}, AGENT_BRIDGE_TERMINAL_AUTH_DRAIN_TIMEOUT_MS);
|
|
31414
|
-
timeout.unref?.();
|
|
31415
|
-
state = {
|
|
31439
|
+
const current = {
|
|
31440
|
+
absoluteTimeout: null,
|
|
31441
|
+
noProgressTimeout: null,
|
|
31416
31442
|
promise: promise2,
|
|
31417
31443
|
redialTimer: null,
|
|
31418
31444
|
reject: rejectDrain,
|
|
31419
31445
|
resolve: resolveDrain,
|
|
31420
|
-
startedAt
|
|
31421
|
-
timeout
|
|
31446
|
+
startedAt
|
|
31422
31447
|
};
|
|
31448
|
+
state = current;
|
|
31449
|
+
scheduleNoProgressTimeout(current);
|
|
31450
|
+
scheduleAbsoluteTimeout(current);
|
|
31423
31451
|
input.writeOutput?.("agent_bridge_terminal_auth_drain_started");
|
|
31424
31452
|
input.runtimeLogger?.warn("agent_bridge_terminal_auth_drain_started");
|
|
31425
31453
|
input.socket.auth = { token: input.token, terminalDrain: true };
|
|
@@ -31487,11 +31515,20 @@ function createTerminalAuthDrainController(input) {
|
|
|
31487
31515
|
}
|
|
31488
31516
|
return terminalAuthExit;
|
|
31489
31517
|
};
|
|
31518
|
+
const handleOutputAckProgress = () => {
|
|
31519
|
+
const current = state;
|
|
31520
|
+
if (!current) {
|
|
31521
|
+
return false;
|
|
31522
|
+
}
|
|
31523
|
+
scheduleNoProgressTimeout(current);
|
|
31524
|
+
return true;
|
|
31525
|
+
};
|
|
31490
31526
|
return {
|
|
31491
31527
|
begin,
|
|
31492
31528
|
handleConnected,
|
|
31493
31529
|
handleConnectError,
|
|
31494
31530
|
handleDisconnect,
|
|
31531
|
+
handleOutputAckProgress,
|
|
31495
31532
|
suppressesReconnect: () => terminalAuthExit || state !== null
|
|
31496
31533
|
};
|
|
31497
31534
|
}
|
|
@@ -31820,6 +31857,7 @@ var AuthScopeSchema = external_exports.enum([
|
|
|
31820
31857
|
"project_members:read",
|
|
31821
31858
|
"tasks:read",
|
|
31822
31859
|
"tasks:write",
|
|
31860
|
+
"task_management:write",
|
|
31823
31861
|
"billing:read",
|
|
31824
31862
|
"billing:write",
|
|
31825
31863
|
"secrets:read",
|
|
@@ -31959,6 +31997,16 @@ var SERVICE_ACCOUNT_SCOPE_PRESETS = {
|
|
|
31959
31997
|
};
|
|
31960
31998
|
var ServiceAccountScopePresetSchema = external_exports.enum(["read-only", "applier"]);
|
|
31961
31999
|
|
|
32000
|
+
// ../../packages/schemas/src/archive-policy.ts
|
|
32001
|
+
var DEFAULT_AUTO_ARCHIVE_AFTER_SECONDS = 24 * 60 * 60;
|
|
32002
|
+
var AutoArchivePolicySchema = external_exports.discriminatedUnion("mode", [
|
|
32003
|
+
external_exports.object({ mode: external_exports.literal("off") }).strict(),
|
|
32004
|
+
external_exports.object({
|
|
32005
|
+
mode: external_exports.literal("after"),
|
|
32006
|
+
seconds: external_exports.number().int().positive().max(2147483647)
|
|
32007
|
+
}).strict()
|
|
32008
|
+
]);
|
|
32009
|
+
|
|
31962
32010
|
// ../../packages/schemas/src/capability-attenuation.ts
|
|
31963
32011
|
function grantedCapabilityLevel(capability) {
|
|
31964
32012
|
return typeof capability === "string" ? capability : capability.level;
|
|
@@ -35095,6 +35143,10 @@ var ProjectMemberCapabilityLevelSchema = external_exports.enum(
|
|
|
35095
35143
|
);
|
|
35096
35144
|
var TASK_CAPABILITY_LEVELS = ["none", "read", "write"];
|
|
35097
35145
|
var TaskCapabilityLevelSchema = external_exports.enum(TASK_CAPABILITY_LEVELS);
|
|
35146
|
+
var TASK_MANAGEMENT_CAPABILITY_LEVELS = ["none", "write"];
|
|
35147
|
+
var TaskManagementCapabilityLevelSchema = external_exports.enum(
|
|
35148
|
+
TASK_MANAGEMENT_CAPABILITY_LEVELS
|
|
35149
|
+
);
|
|
35098
35150
|
var CONNECTION_CAPABILITY_LEVELS = ["none", "read", "write"];
|
|
35099
35151
|
var ConnectionCapabilityLevelSchema = external_exports.enum(
|
|
35100
35152
|
CONNECTION_CAPABILITY_LEVELS
|
|
@@ -35152,6 +35204,10 @@ var LocalAutoToolCapabilitiesSchema = external_exports.object({
|
|
|
35152
35204
|
billing: BillingCapabilitySchema.default("none"),
|
|
35153
35205
|
projectMembers: ProjectMemberCapabilitySchema.default("none"),
|
|
35154
35206
|
tasks: TaskCapabilitySchema.default("none"),
|
|
35207
|
+
// Project-wide coordination is an explicit session-snapshot grant, not a
|
|
35208
|
+
// requester-attenuated form of ordinary Task access. Keeping it optional
|
|
35209
|
+
// preserves pre-capability rendered spec hashes; absence means `none`.
|
|
35210
|
+
taskManagement: TaskManagementCapabilityLevelSchema.optional(),
|
|
35155
35211
|
connections: ConnectionCapabilitySchema.optional(),
|
|
35156
35212
|
secrets: SecretCapabilitySchema.optional(),
|
|
35157
35213
|
webhooks: WebhookCapabilitySchema.optional()
|
|
@@ -35394,6 +35450,36 @@ var TaskLinkTargetSchema = BindingTargetSchema.refine(
|
|
|
35394
35450
|
(target) => TASK_LINK_TARGET_TYPES.includes(target.type),
|
|
35395
35451
|
"Target type cannot be linked to a task"
|
|
35396
35452
|
);
|
|
35453
|
+
var TaskOutcomeSchema = JsonObjectSchema;
|
|
35454
|
+
var TaskArchiveRequestSchema = external_exports.object({ archived: external_exports.boolean() }).strict();
|
|
35455
|
+
var TasksArchiveRequestSchema = external_exports.object({
|
|
35456
|
+
task_ids: external_exports.array(external_exports.string().trim().min(1)).min(1).max(100),
|
|
35457
|
+
archived: external_exports.boolean()
|
|
35458
|
+
}).strict();
|
|
35459
|
+
var TaskArchiveFilterSchema = external_exports.enum(["active", "archived", "all"]);
|
|
35460
|
+
var TaskReadModelSchema = external_exports.object({
|
|
35461
|
+
id: external_exports.string(),
|
|
35462
|
+
organizationId: external_exports.string(),
|
|
35463
|
+
projectId: external_exports.string(),
|
|
35464
|
+
parentTaskId: external_exports.string().nullable(),
|
|
35465
|
+
title: external_exports.string(),
|
|
35466
|
+
description: external_exports.string().nullable(),
|
|
35467
|
+
status: TaskStatusSchema,
|
|
35468
|
+
completionKind: TaskCompletionKindSchema,
|
|
35469
|
+
outcome: TaskOutcomeSchema.nullable(),
|
|
35470
|
+
context: JsonObjectSchema.nullable(),
|
|
35471
|
+
createdBySessionId: external_exports.string().nullable(),
|
|
35472
|
+
requester: JsonObjectSchema.nullable(),
|
|
35473
|
+
revision: external_exports.number().int().positive(),
|
|
35474
|
+
archivedAt: external_exports.string().datetime().nullable(),
|
|
35475
|
+
createdAt: external_exports.string().datetime(),
|
|
35476
|
+
updatedAt: external_exports.string().datetime(),
|
|
35477
|
+
startedAt: external_exports.string().datetime().nullable(),
|
|
35478
|
+
completedAt: external_exports.string().datetime().nullable()
|
|
35479
|
+
});
|
|
35480
|
+
var TaskListResponseSchema = external_exports.object({
|
|
35481
|
+
tasks: external_exports.array(TaskReadModelSchema)
|
|
35482
|
+
});
|
|
35397
35483
|
|
|
35398
35484
|
// ../../packages/schemas/src/trigger-router.ts
|
|
35399
35485
|
var CANONICAL_ROUTE_BY_KINDS = [
|
|
@@ -37269,6 +37355,9 @@ var SessionRecordSchema = external_exports.object({
|
|
|
37269
37355
|
// Trusted non-human origin/actor. Defaulted for legacy session.upsert
|
|
37270
37356
|
// payloads persisted before work provenance shipped.
|
|
37271
37357
|
workProvenance: WorkProvenanceSchema.nullable().default(null),
|
|
37358
|
+
// Platform-stamped only when this session is atomically spawned onto a
|
|
37359
|
+
// Task. Missing/null is the safe persisted-read default for legacy rows.
|
|
37360
|
+
delegatedTaskId: external_exports.string().trim().min(1).nullable().default(null),
|
|
37272
37361
|
// Defaulted for session.upsert payloads persisted before attached prompts.
|
|
37273
37362
|
attachedUserPrompt: external_exports.string().nullable().default(null).optional(),
|
|
37274
37363
|
triggerMessageContext: external_exports.string().nullable().default(null).optional(),
|
|
@@ -37587,6 +37676,10 @@ var OrganizationBillingSettingsSchema = external_exports.object({
|
|
|
37587
37676
|
// amount. Both must be set for auto-top-up to arm.
|
|
37588
37677
|
autoTopUpThresholdUsd: NonNegativeUsdSchema.nullable(),
|
|
37589
37678
|
autoTopUpAmountUsd: PositiveUsdSchema.nullable(),
|
|
37679
|
+
// Set when an automatic charge cannot proceed without operator attention.
|
|
37680
|
+
// The timestamp is intentionally the whole public failure contract: payment
|
|
37681
|
+
// provider identifiers and decline details stay out of settings responses.
|
|
37682
|
+
autoTopUpRequiresAttentionAt: external_exports.string().datetime().nullable().default(null),
|
|
37590
37683
|
// System-managed pause marker: set by the circuit breaker when the org's
|
|
37591
37684
|
// balance drops below its reserve, cleared by the credit-event resume hook.
|
|
37592
37685
|
// Never set by the settings PATCH (the request schema is strict without it).
|
|
@@ -37595,7 +37688,10 @@ var OrganizationBillingSettingsSchema = external_exports.object({
|
|
|
37595
37688
|
// the org's Stripe customer, and the saved card auto-top-up charges
|
|
37596
37689
|
// off-session. A non-null payment method is what "card on file" means.
|
|
37597
37690
|
stripeCustomerId: external_exports.string().trim().min(1).nullable(),
|
|
37598
|
-
stripeDefaultPaymentMethodId: external_exports.string().trim().min(1).nullable()
|
|
37691
|
+
stripeDefaultPaymentMethodId: external_exports.string().trim().min(1).nullable(),
|
|
37692
|
+
// Safe provenance used server-side to reject a test/live mismatch before a
|
|
37693
|
+
// real charge attempt. Null preserves compatibility with legacy rows.
|
|
37694
|
+
stripeDefaultPaymentMethodLivemode: external_exports.boolean().nullable().default(null)
|
|
37599
37695
|
});
|
|
37600
37696
|
var UpdateOrganizationBillingSettingsRequestSchema = external_exports.object({
|
|
37601
37697
|
spendLimitDayUsd: PositiveUsdSchema.nullable().optional(),
|
|
@@ -38054,10 +38150,13 @@ var ProjectDefaultAgentSchema = external_exports.object({
|
|
|
38054
38150
|
});
|
|
38055
38151
|
var UpdateProjectSettingsRequestSchema = external_exports.object({
|
|
38056
38152
|
name: external_exports.string().trim().min(1).optional(),
|
|
38057
|
-
slug: AppRouteSlugSchema.optional()
|
|
38058
|
-
|
|
38059
|
-
|
|
38060
|
-
})
|
|
38153
|
+
slug: AppRouteSlugSchema.optional(),
|
|
38154
|
+
sessionAutoArchivePolicy: AutoArchivePolicySchema.optional(),
|
|
38155
|
+
taskAutoArchivePolicy: AutoArchivePolicySchema.optional()
|
|
38156
|
+
}).strict().refine(
|
|
38157
|
+
(value2) => value2.name !== void 0 || value2.slug !== void 0 || value2.sessionAutoArchivePolicy !== void 0 || value2.taskAutoArchivePolicy !== void 0,
|
|
38158
|
+
{ message: "At least one settings field is required" }
|
|
38159
|
+
);
|
|
38061
38160
|
|
|
38062
38161
|
// ../../packages/schemas/src/project-service-accounts.ts
|
|
38063
38162
|
var ProjectServiceAccountSchema = external_exports.object({
|
|
@@ -72540,6 +72639,7 @@ var AgentBridgeOutputBuffer = class {
|
|
|
72540
72639
|
if (isSuccessfulOutputAck(ack)) {
|
|
72541
72640
|
this.pendingOutputs.delete(output.outputSeq);
|
|
72542
72641
|
this.discardOnFailureOutputSeqs.delete(output.outputSeq);
|
|
72642
|
+
this.input.onOutputAckProgress?.();
|
|
72543
72643
|
this.input.runtimeLogger?.info(
|
|
72544
72644
|
"agent_bridge_output_buffer_emit_ready",
|
|
72545
72645
|
this.outputLogContext(output, {
|
|
@@ -77859,6 +77959,7 @@ function createHarnessCommandHandler(input) {
|
|
|
77859
77959
|
const config2 = resolveHarnessConfig(input.bootstrap);
|
|
77860
77960
|
const base = {
|
|
77861
77961
|
emitOutput: input.emitOutput,
|
|
77962
|
+
...input.onOutputAckProgress ? { onOutputAckProgress: input.onOutputAckProgress } : {},
|
|
77862
77963
|
...input.cycleSocket ? { cycleSocket: input.cycleSocket } : {},
|
|
77863
77964
|
...input.outputSeqStart !== void 0 ? { outputSeqStart: input.outputSeqStart } : {},
|
|
77864
77965
|
...input.runtimeLogger ? { runtimeLogger: input.runtimeLogger } : {},
|