@autohq/cli 0.1.88 → 0.1.90
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 +532 -129
- package/dist/index.js +1168 -225
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -257,10 +257,10 @@ function mergeDefs(...defs) {
|
|
|
257
257
|
function cloneDef(schema) {
|
|
258
258
|
return mergeDefs(schema._zod.def);
|
|
259
259
|
}
|
|
260
|
-
function getElementAtPath(obj,
|
|
261
|
-
if (!
|
|
260
|
+
function getElementAtPath(obj, path2) {
|
|
261
|
+
if (!path2)
|
|
262
262
|
return obj;
|
|
263
|
-
return
|
|
263
|
+
return path2.reduce((acc, key) => acc?.[key], obj);
|
|
264
264
|
}
|
|
265
265
|
function promiseAllObject(promisesObj) {
|
|
266
266
|
const keys = Object.keys(promisesObj);
|
|
@@ -588,11 +588,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
588
588
|
}
|
|
589
589
|
return false;
|
|
590
590
|
}
|
|
591
|
-
function prefixIssues(
|
|
591
|
+
function prefixIssues(path2, issues) {
|
|
592
592
|
return issues.map((iss) => {
|
|
593
593
|
var _a3;
|
|
594
594
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
595
|
-
iss.path.unshift(
|
|
595
|
+
iss.path.unshift(path2);
|
|
596
596
|
return iss;
|
|
597
597
|
});
|
|
598
598
|
}
|
|
@@ -810,16 +810,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
810
810
|
}
|
|
811
811
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
812
812
|
const fieldErrors = { _errors: [] };
|
|
813
|
-
const processError = (error52,
|
|
813
|
+
const processError = (error52, path2 = []) => {
|
|
814
814
|
for (const issue2 of error52.issues) {
|
|
815
815
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
816
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
816
|
+
issue2.errors.map((issues) => processError({ issues }, [...path2, ...issue2.path]));
|
|
817
817
|
} else if (issue2.code === "invalid_key") {
|
|
818
|
-
processError({ issues: issue2.issues }, [...
|
|
818
|
+
processError({ issues: issue2.issues }, [...path2, ...issue2.path]);
|
|
819
819
|
} else if (issue2.code === "invalid_element") {
|
|
820
|
-
processError({ issues: issue2.issues }, [...
|
|
820
|
+
processError({ issues: issue2.issues }, [...path2, ...issue2.path]);
|
|
821
821
|
} else {
|
|
822
|
-
const fullpath = [...
|
|
822
|
+
const fullpath = [...path2, ...issue2.path];
|
|
823
823
|
if (fullpath.length === 0) {
|
|
824
824
|
fieldErrors._errors.push(mapper(issue2));
|
|
825
825
|
} else {
|
|
@@ -846,17 +846,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
846
846
|
}
|
|
847
847
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
848
848
|
const result = { errors: [] };
|
|
849
|
-
const processError = (error52,
|
|
849
|
+
const processError = (error52, path2 = []) => {
|
|
850
850
|
var _a3, _b;
|
|
851
851
|
for (const issue2 of error52.issues) {
|
|
852
852
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
853
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
853
|
+
issue2.errors.map((issues) => processError({ issues }, [...path2, ...issue2.path]));
|
|
854
854
|
} else if (issue2.code === "invalid_key") {
|
|
855
|
-
processError({ issues: issue2.issues }, [...
|
|
855
|
+
processError({ issues: issue2.issues }, [...path2, ...issue2.path]);
|
|
856
856
|
} else if (issue2.code === "invalid_element") {
|
|
857
|
-
processError({ issues: issue2.issues }, [...
|
|
857
|
+
processError({ issues: issue2.issues }, [...path2, ...issue2.path]);
|
|
858
858
|
} else {
|
|
859
|
-
const fullpath = [...
|
|
859
|
+
const fullpath = [...path2, ...issue2.path];
|
|
860
860
|
if (fullpath.length === 0) {
|
|
861
861
|
result.errors.push(mapper(issue2));
|
|
862
862
|
continue;
|
|
@@ -888,8 +888,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
888
888
|
}
|
|
889
889
|
function toDotPath(_path) {
|
|
890
890
|
const segs = [];
|
|
891
|
-
const
|
|
892
|
-
for (const seg of
|
|
891
|
+
const path2 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
892
|
+
for (const seg of path2) {
|
|
893
893
|
if (typeof seg === "number")
|
|
894
894
|
segs.push(`[${seg}]`);
|
|
895
895
|
else if (typeof seg === "symbol")
|
|
@@ -14392,13 +14392,13 @@ function resolveRef(ref, ctx) {
|
|
|
14392
14392
|
if (!ref.startsWith("#")) {
|
|
14393
14393
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
14394
14394
|
}
|
|
14395
|
-
const
|
|
14396
|
-
if (
|
|
14395
|
+
const path2 = ref.slice(1).split("/").filter(Boolean);
|
|
14396
|
+
if (path2.length === 0) {
|
|
14397
14397
|
return ctx.rootSchema;
|
|
14398
14398
|
}
|
|
14399
14399
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
14400
|
-
if (
|
|
14401
|
-
const key =
|
|
14400
|
+
if (path2[0] === defsKey) {
|
|
14401
|
+
const key = path2[1];
|
|
14402
14402
|
if (!key || !ctx.defs[key]) {
|
|
14403
14403
|
throw new Error(`Reference not found: ${ref}`);
|
|
14404
14404
|
}
|
|
@@ -15223,6 +15223,8 @@ var init_auth = __esm({
|
|
|
15223
15223
|
"secrets:read",
|
|
15224
15224
|
"secrets:write",
|
|
15225
15225
|
"secrets:use",
|
|
15226
|
+
"github:mcp",
|
|
15227
|
+
"github:credentials",
|
|
15226
15228
|
"projects:admin",
|
|
15227
15229
|
"org:admin"
|
|
15228
15230
|
]);
|
|
@@ -16413,6 +16415,100 @@ var init_connections = __esm({
|
|
|
16413
16415
|
}
|
|
16414
16416
|
});
|
|
16415
16417
|
|
|
16418
|
+
// ../../packages/schemas/src/github-credentials.ts
|
|
16419
|
+
var CreateRunGithubCredentialRequestSchema, RunGithubCredentialResponseSchema;
|
|
16420
|
+
var init_github_credentials = __esm({
|
|
16421
|
+
"../../packages/schemas/src/github-credentials.ts"() {
|
|
16422
|
+
"use strict";
|
|
16423
|
+
init_zod();
|
|
16424
|
+
CreateRunGithubCredentialRequestSchema = external_exports.object({
|
|
16425
|
+
host: external_exports.literal("github.com"),
|
|
16426
|
+
path: external_exports.string().trim().min(1).optional()
|
|
16427
|
+
});
|
|
16428
|
+
RunGithubCredentialResponseSchema = external_exports.object({
|
|
16429
|
+
username: external_exports.literal("x-access-token"),
|
|
16430
|
+
password: external_exports.string().min(1),
|
|
16431
|
+
expiresAt: external_exports.string().datetime()
|
|
16432
|
+
});
|
|
16433
|
+
}
|
|
16434
|
+
});
|
|
16435
|
+
|
|
16436
|
+
// ../../packages/schemas/src/github-mcp-catalog.ts
|
|
16437
|
+
var GITHUB_MCP_TOOL_NAMES, GITHUB_MCP_WRITE_TOOLS, githubMcpToolNameSet, githubMcpWriteToolSet;
|
|
16438
|
+
var init_github_mcp_catalog = __esm({
|
|
16439
|
+
"../../packages/schemas/src/github-mcp-catalog.ts"() {
|
|
16440
|
+
"use strict";
|
|
16441
|
+
GITHUB_MCP_TOOL_NAMES = [
|
|
16442
|
+
"actions_get",
|
|
16443
|
+
"actions_list",
|
|
16444
|
+
"actions_run_trigger",
|
|
16445
|
+
"add_comment_to_pending_review",
|
|
16446
|
+
"add_issue_comment",
|
|
16447
|
+
"add_reply_to_pull_request_comment",
|
|
16448
|
+
"create_branch",
|
|
16449
|
+
"create_or_update_file",
|
|
16450
|
+
"create_pull_request",
|
|
16451
|
+
"create_repository",
|
|
16452
|
+
"delete_file",
|
|
16453
|
+
"fork_repository",
|
|
16454
|
+
"get_commit",
|
|
16455
|
+
"get_file_contents",
|
|
16456
|
+
"get_job_logs",
|
|
16457
|
+
"get_label",
|
|
16458
|
+
"get_latest_release",
|
|
16459
|
+
"get_release_by_tag",
|
|
16460
|
+
"get_tag",
|
|
16461
|
+
"issue_read",
|
|
16462
|
+
"issue_write",
|
|
16463
|
+
"list_branches",
|
|
16464
|
+
"list_commits",
|
|
16465
|
+
"list_issue_types",
|
|
16466
|
+
"list_issues",
|
|
16467
|
+
"list_pull_requests",
|
|
16468
|
+
"list_releases",
|
|
16469
|
+
"list_repository_collaborators",
|
|
16470
|
+
"list_tags",
|
|
16471
|
+
"merge_pull_request",
|
|
16472
|
+
"pull_request_read",
|
|
16473
|
+
"pull_request_review_write",
|
|
16474
|
+
"push_files",
|
|
16475
|
+
"search_code",
|
|
16476
|
+
"search_commits",
|
|
16477
|
+
"search_issues",
|
|
16478
|
+
"search_pull_requests",
|
|
16479
|
+
"search_repositories",
|
|
16480
|
+
"sub_issue_write",
|
|
16481
|
+
"update_pull_request",
|
|
16482
|
+
"update_pull_request_branch"
|
|
16483
|
+
];
|
|
16484
|
+
GITHUB_MCP_WRITE_TOOLS = [
|
|
16485
|
+
"actions_run_trigger",
|
|
16486
|
+
"add_comment_to_pending_review",
|
|
16487
|
+
"add_issue_comment",
|
|
16488
|
+
"add_reply_to_pull_request_comment",
|
|
16489
|
+
"create_branch",
|
|
16490
|
+
"create_or_update_file",
|
|
16491
|
+
"create_pull_request",
|
|
16492
|
+
"create_repository",
|
|
16493
|
+
"delete_file",
|
|
16494
|
+
"fork_repository",
|
|
16495
|
+
"issue_write",
|
|
16496
|
+
"merge_pull_request",
|
|
16497
|
+
"pull_request_review_write",
|
|
16498
|
+
"push_files",
|
|
16499
|
+
"sub_issue_write",
|
|
16500
|
+
"update_pull_request",
|
|
16501
|
+
"update_pull_request_branch"
|
|
16502
|
+
];
|
|
16503
|
+
githubMcpToolNameSet = new Set(
|
|
16504
|
+
GITHUB_MCP_TOOL_NAMES
|
|
16505
|
+
);
|
|
16506
|
+
githubMcpWriteToolSet = new Set(
|
|
16507
|
+
GITHUB_MCP_WRITE_TOOLS
|
|
16508
|
+
);
|
|
16509
|
+
}
|
|
16510
|
+
});
|
|
16511
|
+
|
|
16416
16512
|
// ../../packages/schemas/src/secrets.ts
|
|
16417
16513
|
var SECRET_ENCRYPTION_ALGORITHM, SecretEnvNameSchema, SecretCiphertextFieldSchema, SecretAesGcmIvSchema, SecretAesGcmAuthTagSchema, SecretEnvValueSchema, SecretEnvSchema, EncryptedSecretValueSchema, SecretSetRequestSchema, SecretMetadataSchema, SecretSetResponseSchema, SecretListResponseSchema, SecretDeleteResponseSchema;
|
|
16418
16514
|
var init_secrets = __esm({
|
|
@@ -16600,7 +16696,7 @@ var init_mcp = __esm({
|
|
|
16600
16696
|
});
|
|
16601
16697
|
|
|
16602
16698
|
// ../../packages/schemas/src/mounts.ts
|
|
16603
|
-
var AbsoluteMountPathSchema, GITHUB_MOUNT_CAPABILITY_LEVELS, GithubMountCapabilityLevelSchema, GitMountAuthSchema, GitMountSchema, SessionMountSchema;
|
|
16699
|
+
var AbsoluteMountPathSchema, GITHUB_MOUNT_CAPABILITY_LEVELS, GithubMountCapabilityLevelSchema, DEFAULT_GITHUB_MOUNT_CAPABILITIES, GitMountAuthSchema, GitMountSchema, SessionMountSchema;
|
|
16604
16700
|
var init_mounts = __esm({
|
|
16605
16701
|
"../../packages/schemas/src/mounts.ts"() {
|
|
16606
16702
|
"use strict";
|
|
@@ -16616,6 +16712,14 @@ var init_mounts = __esm({
|
|
|
16616
16712
|
GithubMountCapabilityLevelSchema = external_exports.enum(
|
|
16617
16713
|
GITHUB_MOUNT_CAPABILITY_LEVELS
|
|
16618
16714
|
);
|
|
16715
|
+
DEFAULT_GITHUB_MOUNT_CAPABILITIES = {
|
|
16716
|
+
contents: "write",
|
|
16717
|
+
pullRequests: "write",
|
|
16718
|
+
issues: "write",
|
|
16719
|
+
checks: "read",
|
|
16720
|
+
actions: "read",
|
|
16721
|
+
workflows: "none"
|
|
16722
|
+
};
|
|
16619
16723
|
GitMountAuthSchema = external_exports.discriminatedUnion("kind", [
|
|
16620
16724
|
external_exports.object({
|
|
16621
16725
|
kind: external_exports.literal("none")
|
|
@@ -16636,14 +16740,7 @@ var init_mounts = __esm({
|
|
|
16636
16740
|
checks: GithubMountCapabilityLevelSchema.default("read"),
|
|
16637
16741
|
actions: GithubMountCapabilityLevelSchema.default("read"),
|
|
16638
16742
|
workflows: GithubMountCapabilityLevelSchema.default("none")
|
|
16639
|
-
}).default({
|
|
16640
|
-
contents: "write",
|
|
16641
|
-
pullRequests: "write",
|
|
16642
|
-
issues: "write",
|
|
16643
|
-
checks: "read",
|
|
16644
|
-
actions: "read",
|
|
16645
|
-
workflows: "none"
|
|
16646
|
-
})
|
|
16743
|
+
}).default({ ...DEFAULT_GITHUB_MOUNT_CAPABILITIES })
|
|
16647
16744
|
})
|
|
16648
16745
|
]);
|
|
16649
16746
|
GitMountSchema = external_exports.object({
|
|
@@ -16759,12 +16856,13 @@ function remoteMcpToolSchema(input) {
|
|
|
16759
16856
|
]).default({ kind: "none" })
|
|
16760
16857
|
});
|
|
16761
16858
|
}
|
|
16762
|
-
var RESOURCE_KIND_TOOL, REMOTE_MCP_TRANSPORTS, LOCAL_TOOL_IMPLEMENTATIONS, SecretReferenceSchema, NoToolAuthSchema, McpOAuthToolAuthSchema, ConnectionToolAuthSchema, ConnectionsToolAuthSchema, ToolAliasSchema, RemoteMcpToolSchema, LocalAutoToolSchema, LocalPingToolSchema, LocalChatToolSchema, LocalToolSchema, ToolSpecSchema, ToolResourceSchema, ToolApplyRequestSchema, ToolConnectRequestSchema, ToolConnectResponseSchema, ToolConnectCompleteResponseSchema, ReferencedSessionToolRefSchema, ReferencedSessionToolRefsSchema, InlineSessionToolSchema, SessionToolRefSchema, SessionToolsSchema;
|
|
16859
|
+
var RESOURCE_KIND_TOOL, REMOTE_MCP_TRANSPORTS, LOCAL_TOOL_IMPLEMENTATIONS, SecretReferenceSchema, NoToolAuthSchema, McpOAuthToolAuthSchema, ConnectionToolAuthSchema, ConnectionsToolAuthSchema, ToolAliasSchema, RemoteMcpToolSchema, LocalAutoToolSchema, LocalPingToolSchema, LocalChatToolSchema, LocalToolSchema, GithubToolSchema, ToolSpecSchema, ToolResourceSchema, ToolApplyRequestSchema, ToolConnectRequestSchema, ToolConnectResponseSchema, ToolConnectCompleteResponseSchema, ReferencedSessionToolRefSchema, ReferencedSessionToolRefsSchema, InlineSessionToolSchema, SessionToolRefSchema, SessionToolsSchema;
|
|
16763
16860
|
var init_tools = __esm({
|
|
16764
16861
|
"../../packages/schemas/src/tools.ts"() {
|
|
16765
16862
|
"use strict";
|
|
16766
16863
|
init_zod();
|
|
16767
16864
|
init_connections();
|
|
16865
|
+
init_github_mcp_catalog();
|
|
16768
16866
|
init_ids();
|
|
16769
16867
|
init_resources();
|
|
16770
16868
|
RESOURCE_KIND_TOOL = "tool";
|
|
@@ -16822,6 +16920,11 @@ var init_tools = __esm({
|
|
|
16822
16920
|
error: `Unsupported local tool implementation. Supported implementations: ${LOCAL_TOOL_IMPLEMENTATIONS.join(", ")}`
|
|
16823
16921
|
}
|
|
16824
16922
|
);
|
|
16923
|
+
GithubToolSchema = external_exports.object({
|
|
16924
|
+
kind: external_exports.literal("github"),
|
|
16925
|
+
description: external_exports.string().trim().min(1).optional(),
|
|
16926
|
+
tools: external_exports.array(external_exports.enum(GITHUB_MCP_TOOL_NAMES)).min(1).optional()
|
|
16927
|
+
});
|
|
16825
16928
|
ToolSpecSchema = external_exports.discriminatedUnion("kind", [
|
|
16826
16929
|
RemoteMcpToolSchema,
|
|
16827
16930
|
LocalToolSchema
|
|
@@ -16871,6 +16974,10 @@ var init_tools = __esm({
|
|
|
16871
16974
|
disabled: external_exports.boolean().optional()
|
|
16872
16975
|
})
|
|
16873
16976
|
)
|
|
16977
|
+
).or(
|
|
16978
|
+
GithubToolSchema.extend({
|
|
16979
|
+
disabled: external_exports.boolean().optional()
|
|
16980
|
+
})
|
|
16874
16981
|
);
|
|
16875
16982
|
SessionToolRefSchema = InlineSessionToolSchema.or(
|
|
16876
16983
|
ReferencedSessionToolRefSchema
|
|
@@ -17133,8 +17240,8 @@ function hasAutoAttributionsExists(trigger, expected) {
|
|
|
17133
17240
|
function isChatMessageEvent(trigger) {
|
|
17134
17241
|
return trigger.event.startsWith("chat.message.");
|
|
17135
17242
|
}
|
|
17136
|
-
function hasFilterValue(trigger,
|
|
17137
|
-
return trigger.where?.[
|
|
17243
|
+
function hasFilterValue(trigger, path2, expected) {
|
|
17244
|
+
return trigger.where?.[path2] === expected;
|
|
17138
17245
|
}
|
|
17139
17246
|
var RESOURCE_KIND_SESSION, TriggerFilterScalarSchema, TriggerFilterPathSchema, TriggerFilterClauseSchema, TriggerFilterSchema, SessionTriggerCheckTimeoutSchema, TriggerEventSchema, TriggerEventsSchema, SessionTriggerSharedFields, SessionTriggerEventSourceFields, SessionTriggerBaseSchema, SessionTriggerDefinitionBaseSchema, SessionTriggerSchema, SessionApplyTriggerSchema, SessionHeartbeatTriggerBaseSchema, SessionHeartbeatTriggerSchema, SessionApplyHeartbeatTriggerSchema, SessionTriggerDefinitionSchema, SessionApplyTriggerDefinitionSchema, SessionTriggersSchema, SessionApplyTriggersSchema, AVATAR_ASSET_EXTENSIONS, MAX_AVATAR_ASSET_BYTES, SESSION_IDENTITY_DESCRIPTION_MAX_LENGTH, SHA256_HEX_PATTERN, SessionIdentitySchema, SessionSpecSchema, SessionApplySpecSchema, SessionStatusSchema, SessionResourceSchema, SessionApplyRequestSchema, SessionApplyTriggerReceiptSchema, SessionApplyResponseSchema, SESSION_TELEGRAM_IDENTITY_STATUSES, SessionTelegramIdentityStatusSchema, SessionPresenceIdentitySchema, SessionPresenceResponseSchema, SessionPresenceConnectRequestSchema, SessionPresenceConnectPendingSchema, SessionPresenceConnectResponseSchema, SessionPresenceIconRequestSchema, SessionPresenceIconResponseSchema, SessionPresenceCompleteResponseSchema;
|
|
17140
17247
|
var init_sessions = __esm({
|
|
@@ -17156,17 +17263,17 @@ var init_sessions = __esm({
|
|
|
17156
17263
|
external_exports.boolean()
|
|
17157
17264
|
]);
|
|
17158
17265
|
TriggerFilterPathSchema = external_exports.string().refine(
|
|
17159
|
-
(
|
|
17160
|
-
if (
|
|
17266
|
+
(path2) => {
|
|
17267
|
+
if (path2.length === 0 || path2.trim() !== path2) {
|
|
17161
17268
|
return false;
|
|
17162
17269
|
}
|
|
17163
|
-
if (
|
|
17164
|
-
const segments =
|
|
17270
|
+
if (path2.startsWith("$.")) {
|
|
17271
|
+
const segments = path2.slice(2).split(".");
|
|
17165
17272
|
return segments.length > 0 && segments.every(
|
|
17166
17273
|
(segment) => segment.length > 0 && segment.trim() === segment
|
|
17167
17274
|
);
|
|
17168
17275
|
}
|
|
17169
|
-
return !
|
|
17276
|
+
return !path2.includes(".");
|
|
17170
17277
|
},
|
|
17171
17278
|
{
|
|
17172
17279
|
message: "Trigger filter paths must be a single bare key or use $.path.segments"
|
|
@@ -17654,6 +17761,307 @@ var init_run_diagnostics = __esm({
|
|
|
17654
17761
|
}
|
|
17655
17762
|
});
|
|
17656
17763
|
|
|
17764
|
+
// ../../packages/schemas/src/session-runs.ts
|
|
17765
|
+
var SESSION_RUN_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;
|
|
17766
|
+
var init_session_runs = __esm({
|
|
17767
|
+
"../../packages/schemas/src/session-runs.ts"() {
|
|
17768
|
+
"use strict";
|
|
17769
|
+
init_zod();
|
|
17770
|
+
init_auth();
|
|
17771
|
+
init_environments();
|
|
17772
|
+
init_ids();
|
|
17773
|
+
init_primitives();
|
|
17774
|
+
init_profiles();
|
|
17775
|
+
init_sessions();
|
|
17776
|
+
init_tools();
|
|
17777
|
+
SESSION_RUN_STATUSES = [
|
|
17778
|
+
"queued",
|
|
17779
|
+
"running",
|
|
17780
|
+
"awaiting",
|
|
17781
|
+
"failed",
|
|
17782
|
+
"stopped"
|
|
17783
|
+
];
|
|
17784
|
+
SESSION_RUN_DISPLAY_TITLE_MAX_LENGTH = 64;
|
|
17785
|
+
SessionRunStatusSchema = external_exports.enum(SESSION_RUN_STATUSES);
|
|
17786
|
+
SessionRunDisplayTitleSchema = external_exports.string().trim().max(SESSION_RUN_DISPLAY_TITLE_MAX_LENGTH);
|
|
17787
|
+
SESSION_RUN_CHECK_STATUSES = [
|
|
17788
|
+
"queued",
|
|
17789
|
+
"in_progress",
|
|
17790
|
+
"completed"
|
|
17791
|
+
];
|
|
17792
|
+
SESSION_RUN_CHECK_CONCLUSIONS = ["success", "failure"];
|
|
17793
|
+
SESSION_RUN_CHECK_TIMEOUT_PHASES = ["begin", "complete"];
|
|
17794
|
+
SessionRunCheckStatusSchema = external_exports.enum(SESSION_RUN_CHECK_STATUSES);
|
|
17795
|
+
SessionRunCheckConclusionSchema = external_exports.enum(
|
|
17796
|
+
SESSION_RUN_CHECK_CONCLUSIONS
|
|
17797
|
+
);
|
|
17798
|
+
SessionRunCheckTimeoutPhaseSchema = external_exports.enum(
|
|
17799
|
+
SESSION_RUN_CHECK_TIMEOUT_PHASES
|
|
17800
|
+
);
|
|
17801
|
+
ManualSessionRunRequestSchema = external_exports.object({
|
|
17802
|
+
message: external_exports.string().trim().min(1).max(2e4).optional(),
|
|
17803
|
+
interactive: external_exports.boolean().optional()
|
|
17804
|
+
});
|
|
17805
|
+
SessionRunArchiveRequestSchema = external_exports.object({
|
|
17806
|
+
archived: external_exports.boolean()
|
|
17807
|
+
});
|
|
17808
|
+
SessionRunsArchiveRequestSchema = external_exports.object({
|
|
17809
|
+
run_ids: external_exports.array(SessionRunIdSchema2).min(1).max(100),
|
|
17810
|
+
archived: external_exports.boolean()
|
|
17811
|
+
});
|
|
17812
|
+
SessionRunRecordSchema = external_exports.object({
|
|
17813
|
+
id: SessionRunIdSchema2,
|
|
17814
|
+
organizationId: external_exports.string().trim().min(1),
|
|
17815
|
+
projectId: external_exports.string().trim().min(1).nullable(),
|
|
17816
|
+
sessionId: SessionIdSchema,
|
|
17817
|
+
runtimeId: RuntimeIdSchema2.nullable(),
|
|
17818
|
+
status: SessionRunStatusSchema,
|
|
17819
|
+
idempotencyKey: external_exports.string().min(1).nullable(),
|
|
17820
|
+
correlationKey: external_exports.string().nullable(),
|
|
17821
|
+
workflowId: external_exports.string().min(1),
|
|
17822
|
+
displayTitle: SessionRunDisplayTitleSchema,
|
|
17823
|
+
starterActor: AuthActorSchema.nullable(),
|
|
17824
|
+
sessionSnapshot: SessionResourceSchema,
|
|
17825
|
+
profileSnapshot: ProfileResourceSchema,
|
|
17826
|
+
environmentSnapshot: EnvironmentResourceSchema,
|
|
17827
|
+
toolSnapshots: external_exports.array(
|
|
17828
|
+
external_exports.discriminatedUnion("source", [
|
|
17829
|
+
external_exports.object({
|
|
17830
|
+
source: external_exports.literal("inline"),
|
|
17831
|
+
alias: ToolAliasSchema,
|
|
17832
|
+
spec: RemoteMcpToolSchema.or(LocalToolSchema).or(GithubToolSchema)
|
|
17833
|
+
}),
|
|
17834
|
+
external_exports.object({
|
|
17835
|
+
source: external_exports.literal("resource"),
|
|
17836
|
+
alias: ToolAliasSchema,
|
|
17837
|
+
resource: ToolResourceSchema
|
|
17838
|
+
})
|
|
17839
|
+
])
|
|
17840
|
+
),
|
|
17841
|
+
input: JsonValueSchema2,
|
|
17842
|
+
createdAt: external_exports.string().datetime(),
|
|
17843
|
+
updatedAt: external_exports.string().datetime(),
|
|
17844
|
+
startedAt: external_exports.string().datetime().nullable(),
|
|
17845
|
+
finishedAt: external_exports.string().datetime().nullable(),
|
|
17846
|
+
archivedAt: external_exports.string().datetime().nullable(),
|
|
17847
|
+
error: JsonValueSchema2.nullable()
|
|
17848
|
+
});
|
|
17849
|
+
SessionRunsArchiveResponseSchema = external_exports.object({
|
|
17850
|
+
archived: external_exports.boolean(),
|
|
17851
|
+
runs: external_exports.array(SessionRunRecordSchema)
|
|
17852
|
+
});
|
|
17853
|
+
}
|
|
17854
|
+
});
|
|
17855
|
+
|
|
17856
|
+
// ../../packages/schemas/src/run-introspection.ts
|
|
17857
|
+
var TruncatedValueSchema, RunConversationSearchSnippetSchema, RunConversationSearchMatchSchema, RunConversationSearchResponseSchema, RunToolExchangeSchema, RunToolExchangesResponseSchema, RUN_TRIGGER_DELIVERY_ACTIONS, RunTriggerDeliveryActionSchema, RUN_EVENT_ORIGIN_KINDS, RunEventOriginKindSchema, RunTriggerDeliveryRecordSchema, RunTriggersResponseSchema, RunArtifactRecordSchema, RunArtifactsResponseSchema, RunTurnSchema, RunToolStatSchema, RunSummarySchema;
|
|
17858
|
+
var init_run_introspection = __esm({
|
|
17859
|
+
"../../packages/schemas/src/run-introspection.ts"() {
|
|
17860
|
+
"use strict";
|
|
17861
|
+
init_zod();
|
|
17862
|
+
init_auth();
|
|
17863
|
+
init_conversation();
|
|
17864
|
+
init_ids();
|
|
17865
|
+
init_primitives();
|
|
17866
|
+
init_session_runs();
|
|
17867
|
+
TruncatedValueSchema = external_exports.object({
|
|
17868
|
+
truncated: external_exports.literal(true),
|
|
17869
|
+
truncatedPreview: external_exports.string(),
|
|
17870
|
+
originalBytes: external_exports.number().int().nonnegative()
|
|
17871
|
+
});
|
|
17872
|
+
RunConversationSearchSnippetSchema = external_exports.object({
|
|
17873
|
+
partIndex: external_exports.number().int().nonnegative(),
|
|
17874
|
+
partType: external_exports.string(),
|
|
17875
|
+
/** The search term this snippet was produced for. */
|
|
17876
|
+
query: external_exports.string(),
|
|
17877
|
+
text: external_exports.string()
|
|
17878
|
+
});
|
|
17879
|
+
RunConversationSearchMatchSchema = external_exports.object({
|
|
17880
|
+
sequence: external_exports.number().int().nonnegative(),
|
|
17881
|
+
role: ConversationRoleSchema2,
|
|
17882
|
+
kind: ConversationEntryKindSchema2,
|
|
17883
|
+
status: ConversationEntryStatusSchema2,
|
|
17884
|
+
createdAt: external_exports.string().datetime(),
|
|
17885
|
+
/** Which of the requested terms matched this entry. */
|
|
17886
|
+
matchedQueries: external_exports.array(external_exports.string()),
|
|
17887
|
+
/** Total match occurrences across terms in this entry. */
|
|
17888
|
+
matchCount: external_exports.number().int().positive(),
|
|
17889
|
+
snippets: external_exports.array(RunConversationSearchSnippetSchema)
|
|
17890
|
+
});
|
|
17891
|
+
RunConversationSearchResponseSchema = external_exports.object({
|
|
17892
|
+
matches: external_exports.array(RunConversationSearchMatchSchema),
|
|
17893
|
+
hasMore: external_exports.boolean(),
|
|
17894
|
+
/**
|
|
17895
|
+
* Sequence of the last candidate entry scanned (not just the last confirmed
|
|
17896
|
+
* match) — pass as `afterSequence` to continue without re-scanning
|
|
17897
|
+
* candidates the match confirmation dropped. Null when nothing was scanned.
|
|
17898
|
+
*/
|
|
17899
|
+
nextAfterSequence: external_exports.number().int().nullable()
|
|
17900
|
+
});
|
|
17901
|
+
RunToolExchangeSchema = external_exports.object({
|
|
17902
|
+
name: external_exports.string(),
|
|
17903
|
+
callSequence: external_exports.number().int().nonnegative(),
|
|
17904
|
+
resultSequence: external_exports.number().int().nonnegative().nullable(),
|
|
17905
|
+
input: JsonValueSchema2,
|
|
17906
|
+
output: JsonValueSchema2.nullable(),
|
|
17907
|
+
/** Null while the call has no recorded result. */
|
|
17908
|
+
isError: external_exports.boolean().nullable(),
|
|
17909
|
+
/** Result `completedAt` minus call `createdAt`; null without a result. */
|
|
17910
|
+
durationMs: external_exports.number().int().nonnegative().nullable(),
|
|
17911
|
+
startedAt: external_exports.string().datetime(),
|
|
17912
|
+
completedAt: external_exports.string().datetime().nullable()
|
|
17913
|
+
});
|
|
17914
|
+
RunToolExchangesResponseSchema = external_exports.object({
|
|
17915
|
+
exchanges: external_exports.array(RunToolExchangeSchema),
|
|
17916
|
+
hasMore: external_exports.boolean(),
|
|
17917
|
+
/**
|
|
17918
|
+
* Sequence bounds of the entries window this page consumed (not just the
|
|
17919
|
+
* returned exchanges) — continue paging with `after`/`before` from these so
|
|
17920
|
+
* filtered-out entries are not re-scanned. Null when nothing was scanned.
|
|
17921
|
+
*/
|
|
17922
|
+
nextAfterSequence: external_exports.number().int().nullable(),
|
|
17923
|
+
nextBeforeSequence: external_exports.number().int().nullable()
|
|
17924
|
+
});
|
|
17925
|
+
RUN_TRIGGER_DELIVERY_ACTIONS = [
|
|
17926
|
+
"started",
|
|
17927
|
+
"signaled",
|
|
17928
|
+
"dropped",
|
|
17929
|
+
"warned",
|
|
17930
|
+
"errored"
|
|
17931
|
+
];
|
|
17932
|
+
RunTriggerDeliveryActionSchema = external_exports.enum(
|
|
17933
|
+
RUN_TRIGGER_DELIVERY_ACTIONS
|
|
17934
|
+
);
|
|
17935
|
+
RUN_EVENT_ORIGIN_KINDS = [
|
|
17936
|
+
"internal",
|
|
17937
|
+
"provider_grant",
|
|
17938
|
+
"webhook"
|
|
17939
|
+
];
|
|
17940
|
+
RunEventOriginKindSchema = external_exports.enum(RUN_EVENT_ORIGIN_KINDS);
|
|
17941
|
+
RunTriggerDeliveryRecordSchema = external_exports.object({
|
|
17942
|
+
action: RunTriggerDeliveryActionSchema,
|
|
17943
|
+
triggerId: external_exports.string(),
|
|
17944
|
+
eventKey: external_exports.string(),
|
|
17945
|
+
originKind: RunEventOriginKindSchema,
|
|
17946
|
+
occurredAt: external_exports.string().datetime(),
|
|
17947
|
+
receivedAt: external_exports.string().datetime(),
|
|
17948
|
+
deliveredAt: external_exports.string().datetime(),
|
|
17949
|
+
reason: external_exports.string().nullable(),
|
|
17950
|
+
/** Event payload; may be a {@link TruncatedValueSchema} marker. */
|
|
17951
|
+
payload: JsonValueSchema2.optional()
|
|
17952
|
+
});
|
|
17953
|
+
RunTriggersResponseSchema = external_exports.object({
|
|
17954
|
+
/** The `started` delivery that spawned the run; null for manual/agent spawns. */
|
|
17955
|
+
spawn: RunTriggerDeliveryRecordSchema.nullable(),
|
|
17956
|
+
/** Who started the run, for manual/CLI/agent spawns. */
|
|
17957
|
+
starter: AuthActorSchema.nullable(),
|
|
17958
|
+
/** Subsequent deliveries against the run, chronological. */
|
|
17959
|
+
deliveries: external_exports.array(RunTriggerDeliveryRecordSchema)
|
|
17960
|
+
});
|
|
17961
|
+
RunArtifactRecordSchema = external_exports.object({
|
|
17962
|
+
artifactType: external_exports.string(),
|
|
17963
|
+
externalId: external_exports.string(),
|
|
17964
|
+
payload: JsonValueSchema2,
|
|
17965
|
+
recordedAt: external_exports.string().datetime()
|
|
17966
|
+
});
|
|
17967
|
+
RunArtifactsResponseSchema = external_exports.object({
|
|
17968
|
+
artifacts: external_exports.array(RunArtifactRecordSchema)
|
|
17969
|
+
});
|
|
17970
|
+
RunTurnSchema = external_exports.object({
|
|
17971
|
+
startSequence: external_exports.number().int().nonnegative(),
|
|
17972
|
+
endSequence: external_exports.number().int().nonnegative(),
|
|
17973
|
+
startedAt: external_exports.string().datetime(),
|
|
17974
|
+
completedAt: external_exports.string().datetime().nullable(),
|
|
17975
|
+
toolCallCount: external_exports.number().int().nonnegative()
|
|
17976
|
+
});
|
|
17977
|
+
RunToolStatSchema = external_exports.object({
|
|
17978
|
+
name: external_exports.string(),
|
|
17979
|
+
/** Run-wide call count from the SQL aggregate. */
|
|
17980
|
+
calls: external_exports.number().int().nonnegative(),
|
|
17981
|
+
/**
|
|
17982
|
+
* Derived from the summary's recent-entries window (most recent ~1000
|
|
17983
|
+
* entries), so on very long runs `errors` and `durationMs` can understate
|
|
17984
|
+
* relative to the run-wide `calls`.
|
|
17985
|
+
*/
|
|
17986
|
+
errors: external_exports.number().int().nonnegative(),
|
|
17987
|
+
durationMs: external_exports.object({
|
|
17988
|
+
p50: external_exports.number().nonnegative().nullable(),
|
|
17989
|
+
max: external_exports.number().nonnegative().nullable()
|
|
17990
|
+
})
|
|
17991
|
+
});
|
|
17992
|
+
RunSummarySchema = external_exports.object({
|
|
17993
|
+
run: external_exports.object({
|
|
17994
|
+
id: SessionRunIdSchema2,
|
|
17995
|
+
sessionName: external_exports.string(),
|
|
17996
|
+
profileName: external_exports.string(),
|
|
17997
|
+
displayTitle: external_exports.string(),
|
|
17998
|
+
status: SessionRunStatusSchema,
|
|
17999
|
+
error: JsonValueSchema2.nullable(),
|
|
18000
|
+
workflowId: external_exports.string(),
|
|
18001
|
+
createdAt: external_exports.string().datetime(),
|
|
18002
|
+
startedAt: external_exports.string().datetime().nullable(),
|
|
18003
|
+
finishedAt: external_exports.string().datetime().nullable(),
|
|
18004
|
+
archivedAt: external_exports.string().datetime().nullable()
|
|
18005
|
+
}),
|
|
18006
|
+
timing: external_exports.object({
|
|
18007
|
+
/** `startedAt - createdAt`; null until the run starts. */
|
|
18008
|
+
queuedMs: external_exports.number().int().nonnegative().nullable(),
|
|
18009
|
+
/** `(finishedAt ?? now) - startedAt`; null until the run starts. */
|
|
18010
|
+
activeMs: external_exports.number().int().nonnegative().nullable(),
|
|
18011
|
+
/** `(finishedAt ?? now) - createdAt`. */
|
|
18012
|
+
totalMs: external_exports.number().int().nonnegative()
|
|
18013
|
+
}),
|
|
18014
|
+
conversation: external_exports.object({
|
|
18015
|
+
entryCount: external_exports.number().int().nonnegative(),
|
|
18016
|
+
firstEntryAt: external_exports.string().datetime().nullable(),
|
|
18017
|
+
lastEntryAt: external_exports.string().datetime().nullable(),
|
|
18018
|
+
countsByKind: external_exports.object({
|
|
18019
|
+
status: external_exports.number().int().nonnegative(),
|
|
18020
|
+
message: external_exports.number().int().nonnegative(),
|
|
18021
|
+
tool_call: external_exports.number().int().nonnegative(),
|
|
18022
|
+
tool_result: external_exports.number().int().nonnegative(),
|
|
18023
|
+
question: external_exports.number().int().nonnegative()
|
|
18024
|
+
}),
|
|
18025
|
+
failedEntryCount: external_exports.number().int().nonnegative(),
|
|
18026
|
+
lastSequence: external_exports.number().int().nonnegative()
|
|
18027
|
+
}),
|
|
18028
|
+
tools: external_exports.array(RunToolStatSchema),
|
|
18029
|
+
/**
|
|
18030
|
+
* True when the run has more conversation entries than the summary's
|
|
18031
|
+
* recent-entries window, meaning per-tool `errors`/`durationMs` (and
|
|
18032
|
+
* `turns`) describe only the most recent slice of the run.
|
|
18033
|
+
*/
|
|
18034
|
+
toolStatsWindowed: external_exports.boolean(),
|
|
18035
|
+
trigger: external_exports.object({
|
|
18036
|
+
/** Spawning event key, or "manual" / "agent" for actor-started runs. */
|
|
18037
|
+
spawn: external_exports.string(),
|
|
18038
|
+
signaledCount: external_exports.number().int().nonnegative(),
|
|
18039
|
+
droppedCount: external_exports.number().int().nonnegative()
|
|
18040
|
+
}),
|
|
18041
|
+
artifacts: external_exports.object({
|
|
18042
|
+
count: external_exports.number().int().nonnegative(),
|
|
18043
|
+
types: external_exports.array(external_exports.string())
|
|
18044
|
+
}),
|
|
18045
|
+
/** Derived per-user-message turns, capped to the most recent. */
|
|
18046
|
+
turns: external_exports.array(RunTurnSchema),
|
|
18047
|
+
commands: external_exports.object({
|
|
18048
|
+
total: external_exports.number().int().nonnegative(),
|
|
18049
|
+
byKind: external_exports.record(external_exports.string(), external_exports.number().int().nonnegative()),
|
|
18050
|
+
failed: external_exports.number().int().nonnegative()
|
|
18051
|
+
}),
|
|
18052
|
+
checks: external_exports.array(
|
|
18053
|
+
external_exports.object({
|
|
18054
|
+
name: external_exports.string(),
|
|
18055
|
+
displayName: external_exports.string(),
|
|
18056
|
+
status: SessionRunCheckStatusSchema,
|
|
18057
|
+
conclusion: SessionRunCheckConclusionSchema.nullable(),
|
|
18058
|
+
completedAt: external_exports.string().datetime().nullable()
|
|
18059
|
+
})
|
|
18060
|
+
)
|
|
18061
|
+
});
|
|
18062
|
+
}
|
|
18063
|
+
});
|
|
18064
|
+
|
|
17657
18065
|
// ../../packages/schemas/src/session-run-commands.ts
|
|
17658
18066
|
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;
|
|
17659
18067
|
var init_session_run_commands = __esm({
|
|
@@ -17970,98 +18378,6 @@ var init_runtimes = __esm({
|
|
|
17970
18378
|
}
|
|
17971
18379
|
});
|
|
17972
18380
|
|
|
17973
|
-
// ../../packages/schemas/src/session-runs.ts
|
|
17974
|
-
var SESSION_RUN_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;
|
|
17975
|
-
var init_session_runs = __esm({
|
|
17976
|
-
"../../packages/schemas/src/session-runs.ts"() {
|
|
17977
|
-
"use strict";
|
|
17978
|
-
init_zod();
|
|
17979
|
-
init_auth();
|
|
17980
|
-
init_environments();
|
|
17981
|
-
init_ids();
|
|
17982
|
-
init_primitives();
|
|
17983
|
-
init_profiles();
|
|
17984
|
-
init_sessions();
|
|
17985
|
-
init_tools();
|
|
17986
|
-
SESSION_RUN_STATUSES = [
|
|
17987
|
-
"queued",
|
|
17988
|
-
"running",
|
|
17989
|
-
"awaiting",
|
|
17990
|
-
"failed",
|
|
17991
|
-
"stopped"
|
|
17992
|
-
];
|
|
17993
|
-
SESSION_RUN_DISPLAY_TITLE_MAX_LENGTH = 64;
|
|
17994
|
-
SessionRunStatusSchema = external_exports.enum(SESSION_RUN_STATUSES);
|
|
17995
|
-
SessionRunDisplayTitleSchema = external_exports.string().trim().max(SESSION_RUN_DISPLAY_TITLE_MAX_LENGTH);
|
|
17996
|
-
SESSION_RUN_CHECK_STATUSES = [
|
|
17997
|
-
"queued",
|
|
17998
|
-
"in_progress",
|
|
17999
|
-
"completed"
|
|
18000
|
-
];
|
|
18001
|
-
SESSION_RUN_CHECK_CONCLUSIONS = ["success", "failure"];
|
|
18002
|
-
SESSION_RUN_CHECK_TIMEOUT_PHASES = ["begin", "complete"];
|
|
18003
|
-
SessionRunCheckStatusSchema = external_exports.enum(SESSION_RUN_CHECK_STATUSES);
|
|
18004
|
-
SessionRunCheckConclusionSchema = external_exports.enum(
|
|
18005
|
-
SESSION_RUN_CHECK_CONCLUSIONS
|
|
18006
|
-
);
|
|
18007
|
-
SessionRunCheckTimeoutPhaseSchema = external_exports.enum(
|
|
18008
|
-
SESSION_RUN_CHECK_TIMEOUT_PHASES
|
|
18009
|
-
);
|
|
18010
|
-
ManualSessionRunRequestSchema = external_exports.object({
|
|
18011
|
-
message: external_exports.string().trim().min(1).max(2e4).optional(),
|
|
18012
|
-
interactive: external_exports.boolean().optional()
|
|
18013
|
-
});
|
|
18014
|
-
SessionRunArchiveRequestSchema = external_exports.object({
|
|
18015
|
-
archived: external_exports.boolean()
|
|
18016
|
-
});
|
|
18017
|
-
SessionRunsArchiveRequestSchema = external_exports.object({
|
|
18018
|
-
run_ids: external_exports.array(SessionRunIdSchema2).min(1).max(100),
|
|
18019
|
-
archived: external_exports.boolean()
|
|
18020
|
-
});
|
|
18021
|
-
SessionRunRecordSchema = external_exports.object({
|
|
18022
|
-
id: SessionRunIdSchema2,
|
|
18023
|
-
organizationId: external_exports.string().trim().min(1),
|
|
18024
|
-
projectId: external_exports.string().trim().min(1).nullable(),
|
|
18025
|
-
sessionId: SessionIdSchema,
|
|
18026
|
-
runtimeId: RuntimeIdSchema2.nullable(),
|
|
18027
|
-
status: SessionRunStatusSchema,
|
|
18028
|
-
idempotencyKey: external_exports.string().min(1).nullable(),
|
|
18029
|
-
correlationKey: external_exports.string().nullable(),
|
|
18030
|
-
workflowId: external_exports.string().min(1),
|
|
18031
|
-
displayTitle: SessionRunDisplayTitleSchema,
|
|
18032
|
-
starterActor: AuthActorSchema.nullable(),
|
|
18033
|
-
sessionSnapshot: SessionResourceSchema,
|
|
18034
|
-
profileSnapshot: ProfileResourceSchema,
|
|
18035
|
-
environmentSnapshot: EnvironmentResourceSchema,
|
|
18036
|
-
toolSnapshots: external_exports.array(
|
|
18037
|
-
external_exports.discriminatedUnion("source", [
|
|
18038
|
-
external_exports.object({
|
|
18039
|
-
source: external_exports.literal("inline"),
|
|
18040
|
-
alias: ToolAliasSchema,
|
|
18041
|
-
spec: RemoteMcpToolSchema.or(LocalToolSchema)
|
|
18042
|
-
}),
|
|
18043
|
-
external_exports.object({
|
|
18044
|
-
source: external_exports.literal("resource"),
|
|
18045
|
-
alias: ToolAliasSchema,
|
|
18046
|
-
resource: ToolResourceSchema
|
|
18047
|
-
})
|
|
18048
|
-
])
|
|
18049
|
-
),
|
|
18050
|
-
input: JsonValueSchema2,
|
|
18051
|
-
createdAt: external_exports.string().datetime(),
|
|
18052
|
-
updatedAt: external_exports.string().datetime(),
|
|
18053
|
-
startedAt: external_exports.string().datetime().nullable(),
|
|
18054
|
-
finishedAt: external_exports.string().datetime().nullable(),
|
|
18055
|
-
archivedAt: external_exports.string().datetime().nullable(),
|
|
18056
|
-
error: JsonValueSchema2.nullable()
|
|
18057
|
-
});
|
|
18058
|
-
SessionRunsArchiveResponseSchema = external_exports.object({
|
|
18059
|
-
archived: external_exports.boolean(),
|
|
18060
|
-
runs: external_exports.array(SessionRunRecordSchema)
|
|
18061
|
-
});
|
|
18062
|
-
}
|
|
18063
|
-
});
|
|
18064
|
-
|
|
18065
18381
|
// ../../packages/schemas/src/temporal.ts
|
|
18066
18382
|
var ResourceReconciliationScopeSchema;
|
|
18067
18383
|
var init_temporal = __esm({
|
|
@@ -18085,6 +18401,8 @@ var init_src = __esm({
|
|
|
18085
18401
|
init_conversation();
|
|
18086
18402
|
init_conversation_reducer();
|
|
18087
18403
|
init_connections();
|
|
18404
|
+
init_github_credentials();
|
|
18405
|
+
init_github_mcp_catalog();
|
|
18088
18406
|
init_ids();
|
|
18089
18407
|
init_environments();
|
|
18090
18408
|
init_mcp();
|
|
@@ -18097,6 +18415,7 @@ var init_src = __esm({
|
|
|
18097
18415
|
init_realtime();
|
|
18098
18416
|
init_resources();
|
|
18099
18417
|
init_run_diagnostics();
|
|
18418
|
+
init_run_introspection();
|
|
18100
18419
|
init_secrets();
|
|
18101
18420
|
init_session_run_commands();
|
|
18102
18421
|
init_runtimes();
|
|
@@ -18159,10 +18478,10 @@ var init_active_project = __esm({
|
|
|
18159
18478
|
|
|
18160
18479
|
// src/lib/config/path.ts
|
|
18161
18480
|
import { createHash } from "crypto";
|
|
18162
|
-
import { homedir } from "os";
|
|
18481
|
+
import { homedir as homedir2 } from "os";
|
|
18163
18482
|
import { join, normalize } from "path";
|
|
18164
18483
|
function defaultConfigPath() {
|
|
18165
|
-
return process.env.AUTO_CLI_CONFIG ?? join(
|
|
18484
|
+
return process.env.AUTO_CLI_CONFIG ?? join(homedir2(), ".auto", "config.yaml");
|
|
18166
18485
|
}
|
|
18167
18486
|
function profilesDir(configPath = defaultConfigPath()) {
|
|
18168
18487
|
return normalize(join(configPath, "..", PROFILES_DIR_NAME));
|
|
@@ -18194,9 +18513,9 @@ var init_path = __esm({
|
|
|
18194
18513
|
// src/lib/config/file.ts
|
|
18195
18514
|
import { chmodSync, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
18196
18515
|
import { basename, dirname as dirname2, join as join2 } from "path";
|
|
18197
|
-
function readConfig(
|
|
18516
|
+
function readConfig(path2 = defaultConfigPath()) {
|
|
18198
18517
|
try {
|
|
18199
|
-
const text = readFileSync2(
|
|
18518
|
+
const text = readFileSync2(path2, "utf8");
|
|
18200
18519
|
const config2 = {};
|
|
18201
18520
|
for (const line of text.split(/\r?\n/)) {
|
|
18202
18521
|
const match = /^([A-Za-z0-9_]+):\s*(.*)$/.exec(line.trim());
|
|
@@ -18210,13 +18529,13 @@ function readConfig(path = defaultConfigPath()) {
|
|
|
18210
18529
|
throw err;
|
|
18211
18530
|
}
|
|
18212
18531
|
}
|
|
18213
|
-
function writeConfig(config2,
|
|
18214
|
-
writeConfigFile(config2,
|
|
18215
|
-
if (config2.userEmail && config2.serverUrl && basename(dirname2(
|
|
18532
|
+
function writeConfig(config2, path2 = defaultConfigPath()) {
|
|
18533
|
+
writeConfigFile(config2, path2);
|
|
18534
|
+
if (config2.userEmail && config2.serverUrl && basename(dirname2(path2)) !== PROFILES_DIR_NAME) {
|
|
18216
18535
|
writeConfigFile(
|
|
18217
18536
|
config2,
|
|
18218
18537
|
join2(
|
|
18219
|
-
dirname2(
|
|
18538
|
+
dirname2(path2),
|
|
18220
18539
|
PROFILES_DIR_NAME,
|
|
18221
18540
|
profileFileName({
|
|
18222
18541
|
userEmail: config2.userEmail,
|
|
@@ -18226,17 +18545,17 @@ function writeConfig(config2, path = defaultConfigPath()) {
|
|
|
18226
18545
|
);
|
|
18227
18546
|
}
|
|
18228
18547
|
}
|
|
18229
|
-
function writeConfigFile(config2,
|
|
18230
|
-
mkdirSync2(dirname2(
|
|
18548
|
+
function writeConfigFile(config2, path2) {
|
|
18549
|
+
mkdirSync2(dirname2(path2), { recursive: true });
|
|
18231
18550
|
const lines = CONFIG_KEYS.filter((key) => config2[key]).map(
|
|
18232
18551
|
(key) => `${key}: ${config2[key]}`
|
|
18233
18552
|
);
|
|
18234
|
-
writeFileSync2(
|
|
18553
|
+
writeFileSync2(path2, `${lines.join("\n")}
|
|
18235
18554
|
`, {
|
|
18236
18555
|
encoding: "utf8",
|
|
18237
18556
|
mode: 384
|
|
18238
18557
|
});
|
|
18239
|
-
chmodSync(
|
|
18558
|
+
chmodSync(path2, 384);
|
|
18240
18559
|
}
|
|
18241
18560
|
var CONFIG_KEYS;
|
|
18242
18561
|
var init_file = __esm({
|
|
@@ -18394,38 +18713,38 @@ var init_http = __esm({
|
|
|
18394
18713
|
});
|
|
18395
18714
|
|
|
18396
18715
|
// src/lib/api/paths.ts
|
|
18397
|
-
function apiPath(
|
|
18398
|
-
return `${API_PREFIX}${cleanSubpath(
|
|
18716
|
+
function apiPath(path2 = "") {
|
|
18717
|
+
return `${API_PREFIX}${cleanSubpath(path2)}`;
|
|
18399
18718
|
}
|
|
18400
|
-
function orgApiPath(organizationId,
|
|
18401
|
-
return apiPath(orgSubpath(organizationId,
|
|
18719
|
+
function orgApiPath(organizationId, path2 = "") {
|
|
18720
|
+
return apiPath(orgSubpath(organizationId, path2));
|
|
18402
18721
|
}
|
|
18403
|
-
function projectApiPath(project,
|
|
18722
|
+
function projectApiPath(project, path2 = "") {
|
|
18404
18723
|
return apiPath(
|
|
18405
18724
|
orgSubpath(
|
|
18406
18725
|
project.organizationId,
|
|
18407
|
-
`/projects/${encodeURIComponent(project.projectId)}${cleanSubpath(
|
|
18726
|
+
`/projects/${encodeURIComponent(project.projectId)}${cleanSubpath(path2)}`
|
|
18408
18727
|
)
|
|
18409
18728
|
);
|
|
18410
18729
|
}
|
|
18411
|
-
function sessionApiPath(project, sessionName,
|
|
18730
|
+
function sessionApiPath(project, sessionName, path2 = "") {
|
|
18412
18731
|
return projectApiPath(
|
|
18413
18732
|
project,
|
|
18414
|
-
`/sessions/${encodeURIComponent(sessionName)}${cleanSubpath(
|
|
18733
|
+
`/sessions/${encodeURIComponent(sessionName)}${cleanSubpath(path2)}`
|
|
18415
18734
|
);
|
|
18416
18735
|
}
|
|
18417
|
-
function runApiPath(runId,
|
|
18418
|
-
return apiPath(`/runs/${encodeURIComponent(runId)}${cleanSubpath(
|
|
18736
|
+
function runApiPath(runId, path2 = "") {
|
|
18737
|
+
return apiPath(`/runs/${encodeURIComponent(runId)}${cleanSubpath(path2)}`);
|
|
18419
18738
|
}
|
|
18420
|
-
function cleanSubpath(
|
|
18421
|
-
const trimmed =
|
|
18739
|
+
function cleanSubpath(path2) {
|
|
18740
|
+
const trimmed = path2.trim();
|
|
18422
18741
|
if (!trimmed) {
|
|
18423
18742
|
return "";
|
|
18424
18743
|
}
|
|
18425
18744
|
return trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
|
18426
18745
|
}
|
|
18427
|
-
function orgSubpath(organizationId,
|
|
18428
|
-
return `/orgs/${encodeURIComponent(organizationId)}${cleanSubpath(
|
|
18746
|
+
function orgSubpath(organizationId, path2 = "") {
|
|
18747
|
+
return `/orgs/${encodeURIComponent(organizationId)}${cleanSubpath(path2)}`;
|
|
18429
18748
|
}
|
|
18430
18749
|
var API_PREFIX;
|
|
18431
18750
|
var init_paths = __esm({
|
|
@@ -18717,9 +19036,9 @@ async function deleteProjectResource(context, request, options) {
|
|
|
18717
19036
|
};
|
|
18718
19037
|
}
|
|
18719
19038
|
async function applyProjectResources(context, request, options) {
|
|
18720
|
-
const
|
|
19039
|
+
const path2 = projectApplyPath(context);
|
|
18721
19040
|
const response = await context.authenticatedFetch(
|
|
18722
|
-
context.apiUrl(
|
|
19041
|
+
context.apiUrl(path2, options.apiBaseUrl),
|
|
18723
19042
|
{
|
|
18724
19043
|
method: "POST",
|
|
18725
19044
|
headers: {
|
|
@@ -18816,8 +19135,8 @@ function createApiClient(input) {
|
|
|
18816
19135
|
explicit
|
|
18817
19136
|
});
|
|
18818
19137
|
}
|
|
18819
|
-
function apiUrl(
|
|
18820
|
-
return `${apiBaseUrl(explicit)}${
|
|
19138
|
+
function apiUrl(path2, explicit) {
|
|
19139
|
+
return `${apiBaseUrl(explicit)}${path2}`;
|
|
18821
19140
|
}
|
|
18822
19141
|
function activeProject() {
|
|
18823
19142
|
const config2 = readConfig(input.configPath);
|
|
@@ -18986,10 +19305,11 @@ function createApiClient(input) {
|
|
|
18986
19305
|
headers: bootstrapAuthHeaders(init.headers)
|
|
18987
19306
|
});
|
|
18988
19307
|
}
|
|
18989
|
-
async function requestJson(
|
|
18990
|
-
const url2 = new URL(apiUrl(
|
|
18991
|
-
|
|
18992
|
-
|
|
19308
|
+
async function requestJson(path2, options = {}) {
|
|
19309
|
+
const url2 = new URL(apiUrl(path2, options.apiBaseUrl));
|
|
19310
|
+
const searchParamEntries = Array.isArray(options.searchParams) ? options.searchParams : Object.entries(options.searchParams ?? {});
|
|
19311
|
+
for (const [name, value] of searchParamEntries) {
|
|
19312
|
+
url2.searchParams.append(name, value);
|
|
18993
19313
|
}
|
|
18994
19314
|
const response = await authenticatedFetch(
|
|
18995
19315
|
url2.toString(),
|
|
@@ -19370,7 +19690,7 @@ function createApiClient(input) {
|
|
|
19370
19690
|
}),
|
|
19371
19691
|
async setSecret(name, request, options = {}) {
|
|
19372
19692
|
const organization = activeOrganization();
|
|
19373
|
-
const
|
|
19693
|
+
const path2 = options.projectId ? projectApiPath(
|
|
19374
19694
|
{
|
|
19375
19695
|
organizationId: organization.organizationId,
|
|
19376
19696
|
projectId: options.projectId
|
|
@@ -19381,7 +19701,7 @@ function createApiClient(input) {
|
|
|
19381
19701
|
`/secrets/${encodeURIComponent(name)}`
|
|
19382
19702
|
);
|
|
19383
19703
|
const response = await authenticatedFetch(
|
|
19384
|
-
apiUrl(
|
|
19704
|
+
apiUrl(path2, options.apiBaseUrl),
|
|
19385
19705
|
{
|
|
19386
19706
|
method: "PUT",
|
|
19387
19707
|
headers: {
|
|
@@ -19398,7 +19718,7 @@ function createApiClient(input) {
|
|
|
19398
19718
|
},
|
|
19399
19719
|
async listSecrets(options = {}) {
|
|
19400
19720
|
const organization = activeOrganization();
|
|
19401
|
-
const
|
|
19721
|
+
const path2 = options.projectId ? projectApiPath(
|
|
19402
19722
|
{
|
|
19403
19723
|
organizationId: organization.organizationId,
|
|
19404
19724
|
projectId: options.projectId
|
|
@@ -19406,7 +19726,7 @@ function createApiClient(input) {
|
|
|
19406
19726
|
"/secrets"
|
|
19407
19727
|
) : orgApiPath(organization.organizationId, "/secrets");
|
|
19408
19728
|
const response = await authenticatedFetch(
|
|
19409
|
-
apiUrl(
|
|
19729
|
+
apiUrl(path2, options.apiBaseUrl),
|
|
19410
19730
|
{},
|
|
19411
19731
|
options.apiBaseUrl
|
|
19412
19732
|
);
|
|
@@ -19417,7 +19737,7 @@ function createApiClient(input) {
|
|
|
19417
19737
|
},
|
|
19418
19738
|
async removeSecret(name, options = {}) {
|
|
19419
19739
|
const organization = activeOrganization();
|
|
19420
|
-
const
|
|
19740
|
+
const path2 = options.projectId ? projectApiPath(
|
|
19421
19741
|
{
|
|
19422
19742
|
organizationId: organization.organizationId,
|
|
19423
19743
|
projectId: options.projectId
|
|
@@ -19428,7 +19748,7 @@ function createApiClient(input) {
|
|
|
19428
19748
|
`/secrets/${encodeURIComponent(name)}`
|
|
19429
19749
|
);
|
|
19430
19750
|
const response = await authenticatedFetch(
|
|
19431
|
-
apiUrl(
|
|
19751
|
+
apiUrl(path2, options.apiBaseUrl),
|
|
19432
19752
|
{
|
|
19433
19753
|
method: "DELETE"
|
|
19434
19754
|
},
|
|
@@ -19729,7 +20049,7 @@ function createApiClient(input) {
|
|
|
19729
20049
|
sessionApiPath(scope, sessionName, "/runs"),
|
|
19730
20050
|
{
|
|
19731
20051
|
apiBaseUrl: options.apiBaseUrl,
|
|
19732
|
-
searchParams: options
|
|
20052
|
+
searchParams: runListSearchParams(options)
|
|
19733
20053
|
}
|
|
19734
20054
|
);
|
|
19735
20055
|
},
|
|
@@ -19737,7 +20057,87 @@ function createApiClient(input) {
|
|
|
19737
20057
|
const scope = activeProject();
|
|
19738
20058
|
return requestJson(projectApiPath(scope, "/runs"), {
|
|
19739
20059
|
apiBaseUrl: options.apiBaseUrl,
|
|
19740
|
-
searchParams: options
|
|
20060
|
+
searchParams: runListSearchParams(options)
|
|
20061
|
+
});
|
|
20062
|
+
},
|
|
20063
|
+
async getRunSummary(runId, options = {}) {
|
|
20064
|
+
return requestJson(runApiPath(runId, "/summary"), {
|
|
20065
|
+
apiBaseUrl: options.apiBaseUrl
|
|
20066
|
+
});
|
|
20067
|
+
},
|
|
20068
|
+
async getRunConversation(runId, options = {}) {
|
|
20069
|
+
const searchParams = [];
|
|
20070
|
+
if (options.cursor) searchParams.push(["cursor", options.cursor]);
|
|
20071
|
+
if (options.before !== void 0)
|
|
20072
|
+
searchParams.push(["before", String(options.before)]);
|
|
20073
|
+
if (options.limit !== void 0)
|
|
20074
|
+
searchParams.push(["limit", String(options.limit)]);
|
|
20075
|
+
if (options.order) searchParams.push(["order", options.order]);
|
|
20076
|
+
for (const kind of options.kinds ?? []) searchParams.push(["kind", kind]);
|
|
20077
|
+
for (const role of options.roles ?? []) searchParams.push(["role", role]);
|
|
20078
|
+
return requestJson(
|
|
20079
|
+
runApiPath(runId, "/conversation"),
|
|
20080
|
+
{
|
|
20081
|
+
apiBaseUrl: options.apiBaseUrl,
|
|
20082
|
+
searchParams
|
|
20083
|
+
}
|
|
20084
|
+
);
|
|
20085
|
+
},
|
|
20086
|
+
async searchRunConversation(runId, queries, options = {}) {
|
|
20087
|
+
const searchParams = queries.map((query) => [
|
|
20088
|
+
"q",
|
|
20089
|
+
query
|
|
20090
|
+
]);
|
|
20091
|
+
if (options.after !== void 0)
|
|
20092
|
+
searchParams.push(["after", String(options.after)]);
|
|
20093
|
+
for (const kind of options.kinds ?? []) searchParams.push(["kind", kind]);
|
|
20094
|
+
for (const role of options.roles ?? []) searchParams.push(["role", role]);
|
|
20095
|
+
if (options.limit !== void 0)
|
|
20096
|
+
searchParams.push(["limit", String(options.limit)]);
|
|
20097
|
+
return requestJson(
|
|
20098
|
+
runApiPath(runId, "/conversation/search"),
|
|
20099
|
+
{
|
|
20100
|
+
apiBaseUrl: options.apiBaseUrl,
|
|
20101
|
+
searchParams
|
|
20102
|
+
}
|
|
20103
|
+
);
|
|
20104
|
+
},
|
|
20105
|
+
async listRunToolExchanges(runId, options = {}) {
|
|
20106
|
+
const searchParams = [];
|
|
20107
|
+
if (options.toolName) searchParams.push(["toolName", options.toolName]);
|
|
20108
|
+
if (options.errorsOnly) searchParams.push(["errorsOnly", "true"]);
|
|
20109
|
+
if (options.after !== void 0)
|
|
20110
|
+
searchParams.push(["after", String(options.after)]);
|
|
20111
|
+
if (options.before !== void 0)
|
|
20112
|
+
searchParams.push(["before", String(options.before)]);
|
|
20113
|
+
if (options.order) searchParams.push(["order", options.order]);
|
|
20114
|
+
if (options.limit !== void 0)
|
|
20115
|
+
searchParams.push(["limit", String(options.limit)]);
|
|
20116
|
+
return requestJson(
|
|
20117
|
+
runApiPath(runId, "/tools"),
|
|
20118
|
+
{
|
|
20119
|
+
apiBaseUrl: options.apiBaseUrl,
|
|
20120
|
+
searchParams
|
|
20121
|
+
}
|
|
20122
|
+
);
|
|
20123
|
+
},
|
|
20124
|
+
async listRunTriggers(runId, options = {}) {
|
|
20125
|
+
return requestJson(runApiPath(runId, "/triggers"), {
|
|
20126
|
+
apiBaseUrl: options.apiBaseUrl,
|
|
20127
|
+
searchParams: options.payload ? { payload: options.payload } : void 0
|
|
20128
|
+
});
|
|
20129
|
+
},
|
|
20130
|
+
async listRunArtifacts(runId, options = {}) {
|
|
20131
|
+
return requestJson(
|
|
20132
|
+
runApiPath(runId, "/artifacts"),
|
|
20133
|
+
{
|
|
20134
|
+
apiBaseUrl: options.apiBaseUrl
|
|
20135
|
+
}
|
|
20136
|
+
);
|
|
20137
|
+
},
|
|
20138
|
+
async listRunCommands(runId, options = {}) {
|
|
20139
|
+
return requestJson(runApiPath(runId, "/commands"), {
|
|
20140
|
+
apiBaseUrl: options.apiBaseUrl
|
|
19741
20141
|
});
|
|
19742
20142
|
},
|
|
19743
20143
|
getOperatorInfo() {
|
|
@@ -19797,6 +20197,22 @@ function createApiClient(input) {
|
|
|
19797
20197
|
}
|
|
19798
20198
|
};
|
|
19799
20199
|
}
|
|
20200
|
+
function runListSearchParams(options) {
|
|
20201
|
+
const searchParams = [];
|
|
20202
|
+
if (options.includeArchived) {
|
|
20203
|
+
searchParams.push(["include_archived", "true"]);
|
|
20204
|
+
}
|
|
20205
|
+
for (const status of options.statuses ?? []) {
|
|
20206
|
+
searchParams.push(["status", status]);
|
|
20207
|
+
}
|
|
20208
|
+
if (options.since) {
|
|
20209
|
+
searchParams.push(["created_after", options.since]);
|
|
20210
|
+
}
|
|
20211
|
+
if (options.limit !== void 0) {
|
|
20212
|
+
searchParams.push(["limit", String(options.limit)]);
|
|
20213
|
+
}
|
|
20214
|
+
return searchParams;
|
|
20215
|
+
}
|
|
19800
20216
|
var init_client = __esm({
|
|
19801
20217
|
"src/lib/api/client.ts"() {
|
|
19802
20218
|
"use strict";
|
|
@@ -19831,9 +20247,9 @@ var init_browser = __esm({
|
|
|
19831
20247
|
});
|
|
19832
20248
|
|
|
19833
20249
|
// src/lib/oauth/loopback.ts
|
|
19834
|
-
import { createServer } from "http";
|
|
20250
|
+
import { createServer as createServer2 } from "http";
|
|
19835
20251
|
async function createOAuthLoopbackCallback(input) {
|
|
19836
|
-
const
|
|
20252
|
+
const path2 = input?.path ?? "/callback";
|
|
19837
20253
|
const successHtml = input?.successHtml ?? renderOAuthLoopbackPage({
|
|
19838
20254
|
status: "success",
|
|
19839
20255
|
eyebrow: "Auto",
|
|
@@ -19852,9 +20268,9 @@ async function createOAuthLoopbackCallback(input) {
|
|
|
19852
20268
|
resolveResult = resolve2;
|
|
19853
20269
|
rejectResult = reject;
|
|
19854
20270
|
});
|
|
19855
|
-
const server =
|
|
20271
|
+
const server = createServer2((request, response) => {
|
|
19856
20272
|
const url2 = new URL(request.url ?? "/", "http://127.0.0.1");
|
|
19857
|
-
if (url2.pathname !==
|
|
20273
|
+
if (url2.pathname !== path2) {
|
|
19858
20274
|
response.writeHead(404).end("Not found");
|
|
19859
20275
|
return;
|
|
19860
20276
|
}
|
|
@@ -19896,7 +20312,7 @@ async function createOAuthLoopbackCallback(input) {
|
|
|
19896
20312
|
const address = server.address();
|
|
19897
20313
|
return {
|
|
19898
20314
|
close: () => server.close(),
|
|
19899
|
-
redirectUri: `http://127.0.0.1:${address.port}${
|
|
20315
|
+
redirectUri: `http://127.0.0.1:${address.port}${path2}`,
|
|
19900
20316
|
result
|
|
19901
20317
|
};
|
|
19902
20318
|
}
|
|
@@ -20278,12 +20694,12 @@ function readProjectApplyRequest(options) {
|
|
|
20278
20694
|
throw new Error(`No resource files found in ${directory}`);
|
|
20279
20695
|
}
|
|
20280
20696
|
const resources = [];
|
|
20281
|
-
for (const { kind, path } of files) {
|
|
20282
|
-
const request = readApplyDocumentFile(
|
|
20697
|
+
for (const { kind, path: path2 } of files) {
|
|
20698
|
+
const request = readApplyDocumentFile(path2);
|
|
20283
20699
|
for (const resource of request.resources) {
|
|
20284
20700
|
if (resource.kind !== kind) {
|
|
20285
20701
|
throw new Error(
|
|
20286
|
-
`Resource kind "${resource.kind}" in ${
|
|
20702
|
+
`Resource kind "${resource.kind}" in ${path2} does not match .auto/${APPLY_DIRECTORIES[kind]}`
|
|
20287
20703
|
);
|
|
20288
20704
|
}
|
|
20289
20705
|
resources.push(resource);
|
|
@@ -20335,15 +20751,15 @@ function applyFiles(root) {
|
|
|
20335
20751
|
const files = [];
|
|
20336
20752
|
for (const kind of APPLY_RESOURCE_ORDER) {
|
|
20337
20753
|
const directory = APPLY_DIRECTORIES[kind];
|
|
20338
|
-
const
|
|
20754
|
+
const path2 = join3(root, directory);
|
|
20339
20755
|
let entries;
|
|
20340
20756
|
try {
|
|
20341
|
-
entries = readdirSync(
|
|
20757
|
+
entries = readdirSync(path2, { withFileTypes: true });
|
|
20342
20758
|
} catch {
|
|
20343
20759
|
continue;
|
|
20344
20760
|
}
|
|
20345
20761
|
files.push(
|
|
20346
|
-
...resourceApplyFiles(
|
|
20762
|
+
...resourceApplyFiles(path2, entries).map((file2) => ({
|
|
20347
20763
|
kind,
|
|
20348
20764
|
path: file2
|
|
20349
20765
|
}))
|
|
@@ -20351,8 +20767,8 @@ function applyFiles(root) {
|
|
|
20351
20767
|
}
|
|
20352
20768
|
return files;
|
|
20353
20769
|
}
|
|
20354
|
-
function readApplyDocumentFile(
|
|
20355
|
-
const source = readFileSync3(
|
|
20770
|
+
function readApplyDocumentFile(path2) {
|
|
20771
|
+
const source = readFileSync3(path2, "utf8");
|
|
20356
20772
|
let documents;
|
|
20357
20773
|
try {
|
|
20358
20774
|
documents = parseYamlDocuments(source).filter((document) => document.contents !== null).map((document) => document.toJSON());
|
|
@@ -20362,7 +20778,7 @@ function readApplyDocumentFile(path) {
|
|
|
20362
20778
|
);
|
|
20363
20779
|
}
|
|
20364
20780
|
if (documents.length === 0) {
|
|
20365
|
-
throw new Error(`Invalid apply file: ${
|
|
20781
|
+
throw new Error(`Invalid apply file: ${path2} is empty`);
|
|
20366
20782
|
}
|
|
20367
20783
|
if (documents.length === 1) {
|
|
20368
20784
|
const system = ProjectApplySystemConfigSchema.safeParse(documents[0]);
|
|
@@ -20488,8 +20904,8 @@ function applyFileProjectRoot(file2) {
|
|
|
20488
20904
|
dir = parent;
|
|
20489
20905
|
}
|
|
20490
20906
|
}
|
|
20491
|
-
function isInside(
|
|
20492
|
-
return
|
|
20907
|
+
function isInside(path2, parent) {
|
|
20908
|
+
return path2.startsWith(`${parent}/`);
|
|
20493
20909
|
}
|
|
20494
20910
|
function applyCandidate(document) {
|
|
20495
20911
|
if (!isRecord(document) || !("kind" in document)) {
|
|
@@ -20515,15 +20931,15 @@ function isRecord(value) {
|
|
|
20515
20931
|
function resourceApplyFiles(directory, entries) {
|
|
20516
20932
|
const files = [];
|
|
20517
20933
|
for (const entry of entries) {
|
|
20518
|
-
const
|
|
20934
|
+
const path2 = join3(directory, entry.name);
|
|
20519
20935
|
if (entry.isDirectory()) {
|
|
20520
20936
|
files.push(
|
|
20521
|
-
...resourceApplyFiles(
|
|
20937
|
+
...resourceApplyFiles(path2, readdirSync(path2, { withFileTypes: true }))
|
|
20522
20938
|
);
|
|
20523
20939
|
continue;
|
|
20524
20940
|
}
|
|
20525
20941
|
if (entry.isFile() && /\.(json|ya?ml)$/i.test(entry.name)) {
|
|
20526
|
-
files.push(
|
|
20942
|
+
files.push(path2);
|
|
20527
20943
|
}
|
|
20528
20944
|
}
|
|
20529
20945
|
return files.sort((left, right) => left.localeCompare(right));
|
|
@@ -20677,8 +21093,8 @@ function listProfiles(configPath = defaultConfigPath()) {
|
|
|
20677
21093
|
throw err;
|
|
20678
21094
|
}
|
|
20679
21095
|
return entries.filter((entry) => entry.endsWith(".yaml")).sort().map((entry) => {
|
|
20680
|
-
const
|
|
20681
|
-
return { path, config: readConfig(
|
|
21096
|
+
const path2 = join4(dir, entry);
|
|
21097
|
+
return { path: path2, config: readConfig(path2) };
|
|
20682
21098
|
}).filter((profile) => profile.config.userEmail);
|
|
20683
21099
|
}
|
|
20684
21100
|
function findAccountProfile(input) {
|
|
@@ -21183,7 +21599,7 @@ var init_package = __esm({
|
|
|
21183
21599
|
"package.json"() {
|
|
21184
21600
|
package_default = {
|
|
21185
21601
|
name: "@autohq/cli",
|
|
21186
|
-
version: "0.1.
|
|
21602
|
+
version: "0.1.90",
|
|
21187
21603
|
license: "SEE LICENSE IN README.md",
|
|
21188
21604
|
publishConfig: {
|
|
21189
21605
|
access: "public"
|
|
@@ -23866,7 +24282,10 @@ function sessionRunsQueryOptions(client, sessionName, apiUrl, includeArchived =
|
|
|
23866
24282
|
queryFn: async () => {
|
|
23867
24283
|
const res = await client.listSessionRuns(sessionName ?? "", {
|
|
23868
24284
|
apiBaseUrl: apiUrl,
|
|
23869
|
-
includeArchived
|
|
24285
|
+
includeArchived,
|
|
24286
|
+
// The run-list routes default to 50; ask for the server max so the
|
|
24287
|
+
// TUI keeps showing deep history.
|
|
24288
|
+
limit: TUI_RUN_LIST_LIMIT
|
|
23870
24289
|
});
|
|
23871
24290
|
return res.runs;
|
|
23872
24291
|
},
|
|
@@ -23880,7 +24299,8 @@ function runsQueryOptions(client, apiUrl, includeArchived = false) {
|
|
|
23880
24299
|
queryFn: async () => {
|
|
23881
24300
|
const res = await client.listRuns({
|
|
23882
24301
|
apiBaseUrl: apiUrl,
|
|
23883
|
-
includeArchived
|
|
24302
|
+
includeArchived,
|
|
24303
|
+
limit: TUI_RUN_LIST_LIMIT
|
|
23884
24304
|
});
|
|
23885
24305
|
return res.runs;
|
|
23886
24306
|
},
|
|
@@ -23996,12 +24416,13 @@ function invalidateRunsQueries(queryClient, apiUrl, runs) {
|
|
|
23996
24416
|
});
|
|
23997
24417
|
}
|
|
23998
24418
|
}
|
|
23999
|
-
var queryKeys, RUNS_REFETCH_INTERVAL_MS;
|
|
24419
|
+
var TUI_RUN_LIST_LIMIT, queryKeys, RUNS_REFETCH_INTERVAL_MS;
|
|
24000
24420
|
var init_queries = __esm({
|
|
24001
24421
|
"src/tui/hooks/queries.ts"() {
|
|
24002
24422
|
"use strict";
|
|
24003
24423
|
init_src();
|
|
24004
24424
|
init_ApiClientContext();
|
|
24425
|
+
TUI_RUN_LIST_LIMIT = 200;
|
|
24005
24426
|
queryKeys = {
|
|
24006
24427
|
environments: (apiUrl) => ["environments", apiUrl],
|
|
24007
24428
|
profiles: (apiUrl) => ["profiles", apiUrl],
|
|
@@ -24359,7 +24780,7 @@ var init_SessionsView = __esm({
|
|
|
24359
24780
|
|
|
24360
24781
|
// src/tui/SpecInspector.tsx
|
|
24361
24782
|
import { Box as Box12, Text as Text13 } from "ink";
|
|
24362
|
-
import { stringify as
|
|
24783
|
+
import { stringify as stringify4 } from "yaml";
|
|
24363
24784
|
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
24364
24785
|
function SpecInspector({
|
|
24365
24786
|
kind,
|
|
@@ -24390,7 +24811,7 @@ function specLineCount(spec) {
|
|
|
24390
24811
|
return yamlLines(spec).length;
|
|
24391
24812
|
}
|
|
24392
24813
|
function yamlLines(spec) {
|
|
24393
|
-
return
|
|
24814
|
+
return stringify4(spec).trimEnd().split("\n");
|
|
24394
24815
|
}
|
|
24395
24816
|
function YamlLine({ line }) {
|
|
24396
24817
|
const match = /^(\s*)([^:#][^:]*:)(.*)$/.exec(line);
|
|
@@ -26304,6 +26725,156 @@ var init_launcher = __esm({
|
|
|
26304
26725
|
// src/cli/program.ts
|
|
26305
26726
|
import { Command, Option as Option3 } from "commander";
|
|
26306
26727
|
|
|
26728
|
+
// src/commands/agent-bridge/git-credentials.ts
|
|
26729
|
+
import { once } from "events";
|
|
26730
|
+
import { chmod, mkdir, readFile, writeFile } from "fs/promises";
|
|
26731
|
+
import { createServer } from "http";
|
|
26732
|
+
import { homedir } from "os";
|
|
26733
|
+
import path from "path";
|
|
26734
|
+
var RELAY_PATH = "/git-credential";
|
|
26735
|
+
function defaultGitCredentialPortFilePath() {
|
|
26736
|
+
return path.join(homedir(), ".auto", "agent-bridge", "git-credential.json");
|
|
26737
|
+
}
|
|
26738
|
+
async function startGitCredentialRelay(input) {
|
|
26739
|
+
const fetchImpl = input.fetchImpl ?? fetch;
|
|
26740
|
+
let target = { url: input.url, accessToken: input.accessToken };
|
|
26741
|
+
const server = createServer((request, response) => {
|
|
26742
|
+
if (request.method !== "POST" || request.url !== RELAY_PATH) {
|
|
26743
|
+
response.writeHead(404).end();
|
|
26744
|
+
return;
|
|
26745
|
+
}
|
|
26746
|
+
const chunks = [];
|
|
26747
|
+
request.on("data", (chunk) => chunks.push(chunk));
|
|
26748
|
+
request.on("end", () => {
|
|
26749
|
+
void (async () => {
|
|
26750
|
+
try {
|
|
26751
|
+
const upstream = await fetchImpl(target.url, {
|
|
26752
|
+
method: "POST",
|
|
26753
|
+
headers: {
|
|
26754
|
+
authorization: `Bearer ${target.accessToken}`,
|
|
26755
|
+
"content-type": "application/json"
|
|
26756
|
+
},
|
|
26757
|
+
body: Buffer.concat(chunks).toString("utf8") || "{}"
|
|
26758
|
+
});
|
|
26759
|
+
const body = await upstream.text();
|
|
26760
|
+
response.writeHead(upstream.status, {
|
|
26761
|
+
"content-type": upstream.headers.get("content-type") ?? "application/json"
|
|
26762
|
+
}).end(body);
|
|
26763
|
+
} catch (error51) {
|
|
26764
|
+
response.writeHead(502, { "content-type": "application/json" }).end(
|
|
26765
|
+
JSON.stringify({
|
|
26766
|
+
error: error51 instanceof Error ? error51.message : String(error51)
|
|
26767
|
+
})
|
|
26768
|
+
);
|
|
26769
|
+
}
|
|
26770
|
+
})();
|
|
26771
|
+
});
|
|
26772
|
+
});
|
|
26773
|
+
server.listen(0, "127.0.0.1");
|
|
26774
|
+
await once(server, "listening");
|
|
26775
|
+
server.unref();
|
|
26776
|
+
const address = server.address();
|
|
26777
|
+
if (!address || typeof address !== "object") {
|
|
26778
|
+
server.close();
|
|
26779
|
+
throw new Error("git credential relay failed to bind a loopback port");
|
|
26780
|
+
}
|
|
26781
|
+
const portFilePath = input.portFilePath ?? defaultGitCredentialPortFilePath();
|
|
26782
|
+
await mkdir(path.dirname(portFilePath), { recursive: true });
|
|
26783
|
+
await writeFile(portFilePath, JSON.stringify({ port: address.port }), {
|
|
26784
|
+
mode: 384
|
|
26785
|
+
});
|
|
26786
|
+
await chmod(portFilePath, 384);
|
|
26787
|
+
return {
|
|
26788
|
+
port: address.port,
|
|
26789
|
+
update: (next) => {
|
|
26790
|
+
target = { url: next.url, accessToken: next.accessToken };
|
|
26791
|
+
},
|
|
26792
|
+
close: () => new Promise((resolve2) => {
|
|
26793
|
+
server.close(() => resolve2());
|
|
26794
|
+
})
|
|
26795
|
+
};
|
|
26796
|
+
}
|
|
26797
|
+
async function runGitCredentialHelper(input) {
|
|
26798
|
+
if (input.args.includes("--check")) {
|
|
26799
|
+
return 0;
|
|
26800
|
+
}
|
|
26801
|
+
const operation = input.args.find((arg) => !arg.startsWith("-"));
|
|
26802
|
+
if (operation === "store" || operation === "erase") {
|
|
26803
|
+
return 0;
|
|
26804
|
+
}
|
|
26805
|
+
if (operation !== "get") {
|
|
26806
|
+
input.writeError(`unsupported git credential operation: ${operation}`);
|
|
26807
|
+
return 1;
|
|
26808
|
+
}
|
|
26809
|
+
try {
|
|
26810
|
+
const attributes = parseGitCredentialAttributes(
|
|
26811
|
+
await readStream(input.stdin)
|
|
26812
|
+
);
|
|
26813
|
+
if (attributes.protocol !== "https" || attributes.host !== "github.com") {
|
|
26814
|
+
return 1;
|
|
26815
|
+
}
|
|
26816
|
+
const portFilePath = input.portFilePath ?? defaultGitCredentialPortFilePath();
|
|
26817
|
+
const portFile = JSON.parse(await readFile(portFilePath, "utf8"));
|
|
26818
|
+
if (typeof portFile.port !== "number") {
|
|
26819
|
+
input.writeError("git credential relay port file is malformed");
|
|
26820
|
+
return 1;
|
|
26821
|
+
}
|
|
26822
|
+
const response = await (input.fetchImpl ?? fetch)(
|
|
26823
|
+
`http://127.0.0.1:${portFile.port}${RELAY_PATH}`,
|
|
26824
|
+
{
|
|
26825
|
+
method: "POST",
|
|
26826
|
+
headers: { "content-type": "application/json" },
|
|
26827
|
+
body: JSON.stringify({
|
|
26828
|
+
host: attributes.host,
|
|
26829
|
+
...attributes.path ? { path: attributes.path } : {}
|
|
26830
|
+
})
|
|
26831
|
+
}
|
|
26832
|
+
);
|
|
26833
|
+
if (!response.ok) {
|
|
26834
|
+
input.writeError(
|
|
26835
|
+
`git credential broker rejected the request: ${response.status}`
|
|
26836
|
+
);
|
|
26837
|
+
return 1;
|
|
26838
|
+
}
|
|
26839
|
+
const credential = await response.json();
|
|
26840
|
+
if (!credential.username || !credential.password) {
|
|
26841
|
+
input.writeError("git credential broker returned no credential");
|
|
26842
|
+
return 1;
|
|
26843
|
+
}
|
|
26844
|
+
input.writeOutput(`username=${credential.username}`);
|
|
26845
|
+
input.writeOutput(`password=${credential.password}`);
|
|
26846
|
+
const expiryUtc = credential.expiresAt ? Math.floor(new Date(credential.expiresAt).getTime() / 1e3) : void 0;
|
|
26847
|
+
if (expiryUtc && Number.isFinite(expiryUtc)) {
|
|
26848
|
+
input.writeOutput(`password_expiry_utc=${expiryUtc}`);
|
|
26849
|
+
}
|
|
26850
|
+
return 0;
|
|
26851
|
+
} catch (error51) {
|
|
26852
|
+
input.writeError(error51 instanceof Error ? error51.message : String(error51));
|
|
26853
|
+
return 1;
|
|
26854
|
+
}
|
|
26855
|
+
}
|
|
26856
|
+
function parseGitCredentialAttributes(raw) {
|
|
26857
|
+
const attributes = {};
|
|
26858
|
+
for (const line of raw.split("\n")) {
|
|
26859
|
+
if (!line.trim()) {
|
|
26860
|
+
continue;
|
|
26861
|
+
}
|
|
26862
|
+
const separator = line.indexOf("=");
|
|
26863
|
+
if (separator <= 0) {
|
|
26864
|
+
continue;
|
|
26865
|
+
}
|
|
26866
|
+
attributes[line.slice(0, separator)] = line.slice(separator + 1);
|
|
26867
|
+
}
|
|
26868
|
+
return attributes;
|
|
26869
|
+
}
|
|
26870
|
+
async function readStream(stream) {
|
|
26871
|
+
const chunks = [];
|
|
26872
|
+
for await (const chunk of stream) {
|
|
26873
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
26874
|
+
}
|
|
26875
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
26876
|
+
}
|
|
26877
|
+
|
|
26307
26878
|
// ../../packages/protocol/src/index.ts
|
|
26308
26879
|
init_zod();
|
|
26309
26880
|
var OpaqueIdSchema = external_exports.string().trim().min(1);
|
|
@@ -26412,7 +26983,14 @@ var AgentBridgeClaudeConfigSchema = external_exports.object({
|
|
|
26412
26983
|
var RuntimeBridgeBootstrapPlaintextSchema = external_exports.object({
|
|
26413
26984
|
version: external_exports.literal(1),
|
|
26414
26985
|
outputSeqStart: external_exports.number().int().nonnegative(),
|
|
26415
|
-
claude: AgentBridgeClaudeConfigSchema
|
|
26986
|
+
claude: AgentBridgeClaudeConfigSchema,
|
|
26987
|
+
// Endpoint + run token for the git credential broker. Present only when
|
|
26988
|
+
// the run has GitHub App git mounts; rides the encrypted bootstrap so the
|
|
26989
|
+
// token lives in agent-bridge memory, never on disk.
|
|
26990
|
+
gitCredentials: external_exports.object({
|
|
26991
|
+
url: external_exports.string().trim().min(1),
|
|
26992
|
+
accessToken: external_exports.string().trim().min(1)
|
|
26993
|
+
}).strict().optional()
|
|
26416
26994
|
}).strict();
|
|
26417
26995
|
var RuntimeBridgeEncryptedBootstrapSchema = external_exports.object({
|
|
26418
26996
|
version: external_exports.literal(1),
|
|
@@ -26639,6 +27217,7 @@ async function runAgentBridgeSocket(options) {
|
|
|
26639
27217
|
RUNTIME_BRIDGE_BOOTSTRAP_EVENT,
|
|
26640
27218
|
createRuntimeBridgeBootstrapListener({
|
|
26641
27219
|
token: options.token,
|
|
27220
|
+
onBootstrap: options.onBootstrap,
|
|
26642
27221
|
createHandler: (bootstrap) => options.createHandler({
|
|
26643
27222
|
emitOutput: (output) => emitOutputWithAck(socket, output),
|
|
26644
27223
|
claude: bootstrap.claude,
|
|
@@ -26737,6 +27316,7 @@ function createRuntimeBridgeBootstrapListener(input) {
|
|
|
26737
27316
|
input.writeOutput?.(
|
|
26738
27317
|
`agent_bridge_bootstrap_decrypted duration_ms=${Date.now() - decryptStartedAt}`
|
|
26739
27318
|
);
|
|
27319
|
+
await input.onBootstrap?.(bootstrap);
|
|
26740
27320
|
let handler = input.getHandler();
|
|
26741
27321
|
if (!handler) {
|
|
26742
27322
|
handler = input.createHandler(bootstrap);
|
|
@@ -27573,21 +28153,21 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
|
27573
28153
|
import { dirname } from "path";
|
|
27574
28154
|
var AGENT_BRIDGE_RUNTIME_DIR = "/tmp/auto-bridge-runtime";
|
|
27575
28155
|
var CLAUDE_SESSION_RESUME_PATH = `${AGENT_BRIDGE_RUNTIME_DIR}/claude-session-id`;
|
|
27576
|
-
function fileClaudeSessionResumeStore(
|
|
28156
|
+
function fileClaudeSessionResumeStore(path2 = CLAUDE_SESSION_RESUME_PATH) {
|
|
27577
28157
|
return {
|
|
27578
28158
|
read(runId) {
|
|
27579
|
-
if (!existsSync(
|
|
28159
|
+
if (!existsSync(path2)) {
|
|
27580
28160
|
return null;
|
|
27581
28161
|
}
|
|
27582
|
-
const record2 = parseResumeRecord(readFileSync(
|
|
28162
|
+
const record2 = parseResumeRecord(readFileSync(path2, "utf8"));
|
|
27583
28163
|
if (!record2 || record2.runId !== runId) {
|
|
27584
28164
|
return null;
|
|
27585
28165
|
}
|
|
27586
28166
|
return record2.sessionId;
|
|
27587
28167
|
},
|
|
27588
28168
|
write(record2) {
|
|
27589
|
-
mkdirSync(dirname(
|
|
27590
|
-
writeFileSync(
|
|
28169
|
+
mkdirSync(dirname(path2), { recursive: true });
|
|
28170
|
+
writeFileSync(path2, `${JSON.stringify(record2)}
|
|
27591
28171
|
`, "utf8");
|
|
27592
28172
|
}
|
|
27593
28173
|
};
|
|
@@ -27956,7 +28536,10 @@ function deliveryMessage(delivery) {
|
|
|
27956
28536
|
// src/commands/agent-bridge/entrypoint.ts
|
|
27957
28537
|
async function runAgentBridgeProcess(input) {
|
|
27958
28538
|
const runAgentBridge = input.runAgentBridge ?? runAgentBridgeClaudeCode;
|
|
27959
|
-
await runAgentBridge(
|
|
28539
|
+
await runAgentBridge({
|
|
28540
|
+
...agentBridgeOptionsFromEnv(input),
|
|
28541
|
+
onBootstrap: createGitCredentialRelayStarter(input.writeOutput)
|
|
28542
|
+
});
|
|
27960
28543
|
}
|
|
27961
28544
|
function agentBridgeOptionsFromEnv(input) {
|
|
27962
28545
|
return {
|
|
@@ -27965,6 +28548,37 @@ function agentBridgeOptionsFromEnv(input) {
|
|
|
27965
28548
|
writeOutput: input.writeOutput
|
|
27966
28549
|
};
|
|
27967
28550
|
}
|
|
28551
|
+
function createGitCredentialRelayStarter(writeOutput) {
|
|
28552
|
+
let relay;
|
|
28553
|
+
let startup;
|
|
28554
|
+
return async (bootstrap) => {
|
|
28555
|
+
const gitCredentials = bootstrap.gitCredentials;
|
|
28556
|
+
if (!gitCredentials) {
|
|
28557
|
+
return;
|
|
28558
|
+
}
|
|
28559
|
+
if (relay) {
|
|
28560
|
+
relay.update(gitCredentials);
|
|
28561
|
+
return;
|
|
28562
|
+
}
|
|
28563
|
+
if (startup) {
|
|
28564
|
+
const started = await startup;
|
|
28565
|
+
started?.update(gitCredentials);
|
|
28566
|
+
return;
|
|
28567
|
+
}
|
|
28568
|
+
startup = startGitCredentialRelay(gitCredentials).then((started) => {
|
|
28569
|
+
relay = started;
|
|
28570
|
+
writeOutput?.(`agent_bridge_git_credential_relay port=${started.port}`);
|
|
28571
|
+
return started;
|
|
28572
|
+
}).catch((error51) => {
|
|
28573
|
+
startup = void 0;
|
|
28574
|
+
writeOutput?.(
|
|
28575
|
+
`agent_bridge_git_credential_relay_failed error=${error51 instanceof Error ? error51.message : String(error51)}`
|
|
28576
|
+
);
|
|
28577
|
+
return void 0;
|
|
28578
|
+
});
|
|
28579
|
+
await startup;
|
|
28580
|
+
};
|
|
28581
|
+
}
|
|
27968
28582
|
function requiredEnv(env, key) {
|
|
27969
28583
|
const value = env[key]?.trim();
|
|
27970
28584
|
if (!value) {
|
|
@@ -27975,12 +28589,25 @@ function requiredEnv(env, key) {
|
|
|
27975
28589
|
|
|
27976
28590
|
// src/commands/agent-bridge/commands.ts
|
|
27977
28591
|
function registerAgentBridgeCommands(program, context) {
|
|
27978
|
-
program.command("agent-bridge", { hidden: true }).description("Run the internal runtime bridge wrapper.").action(async () => {
|
|
28592
|
+
const agentBridge = program.command("agent-bridge", { hidden: true }).description("Run the internal runtime bridge wrapper.").action(async () => {
|
|
27979
28593
|
await runAgentBridgeProcess({
|
|
27980
28594
|
env: context.env,
|
|
27981
28595
|
writeOutput: context.writeOutput
|
|
27982
28596
|
});
|
|
27983
28597
|
});
|
|
28598
|
+
agentBridge.command("git-credential [operation]").description("git credential helper backed by the run's broker endpoint.").option("--check", "Exit 0 when the helper is available.").allowUnknownOption(true).action(async (operation, options) => {
|
|
28599
|
+
const exitCode = await runGitCredentialHelper({
|
|
28600
|
+
args: [
|
|
28601
|
+
...options.check ? ["--check"] : [],
|
|
28602
|
+
...operation ? [operation] : []
|
|
28603
|
+
],
|
|
28604
|
+
stdin: process.stdin,
|
|
28605
|
+
writeOutput: context.writeOutput,
|
|
28606
|
+
writeError: (line) => process.stderr.write(`${line}
|
|
28607
|
+
`)
|
|
28608
|
+
});
|
|
28609
|
+
process.exitCode = exitCode;
|
|
28610
|
+
});
|
|
27984
28611
|
}
|
|
27985
28612
|
|
|
27986
28613
|
// src/cli/options.ts
|
|
@@ -30424,26 +31051,292 @@ function validateNonNegativeInteger(value, label) {
|
|
|
30424
31051
|
}
|
|
30425
31052
|
}
|
|
30426
31053
|
|
|
31054
|
+
// src/commands/runs/introspect.ts
|
|
31055
|
+
var PREVIEW_CHARS = 160;
|
|
31056
|
+
async function handleRunsShow(context, runId, options = {}) {
|
|
31057
|
+
const client = createContextApiClient(context);
|
|
31058
|
+
const apiBaseUrl = apiUrlFromOptions(context, options);
|
|
31059
|
+
const [run, summary] = await Promise.all([
|
|
31060
|
+
client.getRun(runId, { apiBaseUrl }),
|
|
31061
|
+
client.getRunSummary(runId, { apiBaseUrl })
|
|
31062
|
+
]);
|
|
31063
|
+
context.io.writeResult({ run, summary }, formatRunShowText);
|
|
31064
|
+
}
|
|
31065
|
+
function formatRunShowText(result, writeLine) {
|
|
31066
|
+
const { summary } = result;
|
|
31067
|
+
writeLine(
|
|
31068
|
+
`${summary.run.id} ${summary.run.status} session=${summary.run.sessionName} profile=${summary.run.profileName}`
|
|
31069
|
+
);
|
|
31070
|
+
if (summary.run.displayTitle) {
|
|
31071
|
+
writeLine(`title: ${summary.run.displayTitle}`);
|
|
31072
|
+
}
|
|
31073
|
+
writeLine(
|
|
31074
|
+
`created=${summary.run.createdAt} started=${summary.run.startedAt ?? "-"} finished=${summary.run.finishedAt ?? "-"}`
|
|
31075
|
+
);
|
|
31076
|
+
writeLine(
|
|
31077
|
+
`timing: queued=${formatMs(summary.timing.queuedMs)} active=${formatMs(summary.timing.activeMs)} total=${formatMs(summary.timing.totalMs)}`
|
|
31078
|
+
);
|
|
31079
|
+
writeLine(
|
|
31080
|
+
`entries=${summary.conversation.entryCount} failed=${summary.conversation.failedEntryCount} turns=${summary.turns.length} lastSequence=${summary.conversation.lastSequence}`
|
|
31081
|
+
);
|
|
31082
|
+
writeLine(
|
|
31083
|
+
`trigger: spawn=${summary.trigger.spawn} signaled=${summary.trigger.signaledCount} dropped=${summary.trigger.droppedCount}`
|
|
31084
|
+
);
|
|
31085
|
+
if (summary.artifacts.count > 0) {
|
|
31086
|
+
writeLine(
|
|
31087
|
+
`artifacts: ${summary.artifacts.count} (${summary.artifacts.types.join(", ")})`
|
|
31088
|
+
);
|
|
31089
|
+
}
|
|
31090
|
+
writeLine(
|
|
31091
|
+
`commands: ${summary.commands.total} failed=${summary.commands.failed}`
|
|
31092
|
+
);
|
|
31093
|
+
if (summary.tools.length > 0) {
|
|
31094
|
+
writeLine("tools:");
|
|
31095
|
+
for (const tool of summary.tools) {
|
|
31096
|
+
writeLine(
|
|
31097
|
+
` ${tool.name} calls=${tool.calls} errors=${tool.errors} p50=${formatMs(tool.durationMs.p50)} max=${formatMs(tool.durationMs.max)}`
|
|
31098
|
+
);
|
|
31099
|
+
}
|
|
31100
|
+
}
|
|
31101
|
+
for (const check2 of summary.checks) {
|
|
31102
|
+
writeLine(
|
|
31103
|
+
`check: ${check2.name} ${check2.status}${check2.conclusion ? ` ${check2.conclusion}` : ""}`
|
|
31104
|
+
);
|
|
31105
|
+
}
|
|
31106
|
+
if (summary.run.error !== null) {
|
|
31107
|
+
writeLine(`error: ${JSON.stringify(summary.run.error)}`);
|
|
31108
|
+
}
|
|
31109
|
+
}
|
|
31110
|
+
async function handleRunsConversation(context, runId, options = {}) {
|
|
31111
|
+
const client = createContextApiClient(context);
|
|
31112
|
+
const tailMode = !options.after;
|
|
31113
|
+
const response = await client.getRunConversation(runId, {
|
|
31114
|
+
apiBaseUrl: apiUrlFromOptions(context, options),
|
|
31115
|
+
cursor: options.after,
|
|
31116
|
+
before: options.before,
|
|
31117
|
+
order: tailMode ? "desc" : "asc",
|
|
31118
|
+
limit: options.tail ?? 25,
|
|
31119
|
+
kinds: options.kind
|
|
31120
|
+
});
|
|
31121
|
+
const events = [...response.events].sort((a, b) => a.sequence - b.sequence);
|
|
31122
|
+
context.io.writeResult(
|
|
31123
|
+
{
|
|
31124
|
+
runId,
|
|
31125
|
+
events,
|
|
31126
|
+
cursor: response.cursor,
|
|
31127
|
+
hasMore: response.hasMore,
|
|
31128
|
+
full: Boolean(options.full),
|
|
31129
|
+
tailMode
|
|
31130
|
+
},
|
|
31131
|
+
formatConversationText
|
|
31132
|
+
);
|
|
31133
|
+
}
|
|
31134
|
+
function formatConversationText(result, writeLine) {
|
|
31135
|
+
if (result.events.length === 0) {
|
|
31136
|
+
writeLine("No conversation entries.");
|
|
31137
|
+
return;
|
|
31138
|
+
}
|
|
31139
|
+
for (const event of result.events) {
|
|
31140
|
+
const failed = event.status === "failed" ? " FAILED" : "";
|
|
31141
|
+
writeLine(
|
|
31142
|
+
`${event.sequence} ${event.role}/${event.kind}${failed}: ${entryPreview(event, result.full)}`
|
|
31143
|
+
);
|
|
31144
|
+
}
|
|
31145
|
+
if (result.hasMore) {
|
|
31146
|
+
if (result.tailMode) {
|
|
31147
|
+
const oldest = result.events[0]?.sequence;
|
|
31148
|
+
writeLine(
|
|
31149
|
+
`(more older entries; rerun with --before ${oldest ?? "<sequence>"})`
|
|
31150
|
+
);
|
|
31151
|
+
} else {
|
|
31152
|
+
writeLine(`(more entries; continue with --after ${result.cursor})`);
|
|
31153
|
+
}
|
|
31154
|
+
}
|
|
31155
|
+
}
|
|
31156
|
+
async function handleRunsSearch(context, runId, queries, options = {}) {
|
|
31157
|
+
const client = createContextApiClient(context);
|
|
31158
|
+
const response = await client.searchRunConversation(runId, queries, {
|
|
31159
|
+
apiBaseUrl: apiUrlFromOptions(context, options),
|
|
31160
|
+
kinds: options.kind,
|
|
31161
|
+
after: options.after,
|
|
31162
|
+
limit: options.limit
|
|
31163
|
+
});
|
|
31164
|
+
context.io.writeResult({ runId, queries, ...response }, formatSearchText);
|
|
31165
|
+
}
|
|
31166
|
+
function formatSearchText(result, writeLine) {
|
|
31167
|
+
if (result.matches.length === 0) {
|
|
31168
|
+
writeLine(`No matches for: ${result.queries.join(", ")}`);
|
|
31169
|
+
return;
|
|
31170
|
+
}
|
|
31171
|
+
for (const match of result.matches) {
|
|
31172
|
+
for (const snippet of match.snippets) {
|
|
31173
|
+
writeLine(
|
|
31174
|
+
`${match.sequence} ${match.kind} [${snippet.query}]: ${singleLine(snippet.text)}`
|
|
31175
|
+
);
|
|
31176
|
+
}
|
|
31177
|
+
}
|
|
31178
|
+
if (result.hasMore) {
|
|
31179
|
+
writeLine(
|
|
31180
|
+
`(more scanned entries; continue with --after ${result.nextAfterSequence ?? "<sequence>"})`
|
|
31181
|
+
);
|
|
31182
|
+
}
|
|
31183
|
+
}
|
|
31184
|
+
async function handleRunsTools(context, runId, options = {}) {
|
|
31185
|
+
const client = createContextApiClient(context);
|
|
31186
|
+
const response = await client.listRunToolExchanges(runId, {
|
|
31187
|
+
apiBaseUrl: apiUrlFromOptions(context, options),
|
|
31188
|
+
toolName: options.tool,
|
|
31189
|
+
errorsOnly: options.errors,
|
|
31190
|
+
after: options.after,
|
|
31191
|
+
before: options.before,
|
|
31192
|
+
limit: options.limit
|
|
31193
|
+
});
|
|
31194
|
+
context.io.writeResult({ runId, ...response }, formatToolsText);
|
|
31195
|
+
}
|
|
31196
|
+
function formatToolsText(result, writeLine) {
|
|
31197
|
+
if (result.exchanges.length === 0) {
|
|
31198
|
+
writeLine("No tool exchanges.");
|
|
31199
|
+
return;
|
|
31200
|
+
}
|
|
31201
|
+
for (const exchange of result.exchanges) {
|
|
31202
|
+
const duration4 = exchange.durationMs === null ? "-" : `${exchange.durationMs}ms`;
|
|
31203
|
+
const outcome = exchange.isError === null ? "pending" : exchange.isError ? "ERR" : "ok";
|
|
31204
|
+
writeLine(
|
|
31205
|
+
`${exchange.callSequence} ${exchange.name} ${duration4} ${outcome}: ${preview(exchange.input)}`
|
|
31206
|
+
);
|
|
31207
|
+
}
|
|
31208
|
+
if (result.hasMore) {
|
|
31209
|
+
writeLine(
|
|
31210
|
+
`(more exchanges; page older with --before ${result.nextBeforeSequence ?? "<sequence>"})`
|
|
31211
|
+
);
|
|
31212
|
+
}
|
|
31213
|
+
}
|
|
31214
|
+
async function handleRunsTriggers(context, runId, options = {}) {
|
|
31215
|
+
const client = createContextApiClient(context);
|
|
31216
|
+
const response = await client.listRunTriggers(runId, {
|
|
31217
|
+
apiBaseUrl: apiUrlFromOptions(context, options)
|
|
31218
|
+
});
|
|
31219
|
+
context.io.writeResult({ runId, ...response }, formatTriggersText);
|
|
31220
|
+
}
|
|
31221
|
+
function formatTriggersText(result, writeLine) {
|
|
31222
|
+
if (result.spawn) {
|
|
31223
|
+
writeLine(
|
|
31224
|
+
`spawn: ${result.spawn.eventKey} (${result.spawn.originKind}) delivered=${result.spawn.deliveredAt}`
|
|
31225
|
+
);
|
|
31226
|
+
} else if (result.starter) {
|
|
31227
|
+
writeLine(
|
|
31228
|
+
`spawn: ${result.starter.principal.kind === "run" ? "agent" : "manual"} starter=${JSON.stringify(result.starter.principal)}`
|
|
31229
|
+
);
|
|
31230
|
+
} else {
|
|
31231
|
+
writeLine("spawn: manual");
|
|
31232
|
+
}
|
|
31233
|
+
if (result.deliveries.length === 0) {
|
|
31234
|
+
writeLine("No subsequent deliveries.");
|
|
31235
|
+
return;
|
|
31236
|
+
}
|
|
31237
|
+
for (const delivery of result.deliveries) {
|
|
31238
|
+
const reason = delivery.reason ? ` reason=${delivery.reason}` : "";
|
|
31239
|
+
writeLine(
|
|
31240
|
+
`${delivery.deliveredAt} ${delivery.action} ${delivery.eventKey}${reason}`
|
|
31241
|
+
);
|
|
31242
|
+
}
|
|
31243
|
+
}
|
|
31244
|
+
async function handleRunsArtifacts(context, runId, options = {}) {
|
|
31245
|
+
const client = createContextApiClient(context);
|
|
31246
|
+
const response = await client.listRunArtifacts(runId, {
|
|
31247
|
+
apiBaseUrl: apiUrlFromOptions(context, options)
|
|
31248
|
+
});
|
|
31249
|
+
context.io.writeResult({ runId, ...response }, formatArtifactsText);
|
|
31250
|
+
}
|
|
31251
|
+
function formatArtifactsText(result, writeLine) {
|
|
31252
|
+
if (result.artifacts.length === 0) {
|
|
31253
|
+
writeLine("No artifacts currently owned.");
|
|
31254
|
+
return;
|
|
31255
|
+
}
|
|
31256
|
+
for (const artifact of result.artifacts) {
|
|
31257
|
+
writeLine(
|
|
31258
|
+
`${artifact.artifactType} ${artifact.externalId} recorded=${artifact.recordedAt}`
|
|
31259
|
+
);
|
|
31260
|
+
}
|
|
31261
|
+
}
|
|
31262
|
+
async function handleRunsCommands(context, runId, options = {}) {
|
|
31263
|
+
const client = createContextApiClient(context);
|
|
31264
|
+
const response = await client.listRunCommands(runId, {
|
|
31265
|
+
apiBaseUrl: apiUrlFromOptions(context, options)
|
|
31266
|
+
});
|
|
31267
|
+
context.io.writeResult({ runId, ...response }, formatCommandsText);
|
|
31268
|
+
}
|
|
31269
|
+
function formatCommandsText(result, writeLine) {
|
|
31270
|
+
if (result.commands.length === 0) {
|
|
31271
|
+
writeLine("No commands.");
|
|
31272
|
+
return;
|
|
31273
|
+
}
|
|
31274
|
+
for (const command of result.commands) {
|
|
31275
|
+
writeLine(
|
|
31276
|
+
`${command.createdAt} ${command.kind} ${command.status} sender=${command.sender.type}: ${preview(command.payload)}`
|
|
31277
|
+
);
|
|
31278
|
+
}
|
|
31279
|
+
}
|
|
31280
|
+
function formatMs(value) {
|
|
31281
|
+
return value === null ? "-" : `${value}ms`;
|
|
31282
|
+
}
|
|
31283
|
+
function entryPreview(event, full) {
|
|
31284
|
+
const texts = event.content.parts.map((part) => {
|
|
31285
|
+
switch (part.type) {
|
|
31286
|
+
case "text":
|
|
31287
|
+
return part.text;
|
|
31288
|
+
case "tool_call":
|
|
31289
|
+
return `${part.name} ${stringify3(part.input)}`;
|
|
31290
|
+
case "tool_result":
|
|
31291
|
+
return stringify3(part.output);
|
|
31292
|
+
case "question":
|
|
31293
|
+
return part.questions.map((question) => question.question).join(" ");
|
|
31294
|
+
default:
|
|
31295
|
+
return "";
|
|
31296
|
+
}
|
|
31297
|
+
});
|
|
31298
|
+
const joined = singleLine(texts.join(" "));
|
|
31299
|
+
return full ? joined : clip(joined);
|
|
31300
|
+
}
|
|
31301
|
+
function preview(value) {
|
|
31302
|
+
return clip(singleLine(stringify3(value)));
|
|
31303
|
+
}
|
|
31304
|
+
function stringify3(value) {
|
|
31305
|
+
return typeof value === "string" ? value : JSON.stringify(value);
|
|
31306
|
+
}
|
|
31307
|
+
function singleLine(text) {
|
|
31308
|
+
return text.replace(/\s+/g, " ").trim();
|
|
31309
|
+
}
|
|
31310
|
+
function clip(text) {
|
|
31311
|
+
return text.length > PREVIEW_CHARS ? `${text.slice(0, PREVIEW_CHARS)}\u2026` : text;
|
|
31312
|
+
}
|
|
31313
|
+
|
|
30427
31314
|
// src/commands/runs/list.ts
|
|
30428
31315
|
async function handleRunsList(context, sessionName, options = {}) {
|
|
30429
|
-
const result = await
|
|
31316
|
+
const result = await fetchRuns(context, sessionName, options);
|
|
30430
31317
|
context.io.writeResult(result, formatRunsText);
|
|
30431
31318
|
}
|
|
30432
|
-
async function
|
|
31319
|
+
async function fetchRuns(context, sessionName, options) {
|
|
30433
31320
|
const client = createContextApiClient(context);
|
|
30434
|
-
const
|
|
31321
|
+
const clientOptions = {
|
|
30435
31322
|
apiBaseUrl: apiUrlFromOptions(context, options),
|
|
30436
|
-
includeArchived: options.includeArchived
|
|
30437
|
-
|
|
31323
|
+
includeArchived: options.includeArchived,
|
|
31324
|
+
statuses: options.status,
|
|
31325
|
+
since: options.since,
|
|
31326
|
+
limit: options.limit
|
|
31327
|
+
};
|
|
31328
|
+
const response = sessionName ? await client.listSessionRuns(sessionName, clientOptions) : await client.listRuns(clientOptions);
|
|
30438
31329
|
return {
|
|
30439
|
-
session: sessionName,
|
|
31330
|
+
session: sessionName ?? null,
|
|
30440
31331
|
runs: response.runs,
|
|
30441
31332
|
includeArchived: Boolean(options.includeArchived)
|
|
30442
31333
|
};
|
|
30443
31334
|
}
|
|
30444
31335
|
function formatRunsText(result, writeLine) {
|
|
30445
31336
|
if (result.runs.length === 0) {
|
|
30446
|
-
writeLine(
|
|
31337
|
+
writeLine(
|
|
31338
|
+
result.session ? `No runs found for session ${result.session}.` : "No runs found in the current project."
|
|
31339
|
+
);
|
|
30447
31340
|
return;
|
|
30448
31341
|
}
|
|
30449
31342
|
for (const run of result.runs) {
|
|
@@ -30453,13 +31346,63 @@ function formatRunsText(result, writeLine) {
|
|
|
30453
31346
|
}
|
|
30454
31347
|
|
|
30455
31348
|
// src/commands/runs/commands.ts
|
|
31349
|
+
function collect(value, previous = []) {
|
|
31350
|
+
return [...previous, value];
|
|
31351
|
+
}
|
|
30456
31352
|
function registerRunCommands(program, context) {
|
|
30457
31353
|
const runs = program.command("runs").description("Inspect session runs.");
|
|
30458
|
-
runs.command("list").description("List runs for a session.").
|
|
30459
|
-
|
|
30460
|
-
|
|
31354
|
+
runs.command("list").description("List runs for a session or the whole project.").option("--session <name>", "session name").option("--include-archived", "include archived runs").option("--status <status>", "filter by run status (repeatable)", collect).option("--since <iso-timestamp>", "only runs created after this time").option("--limit <count>", "maximum runs to return", parsePositiveInteger).option("--api-url <url>", "Auto API base URL").option("--api-base-url <url>", "Auto API base URL").action(async (options) => {
|
|
31355
|
+
await handleRunsList(context, options.session, options);
|
|
31356
|
+
});
|
|
31357
|
+
runs.command("show").description("Show a run's lifecycle, timing, and behavior summary.").argument("<run-id>", "run id").option("--api-url <url>", "Auto API base URL").option("--api-base-url <url>", "Auto API base URL").action(async (runId, commandOptions) => {
|
|
31358
|
+
await handleRunsShow(context, runId, commandOptions);
|
|
31359
|
+
});
|
|
31360
|
+
runs.command("conversation").description(
|
|
31361
|
+
"Read a snapshot of a run's conversation (most recent entries by default)."
|
|
31362
|
+
).argument("<run-id>", "run id").option(
|
|
31363
|
+
"--tail <count>",
|
|
31364
|
+
"number of most recent entries",
|
|
31365
|
+
parsePositiveInteger
|
|
31366
|
+
).option("--after <cursor>", "read forward from an rt:<sequence> cursor").option(
|
|
31367
|
+
"--before <sequence>",
|
|
31368
|
+
"only entries older than this sequence (backward paging)",
|
|
31369
|
+
parsePositiveInteger
|
|
31370
|
+
).option("--kind <kind>", "filter by entry kind (repeatable)", collect).option("--full", "do not clip entry previews in text output").option("--api-url <url>", "Auto API base URL").option("--api-base-url <url>", "Auto API base URL").action(
|
|
31371
|
+
async (runId, commandOptions) => {
|
|
31372
|
+
await handleRunsConversation(context, runId, commandOptions);
|
|
30461
31373
|
}
|
|
30462
31374
|
);
|
|
31375
|
+
runs.command("search").description("Grep a run's transcript; multiple query terms OR together.").argument("<run-id>", "run id").argument("<query...>", "search term(s), at least 2 characters each").option("--kind <kind>", "filter by entry kind (repeatable)", collect).option(
|
|
31376
|
+
"--after <sequence>",
|
|
31377
|
+
"only entries after this sequence (forward paging)",
|
|
31378
|
+
parsePositiveInteger
|
|
31379
|
+
).option("--limit <count>", "maximum matched entries", parsePositiveInteger).option("--api-url <url>", "Auto API base URL").option("--api-base-url <url>", "Auto API base URL").action(
|
|
31380
|
+
async (runId, queries, commandOptions) => {
|
|
31381
|
+
await handleRunsSearch(context, runId, queries, commandOptions);
|
|
31382
|
+
}
|
|
31383
|
+
);
|
|
31384
|
+
runs.command("tools").description("List a run's paired tool calls and results with timing.").argument("<run-id>", "run id").option("--tool <name>", "filter by tool name").option("--errors", "only failed exchanges").option(
|
|
31385
|
+
"--after <sequence>",
|
|
31386
|
+
"only exchanges after this entry sequence",
|
|
31387
|
+
parsePositiveInteger
|
|
31388
|
+
).option(
|
|
31389
|
+
"--before <sequence>",
|
|
31390
|
+
"only exchanges before this entry sequence (backward paging)",
|
|
31391
|
+
parsePositiveInteger
|
|
31392
|
+
).option("--limit <count>", "maximum exchanges", parsePositiveInteger).option("--api-url <url>", "Auto API base URL").option("--api-base-url <url>", "Auto API base URL").action(
|
|
31393
|
+
async (runId, commandOptions) => {
|
|
31394
|
+
await handleRunsTools(context, runId, commandOptions);
|
|
31395
|
+
}
|
|
31396
|
+
);
|
|
31397
|
+
runs.command("triggers").description("Show what spawned a run and the events delivered to it.").argument("<run-id>", "run id").option("--api-url <url>", "Auto API base URL").option("--api-base-url <url>", "Auto API base URL").action(async (runId, commandOptions) => {
|
|
31398
|
+
await handleRunsTriggers(context, runId, commandOptions);
|
|
31399
|
+
});
|
|
31400
|
+
runs.command("artifacts").description("List artifacts a run currently owns.").argument("<run-id>", "run id").option("--api-url <url>", "Auto API base URL").option("--api-base-url <url>", "Auto API base URL").action(async (runId, commandOptions) => {
|
|
31401
|
+
await handleRunsArtifacts(context, runId, commandOptions);
|
|
31402
|
+
});
|
|
31403
|
+
runs.command("commands").description("List a run's inbound command history.").argument("<run-id>", "run id").option("--api-url <url>", "Auto API base URL").option("--api-base-url <url>", "Auto API base URL").action(async (runId, commandOptions) => {
|
|
31404
|
+
await handleRunsCommands(context, runId, commandOptions);
|
|
31405
|
+
});
|
|
30463
31406
|
runs.command("archive").description("Archive runs so they are hidden from default run lists.").argument("<run-ids...>", "run id(s)").option("--api-url <url>", "Auto API base URL").option("--api-base-url <url>", "Auto API base URL").action(async (runIds, commandOptions) => {
|
|
30464
31407
|
if (runIds.length === 1) {
|
|
30465
31408
|
await archiveRunAction(context, runIds[0], commandOptions);
|
|
@@ -30586,7 +31529,7 @@ async function secretValue(input) {
|
|
|
30586
31529
|
}
|
|
30587
31530
|
value = envValue;
|
|
30588
31531
|
} else if (input.options.stdin) {
|
|
30589
|
-
value = await
|
|
31532
|
+
value = await readStream2(input.stdin, Boolean(input.options.raw));
|
|
30590
31533
|
} else {
|
|
30591
31534
|
throw new Error(
|
|
30592
31535
|
"Provide the secret value with --stdin, --value, or --from-env."
|
|
@@ -30599,7 +31542,7 @@ async function secretValue(input) {
|
|
|
30599
31542
|
}
|
|
30600
31543
|
return value;
|
|
30601
31544
|
}
|
|
30602
|
-
async function
|
|
31545
|
+
async function readStream2(stream, raw) {
|
|
30603
31546
|
const chunks = [];
|
|
30604
31547
|
for await (const chunk of stream) {
|
|
30605
31548
|
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(String(chunk)));
|
|
@@ -30829,7 +31772,7 @@ function withApiBaseUrl2(context, commandOptions) {
|
|
|
30829
31772
|
init_resources2();
|
|
30830
31773
|
init_browser();
|
|
30831
31774
|
import { existsSync as existsSync2, mkdtempSync as mkdtempSync2, writeFileSync as writeFileSync4 } from "fs";
|
|
30832
|
-
import { homedir as
|
|
31775
|
+
import { homedir as homedir3, tmpdir as tmpdir2 } from "os";
|
|
30833
31776
|
import { join as join6 } from "path";
|
|
30834
31777
|
var POLL_INTERVAL_MS = 2e3;
|
|
30835
31778
|
var POLL_TIMEOUT_MS = 5 * 6e4;
|
|
@@ -30991,7 +31934,7 @@ async function promptForIconUploads(input, options) {
|
|
|
30991
31934
|
}
|
|
30992
31935
|
}
|
|
30993
31936
|
function stagedLocationLabel(stagedPath) {
|
|
30994
|
-
return stagedPath.startsWith(`${join6(
|
|
31937
|
+
return stagedPath.startsWith(`${join6(homedir3(), "Downloads")}/`) ? "Downloads" : "the printed path";
|
|
30995
31938
|
}
|
|
30996
31939
|
async function stageAvatarImage(input) {
|
|
30997
31940
|
try {
|
|
@@ -31003,11 +31946,11 @@ async function stageAvatarImage(input) {
|
|
|
31003
31946
|
}
|
|
31004
31947
|
const contentType = response.headers.get("content-type") ?? "";
|
|
31005
31948
|
const extension = contentType.includes("jpeg") ? ".jpg" : ".png";
|
|
31006
|
-
const downloads = join6(
|
|
31949
|
+
const downloads = join6(homedir3(), "Downloads");
|
|
31007
31950
|
const directory = existsSync2(downloads) ? downloads : mkdtempSync2(join6(tmpdir2(), "auto-avatar-"));
|
|
31008
|
-
const
|
|
31009
|
-
writeFileSync4(
|
|
31010
|
-
return
|
|
31951
|
+
const path2 = join6(directory, `${input.session}-avatar${extension}`);
|
|
31952
|
+
writeFileSync4(path2, Buffer.from(await response.arrayBuffer()));
|
|
31953
|
+
return path2;
|
|
31011
31954
|
} catch {
|
|
31012
31955
|
return void 0;
|
|
31013
31956
|
}
|