@moxt-ai/mobius 0.0.34 → 0.0.35
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 +7 -0
- package/dist/acp/session-manager.d.ts.map +1 -1
- package/dist/acp/session-manager.js +47 -0
- package/dist/acp/session-manager.js.map +1 -1
- package/dist/agent-catalog/publish-agent-catalog.d.ts.map +1 -1
- package/dist/agent-catalog/publish-agent-catalog.js +1 -0
- package/dist/agent-catalog/publish-agent-catalog.js.map +1 -1
- package/dist/bots/local-bot-grant-store.d.ts.map +1 -1
- package/dist/bots/local-bot-grant-store.js +43 -3
- package/dist/bots/local-bot-grant-store.js.map +1 -1
- package/dist/cli.js +243 -57
- package/dist/cli.js.map +3 -3
- package/dist/index.js +242 -56
- package/dist/index.js.map +3 -3
- package/dist/native-sessions/service.d.ts.map +1 -1
- package/dist/native-sessions/service.js +14 -0
- package/dist/native-sessions/service.js.map +1 -1
- package/dist/pairing/pair-local-machine.d.ts.map +1 -1
- package/dist/pairing/pair-local-machine.js +1 -0
- package/dist/pairing/pair-local-machine.js.map +1 -1
- package/dist/run-daemon.d.ts.map +1 -1
- package/dist/run-daemon.js +19 -2
- package/dist/run-daemon.js.map +1 -1
- package/dist/runtime.js +242 -56
- package/dist/runtime.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19821,7 +19821,7 @@ var configValueSchema = external_exports.strictObject({
|
|
|
19821
19821
|
name: external_exports.string().min(1).max(255),
|
|
19822
19822
|
value: external_exports.string().min(1).max(500)
|
|
19823
19823
|
}).readonly();
|
|
19824
|
-
var
|
|
19824
|
+
var sessionConfigOptionSchema = external_exports.strictObject({
|
|
19825
19825
|
booleanValue: external_exports.boolean(),
|
|
19826
19826
|
category: external_exports.string().max(128),
|
|
19827
19827
|
currentValue: external_exports.string().max(500),
|
|
@@ -19831,6 +19831,26 @@ var configOptionSchema = external_exports.strictObject({
|
|
|
19831
19831
|
type: external_exports.enum(["boolean", "select"]),
|
|
19832
19832
|
values: external_exports.array(configValueSchema).max(500).readonly()
|
|
19833
19833
|
}).readonly();
|
|
19834
|
+
var sessionConfigOptionsSchema = external_exports.array(sessionConfigOptionSchema).max(100).readonly();
|
|
19835
|
+
var sessionConfigurationSelectionSchema = external_exports.strictObject({
|
|
19836
|
+
booleanValue: external_exports.boolean(),
|
|
19837
|
+
configId: IDENTIFIER,
|
|
19838
|
+
value: external_exports.string().max(500),
|
|
19839
|
+
valueType: external_exports.enum(["boolean", "select"])
|
|
19840
|
+
}).readonly();
|
|
19841
|
+
var sessionConfigurationSelectionsSchema = external_exports.array(sessionConfigurationSelectionSchema).max(100).superRefine((selections, context) => {
|
|
19842
|
+
const identifiers = /* @__PURE__ */ new Set();
|
|
19843
|
+
for (const [index, selection] of selections.entries()) {
|
|
19844
|
+
if (identifiers.has(selection.configId)) {
|
|
19845
|
+
context.addIssue({
|
|
19846
|
+
code: "custom",
|
|
19847
|
+
message: "Session configuration identifiers must be unique",
|
|
19848
|
+
path: [index, "configId"]
|
|
19849
|
+
});
|
|
19850
|
+
}
|
|
19851
|
+
identifiers.add(selection.configId);
|
|
19852
|
+
}
|
|
19853
|
+
}).readonly();
|
|
19834
19854
|
var sessionCapabilitiesSchema = external_exports.strictObject({
|
|
19835
19855
|
additionalDirectories: external_exports.boolean(),
|
|
19836
19856
|
audioPrompt: external_exports.boolean(),
|
|
@@ -19941,7 +19961,8 @@ var sessionIdentityFields = {
|
|
|
19941
19961
|
var sessionPrepareCommandSchema = external_exports.strictObject({
|
|
19942
19962
|
...sessionIdentityFields,
|
|
19943
19963
|
kind: external_exports.literal(SESSION_PREPARE_KIND),
|
|
19944
|
-
requestId: IDENTIFIER
|
|
19964
|
+
requestId: IDENTIFIER,
|
|
19965
|
+
transient: external_exports.boolean().optional()
|
|
19945
19966
|
}).readonly();
|
|
19946
19967
|
var sessionReadyEventSchema = external_exports.strictObject({
|
|
19947
19968
|
additionalDirectories: external_exports.array(workspaceEntrySchema).max(16).readonly(),
|
|
@@ -19950,7 +19971,7 @@ var sessionReadyEventSchema = external_exports.strictObject({
|
|
|
19950
19971
|
agentVersion: external_exports.string().max(128),
|
|
19951
19972
|
capabilities: sessionCapabilitiesSchema,
|
|
19952
19973
|
commands: external_exports.array(sessionCommandSchema).max(500).readonly(),
|
|
19953
|
-
configOptions:
|
|
19974
|
+
configOptions: sessionConfigOptionsSchema,
|
|
19954
19975
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
19955
19976
|
directoryLabel: external_exports.string().min(1).max(2048),
|
|
19956
19977
|
kind: external_exports.literal(SESSION_READY_KIND),
|
|
@@ -19968,7 +19989,7 @@ var sessionConfigureCommandSchema = external_exports.strictObject({
|
|
|
19968
19989
|
valueType: external_exports.enum(["boolean", "select"])
|
|
19969
19990
|
}).readonly();
|
|
19970
19991
|
var sessionConfigUpdatedEventSchema = external_exports.strictObject({
|
|
19971
|
-
configOptions:
|
|
19992
|
+
configOptions: sessionConfigOptionsSchema,
|
|
19972
19993
|
kind: external_exports.literal(SESSION_CONFIG_UPDATED_KIND),
|
|
19973
19994
|
requestId: IDENTIFIER,
|
|
19974
19995
|
sessionId: IDENTIFIER
|
|
@@ -20144,6 +20165,7 @@ var decodeAgentDisplayContentValue = (value) => decodeValue(value, displayConten
|
|
|
20144
20165
|
var decodeRecordedAgentContentValue = (value) => decodeValue(value, recordedDisplayContentSchema);
|
|
20145
20166
|
var decodePromptImagesValue = (value) => decodeValue(value, external_exports.array(promptImageSchema).max(8).readonly());
|
|
20146
20167
|
var decodePromptResourcesValue = (value) => decodeValue(value, external_exports.array(promptResourceSchema).max(16).readonly());
|
|
20168
|
+
var decodeSessionConfigurationSelections = (value) => decodeValue(value, sessionConfigurationSelectionsSchema);
|
|
20147
20169
|
var encode3 = (message, schema) => JSON.stringify(decodeValue(message, schema));
|
|
20148
20170
|
var decodeWorkspaceListCommand = (encoded) => decode3(encoded, workspaceListCommandSchema);
|
|
20149
20171
|
var encodeWorkspaceEntriesEvent = (message) => encode3(message, workspaceEntriesEventSchema);
|
|
@@ -20680,8 +20702,9 @@ var BotExecutionBindingApprovalRequest = class {
|
|
|
20680
20702
|
requestId;
|
|
20681
20703
|
requiredCapabilities;
|
|
20682
20704
|
runtimeId;
|
|
20705
|
+
sessionConfigurations;
|
|
20683
20706
|
workspaceRef;
|
|
20684
|
-
constructor(requestId, botId, behaviorRevisionId, bindingId, bindingRevision, runtimeId, agentRef, workspaceRef, agentConfigRevision, behaviorInstructions, behaviorDigest, requiredCapabilities, allowedDeliveryTargets, completionPolicy) {
|
|
20707
|
+
constructor(requestId, botId, behaviorRevisionId, bindingId, bindingRevision, runtimeId, agentRef, workspaceRef, agentConfigRevision, behaviorInstructions, behaviorDigest, requiredCapabilities, allowedDeliveryTargets, completionPolicy, sessionConfigurations = []) {
|
|
20685
20708
|
this.requestId = requestId;
|
|
20686
20709
|
this.botId = botId;
|
|
20687
20710
|
this.behaviorRevisionId = behaviorRevisionId;
|
|
@@ -20694,6 +20717,7 @@ var BotExecutionBindingApprovalRequest = class {
|
|
|
20694
20717
|
this.behaviorInstructions = behaviorInstructions;
|
|
20695
20718
|
this.behaviorDigest = behaviorDigest;
|
|
20696
20719
|
this.requiredCapabilities = Object.freeze([...requiredCapabilities]);
|
|
20720
|
+
this.sessionConfigurations = Object.freeze([...sessionConfigurations]);
|
|
20697
20721
|
this.allowedDeliveryTargets = Object.freeze(
|
|
20698
20722
|
allowedDeliveryTargets.map(
|
|
20699
20723
|
(target) => new BotDeliveryTargetReference(target.alias, target.deliveryTargetId)
|
|
@@ -20701,6 +20725,13 @@ var BotExecutionBindingApprovalRequest = class {
|
|
|
20701
20725
|
);
|
|
20702
20726
|
this.completionPolicy = completionPolicy;
|
|
20703
20727
|
}
|
|
20728
|
+
toJSON() {
|
|
20729
|
+
const { sessionConfigurations, ...request } = this;
|
|
20730
|
+
return {
|
|
20731
|
+
...request,
|
|
20732
|
+
...sessionConfigurations.length === 0 ? {} : { sessionConfigurations }
|
|
20733
|
+
};
|
|
20734
|
+
}
|
|
20704
20735
|
};
|
|
20705
20736
|
var BotExecutionBindingApprovedEvent = class {
|
|
20706
20737
|
agentIdentityDigest;
|
|
@@ -20765,9 +20796,10 @@ var BotSessionPromptCommand = class {
|
|
|
20765
20796
|
prompt;
|
|
20766
20797
|
replyRoute;
|
|
20767
20798
|
resources;
|
|
20799
|
+
sessionConfigurations;
|
|
20768
20800
|
sessionId;
|
|
20769
20801
|
turnId;
|
|
20770
|
-
constructor(sessionId, commandId, agentId, bindingId, directoryId2, additionalDirectoryIds, images, resources, prompt, executionId, executionCapabilityId, executionCapabilitySecret, executionDeadlineAt, botId, conversationId, turnId, behaviorRevisionId, bindingRevision, localGrantId, behaviorInstructions, behaviorDigest, allowedDeliveryTargets, replyRoute) {
|
|
20802
|
+
constructor(sessionId, commandId, agentId, bindingId, directoryId2, additionalDirectoryIds, images, resources, prompt, executionId, executionCapabilityId, executionCapabilitySecret, executionDeadlineAt, botId, conversationId, turnId, behaviorRevisionId, bindingRevision, localGrantId, behaviorInstructions, behaviorDigest, allowedDeliveryTargets, replyRoute, sessionConfigurations = []) {
|
|
20771
20803
|
this.sessionId = sessionId;
|
|
20772
20804
|
this.commandId = commandId;
|
|
20773
20805
|
this.agentId = agentId;
|
|
@@ -20795,6 +20827,14 @@ var BotSessionPromptCommand = class {
|
|
|
20795
20827
|
)
|
|
20796
20828
|
);
|
|
20797
20829
|
this.replyRoute = replyRoute;
|
|
20830
|
+
this.sessionConfigurations = Object.freeze([...sessionConfigurations]);
|
|
20831
|
+
}
|
|
20832
|
+
toJSON() {
|
|
20833
|
+
const { sessionConfigurations, ...command } = this;
|
|
20834
|
+
return {
|
|
20835
|
+
...command,
|
|
20836
|
+
...sessionConfigurations.length === 0 ? {} : { sessionConfigurations }
|
|
20837
|
+
};
|
|
20798
20838
|
}
|
|
20799
20839
|
};
|
|
20800
20840
|
function isRecord2(value) {
|
|
@@ -20818,6 +20858,12 @@ function assertExactKeys2(value, expected) {
|
|
|
20818
20858
|
throw new ProtocolMessageError("Message fields do not match the Bot protocol");
|
|
20819
20859
|
}
|
|
20820
20860
|
}
|
|
20861
|
+
function assertKeysWithOptional(value, expected, optional2) {
|
|
20862
|
+
const keys = Object.keys(value);
|
|
20863
|
+
if (keys.length < expected.length || keys.length > expected.length + optional2.length || expected.some((key) => !Object.hasOwn(value, key)) || keys.some((key) => !expected.includes(key) && !optional2.includes(key))) {
|
|
20864
|
+
throw new ProtocolMessageError("Message fields do not match the Bot protocol");
|
|
20865
|
+
}
|
|
20866
|
+
}
|
|
20821
20867
|
function readText2(value, key, maximumLength, allowEmpty) {
|
|
20822
20868
|
const field = value[key];
|
|
20823
20869
|
if (typeof field !== "string" || field.length > maximumLength || !allowEmpty && field.length === 0) {
|
|
@@ -20907,6 +20953,12 @@ function readTargets(value, key) {
|
|
|
20907
20953
|
}
|
|
20908
20954
|
return Object.freeze(targets);
|
|
20909
20955
|
}
|
|
20956
|
+
function readSessionConfigurations(value) {
|
|
20957
|
+
if (!Object.hasOwn(value, "sessionConfigurations")) {
|
|
20958
|
+
return [];
|
|
20959
|
+
}
|
|
20960
|
+
return decodeSessionConfigurationSelections(value["sessionConfigurations"]);
|
|
20961
|
+
}
|
|
20910
20962
|
function readCompletionPolicy(value) {
|
|
20911
20963
|
if (!isRecord2(value)) {
|
|
20912
20964
|
throw new ProtocolMessageError("Invalid Bot completion policy");
|
|
@@ -20945,23 +20997,27 @@ function readReplyRoute(value) {
|
|
|
20945
20997
|
}
|
|
20946
20998
|
function decodeBotExecutionBindingApprovalRequest(encoded) {
|
|
20947
20999
|
const value = parseJson3(encoded);
|
|
20948
|
-
|
|
20949
|
-
|
|
20950
|
-
|
|
20951
|
-
|
|
20952
|
-
|
|
20953
|
-
|
|
20954
|
-
|
|
20955
|
-
|
|
20956
|
-
|
|
20957
|
-
|
|
20958
|
-
|
|
20959
|
-
|
|
20960
|
-
|
|
20961
|
-
|
|
20962
|
-
|
|
20963
|
-
|
|
20964
|
-
|
|
21000
|
+
assertKeysWithOptional(
|
|
21001
|
+
value,
|
|
21002
|
+
[
|
|
21003
|
+
"agentConfigRevision",
|
|
21004
|
+
"agentRef",
|
|
21005
|
+
"allowedDeliveryTargets",
|
|
21006
|
+
"behaviorDigest",
|
|
21007
|
+
"behaviorInstructions",
|
|
21008
|
+
"behaviorRevisionId",
|
|
21009
|
+
"bindingId",
|
|
21010
|
+
"bindingRevision",
|
|
21011
|
+
"botId",
|
|
21012
|
+
"completionPolicy",
|
|
21013
|
+
"kind",
|
|
21014
|
+
"requestId",
|
|
21015
|
+
"requiredCapabilities",
|
|
21016
|
+
"runtimeId",
|
|
21017
|
+
"workspaceRef"
|
|
21018
|
+
],
|
|
21019
|
+
["sessionConfigurations"]
|
|
21020
|
+
);
|
|
20965
21021
|
if (value["kind"] !== BOT_BINDING_APPROVAL_REQUEST_KIND) {
|
|
20966
21022
|
throw new ProtocolMessageError("Invalid Bot binding approval request kind");
|
|
20967
21023
|
}
|
|
@@ -20979,7 +21035,8 @@ function decodeBotExecutionBindingApprovalRequest(encoded) {
|
|
|
20979
21035
|
readDigest(value, "behaviorDigest"),
|
|
20980
21036
|
readIdentifiers(value, "requiredCapabilities", 32),
|
|
20981
21037
|
readTargets(value, "allowedDeliveryTargets"),
|
|
20982
|
-
readCompletionPolicy(value["completionPolicy"])
|
|
21038
|
+
readCompletionPolicy(value["completionPolicy"]),
|
|
21039
|
+
readSessionConfigurations(value)
|
|
20983
21040
|
);
|
|
20984
21041
|
}
|
|
20985
21042
|
function decodeBotExecutionBindingApprovedEvent(encoded) {
|
|
@@ -21042,32 +21099,36 @@ function encodeBotExecutionBindingUnavailableEvent(event) {
|
|
|
21042
21099
|
}
|
|
21043
21100
|
function decodeBotSessionPromptCommand(encoded) {
|
|
21044
21101
|
const value = parseJson3(encoded);
|
|
21045
|
-
|
|
21046
|
-
|
|
21047
|
-
|
|
21048
|
-
|
|
21049
|
-
|
|
21050
|
-
|
|
21051
|
-
|
|
21052
|
-
|
|
21053
|
-
|
|
21054
|
-
|
|
21055
|
-
|
|
21056
|
-
|
|
21057
|
-
|
|
21058
|
-
|
|
21059
|
-
|
|
21060
|
-
|
|
21061
|
-
|
|
21062
|
-
|
|
21063
|
-
|
|
21064
|
-
|
|
21065
|
-
|
|
21066
|
-
|
|
21067
|
-
|
|
21068
|
-
|
|
21069
|
-
|
|
21070
|
-
|
|
21102
|
+
assertKeysWithOptional(
|
|
21103
|
+
value,
|
|
21104
|
+
[
|
|
21105
|
+
"additionalDirectoryIds",
|
|
21106
|
+
"agentId",
|
|
21107
|
+
"allowedDeliveryTargets",
|
|
21108
|
+
"behaviorDigest",
|
|
21109
|
+
"behaviorInstructions",
|
|
21110
|
+
"behaviorRevisionId",
|
|
21111
|
+
"bindingId",
|
|
21112
|
+
"bindingRevision",
|
|
21113
|
+
"botId",
|
|
21114
|
+
"commandId",
|
|
21115
|
+
"conversationId",
|
|
21116
|
+
"directoryId",
|
|
21117
|
+
"executionCapabilityId",
|
|
21118
|
+
"executionCapabilitySecret",
|
|
21119
|
+
"executionDeadlineAt",
|
|
21120
|
+
"executionId",
|
|
21121
|
+
"images",
|
|
21122
|
+
"kind",
|
|
21123
|
+
"localGrantId",
|
|
21124
|
+
"prompt",
|
|
21125
|
+
"replyRoute",
|
|
21126
|
+
"resources",
|
|
21127
|
+
"sessionId",
|
|
21128
|
+
"turnId"
|
|
21129
|
+
],
|
|
21130
|
+
["sessionConfigurations"]
|
|
21131
|
+
);
|
|
21071
21132
|
if (value["kind"] !== BOT_SESSION_PROMPT_KIND) {
|
|
21072
21133
|
throw new ProtocolMessageError("Invalid Bot Session prompt kind");
|
|
21073
21134
|
}
|
|
@@ -21094,7 +21155,8 @@ function decodeBotSessionPromptCommand(encoded) {
|
|
|
21094
21155
|
readText2(value, "behaviorInstructions", MAX_INSTRUCTIONS_LENGTH, true),
|
|
21095
21156
|
readDigest(value, "behaviorDigest"),
|
|
21096
21157
|
readTargets(value, "allowedDeliveryTargets"),
|
|
21097
|
-
readReplyRoute(value["replyRoute"])
|
|
21158
|
+
readReplyRoute(value["replyRoute"]),
|
|
21159
|
+
readSessionConfigurations(value)
|
|
21098
21160
|
);
|
|
21099
21161
|
}
|
|
21100
21162
|
|
|
@@ -21217,6 +21279,7 @@ var nativeSessionTurnForkCommandSchema = external_exports.strictObject({
|
|
|
21217
21279
|
title: external_exports.string().max(500)
|
|
21218
21280
|
}).readonly();
|
|
21219
21281
|
var nativeSessionCommandSchema = external_exports.discriminatedUnion("action", [
|
|
21282
|
+
external_exports.strictObject({ ...identity, action: external_exports.literal("preview"), entryId: identifier }).readonly(),
|
|
21220
21283
|
external_exports.strictObject({
|
|
21221
21284
|
...identity,
|
|
21222
21285
|
action: external_exports.literal("list"),
|
|
@@ -21267,7 +21330,7 @@ var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
|
|
|
21267
21330
|
action: external_exports.literal("preview"),
|
|
21268
21331
|
entryId: identifier,
|
|
21269
21332
|
targetSessionId: identifier,
|
|
21270
|
-
reason: external_exports.
|
|
21333
|
+
reason: external_exports.enum(["continuation_unavailable", "requested"]),
|
|
21271
21334
|
history: sessionHistorySchema,
|
|
21272
21335
|
title: external_exports.string().max(500)
|
|
21273
21336
|
}).readonly(),
|
|
@@ -25408,6 +25471,29 @@ var AcpSessionManager = class {
|
|
|
25408
25471
|
const runtime = await this.#startPreparation(options);
|
|
25409
25472
|
return runtime.prepared();
|
|
25410
25473
|
};
|
|
25474
|
+
/**
|
|
25475
|
+
* Opens a short-lived ACP session only to read the Agent's authoritative
|
|
25476
|
+
* configuration options. The runtime and any persisted native-session
|
|
25477
|
+
* record are released before this method resolves.
|
|
25478
|
+
*/
|
|
25479
|
+
inspectSession = async (options) => {
|
|
25480
|
+
if (this.#preparing.has(options.sessionId) || this.#sessions.has(options.sessionId)) {
|
|
25481
|
+
throw new AcpExecutionError("The configuration inspection session is already in use", {}, "session_busy");
|
|
25482
|
+
}
|
|
25483
|
+
const runtime = await this.#startPreparation(options);
|
|
25484
|
+
try {
|
|
25485
|
+
return runtime.prepared();
|
|
25486
|
+
} finally {
|
|
25487
|
+
if (this.#sessions.get(options.sessionId) === runtime) {
|
|
25488
|
+
this.#sessions.delete(options.sessionId);
|
|
25489
|
+
}
|
|
25490
|
+
try {
|
|
25491
|
+
await runtime.close();
|
|
25492
|
+
} finally {
|
|
25493
|
+
this.#store.remove(options.sessionId);
|
|
25494
|
+
}
|
|
25495
|
+
}
|
|
25496
|
+
};
|
|
25411
25497
|
prepareExecutionSession = async (options) => {
|
|
25412
25498
|
const pending = this.#preparing.get(options.sessionId);
|
|
25413
25499
|
if (pending !== void 0) {
|
|
@@ -25668,6 +25754,33 @@ var AcpSessionManager = class {
|
|
|
25668
25754
|
return started;
|
|
25669
25755
|
}
|
|
25670
25756
|
listNativeSessions = async (options, cursor) => await (await this.#ensureNativeSessionBrowser(options)).listNativeSessions(cursor, options.signal);
|
|
25757
|
+
previewNativeSession = async (options, nativeSessionId) => {
|
|
25758
|
+
const key = `${options.agent.id}:${nativeSessionId}`;
|
|
25759
|
+
const linked = this.#store.findNative(options.agent.id, nativeSessionId);
|
|
25760
|
+
if (this.#nativeOperations.has(key) || linked.some((entry) => this.#activeSessionIds.has(entry.sessionId) || this.#preparing.has(entry.sessionId))) {
|
|
25761
|
+
throw new AcpExecutionError(
|
|
25762
|
+
"Wait for the native session's running operation to finish",
|
|
25763
|
+
{},
|
|
25764
|
+
"session_busy"
|
|
25765
|
+
);
|
|
25766
|
+
}
|
|
25767
|
+
this.#nativeOperations.add(key);
|
|
25768
|
+
try {
|
|
25769
|
+
const runtime = await AcpProcessSession.startNativeSessionBrowser(
|
|
25770
|
+
options,
|
|
25771
|
+
() => this.#nativeBrowserObserver,
|
|
25772
|
+
new MemoryAcpSessionStore()
|
|
25773
|
+
);
|
|
25774
|
+
try {
|
|
25775
|
+
runtime.selectNativeSession(nativeSessionId);
|
|
25776
|
+
return await runtime.loadHistory(options.signal);
|
|
25777
|
+
} finally {
|
|
25778
|
+
await runtime.closeProcess();
|
|
25779
|
+
}
|
|
25780
|
+
} finally {
|
|
25781
|
+
this.#nativeOperations.delete(key);
|
|
25782
|
+
}
|
|
25783
|
+
};
|
|
25671
25784
|
openNativeSession = async (options, origin) => {
|
|
25672
25785
|
const key = `${options.agent.id}:${origin.nativeSessionId}`;
|
|
25673
25786
|
if (this.#nativeOperations.has(key)) {
|
|
@@ -26017,6 +26130,16 @@ function exactTargets(left, right) {
|
|
|
26017
26130
|
const actual = [...right].sort();
|
|
26018
26131
|
return expected.every((target, index) => target === actual[index]);
|
|
26019
26132
|
}
|
|
26133
|
+
function exactSessionConfigurations(left, right) {
|
|
26134
|
+
if (left.length !== right.length) {
|
|
26135
|
+
return false;
|
|
26136
|
+
}
|
|
26137
|
+
const expected = new Map(left.map((selection) => [selection.configId, selection]));
|
|
26138
|
+
return right.every((selection) => {
|
|
26139
|
+
const approved = expected.get(selection.configId);
|
|
26140
|
+
return approved !== void 0 && approved.booleanValue === selection.booleanValue && approved.value === selection.value && approved.valueType === selection.valueType;
|
|
26141
|
+
});
|
|
26142
|
+
}
|
|
26020
26143
|
function rowString(row, key) {
|
|
26021
26144
|
const value = Reflect.get(row, key);
|
|
26022
26145
|
if (typeof value !== "string") {
|
|
@@ -26043,6 +26166,15 @@ function parseTargets(encoded) {
|
|
|
26043
26166
|
}
|
|
26044
26167
|
return value.filter((target) => typeof target === "string");
|
|
26045
26168
|
}
|
|
26169
|
+
function parseSessionConfigurations(encoded) {
|
|
26170
|
+
let value;
|
|
26171
|
+
try {
|
|
26172
|
+
value = JSON.parse(encoded);
|
|
26173
|
+
return decodeSessionConfigurationSelections(value);
|
|
26174
|
+
} catch (cause) {
|
|
26175
|
+
throw new LocalBotAuthorizationError("local_grant_invalid", "The local Bot grant is invalid", { cause });
|
|
26176
|
+
}
|
|
26177
|
+
}
|
|
26046
26178
|
var LocalBotGrantStore = class {
|
|
26047
26179
|
#database;
|
|
26048
26180
|
static containsBot = (path2, botId) => {
|
|
@@ -26087,6 +26219,10 @@ var LocalBotGrantStore = class {
|
|
|
26087
26219
|
error_code TEXT,
|
|
26088
26220
|
error_message TEXT
|
|
26089
26221
|
) STRICT;
|
|
26222
|
+
CREATE TABLE IF NOT EXISTS local_bot_grant_configurations (
|
|
26223
|
+
local_grant_id TEXT PRIMARY KEY,
|
|
26224
|
+
session_configurations_json TEXT NOT NULL
|
|
26225
|
+
) STRICT;
|
|
26090
26226
|
`);
|
|
26091
26227
|
}
|
|
26092
26228
|
/** Only the local CLI may invoke this explicit approval transition. */
|
|
@@ -26212,6 +26348,11 @@ var LocalBotGrantStore = class {
|
|
|
26212
26348
|
now,
|
|
26213
26349
|
expiresAt
|
|
26214
26350
|
);
|
|
26351
|
+
this.#database.prepare(
|
|
26352
|
+
`INSERT INTO local_bot_grant_configurations (
|
|
26353
|
+
local_grant_id, session_configurations_json
|
|
26354
|
+
) VALUES (?, ?)`
|
|
26355
|
+
).run(localGrantId, JSON.stringify(request.sessionConfigurations));
|
|
26215
26356
|
this.#database.prepare(
|
|
26216
26357
|
`INSERT INTO local_bot_binding_resolutions (
|
|
26217
26358
|
request_id, binding_id, local_grant_id, resolved_at, result
|
|
@@ -26237,8 +26378,12 @@ var LocalBotGrantStore = class {
|
|
|
26237
26378
|
resolveExecution = async (command, catalog, directories, bindingAuthorityId, now, signal) => {
|
|
26238
26379
|
signal.throwIfAborted();
|
|
26239
26380
|
const row = this.#database.prepare(
|
|
26240
|
-
`SELECT
|
|
26241
|
-
|
|
26381
|
+
`SELECT grants.*, COALESCE(configurations.session_configurations_json, '[]')
|
|
26382
|
+
AS session_configurations_json
|
|
26383
|
+
FROM local_bot_grants AS grants
|
|
26384
|
+
LEFT JOIN local_bot_grant_configurations AS configurations
|
|
26385
|
+
ON configurations.local_grant_id = grants.local_grant_id
|
|
26386
|
+
WHERE grants.local_grant_id = ? AND grants.bot_id = ?
|
|
26242
26387
|
AND behavior_revision_id = ? AND behavior_digest = ?
|
|
26243
26388
|
AND binding_id = ? AND binding_revision = ?
|
|
26244
26389
|
AND agent_ref = ?
|
|
@@ -26267,6 +26412,13 @@ var LocalBotGrantStore = class {
|
|
|
26267
26412
|
"The Bot execution target policy changed after local approval"
|
|
26268
26413
|
);
|
|
26269
26414
|
}
|
|
26415
|
+
const approvedConfigurations = parseSessionConfigurations(rowString(row, "session_configurations_json"));
|
|
26416
|
+
if (!exactSessionConfigurations(approvedConfigurations, command.sessionConfigurations)) {
|
|
26417
|
+
throw new LocalBotAuthorizationError(
|
|
26418
|
+
"binding_not_approved",
|
|
26419
|
+
"The Bot Agent configuration changed after local approval"
|
|
26420
|
+
);
|
|
26421
|
+
}
|
|
26270
26422
|
const agent = catalog.find(command.agentId);
|
|
26271
26423
|
const [adapterUnchanged, agentUnchanged] = await Promise.all([
|
|
26272
26424
|
revalidateExecutable(agent.adapterIdentity),
|
|
@@ -29002,6 +29154,7 @@ async function claimPairing(options, defaultWorkspace, localAgents, installableA
|
|
|
29002
29154
|
const agents = localAgents.map((agent) => ({
|
|
29003
29155
|
agentPath: agent.agentIdentity.requestedPath,
|
|
29004
29156
|
agentVersion: agent.agentVersion,
|
|
29157
|
+
botSessionConfiguration: true,
|
|
29005
29158
|
capabilities: agent.capabilities,
|
|
29006
29159
|
id: agent.id,
|
|
29007
29160
|
label: agent.label
|
|
@@ -29242,6 +29395,7 @@ async function publishAgentCatalog(config2, signal) {
|
|
|
29242
29395
|
agents: catalog.agents.map((agent) => ({
|
|
29243
29396
|
agentPath: agent.agentIdentity.requestedPath,
|
|
29244
29397
|
agentVersion: agent.agentVersion,
|
|
29398
|
+
botSessionConfiguration: true,
|
|
29245
29399
|
capabilities: agent.capabilities,
|
|
29246
29400
|
id: agent.id,
|
|
29247
29401
|
label: agent.label
|
|
@@ -30443,6 +30597,23 @@ var NativeSessionService = class {
|
|
|
30443
30597
|
);
|
|
30444
30598
|
}
|
|
30445
30599
|
const target = await this.resolveTarget(command, options, selected);
|
|
30600
|
+
if (command.action === "preview") {
|
|
30601
|
+
const history = await this.#sessions.previewNativeSession(
|
|
30602
|
+
{ ...options, cwd: target.cwd, additionalDirectories: target.additionalDirectories },
|
|
30603
|
+
target.info.sessionId
|
|
30604
|
+
);
|
|
30605
|
+
signal.throwIfAborted();
|
|
30606
|
+
this.record(command, "native_session_previewed");
|
|
30607
|
+
return {
|
|
30608
|
+
...envelope2,
|
|
30609
|
+
action: "preview",
|
|
30610
|
+
entryId: command.entryId,
|
|
30611
|
+
targetSessionId: command.sessionId,
|
|
30612
|
+
reason: "requested",
|
|
30613
|
+
title: target.info.title ?? "Untitled session",
|
|
30614
|
+
history
|
|
30615
|
+
};
|
|
30616
|
+
}
|
|
30446
30617
|
if (command.action === "delete") {
|
|
30447
30618
|
if (!prepared.capabilities.deleteSession) {
|
|
30448
30619
|
throw new AcpExecutionError(
|
|
@@ -32442,13 +32613,14 @@ async function executeSessionPrepare(publisher, socket, command, config2, direct
|
|
|
32442
32613
|
signal
|
|
32443
32614
|
);
|
|
32444
32615
|
const agent = config2.catalog.find(command.agentId);
|
|
32445
|
-
const
|
|
32616
|
+
const preparation = {
|
|
32446
32617
|
additionalDirectories: resolved.additionalDirectories,
|
|
32447
32618
|
agent,
|
|
32448
32619
|
cwd: resolved.cwd,
|
|
32449
32620
|
sessionId: command.sessionId,
|
|
32450
32621
|
signal
|
|
32451
|
-
}
|
|
32622
|
+
};
|
|
32623
|
+
const prepared = command.transient === true ? await sessions.inspectSession(preparation) : await sessions.prepareSession(preparation);
|
|
32452
32624
|
const listing = await directories.list(config2.bindingId, command.directoryId, signal);
|
|
32453
32625
|
audit.record({
|
|
32454
32626
|
commandId: command.requestId,
|
|
@@ -32727,6 +32899,20 @@ async function executeBotPrompt(outbox, publisher, command, config2, directories
|
|
|
32727
32899
|
sessionId: command.sessionId,
|
|
32728
32900
|
signal: executionSignal
|
|
32729
32901
|
});
|
|
32902
|
+
for (const selection of command.sessionConfigurations) {
|
|
32903
|
+
await sessions.configureSession({
|
|
32904
|
+
additionalDirectories: resolved.additionalDirectories,
|
|
32905
|
+
agent,
|
|
32906
|
+
booleanValue: selection.booleanValue,
|
|
32907
|
+
configId: selection.configId,
|
|
32908
|
+
cwd: resolved.cwd,
|
|
32909
|
+
requestId: `cfg_${randomUUID6()}`,
|
|
32910
|
+
sessionId: command.sessionId,
|
|
32911
|
+
signal: executionSignal,
|
|
32912
|
+
value: selection.value,
|
|
32913
|
+
valueType: selection.valueType
|
|
32914
|
+
});
|
|
32915
|
+
}
|
|
32730
32916
|
audit.record({
|
|
32731
32917
|
commandId: command.commandId,
|
|
32732
32918
|
details: {
|