@moxt-ai/mobius 0.0.46 → 0.0.48
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/session-manager.d.ts +1 -0
- package/dist/acp/session-manager.d.ts.map +1 -1
- package/dist/acp/session-manager.js +27 -24
- package/dist/acp/session-manager.js.map +1 -1
- package/dist/agent-catalog/agent-specification.d.ts +0 -1
- package/dist/agent-catalog/agent-specification.d.ts.map +1 -1
- package/dist/agent-catalog/agent-specification.js +0 -2
- package/dist/agent-catalog/agent-specification.js.map +1 -1
- package/dist/agent-catalog/agents/pi-agent.d.ts +0 -1
- package/dist/agent-catalog/agents/pi-agent.d.ts.map +1 -1
- package/dist/agent-catalog/agents/pi-agent.js +0 -2
- package/dist/agent-catalog/agents/pi-agent.js.map +1 -1
- package/dist/agent-catalog/discover-agent.d.ts.map +1 -1
- package/dist/agent-catalog/discover-agent.js +2 -2
- package/dist/agent-catalog/discover-agent.js.map +1 -1
- package/dist/agent-catalog/local-agent.d.ts +1 -2
- package/dist/agent-catalog/local-agent.d.ts.map +1 -1
- package/dist/agent-catalog/local-agent.js +2 -7
- package/dist/agent-catalog/local-agent.js.map +1 -1
- package/dist/bots/bot-execution-context.d.ts +0 -1
- package/dist/bots/bot-execution-context.d.ts.map +1 -1
- package/dist/bots/bot-execution-context.js +0 -7
- package/dist/bots/bot-execution-context.js.map +1 -1
- package/dist/cli.js +174 -82
- package/dist/cli.js.map +3 -3
- package/dist/index.js +173 -81
- package/dist/index.js.map +3 -3
- package/dist/run-daemon.d.ts.map +1 -1
- package/dist/run-daemon.js +89 -31
- package/dist/run-daemon.js.map +1 -1
- package/dist/runtime.js +173 -81
- package/dist/runtime.js.map +3 -3
- package/package.json +1 -1
package/dist/runtime.js
CHANGED
|
@@ -22127,11 +22127,7 @@ var LocalAgentDefinition = class _LocalAgentDefinition {
|
|
|
22127
22127
|
id;
|
|
22128
22128
|
label;
|
|
22129
22129
|
permissionProfile;
|
|
22130
|
-
|
|
22131
|
-
constructor(id, label, command, arguments_, environment = {}, adapterVersion = "", agentVersion = "", adapterIdentity = readTrustedIdentity(command), agentIdentity = adapterIdentity, promptTimeoutMilliseconds = 30 * 60 * 1e3, capabilities = unsupportedSessionCapabilities(), permissionProfile = permissionProfileForAgent(id)) {
|
|
22132
|
-
if (!Number.isSafeInteger(promptTimeoutMilliseconds) || promptTimeoutMilliseconds < 1) {
|
|
22133
|
-
throw new Error("The local Agent prompt deadline is invalid");
|
|
22134
|
-
}
|
|
22130
|
+
constructor(id, label, command, arguments_, environment = {}, adapterVersion = "", agentVersion = "", adapterIdentity = readTrustedIdentity(command), agentIdentity = adapterIdentity, capabilities = unsupportedSessionCapabilities(), permissionProfile = permissionProfileForAgent(id)) {
|
|
22135
22131
|
this.adapterIdentity = adapterIdentity;
|
|
22136
22132
|
this.adapterPath = adapterIdentity.realPath;
|
|
22137
22133
|
this.adapterVersion = adapterVersion;
|
|
@@ -22141,7 +22137,6 @@ var LocalAgentDefinition = class _LocalAgentDefinition {
|
|
|
22141
22137
|
this.id = id;
|
|
22142
22138
|
this.label = label;
|
|
22143
22139
|
this.permissionProfile = permissionProfile;
|
|
22144
|
-
this.promptTimeoutMilliseconds = promptTimeoutMilliseconds;
|
|
22145
22140
|
this.command = adapterIdentity.realPath;
|
|
22146
22141
|
this.arguments = Object.freeze([...arguments_]);
|
|
22147
22142
|
this.environment = permissionProfile.apply(environment, permissionProfile.currentMode(environment));
|
|
@@ -22160,7 +22155,6 @@ var LocalAgentDefinition = class _LocalAgentDefinition {
|
|
|
22160
22155
|
this.agentVersion,
|
|
22161
22156
|
this.adapterIdentity,
|
|
22162
22157
|
this.agentIdentity,
|
|
22163
|
-
this.promptTimeoutMilliseconds,
|
|
22164
22158
|
this.capabilities,
|
|
22165
22159
|
this.permissionProfile
|
|
22166
22160
|
);
|
|
@@ -22679,7 +22673,6 @@ function normalizeVersionOutput(output2) {
|
|
|
22679
22673
|
// src/agent-catalog/agent-specification.ts
|
|
22680
22674
|
var VERSION_PROBE_TIMEOUT_MILLISECONDS = 3e3;
|
|
22681
22675
|
var ACP_PROBE_TIMEOUT_MILLISECONDS = 5e3;
|
|
22682
|
-
var DEFAULT_PROMPT_TIMEOUT_MILLISECONDS = 30 * 60 * 1e3;
|
|
22683
22676
|
var LocalAgentSpecification = class {
|
|
22684
22677
|
acpProbeTimeoutMilliseconds = ACP_PROBE_TIMEOUT_MILLISECONDS;
|
|
22685
22678
|
authenticationCommand = () => "";
|
|
@@ -22687,7 +22680,6 @@ var LocalAgentSpecification = class {
|
|
|
22687
22680
|
agentVersionArguments = ["--version"];
|
|
22688
22681
|
normalizeAdapterVersion = normalizeVersionOutput;
|
|
22689
22682
|
normalizeAgentVersion = normalizeVersionOutput;
|
|
22690
|
-
promptTimeoutMilliseconds = DEFAULT_PROMPT_TIMEOUT_MILLISECONDS;
|
|
22691
22683
|
versionProbeTimeoutMilliseconds = VERSION_PROBE_TIMEOUT_MILLISECONDS;
|
|
22692
22684
|
resolveManagedAgent = async (stateDirectory, platform, signal) => {
|
|
22693
22685
|
signal.throwIfAborted();
|
|
@@ -23539,7 +23531,6 @@ var PI_AGENT_PACKAGE = new SriManagedNpmPackageDefinition(
|
|
|
23539
23531
|
|
|
23540
23532
|
// src/agent-catalog/agents/pi-agent.ts
|
|
23541
23533
|
var ACP_PROBE_TIMEOUT_MILLISECONDS2 = 3e4;
|
|
23542
|
-
var PROMPT_TIMEOUT_MILLISECONDS = 5 * 60 * 1e3;
|
|
23543
23534
|
var PiAgentSpecification = class extends BridgedAcpAgentDefinition {
|
|
23544
23535
|
acpProbeTimeoutMilliseconds = ACP_PROBE_TIMEOUT_MILLISECONDS2;
|
|
23545
23536
|
adapterEnvironmentVariable = "PI_ACP_PI_COMMAND";
|
|
@@ -23571,7 +23562,6 @@ var PiAgentSpecification = class extends BridgedAcpAgentDefinition {
|
|
|
23571
23562
|
"bundle",
|
|
23572
23563
|
"cli.js"
|
|
23573
23564
|
];
|
|
23574
|
-
promptTimeoutMilliseconds = PROMPT_TIMEOUT_MILLISECONDS;
|
|
23575
23565
|
resolveManagedAgent = async (stateDirectory, _platform, signal) => {
|
|
23576
23566
|
signal.throwIfAborted();
|
|
23577
23567
|
const executable = await validateManagedNpmPackage(
|
|
@@ -24223,8 +24213,7 @@ async function discoverAgent(specification, context) {
|
|
|
24223
24213
|
adapterVersion,
|
|
24224
24214
|
agentVersion,
|
|
24225
24215
|
adapter.identity,
|
|
24226
|
-
agent.identity
|
|
24227
|
-
specification.promptTimeoutMilliseconds
|
|
24216
|
+
agent.identity
|
|
24228
24217
|
);
|
|
24229
24218
|
try {
|
|
24230
24219
|
const readiness = await probeAcpReadiness(
|
|
@@ -24250,7 +24239,6 @@ async function discoverAgent(specification, context) {
|
|
|
24250
24239
|
agentVersion,
|
|
24251
24240
|
adapter.identity,
|
|
24252
24241
|
agent.identity,
|
|
24253
|
-
specification.promptTimeoutMilliseconds,
|
|
24254
24242
|
readiness.capabilities
|
|
24255
24243
|
)
|
|
24256
24244
|
);
|
|
@@ -33147,6 +33135,7 @@ var MAX_ACP_PROCESSES = 10;
|
|
|
33147
33135
|
var MAX_PRE_SESSION_UPDATES = 100;
|
|
33148
33136
|
var MAX_PRE_SESSION_UPDATE_BYTES = 1024 * 1024;
|
|
33149
33137
|
var SESSION_CONTROL_COMMAND_ID = "session-control";
|
|
33138
|
+
var SESSION_CONTROL_TIMEOUT_MILLISECONDS = 3e4;
|
|
33150
33139
|
var NullAcpSessionObserver = class {
|
|
33151
33140
|
importLocalArtifact = (_sessionId, _artifact, signal) => {
|
|
33152
33141
|
signal.throwIfAborted();
|
|
@@ -33710,7 +33699,7 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
33710
33699
|
#preSessionUpdateBytes = 0;
|
|
33711
33700
|
#agentName = "";
|
|
33712
33701
|
#agentVersion = "";
|
|
33713
|
-
#bufferedAgentText =
|
|
33702
|
+
#bufferedAgentText = [];
|
|
33714
33703
|
#capabilities = {
|
|
33715
33704
|
additionalDirectories: false,
|
|
33716
33705
|
audioPrompt: false,
|
|
@@ -33899,20 +33888,30 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
33899
33888
|
});
|
|
33900
33889
|
};
|
|
33901
33890
|
bufferAgentText = async (text3, messageId) => {
|
|
33902
|
-
|
|
33903
|
-
|
|
33904
|
-
this.#bufferedAgentText =
|
|
33891
|
+
const previous2 = this.#bufferedAgentText.at(-1);
|
|
33892
|
+
if (previous2?.messageId === messageId) {
|
|
33893
|
+
this.#bufferedAgentText = [
|
|
33894
|
+
...this.#bufferedAgentText.slice(0, -1),
|
|
33895
|
+
{ chunks: [...previous2.chunks, text3], messageId }
|
|
33896
|
+
];
|
|
33897
|
+
return;
|
|
33905
33898
|
}
|
|
33906
|
-
this.#bufferedAgentText = {
|
|
33907
|
-
chunks: [...this.#bufferedAgentText?.chunks ?? [], text3],
|
|
33908
|
-
messageId
|
|
33909
|
-
};
|
|
33899
|
+
this.#bufferedAgentText = [...this.#bufferedAgentText, { chunks: [text3], messageId }];
|
|
33910
33900
|
};
|
|
33911
33901
|
flushAgentText = async () => {
|
|
33912
33902
|
const buffered = this.#bufferedAgentText;
|
|
33913
|
-
this.#bufferedAgentText =
|
|
33914
|
-
|
|
33915
|
-
await this.emitAgentMessage(
|
|
33903
|
+
this.#bufferedAgentText = [];
|
|
33904
|
+
for (const message of buffered) {
|
|
33905
|
+
await this.emitAgentMessage(message.chunks, message.messageId);
|
|
33906
|
+
}
|
|
33907
|
+
};
|
|
33908
|
+
recordBufferedAgentTextAsProgress = async () => {
|
|
33909
|
+
const buffered = this.#bufferedAgentText;
|
|
33910
|
+
this.#bufferedAgentText = [];
|
|
33911
|
+
for (const message of buffered) {
|
|
33912
|
+
for (const chunk of message.chunks) {
|
|
33913
|
+
await this.#turn.activities.recordNarrative("progress", message.messageId, chunk);
|
|
33914
|
+
}
|
|
33916
33915
|
}
|
|
33917
33916
|
};
|
|
33918
33917
|
prepareAgentContent = async (content3) => {
|
|
@@ -34426,7 +34425,7 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
34426
34425
|
cause: error62
|
|
34427
34426
|
});
|
|
34428
34427
|
} finally {
|
|
34429
|
-
this.#bufferedAgentText =
|
|
34428
|
+
this.#bufferedAgentText = [];
|
|
34430
34429
|
this.#turn = new IdleAcpTurn();
|
|
34431
34430
|
}
|
|
34432
34431
|
};
|
|
@@ -34741,6 +34740,7 @@ var AcpProcessSession = class _AcpProcessSession {
|
|
|
34741
34740
|
return;
|
|
34742
34741
|
}
|
|
34743
34742
|
if (update.sessionUpdate === "tool_call") {
|
|
34743
|
+
await this.recordBufferedAgentTextAsProgress();
|
|
34744
34744
|
await this.#turn.activities.recordToolCall(update);
|
|
34745
34745
|
return;
|
|
34746
34746
|
}
|
|
@@ -35586,7 +35586,7 @@ var AcpSessionManager = class {
|
|
|
35586
35586
|
() => deadlineController.abort(
|
|
35587
35587
|
new AcpExecutionError("The steering request exceeded its deadline", {}, "steering_timeout")
|
|
35588
35588
|
),
|
|
35589
|
-
|
|
35589
|
+
SESSION_CONTROL_TIMEOUT_MILLISECONDS
|
|
35590
35590
|
);
|
|
35591
35591
|
deadline.unref();
|
|
35592
35592
|
try {
|
|
@@ -35611,28 +35611,13 @@ var AcpSessionManager = class {
|
|
|
35611
35611
|
if (this.#activeSessionIds.has(options.sessionId)) {
|
|
35612
35612
|
throw new AcpExecutionError("Another prompt is already running in this conversation", {}, "session_busy");
|
|
35613
35613
|
}
|
|
35614
|
-
const deadlineController = new AbortController();
|
|
35615
|
-
const deadlineError = new AcpExecutionError(
|
|
35616
|
-
"The local Agent prompt exceeded its deadline",
|
|
35617
|
-
{},
|
|
35618
|
-
"prompt_timeout"
|
|
35619
|
-
);
|
|
35620
|
-
const deadline = setTimeout(
|
|
35621
|
-
() => deadlineController.abort(deadlineError),
|
|
35622
|
-
options.agent.promptTimeoutMilliseconds
|
|
35623
|
-
);
|
|
35624
|
-
deadline.unref();
|
|
35625
|
-
const boundedOptions = {
|
|
35626
|
-
...options,
|
|
35627
|
-
signal: AbortSignal.any([options.signal, deadlineController.signal])
|
|
35628
|
-
};
|
|
35629
35614
|
this.#activeSessionIds.add(options.sessionId);
|
|
35630
35615
|
this.#activeCommandIds.set(options.sessionId, options.commandId);
|
|
35631
35616
|
try {
|
|
35632
35617
|
if (this.#cancellationRequests.has(options.sessionId)) {
|
|
35633
35618
|
return { stopReason: "cancelled" };
|
|
35634
35619
|
}
|
|
35635
|
-
const runtime = await this.ensureSession(
|
|
35620
|
+
const runtime = await this.ensureSession(options);
|
|
35636
35621
|
if (this.#nativeOperations.has(`${options.agent.id}:${runtime.nativeSessionId()}`)) {
|
|
35637
35622
|
throw new AcpExecutionError("The native session is being managed", {}, "session_busy");
|
|
35638
35623
|
}
|
|
@@ -35640,7 +35625,7 @@ var AcpSessionManager = class {
|
|
|
35640
35625
|
return { stopReason: "cancelled" };
|
|
35641
35626
|
}
|
|
35642
35627
|
try {
|
|
35643
|
-
const result = await runtime.prompt(
|
|
35628
|
+
const result = await runtime.prompt(options);
|
|
35644
35629
|
return this.#cancellationRequests.has(options.sessionId) ? { stopReason: "cancelled" } : result;
|
|
35645
35630
|
} catch (error62) {
|
|
35646
35631
|
if (this.#cancellationRequests.has(options.sessionId)) {
|
|
@@ -35668,7 +35653,6 @@ var AcpSessionManager = class {
|
|
|
35668
35653
|
cause: error62
|
|
35669
35654
|
});
|
|
35670
35655
|
} finally {
|
|
35671
|
-
clearTimeout(deadline);
|
|
35672
35656
|
try {
|
|
35673
35657
|
await this.#cancellationRequests.get(options.sessionId);
|
|
35674
35658
|
} finally {
|
|
@@ -37217,10 +37201,6 @@ var BotExecutionContextRegistry = class {
|
|
|
37217
37201
|
#activeByHandle = /* @__PURE__ */ new Map();
|
|
37218
37202
|
#handlesBySession = /* @__PURE__ */ new Map();
|
|
37219
37203
|
#inactiveHandles = /* @__PURE__ */ new Set();
|
|
37220
|
-
#now;
|
|
37221
|
-
constructor(now = Date.now) {
|
|
37222
|
-
this.#now = now;
|
|
37223
|
-
}
|
|
37224
37204
|
activate = (command) => {
|
|
37225
37205
|
let handle = this.#handlesBySession.get(command.sessionId);
|
|
37226
37206
|
if (handle === void 0) {
|
|
@@ -37254,12 +37234,6 @@ var BotExecutionContextRegistry = class {
|
|
|
37254
37234
|
"An active Bot execution context is required"
|
|
37255
37235
|
);
|
|
37256
37236
|
}
|
|
37257
|
-
if (Date.parse(context.command.executionDeadlineAt) <= this.#now()) {
|
|
37258
|
-
throw new LocalBotAuthorizationError(
|
|
37259
|
-
"execution_capability_expired",
|
|
37260
|
-
"The Bot execution capability has expired"
|
|
37261
|
-
);
|
|
37262
|
-
}
|
|
37263
37237
|
return context;
|
|
37264
37238
|
};
|
|
37265
37239
|
};
|
|
@@ -40129,11 +40103,13 @@ async function executePrompt(outbox, publisher, command, config2, directories, a
|
|
|
40129
40103
|
} else {
|
|
40130
40104
|
await applyCompleteSessionConfiguration(
|
|
40131
40105
|
sessions,
|
|
40106
|
+
audit,
|
|
40132
40107
|
prepared.configOptions,
|
|
40133
40108
|
command.sessionConfigurations,
|
|
40134
40109
|
agent,
|
|
40135
40110
|
resolved.cwd,
|
|
40136
40111
|
resolved.additionalDirectories,
|
|
40112
|
+
command.commandId,
|
|
40137
40113
|
command.sessionId,
|
|
40138
40114
|
signal
|
|
40139
40115
|
);
|
|
@@ -40274,6 +40250,26 @@ function assertSessionConfigurationSchema(options, selections) {
|
|
|
40274
40250
|
}
|
|
40275
40251
|
}
|
|
40276
40252
|
}
|
|
40253
|
+
function assertSessionConfigurationCoverage(options, selections) {
|
|
40254
|
+
const selectionsById = new Map(selections.map((selection) => [selection.configId, selection]));
|
|
40255
|
+
if (selectionsById.size !== selections.length) {
|
|
40256
|
+
throw invalidSessionConfiguration("The Turn configuration contains duplicate Agent settings");
|
|
40257
|
+
}
|
|
40258
|
+
for (const option of options) {
|
|
40259
|
+
if (!selectionsById.has(option.id)) {
|
|
40260
|
+
throw invalidSessionConfiguration(`The Turn configuration does not match Agent setting ${option.id}`);
|
|
40261
|
+
}
|
|
40262
|
+
}
|
|
40263
|
+
}
|
|
40264
|
+
function sessionConfigurationSelectionIsAvailable(option, selection) {
|
|
40265
|
+
if (option.type !== selection.valueType) {
|
|
40266
|
+
return false;
|
|
40267
|
+
}
|
|
40268
|
+
if (option.type === "boolean") {
|
|
40269
|
+
return selection.value.length === 0;
|
|
40270
|
+
}
|
|
40271
|
+
return !selection.booleanValue && option.values.some((value) => value.value === selection.value);
|
|
40272
|
+
}
|
|
40277
40273
|
function sessionConfigurationMatches(option, selection) {
|
|
40278
40274
|
validateSessionConfigurationSelection(option, selection);
|
|
40279
40275
|
return option.type === "boolean" ? option.booleanValue === selection.booleanValue : option.currentValue === selection.value;
|
|
@@ -40304,11 +40300,92 @@ function assertCompleteSessionConfiguration(options, selections) {
|
|
|
40304
40300
|
}
|
|
40305
40301
|
}
|
|
40306
40302
|
}
|
|
40307
|
-
|
|
40303
|
+
function assertAppliedSessionConfiguration(options, selections) {
|
|
40304
|
+
const selectionsById = new Map(selections.map((selection) => [selection.configId, selection]));
|
|
40305
|
+
for (const option of options) {
|
|
40306
|
+
const selection = selectionsById.get(option.id);
|
|
40307
|
+
if (option.id === AGENT_PERMISSION_MODE_CONFIG_ID) {
|
|
40308
|
+
if (selection === void 0 || !sessionConfigurationMatches(option, selection)) {
|
|
40309
|
+
throw invalidSessionConfiguration(`The Turn configuration does not match Agent setting ${option.id}`);
|
|
40310
|
+
}
|
|
40311
|
+
continue;
|
|
40312
|
+
}
|
|
40313
|
+
if (selection === void 0 || !sessionConfigurationSelectionIsAvailable(option, selection)) {
|
|
40314
|
+
continue;
|
|
40315
|
+
}
|
|
40316
|
+
if (!sessionConfigurationMatches(option, selection)) {
|
|
40317
|
+
throw invalidSessionConfiguration(`The Turn configuration does not match Agent setting ${option.id}`);
|
|
40318
|
+
}
|
|
40319
|
+
}
|
|
40320
|
+
}
|
|
40321
|
+
function unavailableSessionConfigurationCategory(selection) {
|
|
40322
|
+
if (selection.configId === "model") {
|
|
40323
|
+
return "model";
|
|
40324
|
+
}
|
|
40325
|
+
if (selection.configId === "reasoning_effort") {
|
|
40326
|
+
return "thought_level";
|
|
40327
|
+
}
|
|
40328
|
+
return "unknown";
|
|
40329
|
+
}
|
|
40330
|
+
async function applySessionConfigurationSelection(sessions, audit, options, selection, agent, cwd, additionalDirectories, commandId, sessionId, signal) {
|
|
40308
40331
|
const option = options.find((candidate) => candidate.id === selection.configId);
|
|
40309
40332
|
if (option === void 0) {
|
|
40333
|
+
if (selection.configId !== AGENT_PERMISSION_MODE_CONFIG_ID) {
|
|
40334
|
+
warnIgnoredSetting(
|
|
40335
|
+
audit,
|
|
40336
|
+
"session_configuration_setting_ignored",
|
|
40337
|
+
commandId,
|
|
40338
|
+
sessionId,
|
|
40339
|
+
agent.id,
|
|
40340
|
+
selection,
|
|
40341
|
+
unavailableSessionConfigurationCategory(selection),
|
|
40342
|
+
"setting_unavailable"
|
|
40343
|
+
);
|
|
40344
|
+
return options;
|
|
40345
|
+
}
|
|
40310
40346
|
throw invalidSessionConfiguration(`The Agent setting ${selection.configId} is unavailable`);
|
|
40311
40347
|
}
|
|
40348
|
+
if (selection.configId !== AGENT_PERMISSION_MODE_CONFIG_ID) {
|
|
40349
|
+
if (option.type !== selection.valueType) {
|
|
40350
|
+
warnIgnoredSetting(
|
|
40351
|
+
audit,
|
|
40352
|
+
"session_configuration_setting_ignored",
|
|
40353
|
+
commandId,
|
|
40354
|
+
sessionId,
|
|
40355
|
+
agent.id,
|
|
40356
|
+
selection,
|
|
40357
|
+
option.category,
|
|
40358
|
+
"setting_schema_mismatch"
|
|
40359
|
+
);
|
|
40360
|
+
return options;
|
|
40361
|
+
}
|
|
40362
|
+
if (option.type === "boolean" && selection.value.length > 0 || option.type === "select" && selection.booleanValue) {
|
|
40363
|
+
warnIgnoredSetting(
|
|
40364
|
+
audit,
|
|
40365
|
+
"session_configuration_setting_ignored",
|
|
40366
|
+
commandId,
|
|
40367
|
+
sessionId,
|
|
40368
|
+
agent.id,
|
|
40369
|
+
selection,
|
|
40370
|
+
option.category,
|
|
40371
|
+
"selection_schema_mismatch"
|
|
40372
|
+
);
|
|
40373
|
+
return options;
|
|
40374
|
+
}
|
|
40375
|
+
if (option.type === "select" && !option.values.some((value) => value.value === selection.value)) {
|
|
40376
|
+
warnIgnoredSetting(
|
|
40377
|
+
audit,
|
|
40378
|
+
"session_configuration_setting_ignored",
|
|
40379
|
+
commandId,
|
|
40380
|
+
sessionId,
|
|
40381
|
+
agent.id,
|
|
40382
|
+
selection,
|
|
40383
|
+
option.category,
|
|
40384
|
+
"value_unavailable"
|
|
40385
|
+
);
|
|
40386
|
+
return options;
|
|
40387
|
+
}
|
|
40388
|
+
}
|
|
40312
40389
|
if (sessionConfigurationMatches(option, selection)) {
|
|
40313
40390
|
return options;
|
|
40314
40391
|
}
|
|
@@ -40325,8 +40402,8 @@ async function applySessionConfigurationSelection(sessions, options, selection,
|
|
|
40325
40402
|
valueType: selection.valueType
|
|
40326
40403
|
});
|
|
40327
40404
|
}
|
|
40328
|
-
async function applyCompleteSessionConfiguration(sessions, initialOptions, selections, agent, cwd, additionalDirectories, sessionId, signal) {
|
|
40329
|
-
|
|
40405
|
+
async function applyCompleteSessionConfiguration(sessions, audit, initialOptions, selections, agent, cwd, additionalDirectories, commandId, sessionId, signal) {
|
|
40406
|
+
assertSessionConfigurationCoverage(initialOptions, selections);
|
|
40330
40407
|
let options = initialOptions;
|
|
40331
40408
|
const orderedSelections = selections.toSorted((left, right) => {
|
|
40332
40409
|
const priority = sessionConfigurationPriority(left, initialOptions) - sessionConfigurationPriority(right, initialOptions);
|
|
@@ -40335,16 +40412,18 @@ async function applyCompleteSessionConfiguration(sessions, initialOptions, selec
|
|
|
40335
40412
|
for (const selection of orderedSelections) {
|
|
40336
40413
|
options = await applySessionConfigurationSelection(
|
|
40337
40414
|
sessions,
|
|
40415
|
+
audit,
|
|
40338
40416
|
options,
|
|
40339
40417
|
selection,
|
|
40340
40418
|
agent,
|
|
40341
40419
|
cwd,
|
|
40342
40420
|
additionalDirectories,
|
|
40421
|
+
commandId,
|
|
40343
40422
|
sessionId,
|
|
40344
40423
|
signal
|
|
40345
40424
|
);
|
|
40346
40425
|
}
|
|
40347
|
-
|
|
40426
|
+
assertAppliedSessionConfiguration(options, selections);
|
|
40348
40427
|
}
|
|
40349
40428
|
function botExecutionAgent(agent, contextHandle, socketPath) {
|
|
40350
40429
|
return new LocalAgentDefinition(
|
|
@@ -40363,7 +40442,6 @@ function botExecutionAgent(agent, contextHandle, socketPath) {
|
|
|
40363
40442
|
agent.agentVersion,
|
|
40364
40443
|
agent.adapterIdentity,
|
|
40365
40444
|
agent.agentIdentity,
|
|
40366
|
-
agent.promptTimeoutMilliseconds,
|
|
40367
40445
|
agent.capabilities,
|
|
40368
40446
|
agent.permissionProfile
|
|
40369
40447
|
);
|
|
@@ -40378,7 +40456,7 @@ function assertPreparedPermission(configOptions, permissionMode) {
|
|
|
40378
40456
|
);
|
|
40379
40457
|
}
|
|
40380
40458
|
}
|
|
40381
|
-
function
|
|
40459
|
+
function warnIgnoredSetting(audit, event, commandId, sessionId, agentId, selection, category, reason) {
|
|
40382
40460
|
const details = {
|
|
40383
40461
|
agentId,
|
|
40384
40462
|
category,
|
|
@@ -40386,7 +40464,6 @@ function warnIgnoredExecutionSetting(audit, commandId, sessionId, agentId, selec
|
|
|
40386
40464
|
reason,
|
|
40387
40465
|
requestedValue: selection.value
|
|
40388
40466
|
};
|
|
40389
|
-
const event = "bot_execution_setting_ignored";
|
|
40390
40467
|
audit.record({ commandId, details, event, sessionId });
|
|
40391
40468
|
process.stderr.write(`Mobius daemon warning ${JSON.stringify({ commandId, event, sessionId, ...details })}
|
|
40392
40469
|
`);
|
|
@@ -40397,12 +40474,22 @@ async function applySupportedExecutionSelection(sessions, audit, configOptions,
|
|
|
40397
40474
|
}
|
|
40398
40475
|
const option = configOptions.find((candidate) => candidate.id === selection.configId);
|
|
40399
40476
|
if (option === void 0) {
|
|
40400
|
-
|
|
40477
|
+
warnIgnoredSetting(
|
|
40478
|
+
audit,
|
|
40479
|
+
"bot_execution_setting_ignored",
|
|
40480
|
+
commandId,
|
|
40481
|
+
sessionId,
|
|
40482
|
+
agent.id,
|
|
40483
|
+
selection,
|
|
40484
|
+
category,
|
|
40485
|
+
"setting_unavailable"
|
|
40486
|
+
);
|
|
40401
40487
|
return configOptions;
|
|
40402
40488
|
}
|
|
40403
40489
|
if (option.type !== "select" || option.category !== category) {
|
|
40404
|
-
|
|
40490
|
+
warnIgnoredSetting(
|
|
40405
40491
|
audit,
|
|
40492
|
+
"bot_execution_setting_ignored",
|
|
40406
40493
|
commandId,
|
|
40407
40494
|
sessionId,
|
|
40408
40495
|
agent.id,
|
|
@@ -40413,8 +40500,9 @@ async function applySupportedExecutionSelection(sessions, audit, configOptions,
|
|
|
40413
40500
|
return configOptions;
|
|
40414
40501
|
}
|
|
40415
40502
|
if (selection.valueType !== "select" || selection.booleanValue) {
|
|
40416
|
-
|
|
40503
|
+
warnIgnoredSetting(
|
|
40417
40504
|
audit,
|
|
40505
|
+
"bot_execution_setting_ignored",
|
|
40418
40506
|
commandId,
|
|
40419
40507
|
sessionId,
|
|
40420
40508
|
agent.id,
|
|
@@ -40425,7 +40513,16 @@ async function applySupportedExecutionSelection(sessions, audit, configOptions,
|
|
|
40425
40513
|
return configOptions;
|
|
40426
40514
|
}
|
|
40427
40515
|
if (!option.values.some((value) => value.value === selection.value)) {
|
|
40428
|
-
|
|
40516
|
+
warnIgnoredSetting(
|
|
40517
|
+
audit,
|
|
40518
|
+
"bot_execution_setting_ignored",
|
|
40519
|
+
commandId,
|
|
40520
|
+
sessionId,
|
|
40521
|
+
agent.id,
|
|
40522
|
+
selection,
|
|
40523
|
+
category,
|
|
40524
|
+
"value_unavailable"
|
|
40525
|
+
);
|
|
40429
40526
|
return configOptions;
|
|
40430
40527
|
}
|
|
40431
40528
|
if (option.currentValue === selection.value) {
|
|
@@ -40449,10 +40546,9 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
40449
40546
|
publisher.recordAttempt(command.sessionId, encodeDaemonActivity(command, activity), attemptId);
|
|
40450
40547
|
});
|
|
40451
40548
|
try {
|
|
40452
|
-
const
|
|
40453
|
-
|
|
40454
|
-
|
|
40455
|
-
throw new LocalBotAuthorizationError("turn_expired", "The Bot execution deadline has expired");
|
|
40549
|
+
const startDeadline = Date.parse(command.executionDeadlineAt);
|
|
40550
|
+
if (!Number.isSafeInteger(startDeadline) || startDeadline <= Date.now()) {
|
|
40551
|
+
throw new LocalBotAuthorizationError("turn_expired", "The Bot execution start deadline has expired");
|
|
40456
40552
|
}
|
|
40457
40553
|
const execution = await authorizer.authorize(command, config2.catalog, directories, config2.bindingId, signal);
|
|
40458
40554
|
const resolved = await resolveSessionDirectories(
|
|
@@ -40464,8 +40560,6 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
40464
40560
|
);
|
|
40465
40561
|
const attachments = await resolvePromptArtifacts(config2, command, signal);
|
|
40466
40562
|
const applied = await applicator.apply(command, execution, attachments.resources, signal);
|
|
40467
|
-
const deadlineSignal = AbortSignal.timeout(remaining);
|
|
40468
|
-
const executionSignal = AbortSignal.any([signal, deadlineSignal]);
|
|
40469
40563
|
const startExecution = () => {
|
|
40470
40564
|
audit.record({
|
|
40471
40565
|
commandId: command.commandId,
|
|
@@ -40503,7 +40597,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
40503
40597
|
prompt: command.prompt,
|
|
40504
40598
|
resources: applied.resources,
|
|
40505
40599
|
sessionId: command.sessionId,
|
|
40506
|
-
signal
|
|
40600
|
+
signal,
|
|
40507
40601
|
targetCommandId: command.targetCommandId
|
|
40508
40602
|
});
|
|
40509
40603
|
} else {
|
|
@@ -40522,7 +40616,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
40522
40616
|
agent,
|
|
40523
40617
|
cwd: resolved.cwd,
|
|
40524
40618
|
sessionId: command.sessionId,
|
|
40525
|
-
signal
|
|
40619
|
+
signal
|
|
40526
40620
|
});
|
|
40527
40621
|
assertPreparedPermission(prepared.configOptions, execution.executionConfiguration.permissionMode);
|
|
40528
40622
|
let configOptions = await applySupportedExecutionSelection(
|
|
@@ -40536,7 +40630,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
40536
40630
|
resolved.additionalDirectories,
|
|
40537
40631
|
command.commandId,
|
|
40538
40632
|
command.sessionId,
|
|
40539
|
-
|
|
40633
|
+
signal
|
|
40540
40634
|
);
|
|
40541
40635
|
configOptions = await applySupportedExecutionSelection(
|
|
40542
40636
|
sessions,
|
|
@@ -40549,7 +40643,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
40549
40643
|
resolved.additionalDirectories,
|
|
40550
40644
|
command.commandId,
|
|
40551
40645
|
command.sessionId,
|
|
40552
|
-
|
|
40646
|
+
signal
|
|
40553
40647
|
);
|
|
40554
40648
|
for (const selection of command.sessionConfigurations) {
|
|
40555
40649
|
await sessions.configureSession({
|
|
@@ -40560,7 +40654,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
40560
40654
|
cwd: resolved.cwd,
|
|
40561
40655
|
requestId: `cfg_${randomUUID3()}`,
|
|
40562
40656
|
sessionId: command.sessionId,
|
|
40563
|
-
signal
|
|
40657
|
+
signal,
|
|
40564
40658
|
value: selection.value,
|
|
40565
40659
|
valueType: selection.valueType
|
|
40566
40660
|
});
|
|
@@ -40591,7 +40685,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
40591
40685
|
prompt: command.prompt,
|
|
40592
40686
|
resources: applied.resources,
|
|
40593
40687
|
sessionId: command.sessionId,
|
|
40594
|
-
signal
|
|
40688
|
+
signal,
|
|
40595
40689
|
targetCommandId: command.targetCommandId
|
|
40596
40690
|
});
|
|
40597
40691
|
stopReason = result.stopReason;
|
|
@@ -40619,9 +40713,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
40619
40713
|
});
|
|
40620
40714
|
} catch (error62) {
|
|
40621
40715
|
activities.flush();
|
|
40622
|
-
const failure2 =
|
|
40623
|
-
cause: error62
|
|
40624
|
-
}) : error62;
|
|
40716
|
+
const failure2 = error62;
|
|
40625
40717
|
audit.record({
|
|
40626
40718
|
commandId: command.commandId,
|
|
40627
40719
|
details: {
|