@alook/daemon 0.1.62 → 0.1.63
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/cli/index.js +350 -340
- package/dist/index.js +124 -114
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -11730,7 +11730,7 @@ var require_JSXTransformer = __commonJS((exports) => {
|
|
|
11730
11730
|
}
|
|
11731
11731
|
exports.startsWithLowerCase = startsWithLowerCase;
|
|
11732
11732
|
function formatJSXTextLiteral(text2) {
|
|
11733
|
-
let
|
|
11733
|
+
let result2 = "";
|
|
11734
11734
|
let whitespace = "";
|
|
11735
11735
|
let isInInitialLineWhitespace = false;
|
|
11736
11736
|
let seenNonWhitespace = false;
|
|
@@ -11746,25 +11746,25 @@ var require_JSXTransformer = __commonJS((exports) => {
|
|
|
11746
11746
|
isInInitialLineWhitespace = true;
|
|
11747
11747
|
} else {
|
|
11748
11748
|
if (seenNonWhitespace && isInInitialLineWhitespace) {
|
|
11749
|
-
|
|
11749
|
+
result2 += " ";
|
|
11750
11750
|
}
|
|
11751
|
-
|
|
11751
|
+
result2 += whitespace;
|
|
11752
11752
|
whitespace = "";
|
|
11753
11753
|
if (c === "&") {
|
|
11754
11754
|
const { entity, newI } = processEntity(text2, i + 1);
|
|
11755
11755
|
i = newI - 1;
|
|
11756
|
-
|
|
11756
|
+
result2 += entity;
|
|
11757
11757
|
} else {
|
|
11758
|
-
|
|
11758
|
+
result2 += c;
|
|
11759
11759
|
}
|
|
11760
11760
|
seenNonWhitespace = true;
|
|
11761
11761
|
isInInitialLineWhitespace = false;
|
|
11762
11762
|
}
|
|
11763
11763
|
}
|
|
11764
11764
|
if (!isInInitialLineWhitespace) {
|
|
11765
|
-
|
|
11765
|
+
result2 += whitespace;
|
|
11766
11766
|
}
|
|
11767
|
-
return JSON.stringify(
|
|
11767
|
+
return JSON.stringify(result2);
|
|
11768
11768
|
}
|
|
11769
11769
|
function formatJSXTextReplacement(text2) {
|
|
11770
11770
|
let numNewlines = 0;
|
|
@@ -11782,29 +11782,29 @@ var require_JSXTransformer = __commonJS((exports) => {
|
|
|
11782
11782
|
`.repeat(numNewlines) + " ".repeat(numSpaces);
|
|
11783
11783
|
}
|
|
11784
11784
|
function formatJSXStringValueLiteral(text2) {
|
|
11785
|
-
let
|
|
11785
|
+
let result2 = "";
|
|
11786
11786
|
for (let i = 0;i < text2.length; i++) {
|
|
11787
11787
|
const c = text2[i];
|
|
11788
11788
|
if (c === `
|
|
11789
11789
|
`) {
|
|
11790
11790
|
if (/\s/.test(text2[i + 1])) {
|
|
11791
|
-
|
|
11791
|
+
result2 += " ";
|
|
11792
11792
|
while (i < text2.length && /\s/.test(text2[i + 1])) {
|
|
11793
11793
|
i++;
|
|
11794
11794
|
}
|
|
11795
11795
|
} else {
|
|
11796
|
-
|
|
11796
|
+
result2 += `
|
|
11797
11797
|
`;
|
|
11798
11798
|
}
|
|
11799
11799
|
} else if (c === "&") {
|
|
11800
11800
|
const { entity, newI } = processEntity(text2, i + 1);
|
|
11801
|
-
|
|
11801
|
+
result2 += entity;
|
|
11802
11802
|
i = newI - 1;
|
|
11803
11803
|
} else {
|
|
11804
|
-
|
|
11804
|
+
result2 += c;
|
|
11805
11805
|
}
|
|
11806
11806
|
}
|
|
11807
|
-
return JSON.stringify(
|
|
11807
|
+
return JSON.stringify(result2);
|
|
11808
11808
|
}
|
|
11809
11809
|
function processEntity(text2, indexAfterAmpersand) {
|
|
11810
11810
|
let str = "";
|
|
@@ -12050,9 +12050,9 @@ var require_CJSImportProcessor = __commonJS((exports) => {
|
|
|
12050
12050
|
index2++;
|
|
12051
12051
|
}
|
|
12052
12052
|
if (this.tokens.matches1AtIndex(index2, _types.TokenType.braceL)) {
|
|
12053
|
-
const
|
|
12054
|
-
index2 =
|
|
12055
|
-
for (const namedImport of
|
|
12053
|
+
const result2 = this.getNamedImports(index2 + 1);
|
|
12054
|
+
index2 = result2.newIndex;
|
|
12055
|
+
for (const namedImport of result2.namedImports) {
|
|
12056
12056
|
if (namedImport.importedName === "default") {
|
|
12057
12057
|
defaultNames.push(namedImport.localName);
|
|
12058
12058
|
} else {
|
|
@@ -12206,9 +12206,9 @@ var require_CJSImportProcessor = __commonJS((exports) => {
|
|
|
12206
12206
|
this.exportBindingsByLocalName.get(localName).push(exportedName);
|
|
12207
12207
|
}
|
|
12208
12208
|
claimImportCode(importPath) {
|
|
12209
|
-
const
|
|
12209
|
+
const result2 = this.importsToReplace.get(importPath);
|
|
12210
12210
|
this.importsToReplace.set(importPath, "");
|
|
12211
|
-
return
|
|
12211
|
+
return result2 || "";
|
|
12212
12212
|
}
|
|
12213
12213
|
getIdentifierReplacement(identifierName) {
|
|
12214
12214
|
return this.identifierReplacements.get(identifierName) || null;
|
|
@@ -13407,12 +13407,12 @@ var require_trace_mapping_umd = __commonJS((exports, module) => {
|
|
|
13407
13407
|
if (!found)
|
|
13408
13408
|
min = lowerBound(segments, matchedColumn, min);
|
|
13409
13409
|
const max = upperBound(segments, matchedColumn, min);
|
|
13410
|
-
const
|
|
13410
|
+
const result2 = [];
|
|
13411
13411
|
for (;min <= max; min++) {
|
|
13412
13412
|
const segment = segments[min];
|
|
13413
|
-
|
|
13413
|
+
result2.push(GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]));
|
|
13414
13414
|
}
|
|
13415
|
-
return
|
|
13415
|
+
return result2;
|
|
13416
13416
|
}
|
|
13417
13417
|
function generatedPosition(map2, source, line, column, bias, all) {
|
|
13418
13418
|
var _a3, _b;
|
|
@@ -14657,10 +14657,10 @@ var require_types2 = __commonJS((exports) => {
|
|
|
14657
14657
|
exports.func = func;
|
|
14658
14658
|
var TFunc = function(_super) {
|
|
14659
14659
|
__extends(TFunc2, _super);
|
|
14660
|
-
function TFunc2(paramList,
|
|
14660
|
+
function TFunc2(paramList, result2) {
|
|
14661
14661
|
var _this = _super.call(this) || this;
|
|
14662
14662
|
_this.paramList = paramList;
|
|
14663
|
-
_this.result =
|
|
14663
|
+
_this.result = result2;
|
|
14664
14664
|
return _this;
|
|
14665
14665
|
}
|
|
14666
14666
|
TFunc2.prototype.getChecker = function(suite, strict) {
|
|
@@ -19396,11 +19396,11 @@ var require_parser = __commonJS((exports) => {
|
|
|
19396
19396
|
throw new Error("Cannot combine flow and typescript plugins.");
|
|
19397
19397
|
}
|
|
19398
19398
|
_base.initParser.call(undefined, input2, isJSXEnabled, isTypeScriptEnabled, isFlowEnabled);
|
|
19399
|
-
const
|
|
19399
|
+
const result2 = _index.parseFile.call(undefined);
|
|
19400
19400
|
if (_base.state.error) {
|
|
19401
19401
|
throw _base.augmentError.call(undefined, _base.state.error);
|
|
19402
19402
|
}
|
|
19403
|
-
return
|
|
19403
|
+
return result2;
|
|
19404
19404
|
}
|
|
19405
19405
|
exports.parse = parse5;
|
|
19406
19406
|
});
|
|
@@ -19474,9 +19474,9 @@ var require_TokenProcessor = __commonJS((exports) => {
|
|
|
19474
19474
|
this.tokenIndex = snapshot.tokenIndex;
|
|
19475
19475
|
}
|
|
19476
19476
|
dangerouslyGetAndRemoveCodeSinceSnapshot(snapshot) {
|
|
19477
|
-
const
|
|
19477
|
+
const result2 = this.resultCode.slice(snapshot.resultCode.length);
|
|
19478
19478
|
this.resultCode = snapshot.resultCode;
|
|
19479
|
-
return
|
|
19479
|
+
return result2;
|
|
19480
19480
|
}
|
|
19481
19481
|
reset() {
|
|
19482
19482
|
this.resultCode = "";
|
|
@@ -21821,8 +21821,8 @@ var require_RootTransformer = __commonJS((exports) => {
|
|
|
21821
21821
|
for (const transformer of this.transformers) {
|
|
21822
21822
|
suffix += transformer.getSuffixCode();
|
|
21823
21823
|
}
|
|
21824
|
-
const
|
|
21825
|
-
let { code } =
|
|
21824
|
+
const result2 = this.tokens.finish();
|
|
21825
|
+
let { code } = result2;
|
|
21826
21826
|
if (code.startsWith("#!")) {
|
|
21827
21827
|
let newlineIndex = code.indexOf(`
|
|
21828
21828
|
`);
|
|
@@ -21833,12 +21833,12 @@ var require_RootTransformer = __commonJS((exports) => {
|
|
|
21833
21833
|
}
|
|
21834
21834
|
return {
|
|
21835
21835
|
code: code.slice(0, newlineIndex + 1) + prefix + code.slice(newlineIndex + 1) + suffix,
|
|
21836
|
-
mappings: this.shiftMappings(
|
|
21836
|
+
mappings: this.shiftMappings(result2.mappings, prefix.length)
|
|
21837
21837
|
};
|
|
21838
21838
|
} else {
|
|
21839
21839
|
return {
|
|
21840
21840
|
code: prefix + code + suffix,
|
|
21841
|
-
mappings: this.shiftMappings(
|
|
21841
|
+
mappings: this.shiftMappings(result2.mappings, prefix.length)
|
|
21842
21842
|
};
|
|
21843
21843
|
}
|
|
21844
21844
|
}
|
|
@@ -22281,17 +22281,17 @@ var require_dist2 = __commonJS((exports) => {
|
|
|
22281
22281
|
const sucraseContext = getSucraseContext(code, options);
|
|
22282
22282
|
const transformer = new (0, _RootTransformer2.default)(sucraseContext, options.transforms, Boolean(options.enableLegacyBabel5ModuleInterop), options);
|
|
22283
22283
|
const transformerResult = transformer.transform();
|
|
22284
|
-
let
|
|
22284
|
+
let result2 = { code: transformerResult.code };
|
|
22285
22285
|
if (options.sourceMapOptions) {
|
|
22286
22286
|
if (!options.filePath) {
|
|
22287
22287
|
throw new Error("filePath must be specified when generating a source map.");
|
|
22288
22288
|
}
|
|
22289
|
-
|
|
22290
|
-
...
|
|
22289
|
+
result2 = {
|
|
22290
|
+
...result2,
|
|
22291
22291
|
sourceMap: _computeSourceMap2.default.call(undefined, transformerResult, options.filePath, options.sourceMapOptions, code, sucraseContext.tokenProcessor.tokens)
|
|
22292
22292
|
};
|
|
22293
22293
|
}
|
|
22294
|
-
return
|
|
22294
|
+
return result2;
|
|
22295
22295
|
} catch (e) {
|
|
22296
22296
|
if (options.filePath) {
|
|
22297
22297
|
e.message = `Error transforming ${options.filePath}: ${e.message}`;
|
|
@@ -44611,7 +44611,7 @@ var CommunityResourceProfileSchema = exports_external.strictObject({
|
|
|
44611
44611
|
statusText: exports_external.string().nullable().optional()
|
|
44612
44612
|
});
|
|
44613
44613
|
// ../shared/src/business-schema-version.ts
|
|
44614
|
-
var BUSINESS_SCHEMA_VERSION =
|
|
44614
|
+
var BUSINESS_SCHEMA_VERSION = 8;
|
|
44615
44615
|
|
|
44616
44616
|
// ../shared/src/community-contract.ts
|
|
44617
44617
|
var COMMUNITY_RESOURCE_CONTRACT_VERSION = BUSINESS_SCHEMA_VERSION;
|
|
@@ -46890,6 +46890,7 @@ var serverMembershipSchema = CommunityServerMembershipResourceSchema.extend({
|
|
|
46890
46890
|
viewer: exports_external.boolean()
|
|
46891
46891
|
});
|
|
46892
46892
|
var channelMembershipSchema = CommunityChannelMembershipResourceSchema.extend({ id: exports_external.string().min(1) });
|
|
46893
|
+
var profileSchema = CommunityResourceProfileSchema.extend({ presence: exports_external.enum(["online", "offline"]).optional() });
|
|
46893
46894
|
var readStateSchema = CommunityReadStateResourceSchema.extend({ observedRevision: exports_external.number().int().nonnegative().optional() });
|
|
46894
46895
|
var friendshipSchema = exports_external.strictObject({
|
|
46895
46896
|
id: exports_external.string().min(1),
|
|
@@ -47702,6 +47703,15 @@ var TaskMemberInstructionCacheSchema = exports_external.strictObject({
|
|
|
47702
47703
|
globalInstruction: exports_external.string()
|
|
47703
47704
|
}).nullable();
|
|
47704
47705
|
var TaskUserIdentityCacheSchema = CommunityResourceProfileSchema.pick({ id: true, name: true }).extend({ email: exports_external.string() }).nullable();
|
|
47706
|
+
// ../shared/src/community-presence.ts
|
|
47707
|
+
var result = exports_external.strictObject({ online: exports_external.array(exports_external.string().min(1)), offline: exports_external.array(exports_external.string().min(1)) });
|
|
47708
|
+
var disjoint = (value) => !value.offline.some((id3) => value.online.includes(id3));
|
|
47709
|
+
var CommunityPresenceResultSchema = result.refine(disjoint, "Conflicting user presence");
|
|
47710
|
+
var CommunityPresenceReadSchema = result.extend({
|
|
47711
|
+
truncated: exports_external.boolean().optional(),
|
|
47712
|
+
limit: exports_external.number().int().positive().optional(),
|
|
47713
|
+
stale: exports_external.literal(true).optional()
|
|
47714
|
+
}).refine(disjoint, "Conflicting user presence");
|
|
47705
47715
|
// ../shared/src/community-forum-sidebar.ts
|
|
47706
47716
|
var timestamp = exports_external.string().refine((value) => Number.isFinite(Date.parse(value)));
|
|
47707
47717
|
var CommunityForumSidebarChannelSummarySchema = CommunityChannelResourceSchema.pick({
|
|
@@ -47908,8 +47918,8 @@ function registerPlatformCommands(program, getApi, output2) {
|
|
|
47908
47918
|
const api2 = getApi();
|
|
47909
47919
|
if (!api2.platformMachine)
|
|
47910
47920
|
throw failure2("Platform machine commands are unavailable", "UPGRADE_REQUIRED");
|
|
47911
|
-
const
|
|
47912
|
-
output2({ success:
|
|
47921
|
+
const result2 = await api2.platformMachine(opts.list ? { action: "list" } : opts.backends ? { action: "backends", machineId: opts.id } : { action: "models", machineId: opts.id, backendId: opts.backend, ...opts.model ? { model: opts.model } : {}, refresh: opts.refresh === true, requestId: randomUUID() });
|
|
47922
|
+
output2({ success: result2 });
|
|
47913
47923
|
});
|
|
47914
47924
|
const bot = platform.command("bot").description("read bots or request owner-approved creation").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).option("--list", "list your owner's bot summaries").option("--create <bot-json>", "request one bot; repeat for one gallery request", (value, previous) => [...previous, value], []);
|
|
47915
47925
|
bot.action(async () => {
|
|
@@ -48053,19 +48063,19 @@ function registerUseCommands(program, output2) {
|
|
|
48053
48063
|
}
|
|
48054
48064
|
if (!raw || typeof raw !== "object" || Array.isArray(raw))
|
|
48055
48065
|
throw new Error("Automation returned an invalid result");
|
|
48056
|
-
const
|
|
48066
|
+
const result2 = raw;
|
|
48057
48067
|
if (!response.ok) {
|
|
48058
|
-
const message2 = typeof
|
|
48068
|
+
const message2 = typeof result2.error === "string" ? result2.error.replaceAll(secret, "[redacted]") : `Automation failed: HTTP ${response.status}`;
|
|
48059
48069
|
throw Object.assign(new Error(message2), {
|
|
48060
|
-
...typeof
|
|
48070
|
+
...typeof result2.code === "string" ? { code: result2.code.replaceAll(secret, "[redacted]") } : {},
|
|
48061
48071
|
...response.status === 429 ? { hint: `Retry after ${response.headers.get("Retry-After") ?? "the indicated"} seconds` } : {}
|
|
48062
48072
|
});
|
|
48063
48073
|
}
|
|
48064
|
-
return { result, origin };
|
|
48074
|
+
return { result: result2, origin };
|
|
48065
48075
|
};
|
|
48066
48076
|
use.command("expire").description("expire the supplied access code immediately").action(async () => {
|
|
48067
|
-
const { result } = await request("/api/community/automation/expire", {});
|
|
48068
|
-
if (
|
|
48077
|
+
const { result: result2 } = await request("/api/community/automation/expire", {});
|
|
48078
|
+
if (result2.expired !== true)
|
|
48069
48079
|
throw new Error("Automation returned an invalid expiration result");
|
|
48070
48080
|
output2({ success: { expired: true } });
|
|
48071
48081
|
});
|
|
@@ -48080,10 +48090,10 @@ function registerUseCommands(program, output2) {
|
|
|
48080
48090
|
throw new Error("Message file is too large");
|
|
48081
48091
|
const content = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(bytes);
|
|
48082
48092
|
const body = parseInput(JSON.stringify({ target: options.target, as: options.as, content, nonce: randomUUID2() }), AutomationMessageSendSchema);
|
|
48083
|
-
const { result } = await request("/api/community/automation/messages", body);
|
|
48084
|
-
if (
|
|
48093
|
+
const { result: result2 } = await request("/api/community/automation/messages", body);
|
|
48094
|
+
if (result2.state === "blocked")
|
|
48085
48095
|
throw Object.assign(new Error("Bot has unread messages; use its normal inbox pull before sending"), { code: "unaligned" });
|
|
48086
|
-
const sent = AutomationMessageSentSchema.safeParse(
|
|
48096
|
+
const sent = AutomationMessageSentSchema.safeParse(result2);
|
|
48087
48097
|
if (!sent.success)
|
|
48088
48098
|
throw new Error("Automation returned an invalid message result");
|
|
48089
48099
|
output2({ success: sent.data });
|
|
@@ -48108,8 +48118,8 @@ function registerUseCommands(program, output2) {
|
|
|
48108
48118
|
if (!parseNameAndTag(options.members))
|
|
48109
48119
|
throw new Error("Use a full server handle");
|
|
48110
48120
|
const query = options.cursor ? `?${new URLSearchParams({ cursor: options.cursor })}` : "";
|
|
48111
|
-
const { result:
|
|
48112
|
-
const parsed = MemberList.safeParse(
|
|
48121
|
+
const { result: result3 } = await request(`/api/community/automation/servers/${encodeURIComponent(options.members)}/members${query}`);
|
|
48122
|
+
const parsed = MemberList.safeParse(result3);
|
|
48113
48123
|
if (!parsed.success || parsed.data.server !== options.members)
|
|
48114
48124
|
throw new Error("Automation returned an invalid member list");
|
|
48115
48125
|
output2({ success: parsed.data });
|
|
@@ -48119,8 +48129,8 @@ function registerUseCommands(program, output2) {
|
|
|
48119
48129
|
if (!options.id?.trim() || !options.backend?.trim())
|
|
48120
48130
|
throw new Error("--list-models requires --id and --backend");
|
|
48121
48131
|
const requestId = randomUUID2();
|
|
48122
|
-
const { result:
|
|
48123
|
-
const parsed = ModelList.safeParse(
|
|
48132
|
+
const { result: result3 } = await request(`/api/community/automation/machines/${encodeURIComponent(options.id)}/discover-models`, { requestId, runtimeId: options.backend, ...options.refresh ? { refresh: true } : {} }, 55000);
|
|
48133
|
+
const parsed = ModelList.safeParse(result3);
|
|
48124
48134
|
if (!parsed.success || parsed.data.machineId !== options.id || parsed.data.backendId !== options.backend || parsed.data.requestId !== requestId)
|
|
48125
48135
|
throw new Error("Automation returned an invalid model list");
|
|
48126
48136
|
output2({ success: parsed.data });
|
|
@@ -48130,8 +48140,8 @@ function registerUseCommands(program, output2) {
|
|
|
48130
48140
|
throw new Error("--id, --backend and --refresh require --list-models");
|
|
48131
48141
|
if (options.list) {
|
|
48132
48142
|
const key = `${kind}s`;
|
|
48133
|
-
const { result:
|
|
48134
|
-
const rows =
|
|
48143
|
+
const { result: result3 } = await request(kind === "friend" ? "/api/community/automation/friends" : `/api/community/automation/${key}`);
|
|
48144
|
+
const rows = result3[key];
|
|
48135
48145
|
if (!Array.isArray(rows))
|
|
48136
48146
|
throw new Error("Automation returned an invalid list");
|
|
48137
48147
|
const list = rows.map((row) => {
|
|
@@ -48158,8 +48168,8 @@ function registerUseCommands(program, output2) {
|
|
|
48158
48168
|
}
|
|
48159
48169
|
if (options.invite !== undefined) {
|
|
48160
48170
|
const input2 = parseInput(options.invite, InviteInput);
|
|
48161
|
-
const { result:
|
|
48162
|
-
const value =
|
|
48171
|
+
const { result: result3 } = await request(`/api/community/automation/servers/${encodeURIComponent(input2.server)}/invites`, { friend: input2.friend });
|
|
48172
|
+
const value = result3.invitation;
|
|
48163
48173
|
if (!value || typeof value !== "object" || !("sent" in value) || value.sent !== true || !("server" in value) || typeof value.server !== "string" || !("friend" in value) || typeof value.friend !== "string")
|
|
48164
48174
|
throw new Error("Automation returned an invalid invitation result; do not retry automatically");
|
|
48165
48175
|
output2({ success: { invitation: { server: value.server, friend: value.friend, sent: true } } });
|
|
@@ -48171,8 +48181,8 @@ function registerUseCommands(program, output2) {
|
|
|
48171
48181
|
body = { ...bot, runtime: backendId };
|
|
48172
48182
|
} else
|
|
48173
48183
|
body = parseInput(options.create, ServerInput);
|
|
48174
|
-
const { result, origin } = await request(`/api/community/automation/${kind}s`, body);
|
|
48175
|
-
const resource =
|
|
48184
|
+
const { result: result2, origin } = await request(`/api/community/automation/${kind}s`, body);
|
|
48185
|
+
const resource = result2[kind];
|
|
48176
48186
|
if (!resource || typeof resource !== "object" || !("id" in resource) || !("name" in resource) || !("discriminator" in resource) || typeof resource.id !== "string" || typeof resource.name !== "string" || typeof resource.discriminator !== "string")
|
|
48177
48187
|
throw new Error("Automation returned an invalid result; do not retry automatically");
|
|
48178
48188
|
output2({ success: { [kind]: {
|
|
@@ -48277,7 +48287,7 @@ class PiiRunner {
|
|
|
48277
48287
|
sequence = 0;
|
|
48278
48288
|
tail = Promise.resolve();
|
|
48279
48289
|
evaluate(plugins, text2) {
|
|
48280
|
-
return this.evaluateWithResult(plugins, text2).then((
|
|
48290
|
+
return this.evaluateWithResult(plugins, text2).then((result2) => result2.text);
|
|
48281
48291
|
}
|
|
48282
48292
|
evaluateWithResult(plugins, text2) {
|
|
48283
48293
|
if (this.closed || this.pending >= 32)
|
|
@@ -49673,12 +49683,12 @@ function taskkillTree(pid) {
|
|
|
49673
49683
|
windowsHide: true
|
|
49674
49684
|
});
|
|
49675
49685
|
let settled = false;
|
|
49676
|
-
const settle2 = (
|
|
49686
|
+
const settle2 = (result2, error62) => {
|
|
49677
49687
|
if (settled)
|
|
49678
49688
|
return;
|
|
49679
49689
|
settled = true;
|
|
49680
49690
|
clearTimeout(timer);
|
|
49681
|
-
if (
|
|
49691
|
+
if (result2 === "resolve")
|
|
49682
49692
|
resolve();
|
|
49683
49693
|
else
|
|
49684
49694
|
reject(error62);
|
|
@@ -50528,20 +50538,20 @@ class AgyDriver {
|
|
|
50528
50538
|
}
|
|
50529
50539
|
if (this.inputIndex === undefined || index2 <= this.inputIndex)
|
|
50530
50540
|
return [];
|
|
50531
|
-
const
|
|
50541
|
+
const result3 = [];
|
|
50532
50542
|
if (step.step_type === "agent_response" && typeof step.text_delta === "string")
|
|
50533
|
-
|
|
50543
|
+
result3.push({ kind: "assistant_message_delta", text: step.text_delta });
|
|
50534
50544
|
if (step.step_type === "tool") {
|
|
50535
50545
|
const tool = asRecord(step.tool_info);
|
|
50536
50546
|
const name = typeof step.tool_name === "string" ? step.tool_name : "tool";
|
|
50537
50547
|
const callId = `${this.sessionId}:${index2}`;
|
|
50538
50548
|
if ((step.state === "ACTIVE" || step.state === "DONE") && !this.tools.has(index2)) {
|
|
50539
50549
|
this.tools.set(index2, "active");
|
|
50540
|
-
|
|
50550
|
+
result3.push({ kind: "tool_call", callId, name, input: tool?.parameters });
|
|
50541
50551
|
}
|
|
50542
50552
|
if (step.state === "DONE" && this.tools.get(index2) === "active") {
|
|
50543
50553
|
this.tools.set(index2, "done");
|
|
50544
|
-
|
|
50554
|
+
result3.push({ kind: "tool_output", callId, name });
|
|
50545
50555
|
}
|
|
50546
50556
|
}
|
|
50547
50557
|
const usage = asRecord(step.usage);
|
|
@@ -50558,21 +50568,21 @@ class AgyDriver {
|
|
|
50558
50568
|
outputIncludesReasoning: true
|
|
50559
50569
|
});
|
|
50560
50570
|
if (projected?.kind === "telemetry" && projected.name === "token_usage")
|
|
50561
|
-
|
|
50571
|
+
result3.push({
|
|
50562
50572
|
...projected,
|
|
50563
50573
|
identity: { source: `${this.usageSource}:${this.sessionId}`, index: index2, occurredAt: this.inputAt }
|
|
50564
50574
|
});
|
|
50565
50575
|
}
|
|
50566
|
-
return
|
|
50576
|
+
return result3;
|
|
50567
50577
|
}
|
|
50568
50578
|
if (event?.event !== "result")
|
|
50569
50579
|
return [];
|
|
50570
|
-
const
|
|
50571
|
-
if (
|
|
50572
|
-
return this.fail(typeof
|
|
50573
|
-
if (!this.pending ||
|
|
50580
|
+
const result2 = asRecord(event.result);
|
|
50581
|
+
if (result2?.status === "ERROR" && !this.sessionId)
|
|
50582
|
+
return this.fail(typeof result2.error === "string" ? result2.error : "Antigravity CLI initialization failed");
|
|
50583
|
+
if (!this.pending || result2?.conversation_id !== this.sessionId)
|
|
50574
50584
|
return [];
|
|
50575
|
-
const turns =
|
|
50585
|
+
const turns = result2.num_turns;
|
|
50576
50586
|
if (!Number.isSafeInteger(turns) || turns < 1)
|
|
50577
50587
|
return this.fail("Antigravity CLI emitted an invalid turn counter");
|
|
50578
50588
|
if (this.previousTurns !== undefined && turns <= this.previousTurns)
|
|
@@ -50582,17 +50592,17 @@ class AgyDriver {
|
|
|
50582
50592
|
this.previousTurns = turns;
|
|
50583
50593
|
this.pending = false;
|
|
50584
50594
|
const events = [];
|
|
50585
|
-
const interrupted =
|
|
50586
|
-
if (
|
|
50587
|
-
if (typeof
|
|
50595
|
+
const interrupted = result2.status === "CANCELLED" || result2.status === "ERROR" && result2.error === "interrupted";
|
|
50596
|
+
if (result2.status === "SUCCESS") {
|
|
50597
|
+
if (typeof result2.response !== "string")
|
|
50588
50598
|
return this.fail("Antigravity CLI result is missing response text");
|
|
50589
|
-
events.push({ kind: "assistant_message_completed", text:
|
|
50599
|
+
events.push({ kind: "assistant_message_completed", text: result2.response });
|
|
50590
50600
|
} else if (!interrupted)
|
|
50591
|
-
events.push({ kind: "error", message: typeof
|
|
50601
|
+
events.push({ kind: "error", message: typeof result2.error === "string" ? result2.error : `Antigravity CLI status: ${String(result2.status)}` });
|
|
50592
50602
|
events.push({
|
|
50593
50603
|
kind: "turn_end",
|
|
50594
50604
|
sessionId: this.currentSessionId,
|
|
50595
|
-
...
|
|
50605
|
+
...result2.status !== "SUCCESS" ? { pendingContent: "discard" } : {},
|
|
50596
50606
|
...interrupted ? { outcome: "interrupted" } : {}
|
|
50597
50607
|
});
|
|
50598
50608
|
return events;
|
|
@@ -50662,7 +50672,7 @@ function fields(data) {
|
|
|
50662
50672
|
}
|
|
50663
50673
|
throw new Error("Invalid native usage varint");
|
|
50664
50674
|
};
|
|
50665
|
-
const
|
|
50675
|
+
const result2 = [];
|
|
50666
50676
|
while (offset < data.length) {
|
|
50667
50677
|
const tag = varint();
|
|
50668
50678
|
const number4 = Number(tag >> 3n);
|
|
@@ -50670,12 +50680,12 @@ function fields(data) {
|
|
|
50670
50680
|
if (!number4 || number4 > 536870911)
|
|
50671
50681
|
throw new Error("Invalid native usage field");
|
|
50672
50682
|
if (wire === 0)
|
|
50673
|
-
|
|
50683
|
+
result2.push({ number: number4, value: varint() });
|
|
50674
50684
|
else if (wire === 2) {
|
|
50675
50685
|
const length = Number(varint());
|
|
50676
50686
|
if (!Number.isSafeInteger(length) || length < 0 || offset + length > data.length)
|
|
50677
50687
|
throw new Error("Invalid native usage length");
|
|
50678
|
-
|
|
50688
|
+
result2.push({ number: number4, value: data.subarray(offset, offset + length) });
|
|
50679
50689
|
offset += length;
|
|
50680
50690
|
} else if (wire === 1 || wire === 5) {
|
|
50681
50691
|
offset += wire === 1 ? 8 : 4;
|
|
@@ -50684,7 +50694,7 @@ function fields(data) {
|
|
|
50684
50694
|
} else
|
|
50685
50695
|
throw new Error("Unsupported native usage field");
|
|
50686
50696
|
}
|
|
50687
|
-
return
|
|
50697
|
+
return result2;
|
|
50688
50698
|
}
|
|
50689
50699
|
function nested(data, number4) {
|
|
50690
50700
|
const value = data.filter((field) => field.number === number4).at(-1)?.value;
|
|
@@ -50730,7 +50740,7 @@ class NativeUsageReader {
|
|
|
50730
50740
|
const path5 = join5(this.home, "antigravity-acp", "conversations", `${this.sessionId}.db`);
|
|
50731
50741
|
let cursor = this.cursor;
|
|
50732
50742
|
let complete = false;
|
|
50733
|
-
const
|
|
50743
|
+
const result2 = [];
|
|
50734
50744
|
for (let batch = 0;batch < 16; batch++) {
|
|
50735
50745
|
const rows = await this.readRows(path5, cursor);
|
|
50736
50746
|
for (const row of rows) {
|
|
@@ -50741,7 +50751,7 @@ class NativeUsageReader {
|
|
|
50741
50751
|
const parsed = parseNativeGeneration(Buffer.from(row.data, "hex"));
|
|
50742
50752
|
if (!parsed.occurredAt)
|
|
50743
50753
|
throw new Error("Native usage timestamp unavailable");
|
|
50744
|
-
|
|
50754
|
+
result2.push({ usage: row.has_children ? { input: null, output: null, cache: null } : parsed.usage, identity: { source: `antigravity:${createHash2("sha256").update(this.home).digest("hex").slice(0, 16)}:${this.sessionId}`, index: row.idx, occurredAt: parsed.occurredAt } });
|
|
50745
50755
|
cursor = row.idx;
|
|
50746
50756
|
}
|
|
50747
50757
|
if (!rows.length) {
|
|
@@ -50750,7 +50760,7 @@ class NativeUsageReader {
|
|
|
50750
50760
|
}
|
|
50751
50761
|
}
|
|
50752
50762
|
this.cursor = cursor;
|
|
50753
|
-
return { samples:
|
|
50763
|
+
return { samples: result2, complete, ...this.childTrajectories ? { incompleteScope: true } : {} };
|
|
50754
50764
|
}
|
|
50755
50765
|
}
|
|
50756
50766
|
async function queryNativeRowsWithCli(path5, cursor) {
|
|
@@ -51190,8 +51200,8 @@ class AntigravityAcpLane {
|
|
|
51190
51200
|
completePrompt(prompt, value) {
|
|
51191
51201
|
if (this.currentPromptRequestId !== prompt.requestId)
|
|
51192
51202
|
return;
|
|
51193
|
-
const
|
|
51194
|
-
if (!
|
|
51203
|
+
const result2 = record2(value);
|
|
51204
|
+
if (!result2 || typeof result2.stopReason !== "string" || !PROMPT_STOP_REASONS.has(result2.stopReason)) {
|
|
51195
51205
|
this.failPrompt(prompt, new Error("Antigravity ACP prompt response did not contain a supported stopReason"), "antigravity.invalid_stop_reason");
|
|
51196
51206
|
return;
|
|
51197
51207
|
}
|
|
@@ -51203,7 +51213,7 @@ class AntigravityAcpLane {
|
|
|
51203
51213
|
kind: "turn_end",
|
|
51204
51214
|
sessionId: this.sessionId ?? undefined,
|
|
51205
51215
|
turnOwner: terminalOwner,
|
|
51206
|
-
...
|
|
51216
|
+
...result2.stopReason === "cancelled" ? { outcome: "interrupted", pendingContent: "discard" } : {}
|
|
51207
51217
|
});
|
|
51208
51218
|
}
|
|
51209
51219
|
failPrompt(prompt, error62, code = "antigravity.prompt_failed") {
|
|
@@ -51389,14 +51399,14 @@ class AntigravityAcpLane {
|
|
|
51389
51399
|
(async () => {
|
|
51390
51400
|
const deadline = Date.now() + 5000;
|
|
51391
51401
|
for (let batch = 0;batch < 16; batch++) {
|
|
51392
|
-
const
|
|
51402
|
+
const result2 = await this.usageReader.read();
|
|
51393
51403
|
if (this.currentPromptRequestId !== pending.prompt.requestId || this.isClosed() || this.requestedStopReason)
|
|
51394
51404
|
return;
|
|
51395
|
-
for (const sample of
|
|
51405
|
+
for (const sample of result2.samples)
|
|
51396
51406
|
this.events.emit("runtime_event", { kind: "telemetry", name: "token_usage", source: "antigravity.native", ...sample });
|
|
51397
|
-
if (
|
|
51407
|
+
if (result2.incompleteScope)
|
|
51398
51408
|
throw new Error("Child trajectory accounting unavailable");
|
|
51399
|
-
if (
|
|
51409
|
+
if (result2.complete) {
|
|
51400
51410
|
this.events.emit("runtime_event", { kind: "telemetry", name: "token_usage_status", source: "antigravity.native", status: "available" });
|
|
51401
51411
|
return;
|
|
51402
51412
|
}
|
|
@@ -51629,7 +51639,7 @@ async function probeAntigravity(command, options = {}) {
|
|
|
51629
51639
|
let version3;
|
|
51630
51640
|
let sessionRequestId = 0;
|
|
51631
51641
|
let loading = false;
|
|
51632
|
-
const finish = (
|
|
51642
|
+
const finish = (result2) => {
|
|
51633
51643
|
if (settled)
|
|
51634
51644
|
return;
|
|
51635
51645
|
settled = true;
|
|
@@ -51640,7 +51650,7 @@ async function probeAntigravity(command, options = {}) {
|
|
|
51640
51650
|
else
|
|
51641
51651
|
child.kill("SIGTERM");
|
|
51642
51652
|
});
|
|
51643
|
-
cleanup(proc).then(() => resolve2(
|
|
51653
|
+
cleanup(proc).then(() => resolve2(result2), () => resolve2({ status: "unhealthy", lastError: "antigravity_acp_cleanup_failed" }));
|
|
51644
51654
|
};
|
|
51645
51655
|
const fail = (lastError) => finish({ status: "unhealthy", lastError });
|
|
51646
51656
|
const timer = setTimeout(() => fail("antigravity_acp_timeout"), options.timeoutMs ?? (process.platform === "win32" ? 30000 : 1e4));
|
|
@@ -51708,9 +51718,9 @@ async function probeAntigravity(command, options = {}) {
|
|
|
51708
51718
|
finish({ status: "healthy", ...version3 ? { version: version3 } : {} });
|
|
51709
51719
|
continue;
|
|
51710
51720
|
}
|
|
51711
|
-
const
|
|
51712
|
-
const sessionId = loading ? cachedSessionId :
|
|
51713
|
-
if (typeof sessionId !== "string" || !/^[A-Za-z0-9_-]{1,100}$/.test(sessionId) || loading &&
|
|
51721
|
+
const result3 = asRecord(message2.result);
|
|
51722
|
+
const sessionId = loading ? cachedSessionId : result3?.sessionId;
|
|
51723
|
+
if (typeof sessionId !== "string" || !/^[A-Za-z0-9_-]{1,100}$/.test(sessionId) || loading && result3?.sessionId !== undefined && result3.sessionId !== sessionId)
|
|
51714
51724
|
return fail("antigravity_acp_invalid_session");
|
|
51715
51725
|
if (!loading) {
|
|
51716
51726
|
try {
|
|
@@ -51721,7 +51731,7 @@ async function probeAntigravity(command, options = {}) {
|
|
|
51721
51731
|
return fail("antigravity_acp_probe_storage_failed");
|
|
51722
51732
|
}
|
|
51723
51733
|
}
|
|
51724
|
-
const catalog = parseAntigravityCatalog(
|
|
51734
|
+
const catalog = parseAntigravityCatalog(result3);
|
|
51725
51735
|
finish({
|
|
51726
51736
|
status: "healthy",
|
|
51727
51737
|
...version3 ? { version: version3 } : {},
|
|
@@ -51731,10 +51741,10 @@ async function probeAntigravity(command, options = {}) {
|
|
|
51731
51741
|
}
|
|
51732
51742
|
if (message2?.id !== 1 || sessionRequestId)
|
|
51733
51743
|
continue;
|
|
51734
|
-
const
|
|
51735
|
-
if (message2.jsonrpc !== "2.0" || message2.error ||
|
|
51744
|
+
const result2 = asRecord(message2.result);
|
|
51745
|
+
if (message2.jsonrpc !== "2.0" || message2.error || result2?.protocolVersion !== 1 || asRecord(result2.agentCapabilities)?.loadSession !== true || asRecord(result2.agentInfo)?.name !== "antigravity-acp")
|
|
51736
51746
|
return fail("antigravity_acp_incompatible");
|
|
51737
|
-
const reportedVersion = asRecord(
|
|
51747
|
+
const reportedVersion = asRecord(result2.agentInfo)?.version;
|
|
51738
51748
|
version3 = typeof reportedVersion === "string" ? reportedVersion : undefined;
|
|
51739
51749
|
if (!includeModels) {
|
|
51740
51750
|
finish({ status: "healthy", ...version3 ? { version: version3 } : {} });
|
|
@@ -52493,8 +52503,8 @@ class ClaudeDriver {
|
|
|
52493
52503
|
probe(command, includeModels = true) {
|
|
52494
52504
|
const explicit = command?.trim();
|
|
52495
52505
|
const base = explicit ? (() => {
|
|
52496
|
-
const
|
|
52497
|
-
return
|
|
52506
|
+
const result2 = probeCommandVersion(explicit);
|
|
52507
|
+
return result2.ok ? { status: "healthy", version: result2.version } : { status: "unhealthy", lastError: result2.error };
|
|
52498
52508
|
})() : probeClaude();
|
|
52499
52509
|
return base.status === "healthy" && includeModels ? { ...base, reasoning: CLAUDE_MODEL_CATALOG } : base;
|
|
52500
52510
|
}
|
|
@@ -52728,8 +52738,8 @@ function rotateCodexQuotaSource() {
|
|
|
52728
52738
|
codexQuotaSourceGeneration += 1;
|
|
52729
52739
|
codexAccountFingerprint = null;
|
|
52730
52740
|
}
|
|
52731
|
-
function observeCodexAccount(
|
|
52732
|
-
const account2 =
|
|
52741
|
+
function observeCodexAccount(result2) {
|
|
52742
|
+
const account2 = result2?.account;
|
|
52733
52743
|
const fingerprint = account2 && typeof account2 === "object" ? JSON.stringify([
|
|
52734
52744
|
account2.type ?? "unknown",
|
|
52735
52745
|
account2.email ?? null,
|
|
@@ -53293,13 +53303,13 @@ class CodexDriver {
|
|
|
53293
53303
|
return this.codexHomeRoot;
|
|
53294
53304
|
}
|
|
53295
53305
|
async probe(command, includeModels = true) {
|
|
53296
|
-
const
|
|
53297
|
-
if (
|
|
53298
|
-
return
|
|
53306
|
+
const result2 = await probeCliRuntime("codex", {}, command);
|
|
53307
|
+
if (result2.status !== "healthy")
|
|
53308
|
+
return result2;
|
|
53299
53309
|
if (!includeModels)
|
|
53300
|
-
return
|
|
53310
|
+
return result2;
|
|
53301
53311
|
return {
|
|
53302
|
-
...
|
|
53312
|
+
...result2,
|
|
53303
53313
|
reasoning: await this.probeReasoningCatalog(command)
|
|
53304
53314
|
};
|
|
53305
53315
|
}
|
|
@@ -53387,13 +53397,13 @@ class CodexDriver {
|
|
|
53387
53397
|
return;
|
|
53388
53398
|
if (message2.error || !message2.result || typeof message2.result !== "object")
|
|
53389
53399
|
return finish();
|
|
53390
|
-
const
|
|
53391
|
-
for (const model of Array.isArray(
|
|
53400
|
+
const result2 = message2.result;
|
|
53401
|
+
for (const model of Array.isArray(result2.data) ? result2.data : []) {
|
|
53392
53402
|
consumeModel(model);
|
|
53393
53403
|
if (models.length >= MODEL_LIST_MAX)
|
|
53394
53404
|
break;
|
|
53395
53405
|
}
|
|
53396
|
-
const cursor = typeof
|
|
53406
|
+
const cursor = typeof result2.nextCursor === "string" ? result2.nextCursor : undefined;
|
|
53397
53407
|
if (cursor && models.length < MODEL_LIST_MAX)
|
|
53398
53408
|
return requestModelPage(cursor);
|
|
53399
53409
|
if (models.length === 0)
|
|
@@ -53752,19 +53762,19 @@ async function probeCursorAcpCatalog(command, options = {}) {
|
|
|
53752
53762
|
request("session/new", { cwd, mcpServers: [] });
|
|
53753
53763
|
return;
|
|
53754
53764
|
}
|
|
53755
|
-
const
|
|
53756
|
-
if (!
|
|
53765
|
+
const result2 = record3(message2.result);
|
|
53766
|
+
if (!result2)
|
|
53757
53767
|
return finish();
|
|
53758
53768
|
if (expectedMethod === "initialize") {
|
|
53759
|
-
const authMethods = Array.isArray(
|
|
53760
|
-
if (
|
|
53769
|
+
const authMethods = Array.isArray(result2.authMethods) ? result2.authMethods : [];
|
|
53770
|
+
if (result2.protocolVersion !== ACP_PROTOCOL_VERSION2 || !authMethods.some((method) => record3(method)?.id === AUTH_METHOD_ID))
|
|
53761
53771
|
return finish();
|
|
53762
53772
|
request("authenticate", { methodId: AUTH_METHOD_ID });
|
|
53763
53773
|
return;
|
|
53764
53774
|
}
|
|
53765
|
-
if (expectedMethod !== "session/new" || typeof
|
|
53775
|
+
if (expectedMethod !== "session/new" || typeof result2.sessionId !== "string" || !result2.sessionId.trim())
|
|
53766
53776
|
return finish();
|
|
53767
|
-
finish(parseCursorAcpModelCatalog(
|
|
53777
|
+
finish(parseCursorAcpModelCatalog(result2));
|
|
53768
53778
|
};
|
|
53769
53779
|
const timer = setTimeout(() => finish(), options.timeoutMs ?? CATALOG_PROBE_TIMEOUT_MS);
|
|
53770
53780
|
timer.unref?.();
|
|
@@ -54105,8 +54115,8 @@ class CursorAcpLane {
|
|
|
54105
54115
|
completePrompt(prompt, value) {
|
|
54106
54116
|
if (this.currentPromptRequestId !== prompt.requestId)
|
|
54107
54117
|
return;
|
|
54108
|
-
const
|
|
54109
|
-
if (!
|
|
54118
|
+
const result2 = record4(value);
|
|
54119
|
+
if (!result2 || typeof result2.stopReason !== "string" || !PROMPT_STOP_REASONS2.has(result2.stopReason)) {
|
|
54110
54120
|
this.failPrompt(prompt, new Error("Cursor ACP prompt response did not contain a supported stopReason"), "cursor.invalid_stop_reason");
|
|
54111
54121
|
return;
|
|
54112
54122
|
}
|
|
@@ -54118,7 +54128,7 @@ class CursorAcpLane {
|
|
|
54118
54128
|
kind: "turn_end",
|
|
54119
54129
|
sessionId: this.sessionId ?? undefined,
|
|
54120
54130
|
turnOwner: terminalOwner,
|
|
54121
|
-
...
|
|
54131
|
+
...result2.stopReason === "cancelled" ? { outcome: "interrupted" } : {}
|
|
54122
54132
|
});
|
|
54123
54133
|
}
|
|
54124
54134
|
failPrompt(prompt, error62, code = "cursor.prompt_failed") {
|
|
@@ -54480,20 +54490,20 @@ function runBoundedDiscoveryProcess(options) {
|
|
|
54480
54490
|
let settled = false;
|
|
54481
54491
|
let decoderEnded = false;
|
|
54482
54492
|
let outputBytes = 0;
|
|
54483
|
-
const settle2 = (
|
|
54493
|
+
const settle2 = (result2, error62) => {
|
|
54484
54494
|
if (settled)
|
|
54485
54495
|
return;
|
|
54486
54496
|
settled = true;
|
|
54487
54497
|
clearTimeout(timer);
|
|
54488
54498
|
if (!decoderEnded)
|
|
54489
54499
|
decoder.end();
|
|
54490
|
-
Promise.resolve().then(() => options.cleanup?.(options.process) ?? cleanupProcess(options.process, options.label)).then(() => error62 ? reject(error62) : resolve3(
|
|
54500
|
+
Promise.resolve().then(() => options.cleanup?.(options.process) ?? cleanupProcess(options.process, options.label)).then(() => error62 ? reject(error62) : resolve3(result2), () => reject(error62 ?? new Error(`${options.label} discovery cleanup failed`)));
|
|
54491
54501
|
};
|
|
54492
54502
|
const control = {
|
|
54493
54503
|
get outputBytes() {
|
|
54494
54504
|
return outputBytes;
|
|
54495
54505
|
},
|
|
54496
|
-
finish: (
|
|
54506
|
+
finish: (result2) => settle2(result2),
|
|
54497
54507
|
fail: (message2) => settle2(undefined, new Error(message2)),
|
|
54498
54508
|
flushStdout: () => {
|
|
54499
54509
|
if (settled || decoderEnded)
|
|
@@ -54570,19 +54580,19 @@ async function discoverCursorRecentContext(request, dependencies = {}) {
|
|
|
54570
54580
|
return;
|
|
54571
54581
|
if (message2.error !== undefined)
|
|
54572
54582
|
return control.fail("Cursor discovery request failed");
|
|
54573
|
-
const
|
|
54574
|
-
if (!
|
|
54583
|
+
const result2 = asRecord(message2.result);
|
|
54584
|
+
if (!result2)
|
|
54575
54585
|
return control.fail("Cursor discovery returned an invalid response");
|
|
54576
54586
|
if (expectedMethod === "initialize") {
|
|
54577
|
-
if (
|
|
54587
|
+
if (result2.protocolVersion !== ACP_PROTOCOL_VERSION4) {
|
|
54578
54588
|
return control.fail("Cursor discovery protocol is incompatible");
|
|
54579
54589
|
}
|
|
54580
|
-
const capabilities = asRecord(
|
|
54590
|
+
const capabilities = asRecord(result2.agentCapabilities);
|
|
54581
54591
|
const sessionCapabilities = asRecord(capabilities?.sessionCapabilities);
|
|
54582
54592
|
if (sessionCapabilities?.list !== true && !asRecord(sessionCapabilities?.list)) {
|
|
54583
54593
|
return control.fail("Cursor session listing is unavailable");
|
|
54584
54594
|
}
|
|
54585
|
-
const authMethods = Array.isArray(
|
|
54595
|
+
const authMethods = Array.isArray(result2.authMethods) ? result2.authMethods : [];
|
|
54586
54596
|
if (!authMethods.some((method) => asRecord(method)?.id === AUTH_METHOD_ID3)) {
|
|
54587
54597
|
return control.fail("Cursor discovery authentication is unavailable");
|
|
54588
54598
|
}
|
|
@@ -54595,7 +54605,7 @@ async function discoverCursorRecentContext(request, dependencies = {}) {
|
|
|
54595
54605
|
}
|
|
54596
54606
|
if (expectedMethod !== "session/list")
|
|
54597
54607
|
return control.fail("Cursor discovery state is invalid");
|
|
54598
|
-
const sessions = Array.isArray(
|
|
54608
|
+
const sessions = Array.isArray(result2.sessions) ? result2.sessions : Array.isArray(result2.data) ? result2.data : [];
|
|
54599
54609
|
for (const value of sessions) {
|
|
54600
54610
|
const session2 = asRecord(value);
|
|
54601
54611
|
if (!session2)
|
|
@@ -54604,7 +54614,7 @@ async function discoverCursorRecentContext(request, dependencies = {}) {
|
|
|
54604
54614
|
if (collector.satisfied)
|
|
54605
54615
|
return control.finish(collector.result());
|
|
54606
54616
|
}
|
|
54607
|
-
const nextCursor = typeof
|
|
54617
|
+
const nextCursor = typeof result2.nextCursor === "string" && result2.nextCursor ? result2.nextCursor : undefined;
|
|
54608
54618
|
if (!nextCursor)
|
|
54609
54619
|
return control.finish(collector.result());
|
|
54610
54620
|
if (seenCursors.has(nextCursor))
|
|
@@ -54664,11 +54674,11 @@ class CursorDriver {
|
|
|
54664
54674
|
this.catalogProbe = catalogProbe;
|
|
54665
54675
|
}
|
|
54666
54676
|
async probe(command, includeModels = true) {
|
|
54667
|
-
const
|
|
54668
|
-
if (
|
|
54669
|
-
return
|
|
54677
|
+
const result2 = probeCliRuntime("cursor-agent", {}, command);
|
|
54678
|
+
if (result2.status !== "healthy")
|
|
54679
|
+
return result2;
|
|
54670
54680
|
if (!includeModels)
|
|
54671
|
-
return
|
|
54681
|
+
return result2;
|
|
54672
54682
|
let reasoning;
|
|
54673
54683
|
try {
|
|
54674
54684
|
reasoning = await this.catalogProbe(command);
|
|
@@ -54676,7 +54686,7 @@ class CursorDriver {
|
|
|
54676
54686
|
reasoning = undefined;
|
|
54677
54687
|
}
|
|
54678
54688
|
return {
|
|
54679
|
-
...
|
|
54689
|
+
...result2,
|
|
54680
54690
|
reasoning
|
|
54681
54691
|
};
|
|
54682
54692
|
}
|
|
@@ -54771,8 +54781,8 @@ function parseGrokModelCatalog(value) {
|
|
|
54771
54781
|
models
|
|
54772
54782
|
};
|
|
54773
54783
|
}
|
|
54774
|
-
function catalogFromInitialize(
|
|
54775
|
-
const meta3 = asRecord(
|
|
54784
|
+
function catalogFromInitialize(result2) {
|
|
54785
|
+
const meta3 = asRecord(result2._meta) ?? asRecord(result2.meta);
|
|
54776
54786
|
return parseGrokModelCatalog(meta3?.modelState);
|
|
54777
54787
|
}
|
|
54778
54788
|
async function cleanupProbeProcess2(process2) {
|
|
@@ -54849,15 +54859,15 @@ async function probeGrokAcpCatalog(command, options = {}) {
|
|
|
54849
54859
|
if (!("result" in message2)) {
|
|
54850
54860
|
return finish({ status: "unhealthy", lastError: "grok_acp_invalid_response" });
|
|
54851
54861
|
}
|
|
54852
|
-
const
|
|
54862
|
+
const result2 = asRecord(message2.result) ?? {};
|
|
54853
54863
|
if (expectedId === 1) {
|
|
54854
|
-
const capabilities = asRecord(
|
|
54855
|
-
const methods = Array.isArray(
|
|
54864
|
+
const capabilities = asRecord(result2.agentCapabilities);
|
|
54865
|
+
const methods = Array.isArray(result2.authMethods) ? result2.authMethods : [];
|
|
54856
54866
|
const methodIds = methods.flatMap((method) => {
|
|
54857
54867
|
const id3 = asRecord(method)?.id;
|
|
54858
54868
|
return typeof id3 === "string" ? [id3] : [];
|
|
54859
54869
|
});
|
|
54860
|
-
if (
|
|
54870
|
+
if (result2.protocolVersion !== ACP_PROTOCOL_VERSION5) {
|
|
54861
54871
|
return finish({ status: "unhealthy", lastError: "grok_acp_protocol_incompatible" });
|
|
54862
54872
|
}
|
|
54863
54873
|
if (capabilities?.loadSession !== true) {
|
|
@@ -54871,7 +54881,7 @@ async function probeGrokAcpCatalog(command, options = {}) {
|
|
|
54871
54881
|
}
|
|
54872
54882
|
if (options.includeModels === false)
|
|
54873
54883
|
return finish({ status: "compatible" });
|
|
54874
|
-
catalog = catalogFromInitialize(
|
|
54884
|
+
catalog = catalogFromInitialize(result2) ?? catalog;
|
|
54875
54885
|
expectedId = 2;
|
|
54876
54886
|
write("authenticate", { methodId: AUTH_METHOD_ID4 }, expectedId);
|
|
54877
54887
|
return;
|
|
@@ -55349,13 +55359,13 @@ class GrokAcpLane {
|
|
|
55349
55359
|
completePrompt(prompt, value) {
|
|
55350
55360
|
if (this.currentPromptRequestId !== prompt.requestId)
|
|
55351
55361
|
return;
|
|
55352
|
-
const
|
|
55353
|
-
if (!
|
|
55362
|
+
const result2 = asRecord(value);
|
|
55363
|
+
if (!result2 || typeof result2.stopReason !== "string" || !PROMPT_STOP_REASONS3.has(result2.stopReason)) {
|
|
55354
55364
|
this.failPrompt(prompt, new Error("Grok ACP prompt response did not contain a supported stopReason"), "grok.invalid_stop_reason");
|
|
55355
55365
|
return;
|
|
55356
55366
|
}
|
|
55357
55367
|
const terminalOwner = this.terminalOwner ?? prompt.receipt;
|
|
55358
|
-
const meta3 = asRecord(
|
|
55368
|
+
const meta3 = asRecord(result2._meta) ?? asRecord(result2.meta);
|
|
55359
55369
|
const responseUsage = projectGrokUsage(this.usageProjector, this.sessionId ?? "unknown", prompt.providerPromptId, meta3?.usage);
|
|
55360
55370
|
const usage = responseUsage ?? projectGrokUsage(this.usageProjector, this.sessionId ?? "unknown", prompt.providerPromptId, prompt.fallbackUsage);
|
|
55361
55371
|
this.currentPromptRequestId = null;
|
|
@@ -55367,7 +55377,7 @@ class GrokAcpLane {
|
|
|
55367
55377
|
kind: "turn_end",
|
|
55368
55378
|
sessionId: this.sessionId ?? undefined,
|
|
55369
55379
|
turnOwner: terminalOwner,
|
|
55370
|
-
...
|
|
55380
|
+
...result2.stopReason === "cancelled" ? { outcome: "interrupted" } : {}
|
|
55371
55381
|
});
|
|
55372
55382
|
this.refreshBilling();
|
|
55373
55383
|
}
|
|
@@ -55694,15 +55704,15 @@ class GrokAcpLane {
|
|
|
55694
55704
|
return;
|
|
55695
55705
|
this.billingInFlight = true;
|
|
55696
55706
|
try {
|
|
55697
|
-
const
|
|
55707
|
+
const result2 = await this.call("_x.ai/billing", {});
|
|
55698
55708
|
if (this.requestedStopReason)
|
|
55699
55709
|
return;
|
|
55700
|
-
const payload = asRecord(
|
|
55710
|
+
const payload = asRecord(result2);
|
|
55701
55711
|
this.events.emit("runtime_event", {
|
|
55702
55712
|
kind: "telemetry",
|
|
55703
55713
|
name: "rate_limits",
|
|
55704
55714
|
source: "grok_billing",
|
|
55705
|
-
quota: normalizeGrokBilling(payload?.billing ??
|
|
55715
|
+
quota: normalizeGrokBilling(payload?.billing ?? result2, this.quotaSourceEpoch)
|
|
55706
55716
|
});
|
|
55707
55717
|
} catch (error62) {
|
|
55708
55718
|
if (this.requestedStopReason)
|
|
@@ -55786,19 +55796,19 @@ async function discoverGrokRecentContext(request, dependencies = {}) {
|
|
|
55786
55796
|
return;
|
|
55787
55797
|
if (message2.error !== undefined)
|
|
55788
55798
|
return control.fail("Grok discovery request failed");
|
|
55789
|
-
const
|
|
55790
|
-
if (!
|
|
55799
|
+
const result2 = asRecord(message2.result);
|
|
55800
|
+
if (!result2)
|
|
55791
55801
|
return control.fail("Grok discovery returned an invalid response");
|
|
55792
55802
|
if (expectedMethod === "initialize") {
|
|
55793
|
-
if (
|
|
55803
|
+
if (result2.protocolVersion !== ACP_PROTOCOL_VERSION7) {
|
|
55794
55804
|
return control.fail("Grok discovery protocol is incompatible");
|
|
55795
55805
|
}
|
|
55796
|
-
const capabilities = asRecord(
|
|
55806
|
+
const capabilities = asRecord(result2.agentCapabilities);
|
|
55797
55807
|
const sessionCapabilities = asRecord(capabilities?.sessionCapabilities);
|
|
55798
55808
|
if (sessionCapabilities?.list !== true && !asRecord(sessionCapabilities?.list)) {
|
|
55799
55809
|
return control.fail("Grok session listing is unavailable");
|
|
55800
55810
|
}
|
|
55801
|
-
const authMethods = Array.isArray(
|
|
55811
|
+
const authMethods = Array.isArray(result2.authMethods) ? result2.authMethods : [];
|
|
55802
55812
|
if (!authMethods.some((method) => asRecord(method)?.id === AUTH_METHOD_ID6)) {
|
|
55803
55813
|
return control.fail("Grok discovery authentication is unavailable");
|
|
55804
55814
|
}
|
|
@@ -55811,7 +55821,7 @@ async function discoverGrokRecentContext(request, dependencies = {}) {
|
|
|
55811
55821
|
}
|
|
55812
55822
|
if (expectedMethod !== "session/list")
|
|
55813
55823
|
return control.fail("Grok discovery state is invalid");
|
|
55814
|
-
const sessions = Array.isArray(
|
|
55824
|
+
const sessions = Array.isArray(result2.sessions) ? result2.sessions : Array.isArray(result2.data) ? result2.data : [];
|
|
55815
55825
|
for (const value of sessions) {
|
|
55816
55826
|
const session2 = asRecord(value);
|
|
55817
55827
|
if (!session2)
|
|
@@ -55820,7 +55830,7 @@ async function discoverGrokRecentContext(request, dependencies = {}) {
|
|
|
55820
55830
|
if (collector.satisfied)
|
|
55821
55831
|
return control.finish(collector.result());
|
|
55822
55832
|
}
|
|
55823
|
-
const nextCursor = typeof
|
|
55833
|
+
const nextCursor = typeof result2.nextCursor === "string" && result2.nextCursor ? result2.nextCursor : undefined;
|
|
55824
55834
|
if (!nextCursor)
|
|
55825
55835
|
return control.finish(collector.result());
|
|
55826
55836
|
if (seenCursors.has(nextCursor))
|
|
@@ -55882,9 +55892,9 @@ class GrokDriver {
|
|
|
55882
55892
|
this.spawnProcess = spawnProcess;
|
|
55883
55893
|
}
|
|
55884
55894
|
async probe(command, includeModels = true) {
|
|
55885
|
-
const
|
|
55886
|
-
if (
|
|
55887
|
-
return
|
|
55895
|
+
const result2 = probeCliRuntime("grok", {}, command);
|
|
55896
|
+
if (result2.status !== "healthy")
|
|
55897
|
+
return result2;
|
|
55888
55898
|
let acpProbe;
|
|
55889
55899
|
try {
|
|
55890
55900
|
acpProbe = includeModels ? await this.catalogProbe(command) : await this.catalogProbe(command, { includeModels: false });
|
|
@@ -55892,9 +55902,9 @@ class GrokDriver {
|
|
|
55892
55902
|
acpProbe = { status: "unhealthy", lastError: "grok_acp_probe_failed" };
|
|
55893
55903
|
}
|
|
55894
55904
|
if (acpProbe.status === "unhealthy") {
|
|
55895
|
-
return { ...
|
|
55905
|
+
return { ...result2, status: "unhealthy", lastError: acpProbe.lastError };
|
|
55896
55906
|
}
|
|
55897
|
-
return { ...
|
|
55907
|
+
return { ...result2, reasoning: acpProbe.reasoning };
|
|
55898
55908
|
}
|
|
55899
55909
|
async openLane(ctx, options) {
|
|
55900
55910
|
return new GrokAcpLane(this, ctx, { onRawStdoutLine: options?.onRawStdoutLine });
|
|
@@ -57681,27 +57691,27 @@ class OpenCodeDriver {
|
|
|
57681
57691
|
discoverRecentContext(request) {
|
|
57682
57692
|
if (request.recentProjectsTopK === 0)
|
|
57683
57693
|
return discoverOpenCodeRecentContext(request);
|
|
57684
|
-
const
|
|
57685
|
-
if (
|
|
57694
|
+
const result2 = this.versionProbe("opencode", {}, request.command);
|
|
57695
|
+
if (result2.status !== "healthy")
|
|
57686
57696
|
throw new Error("Installed OpenCode CLI could not report its version");
|
|
57687
|
-
return discoverOpenCodeRecentContext(request, { compatibility: resolveOpenCodeCompatibility(
|
|
57697
|
+
return discoverOpenCodeRecentContext(request, { compatibility: resolveOpenCodeCompatibility(result2.version) });
|
|
57688
57698
|
}
|
|
57689
57699
|
probe(command, includeModels = true) {
|
|
57690
|
-
const
|
|
57691
|
-
if (
|
|
57692
|
-
return
|
|
57700
|
+
const result2 = this.versionProbe("opencode", {}, command);
|
|
57701
|
+
if (result2.status !== "healthy")
|
|
57702
|
+
return result2;
|
|
57693
57703
|
let compatibility;
|
|
57694
57704
|
try {
|
|
57695
|
-
compatibility = resolveOpenCodeCompatibility(
|
|
57705
|
+
compatibility = resolveOpenCodeCompatibility(result2.version);
|
|
57696
57706
|
} catch {
|
|
57697
|
-
return { ...
|
|
57707
|
+
return { ...result2, status: "unhealthy", lastError: "unsupported_opencode_cli_version" };
|
|
57698
57708
|
}
|
|
57699
57709
|
if (!includeModels)
|
|
57700
|
-
return
|
|
57710
|
+
return result2;
|
|
57701
57711
|
const spec = resolveSpawnSpec("opencode", [...compatibility.modelArgs], command);
|
|
57702
57712
|
const output2 = this.outputProbe(spec.command, spec.args);
|
|
57703
57713
|
return {
|
|
57704
|
-
...
|
|
57714
|
+
...result2,
|
|
57705
57715
|
reasoning: output2.ok ? parseOpenCodeModelCatalog(output2.output) : undefined
|
|
57706
57716
|
};
|
|
57707
57717
|
}
|
|
@@ -57710,10 +57720,10 @@ class OpenCodeDriver {
|
|
|
57710
57720
|
}
|
|
57711
57721
|
async openLane(ctx, options) {
|
|
57712
57722
|
const command = resolveLaunchFieldsOrDefault(ctx.config.runtimeConfig).command;
|
|
57713
|
-
const
|
|
57714
|
-
if (
|
|
57723
|
+
const result2 = this.versionProbe("opencode", {}, command);
|
|
57724
|
+
if (result2.status !== "healthy")
|
|
57715
57725
|
throw new Error("Installed OpenCode CLI could not report its version");
|
|
57716
|
-
const compatibility = resolveOpenCodeCompatibility(
|
|
57726
|
+
const compatibility = resolveOpenCodeCompatibility(result2.version);
|
|
57717
57727
|
const factory = {
|
|
57718
57728
|
spawnService: (launch, port, password) => this.spawnService(launch, port, password, compatibility)
|
|
57719
57729
|
};
|
|
@@ -58828,8 +58838,8 @@ class LogicalAgentSession {
|
|
|
58828
58838
|
};
|
|
58829
58839
|
}
|
|
58830
58840
|
});
|
|
58831
|
-
this.settingsUpdateTail = operation.then((
|
|
58832
|
-
if (
|
|
58841
|
+
this.settingsUpdateTail = operation.then((result2) => {
|
|
58842
|
+
if (result2.status === "applied") {
|
|
58833
58843
|
this.settingsUpdatePending = false;
|
|
58834
58844
|
return;
|
|
58835
58845
|
}
|
|
@@ -59820,17 +59830,17 @@ class LogicalAgentSession {
|
|
|
59820
59830
|
status: "failed",
|
|
59821
59831
|
error: driverError("internal", "host_release_failed", String(error62))
|
|
59822
59832
|
}));
|
|
59823
|
-
const
|
|
59833
|
+
const result2 = await Promise.race([release, timeout]);
|
|
59824
59834
|
release.catch(() => {});
|
|
59825
|
-
if (
|
|
59835
|
+
if (result2.status === "failed" || result2.status === "timed_out") {
|
|
59826
59836
|
this.emit({
|
|
59827
59837
|
type: "diagnostic",
|
|
59828
59838
|
severity: "error",
|
|
59829
59839
|
source: "host",
|
|
59830
|
-
message:
|
|
59840
|
+
message: result2.error.message
|
|
59831
59841
|
});
|
|
59832
59842
|
}
|
|
59833
|
-
return
|
|
59843
|
+
return result2;
|
|
59834
59844
|
} finally {
|
|
59835
59845
|
if (timer)
|
|
59836
59846
|
clearTimeout(timer);
|
|
@@ -59861,12 +59871,12 @@ class LogicalAgentSession {
|
|
|
59861
59871
|
this.interruptedTurnId = undefined;
|
|
59862
59872
|
}
|
|
59863
59873
|
const cleanup = await this.cleanupResource(releaseReason);
|
|
59864
|
-
const
|
|
59865
|
-
this.terminalResult =
|
|
59874
|
+
const result2 = buildResult(cleanup);
|
|
59875
|
+
this.terminalResult = result2;
|
|
59866
59876
|
this.state = "closed";
|
|
59867
|
-
this.emit({ type: "session_closed", result });
|
|
59877
|
+
this.emit({ type: "session_closed", result: result2 });
|
|
59868
59878
|
this.eventQueue.close();
|
|
59869
|
-
this.resolveClosed(
|
|
59879
|
+
this.resolveClosed(result2);
|
|
59870
59880
|
this.finishing = false;
|
|
59871
59881
|
})();
|
|
59872
59882
|
}
|
|
@@ -59908,14 +59918,14 @@ class LogicalAgentSession {
|
|
|
59908
59918
|
mode,
|
|
59909
59919
|
sessionId: this.backendSessionId ?? this.launch.resumeSessionId,
|
|
59910
59920
|
terminalOwner: mode === "idle" ? this.activeTurn?.terminalOwner : undefined
|
|
59911
|
-
}).then((
|
|
59912
|
-
if (!
|
|
59913
|
-
if (
|
|
59914
|
-
throw new StructuredLaneAdmissionError("runtime_busy",
|
|
59921
|
+
}).then((result2) => {
|
|
59922
|
+
if (!result2.ok) {
|
|
59923
|
+
if (result2.reason === "runtime_busy") {
|
|
59924
|
+
throw new StructuredLaneAdmissionError("runtime_busy", result2.error ?? result2.reason);
|
|
59915
59925
|
}
|
|
59916
|
-
throw new Error(
|
|
59926
|
+
throw new Error(result2.error ?? result2.reason);
|
|
59917
59927
|
}
|
|
59918
|
-
return
|
|
59928
|
+
return result2;
|
|
59919
59929
|
});
|
|
59920
59930
|
}
|
|
59921
59931
|
stopLane(reason, forceAfterMs) {
|
|
@@ -60052,25 +60062,25 @@ function createAgentDriverSdkWithRegistry(options) {
|
|
|
60052
60062
|
const adapter = registration.createAdapter();
|
|
60053
60063
|
assertAdapterCompatibility(String(registration.id), registration.capabilities, adapter);
|
|
60054
60064
|
const command = capabilities2.commandOverride ? input2.command : undefined;
|
|
60055
|
-
const
|
|
60056
|
-
if (
|
|
60065
|
+
const result2 = input2.includeModels === false ? await adapter.probe(command, false) : await adapter.probe(command);
|
|
60066
|
+
if (result2.status === "healthy") {
|
|
60057
60067
|
return {
|
|
60058
60068
|
status: "healthy",
|
|
60059
|
-
version:
|
|
60069
|
+
version: result2.version,
|
|
60060
60070
|
capabilities: capabilities2,
|
|
60061
|
-
reasoning:
|
|
60071
|
+
reasoning: result2.reasoning && adapter.modelCatalogOrigin ? { ...result2.reasoning, catalogOrigin: adapter.modelCatalogOrigin } : result2.reasoning
|
|
60062
60072
|
};
|
|
60063
60073
|
}
|
|
60064
60074
|
return {
|
|
60065
60075
|
status: "unhealthy",
|
|
60066
60076
|
error: {
|
|
60067
60077
|
category: "runtime_unavailable",
|
|
60068
|
-
code: stableErrorCode(
|
|
60078
|
+
code: stableErrorCode(result2.lastError, "probe_failed"),
|
|
60069
60079
|
message: `Backend ${input2.backend} is unavailable`,
|
|
60070
60080
|
retryable: true
|
|
60071
60081
|
},
|
|
60072
60082
|
capabilities: capabilities2,
|
|
60073
|
-
reasoning:
|
|
60083
|
+
reasoning: result2.reasoning && adapter.modelCatalogOrigin ? { ...result2.reasoning, catalogOrigin: adapter.modelCatalogOrigin } : result2.reasoning
|
|
60074
60084
|
};
|
|
60075
60085
|
} catch (error62) {
|
|
60076
60086
|
const contractInvalid = error62 instanceof Error && (error62.message.startsWith("Adapter ") || error62.message.startsWith("Agent backend registration "));
|
|
@@ -61915,14 +61925,14 @@ class PiiStore {
|
|
|
61915
61925
|
return this.filterPipelineWithResult(pipeline, text2);
|
|
61916
61926
|
}
|
|
61917
61927
|
async filterPipelineWithResult(pipeline, text2) {
|
|
61918
|
-
const
|
|
61919
|
-
return { text:
|
|
61928
|
+
const result2 = await this.runWithResult(pipeline, text2);
|
|
61929
|
+
return { text: result2.text, triggeredFilters: result2.triggers.filter((trigger) => trigger.triggered).map((trigger) => {
|
|
61920
61930
|
const plugin = pipeline.plugins.find((plugin2) => plugin2.id === trigger.pluginId);
|
|
61921
61931
|
return { id: plugin.id, name: plugin.name };
|
|
61922
61932
|
}) };
|
|
61923
61933
|
}
|
|
61924
61934
|
run(pipeline, text2) {
|
|
61925
|
-
return this.runWithResult(pipeline, text2).then((
|
|
61935
|
+
return this.runWithResult(pipeline, text2).then((result2) => result2.text);
|
|
61926
61936
|
}
|
|
61927
61937
|
runWithResult(pipeline, text2) {
|
|
61928
61938
|
let plugins = this.compiled.get(pipeline);
|
|
@@ -62749,10 +62759,10 @@ class WsControlChannel {
|
|
|
62749
62759
|
const pending = [];
|
|
62750
62760
|
for (const cb of this.commandCbs) {
|
|
62751
62761
|
try {
|
|
62752
|
-
const
|
|
62753
|
-
if (
|
|
62762
|
+
const result2 = cb(cmd);
|
|
62763
|
+
if (result2 === WS_CONTROL_COMMAND_CONSUMED)
|
|
62754
62764
|
break;
|
|
62755
|
-
pending.push(Promise.resolve(
|
|
62765
|
+
pending.push(Promise.resolve(result2).catch((err) => {
|
|
62756
62766
|
this.log.warn("command listener threw", { type: cmd.type, err: describeErr(err) });
|
|
62757
62767
|
}));
|
|
62758
62768
|
} catch (err) {
|
|
@@ -62772,7 +62782,7 @@ class WsControlChannel {
|
|
|
62772
62782
|
return;
|
|
62773
62783
|
}
|
|
62774
62784
|
if (cmd.type === "agent:wake") {
|
|
62775
|
-
const
|
|
62785
|
+
const result2 = await this.wakeCoordinator.run(cmd, (accepted) => this.dispatchListeners(accepted), (advanced) => {
|
|
62776
62786
|
for (const cb of this.wakeDesiredCbs) {
|
|
62777
62787
|
try {
|
|
62778
62788
|
cb(advanced);
|
|
@@ -62781,7 +62791,7 @@ class WsControlChannel {
|
|
|
62781
62791
|
}
|
|
62782
62792
|
}
|
|
62783
62793
|
});
|
|
62784
|
-
if (
|
|
62794
|
+
if (result2.state === "suppressed") {
|
|
62785
62795
|
await this.reportWakeAck({
|
|
62786
62796
|
agentId: cmd.agentId,
|
|
62787
62797
|
launchId: cmd.launchId,
|
|
@@ -62791,7 +62801,7 @@ class WsControlChannel {
|
|
|
62791
62801
|
agentId: cmd.agentId,
|
|
62792
62802
|
channel: cmd.unreadNotice.channel,
|
|
62793
62803
|
latestSeq: cmd.unreadNotice.latestSeq,
|
|
62794
|
-
coveredSeq:
|
|
62804
|
+
coveredSeq: result2.coveredSeq
|
|
62795
62805
|
});
|
|
62796
62806
|
}
|
|
62797
62807
|
return;
|
|
@@ -64133,8 +64143,8 @@ function text2(value) {
|
|
|
64133
64143
|
return typeof value === "string" && value.trim() ? value.trim() : undefined;
|
|
64134
64144
|
}
|
|
64135
64145
|
function label(value) {
|
|
64136
|
-
const
|
|
64137
|
-
return
|
|
64146
|
+
const result2 = text2(value);
|
|
64147
|
+
return result2 && Buffer.byteLength(result2) <= 64 ? result2 : undefined;
|
|
64138
64148
|
}
|
|
64139
64149
|
function parseAntigravityQuota(value) {
|
|
64140
64150
|
const body = asRecord(value);
|
|
@@ -65238,10 +65248,10 @@ class AgentProcessManager {
|
|
|
65238
65248
|
return desiredRevision === appliedRevision ? "idempotent" : "stale";
|
|
65239
65249
|
}
|
|
65240
65250
|
const canApplyNatively = applied && this.runtimeLaunchTuple(applied) === this.runtimeLaunchTuple(desired) && typeof session2.updateSettings === "function";
|
|
65241
|
-
let
|
|
65251
|
+
let result2 = { status: "unsupported" };
|
|
65242
65252
|
if (canApplyNatively) {
|
|
65243
65253
|
try {
|
|
65244
|
-
|
|
65254
|
+
result2 = await session2.updateSettings({
|
|
65245
65255
|
reasoningEffort: desired.reasoningEffort ?? null
|
|
65246
65256
|
});
|
|
65247
65257
|
} catch (error62) {
|
|
@@ -65255,12 +65265,12 @@ class AgentProcessManager {
|
|
|
65255
65265
|
return "saved_for_start";
|
|
65256
65266
|
}
|
|
65257
65267
|
}
|
|
65258
|
-
if (
|
|
65268
|
+
if (result2.status !== "applied") {
|
|
65259
65269
|
this.log.warn("runtime config live apply unavailable; restarting at safe boundary", {
|
|
65260
65270
|
agentId,
|
|
65261
65271
|
revision: desiredRevision,
|
|
65262
|
-
status:
|
|
65263
|
-
code:
|
|
65272
|
+
status: result2.status,
|
|
65273
|
+
code: result2.error?.code
|
|
65264
65274
|
});
|
|
65265
65275
|
if (restartOnFailure)
|
|
65266
65276
|
await this.restartForRuntimeConfig(agentId, session2);
|
|
@@ -65430,13 +65440,13 @@ class AgentProcessManager {
|
|
|
65430
65440
|
const session2 = this.sessions.get(agentId);
|
|
65431
65441
|
if (!session2)
|
|
65432
65442
|
return;
|
|
65433
|
-
const
|
|
65434
|
-
if (
|
|
65443
|
+
const result2 = await session2.interrupt({ requestId: randomUUID10(), reason: "owner_request" });
|
|
65444
|
+
if (result2.status !== "accepted")
|
|
65435
65445
|
return;
|
|
65436
65446
|
this.log.info("agent turn interrupt accepted", {
|
|
65437
65447
|
agentId,
|
|
65438
65448
|
sessionInstanceId: session2.sessionInstanceId,
|
|
65439
|
-
turnId:
|
|
65449
|
+
turnId: result2.turnId
|
|
65440
65450
|
});
|
|
65441
65451
|
try {
|
|
65442
65452
|
this.opts.onBotAuditEvent?.(agentId, { kind: "turn_interrupt", payload: { status: "accepted" } }, this.auditContext(agentId));
|
|
@@ -65467,7 +65477,7 @@ class AgentProcessManager {
|
|
|
65467
65477
|
]));
|
|
65468
65478
|
this.sessions.clear();
|
|
65469
65479
|
this.sessionLifecycles.clear();
|
|
65470
|
-
failures.push(...[...factories, ...completed].filter((
|
|
65480
|
+
failures.push(...[...factories, ...completed].filter((result2) => result2.status === "rejected").map((result2) => result2.reason));
|
|
65471
65481
|
if (failures.length)
|
|
65472
65482
|
throw new AggregateError(failures, "Agent shutdown did not complete cleanly");
|
|
65473
65483
|
});
|
|
@@ -66157,7 +66167,7 @@ ${this.opts.wakePromptFooter}` : text3;
|
|
|
66157
66167
|
this.opts.onRuntimeSpawnFailed?.(driver.id, reason);
|
|
66158
66168
|
this.emitErrorAudit(agentId, options?.scope ?? "spawn", reason, options?.message ?? `Launch failed (${reason})`);
|
|
66159
66169
|
};
|
|
66160
|
-
const teardown = (
|
|
66170
|
+
const teardown = (result2) => {
|
|
66161
66171
|
clearHandshakeTimer();
|
|
66162
66172
|
if (state.torndown)
|
|
66163
66173
|
return;
|
|
@@ -66168,18 +66178,18 @@ ${this.opts.wakePromptFooter}` : text3;
|
|
|
66168
66178
|
this.closeTurn(state, state.activeSpan, { event: "turn_abort", abortCause: "physical_exit" });
|
|
66169
66179
|
return;
|
|
66170
66180
|
}
|
|
66171
|
-
const failedStart =
|
|
66181
|
+
const failedStart = result2.outcome === "failed_to_start";
|
|
66172
66182
|
if (failedStart)
|
|
66173
|
-
reportSpawnFailure(
|
|
66183
|
+
reportSpawnFailure(result2.error.code || "failed_to_start");
|
|
66174
66184
|
if (!state.hasEstablished && !failedStart)
|
|
66175
66185
|
reportSpawnFailure("pre_handshake_exit");
|
|
66176
66186
|
this.closeTurn(state, state.activeSpan, {
|
|
66177
66187
|
event: "turn_abort",
|
|
66178
66188
|
abortCause: failedStart ? "spawn_failure" : "physical_exit"
|
|
66179
66189
|
});
|
|
66180
|
-
const exitCode = "exitCode" in
|
|
66181
|
-
const exitSignal = "signal" in
|
|
66182
|
-
const requested = "requested" in
|
|
66190
|
+
const exitCode = "exitCode" in result2 ? result2.exitCode ?? null : null;
|
|
66191
|
+
const exitSignal = "signal" in result2 ? result2.signal ?? null : null;
|
|
66192
|
+
const requested = "requested" in result2 && result2.requested === true;
|
|
66183
66193
|
const abnormal = !requested && (exitSignal !== null || exitCode !== null && exitCode !== 0);
|
|
66184
66194
|
if (state.hasEstablished && !state.suppressExitLog) {
|
|
66185
66195
|
this.logSessionEnded(agentId, "exit");
|
|
@@ -66264,7 +66274,7 @@ ${this.opts.wakePromptFooter}` : text3;
|
|
|
66264
66274
|
const done = Promise.allSettled([closed, eventsDone]).then(([closedResult, eventsResult]) => {
|
|
66265
66275
|
if (closedResult.status === "fulfilled")
|
|
66266
66276
|
teardown(closedResult.value);
|
|
66267
|
-
const failures = [closedResult, eventsResult].filter((
|
|
66277
|
+
const failures = [closedResult, eventsResult].filter((result2) => result2.status === "rejected").map((result2) => result2.reason);
|
|
66268
66278
|
if (closedResult.status === "fulfilled" && (closedResult.value.cleanup.status === "failed" || closedResult.value.cleanup.status === "timed_out")) {
|
|
66269
66279
|
failures.push(closedResult.value.cleanup.error);
|
|
66270
66280
|
}
|
|
@@ -66624,11 +66634,11 @@ ${this.opts.wakePromptFooter}` : text3;
|
|
|
66624
66634
|
turnId: event.turnId
|
|
66625
66635
|
};
|
|
66626
66636
|
if (this.pendingRuntimeConfigUpdates.has(agentId) && this.sessions.get(agentId) === owner.session) {
|
|
66627
|
-
this.convergeRuntimeConfig(agentId, false).then((
|
|
66628
|
-
if (
|
|
66637
|
+
this.convergeRuntimeConfig(agentId, false).then((result2) => {
|
|
66638
|
+
if (result2 === "saved_for_start" && owner.session)
|
|
66629
66639
|
this.markResetting(agentId);
|
|
66630
66640
|
this.dispatch(completionEvent, owner);
|
|
66631
|
-
if (
|
|
66641
|
+
if (result2 === "saved_for_start" && owner.session) {
|
|
66632
66642
|
this.restartForRuntimeConfig(agentId, owner.session);
|
|
66633
66643
|
}
|
|
66634
66644
|
}).catch((error62) => {
|
|
@@ -67069,11 +67079,11 @@ class AgentRouter {
|
|
|
67069
67079
|
revision: cmd.config.runtimeConfigRevision ?? 0
|
|
67070
67080
|
});
|
|
67071
67081
|
try {
|
|
67072
|
-
const
|
|
67082
|
+
const result2 = await this.opts.manager.updateRuntimeConfig(cmd.agentId, cmd.config);
|
|
67073
67083
|
this.log.info("agent:runtime_config_update accepted", {
|
|
67074
67084
|
agentId: cmd.agentId,
|
|
67075
67085
|
revision: cmd.config.runtimeConfigRevision ?? 0,
|
|
67076
|
-
result
|
|
67086
|
+
result: result2
|
|
67077
67087
|
});
|
|
67078
67088
|
} catch (err) {
|
|
67079
67089
|
this.log.warn("agent:runtime_config_update rejected", {
|
|
@@ -68047,20 +68057,20 @@ function createTimelineRecorder(opts) {
|
|
|
68047
68057
|
}
|
|
68048
68058
|
}
|
|
68049
68059
|
};
|
|
68050
|
-
const handleTrackedResult = (agentId, state,
|
|
68051
|
-
if (
|
|
68052
|
-
applyRewrite(agentId,
|
|
68053
|
-
if (state &&
|
|
68054
|
-
state.handle =
|
|
68060
|
+
const handleTrackedResult = (agentId, state, result2) => {
|
|
68061
|
+
if (result2.status === "written") {
|
|
68062
|
+
applyRewrite(agentId, result2.rewrite);
|
|
68063
|
+
if (state && result2.handle) {
|
|
68064
|
+
state.handle = result2.handle;
|
|
68055
68065
|
state.rowFenced = false;
|
|
68056
68066
|
}
|
|
68057
68067
|
return "written";
|
|
68058
68068
|
}
|
|
68059
|
-
if (
|
|
68069
|
+
if (result2.reason === "lock" || result2.reason === "write")
|
|
68060
68070
|
return "retryable";
|
|
68061
|
-
if (state &&
|
|
68071
|
+
if (state && result2.reason !== "oversized")
|
|
68062
68072
|
state.rowFenced = true;
|
|
68063
|
-
diagnostic(agentId, "timeline_exact_write_rejected",
|
|
68073
|
+
diagnostic(agentId, "timeline_exact_write_rejected", result2.reason);
|
|
68064
68074
|
return "terminal";
|
|
68065
68075
|
};
|
|
68066
68076
|
const tryCommit = (agentId, state) => {
|
|
@@ -68072,11 +68082,11 @@ function createTimelineRecorder(opts) {
|
|
|
68072
68082
|
return "terminal";
|
|
68073
68083
|
}
|
|
68074
68084
|
if (state.handle) {
|
|
68075
|
-
const
|
|
68085
|
+
const result3 = updateTrackedEntry(dir, state.handle, (entry2) => {
|
|
68076
68086
|
const fitted2 = fitResponsesToRow(entry2, state.responses);
|
|
68077
68087
|
return { ...entry2, agent_responses: fitted2 ?? [...entry2.agent_responses, ...state.responses] };
|
|
68078
68088
|
});
|
|
68079
|
-
return handleTrackedResult(agentId, state,
|
|
68089
|
+
return handleTrackedResult(agentId, state, result3);
|
|
68080
68090
|
}
|
|
68081
68091
|
if (state.rowFenced || state.pendingMode === "handle")
|
|
68082
68092
|
return "terminal";
|
|
@@ -68093,8 +68103,8 @@ function createTimelineRecorder(opts) {
|
|
|
68093
68103
|
return "terminal";
|
|
68094
68104
|
}
|
|
68095
68105
|
entry.agent_responses = fitted;
|
|
68096
|
-
const
|
|
68097
|
-
return handleTrackedResult(agentId, state,
|
|
68106
|
+
const result2 = appendTrackedEntry(dir, entry, now());
|
|
68107
|
+
return handleTrackedResult(agentId, state, result2);
|
|
68098
68108
|
};
|
|
68099
68109
|
const deleteState = (agentId, key) => {
|
|
68100
68110
|
const states = statesFor(agentId);
|
|
@@ -68121,13 +68131,13 @@ function createTimelineRecorder(opts) {
|
|
|
68121
68131
|
deleteState(agentId, key);
|
|
68122
68132
|
continue;
|
|
68123
68133
|
}
|
|
68124
|
-
const
|
|
68125
|
-
if (
|
|
68134
|
+
const result2 = tryCommit(agentId, state);
|
|
68135
|
+
if (result2 === "written") {
|
|
68126
68136
|
state.responses = [];
|
|
68127
68137
|
state.pendingSinceMs = undefined;
|
|
68128
68138
|
state.pendingMode = undefined;
|
|
68129
68139
|
state.completedAtMs = nowMs;
|
|
68130
|
-
} else if (
|
|
68140
|
+
} else if (result2 === "terminal") {
|
|
68131
68141
|
deleteState(agentId, key);
|
|
68132
68142
|
}
|
|
68133
68143
|
}
|
|
@@ -68155,12 +68165,12 @@ function createTimelineRecorder(opts) {
|
|
|
68155
68165
|
const dir = dirFor(agentId);
|
|
68156
68166
|
if (!prepareTimelineDirectory(dir))
|
|
68157
68167
|
return;
|
|
68158
|
-
const
|
|
68168
|
+
const result2 = appendTrackedEntry(dir, createTimelineEntry({
|
|
68159
68169
|
messages,
|
|
68160
68170
|
sessionId: sessionByAgent.get(agentId) ?? null,
|
|
68161
68171
|
provider: opts.providerFor?.(agentId) ?? null
|
|
68162
68172
|
}), now());
|
|
68163
|
-
handleTrackedResult(agentId, null,
|
|
68173
|
+
handleTrackedResult(agentId, null, result2);
|
|
68164
68174
|
};
|
|
68165
68175
|
return {
|
|
68166
68176
|
barrierGeneration(agentId) {
|
|
@@ -68204,16 +68214,16 @@ function createTimelineRecorder(opts) {
|
|
|
68204
68214
|
if (!prepareTimelineDirectory(dir))
|
|
68205
68215
|
return;
|
|
68206
68216
|
const stamp = now();
|
|
68207
|
-
let
|
|
68217
|
+
let result2;
|
|
68208
68218
|
if (state.handle && (state.handle.filename === filenameForDate(stamp) || state.owner.barrierGeneration !== currentBarrier(agentId))) {
|
|
68209
|
-
|
|
68219
|
+
result2 = updateTrackedEntry(dir, state.handle, (entry) => ({
|
|
68210
68220
|
...entry,
|
|
68211
68221
|
messages: [...entry.messages, ...messages],
|
|
68212
68222
|
session_id: state.backendSessionId,
|
|
68213
68223
|
provider: state.provider
|
|
68214
68224
|
}));
|
|
68215
68225
|
} else if (state.owner.barrierGeneration === currentBarrier(agentId)) {
|
|
68216
|
-
|
|
68226
|
+
result2 = appendTrackedEntry(dir, createTimelineEntry({
|
|
68217
68227
|
messages,
|
|
68218
68228
|
sessionId: state.backendSessionId,
|
|
68219
68229
|
provider: state.provider
|
|
@@ -68222,7 +68232,7 @@ function createTimelineRecorder(opts) {
|
|
|
68222
68232
|
appendOwnerless(agentId, messages);
|
|
68223
68233
|
return;
|
|
68224
68234
|
}
|
|
68225
|
-
handleTrackedResult(agentId, state,
|
|
68235
|
+
handleTrackedResult(agentId, state, result2);
|
|
68226
68236
|
},
|
|
68227
68237
|
recordAssistantMessage(agentId, owner, text3, truncated = false) {
|
|
68228
68238
|
retryPending(agentId);
|
|
@@ -68255,11 +68265,11 @@ function createTimelineRecorder(opts) {
|
|
|
68255
68265
|
deleteState(agentId, key);
|
|
68256
68266
|
return;
|
|
68257
68267
|
}
|
|
68258
|
-
const
|
|
68259
|
-
if (
|
|
68268
|
+
const result2 = tryCommit(agentId, state);
|
|
68269
|
+
if (result2 === "written") {
|
|
68260
68270
|
state.responses = [];
|
|
68261
68271
|
state.completedAtMs = now().getTime();
|
|
68262
|
-
} else if (
|
|
68272
|
+
} else if (result2 === "terminal") {
|
|
68263
68273
|
deleteState(agentId, key);
|
|
68264
68274
|
} else {
|
|
68265
68275
|
retainPending(agentId, key, state);
|
|
@@ -68355,8 +68365,8 @@ function createTimelineRecorder(opts) {
|
|
|
68355
68365
|
}
|
|
68356
68366
|
}
|
|
68357
68367
|
}
|
|
68358
|
-
const
|
|
68359
|
-
handleTrackedResult(agentId, null,
|
|
68368
|
+
const result2 = appendTrackedEntry(dir, createSystemEntry(barrierType, stamp.toISOString(), forgottenSessionId), stamp);
|
|
68369
|
+
handleTrackedResult(agentId, null, result2);
|
|
68360
68370
|
return true;
|
|
68361
68371
|
},
|
|
68362
68372
|
pendingIdleResetEvents(agentId) {
|
|
@@ -68386,8 +68396,8 @@ function createTimelineRecorder(opts) {
|
|
|
68386
68396
|
}));
|
|
68387
68397
|
if (!persisted)
|
|
68388
68398
|
return false;
|
|
68389
|
-
const
|
|
68390
|
-
handleTrackedResult(agentId, null,
|
|
68399
|
+
const result2 = appendTrackedEntry(dir, createSystemEntry(type, stamp.toISOString(), sessionId), stamp);
|
|
68400
|
+
handleTrackedResult(agentId, null, result2);
|
|
68391
68401
|
return true;
|
|
68392
68402
|
}
|
|
68393
68403
|
}
|
|
@@ -68922,7 +68932,7 @@ class DailyTokenUsageStore {
|
|
|
68922
68932
|
return this.usageWindow(botId).then((window2) => window2.snapshots);
|
|
68923
68933
|
}
|
|
68924
68934
|
usageWindow(botId) {
|
|
68925
|
-
let
|
|
68935
|
+
let result2 = [];
|
|
68926
68936
|
let usageDay = "";
|
|
68927
68937
|
let usageTimeZone = "";
|
|
68928
68938
|
return this.enqueue(async () => {
|
|
@@ -68935,21 +68945,21 @@ class DailyTokenUsageStore {
|
|
|
68935
68945
|
if (this.prune(at, timeZone))
|
|
68936
68946
|
await this.persist();
|
|
68937
68947
|
const oldestDay = oldestVisibleDay(usageDay);
|
|
68938
|
-
|
|
68948
|
+
result2 = (this.data.bots[botId] ?? []).filter((snapshot) => snapshot.day >= oldestDay && snapshot.day <= usageDay).map((snapshot) => structuredClone(snapshot));
|
|
68939
68949
|
}).then(() => ({
|
|
68940
68950
|
usageDay,
|
|
68941
68951
|
usageTimeZone,
|
|
68942
|
-
snapshots:
|
|
68952
|
+
snapshots: result2
|
|
68943
68953
|
}));
|
|
68944
68954
|
}
|
|
68945
68955
|
enqueue(operation) {
|
|
68946
|
-
const
|
|
68947
|
-
this.tail =
|
|
68956
|
+
const result2 = this.tail.then(operation, operation);
|
|
68957
|
+
this.tail = result2.then(() => {
|
|
68948
68958
|
return;
|
|
68949
68959
|
}, () => {
|
|
68950
68960
|
return;
|
|
68951
68961
|
});
|
|
68952
|
-
return
|
|
68962
|
+
return result2;
|
|
68953
68963
|
}
|
|
68954
68964
|
async load() {
|
|
68955
68965
|
if (this.loaded)
|
|
@@ -69054,33 +69064,33 @@ var RECENT_CONTEXT_HEADING = "## Recent local context";
|
|
|
69054
69064
|
function code(value) {
|
|
69055
69065
|
return `\`${value.replaceAll("`", "\\`")}\``;
|
|
69056
69066
|
}
|
|
69057
|
-
function appendRecentContextToPrompt(prompt,
|
|
69067
|
+
function appendRecentContextToPrompt(prompt, result2) {
|
|
69058
69068
|
const lines = [
|
|
69059
69069
|
prompt,
|
|
69060
69070
|
"",
|
|
69061
69071
|
RECENT_CONTEXT_HEADING,
|
|
69062
69072
|
""
|
|
69063
69073
|
];
|
|
69064
|
-
if (!
|
|
69074
|
+
if (!result2.ok) {
|
|
69065
69075
|
lines.push("Recent sessions and projects could not be discovered on this machine. " + "Continue onboarding without inventing context; ask the owner what they want to start with.");
|
|
69066
69076
|
return lines.join(`
|
|
69067
69077
|
`);
|
|
69068
69078
|
}
|
|
69069
69079
|
lines.push("Use these local pointers to understand what the owner has actually been working on before suggesting next actions. " + "Inspect only what is relevant, and do not paste private file paths or unrelated content into Alook.", "Do not read every session in full. For a session you inspect, read the beginning to understand what the user wanted, " + "then read the end to see the result. Read the middle selectively only when it helps resolve a relevant question.", "", "### Recent sessions", "");
|
|
69070
|
-
if (
|
|
69080
|
+
if (result2.sessionFiles.capability === "unavailable") {
|
|
69071
69081
|
lines.push("This runtime does not expose discoverable session files.");
|
|
69072
|
-
} else if (
|
|
69082
|
+
} else if (result2.sessionFiles.items.length === 0) {
|
|
69073
69083
|
lines.push("No recent session files were found.");
|
|
69074
69084
|
} else {
|
|
69075
|
-
for (const item of
|
|
69085
|
+
for (const item of result2.sessionFiles.items) {
|
|
69076
69086
|
lines.push(`- ${code(item.sessionFilePath)} — project ${code(item.projectPath)}; updated ${item.modifiedAt}`);
|
|
69077
69087
|
}
|
|
69078
69088
|
}
|
|
69079
69089
|
lines.push("", "### Recent projects", "");
|
|
69080
|
-
if (
|
|
69090
|
+
if (result2.recentProjects.length === 0) {
|
|
69081
69091
|
lines.push("No recent projects were found.");
|
|
69082
69092
|
} else {
|
|
69083
|
-
for (const item of
|
|
69093
|
+
for (const item of result2.recentProjects) {
|
|
69084
69094
|
lines.push(`- ${code(item.projectPath)} — updated ${item.modifiedAt}`);
|
|
69085
69095
|
}
|
|
69086
69096
|
}
|
|
@@ -69091,16 +69101,16 @@ function createRecentContextPromptAppender(discover, recentSessionFilesTopK = 20
|
|
|
69091
69101
|
return async (prompt, runtimeConfig) => {
|
|
69092
69102
|
const selected = toAgentBackendSelection(runtimeConfig);
|
|
69093
69103
|
const command = selected.config.command;
|
|
69094
|
-
let
|
|
69104
|
+
let result2;
|
|
69095
69105
|
try {
|
|
69096
|
-
|
|
69106
|
+
result2 = await discover({
|
|
69097
69107
|
backend: selected.backend,
|
|
69098
69108
|
recentSessionFilesTopK,
|
|
69099
69109
|
recentProjectsTopK,
|
|
69100
69110
|
...command ? { command } : {}
|
|
69101
69111
|
});
|
|
69102
69112
|
} catch {
|
|
69103
|
-
|
|
69113
|
+
result2 = {
|
|
69104
69114
|
ok: false,
|
|
69105
69115
|
error: {
|
|
69106
69116
|
category: "runtime_unavailable",
|
|
@@ -69110,7 +69120,7 @@ function createRecentContextPromptAppender(discover, recentSessionFilesTopK = 20
|
|
|
69110
69120
|
}
|
|
69111
69121
|
};
|
|
69112
69122
|
}
|
|
69113
|
-
return appendRecentContextToPrompt(prompt,
|
|
69123
|
+
return appendRecentContextToPrompt(prompt, result2);
|
|
69114
69124
|
};
|
|
69115
69125
|
}
|
|
69116
69126
|
|
|
@@ -69777,10 +69787,10 @@ async function createDaemon(opts) {
|
|
|
69777
69787
|
return Promise.resolve([]);
|
|
69778
69788
|
return trackTelemetry((async () => {
|
|
69779
69789
|
const results = await Promise.allSettled(manager.liveAgentActivities().map((info) => activityPayload(info)));
|
|
69780
|
-
const failed = results.find((
|
|
69790
|
+
const failed = results.find((result2) => result2.status === "rejected");
|
|
69781
69791
|
if (failed)
|
|
69782
69792
|
throw failed.reason;
|
|
69783
|
-
const activities = results.map((
|
|
69793
|
+
const activities = results.map((result2) => result2.value);
|
|
69784
69794
|
return stopping ? [] : activities.filter((activity) => manager.agentActivity(activity.agentId) === activity.state);
|
|
69785
69795
|
})());
|
|
69786
69796
|
},
|
|
@@ -70896,8 +70906,8 @@ function createDiagnosticReportCoordinator(args) {
|
|
|
70896
70906
|
for (let attempt = 0;attempt < args.retry.maxAttemptsPerRound; attempt += 1) {
|
|
70897
70907
|
if (stopped)
|
|
70898
70908
|
throw new CoordinatorError("coordinator_shutdown");
|
|
70899
|
-
const
|
|
70900
|
-
if (
|
|
70909
|
+
const result2 = await args.transport.fail(reportId, failureCode);
|
|
70910
|
+
if (result2.kind === "terminal") {
|
|
70901
70911
|
if (options.cleanupArtifacts)
|
|
70902
70912
|
cleanup(reportId);
|
|
70903
70913
|
return { status: "failed", failureCode };
|
|
@@ -70931,11 +70941,11 @@ function createDiagnosticReportCoordinator(args) {
|
|
|
70931
70941
|
if (stopped)
|
|
70932
70942
|
throw new CoordinatorError("coordinator_shutdown");
|
|
70933
70943
|
checkpoint("before_upload");
|
|
70934
|
-
const
|
|
70944
|
+
const result2 = await args.transport.upload({ reportId: sidecar.reportId, sizeBytes: sidecar.sizeBytes, sha256: sidecar.sha256 }, createReadStream3(archivePath(sidecar.reportId)));
|
|
70935
70945
|
checkpoint("after_upload");
|
|
70936
|
-
if (
|
|
70946
|
+
if (result2.kind === "terminal") {
|
|
70937
70947
|
cleanup(sidecar.reportId);
|
|
70938
|
-
return { status:
|
|
70948
|
+
return { status: result2.status };
|
|
70939
70949
|
}
|
|
70940
70950
|
if (attempt + 1 < args.retry.maxAttemptsPerRound) {
|
|
70941
70951
|
const delay4 = Math.min(args.retry.maxDelayMs, args.retry.baseDelayMs * 2 ** attempt);
|
|
@@ -71335,15 +71345,15 @@ function readTestPackageMap(baseDir, machineId) {
|
|
|
71335
71345
|
const parsed = JSON.parse(fs10.readFileSync(filePath, "utf8"));
|
|
71336
71346
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
71337
71347
|
throw new Error("invalid daemon update package map");
|
|
71338
|
-
const
|
|
71348
|
+
const result2 = {};
|
|
71339
71349
|
for (const [key, value] of Object.entries(parsed)) {
|
|
71340
71350
|
if (key !== "latest" && !parseReleaseVersion(key))
|
|
71341
71351
|
throw new Error("invalid daemon update package map key");
|
|
71342
71352
|
if (typeof value !== "string" || !path16.isAbsolute(value))
|
|
71343
71353
|
throw new Error("invalid daemon update package map value");
|
|
71344
|
-
|
|
71354
|
+
result2[key] = value;
|
|
71345
71355
|
}
|
|
71346
|
-
return
|
|
71356
|
+
return result2;
|
|
71347
71357
|
}
|
|
71348
71358
|
function packageSpec(baseDir, machineId, version3) {
|
|
71349
71359
|
const mapped = readTestPackageMap(baseDir, machineId)?.[version3];
|
|
@@ -73277,8 +73287,8 @@ async function cmdMessagePropertySet(opts) {
|
|
|
73277
73287
|
throw new CliError("message property set: --target <ref> is required");
|
|
73278
73288
|
const request = parseMessageTarget("message property set", target2);
|
|
73279
73289
|
const property = parseMessagePropertyJson("message property set", opts.json);
|
|
73280
|
-
const
|
|
73281
|
-
return { target: target2, ...
|
|
73290
|
+
const result2 = await withTransientMutationRetry(() => api2.messagePropertySet({ ...request, property }));
|
|
73291
|
+
return { target: target2, ...result2 };
|
|
73282
73292
|
}
|
|
73283
73293
|
async function cmdMessagePropertyList(opts) {
|
|
73284
73294
|
const api2 = getApi();
|
|
@@ -73286,8 +73296,8 @@ async function cmdMessagePropertyList(opts) {
|
|
|
73286
73296
|
if (!target2)
|
|
73287
73297
|
throw new CliError("message property list: --target <ref> is required");
|
|
73288
73298
|
const request = parseMessageTarget("message property list", target2);
|
|
73289
|
-
const
|
|
73290
|
-
return { target: target2, ...
|
|
73299
|
+
const result2 = await api2.messagePropertyList(request);
|
|
73300
|
+
return { target: target2, ...result2 };
|
|
73291
73301
|
}
|
|
73292
73302
|
async function cmdMessagePropertyRemove(opts) {
|
|
73293
73303
|
const api2 = getApi();
|
|
@@ -73296,8 +73306,8 @@ async function cmdMessagePropertyRemove(opts) {
|
|
|
73296
73306
|
throw new CliError("message property remove: --target <ref> is required");
|
|
73297
73307
|
const request = parseMessageTarget("message property remove", target2);
|
|
73298
73308
|
const property = parseMessagePropertyJson("message property remove", opts.json);
|
|
73299
|
-
const
|
|
73300
|
-
return { target: target2, ...
|
|
73309
|
+
const result2 = await withTransientMutationRetry(() => api2.messagePropertyRemove({ ...request, property }));
|
|
73310
|
+
return { target: target2, ...result2 };
|
|
73301
73311
|
}
|
|
73302
73312
|
function parseMessageTarget(command, target2) {
|
|
73303
73313
|
let parsed;
|
|
@@ -73358,7 +73368,7 @@ async function cmdAttachmentUpload(opts) {
|
|
|
73358
73368
|
throw new CliError(`message attachment upload: ${error62.message}`);
|
|
73359
73369
|
}
|
|
73360
73370
|
}
|
|
73361
|
-
const
|
|
73371
|
+
const result2 = await api2.attachmentUpload({
|
|
73362
73372
|
agentId: agent2,
|
|
73363
73373
|
...target2 !== undefined ? { target: target2 } : {},
|
|
73364
73374
|
file: { data: new Uint8Array(bytes), filename, contentType },
|
|
@@ -73366,7 +73376,7 @@ async function cmdAttachmentUpload(opts) {
|
|
|
73366
73376
|
...width !== undefined ? { width } : {},
|
|
73367
73377
|
...height !== undefined ? { height } : {}
|
|
73368
73378
|
});
|
|
73369
|
-
return
|
|
73379
|
+
return result2;
|
|
73370
73380
|
}
|
|
73371
73381
|
async function cmdAttachmentDownload(opts) {
|
|
73372
73382
|
const api2 = getApi();
|
|
@@ -73378,22 +73388,22 @@ async function cmdAttachmentDownload(opts) {
|
|
|
73378
73388
|
const os4 = await import("os");
|
|
73379
73389
|
const pathMod = await import("path");
|
|
73380
73390
|
const destPath = outFlag ?? pathMod.join(os4.tmpdir(), "alook-attachments", agent2, id3, "file");
|
|
73381
|
-
const
|
|
73391
|
+
const result2 = await api2.attachmentDownload({ agentId: agent2, id: id3, destPath });
|
|
73382
73392
|
if (!outFlag) {
|
|
73383
73393
|
const fs13 = await import("fs/promises");
|
|
73384
73394
|
const destDir = pathMod.dirname(destPath);
|
|
73385
|
-
const safeName = pathMod.basename(
|
|
73395
|
+
const safeName = pathMod.basename(result2.filename) || "file";
|
|
73386
73396
|
const renamed = pathMod.join(destDir, safeName);
|
|
73387
73397
|
if (renamed !== destPath) {
|
|
73388
73398
|
try {
|
|
73389
73399
|
await fs13.rename(destPath, renamed);
|
|
73390
|
-
return { ...
|
|
73400
|
+
return { ...result2, path: renamed };
|
|
73391
73401
|
} catch {
|
|
73392
|
-
return { ...
|
|
73402
|
+
return { ...result2, path: destPath };
|
|
73393
73403
|
}
|
|
73394
73404
|
}
|
|
73395
73405
|
}
|
|
73396
|
-
return
|
|
73406
|
+
return result2;
|
|
73397
73407
|
}
|
|
73398
73408
|
async function cmdSettingProfile(opts) {
|
|
73399
73409
|
const bio = opts.setBio;
|
|
@@ -73460,9 +73470,9 @@ async function cmdInboxPull(opts) {
|
|
|
73460
73470
|
};
|
|
73461
73471
|
} else {
|
|
73462
73472
|
try {
|
|
73463
|
-
const
|
|
73464
|
-
acked =
|
|
73465
|
-
failed =
|
|
73473
|
+
const result2 = await api2.ack({ agentId: agent2, cursors: [...latest.values()] });
|
|
73474
|
+
acked = result2.applied.length;
|
|
73475
|
+
failed = result2.failed;
|
|
73466
73476
|
} catch (err) {
|
|
73467
73477
|
ackError = err instanceof Error ? err.message : String(err);
|
|
73468
73478
|
}
|
|
@@ -73622,128 +73632,128 @@ function buildProgram(stdin) {
|
|
|
73622
73632
|
message2.command("send").description("send a message to a channel, DM, or thread").option("--target <ref>", "destination (path-style ref, e.g. /demo-workspace#1234/general)").requiredOption("--stdin", "read the required UTF-8 message body from non-TTY stdin (max 1 KiB)").option("-a, --attachment <id>", "attach an uploaded file by id (repeatable — order = message order)", (v, prev = []) => [...prev, v], []).option("--force", "bypass duplicate detection only; channel alignment and other send checks still apply").option("--reply <seq>", 'reply to a message by its seq in --target (e.g. "#37" or 37)').requiredOption("--remind-after <0|Nm|Nh>", "required idle follow-up: 0 disables; 1m..24h arms/resets one same-scope timer; a newer message or daemon restart cancels it").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function() {
|
|
73623
73633
|
const localOpts = this.opts();
|
|
73624
73634
|
const globalOpts = program.opts();
|
|
73625
|
-
const
|
|
73626
|
-
printEnvelope({ success:
|
|
73635
|
+
const result2 = await cmdMessageSend({ ...globalOpts, ...localOpts }, stdin);
|
|
73636
|
+
printEnvelope({ success: result2 });
|
|
73627
73637
|
});
|
|
73628
73638
|
const property = message2.command("property").description("message property operations").exitOverride();
|
|
73629
73639
|
property.configureOutput({ writeOut: () => {}, writeErr: () => {} });
|
|
73630
73640
|
property.command("set").description("add a supported property value to a message").requiredOption("--target <ref>", "full message ref").requiredOption("--json <json>", "property JSON").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function() {
|
|
73631
|
-
const
|
|
73632
|
-
printEnvelope({ success:
|
|
73641
|
+
const result2 = await cmdMessagePropertySet({ ...program.opts(), ...this.opts() });
|
|
73642
|
+
printEnvelope({ success: result2 });
|
|
73633
73643
|
});
|
|
73634
73644
|
property.command("list").description("list current properties and supported capabilities").requiredOption("--target <ref>", "full message ref").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function() {
|
|
73635
|
-
const
|
|
73636
|
-
printEnvelope({ success:
|
|
73645
|
+
const result2 = await cmdMessagePropertyList({ ...program.opts(), ...this.opts() });
|
|
73646
|
+
printEnvelope({ success: result2 });
|
|
73637
73647
|
});
|
|
73638
73648
|
property.command("remove").description("remove a supported property value from a message").requiredOption("--target <ref>", "full message ref").requiredOption("--json <json>", "property JSON").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function() {
|
|
73639
|
-
const
|
|
73640
|
-
printEnvelope({ success:
|
|
73649
|
+
const result2 = await cmdMessagePropertyRemove({ ...program.opts(), ...this.opts() });
|
|
73650
|
+
printEnvelope({ success: result2 });
|
|
73641
73651
|
});
|
|
73642
73652
|
const mark = message2.command("mark").description("global durable-mark queries").exitOverride();
|
|
73643
73653
|
mark.configureOutput({ writeOut: () => {}, writeErr: () => {} });
|
|
73644
73654
|
mark.command("list").description("list all currently visible marked messages").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function() {
|
|
73645
|
-
const
|
|
73646
|
-
printEnvelope({ success:
|
|
73655
|
+
const result2 = await cmdMessageMarkList({ ...program.opts(), ...this.opts() });
|
|
73656
|
+
printEnvelope({ success: result2 });
|
|
73647
73657
|
});
|
|
73648
73658
|
const attachment = message2.command("attachment").description("attachment operations").exitOverride();
|
|
73649
73659
|
attachment.configureOutput({ writeOut: () => {}, writeErr: () => {} });
|
|
73650
73660
|
attachment.command("upload").description("upload a local file and get its reusable attachment id").option("--target <ref>", "optional legacy target (channel, DM, or thread ref)").option("--file <path>", "local file to upload").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function() {
|
|
73651
73661
|
const localOpts = this.opts();
|
|
73652
73662
|
const globalOpts = program.opts();
|
|
73653
|
-
const
|
|
73654
|
-
printEnvelope({ success:
|
|
73663
|
+
const result2 = await cmdAttachmentUpload({ ...globalOpts, ...localOpts });
|
|
73664
|
+
printEnvelope({ success: result2 });
|
|
73655
73665
|
});
|
|
73656
73666
|
attachment.command("download").description("download an attachment by id to disk").option("--id <id>", "attachment id (from inbox pull / send response)").option("--out <path>", "explicit output path (default: /tmp/alook-attachments/<agent>/<id>/<filename>)").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function() {
|
|
73657
73667
|
const localOpts = this.opts();
|
|
73658
73668
|
const globalOpts = program.opts();
|
|
73659
|
-
const
|
|
73660
|
-
printEnvelope({ success:
|
|
73669
|
+
const result2 = await cmdAttachmentDownload({ ...globalOpts, ...localOpts });
|
|
73670
|
+
printEnvelope({ success: result2 });
|
|
73661
73671
|
});
|
|
73662
73672
|
const inbox = program.command("inbox").description("inbox operations").exitOverride();
|
|
73663
73673
|
inbox.configureOutput({ writeOut: () => {}, writeErr: () => {} });
|
|
73664
73674
|
inbox.command("pull").description("fetch unread messages from all channels").option("--max <n>", "max messages to return").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function() {
|
|
73665
73675
|
const localOpts = this.opts();
|
|
73666
73676
|
const globalOpts = program.opts();
|
|
73667
|
-
const
|
|
73668
|
-
printEnvelope({ success:
|
|
73677
|
+
const result2 = await cmdInboxPull({ ...globalOpts, ...localOpts });
|
|
73678
|
+
printEnvelope({ success: result2 });
|
|
73669
73679
|
});
|
|
73670
73680
|
const server = program.command("server").description("server operations").exitOverride();
|
|
73671
73681
|
server.configureOutput({ writeOut: () => {}, writeErr: () => {} });
|
|
73672
73682
|
server.command("list").description("list servers this agent is a member of").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function() {
|
|
73673
73683
|
const localOpts = this.opts();
|
|
73674
73684
|
const globalOpts = program.opts();
|
|
73675
|
-
const
|
|
73676
|
-
printEnvelope({ success:
|
|
73685
|
+
const result2 = await cmdServerList({ ...globalOpts, ...localOpts });
|
|
73686
|
+
printEnvelope({ success: result2 });
|
|
73677
73687
|
});
|
|
73678
73688
|
server.command("member").description("list members of a server (paginated; each member carries online + status)").option("--server <handle>", "server name#discriminator handle (from `server list`)").option("--limit <n>", "max members per page").option("--cursor <cursor>", "opaque cursor from a prior page's response (omit for the first page)").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function() {
|
|
73679
73689
|
const localOpts = this.opts();
|
|
73680
73690
|
const globalOpts = program.opts();
|
|
73681
|
-
const
|
|
73682
|
-
printEnvelope({ success:
|
|
73691
|
+
const result2 = await cmdServerMember({ ...globalOpts, ...localOpts });
|
|
73692
|
+
printEnvelope({ success: result2 });
|
|
73683
73693
|
});
|
|
73684
73694
|
server.command("join").description("join a server via an invite link or token").option("--invite <link>", "invite URL or bare token").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function() {
|
|
73685
73695
|
const localOpts = this.opts();
|
|
73686
73696
|
const globalOpts = program.opts();
|
|
73687
|
-
const
|
|
73688
|
-
printEnvelope({ success:
|
|
73697
|
+
const result2 = await cmdServerJoin({ ...globalOpts, ...localOpts });
|
|
73698
|
+
printEnvelope({ success: result2 });
|
|
73689
73699
|
});
|
|
73690
73700
|
server.command("leave").description("leave a server you belong to").option("--server <handle>", "server name#NNNN handle (from `server list`)").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function() {
|
|
73691
73701
|
const localOpts = this.opts();
|
|
73692
73702
|
const globalOpts = program.opts();
|
|
73693
|
-
const
|
|
73694
|
-
printEnvelope({ success:
|
|
73703
|
+
const result2 = await cmdServerLeave({ ...globalOpts, ...localOpts });
|
|
73704
|
+
printEnvelope({ success: result2 });
|
|
73695
73705
|
});
|
|
73696
73706
|
const channel2 = program.command("channel").description("channel operations").exitOverride();
|
|
73697
73707
|
channel2.configureOutput({ writeOut: () => {}, writeErr: () => {} });
|
|
73698
73708
|
channel2.command("list").description("list top-level channels visible to this agent in one server").option("--server <handle>", "server name#discriminator handle (from `server list`)").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function() {
|
|
73699
73709
|
const localOpts = this.opts();
|
|
73700
73710
|
const globalOpts = program.opts();
|
|
73701
|
-
const
|
|
73702
|
-
printEnvelope({ success:
|
|
73711
|
+
const result2 = await cmdChannelList({ ...globalOpts, ...localOpts });
|
|
73712
|
+
printEnvelope({ success: result2 });
|
|
73703
73713
|
});
|
|
73704
73714
|
channel2.command("history").description("fetch a page of messages from a channel, thread, or DM").option("--channel <ref>", "channel/thread/DM ref (path-style)").option("--before <seq>", "messages before this seq").option("--after <seq>", "messages after this seq").option("--around <seq>", "messages around this seq").option("--limit <n>", "max messages to return").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function() {
|
|
73705
73715
|
const localOpts = this.opts();
|
|
73706
73716
|
const globalOpts = program.opts();
|
|
73707
|
-
const
|
|
73708
|
-
printEnvelope({ success:
|
|
73717
|
+
const result2 = await cmdChannelHistory({ ...globalOpts, ...localOpts });
|
|
73718
|
+
printEnvelope({ success: result2 });
|
|
73709
73719
|
});
|
|
73710
73720
|
channel2.command("member").description("fetch the followed members of a channel or thread; public channels return a hint pointing at `alook server member`").option("--channel <ref>", "channel/thread ref (path-style)").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function() {
|
|
73711
73721
|
const localOpts = this.opts();
|
|
73712
73722
|
const globalOpts = program.opts();
|
|
73713
|
-
const
|
|
73714
|
-
printEnvelope({ success:
|
|
73723
|
+
const result2 = await cmdChannelMember({ ...globalOpts, ...localOpts });
|
|
73724
|
+
printEnvelope({ success: result2 });
|
|
73715
73725
|
});
|
|
73716
73726
|
channel2.command("leave").description("leave a thread or private channel/forum").option("--channel <ref>", "channel/thread ref (path-style)").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function() {
|
|
73717
73727
|
const localOpts = this.opts();
|
|
73718
73728
|
const globalOpts = program.opts();
|
|
73719
|
-
const
|
|
73720
|
-
printEnvelope({ success:
|
|
73729
|
+
const result2 = await cmdChannelLeave({ ...globalOpts, ...localOpts });
|
|
73730
|
+
printEnvelope({ success: result2 });
|
|
73721
73731
|
});
|
|
73722
73732
|
const friend = program.command("friend").description("friend operations").exitOverride();
|
|
73723
73733
|
friend.configureOutput({ writeOut: () => {}, writeErr: () => {} });
|
|
73724
73734
|
friend.command("request").description("send a friend request to a user by handle (owner-approval required)").option("--username <name#0042>", "the target's global handle, e.g. Alice#0042").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function() {
|
|
73725
73735
|
const localOpts = this.opts();
|
|
73726
73736
|
const globalOpts = program.opts();
|
|
73727
|
-
const
|
|
73728
|
-
printEnvelope({ success:
|
|
73737
|
+
const result2 = await cmdFriendRequest({ ...globalOpts, ...localOpts });
|
|
73738
|
+
printEnvelope({ success: result2 });
|
|
73729
73739
|
});
|
|
73730
73740
|
friend.command("list").description("list your friends and pending requests (accepted, pendingOutgoing, pendingIncoming)").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function() {
|
|
73731
73741
|
const localOpts = this.opts();
|
|
73732
73742
|
const globalOpts = program.opts();
|
|
73733
|
-
const
|
|
73734
|
-
printEnvelope({ success:
|
|
73743
|
+
const result2 = await cmdFriendList({ ...globalOpts, ...localOpts });
|
|
73744
|
+
printEnvelope({ success: result2 });
|
|
73735
73745
|
});
|
|
73736
73746
|
const setting = program.command("setting").description("account settings").exitOverride();
|
|
73737
73747
|
setting.configureOutput({ writeOut: () => {}, writeErr: () => {} });
|
|
73738
73748
|
setting.command("profile").description("update your public bio and/or avatar").option("--set-bio <text>", "set public bio; pass an empty string to clear it").option("--set-avatar <path>", "upload a png, jpeg, webp, or gif avatar").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function() {
|
|
73739
|
-
const
|
|
73740
|
-
printEnvelope({ success:
|
|
73749
|
+
const result2 = await cmdSettingProfile({ ...program.opts(), ...this.opts() });
|
|
73750
|
+
printEnvelope({ success: result2 });
|
|
73741
73751
|
});
|
|
73742
73752
|
program.command("nap").description("reset your session; optionally wake a fresh session with a handoff (read the nap rule first)").option("--handoff <file>", "path to your handoff note (your note to your reborn self)").exitOverride().configureOutput({ writeOut: () => {}, writeErr: () => {} }).action(async function() {
|
|
73743
73753
|
const localOpts = this.opts();
|
|
73744
73754
|
const globalOpts = program.opts();
|
|
73745
|
-
const
|
|
73746
|
-
printEnvelope({ success:
|
|
73755
|
+
const result2 = await cmdNap({ ...globalOpts, ...localOpts });
|
|
73756
|
+
printEnvelope({ success: result2 });
|
|
73747
73757
|
});
|
|
73748
73758
|
const daemon = program.command("daemon").description("daemon operations").exitOverride();
|
|
73749
73759
|
daemon.configureOutput({ writeOut: () => {}, writeErr: () => {} });
|