@moxt-ai/mobius 0.0.191 → 0.0.193
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-runtime-manager.d.ts +1 -1
- package/dist/acp/agent-runtime-manager.d.ts.map +1 -1
- package/dist/acp/agent-runtime-manager.js +4 -1
- package/dist/acp/agent-runtime-manager.js.map +1 -1
- package/dist/acp/agent-session.d.ts +13 -0
- package/dist/acp/agent-session.d.ts.map +1 -1
- package/dist/acp/agent-session.js +52 -15
- package/dist/acp/agent-session.js.map +1 -1
- package/dist/acp/codex/agent.d.ts +13 -0
- package/dist/acp/codex/agent.d.ts.map +1 -1
- package/dist/acp/codex/agent.js +1 -0
- package/dist/acp/codex/agent.js.map +1 -1
- package/dist/acp/codex/app-server-protocol.d.ts +12 -0
- package/dist/acp/codex/app-server-protocol.d.ts.map +1 -1
- package/dist/acp/codex/app-server-protocol.js +5 -5
- package/dist/acp/codex/app-server-protocol.js.map +1 -1
- package/dist/acp/codex/settings.d.ts +5 -0
- package/dist/acp/codex/settings.d.ts.map +1 -1
- package/dist/acp/codex/settings.js +28 -24
- package/dist/acp/codex/settings.js.map +1 -1
- package/dist/acp/in-process/acp-endpoint.d.ts +3 -0
- package/dist/acp/in-process/acp-endpoint.d.ts.map +1 -1
- package/dist/acp/in-process/acp-endpoint.js.map +1 -1
- package/dist/acp/session-configuration.d.ts +20 -0
- package/dist/acp/session-configuration.d.ts.map +1 -0
- package/dist/acp/session-configuration.js +49 -0
- package/dist/acp/session-configuration.js.map +1 -0
- package/dist/acp/session-contracts.d.ts +11 -2
- package/dist/acp/session-contracts.d.ts.map +1 -1
- package/dist/acp/session-contracts.js +3 -1
- package/dist/acp/session-contracts.js.map +1 -1
- package/dist/acp/session-store.d.ts +3 -1
- package/dist/acp/session-store.d.ts.map +1 -1
- package/dist/acp/session-store.js +9 -2
- package/dist/acp/session-store.js.map +1 -1
- package/dist/agent-catalog/discover-agent-settings.d.ts.map +1 -1
- package/dist/agent-catalog/discover-agent-settings.js +8 -2
- package/dist/agent-catalog/discover-agent-settings.js.map +1 -1
- package/dist/artifacts/local-file-streamer.d.ts.map +1 -1
- package/dist/artifacts/local-file-streamer.js +4 -2
- package/dist/artifacts/local-file-streamer.js.map +1 -1
- package/dist/cli.js +5099 -4963
- package/dist/cli.js.map +4 -4
- package/dist/daemon-command-handler.d.ts.map +1 -1
- package/dist/daemon-command-handler.js +1 -1
- package/dist/daemon-command-handler.js.map +1 -1
- package/dist/daemon-history-commands.d.ts +3 -2
- package/dist/daemon-history-commands.d.ts.map +1 -1
- package/dist/daemon-history-commands.js +12 -5
- package/dist/daemon-history-commands.js.map +1 -1
- package/dist/daemon-prompt-executor.d.ts.map +1 -1
- package/dist/daemon-prompt-executor.js +1 -1
- package/dist/daemon-prompt-executor.js.map +1 -1
- 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 +251 -113
- package/dist/index.js.map +4 -4
- package/dist/runtime.js +251 -113
- package/dist/runtime.js.map +4 -4
- package/dist/schema/acp-session-store/acp-session.d.ts +16 -0
- package/dist/schema/acp-session-store/acp-session.d.ts.map +1 -1
- package/dist/schema/acp-session-store/acp-session.js +1 -0
- package/dist/schema/acp-session-store/acp-session.js.map +1 -1
- package/dist/session-event-log-v2.d.ts +3 -1
- package/dist/session-event-log-v2.d.ts.map +1 -1
- package/dist/session-event-log-v2.js +17 -3
- package/dist/session-event-log-v2.js.map +1 -1
- package/package.json +1 -1
package/dist/runtime.js
CHANGED
|
@@ -21284,8 +21284,10 @@ var lifecycleMetadataV2Schema = external_exports.discriminatedUnion("kind", [
|
|
|
21284
21284
|
external_exports.object({
|
|
21285
21285
|
...lifecycleBase,
|
|
21286
21286
|
content: external_exports.array(contentBlockV2Schema).min(1).max(100).readonly(),
|
|
21287
|
+
disposition: shortString.optional(),
|
|
21287
21288
|
kind: external_exports.literal("prompt.requested"),
|
|
21288
|
-
context: promptExecutionContextV2Schema.optional()
|
|
21289
|
+
context: promptExecutionContextV2Schema.optional(),
|
|
21290
|
+
targetCommandId: identifierStringSchema.optional()
|
|
21289
21291
|
}).readonly(),
|
|
21290
21292
|
external_exports.object({ ...lifecycleBase, attemptId: identifierStringSchema, epoch: identifierStringSchema, kind: external_exports.literal("prompt.started") }).readonly(),
|
|
21291
21293
|
external_exports.object({ ...lifecycleBase, kind: external_exports.literal("prompt.completed"), stopReason: shortString }).readonly(),
|
|
@@ -21394,7 +21396,9 @@ var sessionEventLogPageV2Schema = external_exports.object({
|
|
|
21394
21396
|
var nativeEventPageRequestV2Schema = external_exports.object({ cursor: external_exports.string().min(1).max(512).nullable(), eventLimit: external_exports.number().int().min(1).max(1e4) }).readonly();
|
|
21395
21397
|
var queuedPromptRequestEventLogV2Schema = external_exports.object({
|
|
21396
21398
|
commandId: identifierStringSchema,
|
|
21397
|
-
content: external_exports.array(contentBlockV2Schema).min(1).max(100).readonly()
|
|
21399
|
+
content: external_exports.array(contentBlockV2Schema).min(1).max(100).readonly(),
|
|
21400
|
+
disposition: shortString.optional(),
|
|
21401
|
+
targetCommandId: identifierStringSchema.optional()
|
|
21398
21402
|
}).readonly();
|
|
21399
21403
|
var nativeSessionEventsV2Schema = external_exports.object({
|
|
21400
21404
|
events: sessionEventLogPageV2Schema,
|
|
@@ -21433,18 +21437,21 @@ var SESSION_LIVE_HISTORY_V2_PAGE_LOADED_KIND = "session.live-history.v2.page.loa
|
|
|
21433
21437
|
var SESSION_PREVIEW_HISTORY_PAGE_LOAD_KIND = "session.preview-history.page.load";
|
|
21434
21438
|
var SESSION_PREVIEW_HISTORY_PAGE_LOADED_KIND = "session.preview-history.page.loaded";
|
|
21435
21439
|
var directoryIdentifier = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/);
|
|
21436
|
-
var
|
|
21437
|
-
additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
|
|
21438
|
-
agentId: identifierStringSchema,
|
|
21439
|
-
bindingId: identifierStringSchema,
|
|
21440
|
+
var pageRequestFields = {
|
|
21440
21441
|
cursor: external_exports.string().min(1).max(512).nullable(),
|
|
21441
|
-
directoryId: directoryIdentifier,
|
|
21442
21442
|
eventLimit: external_exports.number().int().min(1).max(1e4),
|
|
21443
21443
|
requestId: identifierStringSchema,
|
|
21444
21444
|
sessionId: identifierStringSchema
|
|
21445
21445
|
};
|
|
21446
|
-
var sessionLiveHistoryV2PageLoadSchema = external_exports.object({ ...
|
|
21447
|
-
var sessionPreviewHistoryPageLoadSchema = external_exports.object({
|
|
21446
|
+
var sessionLiveHistoryV2PageLoadSchema = external_exports.object({ ...pageRequestFields, kind: external_exports.literal(SESSION_LIVE_HISTORY_V2_PAGE_LOAD_KIND) }).readonly();
|
|
21447
|
+
var sessionPreviewHistoryPageLoadSchema = external_exports.object({
|
|
21448
|
+
...pageRequestFields,
|
|
21449
|
+
additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
|
|
21450
|
+
agentId: identifierStringSchema,
|
|
21451
|
+
bindingId: identifierStringSchema,
|
|
21452
|
+
directoryId: directoryIdentifier,
|
|
21453
|
+
kind: external_exports.literal(SESSION_PREVIEW_HISTORY_PAGE_LOAD_KIND)
|
|
21454
|
+
}).readonly();
|
|
21448
21455
|
var pageLoadedFields = {
|
|
21449
21456
|
events: nativeSessionEventsV2Schema,
|
|
21450
21457
|
requestId: identifierStringSchema,
|
|
@@ -23362,7 +23369,11 @@ var threadTurnSchema = external_exports.object({
|
|
|
23362
23369
|
items: external_exports.array(external_exports.unknown()).max(1e5)
|
|
23363
23370
|
});
|
|
23364
23371
|
var threadTurnsSchema = external_exports.array(threadTurnSchema).max(1e5);
|
|
23372
|
+
var collaborationModeSchema = external_exports.object({
|
|
23373
|
+
mode: external_exports.enum(["default", "plan"])
|
|
23374
|
+
});
|
|
23365
23375
|
var threadLifecycleResponseSchema = external_exports.object({
|
|
23376
|
+
collaborationMode: collaborationModeSchema.nullish(),
|
|
23366
23377
|
model: boundedText(256).nullish(),
|
|
23367
23378
|
reasoningEffort: boundedText(256).nullish(),
|
|
23368
23379
|
serviceTier: boundedText(256).nullish(),
|
|
@@ -23407,9 +23418,7 @@ var modelListResponseSchema = external_exports.object({
|
|
|
23407
23418
|
var threadSettingsUpdatedSchema = external_exports.object({
|
|
23408
23419
|
threadId: boundedText(256),
|
|
23409
23420
|
threadSettings: external_exports.object({
|
|
23410
|
-
collaborationMode:
|
|
23411
|
-
mode: external_exports.enum(["default", "plan"])
|
|
23412
|
-
}).nullish()
|
|
23421
|
+
collaborationMode: collaborationModeSchema.nullish()
|
|
23413
23422
|
})
|
|
23414
23423
|
});
|
|
23415
23424
|
|
|
@@ -23886,7 +23895,7 @@ var FULL_ACCESS_MODE = Object.freeze({
|
|
|
23886
23895
|
sandboxPolicy: { type: "dangerFullAccess" }
|
|
23887
23896
|
});
|
|
23888
23897
|
var AGENT_MODES = Object.freeze([READ_ONLY_MODE, AGENT_MODE, FULL_ACCESS_MODE]);
|
|
23889
|
-
var DEFAULT_MODE =
|
|
23898
|
+
var DEFAULT_MODE = FULL_ACCESS_MODE;
|
|
23890
23899
|
function initialMode(environment) {
|
|
23891
23900
|
const requested = environment["INITIAL_AGENT_MODE"];
|
|
23892
23901
|
if (requested === void 0) {
|
|
@@ -23912,7 +23921,7 @@ function effortValues(model) {
|
|
|
23912
23921
|
}));
|
|
23913
23922
|
}
|
|
23914
23923
|
function supportedSelection(models, reportedModel, reportedEffort) {
|
|
23915
|
-
const model = models.find((candidate) => candidate.id === reportedModel)
|
|
23924
|
+
const model = models.find((candidate) => candidate.id === reportedModel);
|
|
23916
23925
|
if (model === void 0) {
|
|
23917
23926
|
return { model: reportedModel, effort: reportedEffort };
|
|
23918
23927
|
}
|
|
@@ -23923,7 +23932,11 @@ function supportedSelection(models, reportedModel, reportedEffort) {
|
|
|
23923
23932
|
};
|
|
23924
23933
|
}
|
|
23925
23934
|
function modelSetting(models, currentValue) {
|
|
23926
|
-
const
|
|
23935
|
+
const catalogValues = modelValues(models);
|
|
23936
|
+
const values = currentValue.length > 0 && !catalogValues.some((value) => value.value === currentValue) ? [
|
|
23937
|
+
{ description: "Current model configured in Codex", name: currentValue, value: currentValue },
|
|
23938
|
+
...catalogValues
|
|
23939
|
+
] : catalogValues;
|
|
23927
23940
|
const current = values.some((value) => value.value === currentValue) ? currentValue : models.find((model) => model.isDefault === true)?.id ?? values[0]?.value ?? "";
|
|
23928
23941
|
if (current.length === 0) {
|
|
23929
23942
|
return null;
|
|
@@ -24004,9 +24017,6 @@ function effortSetting(model, currentValue) {
|
|
|
24004
24017
|
var CodexSettings = class {
|
|
24005
24018
|
#appServer;
|
|
24006
24019
|
#models = [];
|
|
24007
|
-
// Whether the current turn must carry a policy at all. Until the user picks a mode, Codex's own
|
|
24008
|
-
// configuration decides, so `turn/start` omits the fields and inherits what the host set up.
|
|
24009
|
-
#policySelected = false;
|
|
24010
24020
|
// Whether a collaboration mode choice has been made in this session. A restored thread keeps
|
|
24011
24021
|
// the mode Codex already persisted, so the first turn does not reset it to Build.
|
|
24012
24022
|
#collaborationModeSelected = false;
|
|
@@ -24044,16 +24054,12 @@ var CodexSettings = class {
|
|
|
24044
24054
|
turnParameters = () => {
|
|
24045
24055
|
const selection = this.#selection;
|
|
24046
24056
|
const mode = AGENT_MODES.find((candidate) => candidate.id === selection.mode) ?? DEFAULT_MODE;
|
|
24047
|
-
const
|
|
24057
|
+
const model = this.#model(selection.model);
|
|
24058
|
+
const supportsFast = model?.additionalSpeedTiers?.includes(FAST_TIER) === true;
|
|
24048
24059
|
return {
|
|
24049
|
-
|
|
24050
|
-
|
|
24051
|
-
|
|
24052
|
-
...this.#policySelected ? {
|
|
24053
|
-
approvalPolicy: mode.approvalPolicy,
|
|
24054
|
-
approvalsReviewer: mode.approvalsReviewer,
|
|
24055
|
-
sandboxPolicy: mode.sandboxPolicy
|
|
24056
|
-
} : {},
|
|
24060
|
+
approvalPolicy: mode.approvalPolicy,
|
|
24061
|
+
approvalsReviewer: mode.approvalsReviewer,
|
|
24062
|
+
sandboxPolicy: mode.sandboxPolicy,
|
|
24057
24063
|
// The collaboration mode rides on the turn: Codex applies it to the
|
|
24058
24064
|
// thread, where it persists until changed. "Build" is Codex's `default`
|
|
24059
24065
|
// mode, so it is only sent once a choice exists to apply.
|
|
@@ -24067,8 +24073,8 @@ var CodexSettings = class {
|
|
|
24067
24073
|
}
|
|
24068
24074
|
}
|
|
24069
24075
|
} : {},
|
|
24070
|
-
...selection.effort.length === 0 ? {} : { effort: selection.effort },
|
|
24071
|
-
...
|
|
24076
|
+
...model === void 0 || selection.effort.length === 0 ? {} : { effort: selection.effort },
|
|
24077
|
+
...model === void 0 ? {} : { model: model.id },
|
|
24072
24078
|
...selection.fastMode && supportsFast ? { serviceTier: SERVICE_TIER_FAST } : {}
|
|
24073
24079
|
};
|
|
24074
24080
|
};
|
|
@@ -24137,6 +24143,18 @@ var CodexSettings = class {
|
|
|
24137
24143
|
options.push(modeSetting(this.#selection.mode));
|
|
24138
24144
|
return options;
|
|
24139
24145
|
};
|
|
24146
|
+
agentModelEffort = () => ({
|
|
24147
|
+
effortSettingId: REASONING_EFFORT_SETTING_ID,
|
|
24148
|
+
modelSettingId: MODEL_SETTING_ID,
|
|
24149
|
+
resolution: AGENT_MODEL_EFFORT_RESOLUTION_COMPLETE,
|
|
24150
|
+
unsupportedModelIds: [],
|
|
24151
|
+
valuesByModel: Object.fromEntries(
|
|
24152
|
+
this.#models.map((model) => [
|
|
24153
|
+
model.id,
|
|
24154
|
+
effortValues(model).map((value) => ({ ...value, groupId: "", groupName: "" }))
|
|
24155
|
+
])
|
|
24156
|
+
)
|
|
24157
|
+
});
|
|
24140
24158
|
selectRestoredThread = (thread) => {
|
|
24141
24159
|
const supported = supportedSelection(
|
|
24142
24160
|
this.#models,
|
|
@@ -24146,6 +24164,7 @@ var CodexSettings = class {
|
|
|
24146
24164
|
this.#selection = {
|
|
24147
24165
|
...this.#selection,
|
|
24148
24166
|
...supported,
|
|
24167
|
+
collaborationMode: thread.collaborationMode?.mode ?? this.#selection.collaborationMode,
|
|
24149
24168
|
fastMode: thread.serviceTier === SERVICE_TIER_FAST
|
|
24150
24169
|
};
|
|
24151
24170
|
};
|
|
@@ -24185,7 +24204,6 @@ var CodexSettings = class {
|
|
|
24185
24204
|
);
|
|
24186
24205
|
}
|
|
24187
24206
|
this.#selection = { ...this.#selection, mode: value };
|
|
24188
|
-
this.#policySelected = true;
|
|
24189
24207
|
return;
|
|
24190
24208
|
}
|
|
24191
24209
|
if (configId === COLLABORATION_MODE_SETTING_ID) {
|
|
@@ -24522,6 +24540,7 @@ var CodexAcpAgent = class {
|
|
|
24522
24540
|
await this.#interruptTurn();
|
|
24523
24541
|
});
|
|
24524
24542
|
}
|
|
24543
|
+
agentSettingsModelEffort = () => this.#settings.agentModelEffort();
|
|
24525
24544
|
/** The ACP agent app Mobius connects its own ACP client to, in-process. */
|
|
24526
24545
|
app = () => this.#app;
|
|
24527
24546
|
nativeTurnId = () => this.#nativeTurnId;
|
|
@@ -28529,6 +28548,54 @@ function sessionConfigProtocolForAgent(_agentId) {
|
|
|
28529
28548
|
return standardSessionConfigProtocol;
|
|
28530
28549
|
}
|
|
28531
28550
|
|
|
28551
|
+
// src/acp/session-configuration.ts
|
|
28552
|
+
var storedSessionConfigurationsSchema = external_exports.array(
|
|
28553
|
+
external_exports.discriminatedUnion("type", [
|
|
28554
|
+
external_exports.object({ booleanValue: external_exports.boolean(), configId: external_exports.string().max(128), type: external_exports.literal("boolean") }),
|
|
28555
|
+
external_exports.object({ configId: external_exports.string().max(128), type: external_exports.literal("select"), value: external_exports.string().max(500) })
|
|
28556
|
+
])
|
|
28557
|
+
).max(100);
|
|
28558
|
+
var decodeStoredSessionConfigurations = (value) => storedSessionConfigurationsSchema.parse(value);
|
|
28559
|
+
var AcpSessionConfigurations = class {
|
|
28560
|
+
#selected = [];
|
|
28561
|
+
stored = () => this.#selected;
|
|
28562
|
+
capture = (options) => {
|
|
28563
|
+
this.#selected = this.#selected.map((selection) => {
|
|
28564
|
+
const current = options.find(
|
|
28565
|
+
(option) => option.id === selection.configId && option.type === selection.type
|
|
28566
|
+
);
|
|
28567
|
+
if (current === void 0) {
|
|
28568
|
+
return selection;
|
|
28569
|
+
}
|
|
28570
|
+
return current.type === "boolean" ? { booleanValue: current.booleanValue, configId: current.id, type: "boolean" } : { configId: current.id, type: "select", value: current.currentValue };
|
|
28571
|
+
});
|
|
28572
|
+
};
|
|
28573
|
+
select = (option) => {
|
|
28574
|
+
const selected = option.type === "boolean" ? { booleanValue: option.booleanValue, configId: option.id, type: "boolean" } : { configId: option.id, type: "select", value: option.currentValue };
|
|
28575
|
+
this.#selected = [...this.#selected.filter((selection) => selection.configId !== selected.configId), selected];
|
|
28576
|
+
};
|
|
28577
|
+
restore = async (stored, options, apply, signal) => {
|
|
28578
|
+
this.#selected = stored;
|
|
28579
|
+
for (const selection of this.#selected) {
|
|
28580
|
+
const current = options.find(
|
|
28581
|
+
(option) => option.id === selection.configId && option.type === selection.type
|
|
28582
|
+
);
|
|
28583
|
+
if (current === void 0) {
|
|
28584
|
+
continue;
|
|
28585
|
+
}
|
|
28586
|
+
if (selection.type === "boolean") {
|
|
28587
|
+
if (current.booleanValue !== selection.booleanValue) {
|
|
28588
|
+
await apply(selection, signal);
|
|
28589
|
+
}
|
|
28590
|
+
continue;
|
|
28591
|
+
}
|
|
28592
|
+
if (current.currentValue !== selection.value && current.values.some((value) => value.value === selection.value)) {
|
|
28593
|
+
await apply(selection, signal);
|
|
28594
|
+
}
|
|
28595
|
+
}
|
|
28596
|
+
};
|
|
28597
|
+
};
|
|
28598
|
+
|
|
28532
28599
|
// src/acp/session-contracts.ts
|
|
28533
28600
|
var acpNativeHistoryReader = {
|
|
28534
28601
|
access: () => ({ kind: "acp" })
|
|
@@ -28567,10 +28634,12 @@ var AcpAgentSettingsSnapshot = class {
|
|
|
28567
28634
|
agentName;
|
|
28568
28635
|
agentVersion;
|
|
28569
28636
|
configOptions;
|
|
28570
|
-
|
|
28637
|
+
modelEffort;
|
|
28638
|
+
constructor(agentName, agentVersion, configOptions, modelEffort) {
|
|
28571
28639
|
this.agentName = agentName;
|
|
28572
28640
|
this.agentVersion = agentVersion;
|
|
28573
28641
|
this.configOptions = configOptions;
|
|
28642
|
+
this.modelEffort = modelEffort;
|
|
28574
28643
|
}
|
|
28575
28644
|
};
|
|
28576
28645
|
|
|
@@ -34138,6 +34207,7 @@ var acpSession = sqliteTable("acp_session", {
|
|
|
34138
34207
|
nativeSessionId: text("native_session_id").notNull(),
|
|
34139
34208
|
cwd: text("cwd").notNull(),
|
|
34140
34209
|
additionalDirectories: text("additional_directories").notNull(),
|
|
34210
|
+
configurations: text("configurations").notNull().default("[]"),
|
|
34141
34211
|
prompted: integer2("prompted", { mode: "boolean" }).notNull(),
|
|
34142
34212
|
title: text("title").notNull(),
|
|
34143
34213
|
updatedAt: text("updated_at").notNull()
|
|
@@ -34405,15 +34475,17 @@ var AcpStoredSession = class {
|
|
|
34405
34475
|
additionalDirectories;
|
|
34406
34476
|
agentId;
|
|
34407
34477
|
cwd;
|
|
34478
|
+
configurations;
|
|
34408
34479
|
nativeSessionId;
|
|
34409
34480
|
prompted;
|
|
34410
34481
|
sessionId;
|
|
34411
34482
|
title;
|
|
34412
34483
|
updatedAt;
|
|
34413
|
-
constructor(sessionId, agentId, nativeSessionId, cwd, additionalDirectories, prompted, title2, updatedAt = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
34484
|
+
constructor(sessionId, agentId, nativeSessionId, cwd, additionalDirectories, prompted, title2, updatedAt = (/* @__PURE__ */ new Date()).toISOString(), configurations = []) {
|
|
34414
34485
|
this.additionalDirectories = [...additionalDirectories];
|
|
34415
34486
|
this.agentId = agentId;
|
|
34416
34487
|
this.cwd = cwd;
|
|
34488
|
+
this.configurations = configurations.map((configuration) => ({ ...configuration }));
|
|
34417
34489
|
this.nativeSessionId = nativeSessionId;
|
|
34418
34490
|
this.prompted = prompted;
|
|
34419
34491
|
this.sessionId = sessionId;
|
|
@@ -34463,6 +34535,7 @@ var MemoryAcpSessionStore = class {
|
|
|
34463
34535
|
var storedSessionRowSchema = external_exports.object({
|
|
34464
34536
|
additionalDirectories: external_exports.string(),
|
|
34465
34537
|
agentId: external_exports.string(),
|
|
34538
|
+
configurations: external_exports.string(),
|
|
34466
34539
|
cwd: external_exports.string(),
|
|
34467
34540
|
nativeSessionId: external_exports.string(),
|
|
34468
34541
|
prompted: external_exports.boolean(),
|
|
@@ -34474,6 +34547,8 @@ function decodeStoredSession(value) {
|
|
|
34474
34547
|
const row = storedSessionRowSchema.parse(value);
|
|
34475
34548
|
const decodedAdditionalDirectories = JSON.parse(row.additionalDirectories);
|
|
34476
34549
|
const additionalDirectories = external_exports.array(external_exports.string()).parse(decodedAdditionalDirectories);
|
|
34550
|
+
const decodedConfigurations = JSON.parse(row.configurations);
|
|
34551
|
+
const configurations = decodeStoredSessionConfigurations(decodedConfigurations);
|
|
34477
34552
|
return new AcpStoredSession(
|
|
34478
34553
|
row.sessionId,
|
|
34479
34554
|
row.agentId,
|
|
@@ -34482,7 +34557,8 @@ function decodeStoredSession(value) {
|
|
|
34482
34557
|
additionalDirectories,
|
|
34483
34558
|
row.prompted,
|
|
34484
34559
|
row.title,
|
|
34485
|
-
row.updatedAt
|
|
34560
|
+
row.updatedAt,
|
|
34561
|
+
configurations
|
|
34486
34562
|
);
|
|
34487
34563
|
}
|
|
34488
34564
|
var SqliteAcpSessionStore = class {
|
|
@@ -34515,6 +34591,7 @@ var SqliteAcpSessionStore = class {
|
|
|
34515
34591
|
const value = {
|
|
34516
34592
|
additionalDirectories: JSON.stringify(session.additionalDirectories),
|
|
34517
34593
|
agentId: session.agentId,
|
|
34594
|
+
configurations: JSON.stringify(session.configurations),
|
|
34518
34595
|
cwd: session.cwd,
|
|
34519
34596
|
nativeSessionId: session.nativeSessionId,
|
|
34520
34597
|
prompted: session.prompted,
|
|
@@ -34563,6 +34640,7 @@ var AgentSession = class _AgentSession {
|
|
|
34563
34640
|
#commands = [];
|
|
34564
34641
|
#configRevision = 0;
|
|
34565
34642
|
#configOptions = [];
|
|
34643
|
+
#sessionConfigurations = new AcpSessionConfigurations();
|
|
34566
34644
|
#nativeHistoryOwnership = { kind: "unbound" };
|
|
34567
34645
|
#prompted = false;
|
|
34568
34646
|
#nativePrompt = null;
|
|
@@ -34667,6 +34745,41 @@ var AgentSession = class _AgentSession {
|
|
|
34667
34745
|
usesEnvironment = (environment) => recordsEqual(this.#environment, environment);
|
|
34668
34746
|
canRebind = () => !this.#prompted && !this.#turn.running;
|
|
34669
34747
|
hasRunningTurn = () => this.#turn.running;
|
|
34748
|
+
#writeStoredSession = () => {
|
|
34749
|
+
this.#store.write(
|
|
34750
|
+
new AcpStoredSession(
|
|
34751
|
+
this.#mobiusSessionId,
|
|
34752
|
+
this.#agentId,
|
|
34753
|
+
this.#updates.sessionId(),
|
|
34754
|
+
this.#cwd,
|
|
34755
|
+
this.#additionalDirectories,
|
|
34756
|
+
this.#prompted,
|
|
34757
|
+
this.#sessionTitle ?? "",
|
|
34758
|
+
(/* @__PURE__ */ new Date()).toISOString(),
|
|
34759
|
+
this.#sessionConfigurations.stored()
|
|
34760
|
+
)
|
|
34761
|
+
);
|
|
34762
|
+
};
|
|
34763
|
+
#captureSelectedConfigurationValues = () => {
|
|
34764
|
+
this.#sessionConfigurations.capture(this.#configOptions);
|
|
34765
|
+
if (this.#updates.sessionId().length > 0) {
|
|
34766
|
+
this.#writeStoredSession();
|
|
34767
|
+
}
|
|
34768
|
+
};
|
|
34769
|
+
#restoreStoredConfigurations = async (session, signal) => {
|
|
34770
|
+
await this.#sessionConfigurations.restore(
|
|
34771
|
+
session.configurations,
|
|
34772
|
+
this.#configOptions,
|
|
34773
|
+
async (selection, signal2) => await this.#applyConfiguration(
|
|
34774
|
+
selection.configId,
|
|
34775
|
+
selection.type === "select" ? selection.value : "",
|
|
34776
|
+
selection.type === "boolean" ? selection.booleanValue : false,
|
|
34777
|
+
selection.type,
|
|
34778
|
+
signal2
|
|
34779
|
+
),
|
|
34780
|
+
signal
|
|
34781
|
+
);
|
|
34782
|
+
};
|
|
34670
34783
|
prepared = () => new AcpPreparedSession(
|
|
34671
34784
|
this.#agentName,
|
|
34672
34785
|
this.#agentVersion,
|
|
@@ -35017,20 +35130,12 @@ var AgentSession = class _AgentSession {
|
|
|
35017
35130
|
lifecycleResponse = created;
|
|
35018
35131
|
}
|
|
35019
35132
|
this.#configOptions = this.#sessionConfigProtocol.normalizeLifecycle(lifecycleResponse);
|
|
35133
|
+
if (stored instanceof FoundAcpStoredSession && this.#restored) {
|
|
35134
|
+
await this.#restoreStoredConfigurations(stored.session, signal);
|
|
35135
|
+
}
|
|
35020
35136
|
await this.#updates.drained();
|
|
35021
35137
|
signal.throwIfAborted();
|
|
35022
|
-
this.#
|
|
35023
|
-
new AcpStoredSession(
|
|
35024
|
-
this.#mobiusSessionId,
|
|
35025
|
-
this.#agentId,
|
|
35026
|
-
this.#updates.sessionId(),
|
|
35027
|
-
this.#cwd,
|
|
35028
|
-
this.#additionalDirectories,
|
|
35029
|
-
this.#prompted,
|
|
35030
|
-
this.#sessionTitle ?? "",
|
|
35031
|
-
(/* @__PURE__ */ new Date()).toISOString()
|
|
35032
|
-
)
|
|
35033
|
-
);
|
|
35138
|
+
this.#writeStoredSession();
|
|
35034
35139
|
};
|
|
35035
35140
|
listNativeSessions = async (cursor, signal) => {
|
|
35036
35141
|
if (!this.#capabilities.listSessions) {
|
|
@@ -35071,15 +35176,17 @@ var AgentSession = class _AgentSession {
|
|
|
35071
35176
|
this.#cwd,
|
|
35072
35177
|
this.#additionalDirectories,
|
|
35073
35178
|
false,
|
|
35074
|
-
""
|
|
35179
|
+
"",
|
|
35180
|
+
(/* @__PURE__ */ new Date()).toISOString(),
|
|
35181
|
+
this.#sessionConfigurations.stored()
|
|
35075
35182
|
)
|
|
35076
35183
|
);
|
|
35077
35184
|
this.#store.remove(previousSessionId);
|
|
35078
35185
|
this.#mobiusSessionId = sessionId;
|
|
35079
35186
|
};
|
|
35080
|
-
|
|
35081
|
-
const existing = this.#configOptions.find((option) => option.id ===
|
|
35082
|
-
if (existing === void 0 || existing.type !==
|
|
35187
|
+
#applyConfiguration = async (configId, value, booleanValue, valueType, signal) => {
|
|
35188
|
+
const existing = this.#configOptions.find((option) => option.id === configId);
|
|
35189
|
+
if (existing === void 0 || existing.type !== valueType) {
|
|
35083
35190
|
throw new AcpExecutionError(
|
|
35084
35191
|
"The requested ACP configuration option is unavailable",
|
|
35085
35192
|
{},
|
|
@@ -35094,10 +35201,10 @@ var AgentSession = class _AgentSession {
|
|
|
35094
35201
|
"invalid_session_configuration"
|
|
35095
35202
|
);
|
|
35096
35203
|
}
|
|
35097
|
-
if (!existing.values.some((entry) => entry.value ===
|
|
35204
|
+
if (!existing.values.some((entry) => entry.value === value)) {
|
|
35098
35205
|
throw new AcpConfigurationValueUnavailableError(
|
|
35099
|
-
|
|
35100
|
-
|
|
35206
|
+
configId,
|
|
35207
|
+
value,
|
|
35101
35208
|
existing.values.map((entry) => entry.value)
|
|
35102
35209
|
);
|
|
35103
35210
|
}
|
|
@@ -35106,20 +35213,20 @@ var AgentSession = class _AgentSession {
|
|
|
35106
35213
|
try {
|
|
35107
35214
|
const configured = await this.#sessionConfigProtocol.configure(
|
|
35108
35215
|
this.#configOptions,
|
|
35109
|
-
|
|
35216
|
+
{ booleanValue, configId, signal, value },
|
|
35110
35217
|
this.#updates.sessionId(),
|
|
35111
35218
|
{
|
|
35112
|
-
request: async (method, params, failureMessage,
|
|
35219
|
+
request: async (method, params, failureMessage, signal2) => await this.race(
|
|
35113
35220
|
this.#connection.connection.agent.request(method, params, {
|
|
35114
|
-
cancellationSignal:
|
|
35221
|
+
cancellationSignal: signal2
|
|
35115
35222
|
}),
|
|
35116
35223
|
failureMessage,
|
|
35117
|
-
|
|
35224
|
+
signal2
|
|
35118
35225
|
)
|
|
35119
35226
|
}
|
|
35120
35227
|
);
|
|
35121
|
-
const applied = configured.find((option) => option.id ===
|
|
35122
|
-
if (applied === void 0 || applied.type !==
|
|
35228
|
+
const applied = configured.find((option) => option.id === configId);
|
|
35229
|
+
if (applied === void 0 || applied.type !== valueType || applied.type === "boolean" && applied.booleanValue !== booleanValue || applied.type === "select" && applied.currentValue !== value) {
|
|
35123
35230
|
throw new AcpExecutionError(
|
|
35124
35231
|
"The Agent did not apply the requested session configuration",
|
|
35125
35232
|
{},
|
|
@@ -35136,6 +35243,21 @@ var AgentSession = class _AgentSession {
|
|
|
35136
35243
|
}
|
|
35137
35244
|
throw error62;
|
|
35138
35245
|
}
|
|
35246
|
+
};
|
|
35247
|
+
configure = async (options) => {
|
|
35248
|
+
await this.#applyConfiguration(
|
|
35249
|
+
options.configId,
|
|
35250
|
+
options.value,
|
|
35251
|
+
options.booleanValue,
|
|
35252
|
+
options.valueType,
|
|
35253
|
+
options.signal
|
|
35254
|
+
);
|
|
35255
|
+
const applied = this.#configOptions.find((option) => option.id === options.configId);
|
|
35256
|
+
if (applied === void 0) {
|
|
35257
|
+
throw new AcpExecutionError("The requested ACP configuration option is unavailable");
|
|
35258
|
+
}
|
|
35259
|
+
this.#sessionConfigurations.select(applied);
|
|
35260
|
+
this.#writeStoredSession();
|
|
35139
35261
|
return this.#configOptions;
|
|
35140
35262
|
};
|
|
35141
35263
|
buildPrompt = (options) => {
|
|
@@ -35210,19 +35332,8 @@ var AgentSession = class _AgentSession {
|
|
|
35210
35332
|
if (this.#sessionTitle === null || this.#sessionTitle.length === 0) {
|
|
35211
35333
|
this.#sessionTitle = truncate(options.prompt, 500);
|
|
35212
35334
|
}
|
|
35213
|
-
this.#store.write(
|
|
35214
|
-
new AcpStoredSession(
|
|
35215
|
-
this.#mobiusSessionId,
|
|
35216
|
-
this.#agentId,
|
|
35217
|
-
this.#updates.sessionId(),
|
|
35218
|
-
this.#cwd,
|
|
35219
|
-
this.#additionalDirectories,
|
|
35220
|
-
true,
|
|
35221
|
-
this.#sessionTitle,
|
|
35222
|
-
(/* @__PURE__ */ new Date()).toISOString()
|
|
35223
|
-
)
|
|
35224
|
-
);
|
|
35225
35335
|
this.#prompted = true;
|
|
35336
|
+
this.#writeStoredSession();
|
|
35226
35337
|
const running = new RunningAcpTurn(
|
|
35227
35338
|
options.commandId,
|
|
35228
35339
|
options.onActivity,
|
|
@@ -35238,8 +35349,10 @@ var AgentSession = class _AgentSession {
|
|
|
35238
35349
|
payload: {
|
|
35239
35350
|
commandId: options.commandId,
|
|
35240
35351
|
content: lifecycleV2.content,
|
|
35352
|
+
...lifecycleV2.disposition === void 0 ? {} : { disposition: lifecycleV2.disposition },
|
|
35241
35353
|
kind: "prompt.requested",
|
|
35242
|
-
...lifecycleV2.context === void 0 ? {} : { context: lifecycleV2.context }
|
|
35354
|
+
...lifecycleV2.context === void 0 ? {} : { context: lifecycleV2.context },
|
|
35355
|
+
...lifecycleV2.targetCommandId === void 0 ? {} : { targetCommandId: lifecycleV2.targetCommandId }
|
|
35243
35356
|
},
|
|
35244
35357
|
type: "lifecycle-metadata"
|
|
35245
35358
|
});
|
|
@@ -35293,18 +35406,7 @@ var AgentSession = class _AgentSession {
|
|
|
35293
35406
|
usage: result.usage ?? null
|
|
35294
35407
|
});
|
|
35295
35408
|
}
|
|
35296
|
-
this.#
|
|
35297
|
-
new AcpStoredSession(
|
|
35298
|
-
this.#mobiusSessionId,
|
|
35299
|
-
this.#agentId,
|
|
35300
|
-
this.#updates.sessionId(),
|
|
35301
|
-
this.#cwd,
|
|
35302
|
-
this.#additionalDirectories,
|
|
35303
|
-
true,
|
|
35304
|
-
this.#sessionTitle ?? "",
|
|
35305
|
-
(/* @__PURE__ */ new Date()).toISOString()
|
|
35306
|
-
)
|
|
35307
|
-
);
|
|
35409
|
+
this.#writeStoredSession();
|
|
35308
35410
|
if (lifecycleV2 !== void 0) {
|
|
35309
35411
|
await this.recordLifecycleEventV2({
|
|
35310
35412
|
payload: { commandId: options.commandId, kind: "prompt.completed", stopReason: result.stopReason },
|
|
@@ -35357,8 +35459,10 @@ var AgentSession = class _AgentSession {
|
|
|
35357
35459
|
payload: {
|
|
35358
35460
|
commandId: options.commandId,
|
|
35359
35461
|
content: lifecycleV2.content,
|
|
35462
|
+
...lifecycleV2.disposition === void 0 ? {} : { disposition: lifecycleV2.disposition },
|
|
35360
35463
|
kind: "prompt.requested",
|
|
35361
|
-
...lifecycleV2.context === void 0 ? {} : { context: lifecycleV2.context }
|
|
35464
|
+
...lifecycleV2.context === void 0 ? {} : { context: lifecycleV2.context },
|
|
35465
|
+
...lifecycleV2.targetCommandId === void 0 ? {} : { targetCommandId: lifecycleV2.targetCommandId }
|
|
35362
35466
|
},
|
|
35363
35467
|
type: "lifecycle-metadata"
|
|
35364
35468
|
});
|
|
@@ -35560,6 +35664,7 @@ var AgentSession = class _AgentSession {
|
|
|
35560
35664
|
update.configOptions
|
|
35561
35665
|
);
|
|
35562
35666
|
this.#configRevision += 1;
|
|
35667
|
+
this.#captureSelectedConfigurationValues();
|
|
35563
35668
|
await this.emitConfigUpdate();
|
|
35564
35669
|
return;
|
|
35565
35670
|
}
|
|
@@ -35568,6 +35673,7 @@ var AgentSession = class _AgentSession {
|
|
|
35568
35673
|
(option) => option.category === "mode" ? { ...option, currentValue: update.currentModeId } : option
|
|
35569
35674
|
);
|
|
35570
35675
|
this.#configRevision += 1;
|
|
35676
|
+
this.#captureSelectedConfigurationValues();
|
|
35571
35677
|
await this.emitConfigUpdate();
|
|
35572
35678
|
return;
|
|
35573
35679
|
}
|
|
@@ -35583,18 +35689,7 @@ var AgentSession = class _AgentSession {
|
|
|
35583
35689
|
this.#sessionUpdatedAt = truncate(update.updatedAt ?? "", 128);
|
|
35584
35690
|
}
|
|
35585
35691
|
if (this.#updates.sessionId().length > 0) {
|
|
35586
|
-
this.#
|
|
35587
|
-
new AcpStoredSession(
|
|
35588
|
-
this.#mobiusSessionId,
|
|
35589
|
-
this.#agentId,
|
|
35590
|
-
this.#updates.sessionId(),
|
|
35591
|
-
this.#cwd,
|
|
35592
|
-
this.#additionalDirectories,
|
|
35593
|
-
this.#prompted,
|
|
35594
|
-
this.#sessionTitle ?? "",
|
|
35595
|
-
(/* @__PURE__ */ new Date()).toISOString()
|
|
35596
|
-
)
|
|
35597
|
-
);
|
|
35692
|
+
this.#writeStoredSession();
|
|
35598
35693
|
}
|
|
35599
35694
|
await this.#getObserver().onInfo({
|
|
35600
35695
|
kind: SESSION_INFO_UPDATED_KIND,
|
|
@@ -35637,6 +35732,7 @@ var AgentSession = class _AgentSession {
|
|
|
35637
35732
|
}
|
|
35638
35733
|
};
|
|
35639
35734
|
closeProcess = () => this.#connection.closeProcess();
|
|
35735
|
+
agentSettingsModelEffort = () => this.#connection.inProcessAgent?.agentSettingsModelEffort?.() ?? null;
|
|
35640
35736
|
race = (operation, exitMessage, signal) => this.#connection.race(operation, exitMessage, signal);
|
|
35641
35737
|
assertNativeSession = (sessionId) => {
|
|
35642
35738
|
if (sessionId !== this.#updates.sessionId()) {
|
|
@@ -36875,6 +36971,7 @@ var AgentRuntimeManager = class {
|
|
|
36875
36971
|
),
|
|
36876
36972
|
async (runtime) => {
|
|
36877
36973
|
const prepared = runtime.prepared();
|
|
36974
|
+
const discoveredModelEffort = runtime.agentSettingsModelEffort();
|
|
36878
36975
|
const model = options2.model;
|
|
36879
36976
|
const configOptions = model === void 0 ? prepared.configOptions : await runtime.configure({
|
|
36880
36977
|
...options2,
|
|
@@ -36887,7 +36984,12 @@ var AgentRuntimeManager = class {
|
|
|
36887
36984
|
value: model,
|
|
36888
36985
|
valueType: "select"
|
|
36889
36986
|
});
|
|
36890
|
-
return new AcpAgentSettingsSnapshot(
|
|
36987
|
+
return new AcpAgentSettingsSnapshot(
|
|
36988
|
+
prepared.agentName,
|
|
36989
|
+
prepared.agentVersion,
|
|
36990
|
+
configOptions,
|
|
36991
|
+
discoveredModelEffort === null ? { kind: "unavailable" } : { kind: "complete", value: discoveredModelEffort }
|
|
36992
|
+
);
|
|
36891
36993
|
},
|
|
36892
36994
|
async (runtime) => await runtime.close()
|
|
36893
36995
|
);
|
|
@@ -39070,6 +39172,10 @@ var acpSessionStoreMigrations = [
|
|
|
39070
39172
|
{
|
|
39071
39173
|
"name": "0004_special_mathemanic.sql",
|
|
39072
39174
|
"sql": "DROP TABLE `deleted_acp_session`;--> statement-breakpoint\nALTER TABLE `acp_session` DROP COLUMN `last_terminal_command_id`;"
|
|
39175
|
+
},
|
|
39176
|
+
{
|
|
39177
|
+
"name": "0005_orange_amphibian.sql",
|
|
39178
|
+
"sql": "ALTER TABLE `acp_session` ADD `configurations` text DEFAULT '[]' NOT NULL;"
|
|
39073
39179
|
}
|
|
39074
39180
|
];
|
|
39075
39181
|
|
|
@@ -40559,7 +40665,7 @@ import { WebSocket as WebSocket5 } from "undici";
|
|
|
40559
40665
|
// package.json
|
|
40560
40666
|
var package_default = {
|
|
40561
40667
|
name: "@moxt-ai/mobius",
|
|
40562
|
-
version: "0.0.
|
|
40668
|
+
version: "0.0.193",
|
|
40563
40669
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
40564
40670
|
type: "module",
|
|
40565
40671
|
bin: {
|
|
@@ -40873,7 +40979,8 @@ async function discoverAgentSettings(command, config2, directories, sessions, si
|
|
|
40873
40979
|
const baseSnapshot = {
|
|
40874
40980
|
agentName: inspectedBaseSnapshot.agentName,
|
|
40875
40981
|
agentVersion: inspectedBaseSnapshot.agentVersion,
|
|
40876
|
-
configOptions: await discoverOpenCodeModelOptions(agent, cwd, inspectedBaseSnapshot.configOptions, signal)
|
|
40982
|
+
configOptions: await discoverOpenCodeModelOptions(agent, cwd, inspectedBaseSnapshot.configOptions, signal),
|
|
40983
|
+
modelEffort: inspectedBaseSnapshot.modelEffort
|
|
40877
40984
|
};
|
|
40878
40985
|
const baseModel = modelOption(baseSnapshot.configOptions);
|
|
40879
40986
|
const unsupportedModels = [];
|
|
@@ -40913,6 +41020,7 @@ async function discoverAgentSettings(command, config2, directories, sessions, si
|
|
|
40913
41020
|
baseSnapshot.configOptions,
|
|
40914
41021
|
selectedSnapshot.configOptions,
|
|
40915
41022
|
unsupportedModels,
|
|
41023
|
+
baseSnapshot.modelEffort,
|
|
40916
41024
|
cwd,
|
|
40917
41025
|
sessions,
|
|
40918
41026
|
signal
|
|
@@ -41005,7 +41113,7 @@ function unavailableModelEffort() {
|
|
|
41005
41113
|
valuesByModel: {}
|
|
41006
41114
|
};
|
|
41007
41115
|
}
|
|
41008
|
-
async function discoverModelEffort(command, agent, resolution, initialOptions, selectedOptions, initiallyUnsupportedModels, cwd, sessions, signal) {
|
|
41116
|
+
async function discoverModelEffort(command, agent, resolution, initialOptions, selectedOptions, initiallyUnsupportedModels, discoveredModelEffort, cwd, sessions, signal) {
|
|
41009
41117
|
const model = modelOption(initialOptions);
|
|
41010
41118
|
const unsupportedModels = initiallyUnsupportedModels;
|
|
41011
41119
|
if (resolution !== AGENT_MODEL_EFFORT_RESOLUTION_COMPLETE && resolution !== AGENT_MODEL_EFFORT_RESOLUTION_ON_MODEL_SELECTION) {
|
|
@@ -41014,6 +41122,9 @@ async function discoverModelEffort(command, agent, resolution, initialOptions, s
|
|
|
41014
41122
|
if (model === void 0 || model.type !== "select" || model.values.length === 0) {
|
|
41015
41123
|
return { ...unavailableModelEffort(), unsupportedModelIds: unsupportedModelIds(unsupportedModels) };
|
|
41016
41124
|
}
|
|
41125
|
+
if (resolution === AGENT_MODEL_EFFORT_RESOLUTION_COMPLETE && discoveredModelEffort.kind === "complete" && discoveredModelEffort.value.resolution === AGENT_MODEL_EFFORT_RESOLUTION_COMPLETE) {
|
|
41126
|
+
return discoveredModelEffort.value;
|
|
41127
|
+
}
|
|
41017
41128
|
const inspectModel = async (modelValue) => (await sessions.inspectAgentSettings({
|
|
41018
41129
|
additionalDirectories: [],
|
|
41019
41130
|
agent,
|
|
@@ -41252,7 +41363,7 @@ function createAgentSettingsDiscoveryHandler(dependencies) {
|
|
|
41252
41363
|
// src/artifacts/local-file-streamer.ts
|
|
41253
41364
|
import { createReadStream as createReadStream2 } from "node:fs";
|
|
41254
41365
|
import { realpath as realpath9, stat as stat8 } from "node:fs/promises";
|
|
41255
|
-
import { basename as basename4, isAbsolute as isAbsolute11, normalize as normalize4, resolve as resolve5 } from "node:path";
|
|
41366
|
+
import { basename as basename4, extname, isAbsolute as isAbsolute11, normalize as normalize4, resolve as resolve5 } from "node:path";
|
|
41256
41367
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
41257
41368
|
var CHUNK_BYTES = 192 * 1024;
|
|
41258
41369
|
function requestedPath(value) {
|
|
@@ -41302,7 +41413,7 @@ async function streamLocalFile(command, send2, signal, workingDirectory, externa
|
|
|
41302
41413
|
send2({
|
|
41303
41414
|
byteLength: before.size,
|
|
41304
41415
|
kind: FILE_BEGIN_KIND,
|
|
41305
|
-
mediaType: external?.mediaType ?? raster?.mimeType ?? "application/octet-stream",
|
|
41416
|
+
mediaType: external?.mediaType ?? raster?.mimeType ?? (extname(target).toLowerCase() === ".svg" ? "image/svg+xml" : "application/octet-stream"),
|
|
41306
41417
|
modifiedAt: before.mtime.toISOString(),
|
|
41307
41418
|
name: external?.name ?? (basename4(target) || "file"),
|
|
41308
41419
|
requestId: command.requestId,
|
|
@@ -41366,18 +41477,24 @@ async function resolveSessionDirectories(directories, bindingId, directoryId2, a
|
|
|
41366
41477
|
}
|
|
41367
41478
|
|
|
41368
41479
|
// src/daemon-history-commands.ts
|
|
41369
|
-
async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, directories, audit, diagnostics, sessions, eventLogV2, signal) {
|
|
41480
|
+
async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, directories, audit, diagnostics, sessions, nativeSessions, eventLogV2, signal) {
|
|
41481
|
+
let agentId;
|
|
41370
41482
|
try {
|
|
41483
|
+
const [entry] = await nativeSessions.querySessions([command.sessionId], signal);
|
|
41484
|
+
if (entry === void 0) {
|
|
41485
|
+
throw new AcpExecutionError("The Session was not found", {}, "session_not_found");
|
|
41486
|
+
}
|
|
41487
|
+
agentId = entry.agentId;
|
|
41371
41488
|
const resolved = await resolveSessionDirectories(
|
|
41372
41489
|
directories,
|
|
41373
41490
|
config2.bindingId,
|
|
41374
|
-
|
|
41375
|
-
|
|
41491
|
+
entry.directoryId,
|
|
41492
|
+
entry.additionalDirectories.map((directory) => directory.directoryId),
|
|
41376
41493
|
signal
|
|
41377
41494
|
);
|
|
41378
41495
|
const loadOptions = {
|
|
41379
41496
|
additionalDirectories: resolved.additionalDirectories,
|
|
41380
|
-
agent: config2.catalog.find(
|
|
41497
|
+
agent: config2.catalog.find(entry.agentId),
|
|
41381
41498
|
cwd: resolved.cwd,
|
|
41382
41499
|
sessionId: command.sessionId,
|
|
41383
41500
|
signal
|
|
@@ -41422,7 +41539,7 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
|
|
|
41422
41539
|
"session_history_v2_load_failed",
|
|
41423
41540
|
command.requestId,
|
|
41424
41541
|
{
|
|
41425
|
-
agentId:
|
|
41542
|
+
...agentId === void 0 ? {} : { agentId },
|
|
41426
41543
|
code: operationErrorCode(error62),
|
|
41427
41544
|
sessionId: command.sessionId
|
|
41428
41545
|
},
|
|
@@ -41431,7 +41548,7 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
|
|
|
41431
41548
|
audit.record({
|
|
41432
41549
|
commandId: command.requestId,
|
|
41433
41550
|
details: {
|
|
41434
|
-
agentId:
|
|
41551
|
+
...agentId === void 0 ? {} : { agentId },
|
|
41435
41552
|
code: operationErrorCode(error62)
|
|
41436
41553
|
},
|
|
41437
41554
|
event: "session_history_v2_load_failed",
|
|
@@ -41803,7 +41920,13 @@ async function executePrompt({
|
|
|
41803
41920
|
}
|
|
41804
41921
|
}
|
|
41805
41922
|
const stream = activateAttempt();
|
|
41806
|
-
const lifecycleV2 = eventLogV2.started(
|
|
41923
|
+
const lifecycleV2 = eventLogV2.started(
|
|
41924
|
+
command.sessionId,
|
|
41925
|
+
command.commandId,
|
|
41926
|
+
attemptId,
|
|
41927
|
+
stream.epoch,
|
|
41928
|
+
availability.disposition
|
|
41929
|
+
);
|
|
41807
41930
|
const attachments = await resolvePromptArtifacts(config2, command, signal);
|
|
41808
41931
|
let stopReason;
|
|
41809
41932
|
if (availability.disposition === SessionPromptDisposition.Steer) {
|
|
@@ -42291,6 +42414,7 @@ function createDaemonCommandHandler({
|
|
|
42291
42414
|
audit,
|
|
42292
42415
|
diagnostics,
|
|
42293
42416
|
sessions,
|
|
42417
|
+
nativeSessions,
|
|
42294
42418
|
eventLogV2,
|
|
42295
42419
|
signal
|
|
42296
42420
|
);
|
|
@@ -43112,20 +43236,29 @@ var DaemonSessionEventLogV2 = class {
|
|
|
43112
43236
|
this.#queued.set(command.commandId, {
|
|
43113
43237
|
commandId: command.commandId,
|
|
43114
43238
|
content: promptContent(command),
|
|
43239
|
+
...command.disposition === void 0 ? {} : { disposition: command.disposition },
|
|
43115
43240
|
context: {
|
|
43116
43241
|
agentId: command.agentId,
|
|
43117
43242
|
directoryId: command.directoryId,
|
|
43118
43243
|
additionalDirectoryIds: command.additionalDirectoryIds
|
|
43119
43244
|
},
|
|
43120
43245
|
phase: "queued",
|
|
43121
|
-
sessionId: command.sessionId
|
|
43246
|
+
sessionId: command.sessionId,
|
|
43247
|
+
...command.targetCommandId.length === 0 ? {} : { targetCommandId: command.targetCommandId }
|
|
43122
43248
|
});
|
|
43123
43249
|
};
|
|
43124
|
-
started = (sessionId, commandId, attemptId, epoch) => {
|
|
43250
|
+
started = (sessionId, commandId, attemptId, epoch, disposition) => {
|
|
43125
43251
|
const request = this.#queued.get(commandId);
|
|
43126
43252
|
if (request?.sessionId === sessionId) {
|
|
43127
43253
|
this.#queued.set(commandId, { ...request, phase: "running" });
|
|
43128
|
-
return {
|
|
43254
|
+
return {
|
|
43255
|
+
attemptId,
|
|
43256
|
+
content: request.content,
|
|
43257
|
+
disposition,
|
|
43258
|
+
epoch,
|
|
43259
|
+
context: request.context,
|
|
43260
|
+
...request.targetCommandId === void 0 ? {} : { targetCommandId: request.targetCommandId }
|
|
43261
|
+
};
|
|
43129
43262
|
}
|
|
43130
43263
|
throw new Error("The executing prompt was not registered in the V2 queue");
|
|
43131
43264
|
};
|
|
@@ -43212,7 +43345,12 @@ var DaemonSessionEventLogV2 = class {
|
|
|
43212
43345
|
}
|
|
43213
43346
|
};
|
|
43214
43347
|
promptRequestRecovery = (sessionId) => ({
|
|
43215
|
-
queuedPromptRequests: [...this.#queued.values()].filter((request) => request.sessionId === sessionId && request.phase === "queued").map(({ commandId, content }) => ({
|
|
43348
|
+
queuedPromptRequests: [...this.#queued.values()].filter((request) => request.sessionId === sessionId && request.phase === "queued").map(({ commandId, content, disposition, targetCommandId }) => ({
|
|
43349
|
+
commandId,
|
|
43350
|
+
content,
|
|
43351
|
+
...disposition === void 0 ? {} : { disposition },
|
|
43352
|
+
...targetCommandId === void 0 ? {} : { targetCommandId }
|
|
43353
|
+
}))
|
|
43216
43354
|
});
|
|
43217
43355
|
};
|
|
43218
43356
|
|