@autohq/cli 0.1.302 → 0.1.303
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 +86 -9
- package/dist/index.js +86 -9
- package/package.json +1 -1
package/dist/agent-bridge.js
CHANGED
|
@@ -23399,7 +23399,7 @@ Object.assign(lookup, {
|
|
|
23399
23399
|
// package.json
|
|
23400
23400
|
var package_default = {
|
|
23401
23401
|
name: "@autohq/cli",
|
|
23402
|
-
version: "0.1.
|
|
23402
|
+
version: "0.1.303",
|
|
23403
23403
|
license: "SEE LICENSE IN README.md",
|
|
23404
23404
|
publishConfig: {
|
|
23405
23405
|
access: "public"
|
|
@@ -38223,6 +38223,7 @@ var UiMessagePartTracker = class {
|
|
|
38223
38223
|
textPartIndexById = /* @__PURE__ */ new Map();
|
|
38224
38224
|
reasoningPartIndexById = /* @__PURE__ */ new Map();
|
|
38225
38225
|
toolPartIndexByCallId = /* @__PURE__ */ new Map();
|
|
38226
|
+
approvalByCallId = /* @__PURE__ */ new Map();
|
|
38226
38227
|
dataPartIndexById = /* @__PURE__ */ new Map();
|
|
38227
38228
|
append(chunk) {
|
|
38228
38229
|
switch (chunk.type) {
|
|
@@ -38315,14 +38316,16 @@ var UiMessagePartTracker = class {
|
|
|
38315
38316
|
return [];
|
|
38316
38317
|
}
|
|
38317
38318
|
case "tool-input-available": {
|
|
38319
|
+
const pendingApproval = this.approvalByCallId.get(chunk.toolCallId);
|
|
38318
38320
|
const index = this.upsertToolPart(chunk.toolCallId, {
|
|
38319
38321
|
...toolPartShape({
|
|
38320
38322
|
toolCallId: chunk.toolCallId,
|
|
38321
38323
|
toolName: chunk.toolName,
|
|
38322
38324
|
dynamic: chunk.dynamic,
|
|
38323
|
-
state: "input-available"
|
|
38325
|
+
state: pendingApproval ? "approval-requested" : "input-available"
|
|
38324
38326
|
}),
|
|
38325
38327
|
input: chunk.input,
|
|
38328
|
+
...pendingApproval ? { approval: pendingApproval } : {},
|
|
38326
38329
|
...chunk.providerExecuted !== void 0 ? { providerExecuted: chunk.providerExecuted } : {},
|
|
38327
38330
|
...chunk.providerMetadata !== void 0 ? { callProviderMetadata: chunk.providerMetadata } : {}
|
|
38328
38331
|
});
|
|
@@ -38341,6 +38344,24 @@ var UiMessagePartTracker = class {
|
|
|
38341
38344
|
});
|
|
38342
38345
|
return this.persistable(index);
|
|
38343
38346
|
}
|
|
38347
|
+
case "tool-approval-request": {
|
|
38348
|
+
const approval = {
|
|
38349
|
+
id: chunk.approvalId,
|
|
38350
|
+
...chunk.signature != null ? { signature: chunk.signature } : {}
|
|
38351
|
+
};
|
|
38352
|
+
this.approvalByCallId.set(chunk.toolCallId, approval);
|
|
38353
|
+
const part = this.partById(
|
|
38354
|
+
this.toolPartIndexByCallId,
|
|
38355
|
+
chunk.toolCallId
|
|
38356
|
+
);
|
|
38357
|
+
const index = this.toolPartIndexByCallId.get(chunk.toolCallId);
|
|
38358
|
+
if (!part || index === void 0) {
|
|
38359
|
+
return [];
|
|
38360
|
+
}
|
|
38361
|
+
part.state = "approval-requested";
|
|
38362
|
+
part.approval = approval;
|
|
38363
|
+
return this.persistable(index);
|
|
38364
|
+
}
|
|
38344
38365
|
case "tool-output-available": {
|
|
38345
38366
|
const part = this.partById(
|
|
38346
38367
|
this.toolPartIndexByCallId,
|
|
@@ -38353,6 +38374,20 @@ var UiMessagePartTracker = class {
|
|
|
38353
38374
|
part.state = "output-available";
|
|
38354
38375
|
part.output = chunk.output;
|
|
38355
38376
|
part.preliminary = chunk.preliminary;
|
|
38377
|
+
this.settleApproval(part, chunk.toolCallId, { approved: true });
|
|
38378
|
+
return this.persistable(index);
|
|
38379
|
+
}
|
|
38380
|
+
case "tool-output-denied": {
|
|
38381
|
+
const part = this.partById(
|
|
38382
|
+
this.toolPartIndexByCallId,
|
|
38383
|
+
chunk.toolCallId
|
|
38384
|
+
);
|
|
38385
|
+
const index = this.toolPartIndexByCallId.get(chunk.toolCallId);
|
|
38386
|
+
if (!part || index === void 0) {
|
|
38387
|
+
return [];
|
|
38388
|
+
}
|
|
38389
|
+
part.state = "output-denied";
|
|
38390
|
+
this.settleApproval(part, chunk.toolCallId, { approved: false });
|
|
38356
38391
|
return this.persistable(index);
|
|
38357
38392
|
}
|
|
38358
38393
|
case "tool-output-error": {
|
|
@@ -38366,6 +38401,7 @@ var UiMessagePartTracker = class {
|
|
|
38366
38401
|
}
|
|
38367
38402
|
part.state = "output-error";
|
|
38368
38403
|
part.errorText = chunk.errorText;
|
|
38404
|
+
this.settleApproval(part, chunk.toolCallId, { approved: true });
|
|
38369
38405
|
return this.persistable(index);
|
|
38370
38406
|
}
|
|
38371
38407
|
case "start-step": {
|
|
@@ -38473,6 +38509,16 @@ var UiMessagePartTracker = class {
|
|
|
38473
38509
|
}
|
|
38474
38510
|
return this.parts[index] ?? null;
|
|
38475
38511
|
}
|
|
38512
|
+
// The UIToolInvocation contract requires `approval.approved` on settled
|
|
38513
|
+
// states (`output-available`/`output-denied`), but the settling chunks don't
|
|
38514
|
+
// carry it — the outcome is implied by which chunk arrives. Stamp it onto a
|
|
38515
|
+
// previously requested approval; parts that never parked stay approval-free.
|
|
38516
|
+
settleApproval(part, toolCallId, outcome) {
|
|
38517
|
+
const approval = this.approvalByCallId.get(toolCallId);
|
|
38518
|
+
if (approval) {
|
|
38519
|
+
part.approval = { ...approval, approved: outcome.approved };
|
|
38520
|
+
}
|
|
38521
|
+
}
|
|
38476
38522
|
reset() {
|
|
38477
38523
|
this.messageId = null;
|
|
38478
38524
|
this.messageMetadata = void 0;
|
|
@@ -38481,6 +38527,7 @@ var UiMessagePartTracker = class {
|
|
|
38481
38527
|
this.textPartIndexById = /* @__PURE__ */ new Map();
|
|
38482
38528
|
this.reasoningPartIndexById = /* @__PURE__ */ new Map();
|
|
38483
38529
|
this.toolPartIndexByCallId = /* @__PURE__ */ new Map();
|
|
38530
|
+
this.approvalByCallId = /* @__PURE__ */ new Map();
|
|
38484
38531
|
this.dataPartIndexById = /* @__PURE__ */ new Map();
|
|
38485
38532
|
}
|
|
38486
38533
|
};
|
|
@@ -38917,6 +38964,21 @@ function legacyToolEntry(chunk) {
|
|
|
38917
38964
|
]
|
|
38918
38965
|
}
|
|
38919
38966
|
};
|
|
38967
|
+
case "tool-output-denied":
|
|
38968
|
+
return {
|
|
38969
|
+
role: "tool",
|
|
38970
|
+
kind: "tool_result",
|
|
38971
|
+
content: {
|
|
38972
|
+
parts: [
|
|
38973
|
+
{
|
|
38974
|
+
type: "tool_result",
|
|
38975
|
+
toolUseId: legacyToolCallId(chunk.toolCallId),
|
|
38976
|
+
output: { denied: true },
|
|
38977
|
+
isError: true
|
|
38978
|
+
}
|
|
38979
|
+
]
|
|
38980
|
+
}
|
|
38981
|
+
};
|
|
38920
38982
|
default:
|
|
38921
38983
|
return null;
|
|
38922
38984
|
}
|
|
@@ -60626,15 +60688,19 @@ var CodexProjector = class {
|
|
|
60626
60688
|
return [];
|
|
60627
60689
|
}
|
|
60628
60690
|
}
|
|
60629
|
-
// An approval parks the turn on operator input, so
|
|
60630
|
-
//
|
|
60691
|
+
// An approval parks the turn on operator input, so both chunks mark the
|
|
60692
|
+
// delivered turn as waiting for input.
|
|
60631
60693
|
projectApproval(request) {
|
|
60632
60694
|
return [
|
|
60633
|
-
|
|
60634
|
-
type: "
|
|
60635
|
-
|
|
60636
|
-
|
|
60637
|
-
|
|
60695
|
+
{
|
|
60696
|
+
type: "ui_message_chunk",
|
|
60697
|
+
chunk: {
|
|
60698
|
+
type: "tool-approval-request",
|
|
60699
|
+
approvalId: String(request.requestId),
|
|
60700
|
+
toolCallId: request.itemId
|
|
60701
|
+
},
|
|
60702
|
+
turnStatus: "waiting_for_input"
|
|
60703
|
+
},
|
|
60638
60704
|
{
|
|
60639
60705
|
type: "ui_message_chunk",
|
|
60640
60706
|
chunk: {
|
|
@@ -60689,6 +60755,7 @@ var CodexProjector = class {
|
|
|
60689
60755
|
...item.cwd ? { cwd: item.cwd } : {}
|
|
60690
60756
|
},
|
|
60691
60757
|
output: item.aggregatedOutput ?? "",
|
|
60758
|
+
isDenied: isDeclinedStatus(item.status),
|
|
60692
60759
|
isError: isFailedStatus(item.status) || (item.exitCode ?? 0) !== 0,
|
|
60693
60760
|
title: item.command,
|
|
60694
60761
|
toolMetadata: statusMetadata(item.status, {
|
|
@@ -60702,6 +60769,7 @@ var CodexProjector = class {
|
|
|
60702
60769
|
name: "apply_patch",
|
|
60703
60770
|
input: { changes: toJsonValue(item.changes) },
|
|
60704
60771
|
output: { status: item.status ?? "unknown" },
|
|
60772
|
+
isDenied: isDeclinedStatus(item.status),
|
|
60705
60773
|
isError: isFailedStatus(item.status),
|
|
60706
60774
|
title: "apply_patch",
|
|
60707
60775
|
toolMetadata: statusMetadata(item.status)
|
|
@@ -60799,6 +60867,12 @@ function toolInputChunk(input) {
|
|
|
60799
60867
|
});
|
|
60800
60868
|
}
|
|
60801
60869
|
function toolOutputChunk(input) {
|
|
60870
|
+
if (input.isDenied) {
|
|
60871
|
+
return uiChunk2({
|
|
60872
|
+
type: "tool-output-denied",
|
|
60873
|
+
toolCallId: input.itemId
|
|
60874
|
+
});
|
|
60875
|
+
}
|
|
60802
60876
|
return uiChunk2(
|
|
60803
60877
|
input.isError ? {
|
|
60804
60878
|
type: "tool-output-error",
|
|
@@ -60869,6 +60943,9 @@ function reasoningPartId(itemId) {
|
|
|
60869
60943
|
function isFailedStatus(status) {
|
|
60870
60944
|
return status === "failed" || status === "declined";
|
|
60871
60945
|
}
|
|
60946
|
+
function isDeclinedStatus(status) {
|
|
60947
|
+
return status === "declined";
|
|
60948
|
+
}
|
|
60872
60949
|
function statusMetadata(status, fields = {}) {
|
|
60873
60950
|
return {
|
|
60874
60951
|
status: status ?? "unknown",
|
package/dist/index.js
CHANGED
|
@@ -24703,7 +24703,7 @@ var init_package = __esm({
|
|
|
24703
24703
|
"package.json"() {
|
|
24704
24704
|
package_default = {
|
|
24705
24705
|
name: "@autohq/cli",
|
|
24706
|
-
version: "0.1.
|
|
24706
|
+
version: "0.1.303",
|
|
24707
24707
|
license: "SEE LICENSE IN README.md",
|
|
24708
24708
|
publishConfig: {
|
|
24709
24709
|
access: "public"
|
|
@@ -35273,6 +35273,7 @@ var UiMessagePartTracker = class {
|
|
|
35273
35273
|
textPartIndexById = /* @__PURE__ */ new Map();
|
|
35274
35274
|
reasoningPartIndexById = /* @__PURE__ */ new Map();
|
|
35275
35275
|
toolPartIndexByCallId = /* @__PURE__ */ new Map();
|
|
35276
|
+
approvalByCallId = /* @__PURE__ */ new Map();
|
|
35276
35277
|
dataPartIndexById = /* @__PURE__ */ new Map();
|
|
35277
35278
|
append(chunk) {
|
|
35278
35279
|
switch (chunk.type) {
|
|
@@ -35365,14 +35366,16 @@ var UiMessagePartTracker = class {
|
|
|
35365
35366
|
return [];
|
|
35366
35367
|
}
|
|
35367
35368
|
case "tool-input-available": {
|
|
35369
|
+
const pendingApproval = this.approvalByCallId.get(chunk.toolCallId);
|
|
35368
35370
|
const index = this.upsertToolPart(chunk.toolCallId, {
|
|
35369
35371
|
...toolPartShape({
|
|
35370
35372
|
toolCallId: chunk.toolCallId,
|
|
35371
35373
|
toolName: chunk.toolName,
|
|
35372
35374
|
dynamic: chunk.dynamic,
|
|
35373
|
-
state: "input-available"
|
|
35375
|
+
state: pendingApproval ? "approval-requested" : "input-available"
|
|
35374
35376
|
}),
|
|
35375
35377
|
input: chunk.input,
|
|
35378
|
+
...pendingApproval ? { approval: pendingApproval } : {},
|
|
35376
35379
|
...chunk.providerExecuted !== void 0 ? { providerExecuted: chunk.providerExecuted } : {},
|
|
35377
35380
|
...chunk.providerMetadata !== void 0 ? { callProviderMetadata: chunk.providerMetadata } : {}
|
|
35378
35381
|
});
|
|
@@ -35391,6 +35394,24 @@ var UiMessagePartTracker = class {
|
|
|
35391
35394
|
});
|
|
35392
35395
|
return this.persistable(index);
|
|
35393
35396
|
}
|
|
35397
|
+
case "tool-approval-request": {
|
|
35398
|
+
const approval = {
|
|
35399
|
+
id: chunk.approvalId,
|
|
35400
|
+
...chunk.signature != null ? { signature: chunk.signature } : {}
|
|
35401
|
+
};
|
|
35402
|
+
this.approvalByCallId.set(chunk.toolCallId, approval);
|
|
35403
|
+
const part = this.partById(
|
|
35404
|
+
this.toolPartIndexByCallId,
|
|
35405
|
+
chunk.toolCallId
|
|
35406
|
+
);
|
|
35407
|
+
const index = this.toolPartIndexByCallId.get(chunk.toolCallId);
|
|
35408
|
+
if (!part || index === void 0) {
|
|
35409
|
+
return [];
|
|
35410
|
+
}
|
|
35411
|
+
part.state = "approval-requested";
|
|
35412
|
+
part.approval = approval;
|
|
35413
|
+
return this.persistable(index);
|
|
35414
|
+
}
|
|
35394
35415
|
case "tool-output-available": {
|
|
35395
35416
|
const part = this.partById(
|
|
35396
35417
|
this.toolPartIndexByCallId,
|
|
@@ -35403,6 +35424,20 @@ var UiMessagePartTracker = class {
|
|
|
35403
35424
|
part.state = "output-available";
|
|
35404
35425
|
part.output = chunk.output;
|
|
35405
35426
|
part.preliminary = chunk.preliminary;
|
|
35427
|
+
this.settleApproval(part, chunk.toolCallId, { approved: true });
|
|
35428
|
+
return this.persistable(index);
|
|
35429
|
+
}
|
|
35430
|
+
case "tool-output-denied": {
|
|
35431
|
+
const part = this.partById(
|
|
35432
|
+
this.toolPartIndexByCallId,
|
|
35433
|
+
chunk.toolCallId
|
|
35434
|
+
);
|
|
35435
|
+
const index = this.toolPartIndexByCallId.get(chunk.toolCallId);
|
|
35436
|
+
if (!part || index === void 0) {
|
|
35437
|
+
return [];
|
|
35438
|
+
}
|
|
35439
|
+
part.state = "output-denied";
|
|
35440
|
+
this.settleApproval(part, chunk.toolCallId, { approved: false });
|
|
35406
35441
|
return this.persistable(index);
|
|
35407
35442
|
}
|
|
35408
35443
|
case "tool-output-error": {
|
|
@@ -35416,6 +35451,7 @@ var UiMessagePartTracker = class {
|
|
|
35416
35451
|
}
|
|
35417
35452
|
part.state = "output-error";
|
|
35418
35453
|
part.errorText = chunk.errorText;
|
|
35454
|
+
this.settleApproval(part, chunk.toolCallId, { approved: true });
|
|
35419
35455
|
return this.persistable(index);
|
|
35420
35456
|
}
|
|
35421
35457
|
case "start-step": {
|
|
@@ -35523,6 +35559,16 @@ var UiMessagePartTracker = class {
|
|
|
35523
35559
|
}
|
|
35524
35560
|
return this.parts[index] ?? null;
|
|
35525
35561
|
}
|
|
35562
|
+
// The UIToolInvocation contract requires `approval.approved` on settled
|
|
35563
|
+
// states (`output-available`/`output-denied`), but the settling chunks don't
|
|
35564
|
+
// carry it — the outcome is implied by which chunk arrives. Stamp it onto a
|
|
35565
|
+
// previously requested approval; parts that never parked stay approval-free.
|
|
35566
|
+
settleApproval(part, toolCallId, outcome) {
|
|
35567
|
+
const approval = this.approvalByCallId.get(toolCallId);
|
|
35568
|
+
if (approval) {
|
|
35569
|
+
part.approval = { ...approval, approved: outcome.approved };
|
|
35570
|
+
}
|
|
35571
|
+
}
|
|
35526
35572
|
reset() {
|
|
35527
35573
|
this.messageId = null;
|
|
35528
35574
|
this.messageMetadata = void 0;
|
|
@@ -35531,6 +35577,7 @@ var UiMessagePartTracker = class {
|
|
|
35531
35577
|
this.textPartIndexById = /* @__PURE__ */ new Map();
|
|
35532
35578
|
this.reasoningPartIndexById = /* @__PURE__ */ new Map();
|
|
35533
35579
|
this.toolPartIndexByCallId = /* @__PURE__ */ new Map();
|
|
35580
|
+
this.approvalByCallId = /* @__PURE__ */ new Map();
|
|
35534
35581
|
this.dataPartIndexById = /* @__PURE__ */ new Map();
|
|
35535
35582
|
}
|
|
35536
35583
|
};
|
|
@@ -35967,6 +36014,21 @@ function legacyToolEntry(chunk) {
|
|
|
35967
36014
|
]
|
|
35968
36015
|
}
|
|
35969
36016
|
};
|
|
36017
|
+
case "tool-output-denied":
|
|
36018
|
+
return {
|
|
36019
|
+
role: "tool",
|
|
36020
|
+
kind: "tool_result",
|
|
36021
|
+
content: {
|
|
36022
|
+
parts: [
|
|
36023
|
+
{
|
|
36024
|
+
type: "tool_result",
|
|
36025
|
+
toolUseId: legacyToolCallId(chunk.toolCallId),
|
|
36026
|
+
output: { denied: true },
|
|
36027
|
+
isError: true
|
|
36028
|
+
}
|
|
36029
|
+
]
|
|
36030
|
+
}
|
|
36031
|
+
};
|
|
35970
36032
|
default:
|
|
35971
36033
|
return null;
|
|
35972
36034
|
}
|
|
@@ -38109,15 +38171,19 @@ var CodexProjector = class {
|
|
|
38109
38171
|
return [];
|
|
38110
38172
|
}
|
|
38111
38173
|
}
|
|
38112
|
-
// An approval parks the turn on operator input, so
|
|
38113
|
-
//
|
|
38174
|
+
// An approval parks the turn on operator input, so both chunks mark the
|
|
38175
|
+
// delivered turn as waiting for input.
|
|
38114
38176
|
projectApproval(request) {
|
|
38115
38177
|
return [
|
|
38116
|
-
|
|
38117
|
-
type: "
|
|
38118
|
-
|
|
38119
|
-
|
|
38120
|
-
|
|
38178
|
+
{
|
|
38179
|
+
type: "ui_message_chunk",
|
|
38180
|
+
chunk: {
|
|
38181
|
+
type: "tool-approval-request",
|
|
38182
|
+
approvalId: String(request.requestId),
|
|
38183
|
+
toolCallId: request.itemId
|
|
38184
|
+
},
|
|
38185
|
+
turnStatus: "waiting_for_input"
|
|
38186
|
+
},
|
|
38121
38187
|
{
|
|
38122
38188
|
type: "ui_message_chunk",
|
|
38123
38189
|
chunk: {
|
|
@@ -38172,6 +38238,7 @@ var CodexProjector = class {
|
|
|
38172
38238
|
...item.cwd ? { cwd: item.cwd } : {}
|
|
38173
38239
|
},
|
|
38174
38240
|
output: item.aggregatedOutput ?? "",
|
|
38241
|
+
isDenied: isDeclinedStatus(item.status),
|
|
38175
38242
|
isError: isFailedStatus(item.status) || (item.exitCode ?? 0) !== 0,
|
|
38176
38243
|
title: item.command,
|
|
38177
38244
|
toolMetadata: statusMetadata(item.status, {
|
|
@@ -38185,6 +38252,7 @@ var CodexProjector = class {
|
|
|
38185
38252
|
name: "apply_patch",
|
|
38186
38253
|
input: { changes: toJsonValue(item.changes) },
|
|
38187
38254
|
output: { status: item.status ?? "unknown" },
|
|
38255
|
+
isDenied: isDeclinedStatus(item.status),
|
|
38188
38256
|
isError: isFailedStatus(item.status),
|
|
38189
38257
|
title: "apply_patch",
|
|
38190
38258
|
toolMetadata: statusMetadata(item.status)
|
|
@@ -38282,6 +38350,12 @@ function toolInputChunk(input) {
|
|
|
38282
38350
|
});
|
|
38283
38351
|
}
|
|
38284
38352
|
function toolOutputChunk(input) {
|
|
38353
|
+
if (input.isDenied) {
|
|
38354
|
+
return uiChunk2({
|
|
38355
|
+
type: "tool-output-denied",
|
|
38356
|
+
toolCallId: input.itemId
|
|
38357
|
+
});
|
|
38358
|
+
}
|
|
38285
38359
|
return uiChunk2(
|
|
38286
38360
|
input.isError ? {
|
|
38287
38361
|
type: "tool-output-error",
|
|
@@ -38352,6 +38426,9 @@ function reasoningPartId(itemId) {
|
|
|
38352
38426
|
function isFailedStatus(status) {
|
|
38353
38427
|
return status === "failed" || status === "declined";
|
|
38354
38428
|
}
|
|
38429
|
+
function isDeclinedStatus(status) {
|
|
38430
|
+
return status === "declined";
|
|
38431
|
+
}
|
|
38355
38432
|
function statusMetadata(status, fields = {}) {
|
|
38356
38433
|
return {
|
|
38357
38434
|
status: status ?? "unknown",
|