@moxt-ai/mobius 0.0.155 → 0.0.156
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/acp/agent-query-processes.d.ts +2 -1
- package/dist/acp/agent-query-processes.d.ts.map +1 -1
- package/dist/acp/agent-query-processes.js +7 -1
- package/dist/acp/agent-query-processes.js.map +1 -1
- package/dist/acp/agent-runtime-manager.d.ts +4 -2
- package/dist/acp/agent-runtime-manager.d.ts.map +1 -1
- package/dist/acp/agent-runtime-manager.js +19 -0
- package/dist/acp/agent-runtime-manager.js.map +1 -1
- package/dist/acp/agent-session.d.ts +2 -1
- package/dist/acp/agent-session.d.ts.map +1 -1
- package/dist/acp/agent-session.js +16 -2
- package/dist/acp/agent-session.js.map +1 -1
- package/dist/acp/session-contracts.d.ts +9 -1
- package/dist/acp/session-contracts.d.ts.map +1 -1
- package/dist/acp/session-contracts.js +1 -0
- package/dist/acp/session-contracts.js.map +1 -1
- package/dist/acp/session-history.d.ts +3 -2
- package/dist/acp/session-history.d.ts.map +1 -1
- package/dist/acp/session-history.js +17 -1
- package/dist/acp/session-history.js.map +1 -1
- package/dist/acp/session-store.d.ts +7 -0
- package/dist/acp/session-store.d.ts.map +1 -1
- package/dist/acp/session-store.js +34 -3
- package/dist/acp/session-store.js.map +1 -1
- package/dist/cli.js +1034 -103
- package/dist/cli.js.map +4 -4
- package/dist/daemon-command-handler.d.ts +3 -1
- package/dist/daemon-command-handler.d.ts.map +1 -1
- package/dist/daemon-command-handler.js +9 -3
- package/dist/daemon-command-handler.js.map +1 -1
- package/dist/daemon-history-commands.d.ts +2 -1
- package/dist/daemon-history-commands.d.ts.map +1 -1
- package/dist/daemon-history-commands.js +64 -1
- package/dist/daemon-history-commands.js.map +1 -1
- package/dist/daemon-observers.d.ts +3 -2
- package/dist/daemon-observers.d.ts.map +1 -1
- package/dist/daemon-observers.js +7 -1
- package/dist/daemon-observers.js.map +1 -1
- package/dist/daemon-prompt-executor.d.ts +3 -1
- package/dist/daemon-prompt-executor.d.ts.map +1 -1
- package/dist/daemon-prompt-executor.js +9 -3
- package/dist/daemon-prompt-executor.js.map +1 -1
- package/dist/daemon-turn-registry.d.ts +13 -13
- package/dist/generated/acp-session-store-migrations.d.ts +3 -0
- package/dist/generated/acp-session-store-migrations.d.ts.map +1 -1
- package/dist/generated/acp-session-store-migrations.js +5 -1
- package/dist/generated/acp-session-store-migrations.js.map +1 -1
- package/dist/index.js +1017 -86
- package/dist/index.js.map +4 -4
- package/dist/relay-connection/run-relay-connection.d.ts +3 -1
- package/dist/relay-connection/run-relay-connection.d.ts.map +1 -1
- package/dist/relay-connection/run-relay-connection.js +2 -1
- package/dist/relay-connection/run-relay-connection.js.map +1 -1
- package/dist/relay-connection/session-event-publisher.d.ts +2 -1
- package/dist/relay-connection/session-event-publisher.d.ts.map +1 -1
- package/dist/relay-connection/session-event-publisher.js +18 -1
- package/dist/relay-connection/session-event-publisher.js.map +1 -1
- package/dist/run-daemon.d.ts.map +1 -1
- package/dist/run-daemon.js +4 -1
- package/dist/run-daemon.js.map +1 -1
- package/dist/runtime.js +1013 -82
- package/dist/runtime.js.map +4 -4
- package/dist/schema/acp-session-store/index.d.ts +1 -0
- package/dist/schema/acp-session-store/index.d.ts.map +1 -1
- package/dist/schema/acp-session-store/index.js +1 -0
- package/dist/schema/acp-session-store/index.js.map +1 -1
- package/dist/schema/acp-session-store/session-event-v2.d.ts +82 -0
- package/dist/schema/acp-session-store/session-event-v2.d.ts.map +1 -0
- package/dist/schema/acp-session-store/session-event-v2.js +11 -0
- package/dist/schema/acp-session-store/session-event-v2.js.map +1 -0
- package/dist/session-event-log-v2.d.ts +15 -0
- package/dist/session-event-log-v2.d.ts.map +1 -0
- package/dist/session-event-log-v2.js +238 -0
- package/dist/session-event-log-v2.js.map +1 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2340,11 +2340,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2340
2340
|
};
|
|
2341
2341
|
this._checkNumberOfArguments();
|
|
2342
2342
|
const processedArgs = [];
|
|
2343
|
-
this.registeredArguments.forEach((declaredArg,
|
|
2343
|
+
this.registeredArguments.forEach((declaredArg, index2) => {
|
|
2344
2344
|
let value = declaredArg.defaultValue;
|
|
2345
2345
|
if (declaredArg.variadic) {
|
|
2346
|
-
if (
|
|
2347
|
-
value = this.args.slice(
|
|
2346
|
+
if (index2 < this.args.length) {
|
|
2347
|
+
value = this.args.slice(index2);
|
|
2348
2348
|
if (declaredArg.parseArg) {
|
|
2349
2349
|
value = value.reduce((processed, v) => {
|
|
2350
2350
|
return myParseArg(declaredArg, v, processed);
|
|
@@ -2353,13 +2353,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2353
2353
|
} else if (value === void 0) {
|
|
2354
2354
|
value = [];
|
|
2355
2355
|
}
|
|
2356
|
-
} else if (
|
|
2357
|
-
value = this.args[
|
|
2356
|
+
} else if (index2 < this.args.length) {
|
|
2357
|
+
value = this.args[index2];
|
|
2358
2358
|
if (declaredArg.parseArg) {
|
|
2359
2359
|
value = myParseArg(declaredArg, value, declaredArg.defaultValue);
|
|
2360
2360
|
}
|
|
2361
2361
|
}
|
|
2362
|
-
processedArgs[
|
|
2362
|
+
processedArgs[index2] = value;
|
|
2363
2363
|
});
|
|
2364
2364
|
this.processedArgs = processedArgs;
|
|
2365
2365
|
}
|
|
@@ -2653,10 +2653,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2653
2653
|
}
|
|
2654
2654
|
}
|
|
2655
2655
|
if (/^--[^=]+=/.test(arg)) {
|
|
2656
|
-
const
|
|
2657
|
-
const option = this._findOption(arg.slice(0,
|
|
2656
|
+
const index2 = arg.indexOf("=");
|
|
2657
|
+
const option = this._findOption(arg.slice(0, index2));
|
|
2658
2658
|
if (option && (option.required || option.optional)) {
|
|
2659
|
-
this.emit(`option:${option.name()}`, arg.slice(
|
|
2659
|
+
this.emit(`option:${option.name()}`, arg.slice(index2 + 1));
|
|
2660
2660
|
continue;
|
|
2661
2661
|
}
|
|
2662
2662
|
}
|
|
@@ -3381,7 +3381,7 @@ var program = new Command();
|
|
|
3381
3381
|
// package.json
|
|
3382
3382
|
var package_default = {
|
|
3383
3383
|
name: "@moxt-ai/mobius",
|
|
3384
|
-
version: "0.0.
|
|
3384
|
+
version: "0.0.156",
|
|
3385
3385
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
3386
3386
|
type: "module",
|
|
3387
3387
|
bin: {
|
|
@@ -8316,11 +8316,11 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
|
|
|
8316
8316
|
return payload;
|
|
8317
8317
|
};
|
|
8318
8318
|
});
|
|
8319
|
-
function handleArrayResult(result, final,
|
|
8319
|
+
function handleArrayResult(result, final, index2) {
|
|
8320
8320
|
if (result.issues.length) {
|
|
8321
|
-
final.issues.push(...prefixIssues(
|
|
8321
|
+
final.issues.push(...prefixIssues(index2, result.issues));
|
|
8322
8322
|
}
|
|
8323
|
-
final.value[
|
|
8323
|
+
final.value[index2] = result.value;
|
|
8324
8324
|
}
|
|
8325
8325
|
var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
8326
8326
|
$ZodType.init(inst, def);
|
|
@@ -8931,14 +8931,14 @@ function mergeValues(a, b) {
|
|
|
8931
8931
|
return { valid: false, mergeErrorPath: [] };
|
|
8932
8932
|
}
|
|
8933
8933
|
const newArray = [];
|
|
8934
|
-
for (let
|
|
8935
|
-
const itemA = a[
|
|
8936
|
-
const itemB = b[
|
|
8934
|
+
for (let index2 = 0; index2 < a.length; index2++) {
|
|
8935
|
+
const itemA = a[index2];
|
|
8936
|
+
const itemB = b[index2];
|
|
8937
8937
|
const sharedValue = mergeValues(itemA, itemB);
|
|
8938
8938
|
if (!sharedValue.valid) {
|
|
8939
8939
|
return {
|
|
8940
8940
|
valid: false,
|
|
8941
|
-
mergeErrorPath: [
|
|
8941
|
+
mergeErrorPath: [index2, ...sharedValue.mergeErrorPath]
|
|
8942
8942
|
};
|
|
8943
8943
|
}
|
|
8944
8944
|
newArray.push(sharedValue.data);
|
|
@@ -9089,11 +9089,11 @@ function getTupleOptStart(items, key) {
|
|
|
9089
9089
|
}
|
|
9090
9090
|
return 0;
|
|
9091
9091
|
}
|
|
9092
|
-
function handleTupleResult(result, final,
|
|
9092
|
+
function handleTupleResult(result, final, index2) {
|
|
9093
9093
|
if (result.issues.length) {
|
|
9094
|
-
final.issues.push(...prefixIssues(
|
|
9094
|
+
final.issues.push(...prefixIssues(index2, result.issues));
|
|
9095
9095
|
}
|
|
9096
|
-
final.value[
|
|
9096
|
+
final.value[index2] = result.value;
|
|
9097
9097
|
}
|
|
9098
9098
|
function handleTupleResults(itemResults, final, items, input2, optoutStart) {
|
|
9099
9099
|
for (let i = 0; i < items.length; i++) {
|
|
@@ -23774,7 +23774,7 @@ function detectVersion(schema, defaultTarget) {
|
|
|
23774
23774
|
return defaultTarget ?? "draft-2020-12";
|
|
23775
23775
|
}
|
|
23776
23776
|
function applyMinItems(items, minItems) {
|
|
23777
|
-
return items.map((item,
|
|
23777
|
+
return items.map((item, index2) => index2 < minItems ? item : item.optional());
|
|
23778
23778
|
}
|
|
23779
23779
|
function decodeJSONPointerSegment(segment) {
|
|
23780
23780
|
return segment.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
@@ -27822,9 +27822,9 @@ function comparePrerelease(left, right) {
|
|
|
27822
27822
|
if (left.length === 0 || right.length === 0) {
|
|
27823
27823
|
return left.length === right.length ? 0 : left.length === 0 ? 1 : -1;
|
|
27824
27824
|
}
|
|
27825
|
-
for (let
|
|
27826
|
-
const leftPart = left[
|
|
27827
|
-
const rightPart = right[
|
|
27825
|
+
for (let index2 = 0; index2 < Math.max(left.length, right.length); index2 += 1) {
|
|
27826
|
+
const leftPart = left[index2];
|
|
27827
|
+
const rightPart = right[index2];
|
|
27828
27828
|
if (leftPart === void 0 || rightPart === void 0) {
|
|
27829
27829
|
return leftPart === rightPart ? 0 : leftPart === void 0 ? -1 : 1;
|
|
27830
27830
|
}
|
|
@@ -27849,8 +27849,8 @@ function compareAgentVersions(left, right) {
|
|
|
27849
27849
|
if (parsedLeft === null || parsedRight === null) {
|
|
27850
27850
|
return null;
|
|
27851
27851
|
}
|
|
27852
|
-
for (let
|
|
27853
|
-
const difference = (parsedLeft.core[
|
|
27852
|
+
for (let index2 = 0; index2 < Math.max(parsedLeft.core.length, parsedRight.core.length); index2 += 1) {
|
|
27853
|
+
const difference = (parsedLeft.core[index2] ?? 0) - (parsedRight.core[index2] ?? 0);
|
|
27854
27854
|
if (difference !== 0) {
|
|
27855
27855
|
return Math.sign(difference);
|
|
27856
27856
|
}
|
|
@@ -28597,12 +28597,12 @@ var DEFAULT_AGENT_EXECUTION_CONFIGURATION = Object.freeze({
|
|
|
28597
28597
|
});
|
|
28598
28598
|
var sessionConfigurationSelectionsSchema = external_exports.array(sessionConfigurationSelectionSchema).max(100).superRefine((selections, context) => {
|
|
28599
28599
|
const identifiers = /* @__PURE__ */ new Set();
|
|
28600
|
-
for (const [
|
|
28600
|
+
for (const [index2, selection] of selections.entries()) {
|
|
28601
28601
|
if (identifiers.has(selection.configId)) {
|
|
28602
28602
|
context.addIssue({
|
|
28603
28603
|
code: "custom",
|
|
28604
28604
|
message: "Session configuration identifiers must be unique",
|
|
28605
|
-
path: [
|
|
28605
|
+
path: [index2, "configId"]
|
|
28606
28606
|
});
|
|
28607
28607
|
}
|
|
28608
28608
|
identifiers.add(selection.configId);
|
|
@@ -29804,6 +29804,383 @@ var encodeNativeSessionResult = (value) => JSON.stringify(nativeSessionResultSch
|
|
|
29804
29804
|
var decodeNativeSessionCancel = (encoded) => decode4(nativeSessionCancelSchema, encoded);
|
|
29805
29805
|
var encodeNativeSessionCancel = (value) => JSON.stringify(nativeSessionCancelSchema.parse(value));
|
|
29806
29806
|
|
|
29807
|
+
// ../protocol/src/session-event-log-v2.ts
|
|
29808
|
+
var MAX_EVENT_COUNT = 1e4;
|
|
29809
|
+
var MAX_COLLECTION_SIZE = 1e3;
|
|
29810
|
+
var MAX_CONTENT_LENGTH = 1e6;
|
|
29811
|
+
var MAX_JSON_DEPTH = 16;
|
|
29812
|
+
var MAX_JSON_KEYS = 1e3;
|
|
29813
|
+
var SESSION_EVENT_V2_KIND = "session.event.v2";
|
|
29814
|
+
var boundedString = external_exports.string().max(MAX_CONTENT_LENGTH);
|
|
29815
|
+
var shortString = external_exports.string().max(2048);
|
|
29816
|
+
function boundedJsonIssue(value, depth = 0) {
|
|
29817
|
+
if (depth > MAX_JSON_DEPTH) {
|
|
29818
|
+
return "JSON nesting exceeds the maximum depth";
|
|
29819
|
+
}
|
|
29820
|
+
if (typeof value === "string") {
|
|
29821
|
+
return value.length <= MAX_CONTENT_LENGTH ? null : "JSON string exceeds the maximum length";
|
|
29822
|
+
}
|
|
29823
|
+
if (typeof value === "number") {
|
|
29824
|
+
return Number.isFinite(value) ? null : "JSON number must be finite";
|
|
29825
|
+
}
|
|
29826
|
+
if (typeof value === "boolean" || value === null) {
|
|
29827
|
+
return null;
|
|
29828
|
+
}
|
|
29829
|
+
if (Array.isArray(value)) {
|
|
29830
|
+
if (value.length > MAX_COLLECTION_SIZE) {
|
|
29831
|
+
return "JSON array exceeds the maximum length";
|
|
29832
|
+
}
|
|
29833
|
+
for (const item of value) {
|
|
29834
|
+
const issue2 = boundedJsonIssue(item, depth + 1);
|
|
29835
|
+
if (issue2 !== null) {
|
|
29836
|
+
return issue2;
|
|
29837
|
+
}
|
|
29838
|
+
}
|
|
29839
|
+
return null;
|
|
29840
|
+
}
|
|
29841
|
+
if (typeof value === "object" && value !== void 0) {
|
|
29842
|
+
const entries = Object.entries(value);
|
|
29843
|
+
if (entries.length > MAX_JSON_KEYS) {
|
|
29844
|
+
return "JSON object exceeds the maximum key count";
|
|
29845
|
+
}
|
|
29846
|
+
for (const [key, item] of entries) {
|
|
29847
|
+
if (key.length > 255) {
|
|
29848
|
+
return "JSON key exceeds the maximum length";
|
|
29849
|
+
}
|
|
29850
|
+
const issue2 = boundedJsonIssue(item, depth + 1);
|
|
29851
|
+
if (issue2 !== null) {
|
|
29852
|
+
return issue2;
|
|
29853
|
+
}
|
|
29854
|
+
}
|
|
29855
|
+
return null;
|
|
29856
|
+
}
|
|
29857
|
+
return "Value is not bounded JSON";
|
|
29858
|
+
}
|
|
29859
|
+
var boundedJsonSchema = external_exports.unknown().superRefine((value, context) => {
|
|
29860
|
+
const issue2 = boundedJsonIssue(value);
|
|
29861
|
+
if (issue2 !== null) {
|
|
29862
|
+
context.addIssue({ code: "custom", message: issue2 });
|
|
29863
|
+
}
|
|
29864
|
+
});
|
|
29865
|
+
var metadataSchema = external_exports.record(external_exports.string().max(255), boundedJsonSchema).readonly();
|
|
29866
|
+
var optionalMetadata = metadataSchema.nullable().optional();
|
|
29867
|
+
var annotationsSchema = external_exports.strictObject({
|
|
29868
|
+
_meta: optionalMetadata,
|
|
29869
|
+
audience: external_exports.array(external_exports.enum(["assistant", "user"])).max(2).readonly().nullable().optional(),
|
|
29870
|
+
lastModified: shortString.nullable().optional(),
|
|
29871
|
+
priority: external_exports.number().finite().nullable().optional()
|
|
29872
|
+
}).readonly();
|
|
29873
|
+
var contentFields = { _meta: optionalMetadata, annotations: annotationsSchema.nullable().optional() };
|
|
29874
|
+
var textContentSchema = external_exports.strictObject({ ...contentFields, text: boundedString, type: external_exports.literal("text") }).readonly();
|
|
29875
|
+
var imageContentSchema = external_exports.strictObject({
|
|
29876
|
+
...contentFields,
|
|
29877
|
+
data: boundedString,
|
|
29878
|
+
mimeType: shortString,
|
|
29879
|
+
type: external_exports.literal("image"),
|
|
29880
|
+
uri: boundedString.nullable().optional()
|
|
29881
|
+
}).readonly();
|
|
29882
|
+
var audioContentSchema = external_exports.strictObject({ ...contentFields, data: boundedString, mimeType: shortString, type: external_exports.literal("audio") }).readonly();
|
|
29883
|
+
var resourceLinkSchema = external_exports.strictObject({
|
|
29884
|
+
...contentFields,
|
|
29885
|
+
description: boundedString.nullable().optional(),
|
|
29886
|
+
mimeType: shortString.nullable().optional(),
|
|
29887
|
+
name: shortString,
|
|
29888
|
+
size: external_exports.number().int().nonnegative().safe().nullable().optional(),
|
|
29889
|
+
title: shortString.nullable().optional(),
|
|
29890
|
+
type: external_exports.literal("resource_link"),
|
|
29891
|
+
uri: boundedString
|
|
29892
|
+
}).readonly();
|
|
29893
|
+
var textResourceSchema = external_exports.strictObject({
|
|
29894
|
+
_meta: optionalMetadata,
|
|
29895
|
+
mimeType: shortString.nullable().optional(),
|
|
29896
|
+
text: boundedString,
|
|
29897
|
+
uri: boundedString
|
|
29898
|
+
}).readonly();
|
|
29899
|
+
var blobResourceSchema = external_exports.strictObject({
|
|
29900
|
+
_meta: optionalMetadata,
|
|
29901
|
+
blob: boundedString,
|
|
29902
|
+
mimeType: shortString.nullable().optional(),
|
|
29903
|
+
uri: boundedString
|
|
29904
|
+
}).readonly();
|
|
29905
|
+
var embeddedResourceSchema = external_exports.strictObject({
|
|
29906
|
+
...contentFields,
|
|
29907
|
+
resource: external_exports.union([textResourceSchema, blobResourceSchema]),
|
|
29908
|
+
type: external_exports.literal("resource")
|
|
29909
|
+
}).readonly();
|
|
29910
|
+
var contentBlockV2Schema = external_exports.discriminatedUnion("type", [
|
|
29911
|
+
textContentSchema,
|
|
29912
|
+
imageContentSchema,
|
|
29913
|
+
audioContentSchema,
|
|
29914
|
+
resourceLinkSchema,
|
|
29915
|
+
embeddedResourceSchema
|
|
29916
|
+
]);
|
|
29917
|
+
var toolCallContentSchema = external_exports.discriminatedUnion("type", [
|
|
29918
|
+
external_exports.strictObject({ _meta: optionalMetadata, content: contentBlockV2Schema, type: external_exports.literal("content") }).readonly(),
|
|
29919
|
+
external_exports.strictObject({
|
|
29920
|
+
_meta: optionalMetadata,
|
|
29921
|
+
newText: boundedString,
|
|
29922
|
+
oldText: boundedString.nullable().optional(),
|
|
29923
|
+
path: boundedString,
|
|
29924
|
+
type: external_exports.literal("diff")
|
|
29925
|
+
}).readonly(),
|
|
29926
|
+
external_exports.strictObject({ _meta: optionalMetadata, terminalId: shortString, type: external_exports.literal("terminal") }).readonly()
|
|
29927
|
+
]);
|
|
29928
|
+
var toolCallLocationSchema = external_exports.strictObject({
|
|
29929
|
+
_meta: optionalMetadata,
|
|
29930
|
+
line: external_exports.number().int().nonnegative().safe().nullable().optional(),
|
|
29931
|
+
path: boundedString
|
|
29932
|
+
}).readonly();
|
|
29933
|
+
var toolKindSchema = external_exports.enum([
|
|
29934
|
+
"read",
|
|
29935
|
+
"edit",
|
|
29936
|
+
"delete",
|
|
29937
|
+
"move",
|
|
29938
|
+
"search",
|
|
29939
|
+
"execute",
|
|
29940
|
+
"think",
|
|
29941
|
+
"fetch",
|
|
29942
|
+
"switch_mode",
|
|
29943
|
+
"other"
|
|
29944
|
+
]);
|
|
29945
|
+
var toolStatusSchema = external_exports.enum(["pending", "in_progress", "completed", "failed"]);
|
|
29946
|
+
var toolPatchFields = {
|
|
29947
|
+
_meta: optionalMetadata,
|
|
29948
|
+
content: external_exports.array(toolCallContentSchema).max(MAX_COLLECTION_SIZE).readonly().nullable().optional(),
|
|
29949
|
+
kind: toolKindSchema.nullable().optional(),
|
|
29950
|
+
locations: external_exports.array(toolCallLocationSchema).max(MAX_COLLECTION_SIZE).readonly().nullable().optional(),
|
|
29951
|
+
name: shortString.nullable().optional(),
|
|
29952
|
+
rawInput: boundedJsonSchema.optional(),
|
|
29953
|
+
rawOutput: boundedJsonSchema.optional(),
|
|
29954
|
+
status: toolStatusSchema.nullable().optional(),
|
|
29955
|
+
title: boundedString.nullable().optional()
|
|
29956
|
+
};
|
|
29957
|
+
var planEntrySchema = external_exports.strictObject({
|
|
29958
|
+
_meta: optionalMetadata,
|
|
29959
|
+
content: boundedString,
|
|
29960
|
+
priority: external_exports.enum(["high", "medium", "low"]),
|
|
29961
|
+
status: external_exports.enum(["pending", "in_progress", "completed"])
|
|
29962
|
+
}).readonly();
|
|
29963
|
+
var planContentSchema = external_exports.discriminatedUnion("type", [
|
|
29964
|
+
external_exports.strictObject({
|
|
29965
|
+
_meta: optionalMetadata,
|
|
29966
|
+
entries: external_exports.array(planEntrySchema).max(MAX_COLLECTION_SIZE).readonly(),
|
|
29967
|
+
planId: shortString,
|
|
29968
|
+
type: external_exports.literal("items")
|
|
29969
|
+
}).readonly(),
|
|
29970
|
+
external_exports.strictObject({ _meta: optionalMetadata, planId: shortString, type: external_exports.literal("file"), uri: boundedString }).readonly(),
|
|
29971
|
+
external_exports.strictObject({
|
|
29972
|
+
_meta: optionalMetadata,
|
|
29973
|
+
content: boundedString,
|
|
29974
|
+
planId: shortString,
|
|
29975
|
+
type: external_exports.literal("markdown")
|
|
29976
|
+
}).readonly()
|
|
29977
|
+
]);
|
|
29978
|
+
var commandSchema = external_exports.strictObject({
|
|
29979
|
+
_meta: optionalMetadata,
|
|
29980
|
+
description: boundedString,
|
|
29981
|
+
input: external_exports.strictObject({ _meta: optionalMetadata, hint: boundedString }).readonly().nullable().optional(),
|
|
29982
|
+
name: shortString
|
|
29983
|
+
}).readonly();
|
|
29984
|
+
var configSelectOptionSchema = external_exports.strictObject({
|
|
29985
|
+
_meta: optionalMetadata,
|
|
29986
|
+
description: boundedString.nullable().optional(),
|
|
29987
|
+
name: shortString,
|
|
29988
|
+
value: shortString
|
|
29989
|
+
}).readonly();
|
|
29990
|
+
var configSelectGroupSchema = external_exports.strictObject({
|
|
29991
|
+
_meta: optionalMetadata,
|
|
29992
|
+
group: shortString,
|
|
29993
|
+
name: shortString,
|
|
29994
|
+
options: external_exports.array(configSelectOptionSchema).max(MAX_COLLECTION_SIZE).readonly()
|
|
29995
|
+
}).readonly();
|
|
29996
|
+
var configBaseFields = {
|
|
29997
|
+
_meta: optionalMetadata,
|
|
29998
|
+
category: shortString.nullable().optional(),
|
|
29999
|
+
description: boundedString.nullable().optional(),
|
|
30000
|
+
id: shortString,
|
|
30001
|
+
name: shortString
|
|
30002
|
+
};
|
|
30003
|
+
var sessionConfigOptionSchema2 = external_exports.discriminatedUnion("type", [
|
|
30004
|
+
external_exports.strictObject({
|
|
30005
|
+
...configBaseFields,
|
|
30006
|
+
currentValue: shortString,
|
|
30007
|
+
options: external_exports.union([
|
|
30008
|
+
external_exports.array(configSelectOptionSchema).max(MAX_COLLECTION_SIZE).readonly(),
|
|
30009
|
+
external_exports.array(configSelectGroupSchema).max(MAX_COLLECTION_SIZE).readonly()
|
|
30010
|
+
]),
|
|
30011
|
+
type: external_exports.literal("select")
|
|
30012
|
+
}).readonly(),
|
|
30013
|
+
external_exports.strictObject({ ...configBaseFields, currentValue: external_exports.boolean(), type: external_exports.literal("boolean") }).readonly()
|
|
30014
|
+
]);
|
|
30015
|
+
var contentChunkFields = {
|
|
30016
|
+
_meta: optionalMetadata,
|
|
30017
|
+
content: contentBlockV2Schema,
|
|
30018
|
+
messageId: shortString.nullable().optional()
|
|
30019
|
+
};
|
|
30020
|
+
var acpSessionUpdateV2Schema = external_exports.discriminatedUnion("sessionUpdate", [
|
|
30021
|
+
external_exports.strictObject({ ...contentChunkFields, sessionUpdate: external_exports.literal("user_message_chunk") }).readonly(),
|
|
30022
|
+
external_exports.strictObject({ ...contentChunkFields, sessionUpdate: external_exports.literal("agent_message_chunk") }).readonly(),
|
|
30023
|
+
external_exports.strictObject({ ...contentChunkFields, sessionUpdate: external_exports.literal("agent_thought_chunk") }).readonly(),
|
|
30024
|
+
external_exports.strictObject({
|
|
30025
|
+
_meta: optionalMetadata,
|
|
30026
|
+
content: external_exports.array(toolCallContentSchema).max(MAX_COLLECTION_SIZE).readonly().optional(),
|
|
30027
|
+
kind: toolKindSchema.optional(),
|
|
30028
|
+
locations: external_exports.array(toolCallLocationSchema).max(MAX_COLLECTION_SIZE).readonly().optional(),
|
|
30029
|
+
name: shortString.nullable().optional(),
|
|
30030
|
+
rawInput: boundedJsonSchema.optional(),
|
|
30031
|
+
rawOutput: boundedJsonSchema.optional(),
|
|
30032
|
+
sessionUpdate: external_exports.literal("tool_call"),
|
|
30033
|
+
status: toolStatusSchema.optional(),
|
|
30034
|
+
title: boundedString,
|
|
30035
|
+
toolCallId: shortString
|
|
30036
|
+
}).readonly(),
|
|
30037
|
+
external_exports.strictObject({ ...toolPatchFields, sessionUpdate: external_exports.literal("tool_call_update"), toolCallId: shortString }).readonly(),
|
|
30038
|
+
external_exports.strictObject({
|
|
30039
|
+
_meta: optionalMetadata,
|
|
30040
|
+
entries: external_exports.array(planEntrySchema).max(MAX_COLLECTION_SIZE).readonly(),
|
|
30041
|
+
sessionUpdate: external_exports.literal("plan")
|
|
30042
|
+
}).readonly(),
|
|
30043
|
+
external_exports.strictObject({ _meta: optionalMetadata, plan: planContentSchema, sessionUpdate: external_exports.literal("plan_update") }).readonly(),
|
|
30044
|
+
external_exports.strictObject({ _meta: optionalMetadata, planId: shortString, sessionUpdate: external_exports.literal("plan_removed") }).readonly(),
|
|
30045
|
+
external_exports.strictObject({
|
|
30046
|
+
_meta: optionalMetadata,
|
|
30047
|
+
availableCommands: external_exports.array(commandSchema).max(MAX_COLLECTION_SIZE).readonly(),
|
|
30048
|
+
sessionUpdate: external_exports.literal("available_commands_update")
|
|
30049
|
+
}).readonly(),
|
|
30050
|
+
external_exports.strictObject({
|
|
30051
|
+
_meta: optionalMetadata,
|
|
30052
|
+
currentModeId: shortString,
|
|
30053
|
+
sessionUpdate: external_exports.literal("current_mode_update")
|
|
30054
|
+
}).readonly(),
|
|
30055
|
+
external_exports.strictObject({
|
|
30056
|
+
_meta: optionalMetadata,
|
|
30057
|
+
configOptions: external_exports.array(sessionConfigOptionSchema2).max(MAX_COLLECTION_SIZE).readonly(),
|
|
30058
|
+
sessionUpdate: external_exports.literal("config_option_update")
|
|
30059
|
+
}).readonly(),
|
|
30060
|
+
external_exports.strictObject({
|
|
30061
|
+
_meta: optionalMetadata,
|
|
30062
|
+
sessionUpdate: external_exports.literal("session_info_update"),
|
|
30063
|
+
title: boundedString.nullable().optional(),
|
|
30064
|
+
updatedAt: shortString.nullable().optional()
|
|
30065
|
+
}).readonly(),
|
|
30066
|
+
external_exports.strictObject({
|
|
30067
|
+
_meta: optionalMetadata,
|
|
30068
|
+
cost: external_exports.strictObject({ _meta: optionalMetadata, amount: external_exports.number().finite(), currency: external_exports.string().max(16) }).readonly().nullable().optional(),
|
|
30069
|
+
sessionUpdate: external_exports.literal("usage_update"),
|
|
30070
|
+
size: external_exports.number().int().nonnegative().safe(),
|
|
30071
|
+
used: external_exports.number().int().nonnegative().safe()
|
|
30072
|
+
}).readonly(),
|
|
30073
|
+
external_exports.strictObject({
|
|
30074
|
+
_meta: optionalMetadata,
|
|
30075
|
+
compactionId: shortString,
|
|
30076
|
+
error: boundedString.nullable().optional(),
|
|
30077
|
+
sessionUpdate: external_exports.literal("compaction_update"),
|
|
30078
|
+
status: shortString,
|
|
30079
|
+
summary: external_exports.array(contentBlockV2Schema).max(MAX_COLLECTION_SIZE).readonly().nullable().optional()
|
|
30080
|
+
}).readonly(),
|
|
30081
|
+
external_exports.strictObject({
|
|
30082
|
+
_meta: optionalMetadata,
|
|
30083
|
+
compactionId: shortString,
|
|
30084
|
+
content: contentBlockV2Schema,
|
|
30085
|
+
sessionUpdate: external_exports.literal("compaction_summary_chunk")
|
|
30086
|
+
}).readonly()
|
|
30087
|
+
]);
|
|
30088
|
+
var lifecycleBase = { commandId: identifierStringSchema };
|
|
30089
|
+
var sessionEventPayloadV2Schema = external_exports.discriminatedUnion("kind", [
|
|
30090
|
+
external_exports.strictObject({ kind: external_exports.literal("acp.session.update"), update: acpSessionUpdateV2Schema }).readonly(),
|
|
30091
|
+
external_exports.strictObject({
|
|
30092
|
+
...lifecycleBase,
|
|
30093
|
+
content: external_exports.array(contentBlockV2Schema).min(1).max(100).readonly(),
|
|
30094
|
+
kind: external_exports.literal("prompt.requested")
|
|
30095
|
+
}).readonly(),
|
|
30096
|
+
external_exports.strictObject({ ...lifecycleBase, attemptId: identifierStringSchema, epoch: identifierStringSchema, kind: external_exports.literal("prompt.started") }).readonly(),
|
|
30097
|
+
external_exports.strictObject({ ...lifecycleBase, kind: external_exports.literal("prompt.completed"), stopReason: shortString }).readonly(),
|
|
30098
|
+
external_exports.strictObject({
|
|
30099
|
+
...lifecycleBase,
|
|
30100
|
+
code: identifierStringSchema,
|
|
30101
|
+
kind: external_exports.literal("prompt.failed-before-start"),
|
|
30102
|
+
message: external_exports.string().min(1).max(500)
|
|
30103
|
+
}).readonly(),
|
|
30104
|
+
external_exports.strictObject({
|
|
30105
|
+
...lifecycleBase,
|
|
30106
|
+
attemptId: identifierStringSchema,
|
|
30107
|
+
code: identifierStringSchema,
|
|
30108
|
+
kind: external_exports.literal("prompt.failed"),
|
|
30109
|
+
message: external_exports.string().min(1).max(500)
|
|
30110
|
+
}).readonly()
|
|
30111
|
+
]);
|
|
30112
|
+
var positionSchema = external_exports.string().regex(/^(0|[1-9][0-9]*)$/);
|
|
30113
|
+
var provenanceSchema = external_exports.discriminatedUnion("kind", [
|
|
30114
|
+
external_exports.strictObject({ kind: external_exports.literal("original") }).readonly(),
|
|
30115
|
+
external_exports.strictObject({
|
|
30116
|
+
kind: external_exports.literal("imported"),
|
|
30117
|
+
sourceEventId: identifierStringSchema,
|
|
30118
|
+
sourcePosition: positionSchema,
|
|
30119
|
+
sourceSessionId: identifierStringSchema
|
|
30120
|
+
}).readonly(),
|
|
30121
|
+
external_exports.strictObject({
|
|
30122
|
+
kind: external_exports.literal("forked"),
|
|
30123
|
+
sourceEventId: identifierStringSchema,
|
|
30124
|
+
sourcePosition: positionSchema,
|
|
30125
|
+
sourceSessionId: identifierStringSchema
|
|
30126
|
+
}).readonly()
|
|
30127
|
+
]);
|
|
30128
|
+
var sessionEventV2Schema = external_exports.strictObject({
|
|
30129
|
+
eventId: identifierStringSchema,
|
|
30130
|
+
payload: sessionEventPayloadV2Schema,
|
|
30131
|
+
position: positionSchema,
|
|
30132
|
+
provenance: provenanceSchema,
|
|
30133
|
+
recordedAt: external_exports.iso.datetime({ offset: true }),
|
|
30134
|
+
sessionId: identifierStringSchema
|
|
30135
|
+
}).readonly();
|
|
30136
|
+
var sessionEventEnvelopeV2Schema = external_exports.strictObject({ event: sessionEventV2Schema, kind: external_exports.literal(SESSION_EVENT_V2_KIND) }).readonly();
|
|
30137
|
+
var sessionEventLogPageV2Schema = external_exports.strictObject({
|
|
30138
|
+
events: external_exports.array(sessionEventV2Schema).max(MAX_EVENT_COUNT).readonly(),
|
|
30139
|
+
nextCursor: external_exports.string().min(1).max(512).nullable(),
|
|
30140
|
+
tailCursor: external_exports.string().max(512),
|
|
30141
|
+
truncated: external_exports.boolean(),
|
|
30142
|
+
version: external_exports.literal(2)
|
|
30143
|
+
}).readonly();
|
|
30144
|
+
var nativeEventPageRequestV2Schema = external_exports.strictObject({ cursor: external_exports.string().min(1).max(512).nullable(), eventLimit: external_exports.number().int().min(1).max(1e4) }).readonly();
|
|
30145
|
+
var executingPromptRequestEventLogV2Schema = external_exports.strictObject({
|
|
30146
|
+
attemptId: identifierStringSchema,
|
|
30147
|
+
commandId: identifierStringSchema,
|
|
30148
|
+
epoch: identifierStringSchema,
|
|
30149
|
+
events: external_exports.array(sessionEventV2Schema).max(MAX_EVENT_COUNT).readonly(),
|
|
30150
|
+
tailCursor: external_exports.string().max(512),
|
|
30151
|
+
truncated: external_exports.boolean()
|
|
30152
|
+
}).readonly();
|
|
30153
|
+
var nativeSessionEventsV2Schema = external_exports.strictObject({
|
|
30154
|
+
executingPromptRequest: executingPromptRequestEventLogV2Schema.nullable(),
|
|
30155
|
+
history: sessionEventLogPageV2Schema
|
|
30156
|
+
}).readonly();
|
|
30157
|
+
function inputValue(value) {
|
|
30158
|
+
if (typeof value !== "string") {
|
|
30159
|
+
return value;
|
|
30160
|
+
}
|
|
30161
|
+
try {
|
|
30162
|
+
return JSON.parse(value);
|
|
30163
|
+
} catch (cause) {
|
|
30164
|
+
throw new ProtocolMessageError("Session Event Log V2 message is not valid JSON", { cause });
|
|
30165
|
+
}
|
|
30166
|
+
}
|
|
30167
|
+
function decode5(value, schema) {
|
|
30168
|
+
const result = schema.safeParse(inputValue(value));
|
|
30169
|
+
if (!result.success) {
|
|
30170
|
+
throw new ProtocolMessageError("Session Event Log V2 message does not match its schema", {
|
|
30171
|
+
cause: result.error
|
|
30172
|
+
});
|
|
30173
|
+
}
|
|
30174
|
+
return result.data;
|
|
30175
|
+
}
|
|
30176
|
+
function encode4(value, schema) {
|
|
30177
|
+
return JSON.stringify(decode5(value, schema));
|
|
30178
|
+
}
|
|
30179
|
+
var decodeSessionEventV2 = (value) => decode5(value, sessionEventV2Schema);
|
|
30180
|
+
var decodeSessionEventEnvelopeV2 = (value) => decode5(value, sessionEventEnvelopeV2Schema);
|
|
30181
|
+
var encodeSessionEventEnvelopeV2 = (value) => encode4(value, sessionEventEnvelopeV2Schema);
|
|
30182
|
+
var decodeAcpSessionUpdateV2 = (value) => decode5(value, acpSessionUpdateV2Schema);
|
|
30183
|
+
|
|
29807
30184
|
// ../protocol/src/session-events.ts
|
|
29808
30185
|
var SESSION_EVENT_KIND = "session.event";
|
|
29809
30186
|
var SESSION_FORKED_KIND = "session.forked";
|
|
@@ -29821,7 +30198,7 @@ var sessionForkedSchema = external_exports.strictObject({
|
|
|
29821
30198
|
sourceSessionId: identifierStringSchema,
|
|
29822
30199
|
throughCommandId: identifierStringSchema
|
|
29823
30200
|
}).readonly();
|
|
29824
|
-
function
|
|
30201
|
+
function decode6(encoded, schema) {
|
|
29825
30202
|
let value;
|
|
29826
30203
|
try {
|
|
29827
30204
|
value = JSON.parse(encoded);
|
|
@@ -29836,7 +30213,7 @@ function decode5(encoded, schema) {
|
|
|
29836
30213
|
}
|
|
29837
30214
|
return decoded.data;
|
|
29838
30215
|
}
|
|
29839
|
-
var
|
|
30216
|
+
var encode5 = (message, schema) => {
|
|
29840
30217
|
const decoded = schema.safeParse(message);
|
|
29841
30218
|
if (!decoded.success) {
|
|
29842
30219
|
throw new ProtocolMessageError("Message does not match its schema", {
|
|
@@ -29845,15 +30222,15 @@ var encode4 = (message, schema) => {
|
|
|
29845
30222
|
}
|
|
29846
30223
|
return JSON.stringify(decoded.data);
|
|
29847
30224
|
};
|
|
29848
|
-
var decodeSessionEventEnvelope = (encoded) =>
|
|
29849
|
-
var encodeSessionEventEnvelope = (message) =>
|
|
30225
|
+
var decodeSessionEventEnvelope = (encoded) => decode6(encoded, sessionEventEnvelopeSchema);
|
|
30226
|
+
var encodeSessionEventEnvelope = (message) => encode5(message, sessionEventEnvelopeSchema);
|
|
29850
30227
|
function decodeRecordedSessionEvent(encoded) {
|
|
29851
30228
|
const kind = decodeMessageKind(encoded);
|
|
29852
30229
|
switch (kind) {
|
|
29853
30230
|
case SESSION_QUEUE_CHANGED_KIND:
|
|
29854
|
-
return
|
|
30231
|
+
return decode6(encoded, sessionQueueChangedSchema);
|
|
29855
30232
|
case SESSION_FORKED_KIND:
|
|
29856
|
-
return
|
|
30233
|
+
return decode6(encoded, sessionForkedSchema);
|
|
29857
30234
|
case AGENT_ACTIVITY_KIND:
|
|
29858
30235
|
return decodeAgentActivityEvent(encoded);
|
|
29859
30236
|
case AGENT_ACTIVITY_NARRATION_KIND:
|
|
@@ -29897,6 +30274,8 @@ var SESSION_LIVE_HISTORY_LOAD_KIND = "session.live-history.load";
|
|
|
29897
30274
|
var SESSION_LIVE_HISTORY_LOADED_KIND = "session.live-history.loaded";
|
|
29898
30275
|
var SESSION_LIVE_HISTORY_PAGE_LOAD_KIND = "session.live-history.page.load";
|
|
29899
30276
|
var SESSION_LIVE_HISTORY_PAGE_LOADED_KIND = "session.live-history.page.loaded";
|
|
30277
|
+
var SESSION_LIVE_HISTORY_V2_PAGE_LOAD_KIND = "session.live-history.v2.page.load";
|
|
30278
|
+
var SESSION_LIVE_HISTORY_V2_PAGE_LOADED_KIND = "session.live-history.v2.page.loaded";
|
|
29900
30279
|
var directoryIdentifier = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/);
|
|
29901
30280
|
var sessionLiveHistoryLoadSchema = external_exports.strictObject({
|
|
29902
30281
|
additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
|
|
@@ -29930,7 +30309,24 @@ var sessionLiveHistoryPageLoadedSchema = external_exports.strictObject({
|
|
|
29930
30309
|
requestId: identifierStringSchema,
|
|
29931
30310
|
sessionId: identifierStringSchema
|
|
29932
30311
|
}).readonly();
|
|
29933
|
-
|
|
30312
|
+
var sessionLiveHistoryV2PageLoadSchema = external_exports.strictObject({
|
|
30313
|
+
additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
|
|
30314
|
+
agentId: identifierStringSchema,
|
|
30315
|
+
bindingId: identifierStringSchema,
|
|
30316
|
+
cursor: external_exports.string().min(1).max(512).nullable(),
|
|
30317
|
+
directoryId: directoryIdentifier,
|
|
30318
|
+
kind: external_exports.literal(SESSION_LIVE_HISTORY_V2_PAGE_LOAD_KIND),
|
|
30319
|
+
eventLimit: external_exports.number().int().min(1).max(1e4),
|
|
30320
|
+
requestId: identifierStringSchema,
|
|
30321
|
+
sessionId: identifierStringSchema
|
|
30322
|
+
}).readonly();
|
|
30323
|
+
var sessionLiveHistoryV2PageLoadedSchema = external_exports.strictObject({
|
|
30324
|
+
events: nativeSessionEventsV2Schema,
|
|
30325
|
+
kind: external_exports.literal(SESSION_LIVE_HISTORY_V2_PAGE_LOADED_KIND),
|
|
30326
|
+
requestId: identifierStringSchema,
|
|
30327
|
+
sessionId: identifierStringSchema
|
|
30328
|
+
}).readonly();
|
|
30329
|
+
function decode7(schema, encoded) {
|
|
29934
30330
|
try {
|
|
29935
30331
|
const value = JSON.parse(encoded);
|
|
29936
30332
|
return schema.parse(value);
|
|
@@ -29938,14 +30334,18 @@ function decode6(schema, encoded) {
|
|
|
29938
30334
|
throw new ProtocolMessageError("Invalid live Session history message", { cause });
|
|
29939
30335
|
}
|
|
29940
30336
|
}
|
|
29941
|
-
var decodeSessionLiveHistoryLoad = (encoded) =>
|
|
29942
|
-
var decodeSessionLiveHistoryLoaded = (encoded) =>
|
|
30337
|
+
var decodeSessionLiveHistoryLoad = (encoded) => decode7(sessionLiveHistoryLoadSchema, encoded);
|
|
30338
|
+
var decodeSessionLiveHistoryLoaded = (encoded) => decode7(sessionLiveHistoryLoadedSchema, encoded);
|
|
29943
30339
|
var encodeSessionLiveHistoryLoad = (value) => JSON.stringify(sessionLiveHistoryLoadSchema.parse(value));
|
|
29944
30340
|
var encodeSessionLiveHistoryLoaded = (value) => JSON.stringify(sessionLiveHistoryLoadedSchema.parse(value));
|
|
29945
|
-
var decodeSessionLiveHistoryPageLoad = (encoded) =>
|
|
29946
|
-
var decodeSessionLiveHistoryPageLoaded = (encoded) =>
|
|
30341
|
+
var decodeSessionLiveHistoryPageLoad = (encoded) => decode7(sessionLiveHistoryPageLoadSchema, encoded);
|
|
30342
|
+
var decodeSessionLiveHistoryPageLoaded = (encoded) => decode7(sessionLiveHistoryPageLoadedSchema, encoded);
|
|
29947
30343
|
var encodeSessionLiveHistoryPageLoad = (value) => JSON.stringify(sessionLiveHistoryPageLoadSchema.parse(value));
|
|
29948
30344
|
var encodeSessionLiveHistoryPageLoaded = (value) => JSON.stringify(sessionLiveHistoryPageLoadedSchema.parse(value));
|
|
30345
|
+
var decodeSessionLiveHistoryV2PageLoad = (encoded) => decode7(sessionLiveHistoryV2PageLoadSchema, encoded);
|
|
30346
|
+
var decodeSessionLiveHistoryV2PageLoaded = (encoded) => decode7(sessionLiveHistoryV2PageLoadedSchema, encoded);
|
|
30347
|
+
var encodeSessionLiveHistoryV2PageLoad = (value) => JSON.stringify(sessionLiveHistoryV2PageLoadSchema.parse(value));
|
|
30348
|
+
var encodeSessionLiveHistoryV2PageLoaded = (value) => JSON.stringify(sessionLiveHistoryV2PageLoadedSchema.parse(value));
|
|
29949
30349
|
|
|
29950
30350
|
// ../protocol/src/daemon-transport.ts
|
|
29951
30351
|
function defineMessageSignature(kind, encoder, decoder) {
|
|
@@ -30030,6 +30430,11 @@ var serviceToDaemonSignatures = {
|
|
|
30030
30430
|
encodeSessionLiveHistoryPageLoad,
|
|
30031
30431
|
decodeSessionLiveHistoryPageLoad
|
|
30032
30432
|
),
|
|
30433
|
+
[SESSION_LIVE_HISTORY_V2_PAGE_LOAD_KIND]: defineMessageSignature(
|
|
30434
|
+
SESSION_LIVE_HISTORY_V2_PAGE_LOAD_KIND,
|
|
30435
|
+
encodeSessionLiveHistoryV2PageLoad,
|
|
30436
|
+
decodeSessionLiveHistoryV2PageLoad
|
|
30437
|
+
),
|
|
30033
30438
|
[SESSION_PERMISSION_RESPOND_KIND]: defineMessageSignature(
|
|
30034
30439
|
SESSION_PERMISSION_RESPOND_KIND,
|
|
30035
30440
|
encodeSessionPermissionRespondCommand,
|
|
@@ -30145,6 +30550,11 @@ var daemonToServiceSignatures = {
|
|
|
30145
30550
|
encodeSessionEventEnvelope,
|
|
30146
30551
|
decodeSessionEventEnvelope
|
|
30147
30552
|
),
|
|
30553
|
+
[SESSION_EVENT_V2_KIND]: defineMessageSignature(
|
|
30554
|
+
SESSION_EVENT_V2_KIND,
|
|
30555
|
+
encodeSessionEventEnvelopeV2,
|
|
30556
|
+
decodeSessionEventEnvelopeV2
|
|
30557
|
+
),
|
|
30148
30558
|
[SESSION_OPERATION_FAILED_KIND]: defineMessageSignature(
|
|
30149
30559
|
SESSION_OPERATION_FAILED_KIND,
|
|
30150
30560
|
encodeSessionOperationFailedEvent,
|
|
@@ -30160,6 +30570,11 @@ var daemonToServiceSignatures = {
|
|
|
30160
30570
|
encodeSessionLiveHistoryPageLoaded,
|
|
30161
30571
|
decodeSessionLiveHistoryPageLoaded
|
|
30162
30572
|
),
|
|
30573
|
+
[SESSION_LIVE_HISTORY_V2_PAGE_LOADED_KIND]: defineMessageSignature(
|
|
30574
|
+
SESSION_LIVE_HISTORY_V2_PAGE_LOADED_KIND,
|
|
30575
|
+
encodeSessionLiveHistoryV2PageLoaded,
|
|
30576
|
+
decodeSessionLiveHistoryV2PageLoaded
|
|
30577
|
+
),
|
|
30163
30578
|
[SESSION_READY_KIND]: defineMessageSignature(SESSION_READY_KIND, encodeSessionReadyEvent, decodeSessionReadyEvent),
|
|
30164
30579
|
[WORKSPACE_ENTRIES_KIND]: defineMessageSignature(
|
|
30165
30580
|
WORKSPACE_ENTRIES_KIND,
|
|
@@ -30244,7 +30659,7 @@ function createDaemonConfig(connection, agents = [], installableAgents = [], loc
|
|
|
30244
30659
|
|
|
30245
30660
|
// src/daemon-manager.ts
|
|
30246
30661
|
import { spawn as spawn6 } from "node:child_process";
|
|
30247
|
-
import { createHash as
|
|
30662
|
+
import { createHash as createHash8, randomBytes } from "node:crypto";
|
|
30248
30663
|
import { readFile as readFile3, unlink as unlink2, writeFile as writeFile4 } from "node:fs/promises";
|
|
30249
30664
|
import { createConnection, createServer } from "node:net";
|
|
30250
30665
|
import { tmpdir } from "node:os";
|
|
@@ -30579,16 +30994,16 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
|
|
|
30579
30994
|
};
|
|
30580
30995
|
#readConnectionForChannel = async (channelId, signal) => {
|
|
30581
30996
|
const normalizedChannelId = validateIdentifier(channelId, "invalid_channel_id");
|
|
30582
|
-
const
|
|
30997
|
+
const index2 = decodeChannelIndex(
|
|
30583
30998
|
await readJsonFile(this.channelIndexPath(normalizedChannelId), signal, "connection_not_found")
|
|
30584
30999
|
);
|
|
30585
|
-
if (
|
|
31000
|
+
if (index2.applicationId !== this.applicationId || index2.installationId !== this.installationId || index2.channelId !== normalizedChannelId) {
|
|
30586
31001
|
throw new RuntimeInstallationStoreError(
|
|
30587
31002
|
"connection_owner_mismatch",
|
|
30588
31003
|
"The saved Runtime connection belongs to another installation"
|
|
30589
31004
|
);
|
|
30590
31005
|
}
|
|
30591
|
-
return await this.readConnection(
|
|
31006
|
+
return await this.readConnection(index2.connectionId, signal);
|
|
30592
31007
|
};
|
|
30593
31008
|
saveConnection = async (input2, signal) => {
|
|
30594
31009
|
const stored = new VerifiedRuntimeConnection(
|
|
@@ -30783,16 +31198,16 @@ function hasExactKeys2(value, expectedKeys) {
|
|
|
30783
31198
|
}
|
|
30784
31199
|
function readSingleOption(arguments_, option) {
|
|
30785
31200
|
const values = [];
|
|
30786
|
-
for (let
|
|
30787
|
-
if (arguments_[
|
|
31201
|
+
for (let index2 = 0; index2 < arguments_.length; index2 += 1) {
|
|
31202
|
+
if (arguments_[index2] !== option) {
|
|
30788
31203
|
continue;
|
|
30789
31204
|
}
|
|
30790
|
-
const value = arguments_[
|
|
31205
|
+
const value = arguments_[index2 + 1];
|
|
30791
31206
|
if (value === void 0 || value.startsWith("--")) {
|
|
30792
31207
|
throw new PairingClientError("invalid_arguments", `${option} requires a value`);
|
|
30793
31208
|
}
|
|
30794
31209
|
values.push(value);
|
|
30795
|
-
|
|
31210
|
+
index2 += 1;
|
|
30796
31211
|
}
|
|
30797
31212
|
if (values.length !== 1) {
|
|
30798
31213
|
throw new PairingClientError("invalid_arguments", `${option} must be provided exactly once`);
|
|
@@ -30800,8 +31215,8 @@ function readSingleOption(arguments_, option) {
|
|
|
30800
31215
|
return values[0] ?? "";
|
|
30801
31216
|
}
|
|
30802
31217
|
function assertKnownArguments(arguments_) {
|
|
30803
|
-
for (let
|
|
30804
|
-
const option = arguments_[
|
|
31218
|
+
for (let index2 = 0; index2 < arguments_.length; index2 += 2) {
|
|
31219
|
+
const option = arguments_[index2];
|
|
30805
31220
|
if (option !== "--url" && option !== "--code" && option !== "--pairing" && option !== "--workspace") {
|
|
30806
31221
|
throw new PairingClientError("invalid_arguments", `Unknown pairing option: ${option ?? "missing option"}`);
|
|
30807
31222
|
}
|
|
@@ -31078,7 +31493,7 @@ var AuditStore = class {
|
|
|
31078
31493
|
};
|
|
31079
31494
|
|
|
31080
31495
|
// src/run-daemon.ts
|
|
31081
|
-
import { createHash as
|
|
31496
|
+
import { createHash as createHash7, randomUUID as randomUUID7 } from "node:crypto";
|
|
31082
31497
|
import { join as join18 } from "node:path";
|
|
31083
31498
|
import { styleText } from "node:util";
|
|
31084
31499
|
|
|
@@ -31201,7 +31616,7 @@ function startsWith(bytes, signature, offset = 0) {
|
|
|
31201
31616
|
if (bytes.byteLength < offset + signature.byteLength) {
|
|
31202
31617
|
return false;
|
|
31203
31618
|
}
|
|
31204
|
-
return signature.every((value,
|
|
31619
|
+
return signature.every((value, index2) => bytes[offset + index2] === value);
|
|
31205
31620
|
}
|
|
31206
31621
|
function sniffRasterMime(bytes) {
|
|
31207
31622
|
if (startsWith(bytes, PNG_SIGNATURE)) {
|
|
@@ -31329,7 +31744,7 @@ function startsWith2(bytes, signature, offset = 0) {
|
|
|
31329
31744
|
if (bytes.byteLength < offset + signature.byteLength) {
|
|
31330
31745
|
return false;
|
|
31331
31746
|
}
|
|
31332
|
-
return signature.every((value,
|
|
31747
|
+
return signature.every((value, index2) => bytes[offset + index2] === value);
|
|
31333
31748
|
}
|
|
31334
31749
|
function sniffVideoMime(bytes) {
|
|
31335
31750
|
if (startsWith2(bytes, MP4_FILE_TYPE, 4)) {
|
|
@@ -31458,10 +31873,10 @@ async function replaceImageMarkers(text2, replace) {
|
|
|
31458
31873
|
let cursor = 0;
|
|
31459
31874
|
let rewritten = "";
|
|
31460
31875
|
for (const match of matches) {
|
|
31461
|
-
const
|
|
31462
|
-
rewritten += text2.slice(cursor,
|
|
31876
|
+
const index2 = match.index ?? 0;
|
|
31877
|
+
rewritten += text2.slice(cursor, index2);
|
|
31463
31878
|
rewritten += await replace(match[1] ?? "");
|
|
31464
|
-
cursor =
|
|
31879
|
+
cursor = index2 + match[0].length;
|
|
31465
31880
|
}
|
|
31466
31881
|
return `${rewritten}${text2.slice(cursor)}`;
|
|
31467
31882
|
}
|
|
@@ -32627,6 +33042,7 @@ function sessionConfigProtocolForAgent(_agentId) {
|
|
|
32627
33042
|
|
|
32628
33043
|
// src/acp/session-contracts.ts
|
|
32629
33044
|
var NullAcpSessionObserver = class {
|
|
33045
|
+
onAcpUpdate = (_sessionId, _update) => Promise.resolve();
|
|
32630
33046
|
onCommands = () => Promise.resolve();
|
|
32631
33047
|
onConfig = () => Promise.resolve();
|
|
32632
33048
|
onContent = () => Promise.resolve();
|
|
@@ -32694,6 +33110,7 @@ function historyContentCharacters(messages) {
|
|
|
32694
33110
|
var AcpHistoryReplay = class {
|
|
32695
33111
|
#activities = /* @__PURE__ */ new Map();
|
|
32696
33112
|
#messages = [];
|
|
33113
|
+
#updates = [];
|
|
32697
33114
|
#turnActivityIds = /* @__PURE__ */ new Set();
|
|
32698
33115
|
#activityTracker = new AcpActivityTracker(
|
|
32699
33116
|
async (activity2) => {
|
|
@@ -32715,7 +33132,8 @@ var AcpHistoryReplay = class {
|
|
|
32715
33132
|
#firstMessageIndex = 0;
|
|
32716
33133
|
#characters = 0;
|
|
32717
33134
|
#truncated = false;
|
|
32718
|
-
record = async (update) => {
|
|
33135
|
+
record = async (update, rawUpdate) => {
|
|
33136
|
+
this.#updates.push(rawUpdate);
|
|
32719
33137
|
if (update.sessionUpdate === "agent_thought_chunk") {
|
|
32720
33138
|
if (update.content.type === "text") {
|
|
32721
33139
|
await this.#activityTracker.recordNarrative(
|
|
@@ -32796,6 +33214,20 @@ var AcpHistoryReplay = class {
|
|
|
32796
33214
|
this.#lastMessageId = id;
|
|
32797
33215
|
this.trimMessages();
|
|
32798
33216
|
};
|
|
33217
|
+
eventPage = (eventLimit, cursor) => {
|
|
33218
|
+
const parsedCursor = cursor === null ? this.#updates.length : Number(cursor);
|
|
33219
|
+
if (!Number.isSafeInteger(parsedCursor) || parsedCursor < 0 || parsedCursor > this.#updates.length) {
|
|
33220
|
+
throw new Error("The native event cursor is invalid");
|
|
33221
|
+
}
|
|
33222
|
+
const endUpdate = parsedCursor;
|
|
33223
|
+
const startUpdate = Math.max(0, endUpdate - eventLimit);
|
|
33224
|
+
return {
|
|
33225
|
+
nextCursor: startUpdate === 0 ? null : startUpdate.toString(),
|
|
33226
|
+
startPosition: startUpdate + 1,
|
|
33227
|
+
truncated: startUpdate > 0,
|
|
33228
|
+
updates: this.#updates.slice(startUpdate, endUpdate)
|
|
33229
|
+
};
|
|
33230
|
+
};
|
|
32799
33231
|
snapshot = async () => {
|
|
32800
33232
|
await this.#activityTracker.finish();
|
|
32801
33233
|
const messages = this.#messages.slice(this.#firstMessageIndex).map((message) => {
|
|
@@ -34783,8 +35215,8 @@ function haveSameKeys(left, right) {
|
|
|
34783
35215
|
if (leftKeys.length !== rightKeys.length) {
|
|
34784
35216
|
return false;
|
|
34785
35217
|
}
|
|
34786
|
-
for (const [
|
|
34787
|
-
if (key !== rightKeys[
|
|
35218
|
+
for (const [index2, key] of leftKeys.entries()) {
|
|
35219
|
+
if (key !== rightKeys[index2]) {
|
|
34788
35220
|
return false;
|
|
34789
35221
|
}
|
|
34790
35222
|
}
|
|
@@ -35972,6 +36404,55 @@ var sqliteTable = (name, columns, extraConfig) => {
|
|
|
35972
36404
|
return sqliteTableBase(name, columns, extraConfig);
|
|
35973
36405
|
};
|
|
35974
36406
|
|
|
36407
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@5.20260918.1_@types+better-sqlite3@7.6.13_better-sqlite3@12.4.1/node_modules/drizzle-orm/sqlite-core/indexes.js
|
|
36408
|
+
var IndexBuilderOn = class {
|
|
36409
|
+
constructor(name, unique) {
|
|
36410
|
+
this.name = name;
|
|
36411
|
+
this.unique = unique;
|
|
36412
|
+
}
|
|
36413
|
+
static [entityKind] = "SQLiteIndexBuilderOn";
|
|
36414
|
+
on(...columns) {
|
|
36415
|
+
return new IndexBuilder(this.name, columns, this.unique);
|
|
36416
|
+
}
|
|
36417
|
+
};
|
|
36418
|
+
var IndexBuilder = class {
|
|
36419
|
+
static [entityKind] = "SQLiteIndexBuilder";
|
|
36420
|
+
/** @internal */
|
|
36421
|
+
config;
|
|
36422
|
+
constructor(name, columns, unique) {
|
|
36423
|
+
this.config = {
|
|
36424
|
+
name,
|
|
36425
|
+
columns,
|
|
36426
|
+
unique,
|
|
36427
|
+
where: void 0
|
|
36428
|
+
};
|
|
36429
|
+
}
|
|
36430
|
+
/**
|
|
36431
|
+
* Condition for partial index.
|
|
36432
|
+
*/
|
|
36433
|
+
where(condition) {
|
|
36434
|
+
this.config.where = condition;
|
|
36435
|
+
return this;
|
|
36436
|
+
}
|
|
36437
|
+
/** @internal */
|
|
36438
|
+
build(table) {
|
|
36439
|
+
return new Index(this.config, table);
|
|
36440
|
+
}
|
|
36441
|
+
};
|
|
36442
|
+
var Index = class {
|
|
36443
|
+
static [entityKind] = "SQLiteIndex";
|
|
36444
|
+
config;
|
|
36445
|
+
constructor(config2, table) {
|
|
36446
|
+
this.config = { ...config2, table };
|
|
36447
|
+
}
|
|
36448
|
+
};
|
|
36449
|
+
function index(name) {
|
|
36450
|
+
return new IndexBuilderOn(name, false);
|
|
36451
|
+
}
|
|
36452
|
+
function uniqueIndex(name) {
|
|
36453
|
+
return new IndexBuilderOn(name, true);
|
|
36454
|
+
}
|
|
36455
|
+
|
|
35975
36456
|
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@5.20260918.1_@types+better-sqlite3@7.6.13_better-sqlite3@12.4.1/node_modules/drizzle-orm/sqlite-core/utils.js
|
|
35976
36457
|
function extractUsedTable(table) {
|
|
35977
36458
|
if (is(table, SQLiteTable)) {
|
|
@@ -36320,8 +36801,8 @@ var SQLiteDialect = class {
|
|
|
36320
36801
|
}
|
|
36321
36802
|
const joinsArray = [];
|
|
36322
36803
|
if (joins) {
|
|
36323
|
-
for (const [
|
|
36324
|
-
if (
|
|
36804
|
+
for (const [index2, joinMeta] of joins.entries()) {
|
|
36805
|
+
if (index2 === 0) {
|
|
36325
36806
|
joinsArray.push(sql` `);
|
|
36326
36807
|
}
|
|
36327
36808
|
const table = joinMeta.table;
|
|
@@ -36341,7 +36822,7 @@ var SQLiteDialect = class {
|
|
|
36341
36822
|
sql`${sql.raw(joinMeta.joinType)} join ${table}${onSql}`
|
|
36342
36823
|
);
|
|
36343
36824
|
}
|
|
36344
|
-
if (
|
|
36825
|
+
if (index2 < joins.length - 1) {
|
|
36345
36826
|
joinsArray.push(sql` `);
|
|
36346
36827
|
}
|
|
36347
36828
|
}
|
|
@@ -36354,9 +36835,9 @@ var SQLiteDialect = class {
|
|
|
36354
36835
|
buildOrderBy(orderBy) {
|
|
36355
36836
|
const orderByList = [];
|
|
36356
36837
|
if (orderBy) {
|
|
36357
|
-
for (const [
|
|
36838
|
+
for (const [index2, orderByValue] of orderBy.entries()) {
|
|
36358
36839
|
orderByList.push(orderByValue);
|
|
36359
|
-
if (
|
|
36840
|
+
if (index2 < orderBy.length - 1) {
|
|
36360
36841
|
orderByList.push(sql`, `);
|
|
36361
36842
|
}
|
|
36362
36843
|
}
|
|
@@ -36409,9 +36890,9 @@ var SQLiteDialect = class {
|
|
|
36409
36890
|
const havingSql = having ? sql` having ${having}` : void 0;
|
|
36410
36891
|
const groupByList = [];
|
|
36411
36892
|
if (groupBy) {
|
|
36412
|
-
for (const [
|
|
36893
|
+
for (const [index2, groupByValue] of groupBy.entries()) {
|
|
36413
36894
|
groupByList.push(groupByValue);
|
|
36414
|
-
if (
|
|
36895
|
+
if (index2 < groupBy.length - 1) {
|
|
36415
36896
|
groupByList.push(sql`, `);
|
|
36416
36897
|
}
|
|
36417
36898
|
}
|
|
@@ -38825,6 +39306,10 @@ var acpSessionStoreMigrations = [
|
|
|
38825
39306
|
{
|
|
38826
39307
|
"name": "0001_regular_ultimates.sql",
|
|
38827
39308
|
"sql": "ALTER TABLE `acp_session` ADD `last_terminal_command_id` text;"
|
|
39309
|
+
},
|
|
39310
|
+
{
|
|
39311
|
+
"name": "0002_equal_black_queen.sql",
|
|
39312
|
+
"sql": "CREATE TABLE `session_event_v2` (\n `event_id` text PRIMARY KEY NOT NULL,\n `event_json` text NOT NULL,\n `position` integer NOT NULL,\n `session_id` text NOT NULL\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX `session_event_v2_session_position_unique` ON `session_event_v2` (`session_id`,`position`);--> statement-breakpoint\nCREATE INDEX `session_event_v2_session_position_index` ON `session_event_v2` (`session_id`,`position`);"
|
|
38828
39313
|
}
|
|
38829
39314
|
];
|
|
38830
39315
|
|
|
@@ -38832,7 +39317,8 @@ var acpSessionStoreMigrations = [
|
|
|
38832
39317
|
var acp_session_store_exports = {};
|
|
38833
39318
|
__export(acp_session_store_exports, {
|
|
38834
39319
|
acpSession: () => acpSession,
|
|
38835
|
-
deletedAcpSession: () => deletedAcpSession
|
|
39320
|
+
deletedAcpSession: () => deletedAcpSession,
|
|
39321
|
+
sessionEventV2: () => sessionEventV2
|
|
38836
39322
|
});
|
|
38837
39323
|
|
|
38838
39324
|
// src/schema/acp-session-store/acp-session.ts
|
|
@@ -38853,6 +39339,21 @@ var deletedAcpSession = sqliteTable("deleted_acp_session", {
|
|
|
38853
39339
|
sessionId: text("session_id").primaryKey()
|
|
38854
39340
|
});
|
|
38855
39341
|
|
|
39342
|
+
// src/schema/acp-session-store/session-event-v2.ts
|
|
39343
|
+
var sessionEventV2 = sqliteTable(
|
|
39344
|
+
"session_event_v2",
|
|
39345
|
+
{
|
|
39346
|
+
eventId: text("event_id").primaryKey(),
|
|
39347
|
+
eventJson: text("event_json").notNull(),
|
|
39348
|
+
position: integer2("position").notNull(),
|
|
39349
|
+
sessionId: text("session_id").notNull()
|
|
39350
|
+
},
|
|
39351
|
+
(table) => [
|
|
39352
|
+
uniqueIndex("session_event_v2_session_position_unique").on(table.sessionId, table.position),
|
|
39353
|
+
index("session_event_v2_session_position_index").on(table.sessionId, table.position)
|
|
39354
|
+
]
|
|
39355
|
+
);
|
|
39356
|
+
|
|
38856
39357
|
// src/acp/session-store.ts
|
|
38857
39358
|
var AcpStoredSession = class {
|
|
38858
39359
|
additionalDirectories;
|
|
@@ -38895,9 +39396,14 @@ var DeletedAcpStoredSession = class extends AcpStoredSessionLookup {
|
|
|
38895
39396
|
var MemoryAcpSessionStore = class {
|
|
38896
39397
|
#sessions = /* @__PURE__ */ new Map();
|
|
38897
39398
|
#deleted = /* @__PURE__ */ new Set();
|
|
39399
|
+
#eventsV2 = /* @__PURE__ */ new Map();
|
|
39400
|
+
appendEventV2 = (event) => {
|
|
39401
|
+
this.#eventsV2.set(event.sessionId, [...this.#eventsV2.get(event.sessionId) ?? [], event]);
|
|
39402
|
+
};
|
|
38898
39403
|
close = () => {
|
|
38899
39404
|
this.#sessions.clear();
|
|
38900
39405
|
this.#deleted.clear();
|
|
39406
|
+
this.#eventsV2.clear();
|
|
38901
39407
|
};
|
|
38902
39408
|
findNative = (agentId, nativeSessionId) => [...this.#sessions.values()].filter(
|
|
38903
39409
|
(session) => session.agentId === agentId && session.nativeSessionId === nativeSessionId
|
|
@@ -38908,6 +39414,7 @@ var MemoryAcpSessionStore = class {
|
|
|
38908
39414
|
for (const id of ids) {
|
|
38909
39415
|
this.#sessions.delete(id);
|
|
38910
39416
|
this.#deleted.add(id);
|
|
39417
|
+
this.#eventsV2.delete(id);
|
|
38911
39418
|
}
|
|
38912
39419
|
return ids;
|
|
38913
39420
|
};
|
|
@@ -38920,7 +39427,9 @@ var MemoryAcpSessionStore = class {
|
|
|
38920
39427
|
};
|
|
38921
39428
|
remove = (sessionId) => {
|
|
38922
39429
|
this.#sessions.delete(sessionId);
|
|
39430
|
+
this.#eventsV2.delete(sessionId);
|
|
38923
39431
|
};
|
|
39432
|
+
readEventsV2 = (sessionId) => this.#eventsV2.get(sessionId) ?? [];
|
|
38924
39433
|
write = (session) => {
|
|
38925
39434
|
this.#sessions.set(session.sessionId, session);
|
|
38926
39435
|
};
|
|
@@ -38969,15 +39478,15 @@ var SqliteAcpSessionStore = class {
|
|
|
38969
39478
|
this.#sqliteDatabase.close();
|
|
38970
39479
|
throw new Error("The ACP Session database was created by a newer Mobius version");
|
|
38971
39480
|
}
|
|
38972
|
-
for (let
|
|
38973
|
-
const migration = acpSessionStoreMigrations[
|
|
39481
|
+
for (let index2 = version3; index2 < acpSessionStoreMigrations.length; index2 += 1) {
|
|
39482
|
+
const migration = acpSessionStoreMigrations[index2];
|
|
38974
39483
|
if (migration === void 0) {
|
|
38975
39484
|
throw new Error("The ACP Session migration is unavailable");
|
|
38976
39485
|
}
|
|
38977
39486
|
this.#sqliteDatabase.exec("BEGIN IMMEDIATE");
|
|
38978
39487
|
try {
|
|
38979
39488
|
this.#sqliteDatabase.exec(migration.sql);
|
|
38980
|
-
this.#sqliteDatabase.pragma(`user_version = ${
|
|
39489
|
+
this.#sqliteDatabase.pragma(`user_version = ${index2 + 1}`);
|
|
38981
39490
|
this.#sqliteDatabase.exec("COMMIT");
|
|
38982
39491
|
} catch (error62) {
|
|
38983
39492
|
this.#sqliteDatabase.exec("ROLLBACK");
|
|
@@ -38988,6 +39497,14 @@ var SqliteAcpSessionStore = class {
|
|
|
38988
39497
|
close = () => {
|
|
38989
39498
|
this.#sqliteDatabase.close();
|
|
38990
39499
|
};
|
|
39500
|
+
appendEventV2 = (event) => {
|
|
39501
|
+
this.#database.insert(sessionEventV2).values({
|
|
39502
|
+
eventId: event.eventId,
|
|
39503
|
+
eventJson: JSON.stringify(event),
|
|
39504
|
+
position: Number(event.position),
|
|
39505
|
+
sessionId: event.sessionId
|
|
39506
|
+
}).run();
|
|
39507
|
+
};
|
|
38991
39508
|
findNative = (agentId, nativeSessionId) => this.#database.select().from(acpSession).where(and(eq(acpSession.agentId, agentId), eq(acpSession.nativeSessionId, nativeSessionId))).all().map(decodeStoredSession);
|
|
38992
39509
|
list = () => this.#database.select().from(acpSession).orderBy(desc(acpSession.updatedAt)).all().map(decodeStoredSession);
|
|
38993
39510
|
markDeleted = (agentId, nativeSessionId) => {
|
|
@@ -38996,6 +39513,7 @@ var SqliteAcpSessionStore = class {
|
|
|
38996
39513
|
transaction.delete(acpSession).where(and(eq(acpSession.agentId, agentId), eq(acpSession.nativeSessionId, nativeSessionId))).run();
|
|
38997
39514
|
for (const id of ids) {
|
|
38998
39515
|
transaction.insert(deletedAcpSession).values({ sessionId: id }).onConflictDoNothing().run();
|
|
39516
|
+
transaction.delete(sessionEventV2).where(eq(sessionEventV2.sessionId, id)).run();
|
|
38999
39517
|
}
|
|
39000
39518
|
});
|
|
39001
39519
|
return ids;
|
|
@@ -39009,8 +39527,12 @@ var SqliteAcpSessionStore = class {
|
|
|
39009
39527
|
const row = this.#database.select().from(acpSession).where(eq(acpSession.sessionId, sessionId)).get();
|
|
39010
39528
|
return row === void 0 ? new MissingAcpStoredSession() : new FoundAcpStoredSession(decodeStoredSession(row));
|
|
39011
39529
|
};
|
|
39530
|
+
readEventsV2 = (sessionId) => this.#database.select({ eventJson: sessionEventV2.eventJson }).from(sessionEventV2).where(eq(sessionEventV2.sessionId, sessionId)).orderBy(asc(sessionEventV2.position)).all().map((row) => decodeSessionEventV2(row.eventJson));
|
|
39012
39531
|
remove = (sessionId) => {
|
|
39013
|
-
this.#database.
|
|
39532
|
+
this.#database.transaction((transaction) => {
|
|
39533
|
+
transaction.delete(acpSession).where(eq(acpSession.sessionId, sessionId)).run();
|
|
39534
|
+
transaction.delete(sessionEventV2).where(eq(sessionEventV2.sessionId, sessionId)).run();
|
|
39535
|
+
});
|
|
39014
39536
|
};
|
|
39015
39537
|
write = (session) => {
|
|
39016
39538
|
const value = {
|
|
@@ -39043,7 +39565,7 @@ var RetryableAcpInitializationError = class extends AcpExecutionError {
|
|
|
39043
39565
|
}
|
|
39044
39566
|
};
|
|
39045
39567
|
function arraysEqual(left, right) {
|
|
39046
|
-
return left.length === right.length && left.every((value,
|
|
39568
|
+
return left.length === right.length && left.every((value, index2) => value === right[index2]);
|
|
39047
39569
|
}
|
|
39048
39570
|
function recordsEqual(left, right) {
|
|
39049
39571
|
const leftEntries = Object.entries(left);
|
|
@@ -39190,6 +39712,17 @@ var AgentSession = class _AgentSession {
|
|
|
39190
39712
|
const loaded = await this.#loadSession(signal, "ACP agent exited while loading history");
|
|
39191
39713
|
return await embedLocalHistoryImages(await loaded.history.snapshot(), signal);
|
|
39192
39714
|
};
|
|
39715
|
+
loadHistoryEventsV2 = async (eventLimit, cursor, signal) => {
|
|
39716
|
+
if (!this.#capabilities.loadSession) {
|
|
39717
|
+
throw new AcpExecutionError(
|
|
39718
|
+
"This Agent restores context but does not provide message history.",
|
|
39719
|
+
{},
|
|
39720
|
+
"native_history_unsupported"
|
|
39721
|
+
);
|
|
39722
|
+
}
|
|
39723
|
+
const loaded = await this.#loadSession(signal, "ACP agent exited while loading history");
|
|
39724
|
+
return loaded.history.eventPage(eventLimit, cursor);
|
|
39725
|
+
};
|
|
39193
39726
|
async #loadSession(signal, exitMessage) {
|
|
39194
39727
|
if (this.#sessionLoad.kind === "loaded") {
|
|
39195
39728
|
return this.#sessionLoad;
|
|
@@ -39836,8 +40369,14 @@ var AgentSession = class _AgentSession {
|
|
|
39836
40369
|
#processUpdate = async (notification) => {
|
|
39837
40370
|
this.assertNativeSession(notification.sessionId);
|
|
39838
40371
|
const update = notification.update;
|
|
40372
|
+
const rawUpdate = decodeAcpSessionUpdateV2(JSON.stringify(update));
|
|
39839
40373
|
if (this.#sessionLoad.kind !== "not-requested") {
|
|
39840
|
-
await this.#sessionLoad.history.record(update);
|
|
40374
|
+
await this.#sessionLoad.history.record(update, rawUpdate);
|
|
40375
|
+
} else {
|
|
40376
|
+
const onAcpUpdate = this.#getObserver().onAcpUpdate;
|
|
40377
|
+
if (onAcpUpdate !== void 0) {
|
|
40378
|
+
await onAcpUpdate(this.#mobiusSessionId, rawUpdate);
|
|
40379
|
+
}
|
|
39841
40380
|
}
|
|
39842
40381
|
if (this.#sessionLoad.kind === "capturing" && (update.sessionUpdate === "user_message_chunk" || update.sessionUpdate === "agent_message_chunk" || update.sessionUpdate === "agent_thought_chunk" || update.sessionUpdate === "tool_call" || update.sessionUpdate === "tool_call_update" || update.sessionUpdate === "plan" || update.sessionUpdate === "plan_update" || update.sessionUpdate === "plan_removed")) {
|
|
39843
40382
|
return;
|
|
@@ -40219,6 +40758,21 @@ var AgentQueryProcesses = class {
|
|
|
40219
40758
|
async (runtime) => await runtime.closeProcess()
|
|
40220
40759
|
);
|
|
40221
40760
|
};
|
|
40761
|
+
previewEventsV2 = async (options, nativeSessionId, eventLimit, cursor) => {
|
|
40762
|
+
return await this.#processes.runTransient(
|
|
40763
|
+
options.signal,
|
|
40764
|
+
async () => await AgentSession.startNativeSessionBrowser(
|
|
40765
|
+
options,
|
|
40766
|
+
() => this.#observer,
|
|
40767
|
+
new MemoryAcpSessionStore()
|
|
40768
|
+
),
|
|
40769
|
+
async (runtime) => {
|
|
40770
|
+
runtime.selectNativeSession(nativeSessionId);
|
|
40771
|
+
return await runtime.loadHistoryEventsV2(eventLimit, cursor, options.signal);
|
|
40772
|
+
},
|
|
40773
|
+
async (runtime) => await runtime.closeProcess()
|
|
40774
|
+
);
|
|
40775
|
+
};
|
|
40222
40776
|
close = async () => {
|
|
40223
40777
|
await Promise.all(
|
|
40224
40778
|
this.#processesByQuery.entries().map(async ([id, runtime]) => await this.retire(id, runtime))
|
|
@@ -40288,9 +40842,9 @@ var AcpProcessCapacityLock = class {
|
|
|
40288
40842
|
return await waiter.completion.promise;
|
|
40289
40843
|
} finally {
|
|
40290
40844
|
signal.removeEventListener("abort", waiter.cancel);
|
|
40291
|
-
const
|
|
40292
|
-
if (
|
|
40293
|
-
this.#waiters.splice(
|
|
40845
|
+
const index2 = this.#waiters.indexOf(waiter);
|
|
40846
|
+
if (index2 >= 0) {
|
|
40847
|
+
this.#waiters.splice(index2, 1);
|
|
40294
40848
|
}
|
|
40295
40849
|
}
|
|
40296
40850
|
};
|
|
@@ -40920,6 +41474,22 @@ var AgentRuntimeManager = class {
|
|
|
40920
41474
|
this.#nativeOperations.delete(key);
|
|
40921
41475
|
}
|
|
40922
41476
|
});
|
|
41477
|
+
previewNativeSessionEventsV2 = async (options, nativeSessionId, eventLimit, cursor) => this.#operations.run(options, async (options2) => {
|
|
41478
|
+
const key = `${options2.agent.id}:${nativeSessionId}`;
|
|
41479
|
+
if (this.#nativeOperations.has(key)) {
|
|
41480
|
+
throw new AcpExecutionError(
|
|
41481
|
+
"Wait for the native session's running operation to finish",
|
|
41482
|
+
{},
|
|
41483
|
+
"session_busy"
|
|
41484
|
+
);
|
|
41485
|
+
}
|
|
41486
|
+
this.#nativeOperations.add(key);
|
|
41487
|
+
try {
|
|
41488
|
+
return await this.#queryProcesses.previewEventsV2(options2, nativeSessionId, eventLimit, cursor);
|
|
41489
|
+
} finally {
|
|
41490
|
+
this.#nativeOperations.delete(key);
|
|
41491
|
+
}
|
|
41492
|
+
});
|
|
40923
41493
|
loadSessionHistory = async (options) => this.#operations.run(options, async (options2) => {
|
|
40924
41494
|
return await this.#executionProcesses.use(options2.sessionId, async () => {
|
|
40925
41495
|
const runtime = await this.ensureSession(options2);
|
|
@@ -40937,6 +41507,12 @@ var AgentRuntimeManager = class {
|
|
|
40937
41507
|
return await runtime.loadHistory(options2.signal);
|
|
40938
41508
|
});
|
|
40939
41509
|
});
|
|
41510
|
+
loadSessionEventsV2 = async (options, eventLimit, cursor) => this.#operations.run(options, async (options2) => {
|
|
41511
|
+
return await this.#executionProcesses.use(options2.sessionId, async () => {
|
|
41512
|
+
const runtime = await this.ensureSession(options2);
|
|
41513
|
+
return await runtime.loadHistoryEventsV2(eventLimit, cursor, options2.signal);
|
|
41514
|
+
});
|
|
41515
|
+
});
|
|
40940
41516
|
openNativeSession = async (options, origin) => this.#operations.run(options, async (options2) => {
|
|
40941
41517
|
const key = `${options2.agent.id}:${origin.nativeSessionId}`;
|
|
40942
41518
|
if (this.#nativeOperations.has(key)) {
|
|
@@ -42139,9 +42715,15 @@ function reportOperationFailure(socket, requestId, sessionId, error62, runtimeTi
|
|
|
42139
42715
|
// src/daemon-observers.ts
|
|
42140
42716
|
var DaemonAcpObserver = class {
|
|
42141
42717
|
#record;
|
|
42142
|
-
|
|
42718
|
+
#recordV2;
|
|
42719
|
+
constructor(record2, recordV2 = () => void 0) {
|
|
42143
42720
|
this.#record = record2;
|
|
42721
|
+
this.#recordV2 = recordV2;
|
|
42144
42722
|
}
|
|
42723
|
+
onAcpUpdate = (sessionId, update) => {
|
|
42724
|
+
this.#recordV2(sessionId, update);
|
|
42725
|
+
return Promise.resolve();
|
|
42726
|
+
};
|
|
42145
42727
|
onCommands = (event) => {
|
|
42146
42728
|
this.#record(event.sessionId, event);
|
|
42147
42729
|
return Promise.resolve();
|
|
@@ -42278,8 +42860,8 @@ var ACTIVE_TURN_TEXT_CHUNK_LIMIT = Math.floor(SESSION_HISTORY_CHARACTER_LIMIT /
|
|
|
42278
42860
|
function boundedRecoveryMessages(messages) {
|
|
42279
42861
|
const selected = [];
|
|
42280
42862
|
let remainingCharacters = SESSION_HISTORY_CHARACTER_LIMIT;
|
|
42281
|
-
for (let
|
|
42282
|
-
const message = messages[
|
|
42863
|
+
for (let index2 = messages.length - 1; index2 >= 0 && selected.length < SESSION_HISTORY_MESSAGE_LIMIT; index2 -= 1) {
|
|
42864
|
+
const message = messages[index2];
|
|
42283
42865
|
if (message === void 0) {
|
|
42284
42866
|
break;
|
|
42285
42867
|
}
|
|
@@ -42420,7 +43002,7 @@ var ActiveDaemonTurn = class {
|
|
|
42420
43002
|
];
|
|
42421
43003
|
} else {
|
|
42422
43004
|
this.#timeline = this.#timeline.map(
|
|
42423
|
-
(entry,
|
|
43005
|
+
(entry, index2) => index2 === target && entry.kind === "message" ? { ...entry, content: new Map([...entry.content, [event.contentId, event.content]]) } : entry
|
|
42424
43006
|
);
|
|
42425
43007
|
}
|
|
42426
43008
|
} else if (event.kind === SESSION_PERMISSION_REQUESTED_KIND || event.kind === SESSION_ELICITATION_REQUESTED_KIND) {
|
|
@@ -43431,7 +44013,7 @@ async function readAcpHistory(sessions, directories, bindingId, options, nativeS
|
|
|
43431
44013
|
async (directory) => await directories.identify(bindingId, directory, options.signal)
|
|
43432
44014
|
)
|
|
43433
44015
|
);
|
|
43434
|
-
if (primary.path !== options.cwd || additional.length !== options.additionalDirectories.length || additional.some((directory,
|
|
44016
|
+
if (primary.path !== options.cwd || additional.length !== options.additionalDirectories.length || additional.some((directory, index2) => directory.path !== options.additionalDirectories[index2])) {
|
|
43435
44017
|
throw new AcpExecutionError(
|
|
43436
44018
|
"The native Session belongs to another workspace.",
|
|
43437
44019
|
{},
|
|
@@ -43564,7 +44146,7 @@ var NativeSessionService = class {
|
|
|
43564
44146
|
"native_session_not_found"
|
|
43565
44147
|
);
|
|
43566
44148
|
}
|
|
43567
|
-
if (source.agentId !== command.agentId || source.cwd !== cwd || source.additionalDirectories.length !== additionalDirectories.length || source.additionalDirectories.some((path3,
|
|
44149
|
+
if (source.agentId !== command.agentId || source.cwd !== cwd || source.additionalDirectories.length !== additionalDirectories.length || source.additionalDirectories.some((path3, index2) => path3 !== additionalDirectories[index2])) {
|
|
43568
44150
|
throw new AcpExecutionError(
|
|
43569
44151
|
"The source conversation execution target does not match the fork request",
|
|
43570
44152
|
{},
|
|
@@ -43585,8 +44167,8 @@ var NativeSessionService = class {
|
|
|
43585
44167
|
signal.throwIfAborted();
|
|
43586
44168
|
const directory = await this.#directories.list(this.#config.bindingId, command.directoryId, signal);
|
|
43587
44169
|
const ready2 = {
|
|
43588
|
-
additionalDirectories: additionalDirectories.map((path3,
|
|
43589
|
-
directoryId: command.additionalDirectoryIds[
|
|
44170
|
+
additionalDirectories: additionalDirectories.map((path3, index2) => ({
|
|
44171
|
+
directoryId: command.additionalDirectoryIds[index2] ?? command.directoryId,
|
|
43590
44172
|
name: basename5(path3) || path3
|
|
43591
44173
|
})),
|
|
43592
44174
|
agentId: command.agentId,
|
|
@@ -43918,7 +44500,7 @@ var NativeSessionService = class {
|
|
|
43918
44500
|
resolveTarget = async (command, options, selected) => {
|
|
43919
44501
|
let cursor = null;
|
|
43920
44502
|
const visited = /* @__PURE__ */ new Set();
|
|
43921
|
-
for (let
|
|
44503
|
+
for (let index2 = 0; index2 < 100; index2 += 1) {
|
|
43922
44504
|
const page = await this.#sessions.listNativeSessions(options, cursor);
|
|
43923
44505
|
const info = page.sessions.find((entry) => entry.sessionId === selected.nativeSessionId);
|
|
43924
44506
|
if (info !== void 0) {
|
|
@@ -43926,7 +44508,7 @@ var NativeSessionService = class {
|
|
|
43926
44508
|
if (target === null) {
|
|
43927
44509
|
throw new LocalAuthorizationError("The selected native session is not authorized");
|
|
43928
44510
|
}
|
|
43929
|
-
if (target.cwd !== selected.cwd || target.additionalDirectories.length !== selected.additionalDirectories.length || target.additionalDirectories.some((path3,
|
|
44511
|
+
if (target.cwd !== selected.cwd || target.additionalDirectories.length !== selected.additionalDirectories.length || target.additionalDirectories.some((path3, index3) => path3 !== selected.additionalDirectories[index3])) {
|
|
43930
44512
|
throw new AcpExecutionError(
|
|
43931
44513
|
"This session's directory changed. Refresh the list before continuing.",
|
|
43932
44514
|
{},
|
|
@@ -45014,6 +45596,9 @@ async function streamLocalFile(command, send2, signal, workingDirectory) {
|
|
|
45014
45596
|
});
|
|
45015
45597
|
}
|
|
45016
45598
|
|
|
45599
|
+
// src/daemon-history-commands.ts
|
|
45600
|
+
import { createHash as createHash6 } from "node:crypto";
|
|
45601
|
+
|
|
45017
45602
|
// src/authorization/resolve-session-directories.ts
|
|
45018
45603
|
import { basename as basename7 } from "node:path";
|
|
45019
45604
|
var ResolvedSessionDirectories = class {
|
|
@@ -45113,8 +45698,8 @@ function selectMessagesBefore(messages, endIndex, messageLimit, characterLimit)
|
|
|
45113
45698
|
const selected = [];
|
|
45114
45699
|
let remainingCharacters = characterLimit;
|
|
45115
45700
|
let startIndex = endIndex;
|
|
45116
|
-
for (let
|
|
45117
|
-
const message = messages[
|
|
45701
|
+
for (let index2 = endIndex - 1; index2 >= 0 && selected.length < messageLimit; index2 -= 1) {
|
|
45702
|
+
const message = messages[index2];
|
|
45118
45703
|
if (message === void 0) {
|
|
45119
45704
|
break;
|
|
45120
45705
|
}
|
|
@@ -45124,7 +45709,7 @@ function selectMessagesBefore(messages, endIndex, messageLimit, characterLimit)
|
|
|
45124
45709
|
}
|
|
45125
45710
|
selected.unshift(message);
|
|
45126
45711
|
remainingCharacters -= characters;
|
|
45127
|
-
startIndex =
|
|
45712
|
+
startIndex = index2;
|
|
45128
45713
|
}
|
|
45129
45714
|
if (selected.length === 0 && endIndex > 0) {
|
|
45130
45715
|
throw new AcpExecutionError(
|
|
@@ -45404,6 +45989,79 @@ async function executeSessionLiveHistoryPageLoad(socket, command, config2, direc
|
|
|
45404
45989
|
});
|
|
45405
45990
|
}
|
|
45406
45991
|
}
|
|
45992
|
+
function replayEvent(sessionId, position, update) {
|
|
45993
|
+
const encoded = JSON.stringify(update);
|
|
45994
|
+
const eventId = `native-${createHash6("sha256").update(sessionId).update(":").update(position.toString()).update(":").update(encoded).digest("hex")}`;
|
|
45995
|
+
return {
|
|
45996
|
+
eventId,
|
|
45997
|
+
payload: { kind: "acp.session.update", update },
|
|
45998
|
+
position: position.toString(),
|
|
45999
|
+
provenance: { kind: "original" },
|
|
46000
|
+
recordedAt: "1970-01-01T00:00:00.000Z",
|
|
46001
|
+
sessionId
|
|
46002
|
+
};
|
|
46003
|
+
}
|
|
46004
|
+
async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, directories, audit, sessions, localRecovery, executingPromptRequest, signal) {
|
|
46005
|
+
try {
|
|
46006
|
+
const local = localRecovery(command.sessionId, command.eventLimit, command.cursor);
|
|
46007
|
+
if (local !== null) {
|
|
46008
|
+
send(socket, {
|
|
46009
|
+
events: local,
|
|
46010
|
+
kind: "session.live-history.v2.page.loaded",
|
|
46011
|
+
requestId: command.requestId,
|
|
46012
|
+
sessionId: command.sessionId
|
|
46013
|
+
});
|
|
46014
|
+
return;
|
|
46015
|
+
}
|
|
46016
|
+
const resolved = await resolveSessionDirectories(
|
|
46017
|
+
directories,
|
|
46018
|
+
config2.bindingId,
|
|
46019
|
+
command.directoryId,
|
|
46020
|
+
command.additionalDirectoryIds,
|
|
46021
|
+
signal
|
|
46022
|
+
);
|
|
46023
|
+
const replay = await sessions.loadSessionEventsV2(
|
|
46024
|
+
{
|
|
46025
|
+
additionalDirectories: resolved.additionalDirectories,
|
|
46026
|
+
agent: config2.catalog.find(command.agentId),
|
|
46027
|
+
cwd: resolved.cwd,
|
|
46028
|
+
sessionId: command.sessionId,
|
|
46029
|
+
signal
|
|
46030
|
+
},
|
|
46031
|
+
command.eventLimit,
|
|
46032
|
+
command.cursor
|
|
46033
|
+
);
|
|
46034
|
+
signal.throwIfAborted();
|
|
46035
|
+
const events = replay.updates.map(
|
|
46036
|
+
(update, index2) => replayEvent(command.sessionId, replay.startPosition + index2, update)
|
|
46037
|
+
);
|
|
46038
|
+
const tailCursor = events.at(-1)?.eventId ?? "";
|
|
46039
|
+
audit.record({
|
|
46040
|
+
commandId: command.requestId,
|
|
46041
|
+
event: "session_event_log_v2_loaded",
|
|
46042
|
+
sessionId: command.sessionId
|
|
46043
|
+
});
|
|
46044
|
+
send(socket, {
|
|
46045
|
+
events: {
|
|
46046
|
+
executingPromptRequest: executingPromptRequest(command.sessionId),
|
|
46047
|
+
history: {
|
|
46048
|
+
events,
|
|
46049
|
+
nextCursor: replay.nextCursor,
|
|
46050
|
+
tailCursor,
|
|
46051
|
+
truncated: replay.truncated,
|
|
46052
|
+
version: 2
|
|
46053
|
+
}
|
|
46054
|
+
},
|
|
46055
|
+
kind: "session.live-history.v2.page.loaded",
|
|
46056
|
+
requestId: command.requestId,
|
|
46057
|
+
sessionId: command.sessionId
|
|
46058
|
+
});
|
|
46059
|
+
} catch (error62) {
|
|
46060
|
+
if (!signal.aborted) {
|
|
46061
|
+
reportOperationFailure(socket, command.requestId, command.sessionId, error62);
|
|
46062
|
+
}
|
|
46063
|
+
}
|
|
46064
|
+
}
|
|
45407
46065
|
|
|
45408
46066
|
// src/acp/session-config/apply-session-configuration.ts
|
|
45409
46067
|
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
@@ -45718,6 +46376,7 @@ function daemonActivity(command, activity2) {
|
|
|
45718
46376
|
async function executePrompt({
|
|
45719
46377
|
operations,
|
|
45720
46378
|
publisher,
|
|
46379
|
+
eventLogV2,
|
|
45721
46380
|
command,
|
|
45722
46381
|
config: config2,
|
|
45723
46382
|
directories,
|
|
@@ -45822,6 +46481,7 @@ async function executePrompt({
|
|
|
45822
46481
|
}
|
|
45823
46482
|
}
|
|
45824
46483
|
const stream = activateAttempt();
|
|
46484
|
+
eventLogV2.started(command.sessionId, command.commandId, attemptId, stream.epoch);
|
|
45825
46485
|
if (!prepared.prompted) {
|
|
45826
46486
|
const listing = await directories.list(config2.bindingId, command.directoryId, signal);
|
|
45827
46487
|
publisher.publish(command.sessionId, {
|
|
@@ -45891,6 +46551,7 @@ async function executePrompt({
|
|
|
45891
46551
|
sessionId: command.sessionId,
|
|
45892
46552
|
stopReason
|
|
45893
46553
|
});
|
|
46554
|
+
eventLogV2.completed(command.sessionId, command.commandId, stopReason);
|
|
45894
46555
|
operations.transitionExecution(command.commandId, stopReason === "cancelled" ? "cancelled" : "succeeded");
|
|
45895
46556
|
audit.record({
|
|
45896
46557
|
commandId: command.commandId,
|
|
@@ -45906,6 +46567,7 @@ async function executePrompt({
|
|
|
45906
46567
|
sessionId: command.sessionId,
|
|
45907
46568
|
stopReason: "cancelled"
|
|
45908
46569
|
});
|
|
46570
|
+
eventLogV2.completed(command.sessionId, command.commandId, "cancelled");
|
|
45909
46571
|
operations.transitionExecution(command.commandId, "cancelled");
|
|
45910
46572
|
audit.record({
|
|
45911
46573
|
commandId: command.commandId,
|
|
@@ -45920,12 +46582,10 @@ async function executePrompt({
|
|
|
45920
46582
|
sessionId: command.sessionId
|
|
45921
46583
|
});
|
|
45922
46584
|
const code = operationErrorCode(error62);
|
|
45923
|
-
|
|
45924
|
-
|
|
45925
|
-
|
|
45926
|
-
|
|
45927
|
-
code === "session_operation_failed" ? "The local agent could not complete the request" : operationErrorMessage(error62)
|
|
45928
|
-
);
|
|
46585
|
+
const failureCode = code === "session_operation_failed" ? "agent_execution_failed" : code;
|
|
46586
|
+
const failureMessage = code === "session_operation_failed" ? "The local agent could not complete the request" : operationErrorMessage(error62);
|
|
46587
|
+
eventLogV2.failed(command.sessionId, command.commandId, failureCode, failureMessage);
|
|
46588
|
+
reportFailure(publisher, command, failureCode, failureMessage);
|
|
45929
46589
|
operations.transitionExecution(command.commandId, "failed");
|
|
45930
46590
|
console.error("Mobius daemon command failed", error62);
|
|
45931
46591
|
}
|
|
@@ -46208,6 +46868,7 @@ function createDaemonCommandHandler({
|
|
|
46208
46868
|
nativeSessions,
|
|
46209
46869
|
operations,
|
|
46210
46870
|
publisher,
|
|
46871
|
+
eventLogV2,
|
|
46211
46872
|
activeTurns,
|
|
46212
46873
|
diagnostics,
|
|
46213
46874
|
socket,
|
|
@@ -46277,6 +46938,20 @@ function createDaemonCommandHandler({
|
|
|
46277
46938
|
);
|
|
46278
46939
|
return;
|
|
46279
46940
|
}
|
|
46941
|
+
if (kind === SESSION_LIVE_HISTORY_V2_PAGE_LOAD_KIND) {
|
|
46942
|
+
void executeSessionLiveHistoryV2PageLoad(
|
|
46943
|
+
socket,
|
|
46944
|
+
message,
|
|
46945
|
+
config2,
|
|
46946
|
+
directories,
|
|
46947
|
+
audit,
|
|
46948
|
+
sessions,
|
|
46949
|
+
eventLogV2.recovery,
|
|
46950
|
+
eventLogV2.executingPromptRequest,
|
|
46951
|
+
signal
|
|
46952
|
+
);
|
|
46953
|
+
return;
|
|
46954
|
+
}
|
|
46280
46955
|
if (kind === NATIVE_SESSION_CANCEL_KIND) {
|
|
46281
46956
|
nativeRequestHandler.cancel(message);
|
|
46282
46957
|
return;
|
|
@@ -46462,9 +47137,11 @@ function createDaemonCommandHandler({
|
|
|
46462
47137
|
return;
|
|
46463
47138
|
}
|
|
46464
47139
|
const turn = activeTurns.start(command, receipt.attemptId);
|
|
47140
|
+
eventLogV2.requested(command);
|
|
46465
47141
|
void executePrompt({
|
|
46466
47142
|
operations,
|
|
46467
47143
|
publisher,
|
|
47144
|
+
eventLogV2,
|
|
46468
47145
|
command,
|
|
46469
47146
|
config: config2,
|
|
46470
47147
|
directories,
|
|
@@ -46754,6 +47431,7 @@ async function runRelayConnection({
|
|
|
46754
47431
|
nativeSessions,
|
|
46755
47432
|
operations,
|
|
46756
47433
|
publisher,
|
|
47434
|
+
eventLogV2,
|
|
46757
47435
|
activeTurns,
|
|
46758
47436
|
connectionEpoch,
|
|
46759
47437
|
diagnostics,
|
|
@@ -46776,6 +47454,7 @@ async function runRelayConnection({
|
|
|
46776
47454
|
nativeSessions,
|
|
46777
47455
|
operations,
|
|
46778
47456
|
publisher,
|
|
47457
|
+
eventLogV2,
|
|
46779
47458
|
activeTurns,
|
|
46780
47459
|
diagnostics,
|
|
46781
47460
|
socket,
|
|
@@ -46955,6 +47634,21 @@ var DaemonSessionEventPublisher = class {
|
|
|
46955
47634
|
this.publish(sessionId, event);
|
|
46956
47635
|
}
|
|
46957
47636
|
};
|
|
47637
|
+
publishV2 = (event) => {
|
|
47638
|
+
const socket = this.#socket;
|
|
47639
|
+
if (socket === null || socket.readyState !== WebSocket9.OPEN) {
|
|
47640
|
+
return;
|
|
47641
|
+
}
|
|
47642
|
+
const encoded = encodeDaemonToServiceMessage({ event, kind: SESSION_EVENT_V2_KIND });
|
|
47643
|
+
if (socket.bufferedAmount + Buffer.byteLength(encoded, "utf8") > MAX_BUFFERED_BYTES) {
|
|
47644
|
+
socket.close(1013, "Live event transport overloaded");
|
|
47645
|
+
return;
|
|
47646
|
+
}
|
|
47647
|
+
try {
|
|
47648
|
+
socket.send(encoded);
|
|
47649
|
+
} catch {
|
|
47650
|
+
}
|
|
47651
|
+
};
|
|
46958
47652
|
};
|
|
46959
47653
|
|
|
46960
47654
|
// src/relay-connection/timer.ts
|
|
@@ -46966,6 +47660,241 @@ var SystemDaemonTimer = class {
|
|
|
46966
47660
|
};
|
|
46967
47661
|
var systemDaemonTimer = new SystemDaemonTimer();
|
|
46968
47662
|
|
|
47663
|
+
// src/session-event-log-v2.ts
|
|
47664
|
+
var EXECUTING_PROMPT_EVENT_LIMIT = 1e4;
|
|
47665
|
+
function promptContent(command) {
|
|
47666
|
+
const content = [];
|
|
47667
|
+
if (command.prompt.length > 0) {
|
|
47668
|
+
content.push({ text: command.prompt, type: "text" });
|
|
47669
|
+
}
|
|
47670
|
+
for (const image of command.images) {
|
|
47671
|
+
content.push({
|
|
47672
|
+
_meta: { mobius: { name: image.name } },
|
|
47673
|
+
data: image.data,
|
|
47674
|
+
mimeType: image.mimeType,
|
|
47675
|
+
type: "image"
|
|
47676
|
+
});
|
|
47677
|
+
}
|
|
47678
|
+
for (const resource of command.resources) {
|
|
47679
|
+
content.push(
|
|
47680
|
+
resource.type === "embedded" ? {
|
|
47681
|
+
resource: { mimeType: resource.mimeType, text: resource.text, uri: resource.uri },
|
|
47682
|
+
type: "resource"
|
|
47683
|
+
} : { mimeType: resource.mimeType, name: resource.name, type: "resource_link", uri: resource.uri }
|
|
47684
|
+
);
|
|
47685
|
+
}
|
|
47686
|
+
return content;
|
|
47687
|
+
}
|
|
47688
|
+
function encodeLocalEventCursor(cursor) {
|
|
47689
|
+
return Buffer.from(JSON.stringify(cursor), "utf8").toString("base64url");
|
|
47690
|
+
}
|
|
47691
|
+
function decodeLocalEventCursor(sessionId, cursor) {
|
|
47692
|
+
try {
|
|
47693
|
+
const value = JSON.parse(Buffer.from(cursor, "base64url").toString("utf8"));
|
|
47694
|
+
if (typeof value !== "object" || value === null || Array.isArray(value) || Object.keys(value).sort().join(",") !== "endEvent,sessionId" || Reflect.get(value, "sessionId") !== sessionId) {
|
|
47695
|
+
throw new Error("Invalid V2 event cursor target");
|
|
47696
|
+
}
|
|
47697
|
+
const endEvent = Reflect.get(value, "endEvent");
|
|
47698
|
+
if (typeof endEvent !== "number" || !Number.isSafeInteger(endEvent) || endEvent < 0) {
|
|
47699
|
+
throw new Error("Invalid V2 event cursor boundary");
|
|
47700
|
+
}
|
|
47701
|
+
return { endEvent, sessionId };
|
|
47702
|
+
} catch (cause) {
|
|
47703
|
+
throw new AcpExecutionError("The native Session event cursor is invalid", { cause }, "invalid_cursor");
|
|
47704
|
+
}
|
|
47705
|
+
}
|
|
47706
|
+
var DaemonSessionEventLogV2 = class {
|
|
47707
|
+
#positions = /* @__PURE__ */ new Map();
|
|
47708
|
+
#events = /* @__PURE__ */ new Map();
|
|
47709
|
+
#requests = /* @__PURE__ */ new Map();
|
|
47710
|
+
#loadedRequestSessions = /* @__PURE__ */ new Set();
|
|
47711
|
+
#publisher;
|
|
47712
|
+
#store;
|
|
47713
|
+
constructor(publisher, store) {
|
|
47714
|
+
this.#publisher = publisher;
|
|
47715
|
+
this.#store = store;
|
|
47716
|
+
}
|
|
47717
|
+
#eventsFor = (sessionId) => {
|
|
47718
|
+
const cached2 = this.#events.get(sessionId);
|
|
47719
|
+
if (cached2 !== void 0) {
|
|
47720
|
+
return cached2;
|
|
47721
|
+
}
|
|
47722
|
+
const stored = this.#store.readEventsV2(sessionId);
|
|
47723
|
+
this.#events.set(sessionId, stored);
|
|
47724
|
+
const lastPosition = stored.at(-1)?.position;
|
|
47725
|
+
if (lastPosition !== void 0) {
|
|
47726
|
+
this.#positions.set(sessionId, Number(lastPosition));
|
|
47727
|
+
}
|
|
47728
|
+
return stored;
|
|
47729
|
+
};
|
|
47730
|
+
#loadRequests = (sessionId) => {
|
|
47731
|
+
if (this.#loadedRequestSessions.has(sessionId)) {
|
|
47732
|
+
return;
|
|
47733
|
+
}
|
|
47734
|
+
for (const event of this.#eventsFor(sessionId)) {
|
|
47735
|
+
const payload = event.payload;
|
|
47736
|
+
if (payload.kind === "prompt.requested") {
|
|
47737
|
+
this.#requests.set(payload.commandId, {
|
|
47738
|
+
commandId: payload.commandId,
|
|
47739
|
+
events: [event],
|
|
47740
|
+
kind: "requested",
|
|
47741
|
+
sessionId
|
|
47742
|
+
});
|
|
47743
|
+
continue;
|
|
47744
|
+
}
|
|
47745
|
+
if (payload.kind === "acp.session.update") {
|
|
47746
|
+
const executing = [...this.#requests.values()].find(
|
|
47747
|
+
(request) => request.sessionId === sessionId && request.kind === "executing"
|
|
47748
|
+
);
|
|
47749
|
+
if (executing !== void 0) {
|
|
47750
|
+
this.#requests.set(executing.commandId, {
|
|
47751
|
+
...executing,
|
|
47752
|
+
events: [...executing.events, event]
|
|
47753
|
+
});
|
|
47754
|
+
}
|
|
47755
|
+
continue;
|
|
47756
|
+
}
|
|
47757
|
+
if (!("commandId" in payload)) {
|
|
47758
|
+
continue;
|
|
47759
|
+
}
|
|
47760
|
+
const state = this.#requests.get(payload.commandId);
|
|
47761
|
+
if (state === void 0) {
|
|
47762
|
+
continue;
|
|
47763
|
+
}
|
|
47764
|
+
const events = [...state.events, event];
|
|
47765
|
+
if (payload.kind === "prompt.started") {
|
|
47766
|
+
this.#requests.set(payload.commandId, {
|
|
47767
|
+
attemptId: payload.attemptId,
|
|
47768
|
+
commandId: payload.commandId,
|
|
47769
|
+
epoch: payload.epoch,
|
|
47770
|
+
events,
|
|
47771
|
+
kind: "executing",
|
|
47772
|
+
sessionId
|
|
47773
|
+
});
|
|
47774
|
+
} else if (payload.kind === "prompt.completed" || payload.kind === "prompt.failed" || payload.kind === "prompt.failed-before-start") {
|
|
47775
|
+
this.#requests.delete(payload.commandId);
|
|
47776
|
+
}
|
|
47777
|
+
}
|
|
47778
|
+
this.#loadedRequestSessions.add(sessionId);
|
|
47779
|
+
};
|
|
47780
|
+
#append = (sessionId, payload) => {
|
|
47781
|
+
this.#eventsFor(sessionId);
|
|
47782
|
+
const position = (this.#positions.get(sessionId) ?? 0) + 1;
|
|
47783
|
+
const event = {
|
|
47784
|
+
eventId: `event-${crypto.randomUUID()}`,
|
|
47785
|
+
payload,
|
|
47786
|
+
position: position.toString(),
|
|
47787
|
+
provenance: { kind: "original" },
|
|
47788
|
+
recordedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
47789
|
+
sessionId
|
|
47790
|
+
};
|
|
47791
|
+
this.#store.appendEventV2(event);
|
|
47792
|
+
this.#positions.set(sessionId, position);
|
|
47793
|
+
this.#events.set(sessionId, [...this.#eventsFor(sessionId), event]);
|
|
47794
|
+
this.#publisher.publishV2(event);
|
|
47795
|
+
return event;
|
|
47796
|
+
};
|
|
47797
|
+
requested = (command) => {
|
|
47798
|
+
const event = this.#append(command.sessionId, {
|
|
47799
|
+
commandId: command.commandId,
|
|
47800
|
+
content: promptContent(command),
|
|
47801
|
+
kind: "prompt.requested"
|
|
47802
|
+
});
|
|
47803
|
+
this.#requests.set(command.commandId, {
|
|
47804
|
+
commandId: command.commandId,
|
|
47805
|
+
events: [event],
|
|
47806
|
+
kind: "requested",
|
|
47807
|
+
sessionId: command.sessionId
|
|
47808
|
+
});
|
|
47809
|
+
};
|
|
47810
|
+
started = (sessionId, commandId, attemptId, epoch) => {
|
|
47811
|
+
this.#loadRequests(sessionId);
|
|
47812
|
+
const request = this.#requests.get(commandId);
|
|
47813
|
+
if (request?.sessionId !== sessionId) {
|
|
47814
|
+
return;
|
|
47815
|
+
}
|
|
47816
|
+
const event = this.#append(sessionId, { attemptId, commandId, epoch, kind: "prompt.started" });
|
|
47817
|
+
this.#requests.set(commandId, {
|
|
47818
|
+
attemptId,
|
|
47819
|
+
commandId,
|
|
47820
|
+
epoch,
|
|
47821
|
+
events: [...request.events, event],
|
|
47822
|
+
kind: "executing",
|
|
47823
|
+
sessionId
|
|
47824
|
+
});
|
|
47825
|
+
};
|
|
47826
|
+
acpUpdate = (sessionId, update) => {
|
|
47827
|
+
this.#loadRequests(sessionId);
|
|
47828
|
+
const event = this.#append(sessionId, { kind: "acp.session.update", update });
|
|
47829
|
+
const executing = [...this.#requests.values()].find(
|
|
47830
|
+
(request) => request.sessionId === sessionId && request.kind === "executing"
|
|
47831
|
+
);
|
|
47832
|
+
if (executing !== void 0) {
|
|
47833
|
+
this.#requests.set(executing.commandId, { ...executing, events: [...executing.events, event] });
|
|
47834
|
+
}
|
|
47835
|
+
};
|
|
47836
|
+
completed = (sessionId, commandId, stopReason) => {
|
|
47837
|
+
this.#append(sessionId, { commandId, kind: "prompt.completed", stopReason });
|
|
47838
|
+
this.#requests.delete(commandId);
|
|
47839
|
+
};
|
|
47840
|
+
failed = (sessionId, commandId, code, message) => {
|
|
47841
|
+
this.#loadRequests(sessionId);
|
|
47842
|
+
const request = this.#requests.get(commandId);
|
|
47843
|
+
if (request?.kind === "executing" && request.commandId === commandId) {
|
|
47844
|
+
this.#append(sessionId, { attemptId: request.attemptId, code, commandId, kind: "prompt.failed", message });
|
|
47845
|
+
} else {
|
|
47846
|
+
this.#append(sessionId, { code, commandId, kind: "prompt.failed-before-start", message });
|
|
47847
|
+
}
|
|
47848
|
+
this.#requests.delete(commandId);
|
|
47849
|
+
};
|
|
47850
|
+
executingPromptRequest = (sessionId) => {
|
|
47851
|
+
this.#loadRequests(sessionId);
|
|
47852
|
+
const request = [...this.#requests.values()].find(
|
|
47853
|
+
(candidate) => candidate.sessionId === sessionId && candidate.kind === "executing"
|
|
47854
|
+
);
|
|
47855
|
+
if (request?.kind !== "executing") {
|
|
47856
|
+
return null;
|
|
47857
|
+
}
|
|
47858
|
+
const events = request.events.slice(-EXECUTING_PROMPT_EVENT_LIMIT);
|
|
47859
|
+
return {
|
|
47860
|
+
attemptId: request.attemptId,
|
|
47861
|
+
commandId: request.commandId,
|
|
47862
|
+
epoch: request.epoch,
|
|
47863
|
+
events,
|
|
47864
|
+
tailCursor: events.at(-1)?.eventId ?? "",
|
|
47865
|
+
truncated: events.length < request.events.length
|
|
47866
|
+
};
|
|
47867
|
+
};
|
|
47868
|
+
recovery = (sessionId, eventLimit, cursor) => {
|
|
47869
|
+
const events = this.#eventsFor(sessionId);
|
|
47870
|
+
if (events.length === 0) {
|
|
47871
|
+
return null;
|
|
47872
|
+
}
|
|
47873
|
+
const executingPromptRequest = this.executingPromptRequest(sessionId);
|
|
47874
|
+
const executingRequestState = [...this.#requests.values()].find(
|
|
47875
|
+
(request) => request.sessionId === sessionId && request.kind === "executing"
|
|
47876
|
+
);
|
|
47877
|
+
const firstExecutingPosition = executingRequestState?.events[0]?.position;
|
|
47878
|
+
const historyEvents = firstExecutingPosition === void 0 ? events : events.filter((event) => BigInt(event.position) < BigInt(firstExecutingPosition));
|
|
47879
|
+
const endEvent = cursor === null ? historyEvents.length : decodeLocalEventCursor(sessionId, cursor).endEvent;
|
|
47880
|
+
if (endEvent > historyEvents.length) {
|
|
47881
|
+
throw new AcpExecutionError("The native Session event cursor is invalid", {}, "invalid_cursor");
|
|
47882
|
+
}
|
|
47883
|
+
const startEvent = Math.max(0, endEvent - eventLimit);
|
|
47884
|
+
const pageEvents = historyEvents.slice(startEvent, endEvent);
|
|
47885
|
+
return {
|
|
47886
|
+
executingPromptRequest,
|
|
47887
|
+
history: {
|
|
47888
|
+
events: pageEvents,
|
|
47889
|
+
nextCursor: startEvent === 0 ? null : encodeLocalEventCursor({ endEvent: startEvent, sessionId }),
|
|
47890
|
+
tailCursor: pageEvents.at(-1)?.eventId ?? "",
|
|
47891
|
+
truncated: startEvent > 0,
|
|
47892
|
+
version: 2
|
|
47893
|
+
}
|
|
47894
|
+
};
|
|
47895
|
+
};
|
|
47896
|
+
};
|
|
47897
|
+
|
|
46969
47898
|
// src/run-daemon.ts
|
|
46970
47899
|
var RELAY_RECONNECT_DELAY_MILLISECONDS = 500;
|
|
46971
47900
|
function waitForRelayRetry(signal, timer) {
|
|
@@ -47033,16 +47962,17 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
47033
47962
|
stateDirectory
|
|
47034
47963
|
});
|
|
47035
47964
|
const sessionStore = new SqliteAcpSessionStore(
|
|
47036
|
-
join18(stateDirectory, "sessions", `${
|
|
47965
|
+
join18(stateDirectory, "sessions", `${createHash7("sha256").update(config2.channelId).digest("hex")}.sqlite`)
|
|
47037
47966
|
);
|
|
47038
47967
|
const operations = new DaemonOperationState();
|
|
47039
47968
|
const publisher = new DaemonSessionEventPublisher();
|
|
47969
|
+
const eventLogV2 = new DaemonSessionEventLogV2(publisher, sessionStore);
|
|
47040
47970
|
const activeTurns = new DaemonTurnRegistry(operations);
|
|
47041
47971
|
const recordSessionEvent = (sessionId, event) => {
|
|
47042
47972
|
publisher.publish(sessionId, activeTurns.recordEvent(event));
|
|
47043
47973
|
};
|
|
47044
47974
|
const agentRuntime = new AgentRuntimeManager(
|
|
47045
|
-
new DaemonAcpObserver(recordSessionEvent),
|
|
47975
|
+
new DaemonAcpObserver(recordSessionEvent, eventLogV2.acpUpdate),
|
|
47046
47976
|
sessionStore,
|
|
47047
47977
|
{
|
|
47048
47978
|
read: async (options2, nativeSessionId, nativeTurn) => options2.agent.id === "codex" ? (await readCodexFullHistory(
|
|
@@ -47080,7 +48010,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
47080
48010
|
options2.signal
|
|
47081
48011
|
);
|
|
47082
48012
|
return cwd === options2.cwd && additionalDirectories.length === options2.additionalDirectories.length && additionalDirectories.every(
|
|
47083
|
-
(directory,
|
|
48013
|
+
(directory, index2) => directory === options2.additionalDirectories[index2]
|
|
47084
48014
|
);
|
|
47085
48015
|
});
|
|
47086
48016
|
}
|
|
@@ -47166,6 +48096,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
47166
48096
|
nativeSessions,
|
|
47167
48097
|
operations,
|
|
47168
48098
|
publisher,
|
|
48099
|
+
eventLogV2,
|
|
47169
48100
|
activeTurns,
|
|
47170
48101
|
connectionEpoch,
|
|
47171
48102
|
diagnostics,
|
|
@@ -47318,7 +48249,7 @@ function isRecord11(value) {
|
|
|
47318
48249
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
47319
48250
|
}
|
|
47320
48251
|
function controlSocketPath(stateDirectory) {
|
|
47321
|
-
const installationHash =
|
|
48252
|
+
const installationHash = createHash8("sha256").update(stateDirectory).digest("hex").slice(0, 32);
|
|
47322
48253
|
return process.platform === "win32" ? `\\\\.\\pipe\\mobius-${installationHash}` : join19(tmpdir(), `mobius-${installationHash}.sock`);
|
|
47323
48254
|
}
|
|
47324
48255
|
function controlTokenPath(stateDirectory) {
|
|
@@ -47549,12 +48480,12 @@ var RuntimeSupervisor = class {
|
|
|
47549
48480
|
}
|
|
47550
48481
|
};
|
|
47551
48482
|
function pairingIdentifier(arguments_) {
|
|
47552
|
-
const indexes = arguments_.flatMap((argument,
|
|
48483
|
+
const indexes = arguments_.flatMap((argument, index3) => argument === "--pairing" ? [index3] : []);
|
|
47553
48484
|
if (indexes.length !== 1) {
|
|
47554
48485
|
return null;
|
|
47555
48486
|
}
|
|
47556
|
-
const
|
|
47557
|
-
return
|
|
48487
|
+
const index2 = indexes[0];
|
|
48488
|
+
return index2 === void 0 ? null : arguments_[index2 + 1] ?? null;
|
|
47558
48489
|
}
|
|
47559
48490
|
async function waitForReady(active, signal) {
|
|
47560
48491
|
if (active.status === "online") {
|
|
@@ -47849,9 +48780,9 @@ function formatPairTable(pairs) {
|
|
|
47849
48780
|
const headers = ["connection_id", "app_id", "runtime_id", "workspace", "status"];
|
|
47850
48781
|
const rows = pairs.map((pair) => [pair.connectionId, pair.appId, pair.runtimeId, pair.workspace, pair.status]);
|
|
47851
48782
|
const widths = headers.map(
|
|
47852
|
-
(header,
|
|
48783
|
+
(header, index2) => Math.max(header.length, ...rows.map((row) => row[index2]?.length ?? 0))
|
|
47853
48784
|
);
|
|
47854
|
-
const line = (row) => `| ${row.map((value,
|
|
48785
|
+
const line = (row) => `| ${row.map((value, index2) => value.padEnd(widths[index2] ?? value.length)).join(" | ")} |`;
|
|
47855
48786
|
const divider = `|-${widths.map((width) => "-".repeat(width)).join("-|-")}-|`;
|
|
47856
48787
|
return `${line(headers)}
|
|
47857
48788
|
${divider}
|