@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/index.js
CHANGED
|
@@ -11727,7 +11727,7 @@ var require_JSXTransformer = __commonJS((exports) => {
|
|
|
11727
11727
|
}
|
|
11728
11728
|
exports.startsWithLowerCase = startsWithLowerCase;
|
|
11729
11729
|
function formatJSXTextLiteral(text3) {
|
|
11730
|
-
let
|
|
11730
|
+
let result2 = "";
|
|
11731
11731
|
let whitespace = "";
|
|
11732
11732
|
let isInInitialLineWhitespace = false;
|
|
11733
11733
|
let seenNonWhitespace = false;
|
|
@@ -11743,25 +11743,25 @@ var require_JSXTransformer = __commonJS((exports) => {
|
|
|
11743
11743
|
isInInitialLineWhitespace = true;
|
|
11744
11744
|
} else {
|
|
11745
11745
|
if (seenNonWhitespace && isInInitialLineWhitespace) {
|
|
11746
|
-
|
|
11746
|
+
result2 += " ";
|
|
11747
11747
|
}
|
|
11748
|
-
|
|
11748
|
+
result2 += whitespace;
|
|
11749
11749
|
whitespace = "";
|
|
11750
11750
|
if (c === "&") {
|
|
11751
11751
|
const { entity, newI } = processEntity(text3, i + 1);
|
|
11752
11752
|
i = newI - 1;
|
|
11753
|
-
|
|
11753
|
+
result2 += entity;
|
|
11754
11754
|
} else {
|
|
11755
|
-
|
|
11755
|
+
result2 += c;
|
|
11756
11756
|
}
|
|
11757
11757
|
seenNonWhitespace = true;
|
|
11758
11758
|
isInInitialLineWhitespace = false;
|
|
11759
11759
|
}
|
|
11760
11760
|
}
|
|
11761
11761
|
if (!isInInitialLineWhitespace) {
|
|
11762
|
-
|
|
11762
|
+
result2 += whitespace;
|
|
11763
11763
|
}
|
|
11764
|
-
return JSON.stringify(
|
|
11764
|
+
return JSON.stringify(result2);
|
|
11765
11765
|
}
|
|
11766
11766
|
function formatJSXTextReplacement(text3) {
|
|
11767
11767
|
let numNewlines = 0;
|
|
@@ -11779,29 +11779,29 @@ var require_JSXTransformer = __commonJS((exports) => {
|
|
|
11779
11779
|
`.repeat(numNewlines) + " ".repeat(numSpaces);
|
|
11780
11780
|
}
|
|
11781
11781
|
function formatJSXStringValueLiteral(text3) {
|
|
11782
|
-
let
|
|
11782
|
+
let result2 = "";
|
|
11783
11783
|
for (let i = 0;i < text3.length; i++) {
|
|
11784
11784
|
const c = text3[i];
|
|
11785
11785
|
if (c === `
|
|
11786
11786
|
`) {
|
|
11787
11787
|
if (/\s/.test(text3[i + 1])) {
|
|
11788
|
-
|
|
11788
|
+
result2 += " ";
|
|
11789
11789
|
while (i < text3.length && /\s/.test(text3[i + 1])) {
|
|
11790
11790
|
i++;
|
|
11791
11791
|
}
|
|
11792
11792
|
} else {
|
|
11793
|
-
|
|
11793
|
+
result2 += `
|
|
11794
11794
|
`;
|
|
11795
11795
|
}
|
|
11796
11796
|
} else if (c === "&") {
|
|
11797
11797
|
const { entity, newI } = processEntity(text3, i + 1);
|
|
11798
|
-
|
|
11798
|
+
result2 += entity;
|
|
11799
11799
|
i = newI - 1;
|
|
11800
11800
|
} else {
|
|
11801
|
-
|
|
11801
|
+
result2 += c;
|
|
11802
11802
|
}
|
|
11803
11803
|
}
|
|
11804
|
-
return JSON.stringify(
|
|
11804
|
+
return JSON.stringify(result2);
|
|
11805
11805
|
}
|
|
11806
11806
|
function processEntity(text3, indexAfterAmpersand) {
|
|
11807
11807
|
let str = "";
|
|
@@ -12047,9 +12047,9 @@ var require_CJSImportProcessor = __commonJS((exports) => {
|
|
|
12047
12047
|
index2++;
|
|
12048
12048
|
}
|
|
12049
12049
|
if (this.tokens.matches1AtIndex(index2, _types.TokenType.braceL)) {
|
|
12050
|
-
const
|
|
12051
|
-
index2 =
|
|
12052
|
-
for (const namedImport of
|
|
12050
|
+
const result2 = this.getNamedImports(index2 + 1);
|
|
12051
|
+
index2 = result2.newIndex;
|
|
12052
|
+
for (const namedImport of result2.namedImports) {
|
|
12053
12053
|
if (namedImport.importedName === "default") {
|
|
12054
12054
|
defaultNames.push(namedImport.localName);
|
|
12055
12055
|
} else {
|
|
@@ -12203,9 +12203,9 @@ var require_CJSImportProcessor = __commonJS((exports) => {
|
|
|
12203
12203
|
this.exportBindingsByLocalName.get(localName).push(exportedName);
|
|
12204
12204
|
}
|
|
12205
12205
|
claimImportCode(importPath) {
|
|
12206
|
-
const
|
|
12206
|
+
const result2 = this.importsToReplace.get(importPath);
|
|
12207
12207
|
this.importsToReplace.set(importPath, "");
|
|
12208
|
-
return
|
|
12208
|
+
return result2 || "";
|
|
12209
12209
|
}
|
|
12210
12210
|
getIdentifierReplacement(identifierName) {
|
|
12211
12211
|
return this.identifierReplacements.get(identifierName) || null;
|
|
@@ -13404,12 +13404,12 @@ var require_trace_mapping_umd = __commonJS((exports, module) => {
|
|
|
13404
13404
|
if (!found)
|
|
13405
13405
|
min = lowerBound(segments, matchedColumn, min);
|
|
13406
13406
|
const max = upperBound(segments, matchedColumn, min);
|
|
13407
|
-
const
|
|
13407
|
+
const result2 = [];
|
|
13408
13408
|
for (;min <= max; min++) {
|
|
13409
13409
|
const segment = segments[min];
|
|
13410
|
-
|
|
13410
|
+
result2.push(GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]));
|
|
13411
13411
|
}
|
|
13412
|
-
return
|
|
13412
|
+
return result2;
|
|
13413
13413
|
}
|
|
13414
13414
|
function generatedPosition(map2, source, line, column, bias, all) {
|
|
13415
13415
|
var _a3, _b;
|
|
@@ -14654,10 +14654,10 @@ var require_types2 = __commonJS((exports) => {
|
|
|
14654
14654
|
exports.func = func;
|
|
14655
14655
|
var TFunc = function(_super) {
|
|
14656
14656
|
__extends(TFunc2, _super);
|
|
14657
|
-
function TFunc2(paramList,
|
|
14657
|
+
function TFunc2(paramList, result2) {
|
|
14658
14658
|
var _this = _super.call(this) || this;
|
|
14659
14659
|
_this.paramList = paramList;
|
|
14660
|
-
_this.result =
|
|
14660
|
+
_this.result = result2;
|
|
14661
14661
|
return _this;
|
|
14662
14662
|
}
|
|
14663
14663
|
TFunc2.prototype.getChecker = function(suite, strict) {
|
|
@@ -19393,11 +19393,11 @@ var require_parser = __commonJS((exports) => {
|
|
|
19393
19393
|
throw new Error("Cannot combine flow and typescript plugins.");
|
|
19394
19394
|
}
|
|
19395
19395
|
_base.initParser.call(undefined, input2, isJSXEnabled, isTypeScriptEnabled, isFlowEnabled);
|
|
19396
|
-
const
|
|
19396
|
+
const result2 = _index.parseFile.call(undefined);
|
|
19397
19397
|
if (_base.state.error) {
|
|
19398
19398
|
throw _base.augmentError.call(undefined, _base.state.error);
|
|
19399
19399
|
}
|
|
19400
|
-
return
|
|
19400
|
+
return result2;
|
|
19401
19401
|
}
|
|
19402
19402
|
exports.parse = parse6;
|
|
19403
19403
|
});
|
|
@@ -19471,9 +19471,9 @@ var require_TokenProcessor = __commonJS((exports) => {
|
|
|
19471
19471
|
this.tokenIndex = snapshot.tokenIndex;
|
|
19472
19472
|
}
|
|
19473
19473
|
dangerouslyGetAndRemoveCodeSinceSnapshot(snapshot) {
|
|
19474
|
-
const
|
|
19474
|
+
const result2 = this.resultCode.slice(snapshot.resultCode.length);
|
|
19475
19475
|
this.resultCode = snapshot.resultCode;
|
|
19476
|
-
return
|
|
19476
|
+
return result2;
|
|
19477
19477
|
}
|
|
19478
19478
|
reset() {
|
|
19479
19479
|
this.resultCode = "";
|
|
@@ -21818,8 +21818,8 @@ var require_RootTransformer = __commonJS((exports) => {
|
|
|
21818
21818
|
for (const transformer of this.transformers) {
|
|
21819
21819
|
suffix += transformer.getSuffixCode();
|
|
21820
21820
|
}
|
|
21821
|
-
const
|
|
21822
|
-
let { code } =
|
|
21821
|
+
const result2 = this.tokens.finish();
|
|
21822
|
+
let { code } = result2;
|
|
21823
21823
|
if (code.startsWith("#!")) {
|
|
21824
21824
|
let newlineIndex = code.indexOf(`
|
|
21825
21825
|
`);
|
|
@@ -21830,12 +21830,12 @@ var require_RootTransformer = __commonJS((exports) => {
|
|
|
21830
21830
|
}
|
|
21831
21831
|
return {
|
|
21832
21832
|
code: code.slice(0, newlineIndex + 1) + prefix + code.slice(newlineIndex + 1) + suffix,
|
|
21833
|
-
mappings: this.shiftMappings(
|
|
21833
|
+
mappings: this.shiftMappings(result2.mappings, prefix.length)
|
|
21834
21834
|
};
|
|
21835
21835
|
} else {
|
|
21836
21836
|
return {
|
|
21837
21837
|
code: prefix + code + suffix,
|
|
21838
|
-
mappings: this.shiftMappings(
|
|
21838
|
+
mappings: this.shiftMappings(result2.mappings, prefix.length)
|
|
21839
21839
|
};
|
|
21840
21840
|
}
|
|
21841
21841
|
}
|
|
@@ -22278,17 +22278,17 @@ var require_dist2 = __commonJS((exports) => {
|
|
|
22278
22278
|
const sucraseContext = getSucraseContext(code, options);
|
|
22279
22279
|
const transformer = new (0, _RootTransformer2.default)(sucraseContext, options.transforms, Boolean(options.enableLegacyBabel5ModuleInterop), options);
|
|
22280
22280
|
const transformerResult = transformer.transform();
|
|
22281
|
-
let
|
|
22281
|
+
let result2 = { code: transformerResult.code };
|
|
22282
22282
|
if (options.sourceMapOptions) {
|
|
22283
22283
|
if (!options.filePath) {
|
|
22284
22284
|
throw new Error("filePath must be specified when generating a source map.");
|
|
22285
22285
|
}
|
|
22286
|
-
|
|
22287
|
-
...
|
|
22286
|
+
result2 = {
|
|
22287
|
+
...result2,
|
|
22288
22288
|
sourceMap: _computeSourceMap2.default.call(undefined, transformerResult, options.filePath, options.sourceMapOptions, code, sucraseContext.tokenProcessor.tokens)
|
|
22289
22289
|
};
|
|
22290
22290
|
}
|
|
22291
|
-
return
|
|
22291
|
+
return result2;
|
|
22292
22292
|
} catch (e) {
|
|
22293
22293
|
if (options.filePath) {
|
|
22294
22294
|
e.message = `Error transforming ${options.filePath}: ${e.message}`;
|
|
@@ -57558,7 +57558,7 @@ var CommunityResourceProfileSchema = exports_external.strictObject({
|
|
|
57558
57558
|
statusText: exports_external.string().nullable().optional()
|
|
57559
57559
|
});
|
|
57560
57560
|
// ../shared/src/business-schema-version.ts
|
|
57561
|
-
var BUSINESS_SCHEMA_VERSION =
|
|
57561
|
+
var BUSINESS_SCHEMA_VERSION = 8;
|
|
57562
57562
|
|
|
57563
57563
|
// ../shared/src/community-contract.ts
|
|
57564
57564
|
var COMMUNITY_RESOURCE_CONTRACT_VERSION = BUSINESS_SCHEMA_VERSION;
|
|
@@ -59836,6 +59836,7 @@ var serverMembershipSchema = CommunityServerMembershipResourceSchema.extend({
|
|
|
59836
59836
|
viewer: exports_external.boolean()
|
|
59837
59837
|
});
|
|
59838
59838
|
var channelMembershipSchema = CommunityChannelMembershipResourceSchema.extend({ id: exports_external.string().min(1) });
|
|
59839
|
+
var profileSchema = CommunityResourceProfileSchema.extend({ presence: exports_external.enum(["online", "offline"]).optional() });
|
|
59839
59840
|
var readStateSchema = CommunityReadStateResourceSchema.extend({ observedRevision: exports_external.number().int().nonnegative().optional() });
|
|
59840
59841
|
var friendshipSchema = exports_external.strictObject({
|
|
59841
59842
|
id: exports_external.string().min(1),
|
|
@@ -60610,6 +60611,15 @@ var TaskMemberInstructionCacheSchema = exports_external.strictObject({
|
|
|
60610
60611
|
globalInstruction: exports_external.string()
|
|
60611
60612
|
}).nullable();
|
|
60612
60613
|
var TaskUserIdentityCacheSchema = CommunityResourceProfileSchema.pick({ id: true, name: true }).extend({ email: exports_external.string() }).nullable();
|
|
60614
|
+
// ../shared/src/community-presence.ts
|
|
60615
|
+
var result = exports_external.strictObject({ online: exports_external.array(exports_external.string().min(1)), offline: exports_external.array(exports_external.string().min(1)) });
|
|
60616
|
+
var disjoint = (value) => !value.offline.some((id3) => value.online.includes(id3));
|
|
60617
|
+
var CommunityPresenceResultSchema = result.refine(disjoint, "Conflicting user presence");
|
|
60618
|
+
var CommunityPresenceReadSchema = result.extend({
|
|
60619
|
+
truncated: exports_external.boolean().optional(),
|
|
60620
|
+
limit: exports_external.number().int().positive().optional(),
|
|
60621
|
+
stale: exports_external.literal(true).optional()
|
|
60622
|
+
}).refine(disjoint, "Conflicting user presence");
|
|
60613
60623
|
// ../shared/src/community-forum-sidebar.ts
|
|
60614
60624
|
var timestamp = exports_external.string().refine((value) => Number.isFinite(Date.parse(value)));
|
|
60615
60625
|
var CommunityForumSidebarChannelSummarySchema = CommunityChannelResourceSchema.pick({
|
|
@@ -61657,10 +61667,10 @@ class AgentProcessManager {
|
|
|
61657
61667
|
return desiredRevision === appliedRevision ? "idempotent" : "stale";
|
|
61658
61668
|
}
|
|
61659
61669
|
const canApplyNatively = applied && this.runtimeLaunchTuple(applied) === this.runtimeLaunchTuple(desired) && typeof session2.updateSettings === "function";
|
|
61660
|
-
let
|
|
61670
|
+
let result2 = { status: "unsupported" };
|
|
61661
61671
|
if (canApplyNatively) {
|
|
61662
61672
|
try {
|
|
61663
|
-
|
|
61673
|
+
result2 = await session2.updateSettings({
|
|
61664
61674
|
reasoningEffort: desired.reasoningEffort ?? null
|
|
61665
61675
|
});
|
|
61666
61676
|
} catch (error62) {
|
|
@@ -61674,12 +61684,12 @@ class AgentProcessManager {
|
|
|
61674
61684
|
return "saved_for_start";
|
|
61675
61685
|
}
|
|
61676
61686
|
}
|
|
61677
|
-
if (
|
|
61687
|
+
if (result2.status !== "applied") {
|
|
61678
61688
|
this.log.warn("runtime config live apply unavailable; restarting at safe boundary", {
|
|
61679
61689
|
agentId,
|
|
61680
61690
|
revision: desiredRevision,
|
|
61681
|
-
status:
|
|
61682
|
-
code:
|
|
61691
|
+
status: result2.status,
|
|
61692
|
+
code: result2.error?.code
|
|
61683
61693
|
});
|
|
61684
61694
|
if (restartOnFailure)
|
|
61685
61695
|
await this.restartForRuntimeConfig(agentId, session2);
|
|
@@ -61849,13 +61859,13 @@ class AgentProcessManager {
|
|
|
61849
61859
|
const session2 = this.sessions.get(agentId);
|
|
61850
61860
|
if (!session2)
|
|
61851
61861
|
return;
|
|
61852
|
-
const
|
|
61853
|
-
if (
|
|
61862
|
+
const result2 = await session2.interrupt({ requestId: randomUUID7(), reason: "owner_request" });
|
|
61863
|
+
if (result2.status !== "accepted")
|
|
61854
61864
|
return;
|
|
61855
61865
|
this.log.info("agent turn interrupt accepted", {
|
|
61856
61866
|
agentId,
|
|
61857
61867
|
sessionInstanceId: session2.sessionInstanceId,
|
|
61858
|
-
turnId:
|
|
61868
|
+
turnId: result2.turnId
|
|
61859
61869
|
});
|
|
61860
61870
|
try {
|
|
61861
61871
|
this.opts.onBotAuditEvent?.(agentId, { kind: "turn_interrupt", payload: { status: "accepted" } }, this.auditContext(agentId));
|
|
@@ -61886,7 +61896,7 @@ class AgentProcessManager {
|
|
|
61886
61896
|
]));
|
|
61887
61897
|
this.sessions.clear();
|
|
61888
61898
|
this.sessionLifecycles.clear();
|
|
61889
|
-
failures.push(...[...factories, ...completed].filter((
|
|
61899
|
+
failures.push(...[...factories, ...completed].filter((result2) => result2.status === "rejected").map((result2) => result2.reason));
|
|
61890
61900
|
if (failures.length)
|
|
61891
61901
|
throw new AggregateError(failures, "Agent shutdown did not complete cleanly");
|
|
61892
61902
|
});
|
|
@@ -62576,7 +62586,7 @@ ${this.opts.wakePromptFooter}` : text3;
|
|
|
62576
62586
|
this.opts.onRuntimeSpawnFailed?.(driver.id, reason);
|
|
62577
62587
|
this.emitErrorAudit(agentId, options?.scope ?? "spawn", reason, options?.message ?? `Launch failed (${reason})`);
|
|
62578
62588
|
};
|
|
62579
|
-
const teardown = (
|
|
62589
|
+
const teardown = (result2) => {
|
|
62580
62590
|
clearHandshakeTimer();
|
|
62581
62591
|
if (state.torndown)
|
|
62582
62592
|
return;
|
|
@@ -62587,18 +62597,18 @@ ${this.opts.wakePromptFooter}` : text3;
|
|
|
62587
62597
|
this.closeTurn(state, state.activeSpan, { event: "turn_abort", abortCause: "physical_exit" });
|
|
62588
62598
|
return;
|
|
62589
62599
|
}
|
|
62590
|
-
const failedStart =
|
|
62600
|
+
const failedStart = result2.outcome === "failed_to_start";
|
|
62591
62601
|
if (failedStart)
|
|
62592
|
-
reportSpawnFailure(
|
|
62602
|
+
reportSpawnFailure(result2.error.code || "failed_to_start");
|
|
62593
62603
|
if (!state.hasEstablished && !failedStart)
|
|
62594
62604
|
reportSpawnFailure("pre_handshake_exit");
|
|
62595
62605
|
this.closeTurn(state, state.activeSpan, {
|
|
62596
62606
|
event: "turn_abort",
|
|
62597
62607
|
abortCause: failedStart ? "spawn_failure" : "physical_exit"
|
|
62598
62608
|
});
|
|
62599
|
-
const exitCode = "exitCode" in
|
|
62600
|
-
const exitSignal = "signal" in
|
|
62601
|
-
const requested = "requested" in
|
|
62609
|
+
const exitCode = "exitCode" in result2 ? result2.exitCode ?? null : null;
|
|
62610
|
+
const exitSignal = "signal" in result2 ? result2.signal ?? null : null;
|
|
62611
|
+
const requested = "requested" in result2 && result2.requested === true;
|
|
62602
62612
|
const abnormal = !requested && (exitSignal !== null || exitCode !== null && exitCode !== 0);
|
|
62603
62613
|
if (state.hasEstablished && !state.suppressExitLog) {
|
|
62604
62614
|
this.logSessionEnded(agentId, "exit");
|
|
@@ -62683,7 +62693,7 @@ ${this.opts.wakePromptFooter}` : text3;
|
|
|
62683
62693
|
const done = Promise.allSettled([closed, eventsDone]).then(([closedResult, eventsResult]) => {
|
|
62684
62694
|
if (closedResult.status === "fulfilled")
|
|
62685
62695
|
teardown(closedResult.value);
|
|
62686
|
-
const failures = [closedResult, eventsResult].filter((
|
|
62696
|
+
const failures = [closedResult, eventsResult].filter((result2) => result2.status === "rejected").map((result2) => result2.reason);
|
|
62687
62697
|
if (closedResult.status === "fulfilled" && (closedResult.value.cleanup.status === "failed" || closedResult.value.cleanup.status === "timed_out")) {
|
|
62688
62698
|
failures.push(closedResult.value.cleanup.error);
|
|
62689
62699
|
}
|
|
@@ -63043,11 +63053,11 @@ ${this.opts.wakePromptFooter}` : text3;
|
|
|
63043
63053
|
turnId: event.turnId
|
|
63044
63054
|
};
|
|
63045
63055
|
if (this.pendingRuntimeConfigUpdates.has(agentId) && this.sessions.get(agentId) === owner.session) {
|
|
63046
|
-
this.convergeRuntimeConfig(agentId, false).then((
|
|
63047
|
-
if (
|
|
63056
|
+
this.convergeRuntimeConfig(agentId, false).then((result2) => {
|
|
63057
|
+
if (result2 === "saved_for_start" && owner.session)
|
|
63048
63058
|
this.markResetting(agentId);
|
|
63049
63059
|
this.dispatch(completionEvent, owner);
|
|
63050
|
-
if (
|
|
63060
|
+
if (result2 === "saved_for_start" && owner.session) {
|
|
63051
63061
|
this.restartForRuntimeConfig(agentId, owner.session);
|
|
63052
63062
|
}
|
|
63053
63063
|
}).catch((error62) => {
|
|
@@ -63488,11 +63498,11 @@ class AgentRouter {
|
|
|
63488
63498
|
revision: cmd.config.runtimeConfigRevision ?? 0
|
|
63489
63499
|
});
|
|
63490
63500
|
try {
|
|
63491
|
-
const
|
|
63501
|
+
const result2 = await this.opts.manager.updateRuntimeConfig(cmd.agentId, cmd.config);
|
|
63492
63502
|
this.log.info("agent:runtime_config_update accepted", {
|
|
63493
63503
|
agentId: cmd.agentId,
|
|
63494
63504
|
revision: cmd.config.runtimeConfigRevision ?? 0,
|
|
63495
|
-
result
|
|
63505
|
+
result: result2
|
|
63496
63506
|
});
|
|
63497
63507
|
} catch (err) {
|
|
63498
63508
|
this.log.warn("agent:runtime_config_update rejected", {
|
|
@@ -63657,7 +63667,7 @@ class PiiRunner {
|
|
|
63657
63667
|
sequence = 0;
|
|
63658
63668
|
tail = Promise.resolve();
|
|
63659
63669
|
evaluate(plugins, text3) {
|
|
63660
|
-
return this.evaluateWithResult(plugins, text3).then((
|
|
63670
|
+
return this.evaluateWithResult(plugins, text3).then((result2) => result2.text);
|
|
63661
63671
|
}
|
|
63662
63672
|
evaluateWithResult(plugins, text3) {
|
|
63663
63673
|
if (this.closed || this.pending >= 32)
|
|
@@ -66005,14 +66015,14 @@ class PiiStore {
|
|
|
66005
66015
|
return this.filterPipelineWithResult(pipeline, text3);
|
|
66006
66016
|
}
|
|
66007
66017
|
async filterPipelineWithResult(pipeline, text3) {
|
|
66008
|
-
const
|
|
66009
|
-
return { text:
|
|
66018
|
+
const result2 = await this.runWithResult(pipeline, text3);
|
|
66019
|
+
return { text: result2.text, triggeredFilters: result2.triggers.filter((trigger) => trigger.triggered).map((trigger) => {
|
|
66010
66020
|
const plugin = pipeline.plugins.find((plugin2) => plugin2.id === trigger.pluginId);
|
|
66011
66021
|
return { id: plugin.id, name: plugin.name };
|
|
66012
66022
|
}) };
|
|
66013
66023
|
}
|
|
66014
66024
|
run(pipeline, text3) {
|
|
66015
|
-
return this.runWithResult(pipeline, text3).then((
|
|
66025
|
+
return this.runWithResult(pipeline, text3).then((result2) => result2.text);
|
|
66016
66026
|
}
|
|
66017
66027
|
runWithResult(pipeline, text3) {
|
|
66018
66028
|
let plugins = this.compiled.get(pipeline);
|
|
@@ -66839,10 +66849,10 @@ class WsControlChannel {
|
|
|
66839
66849
|
const pending = [];
|
|
66840
66850
|
for (const cb of this.commandCbs) {
|
|
66841
66851
|
try {
|
|
66842
|
-
const
|
|
66843
|
-
if (
|
|
66852
|
+
const result2 = cb(cmd);
|
|
66853
|
+
if (result2 === WS_CONTROL_COMMAND_CONSUMED)
|
|
66844
66854
|
break;
|
|
66845
|
-
pending.push(Promise.resolve(
|
|
66855
|
+
pending.push(Promise.resolve(result2).catch((err) => {
|
|
66846
66856
|
this.log.warn("command listener threw", { type: cmd.type, err: describeErr(err) });
|
|
66847
66857
|
}));
|
|
66848
66858
|
} catch (err) {
|
|
@@ -66862,7 +66872,7 @@ class WsControlChannel {
|
|
|
66862
66872
|
return;
|
|
66863
66873
|
}
|
|
66864
66874
|
if (cmd.type === "agent:wake") {
|
|
66865
|
-
const
|
|
66875
|
+
const result2 = await this.wakeCoordinator.run(cmd, (accepted) => this.dispatchListeners(accepted), (advanced) => {
|
|
66866
66876
|
for (const cb of this.wakeDesiredCbs) {
|
|
66867
66877
|
try {
|
|
66868
66878
|
cb(advanced);
|
|
@@ -66871,7 +66881,7 @@ class WsControlChannel {
|
|
|
66871
66881
|
}
|
|
66872
66882
|
}
|
|
66873
66883
|
});
|
|
66874
|
-
if (
|
|
66884
|
+
if (result2.state === "suppressed") {
|
|
66875
66885
|
await this.reportWakeAck({
|
|
66876
66886
|
agentId: cmd.agentId,
|
|
66877
66887
|
launchId: cmd.launchId,
|
|
@@ -66881,7 +66891,7 @@ class WsControlChannel {
|
|
|
66881
66891
|
agentId: cmd.agentId,
|
|
66882
66892
|
channel: cmd.unreadNotice.channel,
|
|
66883
66893
|
latestSeq: cmd.unreadNotice.latestSeq,
|
|
66884
|
-
coveredSeq:
|
|
66894
|
+
coveredSeq: result2.coveredSeq
|
|
66885
66895
|
});
|
|
66886
66896
|
}
|
|
66887
66897
|
return;
|
|
@@ -67880,20 +67890,20 @@ function createTimelineRecorder(opts) {
|
|
|
67880
67890
|
}
|
|
67881
67891
|
}
|
|
67882
67892
|
};
|
|
67883
|
-
const handleTrackedResult = (agentId, state,
|
|
67884
|
-
if (
|
|
67885
|
-
applyRewrite(agentId,
|
|
67886
|
-
if (state &&
|
|
67887
|
-
state.handle =
|
|
67893
|
+
const handleTrackedResult = (agentId, state, result2) => {
|
|
67894
|
+
if (result2.status === "written") {
|
|
67895
|
+
applyRewrite(agentId, result2.rewrite);
|
|
67896
|
+
if (state && result2.handle) {
|
|
67897
|
+
state.handle = result2.handle;
|
|
67888
67898
|
state.rowFenced = false;
|
|
67889
67899
|
}
|
|
67890
67900
|
return "written";
|
|
67891
67901
|
}
|
|
67892
|
-
if (
|
|
67902
|
+
if (result2.reason === "lock" || result2.reason === "write")
|
|
67893
67903
|
return "retryable";
|
|
67894
|
-
if (state &&
|
|
67904
|
+
if (state && result2.reason !== "oversized")
|
|
67895
67905
|
state.rowFenced = true;
|
|
67896
|
-
diagnostic(agentId, "timeline_exact_write_rejected",
|
|
67906
|
+
diagnostic(agentId, "timeline_exact_write_rejected", result2.reason);
|
|
67897
67907
|
return "terminal";
|
|
67898
67908
|
};
|
|
67899
67909
|
const tryCommit = (agentId, state) => {
|
|
@@ -67905,11 +67915,11 @@ function createTimelineRecorder(opts) {
|
|
|
67905
67915
|
return "terminal";
|
|
67906
67916
|
}
|
|
67907
67917
|
if (state.handle) {
|
|
67908
|
-
const
|
|
67918
|
+
const result3 = updateTrackedEntry(dir, state.handle, (entry2) => {
|
|
67909
67919
|
const fitted2 = fitResponsesToRow(entry2, state.responses);
|
|
67910
67920
|
return { ...entry2, agent_responses: fitted2 ?? [...entry2.agent_responses, ...state.responses] };
|
|
67911
67921
|
});
|
|
67912
|
-
return handleTrackedResult(agentId, state,
|
|
67922
|
+
return handleTrackedResult(agentId, state, result3);
|
|
67913
67923
|
}
|
|
67914
67924
|
if (state.rowFenced || state.pendingMode === "handle")
|
|
67915
67925
|
return "terminal";
|
|
@@ -67926,8 +67936,8 @@ function createTimelineRecorder(opts) {
|
|
|
67926
67936
|
return "terminal";
|
|
67927
67937
|
}
|
|
67928
67938
|
entry.agent_responses = fitted;
|
|
67929
|
-
const
|
|
67930
|
-
return handleTrackedResult(agentId, state,
|
|
67939
|
+
const result2 = appendTrackedEntry(dir, entry, now());
|
|
67940
|
+
return handleTrackedResult(agentId, state, result2);
|
|
67931
67941
|
};
|
|
67932
67942
|
const deleteState = (agentId, key) => {
|
|
67933
67943
|
const states = statesFor(agentId);
|
|
@@ -67954,13 +67964,13 @@ function createTimelineRecorder(opts) {
|
|
|
67954
67964
|
deleteState(agentId, key);
|
|
67955
67965
|
continue;
|
|
67956
67966
|
}
|
|
67957
|
-
const
|
|
67958
|
-
if (
|
|
67967
|
+
const result2 = tryCommit(agentId, state);
|
|
67968
|
+
if (result2 === "written") {
|
|
67959
67969
|
state.responses = [];
|
|
67960
67970
|
state.pendingSinceMs = undefined;
|
|
67961
67971
|
state.pendingMode = undefined;
|
|
67962
67972
|
state.completedAtMs = nowMs;
|
|
67963
|
-
} else if (
|
|
67973
|
+
} else if (result2 === "terminal") {
|
|
67964
67974
|
deleteState(agentId, key);
|
|
67965
67975
|
}
|
|
67966
67976
|
}
|
|
@@ -67988,12 +67998,12 @@ function createTimelineRecorder(opts) {
|
|
|
67988
67998
|
const dir = dirFor(agentId);
|
|
67989
67999
|
if (!prepareTimelineDirectory(dir))
|
|
67990
68000
|
return;
|
|
67991
|
-
const
|
|
68001
|
+
const result2 = appendTrackedEntry(dir, createTimelineEntry({
|
|
67992
68002
|
messages,
|
|
67993
68003
|
sessionId: sessionByAgent.get(agentId) ?? null,
|
|
67994
68004
|
provider: opts.providerFor?.(agentId) ?? null
|
|
67995
68005
|
}), now());
|
|
67996
|
-
handleTrackedResult(agentId, null,
|
|
68006
|
+
handleTrackedResult(agentId, null, result2);
|
|
67997
68007
|
};
|
|
67998
68008
|
return {
|
|
67999
68009
|
barrierGeneration(agentId) {
|
|
@@ -68037,16 +68047,16 @@ function createTimelineRecorder(opts) {
|
|
|
68037
68047
|
if (!prepareTimelineDirectory(dir))
|
|
68038
68048
|
return;
|
|
68039
68049
|
const stamp = now();
|
|
68040
|
-
let
|
|
68050
|
+
let result2;
|
|
68041
68051
|
if (state.handle && (state.handle.filename === filenameForDate(stamp) || state.owner.barrierGeneration !== currentBarrier(agentId))) {
|
|
68042
|
-
|
|
68052
|
+
result2 = updateTrackedEntry(dir, state.handle, (entry) => ({
|
|
68043
68053
|
...entry,
|
|
68044
68054
|
messages: [...entry.messages, ...messages],
|
|
68045
68055
|
session_id: state.backendSessionId,
|
|
68046
68056
|
provider: state.provider
|
|
68047
68057
|
}));
|
|
68048
68058
|
} else if (state.owner.barrierGeneration === currentBarrier(agentId)) {
|
|
68049
|
-
|
|
68059
|
+
result2 = appendTrackedEntry(dir, createTimelineEntry({
|
|
68050
68060
|
messages,
|
|
68051
68061
|
sessionId: state.backendSessionId,
|
|
68052
68062
|
provider: state.provider
|
|
@@ -68055,7 +68065,7 @@ function createTimelineRecorder(opts) {
|
|
|
68055
68065
|
appendOwnerless(agentId, messages);
|
|
68056
68066
|
return;
|
|
68057
68067
|
}
|
|
68058
|
-
handleTrackedResult(agentId, state,
|
|
68068
|
+
handleTrackedResult(agentId, state, result2);
|
|
68059
68069
|
},
|
|
68060
68070
|
recordAssistantMessage(agentId, owner, text3, truncated = false) {
|
|
68061
68071
|
retryPending(agentId);
|
|
@@ -68088,11 +68098,11 @@ function createTimelineRecorder(opts) {
|
|
|
68088
68098
|
deleteState(agentId, key);
|
|
68089
68099
|
return;
|
|
68090
68100
|
}
|
|
68091
|
-
const
|
|
68092
|
-
if (
|
|
68101
|
+
const result2 = tryCommit(agentId, state);
|
|
68102
|
+
if (result2 === "written") {
|
|
68093
68103
|
state.responses = [];
|
|
68094
68104
|
state.completedAtMs = now().getTime();
|
|
68095
|
-
} else if (
|
|
68105
|
+
} else if (result2 === "terminal") {
|
|
68096
68106
|
deleteState(agentId, key);
|
|
68097
68107
|
} else {
|
|
68098
68108
|
retainPending(agentId, key, state);
|
|
@@ -68188,8 +68198,8 @@ function createTimelineRecorder(opts) {
|
|
|
68188
68198
|
}
|
|
68189
68199
|
}
|
|
68190
68200
|
}
|
|
68191
|
-
const
|
|
68192
|
-
handleTrackedResult(agentId, null,
|
|
68201
|
+
const result2 = appendTrackedEntry(dir, createSystemEntry(barrierType, stamp.toISOString(), forgottenSessionId), stamp);
|
|
68202
|
+
handleTrackedResult(agentId, null, result2);
|
|
68193
68203
|
return true;
|
|
68194
68204
|
},
|
|
68195
68205
|
pendingIdleResetEvents(agentId) {
|
|
@@ -68219,8 +68229,8 @@ function createTimelineRecorder(opts) {
|
|
|
68219
68229
|
}));
|
|
68220
68230
|
if (!persisted)
|
|
68221
68231
|
return false;
|
|
68222
|
-
const
|
|
68223
|
-
handleTrackedResult(agentId, null,
|
|
68232
|
+
const result2 = appendTrackedEntry(dir, createSystemEntry(type, stamp.toISOString(), sessionId), stamp);
|
|
68233
|
+
handleTrackedResult(agentId, null, result2);
|
|
68224
68234
|
return true;
|
|
68225
68235
|
}
|
|
68226
68236
|
}
|
|
@@ -68835,7 +68845,7 @@ class DailyTokenUsageStore {
|
|
|
68835
68845
|
return this.usageWindow(botId).then((window2) => window2.snapshots);
|
|
68836
68846
|
}
|
|
68837
68847
|
usageWindow(botId) {
|
|
68838
|
-
let
|
|
68848
|
+
let result2 = [];
|
|
68839
68849
|
let usageDay = "";
|
|
68840
68850
|
let usageTimeZone = "";
|
|
68841
68851
|
return this.enqueue(async () => {
|
|
@@ -68848,21 +68858,21 @@ class DailyTokenUsageStore {
|
|
|
68848
68858
|
if (this.prune(at, timeZone))
|
|
68849
68859
|
await this.persist();
|
|
68850
68860
|
const oldestDay = oldestVisibleDay(usageDay);
|
|
68851
|
-
|
|
68861
|
+
result2 = (this.data.bots[botId] ?? []).filter((snapshot) => snapshot.day >= oldestDay && snapshot.day <= usageDay).map((snapshot) => structuredClone(snapshot));
|
|
68852
68862
|
}).then(() => ({
|
|
68853
68863
|
usageDay,
|
|
68854
68864
|
usageTimeZone,
|
|
68855
|
-
snapshots:
|
|
68865
|
+
snapshots: result2
|
|
68856
68866
|
}));
|
|
68857
68867
|
}
|
|
68858
68868
|
enqueue(operation) {
|
|
68859
|
-
const
|
|
68860
|
-
this.tail =
|
|
68869
|
+
const result2 = this.tail.then(operation, operation);
|
|
68870
|
+
this.tail = result2.then(() => {
|
|
68861
68871
|
return;
|
|
68862
68872
|
}, () => {
|
|
68863
68873
|
return;
|
|
68864
68874
|
});
|
|
68865
|
-
return
|
|
68875
|
+
return result2;
|
|
68866
68876
|
}
|
|
68867
68877
|
async load() {
|
|
68868
68878
|
if (this.loaded)
|
|
@@ -68967,33 +68977,33 @@ var RECENT_CONTEXT_HEADING = "## Recent local context";
|
|
|
68967
68977
|
function code(value) {
|
|
68968
68978
|
return `\`${value.replaceAll("`", "\\`")}\``;
|
|
68969
68979
|
}
|
|
68970
|
-
function appendRecentContextToPrompt(prompt,
|
|
68980
|
+
function appendRecentContextToPrompt(prompt, result2) {
|
|
68971
68981
|
const lines = [
|
|
68972
68982
|
prompt,
|
|
68973
68983
|
"",
|
|
68974
68984
|
RECENT_CONTEXT_HEADING,
|
|
68975
68985
|
""
|
|
68976
68986
|
];
|
|
68977
|
-
if (!
|
|
68987
|
+
if (!result2.ok) {
|
|
68978
68988
|
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.");
|
|
68979
68989
|
return lines.join(`
|
|
68980
68990
|
`);
|
|
68981
68991
|
}
|
|
68982
68992
|
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", "");
|
|
68983
|
-
if (
|
|
68993
|
+
if (result2.sessionFiles.capability === "unavailable") {
|
|
68984
68994
|
lines.push("This runtime does not expose discoverable session files.");
|
|
68985
|
-
} else if (
|
|
68995
|
+
} else if (result2.sessionFiles.items.length === 0) {
|
|
68986
68996
|
lines.push("No recent session files were found.");
|
|
68987
68997
|
} else {
|
|
68988
|
-
for (const item of
|
|
68998
|
+
for (const item of result2.sessionFiles.items) {
|
|
68989
68999
|
lines.push(`- ${code(item.sessionFilePath)} — project ${code(item.projectPath)}; updated ${item.modifiedAt}`);
|
|
68990
69000
|
}
|
|
68991
69001
|
}
|
|
68992
69002
|
lines.push("", "### Recent projects", "");
|
|
68993
|
-
if (
|
|
69003
|
+
if (result2.recentProjects.length === 0) {
|
|
68994
69004
|
lines.push("No recent projects were found.");
|
|
68995
69005
|
} else {
|
|
68996
|
-
for (const item of
|
|
69006
|
+
for (const item of result2.recentProjects) {
|
|
68997
69007
|
lines.push(`- ${code(item.projectPath)} — updated ${item.modifiedAt}`);
|
|
68998
69008
|
}
|
|
68999
69009
|
}
|
|
@@ -69004,16 +69014,16 @@ function createRecentContextPromptAppender(discover, recentSessionFilesTopK = 20
|
|
|
69004
69014
|
return async (prompt, runtimeConfig) => {
|
|
69005
69015
|
const selected = toAgentBackendSelection(runtimeConfig);
|
|
69006
69016
|
const command = selected.config.command;
|
|
69007
|
-
let
|
|
69017
|
+
let result2;
|
|
69008
69018
|
try {
|
|
69009
|
-
|
|
69019
|
+
result2 = await discover({
|
|
69010
69020
|
backend: selected.backend,
|
|
69011
69021
|
recentSessionFilesTopK,
|
|
69012
69022
|
recentProjectsTopK,
|
|
69013
69023
|
...command ? { command } : {}
|
|
69014
69024
|
});
|
|
69015
69025
|
} catch {
|
|
69016
|
-
|
|
69026
|
+
result2 = {
|
|
69017
69027
|
ok: false,
|
|
69018
69028
|
error: {
|
|
69019
69029
|
category: "runtime_unavailable",
|
|
@@ -69023,7 +69033,7 @@ function createRecentContextPromptAppender(discover, recentSessionFilesTopK = 20
|
|
|
69023
69033
|
}
|
|
69024
69034
|
};
|
|
69025
69035
|
}
|
|
69026
|
-
return appendRecentContextToPrompt(prompt,
|
|
69036
|
+
return appendRecentContextToPrompt(prompt, result2);
|
|
69027
69037
|
};
|
|
69028
69038
|
}
|
|
69029
69039
|
|
|
@@ -69690,10 +69700,10 @@ async function createDaemon(opts) {
|
|
|
69690
69700
|
return Promise.resolve([]);
|
|
69691
69701
|
return trackTelemetry((async () => {
|
|
69692
69702
|
const results = await Promise.allSettled(manager.liveAgentActivities().map((info) => activityPayload(info)));
|
|
69693
|
-
const failed = results.find((
|
|
69703
|
+
const failed = results.find((result2) => result2.status === "rejected");
|
|
69694
69704
|
if (failed)
|
|
69695
69705
|
throw failed.reason;
|
|
69696
|
-
const activities = results.map((
|
|
69706
|
+
const activities = results.map((result2) => result2.value);
|
|
69697
69707
|
return stopping ? [] : activities.filter((activity) => manager.agentActivity(activity.agentId) === activity.state);
|
|
69698
69708
|
})());
|
|
69699
69709
|
},
|