@moxt-ai/mobius 0.0.110 → 0.0.113
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/codex/agent.d.ts.map +1 -1
- package/dist/acp/codex/agent.js +76 -3
- package/dist/acp/codex/agent.js.map +1 -1
- package/dist/acp/codex/app-server-protocol.d.ts +3 -0
- package/dist/acp/codex/app-server-protocol.d.ts.map +1 -1
- package/dist/acp/codex/app-server-protocol.js +1 -0
- package/dist/acp/codex/app-server-protocol.js.map +1 -1
- package/dist/acp/codex/items.d.ts +1 -1
- package/dist/acp/codex/items.d.ts.map +1 -1
- package/dist/acp/codex/items.js +6 -3
- package/dist/acp/codex/items.js.map +1 -1
- package/dist/cli.js +354 -171
- package/dist/cli.js.map +4 -4
- package/dist/daemon-session-commands.d.ts +8 -1
- package/dist/daemon-session-commands.d.ts.map +1 -1
- package/dist/daemon-session-commands.js +9 -6
- package/dist/daemon-session-commands.js.map +1 -1
- package/dist/daemon-turn-reconciliation.d.ts +4 -1
- package/dist/daemon-turn-reconciliation.d.ts.map +1 -1
- package/dist/daemon-turn-reconciliation.js +29 -7
- package/dist/daemon-turn-reconciliation.js.map +1 -1
- package/dist/index.js +354 -172
- package/dist/index.js.map +4 -4
- package/dist/native-sessions/service.d.ts +1 -1
- package/dist/native-sessions/service.d.ts.map +1 -1
- package/dist/native-sessions/service.js +7 -6
- 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 +5 -6
- package/dist/pairing/pair-local-machine.js.map +1 -1
- package/dist/prompt-artifact-resolver.d.ts +1 -1
- package/dist/prompt-artifact-resolver.d.ts.map +1 -1
- package/dist/prompt-artifact-resolver.js +2 -2
- package/dist/prompt-artifact-resolver.js.map +1 -1
- package/dist/run-daemon.d.ts.map +1 -1
- package/dist/run-daemon.js +32 -10
- package/dist/run-daemon.js.map +1 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +7115 -6935
- package/dist/runtime.js.map +4 -4
- package/dist/storage/runtime-installation-store.js +3 -3
- package/dist/storage/runtime-installation-store.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3381,7 +3381,7 @@ var program = new Command();
|
|
|
3381
3381
|
// package.json
|
|
3382
3382
|
var package_default = {
|
|
3383
3383
|
name: "@moxt-ai/mobius",
|
|
3384
|
-
version: "0.0.
|
|
3384
|
+
version: "0.0.113",
|
|
3385
3385
|
description: "Mobius CLI for pairing and running local AI agent services.",
|
|
3386
3386
|
type: "module",
|
|
3387
3387
|
bin: {
|
|
@@ -24607,6 +24607,7 @@ var turnSchema = external_exports.object({
|
|
|
24607
24607
|
id: boundedText(256),
|
|
24608
24608
|
status: turnStatusSchema
|
|
24609
24609
|
});
|
|
24610
|
+
var turnSteerResponseSchema = external_exports.object({ turnId: boundedText(256) });
|
|
24610
24611
|
var turnNotificationSchema = external_exports.object({
|
|
24611
24612
|
thread: external_exports.object({ id: boundedText(256) }).nullish(),
|
|
24612
24613
|
threadId: boundedText(256),
|
|
@@ -24991,7 +24992,10 @@ function presentToolItem(item) {
|
|
|
24991
24992
|
kind: "execute",
|
|
24992
24993
|
locations: [],
|
|
24993
24994
|
rawInput: { command: item.command, cwd: item.cwd },
|
|
24994
|
-
rawOutput: {
|
|
24995
|
+
rawOutput: {
|
|
24996
|
+
...item.exitCode == null ? {} : { exitCode: item.exitCode },
|
|
24997
|
+
output: truncate(output2, TOOL_OUTPUT_CHARACTER_LIMIT)
|
|
24998
|
+
},
|
|
24995
24999
|
status: commandStatus(item.status),
|
|
24996
25000
|
title: truncate(firstLine(item.command), TITLE_CHARACTER_LIMIT)
|
|
24997
25001
|
};
|
|
@@ -25047,7 +25051,7 @@ function presentToolItem(item) {
|
|
|
25047
25051
|
}
|
|
25048
25052
|
return null;
|
|
25049
25053
|
}
|
|
25050
|
-
function toolCallUpdate(item) {
|
|
25054
|
+
function toolCallUpdate(item, lifecycle) {
|
|
25051
25055
|
const presentation = presentToolItem(item);
|
|
25052
25056
|
if (presentation === null) {
|
|
25053
25057
|
return null;
|
|
@@ -25058,7 +25062,7 @@ function toolCallUpdate(item) {
|
|
|
25058
25062
|
locations: [...presentation.locations],
|
|
25059
25063
|
rawInput: presentation.rawInput,
|
|
25060
25064
|
rawOutput: presentation.rawOutput,
|
|
25061
|
-
status: presentation.status,
|
|
25065
|
+
status: lifecycle === "completed" && presentation.status === "in_progress" ? "completed" : presentation.status,
|
|
25062
25066
|
title: presentation.title,
|
|
25063
25067
|
toolCallId: item.id
|
|
25064
25068
|
};
|
|
@@ -25167,6 +25171,54 @@ function promptInput(prompt) {
|
|
|
25167
25171
|
}
|
|
25168
25172
|
return input2;
|
|
25169
25173
|
}
|
|
25174
|
+
function steeringPromptInput(prompt) {
|
|
25175
|
+
const input2 = [];
|
|
25176
|
+
for (const block of prompt) {
|
|
25177
|
+
if (typeof block !== "object" || block === null) {
|
|
25178
|
+
throw new AcpExecutionError("Codex received an invalid steering prompt", {}, "invalid_request");
|
|
25179
|
+
}
|
|
25180
|
+
const type = Reflect.get(block, "type");
|
|
25181
|
+
if (type === "text") {
|
|
25182
|
+
const text = Reflect.get(block, "text");
|
|
25183
|
+
if (typeof text !== "string") {
|
|
25184
|
+
throw new AcpExecutionError("Codex received an invalid steering prompt", {}, "invalid_request");
|
|
25185
|
+
}
|
|
25186
|
+
input2.push({ text, text_elements: [], type: "text" });
|
|
25187
|
+
continue;
|
|
25188
|
+
}
|
|
25189
|
+
if (type === "image") {
|
|
25190
|
+
const data = Reflect.get(block, "data");
|
|
25191
|
+
const mimeType = Reflect.get(block, "mimeType");
|
|
25192
|
+
if (typeof data !== "string" || typeof mimeType !== "string") {
|
|
25193
|
+
throw new AcpExecutionError("Codex received an invalid steering prompt", {}, "invalid_request");
|
|
25194
|
+
}
|
|
25195
|
+
input2.push({ type: "image", url: `data:${mimeType};base64,${data}` });
|
|
25196
|
+
continue;
|
|
25197
|
+
}
|
|
25198
|
+
if (type === "resource") {
|
|
25199
|
+
const resource = Reflect.get(block, "resource");
|
|
25200
|
+
if (typeof resource !== "object" || resource === null) {
|
|
25201
|
+
throw new AcpExecutionError("Codex received an invalid steering prompt", {}, "invalid_request");
|
|
25202
|
+
}
|
|
25203
|
+
const text = Reflect.get(resource, "text");
|
|
25204
|
+
if (text !== void 0 && typeof text !== "string") {
|
|
25205
|
+
throw new AcpExecutionError("Codex received an invalid steering prompt", {}, "invalid_request");
|
|
25206
|
+
}
|
|
25207
|
+
input2.push({ text: text ?? "", text_elements: [], type: "text" });
|
|
25208
|
+
continue;
|
|
25209
|
+
}
|
|
25210
|
+
if (type === "resource_link") {
|
|
25211
|
+
const uri = Reflect.get(block, "uri");
|
|
25212
|
+
if (typeof uri !== "string") {
|
|
25213
|
+
throw new AcpExecutionError("Codex received an invalid steering prompt", {}, "invalid_request");
|
|
25214
|
+
}
|
|
25215
|
+
input2.push({ text: `Resource: ${uri}`, text_elements: [], type: "text" });
|
|
25216
|
+
continue;
|
|
25217
|
+
}
|
|
25218
|
+
throw new AcpExecutionError("Codex received an unsupported steering prompt", {}, "invalid_request");
|
|
25219
|
+
}
|
|
25220
|
+
return input2;
|
|
25221
|
+
}
|
|
25170
25222
|
function modelValues(models) {
|
|
25171
25223
|
return models.map((model) => ({
|
|
25172
25224
|
description: model.description ?? "",
|
|
@@ -25345,6 +25397,7 @@ var CodexAcpAgent = class {
|
|
|
25345
25397
|
this.#app = createAgentApp({ name: "mobius-codex" }).onConnect((connection) => {
|
|
25346
25398
|
this.#connection = connection;
|
|
25347
25399
|
}).onRequest(methods.agent.initialize, async () => ({
|
|
25400
|
+
_meta: { steering: { supported: true } },
|
|
25348
25401
|
agentCapabilities: {
|
|
25349
25402
|
loadSession: true,
|
|
25350
25403
|
promptCapabilities: { embeddedContext: true, image: true },
|
|
@@ -25418,7 +25471,11 @@ var CodexAcpAgent = class {
|
|
|
25418
25471
|
return { configOptions: this.#configOptions() };
|
|
25419
25472
|
}).onRequest(methods.agent.session.prompt, async (context) => {
|
|
25420
25473
|
return await this.#runTurn(promptInput(context.params.prompt), context.signal);
|
|
25421
|
-
}).onRequest(
|
|
25474
|
+
}).onRequest(
|
|
25475
|
+
"_session/steering",
|
|
25476
|
+
(params) => params,
|
|
25477
|
+
async (context) => await this.#steerTurn(context.params, context.signal)
|
|
25478
|
+
).onRequest(methods.agent.session.list, async (context) => {
|
|
25422
25479
|
const decoded = threadListResponseSchema.parse(
|
|
25423
25480
|
await this.#appServer.request(
|
|
25424
25481
|
"thread/list",
|
|
@@ -25585,7 +25642,7 @@ var CodexAcpAgent = class {
|
|
|
25585
25642
|
});
|
|
25586
25643
|
continue;
|
|
25587
25644
|
}
|
|
25588
|
-
const update = toolCallUpdate(item);
|
|
25645
|
+
const update = toolCallUpdate(item, "snapshot");
|
|
25589
25646
|
if (update !== null) {
|
|
25590
25647
|
await this.#emit({ ...update, sessionUpdate: "tool_call_update" });
|
|
25591
25648
|
}
|
|
@@ -25782,7 +25839,7 @@ var CodexAcpAgent = class {
|
|
|
25782
25839
|
});
|
|
25783
25840
|
return;
|
|
25784
25841
|
}
|
|
25785
|
-
const update = toolCallUpdate(item);
|
|
25842
|
+
const update = toolCallUpdate(item, method === "item/completed" ? "completed" : "started");
|
|
25786
25843
|
if (update !== null) {
|
|
25787
25844
|
await this.#enqueue(async () => {
|
|
25788
25845
|
await this.#emit({ ...update, sessionUpdate: "tool_call_update" });
|
|
@@ -25968,6 +26025,35 @@ var CodexAcpAgent = class {
|
|
|
25968
26025
|
}
|
|
25969
26026
|
}
|
|
25970
26027
|
};
|
|
26028
|
+
#steerTurn = async (params, signal) => {
|
|
26029
|
+
if (typeof params !== "object" || params === null) {
|
|
26030
|
+
throw new AcpExecutionError("Codex received an invalid steering request", {}, "invalid_request");
|
|
26031
|
+
}
|
|
26032
|
+
const sessionId = Reflect.get(params, "sessionId");
|
|
26033
|
+
const prompt = Reflect.get(params, "prompt");
|
|
26034
|
+
if (typeof sessionId !== "string" || !Array.isArray(prompt)) {
|
|
26035
|
+
throw new AcpExecutionError("Codex received an invalid steering request", {}, "invalid_request");
|
|
26036
|
+
}
|
|
26037
|
+
const active = this.#turn;
|
|
26038
|
+
if (sessionId !== this.#nativeSessionId || active === null || active.turn.id.length === 0) {
|
|
26039
|
+
return { outcome: "promptRequired", reason: "noRunningTurn" };
|
|
26040
|
+
}
|
|
26041
|
+
const input2 = steeringPromptInput(prompt);
|
|
26042
|
+
if (input2.length === 0) {
|
|
26043
|
+
throw new AcpExecutionError("Codex received an empty steering request", {}, "invalid_request");
|
|
26044
|
+
}
|
|
26045
|
+
const response = turnSteerResponseSchema.parse(
|
|
26046
|
+
await this.#appServer.request(
|
|
26047
|
+
"turn/steer",
|
|
26048
|
+
{ expectedTurnId: active.turn.id, input: input2, threadId: this.#nativeSessionId },
|
|
26049
|
+
AbortSignal.any([signal, AbortSignal.timeout(APPROVAL_TIMEOUT_MILLISECONDS)])
|
|
26050
|
+
)
|
|
26051
|
+
);
|
|
26052
|
+
if (response.turnId !== active.turn.id) {
|
|
26053
|
+
throw new AcpExecutionError("Codex steered an unexpected turn", {}, "steering_target_unavailable");
|
|
26054
|
+
}
|
|
26055
|
+
return { outcome: "injected" };
|
|
26056
|
+
};
|
|
25971
26057
|
#interruptTurn = async () => {
|
|
25972
26058
|
const turn = this.#turn;
|
|
25973
26059
|
if (turn === null) {
|
|
@@ -27836,6 +27922,17 @@ async function discoverLocalAgentInventory(options) {
|
|
|
27836
27922
|
// src/config.ts
|
|
27837
27923
|
import { join as join14, resolve as resolve3 } from "node:path";
|
|
27838
27924
|
|
|
27925
|
+
// ../protocol/src/identifier.ts
|
|
27926
|
+
var IDENTIFIER_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
|
|
27927
|
+
var identifierStringSchema = external_exports.string().min(1).max(128).regex(IDENTIFIER_PATTERN);
|
|
27928
|
+
var identifierSchema = identifierStringSchema.brand();
|
|
27929
|
+
function isIdentifier(value) {
|
|
27930
|
+
return identifierSchema.safeParse(value).success;
|
|
27931
|
+
}
|
|
27932
|
+
function decodeIdentifier(value) {
|
|
27933
|
+
return identifierSchema.parse(value);
|
|
27934
|
+
}
|
|
27935
|
+
|
|
27839
27936
|
// ../protocol/src/prompt-usage.ts
|
|
27840
27937
|
var TOKEN_COUNT = external_exports.number().int().nonnegative();
|
|
27841
27938
|
function normalizeQuotaTokenCount(value) {
|
|
@@ -27943,9 +28040,7 @@ var FILE_BEGIN_KIND = "file.begin";
|
|
|
27943
28040
|
var FILE_CHUNK_KIND = "file.chunk";
|
|
27944
28041
|
var FILE_END_KIND = "file.end";
|
|
27945
28042
|
var FILE_FAILED_KIND = "file.failed";
|
|
27946
|
-
var IDENTIFIER_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
|
|
27947
28043
|
var DIRECTORY_IDENTIFIER_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/;
|
|
27948
|
-
var IDENTIFIER = external_exports.string().min(1).max(128).regex(IDENTIFIER_PATTERN);
|
|
27949
28044
|
var DIRECTORY_IDENTIFIER = external_exports.string().min(1).max(2048).regex(DIRECTORY_IDENTIFIER_PATTERN);
|
|
27950
28045
|
var SHORT_TEXT = external_exports.string().max(500);
|
|
27951
28046
|
var LONG_TEXT = external_exports.string().max(1e5);
|
|
@@ -27955,29 +28050,29 @@ var workspaceEntrySchema = external_exports.strictObject({
|
|
|
27955
28050
|
}).readonly();
|
|
27956
28051
|
var sessionMetadataSchema = external_exports.strictObject({
|
|
27957
28052
|
additionalDirectories: external_exports.array(workspaceEntrySchema).max(16).readonly(),
|
|
27958
|
-
agentId:
|
|
28053
|
+
agentId: identifierStringSchema,
|
|
27959
28054
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
27960
28055
|
directoryLabel: external_exports.string().min(1).max(2048),
|
|
27961
28056
|
prompted: external_exports.boolean(),
|
|
27962
|
-
sessionId:
|
|
28057
|
+
sessionId: identifierStringSchema,
|
|
27963
28058
|
title: external_exports.string().max(500),
|
|
27964
28059
|
updatedAt: external_exports.iso.datetime({ offset: true })
|
|
27965
28060
|
}).readonly();
|
|
27966
28061
|
var sessionQueryCommandSchema = external_exports.strictObject({
|
|
27967
28062
|
kind: external_exports.literal(SESSION_QUERY_KIND),
|
|
27968
|
-
requestId:
|
|
27969
|
-
sessionIds: external_exports.array(
|
|
28063
|
+
requestId: identifierStringSchema,
|
|
28064
|
+
sessionIds: external_exports.array(identifierStringSchema).min(1).max(500).readonly()
|
|
27970
28065
|
}).readonly();
|
|
27971
28066
|
var sessionsQueriedEventSchema = external_exports.strictObject({
|
|
27972
28067
|
entries: external_exports.array(sessionMetadataSchema).max(500).readonly(),
|
|
27973
28068
|
kind: external_exports.literal(SESSION_QUERIED_KIND),
|
|
27974
|
-
requestId:
|
|
28069
|
+
requestId: identifierStringSchema
|
|
27975
28070
|
}).readonly();
|
|
27976
28071
|
var fileReadCommandSchema = external_exports.strictObject({
|
|
27977
28072
|
kind: external_exports.literal(FILE_READ_KIND),
|
|
27978
28073
|
maxBytes: external_exports.number().int().positive().max(128 * 1024 * 1024),
|
|
27979
|
-
requestId:
|
|
27980
|
-
sessionId:
|
|
28074
|
+
requestId: identifierStringSchema,
|
|
28075
|
+
sessionId: identifierStringSchema,
|
|
27981
28076
|
path: external_exports.string().min(1).max(4096)
|
|
27982
28077
|
}).readonly();
|
|
27983
28078
|
var fileBeginEventSchema = external_exports.strictObject({
|
|
@@ -27986,27 +28081,27 @@ var fileBeginEventSchema = external_exports.strictObject({
|
|
|
27986
28081
|
mediaType: external_exports.string().min(1).max(255),
|
|
27987
28082
|
modifiedAt: external_exports.iso.datetime({ offset: true }),
|
|
27988
28083
|
name: external_exports.string().min(1).max(500),
|
|
27989
|
-
requestId:
|
|
27990
|
-
sessionId:
|
|
28084
|
+
requestId: identifierStringSchema,
|
|
28085
|
+
sessionId: identifierStringSchema
|
|
27991
28086
|
}).readonly();
|
|
27992
28087
|
var fileChunkEventSchema = external_exports.strictObject({
|
|
27993
28088
|
data: external_exports.string().min(1).max(4e5),
|
|
27994
28089
|
kind: external_exports.literal(FILE_CHUNK_KIND),
|
|
27995
|
-
requestId:
|
|
28090
|
+
requestId: identifierStringSchema,
|
|
27996
28091
|
sequence: external_exports.number().int().nonnegative().max(1024),
|
|
27997
|
-
sessionId:
|
|
28092
|
+
sessionId: identifierStringSchema
|
|
27998
28093
|
}).readonly();
|
|
27999
28094
|
var fileEndEventSchema = external_exports.strictObject({
|
|
28000
28095
|
kind: external_exports.literal(FILE_END_KIND),
|
|
28001
|
-
requestId:
|
|
28002
|
-
sessionId:
|
|
28096
|
+
requestId: identifierStringSchema,
|
|
28097
|
+
sessionId: identifierStringSchema
|
|
28003
28098
|
}).readonly();
|
|
28004
28099
|
var fileFailedEventSchema = external_exports.strictObject({
|
|
28005
|
-
code:
|
|
28100
|
+
code: identifierStringSchema,
|
|
28006
28101
|
kind: external_exports.literal(FILE_FAILED_KIND),
|
|
28007
28102
|
message: external_exports.string().min(1).max(500),
|
|
28008
|
-
requestId:
|
|
28009
|
-
sessionId:
|
|
28103
|
+
requestId: identifierStringSchema,
|
|
28104
|
+
sessionId: identifierStringSchema
|
|
28010
28105
|
}).readonly();
|
|
28011
28106
|
var configValueSchema = external_exports.strictObject({
|
|
28012
28107
|
description: SHORT_TEXT,
|
|
@@ -28057,44 +28152,44 @@ var agentModelEffortSchema = external_exports.strictObject({
|
|
|
28057
28152
|
valuesByModel: external_exports.record(external_exports.string().min(1).max(500), external_exports.array(configValueSchema).max(500).readonly()).readonly()
|
|
28058
28153
|
}).readonly();
|
|
28059
28154
|
var agentSettingsDiscoverCommandSchema = external_exports.strictObject({
|
|
28060
|
-
agentId:
|
|
28155
|
+
agentId: identifierStringSchema,
|
|
28061
28156
|
kind: external_exports.literal(AGENT_SETTINGS_DISCOVER_KIND),
|
|
28062
28157
|
model: external_exports.string().min(1).max(500).optional(),
|
|
28063
|
-
requestId:
|
|
28158
|
+
requestId: identifierStringSchema
|
|
28064
28159
|
}).readonly();
|
|
28065
28160
|
var agentSettingsDiscoveredEventSchema = external_exports.strictObject({
|
|
28066
|
-
agentId:
|
|
28161
|
+
agentId: identifierStringSchema,
|
|
28067
28162
|
agentName: external_exports.string().max(255),
|
|
28068
28163
|
agentVersion: external_exports.string().max(128),
|
|
28069
28164
|
kind: external_exports.literal(AGENT_SETTINGS_DISCOVERED_KIND),
|
|
28070
28165
|
modelEffort: agentModelEffortSchema,
|
|
28071
|
-
requestId:
|
|
28166
|
+
requestId: identifierStringSchema,
|
|
28072
28167
|
settings: agentSettingsSchema,
|
|
28073
28168
|
settingsRevision: external_exports.string().regex(/^[a-f0-9]{64}$/)
|
|
28074
28169
|
}).readonly();
|
|
28075
28170
|
var agentSettingsDiscoveryFailedEventSchema = external_exports.strictObject({
|
|
28076
|
-
code:
|
|
28171
|
+
code: identifierStringSchema,
|
|
28077
28172
|
kind: external_exports.literal(AGENT_SETTINGS_DISCOVERY_FAILED_KIND),
|
|
28078
28173
|
message: external_exports.string().min(1).max(500),
|
|
28079
|
-
requestId:
|
|
28174
|
+
requestId: identifierStringSchema
|
|
28080
28175
|
}).readonly();
|
|
28081
28176
|
var agentCatalogRefreshCommandSchema = external_exports.strictObject({
|
|
28082
28177
|
kind: external_exports.literal(AGENT_CATALOG_REFRESH_KIND),
|
|
28083
|
-
requestId:
|
|
28178
|
+
requestId: identifierStringSchema
|
|
28084
28179
|
}).readonly();
|
|
28085
28180
|
var agentCatalogRefreshedEventSchema = external_exports.strictObject({
|
|
28086
28181
|
kind: external_exports.literal(AGENT_CATALOG_REFRESHED_KIND),
|
|
28087
|
-
requestId:
|
|
28182
|
+
requestId: identifierStringSchema
|
|
28088
28183
|
}).readonly();
|
|
28089
28184
|
var agentCatalogRefreshFailedEventSchema = external_exports.strictObject({
|
|
28090
|
-
code:
|
|
28185
|
+
code: identifierStringSchema,
|
|
28091
28186
|
kind: external_exports.literal(AGENT_CATALOG_REFRESH_FAILED_KIND),
|
|
28092
28187
|
message: external_exports.string().min(1).max(500),
|
|
28093
|
-
requestId:
|
|
28188
|
+
requestId: identifierStringSchema
|
|
28094
28189
|
}).readonly();
|
|
28095
28190
|
var sessionConfigurationSelectionSchema = external_exports.strictObject({
|
|
28096
28191
|
booleanValue: external_exports.boolean(),
|
|
28097
|
-
configId:
|
|
28192
|
+
configId: identifierStringSchema,
|
|
28098
28193
|
value: external_exports.string().max(500),
|
|
28099
28194
|
valueType: external_exports.enum(["boolean", "select"])
|
|
28100
28195
|
}).readonly();
|
|
@@ -28236,26 +28331,26 @@ var promptResourceSchema = external_exports.strictObject({
|
|
|
28236
28331
|
uri: external_exports.string().min(1).max(4096)
|
|
28237
28332
|
}).readonly();
|
|
28238
28333
|
var workspaceListCommandSchema = external_exports.strictObject({
|
|
28239
|
-
bindingId:
|
|
28334
|
+
bindingId: identifierStringSchema,
|
|
28240
28335
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
28241
28336
|
kind: external_exports.literal(WORKSPACE_LIST_KIND),
|
|
28242
|
-
requestId:
|
|
28337
|
+
requestId: identifierStringSchema
|
|
28243
28338
|
}).readonly();
|
|
28244
28339
|
var workspaceEntriesEventSchema = external_exports.strictObject({
|
|
28245
|
-
bindingId:
|
|
28340
|
+
bindingId: identifierStringSchema,
|
|
28246
28341
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
28247
28342
|
directoryLabel: external_exports.string().min(1).max(2048),
|
|
28248
28343
|
entries: external_exports.array(workspaceEntrySchema).max(500).readonly(),
|
|
28249
28344
|
kind: external_exports.literal(WORKSPACE_ENTRIES_KIND),
|
|
28250
28345
|
parentDirectoryId: external_exports.string().max(2048),
|
|
28251
|
-
requestId:
|
|
28346
|
+
requestId: identifierStringSchema
|
|
28252
28347
|
}).readonly();
|
|
28253
28348
|
var sessionIdentityFields = {
|
|
28254
28349
|
additionalDirectoryIds: external_exports.array(DIRECTORY_IDENTIFIER).max(16).readonly(),
|
|
28255
|
-
agentId:
|
|
28256
|
-
bindingId:
|
|
28350
|
+
agentId: identifierStringSchema,
|
|
28351
|
+
bindingId: identifierStringSchema,
|
|
28257
28352
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
28258
|
-
sessionId:
|
|
28353
|
+
sessionId: identifierStringSchema
|
|
28259
28354
|
};
|
|
28260
28355
|
var sessionPrepareCommandSchema = external_exports.strictObject({
|
|
28261
28356
|
...sessionIdentityFields,
|
|
@@ -28266,7 +28361,7 @@ var sessionPrepareCommandSchema = external_exports.strictObject({
|
|
|
28266
28361
|
valueType: external_exports.enum(["boolean", "select"])
|
|
28267
28362
|
}).readonly().optional(),
|
|
28268
28363
|
kind: external_exports.literal(SESSION_PREPARE_KIND),
|
|
28269
|
-
requestId:
|
|
28364
|
+
requestId: identifierStringSchema,
|
|
28270
28365
|
sessionState: external_exports.literal("provisioned").optional(),
|
|
28271
28366
|
/** Marks an inspection-only Session preparation. */
|
|
28272
28367
|
transient: external_exports.boolean().optional()
|
|
@@ -28287,7 +28382,7 @@ var runtimeTimingsSchema = external_exports.array(
|
|
|
28287
28382
|
).max(16).readonly();
|
|
28288
28383
|
var sessionReadyEventSchema = external_exports.strictObject({
|
|
28289
28384
|
additionalDirectories: external_exports.array(workspaceEntrySchema).max(16).readonly(),
|
|
28290
|
-
agentId:
|
|
28385
|
+
agentId: identifierStringSchema,
|
|
28291
28386
|
agentName: external_exports.string().max(255),
|
|
28292
28387
|
agentVersion: external_exports.string().max(128),
|
|
28293
28388
|
capabilities: sessionCapabilitiesSchema,
|
|
@@ -28296,41 +28391,41 @@ var sessionReadyEventSchema = external_exports.strictObject({
|
|
|
28296
28391
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
28297
28392
|
directoryLabel: external_exports.string().min(1).max(2048),
|
|
28298
28393
|
kind: external_exports.literal(SESSION_READY_KIND),
|
|
28299
|
-
requestId:
|
|
28394
|
+
requestId: identifierStringSchema,
|
|
28300
28395
|
restored: external_exports.boolean(),
|
|
28301
28396
|
runtimeTimings: runtimeTimingsSchema.optional(),
|
|
28302
|
-
sessionId:
|
|
28397
|
+
sessionId: identifierStringSchema
|
|
28303
28398
|
}).readonly();
|
|
28304
28399
|
var sessionConfigureCommandSchema = external_exports.strictObject({
|
|
28305
28400
|
...sessionIdentityFields,
|
|
28306
28401
|
booleanValue: external_exports.boolean(),
|
|
28307
28402
|
configId: external_exports.string().min(1).max(128),
|
|
28308
28403
|
kind: external_exports.literal(SESSION_CONFIGURE_KIND),
|
|
28309
|
-
requestId:
|
|
28404
|
+
requestId: identifierStringSchema,
|
|
28310
28405
|
value: external_exports.string().max(500),
|
|
28311
28406
|
valueType: external_exports.enum(["boolean", "select"])
|
|
28312
28407
|
}).readonly();
|
|
28313
28408
|
var sessionConfigUpdatedEventSchema = external_exports.strictObject({
|
|
28314
28409
|
configOptions: sessionConfigOptionsSchema,
|
|
28315
28410
|
kind: external_exports.literal(SESSION_CONFIG_UPDATED_KIND),
|
|
28316
|
-
requestId:
|
|
28317
|
-
sessionId:
|
|
28411
|
+
requestId: identifierStringSchema,
|
|
28412
|
+
sessionId: identifierStringSchema
|
|
28318
28413
|
}).readonly();
|
|
28319
28414
|
var sessionContextUsageUpdatedEventSchema = external_exports.strictObject({
|
|
28320
28415
|
costAmount: external_exports.number().finite().nonnegative(),
|
|
28321
28416
|
costCurrency: external_exports.string().max(16),
|
|
28322
28417
|
hasCost: external_exports.boolean(),
|
|
28323
28418
|
kind: external_exports.literal(SESSION_USAGE_UPDATED_KIND),
|
|
28324
|
-
sessionId:
|
|
28419
|
+
sessionId: identifierStringSchema,
|
|
28325
28420
|
size: external_exports.number().int().nonnegative(),
|
|
28326
28421
|
source: external_exports.literal("context").default("context"),
|
|
28327
28422
|
used: external_exports.number().int().nonnegative()
|
|
28328
28423
|
}).readonly();
|
|
28329
28424
|
var sessionPromptUsageUpdatedEventSchema = external_exports.strictObject({
|
|
28330
28425
|
_meta: promptMetadataSchema.nullable(),
|
|
28331
|
-
commandId:
|
|
28426
|
+
commandId: identifierStringSchema,
|
|
28332
28427
|
kind: external_exports.literal(SESSION_USAGE_UPDATED_KIND),
|
|
28333
|
-
sessionId:
|
|
28428
|
+
sessionId: identifierStringSchema,
|
|
28334
28429
|
source: external_exports.literal("prompt"),
|
|
28335
28430
|
usage: promptUsageSchema.nullable()
|
|
28336
28431
|
}).refine((event) => event.usage !== null || event._meta?.quota !== void 0).readonly();
|
|
@@ -28341,82 +28436,82 @@ var sessionUsageUpdatedEventSchema = external_exports.union([
|
|
|
28341
28436
|
var sessionCommandsUpdatedEventSchema = external_exports.strictObject({
|
|
28342
28437
|
commands: external_exports.array(sessionCommandSchema).max(500).readonly(),
|
|
28343
28438
|
kind: external_exports.literal(SESSION_COMMANDS_UPDATED_KIND),
|
|
28344
|
-
sessionId:
|
|
28439
|
+
sessionId: identifierStringSchema
|
|
28345
28440
|
}).readonly();
|
|
28346
28441
|
var sessionInfoUpdatedEventSchema = external_exports.strictObject({
|
|
28347
28442
|
kind: external_exports.literal(SESSION_INFO_UPDATED_KIND),
|
|
28348
|
-
sessionId:
|
|
28443
|
+
sessionId: identifierStringSchema,
|
|
28349
28444
|
title: external_exports.string().max(500).nullable(),
|
|
28350
28445
|
updatedAt: external_exports.string().max(128)
|
|
28351
28446
|
}).readonly();
|
|
28352
28447
|
var sessionPermissionRequestedEventSchema = external_exports.strictObject({
|
|
28353
|
-
commandId:
|
|
28354
|
-
interactionId:
|
|
28448
|
+
commandId: identifierStringSchema,
|
|
28449
|
+
interactionId: identifierStringSchema,
|
|
28355
28450
|
kind: external_exports.literal(SESSION_PERMISSION_REQUESTED_KIND),
|
|
28356
28451
|
options: external_exports.array(permissionOptionSchema).min(1).max(20).readonly(),
|
|
28357
|
-
sessionId:
|
|
28452
|
+
sessionId: identifierStringSchema,
|
|
28358
28453
|
title: external_exports.string().min(1).max(500),
|
|
28359
28454
|
toolCallId: external_exports.string().min(1).max(255),
|
|
28360
28455
|
toolKind: external_exports.string().max(64)
|
|
28361
28456
|
}).readonly();
|
|
28362
28457
|
var sessionPermissionRespondCommandSchema = external_exports.strictObject({
|
|
28363
|
-
interactionId:
|
|
28458
|
+
interactionId: identifierStringSchema,
|
|
28364
28459
|
kind: external_exports.literal(SESSION_PERMISSION_RESPOND_KIND),
|
|
28365
28460
|
optionId: external_exports.string().max(255),
|
|
28366
28461
|
outcome: external_exports.enum(["cancelled", "selected"]),
|
|
28367
|
-
sessionId:
|
|
28462
|
+
sessionId: identifierStringSchema
|
|
28368
28463
|
}).readonly();
|
|
28369
28464
|
var sessionPermissionResolvedEventSchema = external_exports.strictObject({
|
|
28370
|
-
interactionId:
|
|
28465
|
+
interactionId: identifierStringSchema,
|
|
28371
28466
|
kind: external_exports.literal(SESSION_PERMISSION_RESOLVED_KIND),
|
|
28372
28467
|
optionId: external_exports.string().max(255),
|
|
28373
28468
|
outcome: external_exports.enum(["cancelled", "selected"]),
|
|
28374
|
-
sessionId:
|
|
28469
|
+
sessionId: identifierStringSchema
|
|
28375
28470
|
}).readonly();
|
|
28376
28471
|
var sessionElicitationRequestedEventSchema = external_exports.strictObject({
|
|
28377
28472
|
accepted: external_exports.boolean(),
|
|
28378
|
-
commandId:
|
|
28473
|
+
commandId: identifierStringSchema,
|
|
28379
28474
|
elicitationId: external_exports.string().max(255),
|
|
28380
28475
|
fields: external_exports.array(elicitationFieldSchema).max(100).readonly(),
|
|
28381
|
-
interactionId:
|
|
28476
|
+
interactionId: identifierStringSchema,
|
|
28382
28477
|
kind: external_exports.literal(SESSION_ELICITATION_REQUESTED_KIND),
|
|
28383
28478
|
message: external_exports.string().min(1).max(2e3),
|
|
28384
28479
|
mode: external_exports.enum(["form", "url"]),
|
|
28385
|
-
sessionId:
|
|
28480
|
+
sessionId: identifierStringSchema,
|
|
28386
28481
|
url: external_exports.string().max(4096)
|
|
28387
28482
|
}).readonly();
|
|
28388
28483
|
var sessionElicitationRespondCommandSchema = external_exports.strictObject({
|
|
28389
28484
|
action: external_exports.enum(["accept", "cancel", "decline"]),
|
|
28390
28485
|
content: external_exports.string().max(1e5),
|
|
28391
|
-
interactionId:
|
|
28486
|
+
interactionId: identifierStringSchema,
|
|
28392
28487
|
kind: external_exports.literal(SESSION_ELICITATION_RESPOND_KIND),
|
|
28393
|
-
sessionId:
|
|
28488
|
+
sessionId: identifierStringSchema
|
|
28394
28489
|
}).readonly();
|
|
28395
28490
|
var sessionElicitationResolvedEventSchema = external_exports.strictObject({
|
|
28396
28491
|
action: external_exports.enum(["accept", "cancel", "decline", "complete"]),
|
|
28397
|
-
interactionId:
|
|
28492
|
+
interactionId: identifierStringSchema,
|
|
28398
28493
|
kind: external_exports.literal(SESSION_ELICITATION_RESOLVED_KIND),
|
|
28399
|
-
sessionId:
|
|
28494
|
+
sessionId: identifierStringSchema
|
|
28400
28495
|
}).readonly();
|
|
28401
28496
|
var sessionOperationFailedEventSchema = external_exports.strictObject({
|
|
28402
|
-
code:
|
|
28497
|
+
code: identifierStringSchema,
|
|
28403
28498
|
kind: external_exports.literal(SESSION_OPERATION_FAILED_KIND),
|
|
28404
28499
|
message: external_exports.string().min(1).max(500),
|
|
28405
|
-
requestId:
|
|
28500
|
+
requestId: identifierStringSchema,
|
|
28406
28501
|
runtimeTimings: runtimeTimingsSchema.optional(),
|
|
28407
28502
|
sessionId: external_exports.string().max(128)
|
|
28408
28503
|
}).readonly();
|
|
28409
28504
|
var agentContentEventSchema = external_exports.strictObject({
|
|
28410
|
-
commandId:
|
|
28505
|
+
commandId: identifierStringSchema,
|
|
28411
28506
|
content: displayContentSchema,
|
|
28412
|
-
contentId:
|
|
28507
|
+
contentId: identifierStringSchema,
|
|
28413
28508
|
kind: external_exports.literal(AGENT_CONTENT_KIND),
|
|
28414
28509
|
messageId: external_exports.string().max(255),
|
|
28415
|
-
sessionId:
|
|
28510
|
+
sessionId: identifierStringSchema
|
|
28416
28511
|
}).readonly();
|
|
28417
28512
|
var agentInstallIdentityFields = {
|
|
28418
|
-
agentId:
|
|
28419
|
-
requestId:
|
|
28513
|
+
agentId: identifierStringSchema,
|
|
28514
|
+
requestId: identifierStringSchema
|
|
28420
28515
|
};
|
|
28421
28516
|
var agentInstallRequestCommandSchema = external_exports.strictObject({
|
|
28422
28517
|
...agentInstallIdentityFields,
|
|
@@ -28424,7 +28519,7 @@ var agentInstallRequestCommandSchema = external_exports.strictObject({
|
|
|
28424
28519
|
}).readonly();
|
|
28425
28520
|
var agentInstallCancelCommandSchema = external_exports.strictObject({
|
|
28426
28521
|
kind: external_exports.literal(AGENT_INSTALL_CANCEL_KIND),
|
|
28427
|
-
requestId:
|
|
28522
|
+
requestId: identifierStringSchema
|
|
28428
28523
|
}).readonly();
|
|
28429
28524
|
var agentInstallStartedEventSchema = external_exports.strictObject({
|
|
28430
28525
|
...agentInstallIdentityFields,
|
|
@@ -28449,7 +28544,7 @@ var agentInstallCompletedEventSchema = external_exports.strictObject({
|
|
|
28449
28544
|
}).readonly();
|
|
28450
28545
|
var agentInstallFailedEventSchema = external_exports.strictObject({
|
|
28451
28546
|
...agentInstallIdentityFields,
|
|
28452
|
-
code:
|
|
28547
|
+
code: identifierStringSchema,
|
|
28453
28548
|
kind: external_exports.literal(AGENT_INSTALL_FAILED_KIND),
|
|
28454
28549
|
message: external_exports.string().min(1).max(500)
|
|
28455
28550
|
}).readonly();
|
|
@@ -28558,12 +28653,14 @@ var encodeAgentInstallCancelledEvent = (message) => encode3(message, agentInstal
|
|
|
28558
28653
|
|
|
28559
28654
|
// ../protocol/src/messages.ts
|
|
28560
28655
|
var SESSION_PROMPT_KIND = "session.prompt";
|
|
28656
|
+
var SESSION_PROMPT_DISPOSITION_KIND = "session.prompt.disposition";
|
|
28561
28657
|
var RUNTIME_WORKSPACE_BINDING_ID = "workspace";
|
|
28562
28658
|
var SESSION_CANCEL_KIND = "session.cancel";
|
|
28563
28659
|
var RUNTIME_LIVENESS_READY_KIND = "runtime.liveness.ready";
|
|
28564
28660
|
var RUNTIME_HEARTBEAT_KIND = "runtime.heartbeat";
|
|
28565
28661
|
var RUNTIME_HEARTBEAT_ACK_KIND = "runtime.heartbeat.ack";
|
|
28566
28662
|
var SESSION_STARTED_KIND = "session.started";
|
|
28663
|
+
var SESSION_QUEUED_KIND = "session.queued";
|
|
28567
28664
|
var AGENT_MESSAGE_DELTA_KIND = "agent.message.delta";
|
|
28568
28665
|
var AGENT_ACTIVITY_KIND = "agent.activity";
|
|
28569
28666
|
var AGENT_ACTIVITY_NARRATION_KIND = "agent.activity.narration";
|
|
@@ -28581,7 +28678,6 @@ var SessionPromptDisposition = Object.freeze({
|
|
|
28581
28678
|
});
|
|
28582
28679
|
|
|
28583
28680
|
// ../protocol/src/codecs/messages.ts
|
|
28584
|
-
var IDENTIFIER_PATTERN2 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
|
|
28585
28681
|
var DIRECTORY_IDENTIFIER_PATTERN2 = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/;
|
|
28586
28682
|
var MAX_PROMPT_LENGTH = 1e4;
|
|
28587
28683
|
var MAX_PROMPT_ATTACHMENT_LENGTH = 6e6;
|
|
@@ -28762,11 +28858,11 @@ function readActivityDetail(value) {
|
|
|
28762
28858
|
throw new ProtocolMessageError("Invalid activity detail availability");
|
|
28763
28859
|
}
|
|
28764
28860
|
function readIdentifier(value, key) {
|
|
28765
|
-
|
|
28766
|
-
|
|
28767
|
-
|
|
28861
|
+
try {
|
|
28862
|
+
return decodeIdentifier(value[key]);
|
|
28863
|
+
} catch (cause) {
|
|
28864
|
+
throw new ProtocolMessageError(`Invalid identifier field: ${key}`, { cause });
|
|
28768
28865
|
}
|
|
28769
|
-
return field;
|
|
28770
28866
|
}
|
|
28771
28867
|
function readDirectoryIdentifier(value, key) {
|
|
28772
28868
|
const field = readString(value, key, 2048);
|
|
@@ -28815,7 +28911,7 @@ function decodeSessionPromptCommand(encoded) {
|
|
|
28815
28911
|
const disposition = readPromptDisposition(value);
|
|
28816
28912
|
const rawTargetCommandId = value["targetCommandId"];
|
|
28817
28913
|
const targetCommandId = rawTargetCommandId === void 0 ? "" : readText(value, "targetCommandId", 128);
|
|
28818
|
-
if (disposition === SessionPromptDisposition.Reject && targetCommandId.length > 0 || disposition !== SessionPromptDisposition.Reject && !
|
|
28914
|
+
if (disposition === SessionPromptDisposition.Reject && targetCommandId.length > 0 || disposition !== SessionPromptDisposition.Reject && !isIdentifier(targetCommandId)) {
|
|
28819
28915
|
throw new ProtocolMessageError("Prompt disposition has an invalid target command");
|
|
28820
28916
|
}
|
|
28821
28917
|
const sessionConfigurations = hasSessionConfigurations ? decodeSessionConfigurationSelections(value["sessionConfigurations"]) : [];
|
|
@@ -28848,6 +28944,30 @@ function decodeSessionCancelCommand(encoded) {
|
|
|
28848
28944
|
sessionId: readIdentifier(value, "sessionId")
|
|
28849
28945
|
};
|
|
28850
28946
|
}
|
|
28947
|
+
function decodeSessionPromptDispositionCommand(encoded) {
|
|
28948
|
+
const value = parseJson2(encoded);
|
|
28949
|
+
assertExactKeys(value, ["commandId", "disposition", "kind", "sessionId"]);
|
|
28950
|
+
assertKind(value, SESSION_PROMPT_DISPOSITION_KIND);
|
|
28951
|
+
if (readPromptDisposition(value) !== SessionPromptDisposition.Steer) {
|
|
28952
|
+
throw new ProtocolMessageError("Only queued prompts can be steered");
|
|
28953
|
+
}
|
|
28954
|
+
return {
|
|
28955
|
+
commandId: readIdentifier(value, "commandId"),
|
|
28956
|
+
disposition: SessionPromptDisposition.Steer,
|
|
28957
|
+
kind: SESSION_PROMPT_DISPOSITION_KIND,
|
|
28958
|
+
sessionId: readIdentifier(value, "sessionId")
|
|
28959
|
+
};
|
|
28960
|
+
}
|
|
28961
|
+
function decodeSessionQueuedEvent(encoded) {
|
|
28962
|
+
const value = parseJson2(encoded);
|
|
28963
|
+
assertExactKeys(value, ["commandId", "kind", "sessionId"]);
|
|
28964
|
+
assertKind(value, SESSION_QUEUED_KIND);
|
|
28965
|
+
return {
|
|
28966
|
+
commandId: readIdentifier(value, "commandId"),
|
|
28967
|
+
kind: SESSION_QUEUED_KIND,
|
|
28968
|
+
sessionId: readIdentifier(value, "sessionId")
|
|
28969
|
+
};
|
|
28970
|
+
}
|
|
28851
28971
|
function decodeRuntimeLivenessReadyEvent(encoded) {
|
|
28852
28972
|
const value = parseJson2(encoded);
|
|
28853
28973
|
assertExactKeys(value, ["kind"]);
|
|
@@ -28975,6 +29095,12 @@ function encodeSessionPromptCommand(message) {
|
|
|
28975
29095
|
function encodeSessionCancelCommand(message) {
|
|
28976
29096
|
return JSON.stringify(decodeSessionCancelCommand(JSON.stringify(message)));
|
|
28977
29097
|
}
|
|
29098
|
+
function encodeSessionPromptDispositionCommand(message) {
|
|
29099
|
+
return JSON.stringify(decodeSessionPromptDispositionCommand(JSON.stringify(message)));
|
|
29100
|
+
}
|
|
29101
|
+
function encodeSessionQueuedEvent(message) {
|
|
29102
|
+
return JSON.stringify(decodeSessionQueuedEvent(JSON.stringify(message)));
|
|
29103
|
+
}
|
|
28978
29104
|
function encodeRuntimeLivenessReadyEvent(message) {
|
|
28979
29105
|
return JSON.stringify(decodeRuntimeLivenessReadyEvent(JSON.stringify(message)));
|
|
28980
29106
|
}
|
|
@@ -29061,8 +29187,13 @@ var availableSessionHistoryObjectSchema = external_exports.strictObject({
|
|
|
29061
29187
|
status: external_exports.literal("available"),
|
|
29062
29188
|
messages: external_exports.array(historyMessage).max(SESSION_HISTORY_MESSAGE_LIMIT).readonly(),
|
|
29063
29189
|
truncated: external_exports.boolean(),
|
|
29064
|
-
coveredCommandIds: external_exports.array(
|
|
29065
|
-
coveredMessageIds: external_exports.array(
|
|
29190
|
+
coveredCommandIds: external_exports.array(identifierStringSchema).max(1e4).readonly(),
|
|
29191
|
+
coveredMessageIds: external_exports.array(
|
|
29192
|
+
external_exports.string().refine((value) => {
|
|
29193
|
+
const suffix = value.endsWith(":user") ? ":user" : value.endsWith(":agent") ? ":agent" : null;
|
|
29194
|
+
return suffix !== null && isIdentifier(value.slice(0, -suffix.length));
|
|
29195
|
+
})
|
|
29196
|
+
).max(2e4).readonly().default([])
|
|
29066
29197
|
});
|
|
29067
29198
|
var availableSessionHistorySchema = availableSessionHistoryObjectSchema.readonly();
|
|
29068
29199
|
var unavailableSessionHistoryObjectSchema = external_exports.strictObject({
|
|
@@ -29096,70 +29227,69 @@ var NATIVE_SESSION_REQUEST_KIND = "native.session.request";
|
|
|
29096
29227
|
var NATIVE_SESSION_RESULT_KIND = "native.session.result";
|
|
29097
29228
|
var NATIVE_SESSION_CANCEL_KIND = "native.session.cancel";
|
|
29098
29229
|
var ACTIVE_TURN_TEXT_LIMIT = 1e6;
|
|
29099
|
-
var identifier = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/);
|
|
29100
29230
|
var directoryId = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/);
|
|
29101
29231
|
var envelope = {
|
|
29102
|
-
requestId:
|
|
29103
|
-
sessionId:
|
|
29232
|
+
requestId: identifierStringSchema,
|
|
29233
|
+
sessionId: identifierStringSchema
|
|
29104
29234
|
};
|
|
29105
29235
|
var identity = {
|
|
29106
29236
|
...envelope,
|
|
29107
29237
|
kind: external_exports.literal(NATIVE_SESSION_REQUEST_KIND),
|
|
29108
29238
|
additionalDirectoryIds: external_exports.array(directoryId).max(16).readonly(),
|
|
29109
|
-
agentId:
|
|
29110
|
-
bindingId:
|
|
29239
|
+
agentId: identifierStringSchema,
|
|
29240
|
+
bindingId: identifierStringSchema,
|
|
29111
29241
|
directoryId
|
|
29112
29242
|
};
|
|
29113
29243
|
var nativeSessionRequestSchema = external_exports.discriminatedUnion("action", [
|
|
29114
29244
|
external_exports.strictObject({ ...identity, action: external_exports.literal("create") }).readonly(),
|
|
29115
|
-
external_exports.strictObject({ ...identity, action: external_exports.literal("active-turn"), targetSessionId:
|
|
29116
|
-
external_exports.strictObject({ ...identity, action: external_exports.literal("preview"), entryId:
|
|
29117
|
-
external_exports.strictObject({ ...identity, action: external_exports.literal("history"), entryId:
|
|
29118
|
-
external_exports.strictObject({ ...identity, action: external_exports.literal("find"), nativeSessionId:
|
|
29245
|
+
external_exports.strictObject({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifierStringSchema }).readonly(),
|
|
29246
|
+
external_exports.strictObject({ ...identity, action: external_exports.literal("preview"), entryId: identifierStringSchema }).readonly(),
|
|
29247
|
+
external_exports.strictObject({ ...identity, action: external_exports.literal("history"), entryId: identifierStringSchema }).readonly(),
|
|
29248
|
+
external_exports.strictObject({ ...identity, action: external_exports.literal("find"), nativeSessionId: identifierStringSchema }).readonly(),
|
|
29119
29249
|
external_exports.strictObject({
|
|
29120
29250
|
...identity,
|
|
29121
29251
|
action: external_exports.literal("list"),
|
|
29122
|
-
cursor:
|
|
29252
|
+
cursor: identifierStringSchema.nullable()
|
|
29123
29253
|
}).readonly(),
|
|
29124
29254
|
external_exports.strictObject({
|
|
29125
29255
|
...identity,
|
|
29126
29256
|
action: external_exports.enum(["import", "fork"]),
|
|
29127
|
-
entryId:
|
|
29128
|
-
targetSessionId:
|
|
29257
|
+
entryId: identifierStringSchema,
|
|
29258
|
+
targetSessionId: identifierStringSchema
|
|
29129
29259
|
}).readonly(),
|
|
29130
29260
|
external_exports.strictObject({
|
|
29131
29261
|
...identity,
|
|
29132
29262
|
action: external_exports.literal("delete"),
|
|
29133
|
-
entryId:
|
|
29263
|
+
entryId: identifierStringSchema
|
|
29134
29264
|
}).readonly()
|
|
29135
29265
|
]);
|
|
29136
29266
|
var nativeSessionCommandSchema = external_exports.discriminatedUnion("action", [
|
|
29137
29267
|
external_exports.strictObject({ ...identity, action: external_exports.literal("create") }).readonly(),
|
|
29138
|
-
external_exports.strictObject({ ...identity, action: external_exports.literal("active-turn"), targetSessionId:
|
|
29139
|
-
external_exports.strictObject({ ...identity, action: external_exports.literal("preview"), entryId:
|
|
29140
|
-
external_exports.strictObject({ ...identity, action: external_exports.literal("history"), entryId:
|
|
29141
|
-
external_exports.strictObject({ ...identity, action: external_exports.literal("find"), nativeSessionId:
|
|
29268
|
+
external_exports.strictObject({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifierStringSchema }).readonly(),
|
|
29269
|
+
external_exports.strictObject({ ...identity, action: external_exports.literal("preview"), entryId: identifierStringSchema }).readonly(),
|
|
29270
|
+
external_exports.strictObject({ ...identity, action: external_exports.literal("history"), entryId: identifierStringSchema }).readonly(),
|
|
29271
|
+
external_exports.strictObject({ ...identity, action: external_exports.literal("find"), nativeSessionId: identifierStringSchema }).readonly(),
|
|
29142
29272
|
external_exports.strictObject({
|
|
29143
29273
|
...identity,
|
|
29144
29274
|
action: external_exports.literal("list"),
|
|
29145
|
-
cursor:
|
|
29275
|
+
cursor: identifierStringSchema.nullable()
|
|
29146
29276
|
}).readonly(),
|
|
29147
29277
|
external_exports.strictObject({
|
|
29148
29278
|
...identity,
|
|
29149
29279
|
action: external_exports.enum(["import", "fork"]),
|
|
29150
|
-
entryId:
|
|
29151
|
-
targetSessionId:
|
|
29280
|
+
entryId: identifierStringSchema,
|
|
29281
|
+
targetSessionId: identifierStringSchema
|
|
29152
29282
|
}).readonly(),
|
|
29153
29283
|
external_exports.strictObject({
|
|
29154
29284
|
...identity,
|
|
29155
29285
|
action: external_exports.literal("delete"),
|
|
29156
|
-
entryId:
|
|
29286
|
+
entryId: identifierStringSchema
|
|
29157
29287
|
}).readonly()
|
|
29158
29288
|
]);
|
|
29159
29289
|
var nativeSessionEntrySchema = external_exports.strictObject({
|
|
29160
|
-
entryId:
|
|
29161
|
-
mobiusSessionIds: external_exports.array(
|
|
29162
|
-
nativeSessionId:
|
|
29290
|
+
entryId: identifierStringSchema,
|
|
29291
|
+
mobiusSessionIds: external_exports.array(identifierStringSchema).max(500).readonly(),
|
|
29292
|
+
nativeSessionId: identifierStringSchema,
|
|
29163
29293
|
title: external_exports.string().max(500),
|
|
29164
29294
|
directoryId,
|
|
29165
29295
|
directoryLabel: external_exports.string().min(1).max(2048),
|
|
@@ -29171,17 +29301,17 @@ var resultEnvelope = {
|
|
|
29171
29301
|
kind: external_exports.literal(NATIVE_SESSION_RESULT_KIND)
|
|
29172
29302
|
};
|
|
29173
29303
|
var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
|
|
29174
|
-
external_exports.strictObject({ ...resultEnvelope, action: external_exports.literal("create"), nativeSessionId:
|
|
29304
|
+
external_exports.strictObject({ ...resultEnvelope, action: external_exports.literal("create"), nativeSessionId: identifierStringSchema }).readonly(),
|
|
29175
29305
|
external_exports.strictObject({
|
|
29176
29306
|
...resultEnvelope,
|
|
29177
29307
|
action: external_exports.literal("active-turn"),
|
|
29178
|
-
targetSessionId:
|
|
29308
|
+
targetSessionId: identifierStringSchema,
|
|
29179
29309
|
turn: external_exports.strictObject({
|
|
29180
|
-
commandId:
|
|
29310
|
+
commandId: identifierStringSchema,
|
|
29181
29311
|
prompt: external_exports.string().max(1e5),
|
|
29182
29312
|
text: external_exports.string().max(ACTIVE_TURN_TEXT_LIMIT),
|
|
29183
29313
|
truncated: external_exports.boolean(),
|
|
29184
|
-
epoch:
|
|
29314
|
+
epoch: identifierStringSchema,
|
|
29185
29315
|
interaction: external_exports.discriminatedUnion("kind", [
|
|
29186
29316
|
sessionPermissionRequestedEventSchema,
|
|
29187
29317
|
sessionElicitationRequestedEventSchema
|
|
@@ -29200,20 +29330,20 @@ var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
|
|
|
29200
29330
|
action: external_exports.literal("list"),
|
|
29201
29331
|
capabilities: sessionCapabilitiesSchema,
|
|
29202
29332
|
entries: external_exports.array(nativeSessionEntrySchema).max(500).readonly(),
|
|
29203
|
-
nextCursor:
|
|
29333
|
+
nextCursor: identifierStringSchema.nullable()
|
|
29204
29334
|
}).readonly(),
|
|
29205
29335
|
external_exports.strictObject({
|
|
29206
29336
|
...resultEnvelope,
|
|
29207
29337
|
action: external_exports.enum(["import", "fork"]),
|
|
29208
|
-
targetSessionId:
|
|
29338
|
+
targetSessionId: identifierStringSchema,
|
|
29209
29339
|
ready: sessionReadyEventSchema,
|
|
29210
29340
|
title: external_exports.string().max(500)
|
|
29211
29341
|
}).readonly(),
|
|
29212
29342
|
external_exports.strictObject({
|
|
29213
29343
|
...resultEnvelope,
|
|
29214
29344
|
action: external_exports.literal("preview"),
|
|
29215
|
-
entryId:
|
|
29216
|
-
targetSessionId:
|
|
29345
|
+
entryId: identifierStringSchema,
|
|
29346
|
+
targetSessionId: identifierStringSchema,
|
|
29217
29347
|
reason: external_exports.enum(["continuation_unavailable", "requested"]),
|
|
29218
29348
|
history: sessionHistorySchema,
|
|
29219
29349
|
title: external_exports.string().max(500)
|
|
@@ -29221,15 +29351,15 @@ var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
|
|
|
29221
29351
|
external_exports.strictObject({
|
|
29222
29352
|
...resultEnvelope,
|
|
29223
29353
|
action: external_exports.literal("history"),
|
|
29224
|
-
entryId:
|
|
29354
|
+
entryId: identifierStringSchema,
|
|
29225
29355
|
history: sessionHistorySchema,
|
|
29226
29356
|
title: external_exports.string().max(500)
|
|
29227
29357
|
}).readonly(),
|
|
29228
29358
|
external_exports.strictObject({
|
|
29229
29359
|
...resultEnvelope,
|
|
29230
29360
|
action: external_exports.literal("delete"),
|
|
29231
|
-
entryId:
|
|
29232
|
-
deletedSessionIds: external_exports.array(
|
|
29361
|
+
entryId: identifierStringSchema,
|
|
29362
|
+
deletedSessionIds: external_exports.array(identifierStringSchema).max(500).readonly()
|
|
29233
29363
|
}).readonly()
|
|
29234
29364
|
]);
|
|
29235
29365
|
var nativeSessionCancelSchema = external_exports.strictObject({ ...envelope, kind: external_exports.literal(NATIVE_SESSION_CANCEL_KIND) }).readonly();
|
|
@@ -29251,17 +29381,16 @@ var encodeNativeSessionCancel = (value) => JSON.stringify(nativeSessionCancelSch
|
|
|
29251
29381
|
// ../protocol/src/session-events.ts
|
|
29252
29382
|
var SESSION_EVENT_KIND = "session.event";
|
|
29253
29383
|
var SESSION_EVENT_COMMITTED_KIND = "session.event.committed";
|
|
29254
|
-
var IDENTIFIER_PATTERN3 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
|
|
29255
29384
|
var MAX_RECORDED_EVENT_LENGTH = 8 * 1024 * 1024;
|
|
29256
29385
|
var eventEnvelopeSchema = external_exports.strictObject({
|
|
29257
29386
|
kind: external_exports.literal(SESSION_EVENT_KIND),
|
|
29258
29387
|
payload: external_exports.string().min(2).max(MAX_RECORDED_EVENT_LENGTH),
|
|
29259
|
-
sessionId:
|
|
29388
|
+
sessionId: identifierStringSchema
|
|
29260
29389
|
}).readonly();
|
|
29261
29390
|
var committedEventSchema = external_exports.strictObject({
|
|
29262
29391
|
kind: external_exports.literal(SESSION_EVENT_COMMITTED_KIND),
|
|
29263
29392
|
payload: external_exports.string().min(2).max(MAX_RECORDED_EVENT_LENGTH),
|
|
29264
|
-
sessionId:
|
|
29393
|
+
sessionId: identifierStringSchema
|
|
29265
29394
|
}).readonly();
|
|
29266
29395
|
function decode5(encoded, schema) {
|
|
29267
29396
|
let value;
|
|
@@ -29335,39 +29464,38 @@ var SESSION_LIVE_HISTORY_LOAD_KIND = "session.live-history.load";
|
|
|
29335
29464
|
var SESSION_LIVE_HISTORY_LOADED_KIND = "session.live-history.loaded";
|
|
29336
29465
|
var SESSION_LIVE_HISTORY_PAGE_LOAD_KIND = "session.live-history.page.load";
|
|
29337
29466
|
var SESSION_LIVE_HISTORY_PAGE_LOADED_KIND = "session.live-history.page.loaded";
|
|
29338
|
-
var identifier2 = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/);
|
|
29339
29467
|
var directoryIdentifier = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/);
|
|
29340
29468
|
var sessionLiveHistoryLoadSchema = external_exports.strictObject({
|
|
29341
29469
|
additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
|
|
29342
|
-
agentId:
|
|
29343
|
-
bindingId:
|
|
29470
|
+
agentId: identifierStringSchema,
|
|
29471
|
+
bindingId: identifierStringSchema,
|
|
29344
29472
|
directoryId: directoryIdentifier,
|
|
29345
29473
|
kind: external_exports.literal(SESSION_LIVE_HISTORY_LOAD_KIND),
|
|
29346
|
-
requestId:
|
|
29347
|
-
sessionId:
|
|
29474
|
+
requestId: identifierStringSchema,
|
|
29475
|
+
sessionId: identifierStringSchema
|
|
29348
29476
|
}).readonly();
|
|
29349
29477
|
var sessionLiveHistoryLoadedSchema = external_exports.strictObject({
|
|
29350
29478
|
history: sessionHistorySchema,
|
|
29351
29479
|
kind: external_exports.literal(SESSION_LIVE_HISTORY_LOADED_KIND),
|
|
29352
|
-
requestId:
|
|
29353
|
-
sessionId:
|
|
29480
|
+
requestId: identifierStringSchema,
|
|
29481
|
+
sessionId: identifierStringSchema
|
|
29354
29482
|
}).readonly();
|
|
29355
29483
|
var sessionLiveHistoryPageLoadSchema = external_exports.strictObject({
|
|
29356
29484
|
additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
|
|
29357
|
-
agentId:
|
|
29358
|
-
bindingId:
|
|
29485
|
+
agentId: identifierStringSchema,
|
|
29486
|
+
bindingId: identifierStringSchema,
|
|
29359
29487
|
cursor: external_exports.string().min(1).max(512).nullable(),
|
|
29360
29488
|
directoryId: directoryIdentifier,
|
|
29361
29489
|
kind: external_exports.literal(SESSION_LIVE_HISTORY_PAGE_LOAD_KIND),
|
|
29362
29490
|
limit: external_exports.number().int().min(1).max(100),
|
|
29363
|
-
requestId:
|
|
29364
|
-
sessionId:
|
|
29491
|
+
requestId: identifierStringSchema,
|
|
29492
|
+
sessionId: identifierStringSchema
|
|
29365
29493
|
}).readonly();
|
|
29366
29494
|
var sessionLiveHistoryPageLoadedSchema = external_exports.strictObject({
|
|
29367
29495
|
kind: external_exports.literal(SESSION_LIVE_HISTORY_PAGE_LOADED_KIND),
|
|
29368
29496
|
page: nativeMessagePageSchema,
|
|
29369
|
-
requestId:
|
|
29370
|
-
sessionId:
|
|
29497
|
+
requestId: identifierStringSchema,
|
|
29498
|
+
sessionId: identifierStringSchema
|
|
29371
29499
|
}).readonly();
|
|
29372
29500
|
function decode6(schema, encoded) {
|
|
29373
29501
|
try {
|
|
@@ -29483,6 +29611,11 @@ var serviceToDaemonSignatures = {
|
|
|
29483
29611
|
encodeSessionPromptCommand,
|
|
29484
29612
|
decodeSessionPromptCommand
|
|
29485
29613
|
),
|
|
29614
|
+
[SESSION_PROMPT_DISPOSITION_KIND]: defineMessageSignature(
|
|
29615
|
+
SESSION_PROMPT_DISPOSITION_KIND,
|
|
29616
|
+
encodeSessionPromptDispositionCommand,
|
|
29617
|
+
decodeSessionPromptDispositionCommand
|
|
29618
|
+
),
|
|
29486
29619
|
[WORKSPACE_LIST_KIND]: defineMessageSignature(
|
|
29487
29620
|
WORKSPACE_LIST_KIND,
|
|
29488
29621
|
encodeWorkspaceListCommand,
|
|
@@ -29553,6 +29686,11 @@ var daemonToServiceSignatures = {
|
|
|
29553
29686
|
encodeSessionsQueriedEvent,
|
|
29554
29687
|
decodeSessionsQueriedEvent
|
|
29555
29688
|
),
|
|
29689
|
+
[SESSION_QUEUED_KIND]: defineMessageSignature(
|
|
29690
|
+
SESSION_QUEUED_KIND,
|
|
29691
|
+
encodeSessionQueuedEvent,
|
|
29692
|
+
decodeSessionQueuedEvent
|
|
29693
|
+
),
|
|
29556
29694
|
[NATIVE_SESSION_RESULT_KIND]: defineMessageSignature(
|
|
29557
29695
|
NATIVE_SESSION_RESULT_KIND,
|
|
29558
29696
|
encodeNativeSessionResult,
|
|
@@ -29686,7 +29824,6 @@ import { dirname as dirname3, join as join15, resolve as resolve4 } from "node:p
|
|
|
29686
29824
|
var APPLICATION_ID_PATTERN = /^[a-z][a-z0-9]*(?:[.-][a-z0-9]+){1,31}$/;
|
|
29687
29825
|
var CONNECTION_ID_PATTERN = /^mcn_[a-f0-9]{32}$/;
|
|
29688
29826
|
var INSTALLATION_ID_PATTERN = /^min_[a-f0-9]{32}$/;
|
|
29689
|
-
var IDENTIFIER_PATTERN4 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
|
|
29690
29827
|
var RUNTIME_CREDENTIAL_PATTERN = /^[a-zA-Z0-9_-]{32,256}$/;
|
|
29691
29828
|
var MAX_FILE_LENGTH = 16 * 1024;
|
|
29692
29829
|
var INSTALLATION_POINTER_KEYS = ["installationId", "version"];
|
|
@@ -29764,7 +29901,7 @@ function validateApplicationId(value) {
|
|
|
29764
29901
|
return value;
|
|
29765
29902
|
}
|
|
29766
29903
|
function validateRemoteAppId(value) {
|
|
29767
|
-
if (!
|
|
29904
|
+
if (!isIdentifier(value)) {
|
|
29768
29905
|
throw new RuntimeInstallationStoreError("invalid_app_id", "The remote App ID is invalid");
|
|
29769
29906
|
}
|
|
29770
29907
|
return value;
|
|
@@ -29782,7 +29919,7 @@ function validateInstallationId(value) {
|
|
|
29782
29919
|
return value;
|
|
29783
29920
|
}
|
|
29784
29921
|
function validateIdentifier(value, code) {
|
|
29785
|
-
if (!
|
|
29922
|
+
if (!isIdentifier(value)) {
|
|
29786
29923
|
throw new RuntimeInstallationStoreError(code, "The saved Runtime connection is invalid");
|
|
29787
29924
|
}
|
|
29788
29925
|
return value;
|
|
@@ -30186,7 +30323,6 @@ async function openRuntimeInstallationStore(options, signal) {
|
|
|
30186
30323
|
// src/pairing/pair-local-machine.ts
|
|
30187
30324
|
var PAIRING_TIMEOUT_MILLISECONDS = 2e4;
|
|
30188
30325
|
var PAIRING_CODE_PATTERN = /^[A-HJ-NP-Z2-9]{4}(?:-[A-HJ-NP-Z2-9]{4}){4}$/;
|
|
30189
|
-
var IDENTIFIER_PATTERN5 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
|
|
30190
30326
|
var TOKEN_PATTERN = /^[a-zA-Z0-9_-]{32,256}$/;
|
|
30191
30327
|
var CLAIM_RESPONSE_KEYS = ["appId", "channelId", "daemonToken", "runtimeId"];
|
|
30192
30328
|
var REDEEM_RESPONSE_KEYS = ["appId", "channelId", "runtimeCredential", "runtimeId"];
|
|
@@ -30273,7 +30409,7 @@ function parsePairCommand(arguments_, defaultWorkspace) {
|
|
|
30273
30409
|
};
|
|
30274
30410
|
}
|
|
30275
30411
|
function validatePairingId(value) {
|
|
30276
|
-
if (!
|
|
30412
|
+
if (!isIdentifier(value)) {
|
|
30277
30413
|
throw new PairingClientError("invalid_pairing_id", "The Runtime pairing ID is invalid");
|
|
30278
30414
|
}
|
|
30279
30415
|
return value;
|
|
@@ -30342,7 +30478,7 @@ function decodePairingResponse(value, credentialField, expectedKeys) {
|
|
|
30342
30478
|
const channelId = value["channelId"];
|
|
30343
30479
|
const runtimeCredential2 = value[credentialField];
|
|
30344
30480
|
const runtimeId = value["runtimeId"];
|
|
30345
|
-
if (typeof appId !== "string" || !
|
|
30481
|
+
if (typeof appId !== "string" || !isIdentifier(appId) || typeof channelId !== "string" || !isIdentifier(channelId) || typeof runtimeCredential2 !== "string" || !TOKEN_PATTERN.test(runtimeCredential2) || typeof runtimeId !== "string" || !isIdentifier(runtimeId)) {
|
|
30346
30482
|
throw new PairingClientError("invalid_relay_response", "The relay returned an invalid pairing response");
|
|
30347
30483
|
}
|
|
30348
30484
|
return { appId, channelId, runtimeCredential: runtimeCredential2, runtimeId };
|
|
@@ -35246,7 +35382,6 @@ var ARTIFACT_SCHEME = "mobius-artifact:";
|
|
|
35246
35382
|
var ARTIFACT_DOWNLOAD_TIMEOUT_MILLISECONDS = 2e4;
|
|
35247
35383
|
var MAX_AGENT_IMAGE_BASE64_LENGTH = 4e6;
|
|
35248
35384
|
var MAX_AGENT_RESOURCE_BYTE_LENGTH = 1e6;
|
|
35249
|
-
var IDENTIFIER_PATTERN6 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
|
|
35250
35385
|
var PromptArtifactError = class extends Error {
|
|
35251
35386
|
code;
|
|
35252
35387
|
constructor(code, message, options = {}) {
|
|
@@ -35289,7 +35424,7 @@ function parseReference(resource) {
|
|
|
35289
35424
|
const encodedByteLength2 = url2.searchParams.get("byteLength") ?? "";
|
|
35290
35425
|
const sha256 = url2.searchParams.get("sha256") ?? "";
|
|
35291
35426
|
const byteLength = Number(encodedByteLength2);
|
|
35292
|
-
if (url2.protocol !== ARTIFACT_SCHEME || url2.hash.length > 0 || resource.type !== "link" || resource.text.length > 0 || !
|
|
35427
|
+
if (url2.protocol !== ARTIFACT_SCHEME || url2.hash.length > 0 || resource.type !== "link" || resource.text.length > 0 || !isIdentifier(artifactId) || keys.length !== 2 || keys[0] !== "byteLength" || keys[1] !== "sha256" || !/^[1-9][0-9]*$/.test(encodedByteLength2) || !Number.isSafeInteger(byteLength) || !/^[a-f0-9]{64}$/.test(sha256)) {
|
|
35293
35428
|
throw new PromptArtifactError("artifact_reference_invalid", "The prompt artifact reference is invalid");
|
|
35294
35429
|
}
|
|
35295
35430
|
return new PromptArtifactReference(artifactId, byteLength, sha256, resource);
|
|
@@ -35992,7 +36127,7 @@ async function executeSessionConfigure(publisher, socket, command, config2, dire
|
|
|
35992
36127
|
reportOperationFailure(socket, command.requestId, command.sessionId, error62);
|
|
35993
36128
|
}
|
|
35994
36129
|
}
|
|
35995
|
-
async function executePrompt(operations, publisher, command, config2, directories, audit, sessions, attemptId, activateAttempt, waitForSessionAvailability, timer, signal, recordLiveText, cancellationRequested) {
|
|
36130
|
+
async function executePrompt(operations, publisher, command, config2, directories, audit, sessions, attemptId, activateAttempt, acknowledgeQueued, waitForSessionAvailability, timer, signal, recordLiveText, cancellationRequested) {
|
|
35996
36131
|
const activities = new CoalescingDaemonActivityPublisher(timer, (activity2) => {
|
|
35997
36132
|
publisher.publish(command.sessionId, daemonActivity(command, activity2));
|
|
35998
36133
|
});
|
|
@@ -36030,6 +36165,9 @@ async function executePrompt(operations, publisher, command, config2, directorie
|
|
|
36030
36165
|
AGENT_TEXT_MAXIMUM_LENGTH
|
|
36031
36166
|
);
|
|
36032
36167
|
try {
|
|
36168
|
+
if (command.disposition === SessionPromptDisposition.Queue) {
|
|
36169
|
+
acknowledgeQueued();
|
|
36170
|
+
}
|
|
36033
36171
|
const resolved = await resolveSessionDirectories(
|
|
36034
36172
|
directories,
|
|
36035
36173
|
command.bindingId,
|
|
@@ -36039,10 +36177,10 @@ async function executePrompt(operations, publisher, command, config2, directorie
|
|
|
36039
36177
|
);
|
|
36040
36178
|
const agent = config2.catalog.find(command.agentId);
|
|
36041
36179
|
const availability = await waitForSessionAvailability(signal);
|
|
36042
|
-
if (availability === "busy") {
|
|
36180
|
+
if (availability.kind === "busy") {
|
|
36043
36181
|
throw new AcpExecutionError("Another prompt is already running in this conversation", {}, "session_busy");
|
|
36044
36182
|
}
|
|
36045
|
-
if (availability === "queue-target-unavailable") {
|
|
36183
|
+
if (availability.kind === "queue-target-unavailable") {
|
|
36046
36184
|
throw new AcpExecutionError(
|
|
36047
36185
|
"The queued prompt target is unavailable",
|
|
36048
36186
|
{},
|
|
@@ -36060,7 +36198,7 @@ async function executePrompt(operations, publisher, command, config2, directorie
|
|
|
36060
36198
|
sessionId: command.sessionId,
|
|
36061
36199
|
signal
|
|
36062
36200
|
});
|
|
36063
|
-
if (
|
|
36201
|
+
if (availability.disposition === SessionPromptDisposition.Steer) {
|
|
36064
36202
|
assertAppliedSessionConfiguration(prepared.configOptions, sessionConfigurations ?? []);
|
|
36065
36203
|
} else {
|
|
36066
36204
|
await applyCompleteSessionConfiguration(
|
|
@@ -36095,7 +36233,7 @@ async function executePrompt(operations, publisher, command, config2, directorie
|
|
|
36095
36233
|
});
|
|
36096
36234
|
const attachments = await resolvePromptArtifacts(config2, command, signal);
|
|
36097
36235
|
let stopReason;
|
|
36098
|
-
if (
|
|
36236
|
+
if (availability.disposition === SessionPromptDisposition.Steer) {
|
|
36099
36237
|
await sessions.steerPrompt({
|
|
36100
36238
|
additionalDirectories: resolved.additionalDirectories,
|
|
36101
36239
|
agent: executionAgent,
|
|
@@ -36115,7 +36253,7 @@ async function executePrompt(operations, publisher, command, config2, directorie
|
|
|
36115
36253
|
agent: executionAgent,
|
|
36116
36254
|
commandId: command.commandId,
|
|
36117
36255
|
cwd: resolved.cwd,
|
|
36118
|
-
disposition:
|
|
36256
|
+
disposition: availability.disposition,
|
|
36119
36257
|
images: attachments.images,
|
|
36120
36258
|
onActivity: activities.record,
|
|
36121
36259
|
onNarration: (increment) => {
|
|
@@ -37682,25 +37820,42 @@ var ActiveDaemonTurn = class {
|
|
|
37682
37820
|
#controller;
|
|
37683
37821
|
#finished = Promise.withResolvers();
|
|
37684
37822
|
#cancellationRequested = false;
|
|
37685
|
-
#
|
|
37823
|
+
#dispatch;
|
|
37686
37824
|
#text = "";
|
|
37687
37825
|
#truncated = false;
|
|
37688
37826
|
#sequence = 0;
|
|
37689
37827
|
#interaction = null;
|
|
37690
|
-
#epoch = randomUUID3();
|
|
37828
|
+
#epoch = decodeIdentifier(randomUUID3());
|
|
37691
37829
|
constructor(command, attemptId) {
|
|
37692
37830
|
this.attemptId = attemptId;
|
|
37693
37831
|
this.command = command;
|
|
37694
37832
|
this.#controller = new AbortController();
|
|
37833
|
+
this.#dispatch = command.disposition === SessionPromptDisposition.Queue ? { kind: "queued", promotion: Promise.withResolvers() } : { kind: "pending" };
|
|
37695
37834
|
}
|
|
37696
37835
|
abortDaemon = () => {
|
|
37697
37836
|
this.#controller.abort();
|
|
37698
37837
|
};
|
|
37699
37838
|
finish = () => this.#finished.resolve();
|
|
37700
37839
|
accept = () => {
|
|
37701
|
-
this.#
|
|
37840
|
+
this.#dispatch = { kind: "accepted" };
|
|
37702
37841
|
return { epoch: this.#epoch, sequence: 0 };
|
|
37703
37842
|
};
|
|
37843
|
+
promoteQueuedPrompt = (command) => {
|
|
37844
|
+
if (command.commandId !== this.command.commandId || command.sessionId !== this.command.sessionId || this.#dispatch.kind !== "queued") {
|
|
37845
|
+
return false;
|
|
37846
|
+
}
|
|
37847
|
+
const promotion = this.#dispatch.promotion;
|
|
37848
|
+
this.#dispatch = { kind: "promoted" };
|
|
37849
|
+
promotion.resolve();
|
|
37850
|
+
return true;
|
|
37851
|
+
};
|
|
37852
|
+
queuePromotion = () => {
|
|
37853
|
+
if (this.#dispatch.kind === "queued") {
|
|
37854
|
+
return this.#dispatch.promotion.promise;
|
|
37855
|
+
}
|
|
37856
|
+
return this.#dispatch.kind === "promoted" ? Promise.resolve() : null;
|
|
37857
|
+
};
|
|
37858
|
+
effectiveDisposition = () => this.#dispatch.kind === "promoted" ? SessionPromptDisposition.Steer : this.command.disposition;
|
|
37704
37859
|
recordText = (delta) => {
|
|
37705
37860
|
this.#sequence += 1;
|
|
37706
37861
|
this.#text += delta;
|
|
@@ -37722,8 +37877,8 @@ var ActiveDaemonTurn = class {
|
|
|
37722
37877
|
this.#interaction = null;
|
|
37723
37878
|
}
|
|
37724
37879
|
};
|
|
37725
|
-
snapshot = () => this.#accepted ? {
|
|
37726
|
-
commandId: this.command.commandId,
|
|
37880
|
+
snapshot = () => this.#dispatch.kind === "accepted" ? {
|
|
37881
|
+
commandId: decodeIdentifier(this.command.commandId),
|
|
37727
37882
|
prompt: this.command.prompt,
|
|
37728
37883
|
text: this.#text,
|
|
37729
37884
|
truncated: this.#truncated,
|
|
@@ -37738,7 +37893,7 @@ var ActiveDaemonTurn = class {
|
|
|
37738
37893
|
return "already-requested";
|
|
37739
37894
|
}
|
|
37740
37895
|
this.#cancellationRequested = true;
|
|
37741
|
-
if (
|
|
37896
|
+
if (this.#dispatch.kind !== "accepted") {
|
|
37742
37897
|
this.#controller.abort(new Error("The queued Agent turn was cancelled"));
|
|
37743
37898
|
return "pending";
|
|
37744
37899
|
}
|
|
@@ -38493,7 +38648,7 @@ var NativeSessionService = class {
|
|
|
38493
38648
|
return {
|
|
38494
38649
|
action: "create",
|
|
38495
38650
|
kind: "native.session.result",
|
|
38496
|
-
nativeSessionId,
|
|
38651
|
+
nativeSessionId: decodeIdentifier(nativeSessionId),
|
|
38497
38652
|
requestId: command.requestId,
|
|
38498
38653
|
sessionId: command.sessionId
|
|
38499
38654
|
};
|
|
@@ -38513,7 +38668,7 @@ var NativeSessionService = class {
|
|
|
38513
38668
|
if (authorized === null) {
|
|
38514
38669
|
return null;
|
|
38515
38670
|
}
|
|
38516
|
-
const entryId = randomUUID4();
|
|
38671
|
+
const entryId = decodeIdentifier(randomUUID4());
|
|
38517
38672
|
if (this.#entries.size >= 5e3) {
|
|
38518
38673
|
this.#entries.clear();
|
|
38519
38674
|
}
|
|
@@ -38525,8 +38680,8 @@ var NativeSessionService = class {
|
|
|
38525
38680
|
});
|
|
38526
38681
|
return {
|
|
38527
38682
|
entryId,
|
|
38528
|
-
mobiusSessionIds: this.#sessions.findLinkedSessions(command.agentId, info.sessionId).filter((session) => session.prompted && session.cwd === authorized.cwd).map((session) => session.sessionId),
|
|
38529
|
-
nativeSessionId: info.sessionId,
|
|
38683
|
+
mobiusSessionIds: this.#sessions.findLinkedSessions(command.agentId, info.sessionId).filter((session) => session.prompted && session.cwd === authorized.cwd).map((session) => decodeIdentifier(session.sessionId)),
|
|
38684
|
+
nativeSessionId: decodeIdentifier(info.sessionId),
|
|
38530
38685
|
title: info.title ?? "Untitled session",
|
|
38531
38686
|
directoryId: authorized.directoryId,
|
|
38532
38687
|
directoryLabel: authorized.directoryLabel,
|
|
@@ -38569,7 +38724,7 @@ var NativeSessionService = class {
|
|
|
38569
38724
|
"invalid_native_session_response"
|
|
38570
38725
|
);
|
|
38571
38726
|
}
|
|
38572
|
-
nextCursor = randomUUID4();
|
|
38727
|
+
nextCursor = decodeIdentifier(randomUUID4());
|
|
38573
38728
|
if (this.#cursors.size >= 500) {
|
|
38574
38729
|
this.#cursors.clear();
|
|
38575
38730
|
}
|
|
@@ -38686,7 +38841,7 @@ var NativeSessionService = class {
|
|
|
38686
38841
|
...envelope2,
|
|
38687
38842
|
action: "delete",
|
|
38688
38843
|
entryId: command.entryId,
|
|
38689
|
-
deletedSessionIds
|
|
38844
|
+
deletedSessionIds: deletedSessionIds.map(decodeIdentifier)
|
|
38690
38845
|
};
|
|
38691
38846
|
}
|
|
38692
38847
|
const action = command.action;
|
|
@@ -39542,24 +39697,34 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
39542
39697
|
);
|
|
39543
39698
|
});
|
|
39544
39699
|
};
|
|
39545
|
-
const waitForSessionAvailability = async (command, waitSignal) => {
|
|
39546
|
-
if (
|
|
39547
|
-
return "available";
|
|
39700
|
+
const waitForSessionAvailability = async (command, queuedTurn, waitSignal) => {
|
|
39701
|
+
if (queuedTurn.effectiveDisposition() === SessionPromptDisposition.Steer) {
|
|
39702
|
+
return { disposition: SessionPromptDisposition.Steer, kind: "available" };
|
|
39548
39703
|
}
|
|
39549
39704
|
for (; ; ) {
|
|
39550
39705
|
const first = [...activeTurns.values()].find(
|
|
39551
39706
|
(turn) => turn.command.sessionId === command.sessionId && turn.command.disposition !== SessionPromptDisposition.Steer
|
|
39552
39707
|
);
|
|
39553
39708
|
if (first === void 0 || first.command.commandId === command.commandId) {
|
|
39554
|
-
return command.disposition !== SessionPromptDisposition.Queue || operations.isTerminalExecution(command.targetCommandId, command.sessionId) ? "available" : "queue-target-unavailable";
|
|
39709
|
+
return command.disposition !== SessionPromptDisposition.Queue || operations.isTerminalExecution(command.targetCommandId, command.sessionId) ? { disposition: queuedTurn.effectiveDisposition(), kind: "available" } : { kind: "queue-target-unavailable" };
|
|
39555
39710
|
}
|
|
39556
39711
|
if (command.disposition !== SessionPromptDisposition.Queue) {
|
|
39557
|
-
return "busy";
|
|
39712
|
+
return { kind: "busy" };
|
|
39558
39713
|
}
|
|
39559
39714
|
if (first.command.commandId !== command.targetCommandId) {
|
|
39560
|
-
return "queue-target-unavailable";
|
|
39715
|
+
return { kind: "queue-target-unavailable" };
|
|
39716
|
+
}
|
|
39717
|
+
const promotion = queuedTurn.queuePromotion();
|
|
39718
|
+
if (promotion === null) {
|
|
39719
|
+
throw new Error("The queued prompt cannot be promoted");
|
|
39720
|
+
}
|
|
39721
|
+
const decision = await Promise.race([
|
|
39722
|
+
waitForTurnCompletion(first, waitSignal).then(() => "target-completed"),
|
|
39723
|
+
promotion.then(() => "promoted")
|
|
39724
|
+
]);
|
|
39725
|
+
if (decision === "promoted") {
|
|
39726
|
+
return { disposition: SessionPromptDisposition.Steer, kind: "available" };
|
|
39561
39727
|
}
|
|
39562
|
-
await waitForTurnCompletion(first, waitSignal);
|
|
39563
39728
|
}
|
|
39564
39729
|
};
|
|
39565
39730
|
const connectionLiveness = new RelayConnectionLiveness(timer, {
|
|
@@ -39712,6 +39877,19 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
39712
39877
|
});
|
|
39713
39878
|
return;
|
|
39714
39879
|
}
|
|
39880
|
+
if (kind === SESSION_PROMPT_DISPOSITION_KIND) {
|
|
39881
|
+
const disposition = message;
|
|
39882
|
+
const turn2 = activeTurns.get(disposition.commandId);
|
|
39883
|
+
if (turn2 === void 0 || !turn2.promoteQueuedPrompt(disposition)) {
|
|
39884
|
+
reportOperationFailure(
|
|
39885
|
+
socket,
|
|
39886
|
+
disposition.commandId,
|
|
39887
|
+
disposition.sessionId,
|
|
39888
|
+
new Error("The queued prompt is unavailable")
|
|
39889
|
+
);
|
|
39890
|
+
}
|
|
39891
|
+
return;
|
|
39892
|
+
}
|
|
39715
39893
|
if (kind === WORKSPACE_LIST_KIND) {
|
|
39716
39894
|
const command2 = message;
|
|
39717
39895
|
void executeWorkspaceList(socket, command2, directories, audit, connectionController.signal);
|
|
@@ -39821,7 +39999,12 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
39821
39999
|
sessions,
|
|
39822
40000
|
receipt.attemptId,
|
|
39823
40001
|
turn.accept,
|
|
39824
|
-
(
|
|
40002
|
+
() => send(socket, {
|
|
40003
|
+
commandId: command.commandId,
|
|
40004
|
+
kind: SESSION_QUEUED_KIND,
|
|
40005
|
+
sessionId: command.sessionId
|
|
40006
|
+
}),
|
|
40007
|
+
(waitSignal) => waitForSessionAvailability(command, turn, waitSignal),
|
|
39825
40008
|
timer,
|
|
39826
40009
|
turn.signal,
|
|
39827
40010
|
turn.recordText,
|