@moxt-ai/mobius 0.0.47 → 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.map +1 -1
- package/dist/acp/session-manager.js +4 -12
- 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 +151 -70
- package/dist/cli.js.map +2 -2
- package/dist/index.js +150 -69
- package/dist/index.js.map +2 -2
- 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 +150 -69
- package/dist/runtime.js.map +2 -2
- 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();
|
|
@@ -35597,7 +35586,7 @@ var AcpSessionManager = class {
|
|
|
35597
35586
|
() => deadlineController.abort(
|
|
35598
35587
|
new AcpExecutionError("The steering request exceeded its deadline", {}, "steering_timeout")
|
|
35599
35588
|
),
|
|
35600
|
-
|
|
35589
|
+
SESSION_CONTROL_TIMEOUT_MILLISECONDS
|
|
35601
35590
|
);
|
|
35602
35591
|
deadline.unref();
|
|
35603
35592
|
try {
|
|
@@ -35622,28 +35611,13 @@ var AcpSessionManager = class {
|
|
|
35622
35611
|
if (this.#activeSessionIds.has(options.sessionId)) {
|
|
35623
35612
|
throw new AcpExecutionError("Another prompt is already running in this conversation", {}, "session_busy");
|
|
35624
35613
|
}
|
|
35625
|
-
const deadlineController = new AbortController();
|
|
35626
|
-
const deadlineError = new AcpExecutionError(
|
|
35627
|
-
"The local Agent prompt exceeded its deadline",
|
|
35628
|
-
{},
|
|
35629
|
-
"prompt_timeout"
|
|
35630
|
-
);
|
|
35631
|
-
const deadline = setTimeout(
|
|
35632
|
-
() => deadlineController.abort(deadlineError),
|
|
35633
|
-
options.agent.promptTimeoutMilliseconds
|
|
35634
|
-
);
|
|
35635
|
-
deadline.unref();
|
|
35636
|
-
const boundedOptions = {
|
|
35637
|
-
...options,
|
|
35638
|
-
signal: AbortSignal.any([options.signal, deadlineController.signal])
|
|
35639
|
-
};
|
|
35640
35614
|
this.#activeSessionIds.add(options.sessionId);
|
|
35641
35615
|
this.#activeCommandIds.set(options.sessionId, options.commandId);
|
|
35642
35616
|
try {
|
|
35643
35617
|
if (this.#cancellationRequests.has(options.sessionId)) {
|
|
35644
35618
|
return { stopReason: "cancelled" };
|
|
35645
35619
|
}
|
|
35646
|
-
const runtime = await this.ensureSession(
|
|
35620
|
+
const runtime = await this.ensureSession(options);
|
|
35647
35621
|
if (this.#nativeOperations.has(`${options.agent.id}:${runtime.nativeSessionId()}`)) {
|
|
35648
35622
|
throw new AcpExecutionError("The native session is being managed", {}, "session_busy");
|
|
35649
35623
|
}
|
|
@@ -35651,7 +35625,7 @@ var AcpSessionManager = class {
|
|
|
35651
35625
|
return { stopReason: "cancelled" };
|
|
35652
35626
|
}
|
|
35653
35627
|
try {
|
|
35654
|
-
const result = await runtime.prompt(
|
|
35628
|
+
const result = await runtime.prompt(options);
|
|
35655
35629
|
return this.#cancellationRequests.has(options.sessionId) ? { stopReason: "cancelled" } : result;
|
|
35656
35630
|
} catch (error62) {
|
|
35657
35631
|
if (this.#cancellationRequests.has(options.sessionId)) {
|
|
@@ -35679,7 +35653,6 @@ var AcpSessionManager = class {
|
|
|
35679
35653
|
cause: error62
|
|
35680
35654
|
});
|
|
35681
35655
|
} finally {
|
|
35682
|
-
clearTimeout(deadline);
|
|
35683
35656
|
try {
|
|
35684
35657
|
await this.#cancellationRequests.get(options.sessionId);
|
|
35685
35658
|
} finally {
|
|
@@ -37228,10 +37201,6 @@ var BotExecutionContextRegistry = class {
|
|
|
37228
37201
|
#activeByHandle = /* @__PURE__ */ new Map();
|
|
37229
37202
|
#handlesBySession = /* @__PURE__ */ new Map();
|
|
37230
37203
|
#inactiveHandles = /* @__PURE__ */ new Set();
|
|
37231
|
-
#now;
|
|
37232
|
-
constructor(now = Date.now) {
|
|
37233
|
-
this.#now = now;
|
|
37234
|
-
}
|
|
37235
37204
|
activate = (command) => {
|
|
37236
37205
|
let handle = this.#handlesBySession.get(command.sessionId);
|
|
37237
37206
|
if (handle === void 0) {
|
|
@@ -37265,12 +37234,6 @@ var BotExecutionContextRegistry = class {
|
|
|
37265
37234
|
"An active Bot execution context is required"
|
|
37266
37235
|
);
|
|
37267
37236
|
}
|
|
37268
|
-
if (Date.parse(context.command.executionDeadlineAt) <= this.#now()) {
|
|
37269
|
-
throw new LocalBotAuthorizationError(
|
|
37270
|
-
"execution_capability_expired",
|
|
37271
|
-
"The Bot execution capability has expired"
|
|
37272
|
-
);
|
|
37273
|
-
}
|
|
37274
37237
|
return context;
|
|
37275
37238
|
};
|
|
37276
37239
|
};
|
|
@@ -40140,11 +40103,13 @@ async function executePrompt(outbox, publisher, command, config2, directories, a
|
|
|
40140
40103
|
} else {
|
|
40141
40104
|
await applyCompleteSessionConfiguration(
|
|
40142
40105
|
sessions,
|
|
40106
|
+
audit,
|
|
40143
40107
|
prepared.configOptions,
|
|
40144
40108
|
command.sessionConfigurations,
|
|
40145
40109
|
agent,
|
|
40146
40110
|
resolved.cwd,
|
|
40147
40111
|
resolved.additionalDirectories,
|
|
40112
|
+
command.commandId,
|
|
40148
40113
|
command.sessionId,
|
|
40149
40114
|
signal
|
|
40150
40115
|
);
|
|
@@ -40285,6 +40250,26 @@ function assertSessionConfigurationSchema(options, selections) {
|
|
|
40285
40250
|
}
|
|
40286
40251
|
}
|
|
40287
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
|
+
}
|
|
40288
40273
|
function sessionConfigurationMatches(option, selection) {
|
|
40289
40274
|
validateSessionConfigurationSelection(option, selection);
|
|
40290
40275
|
return option.type === "boolean" ? option.booleanValue === selection.booleanValue : option.currentValue === selection.value;
|
|
@@ -40315,11 +40300,92 @@ function assertCompleteSessionConfiguration(options, selections) {
|
|
|
40315
40300
|
}
|
|
40316
40301
|
}
|
|
40317
40302
|
}
|
|
40318
|
-
|
|
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) {
|
|
40319
40331
|
const option = options.find((candidate) => candidate.id === selection.configId);
|
|
40320
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
|
+
}
|
|
40321
40346
|
throw invalidSessionConfiguration(`The Agent setting ${selection.configId} is unavailable`);
|
|
40322
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
|
+
}
|
|
40323
40389
|
if (sessionConfigurationMatches(option, selection)) {
|
|
40324
40390
|
return options;
|
|
40325
40391
|
}
|
|
@@ -40336,8 +40402,8 @@ async function applySessionConfigurationSelection(sessions, options, selection,
|
|
|
40336
40402
|
valueType: selection.valueType
|
|
40337
40403
|
});
|
|
40338
40404
|
}
|
|
40339
|
-
async function applyCompleteSessionConfiguration(sessions, initialOptions, selections, agent, cwd, additionalDirectories, sessionId, signal) {
|
|
40340
|
-
|
|
40405
|
+
async function applyCompleteSessionConfiguration(sessions, audit, initialOptions, selections, agent, cwd, additionalDirectories, commandId, sessionId, signal) {
|
|
40406
|
+
assertSessionConfigurationCoverage(initialOptions, selections);
|
|
40341
40407
|
let options = initialOptions;
|
|
40342
40408
|
const orderedSelections = selections.toSorted((left, right) => {
|
|
40343
40409
|
const priority = sessionConfigurationPriority(left, initialOptions) - sessionConfigurationPriority(right, initialOptions);
|
|
@@ -40346,16 +40412,18 @@ async function applyCompleteSessionConfiguration(sessions, initialOptions, selec
|
|
|
40346
40412
|
for (const selection of orderedSelections) {
|
|
40347
40413
|
options = await applySessionConfigurationSelection(
|
|
40348
40414
|
sessions,
|
|
40415
|
+
audit,
|
|
40349
40416
|
options,
|
|
40350
40417
|
selection,
|
|
40351
40418
|
agent,
|
|
40352
40419
|
cwd,
|
|
40353
40420
|
additionalDirectories,
|
|
40421
|
+
commandId,
|
|
40354
40422
|
sessionId,
|
|
40355
40423
|
signal
|
|
40356
40424
|
);
|
|
40357
40425
|
}
|
|
40358
|
-
|
|
40426
|
+
assertAppliedSessionConfiguration(options, selections);
|
|
40359
40427
|
}
|
|
40360
40428
|
function botExecutionAgent(agent, contextHandle, socketPath) {
|
|
40361
40429
|
return new LocalAgentDefinition(
|
|
@@ -40374,7 +40442,6 @@ function botExecutionAgent(agent, contextHandle, socketPath) {
|
|
|
40374
40442
|
agent.agentVersion,
|
|
40375
40443
|
agent.adapterIdentity,
|
|
40376
40444
|
agent.agentIdentity,
|
|
40377
|
-
agent.promptTimeoutMilliseconds,
|
|
40378
40445
|
agent.capabilities,
|
|
40379
40446
|
agent.permissionProfile
|
|
40380
40447
|
);
|
|
@@ -40389,7 +40456,7 @@ function assertPreparedPermission(configOptions, permissionMode) {
|
|
|
40389
40456
|
);
|
|
40390
40457
|
}
|
|
40391
40458
|
}
|
|
40392
|
-
function
|
|
40459
|
+
function warnIgnoredSetting(audit, event, commandId, sessionId, agentId, selection, category, reason) {
|
|
40393
40460
|
const details = {
|
|
40394
40461
|
agentId,
|
|
40395
40462
|
category,
|
|
@@ -40397,7 +40464,6 @@ function warnIgnoredExecutionSetting(audit, commandId, sessionId, agentId, selec
|
|
|
40397
40464
|
reason,
|
|
40398
40465
|
requestedValue: selection.value
|
|
40399
40466
|
};
|
|
40400
|
-
const event = "bot_execution_setting_ignored";
|
|
40401
40467
|
audit.record({ commandId, details, event, sessionId });
|
|
40402
40468
|
process.stderr.write(`Mobius daemon warning ${JSON.stringify({ commandId, event, sessionId, ...details })}
|
|
40403
40469
|
`);
|
|
@@ -40408,12 +40474,22 @@ async function applySupportedExecutionSelection(sessions, audit, configOptions,
|
|
|
40408
40474
|
}
|
|
40409
40475
|
const option = configOptions.find((candidate) => candidate.id === selection.configId);
|
|
40410
40476
|
if (option === void 0) {
|
|
40411
|
-
|
|
40477
|
+
warnIgnoredSetting(
|
|
40478
|
+
audit,
|
|
40479
|
+
"bot_execution_setting_ignored",
|
|
40480
|
+
commandId,
|
|
40481
|
+
sessionId,
|
|
40482
|
+
agent.id,
|
|
40483
|
+
selection,
|
|
40484
|
+
category,
|
|
40485
|
+
"setting_unavailable"
|
|
40486
|
+
);
|
|
40412
40487
|
return configOptions;
|
|
40413
40488
|
}
|
|
40414
40489
|
if (option.type !== "select" || option.category !== category) {
|
|
40415
|
-
|
|
40490
|
+
warnIgnoredSetting(
|
|
40416
40491
|
audit,
|
|
40492
|
+
"bot_execution_setting_ignored",
|
|
40417
40493
|
commandId,
|
|
40418
40494
|
sessionId,
|
|
40419
40495
|
agent.id,
|
|
@@ -40424,8 +40500,9 @@ async function applySupportedExecutionSelection(sessions, audit, configOptions,
|
|
|
40424
40500
|
return configOptions;
|
|
40425
40501
|
}
|
|
40426
40502
|
if (selection.valueType !== "select" || selection.booleanValue) {
|
|
40427
|
-
|
|
40503
|
+
warnIgnoredSetting(
|
|
40428
40504
|
audit,
|
|
40505
|
+
"bot_execution_setting_ignored",
|
|
40429
40506
|
commandId,
|
|
40430
40507
|
sessionId,
|
|
40431
40508
|
agent.id,
|
|
@@ -40436,7 +40513,16 @@ async function applySupportedExecutionSelection(sessions, audit, configOptions,
|
|
|
40436
40513
|
return configOptions;
|
|
40437
40514
|
}
|
|
40438
40515
|
if (!option.values.some((value) => value.value === selection.value)) {
|
|
40439
|
-
|
|
40516
|
+
warnIgnoredSetting(
|
|
40517
|
+
audit,
|
|
40518
|
+
"bot_execution_setting_ignored",
|
|
40519
|
+
commandId,
|
|
40520
|
+
sessionId,
|
|
40521
|
+
agent.id,
|
|
40522
|
+
selection,
|
|
40523
|
+
category,
|
|
40524
|
+
"value_unavailable"
|
|
40525
|
+
);
|
|
40440
40526
|
return configOptions;
|
|
40441
40527
|
}
|
|
40442
40528
|
if (option.currentValue === selection.value) {
|
|
@@ -40460,10 +40546,9 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
40460
40546
|
publisher.recordAttempt(command.sessionId, encodeDaemonActivity(command, activity), attemptId);
|
|
40461
40547
|
});
|
|
40462
40548
|
try {
|
|
40463
|
-
const
|
|
40464
|
-
|
|
40465
|
-
|
|
40466
|
-
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");
|
|
40467
40552
|
}
|
|
40468
40553
|
const execution = await authorizer.authorize(command, config2.catalog, directories, config2.bindingId, signal);
|
|
40469
40554
|
const resolved = await resolveSessionDirectories(
|
|
@@ -40475,8 +40560,6 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
40475
40560
|
);
|
|
40476
40561
|
const attachments = await resolvePromptArtifacts(config2, command, signal);
|
|
40477
40562
|
const applied = await applicator.apply(command, execution, attachments.resources, signal);
|
|
40478
|
-
const deadlineSignal = AbortSignal.timeout(remaining);
|
|
40479
|
-
const executionSignal = AbortSignal.any([signal, deadlineSignal]);
|
|
40480
40563
|
const startExecution = () => {
|
|
40481
40564
|
audit.record({
|
|
40482
40565
|
commandId: command.commandId,
|
|
@@ -40514,7 +40597,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
40514
40597
|
prompt: command.prompt,
|
|
40515
40598
|
resources: applied.resources,
|
|
40516
40599
|
sessionId: command.sessionId,
|
|
40517
|
-
signal
|
|
40600
|
+
signal,
|
|
40518
40601
|
targetCommandId: command.targetCommandId
|
|
40519
40602
|
});
|
|
40520
40603
|
} else {
|
|
@@ -40533,7 +40616,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
40533
40616
|
agent,
|
|
40534
40617
|
cwd: resolved.cwd,
|
|
40535
40618
|
sessionId: command.sessionId,
|
|
40536
|
-
signal
|
|
40619
|
+
signal
|
|
40537
40620
|
});
|
|
40538
40621
|
assertPreparedPermission(prepared.configOptions, execution.executionConfiguration.permissionMode);
|
|
40539
40622
|
let configOptions = await applySupportedExecutionSelection(
|
|
@@ -40547,7 +40630,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
40547
40630
|
resolved.additionalDirectories,
|
|
40548
40631
|
command.commandId,
|
|
40549
40632
|
command.sessionId,
|
|
40550
|
-
|
|
40633
|
+
signal
|
|
40551
40634
|
);
|
|
40552
40635
|
configOptions = await applySupportedExecutionSelection(
|
|
40553
40636
|
sessions,
|
|
@@ -40560,7 +40643,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
40560
40643
|
resolved.additionalDirectories,
|
|
40561
40644
|
command.commandId,
|
|
40562
40645
|
command.sessionId,
|
|
40563
|
-
|
|
40646
|
+
signal
|
|
40564
40647
|
);
|
|
40565
40648
|
for (const selection of command.sessionConfigurations) {
|
|
40566
40649
|
await sessions.configureSession({
|
|
@@ -40571,7 +40654,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
40571
40654
|
cwd: resolved.cwd,
|
|
40572
40655
|
requestId: `cfg_${randomUUID3()}`,
|
|
40573
40656
|
sessionId: command.sessionId,
|
|
40574
|
-
signal
|
|
40657
|
+
signal,
|
|
40575
40658
|
value: selection.value,
|
|
40576
40659
|
valueType: selection.valueType
|
|
40577
40660
|
});
|
|
@@ -40602,7 +40685,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
40602
40685
|
prompt: command.prompt,
|
|
40603
40686
|
resources: applied.resources,
|
|
40604
40687
|
sessionId: command.sessionId,
|
|
40605
|
-
signal
|
|
40688
|
+
signal,
|
|
40606
40689
|
targetCommandId: command.targetCommandId
|
|
40607
40690
|
});
|
|
40608
40691
|
stopReason = result.stopReason;
|
|
@@ -40630,9 +40713,7 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
40630
40713
|
});
|
|
40631
40714
|
} catch (error62) {
|
|
40632
40715
|
activities.flush();
|
|
40633
|
-
const failure2 =
|
|
40634
|
-
cause: error62
|
|
40635
|
-
}) : error62;
|
|
40716
|
+
const failure2 = error62;
|
|
40636
40717
|
audit.record({
|
|
40637
40718
|
commandId: command.commandId,
|
|
40638
40719
|
details: {
|