@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/index.js
CHANGED
|
@@ -19702,6 +19702,17 @@ function date4(params) {
|
|
|
19702
19702
|
return _coercedDate(ZodDate, params);
|
|
19703
19703
|
}
|
|
19704
19704
|
|
|
19705
|
+
// ../protocol/src/identifier.ts
|
|
19706
|
+
var IDENTIFIER_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
|
|
19707
|
+
var identifierStringSchema = external_exports.string().min(1).max(128).regex(IDENTIFIER_PATTERN);
|
|
19708
|
+
var identifierSchema = identifierStringSchema.brand();
|
|
19709
|
+
function isIdentifier(value) {
|
|
19710
|
+
return identifierSchema.safeParse(value).success;
|
|
19711
|
+
}
|
|
19712
|
+
function decodeIdentifier(value) {
|
|
19713
|
+
return identifierSchema.parse(value);
|
|
19714
|
+
}
|
|
19715
|
+
|
|
19705
19716
|
// ../protocol/src/prompt-usage.ts
|
|
19706
19717
|
var TOKEN_COUNT = external_exports.number().int().nonnegative();
|
|
19707
19718
|
function normalizeQuotaTokenCount(value) {
|
|
@@ -19809,9 +19820,7 @@ var FILE_BEGIN_KIND = "file.begin";
|
|
|
19809
19820
|
var FILE_CHUNK_KIND = "file.chunk";
|
|
19810
19821
|
var FILE_END_KIND = "file.end";
|
|
19811
19822
|
var FILE_FAILED_KIND = "file.failed";
|
|
19812
|
-
var IDENTIFIER_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
|
|
19813
19823
|
var DIRECTORY_IDENTIFIER_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/;
|
|
19814
|
-
var IDENTIFIER = external_exports.string().min(1).max(128).regex(IDENTIFIER_PATTERN);
|
|
19815
19824
|
var DIRECTORY_IDENTIFIER = external_exports.string().min(1).max(2048).regex(DIRECTORY_IDENTIFIER_PATTERN);
|
|
19816
19825
|
var SHORT_TEXT = external_exports.string().max(500);
|
|
19817
19826
|
var LONG_TEXT = external_exports.string().max(1e5);
|
|
@@ -19821,29 +19830,29 @@ var workspaceEntrySchema = external_exports.strictObject({
|
|
|
19821
19830
|
}).readonly();
|
|
19822
19831
|
var sessionMetadataSchema = external_exports.strictObject({
|
|
19823
19832
|
additionalDirectories: external_exports.array(workspaceEntrySchema).max(16).readonly(),
|
|
19824
|
-
agentId:
|
|
19833
|
+
agentId: identifierStringSchema,
|
|
19825
19834
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
19826
19835
|
directoryLabel: external_exports.string().min(1).max(2048),
|
|
19827
19836
|
prompted: external_exports.boolean(),
|
|
19828
|
-
sessionId:
|
|
19837
|
+
sessionId: identifierStringSchema,
|
|
19829
19838
|
title: external_exports.string().max(500),
|
|
19830
19839
|
updatedAt: external_exports.iso.datetime({ offset: true })
|
|
19831
19840
|
}).readonly();
|
|
19832
19841
|
var sessionQueryCommandSchema = external_exports.strictObject({
|
|
19833
19842
|
kind: external_exports.literal(SESSION_QUERY_KIND),
|
|
19834
|
-
requestId:
|
|
19835
|
-
sessionIds: external_exports.array(
|
|
19843
|
+
requestId: identifierStringSchema,
|
|
19844
|
+
sessionIds: external_exports.array(identifierStringSchema).min(1).max(500).readonly()
|
|
19836
19845
|
}).readonly();
|
|
19837
19846
|
var sessionsQueriedEventSchema = external_exports.strictObject({
|
|
19838
19847
|
entries: external_exports.array(sessionMetadataSchema).max(500).readonly(),
|
|
19839
19848
|
kind: external_exports.literal(SESSION_QUERIED_KIND),
|
|
19840
|
-
requestId:
|
|
19849
|
+
requestId: identifierStringSchema
|
|
19841
19850
|
}).readonly();
|
|
19842
19851
|
var fileReadCommandSchema = external_exports.strictObject({
|
|
19843
19852
|
kind: external_exports.literal(FILE_READ_KIND),
|
|
19844
19853
|
maxBytes: external_exports.number().int().positive().max(128 * 1024 * 1024),
|
|
19845
|
-
requestId:
|
|
19846
|
-
sessionId:
|
|
19854
|
+
requestId: identifierStringSchema,
|
|
19855
|
+
sessionId: identifierStringSchema,
|
|
19847
19856
|
path: external_exports.string().min(1).max(4096)
|
|
19848
19857
|
}).readonly();
|
|
19849
19858
|
var fileBeginEventSchema = external_exports.strictObject({
|
|
@@ -19852,27 +19861,27 @@ var fileBeginEventSchema = external_exports.strictObject({
|
|
|
19852
19861
|
mediaType: external_exports.string().min(1).max(255),
|
|
19853
19862
|
modifiedAt: external_exports.iso.datetime({ offset: true }),
|
|
19854
19863
|
name: external_exports.string().min(1).max(500),
|
|
19855
|
-
requestId:
|
|
19856
|
-
sessionId:
|
|
19864
|
+
requestId: identifierStringSchema,
|
|
19865
|
+
sessionId: identifierStringSchema
|
|
19857
19866
|
}).readonly();
|
|
19858
19867
|
var fileChunkEventSchema = external_exports.strictObject({
|
|
19859
19868
|
data: external_exports.string().min(1).max(4e5),
|
|
19860
19869
|
kind: external_exports.literal(FILE_CHUNK_KIND),
|
|
19861
|
-
requestId:
|
|
19870
|
+
requestId: identifierStringSchema,
|
|
19862
19871
|
sequence: external_exports.number().int().nonnegative().max(1024),
|
|
19863
|
-
sessionId:
|
|
19872
|
+
sessionId: identifierStringSchema
|
|
19864
19873
|
}).readonly();
|
|
19865
19874
|
var fileEndEventSchema = external_exports.strictObject({
|
|
19866
19875
|
kind: external_exports.literal(FILE_END_KIND),
|
|
19867
|
-
requestId:
|
|
19868
|
-
sessionId:
|
|
19876
|
+
requestId: identifierStringSchema,
|
|
19877
|
+
sessionId: identifierStringSchema
|
|
19869
19878
|
}).readonly();
|
|
19870
19879
|
var fileFailedEventSchema = external_exports.strictObject({
|
|
19871
|
-
code:
|
|
19880
|
+
code: identifierStringSchema,
|
|
19872
19881
|
kind: external_exports.literal(FILE_FAILED_KIND),
|
|
19873
19882
|
message: external_exports.string().min(1).max(500),
|
|
19874
|
-
requestId:
|
|
19875
|
-
sessionId:
|
|
19883
|
+
requestId: identifierStringSchema,
|
|
19884
|
+
sessionId: identifierStringSchema
|
|
19876
19885
|
}).readonly();
|
|
19877
19886
|
var configValueSchema = external_exports.strictObject({
|
|
19878
19887
|
description: SHORT_TEXT,
|
|
@@ -19923,44 +19932,44 @@ var agentModelEffortSchema = external_exports.strictObject({
|
|
|
19923
19932
|
valuesByModel: external_exports.record(external_exports.string().min(1).max(500), external_exports.array(configValueSchema).max(500).readonly()).readonly()
|
|
19924
19933
|
}).readonly();
|
|
19925
19934
|
var agentSettingsDiscoverCommandSchema = external_exports.strictObject({
|
|
19926
|
-
agentId:
|
|
19935
|
+
agentId: identifierStringSchema,
|
|
19927
19936
|
kind: external_exports.literal(AGENT_SETTINGS_DISCOVER_KIND),
|
|
19928
19937
|
model: external_exports.string().min(1).max(500).optional(),
|
|
19929
|
-
requestId:
|
|
19938
|
+
requestId: identifierStringSchema
|
|
19930
19939
|
}).readonly();
|
|
19931
19940
|
var agentSettingsDiscoveredEventSchema = external_exports.strictObject({
|
|
19932
|
-
agentId:
|
|
19941
|
+
agentId: identifierStringSchema,
|
|
19933
19942
|
agentName: external_exports.string().max(255),
|
|
19934
19943
|
agentVersion: external_exports.string().max(128),
|
|
19935
19944
|
kind: external_exports.literal(AGENT_SETTINGS_DISCOVERED_KIND),
|
|
19936
19945
|
modelEffort: agentModelEffortSchema,
|
|
19937
|
-
requestId:
|
|
19946
|
+
requestId: identifierStringSchema,
|
|
19938
19947
|
settings: agentSettingsSchema,
|
|
19939
19948
|
settingsRevision: external_exports.string().regex(/^[a-f0-9]{64}$/)
|
|
19940
19949
|
}).readonly();
|
|
19941
19950
|
var agentSettingsDiscoveryFailedEventSchema = external_exports.strictObject({
|
|
19942
|
-
code:
|
|
19951
|
+
code: identifierStringSchema,
|
|
19943
19952
|
kind: external_exports.literal(AGENT_SETTINGS_DISCOVERY_FAILED_KIND),
|
|
19944
19953
|
message: external_exports.string().min(1).max(500),
|
|
19945
|
-
requestId:
|
|
19954
|
+
requestId: identifierStringSchema
|
|
19946
19955
|
}).readonly();
|
|
19947
19956
|
var agentCatalogRefreshCommandSchema = external_exports.strictObject({
|
|
19948
19957
|
kind: external_exports.literal(AGENT_CATALOG_REFRESH_KIND),
|
|
19949
|
-
requestId:
|
|
19958
|
+
requestId: identifierStringSchema
|
|
19950
19959
|
}).readonly();
|
|
19951
19960
|
var agentCatalogRefreshedEventSchema = external_exports.strictObject({
|
|
19952
19961
|
kind: external_exports.literal(AGENT_CATALOG_REFRESHED_KIND),
|
|
19953
|
-
requestId:
|
|
19962
|
+
requestId: identifierStringSchema
|
|
19954
19963
|
}).readonly();
|
|
19955
19964
|
var agentCatalogRefreshFailedEventSchema = external_exports.strictObject({
|
|
19956
|
-
code:
|
|
19965
|
+
code: identifierStringSchema,
|
|
19957
19966
|
kind: external_exports.literal(AGENT_CATALOG_REFRESH_FAILED_KIND),
|
|
19958
19967
|
message: external_exports.string().min(1).max(500),
|
|
19959
|
-
requestId:
|
|
19968
|
+
requestId: identifierStringSchema
|
|
19960
19969
|
}).readonly();
|
|
19961
19970
|
var sessionConfigurationSelectionSchema = external_exports.strictObject({
|
|
19962
19971
|
booleanValue: external_exports.boolean(),
|
|
19963
|
-
configId:
|
|
19972
|
+
configId: identifierStringSchema,
|
|
19964
19973
|
value: external_exports.string().max(500),
|
|
19965
19974
|
valueType: external_exports.enum(["boolean", "select"])
|
|
19966
19975
|
}).readonly();
|
|
@@ -20102,26 +20111,26 @@ var promptResourceSchema = external_exports.strictObject({
|
|
|
20102
20111
|
uri: external_exports.string().min(1).max(4096)
|
|
20103
20112
|
}).readonly();
|
|
20104
20113
|
var workspaceListCommandSchema = external_exports.strictObject({
|
|
20105
|
-
bindingId:
|
|
20114
|
+
bindingId: identifierStringSchema,
|
|
20106
20115
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
20107
20116
|
kind: external_exports.literal(WORKSPACE_LIST_KIND),
|
|
20108
|
-
requestId:
|
|
20117
|
+
requestId: identifierStringSchema
|
|
20109
20118
|
}).readonly();
|
|
20110
20119
|
var workspaceEntriesEventSchema = external_exports.strictObject({
|
|
20111
|
-
bindingId:
|
|
20120
|
+
bindingId: identifierStringSchema,
|
|
20112
20121
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
20113
20122
|
directoryLabel: external_exports.string().min(1).max(2048),
|
|
20114
20123
|
entries: external_exports.array(workspaceEntrySchema).max(500).readonly(),
|
|
20115
20124
|
kind: external_exports.literal(WORKSPACE_ENTRIES_KIND),
|
|
20116
20125
|
parentDirectoryId: external_exports.string().max(2048),
|
|
20117
|
-
requestId:
|
|
20126
|
+
requestId: identifierStringSchema
|
|
20118
20127
|
}).readonly();
|
|
20119
20128
|
var sessionIdentityFields = {
|
|
20120
20129
|
additionalDirectoryIds: external_exports.array(DIRECTORY_IDENTIFIER).max(16).readonly(),
|
|
20121
|
-
agentId:
|
|
20122
|
-
bindingId:
|
|
20130
|
+
agentId: identifierStringSchema,
|
|
20131
|
+
bindingId: identifierStringSchema,
|
|
20123
20132
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
20124
|
-
sessionId:
|
|
20133
|
+
sessionId: identifierStringSchema
|
|
20125
20134
|
};
|
|
20126
20135
|
var sessionPrepareCommandSchema = external_exports.strictObject({
|
|
20127
20136
|
...sessionIdentityFields,
|
|
@@ -20132,7 +20141,7 @@ var sessionPrepareCommandSchema = external_exports.strictObject({
|
|
|
20132
20141
|
valueType: external_exports.enum(["boolean", "select"])
|
|
20133
20142
|
}).readonly().optional(),
|
|
20134
20143
|
kind: external_exports.literal(SESSION_PREPARE_KIND),
|
|
20135
|
-
requestId:
|
|
20144
|
+
requestId: identifierStringSchema,
|
|
20136
20145
|
sessionState: external_exports.literal("provisioned").optional(),
|
|
20137
20146
|
/** Marks an inspection-only Session preparation. */
|
|
20138
20147
|
transient: external_exports.boolean().optional()
|
|
@@ -20153,7 +20162,7 @@ var runtimeTimingsSchema = external_exports.array(
|
|
|
20153
20162
|
).max(16).readonly();
|
|
20154
20163
|
var sessionReadyEventSchema = external_exports.strictObject({
|
|
20155
20164
|
additionalDirectories: external_exports.array(workspaceEntrySchema).max(16).readonly(),
|
|
20156
|
-
agentId:
|
|
20165
|
+
agentId: identifierStringSchema,
|
|
20157
20166
|
agentName: external_exports.string().max(255),
|
|
20158
20167
|
agentVersion: external_exports.string().max(128),
|
|
20159
20168
|
capabilities: sessionCapabilitiesSchema,
|
|
@@ -20162,41 +20171,41 @@ var sessionReadyEventSchema = external_exports.strictObject({
|
|
|
20162
20171
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
20163
20172
|
directoryLabel: external_exports.string().min(1).max(2048),
|
|
20164
20173
|
kind: external_exports.literal(SESSION_READY_KIND),
|
|
20165
|
-
requestId:
|
|
20174
|
+
requestId: identifierStringSchema,
|
|
20166
20175
|
restored: external_exports.boolean(),
|
|
20167
20176
|
runtimeTimings: runtimeTimingsSchema.optional(),
|
|
20168
|
-
sessionId:
|
|
20177
|
+
sessionId: identifierStringSchema
|
|
20169
20178
|
}).readonly();
|
|
20170
20179
|
var sessionConfigureCommandSchema = external_exports.strictObject({
|
|
20171
20180
|
...sessionIdentityFields,
|
|
20172
20181
|
booleanValue: external_exports.boolean(),
|
|
20173
20182
|
configId: external_exports.string().min(1).max(128),
|
|
20174
20183
|
kind: external_exports.literal(SESSION_CONFIGURE_KIND),
|
|
20175
|
-
requestId:
|
|
20184
|
+
requestId: identifierStringSchema,
|
|
20176
20185
|
value: external_exports.string().max(500),
|
|
20177
20186
|
valueType: external_exports.enum(["boolean", "select"])
|
|
20178
20187
|
}).readonly();
|
|
20179
20188
|
var sessionConfigUpdatedEventSchema = external_exports.strictObject({
|
|
20180
20189
|
configOptions: sessionConfigOptionsSchema,
|
|
20181
20190
|
kind: external_exports.literal(SESSION_CONFIG_UPDATED_KIND),
|
|
20182
|
-
requestId:
|
|
20183
|
-
sessionId:
|
|
20191
|
+
requestId: identifierStringSchema,
|
|
20192
|
+
sessionId: identifierStringSchema
|
|
20184
20193
|
}).readonly();
|
|
20185
20194
|
var sessionContextUsageUpdatedEventSchema = external_exports.strictObject({
|
|
20186
20195
|
costAmount: external_exports.number().finite().nonnegative(),
|
|
20187
20196
|
costCurrency: external_exports.string().max(16),
|
|
20188
20197
|
hasCost: external_exports.boolean(),
|
|
20189
20198
|
kind: external_exports.literal(SESSION_USAGE_UPDATED_KIND),
|
|
20190
|
-
sessionId:
|
|
20199
|
+
sessionId: identifierStringSchema,
|
|
20191
20200
|
size: external_exports.number().int().nonnegative(),
|
|
20192
20201
|
source: external_exports.literal("context").default("context"),
|
|
20193
20202
|
used: external_exports.number().int().nonnegative()
|
|
20194
20203
|
}).readonly();
|
|
20195
20204
|
var sessionPromptUsageUpdatedEventSchema = external_exports.strictObject({
|
|
20196
20205
|
_meta: promptMetadataSchema.nullable(),
|
|
20197
|
-
commandId:
|
|
20206
|
+
commandId: identifierStringSchema,
|
|
20198
20207
|
kind: external_exports.literal(SESSION_USAGE_UPDATED_KIND),
|
|
20199
|
-
sessionId:
|
|
20208
|
+
sessionId: identifierStringSchema,
|
|
20200
20209
|
source: external_exports.literal("prompt"),
|
|
20201
20210
|
usage: promptUsageSchema.nullable()
|
|
20202
20211
|
}).refine((event) => event.usage !== null || event._meta?.quota !== void 0).readonly();
|
|
@@ -20207,82 +20216,82 @@ var sessionUsageUpdatedEventSchema = external_exports.union([
|
|
|
20207
20216
|
var sessionCommandsUpdatedEventSchema = external_exports.strictObject({
|
|
20208
20217
|
commands: external_exports.array(sessionCommandSchema).max(500).readonly(),
|
|
20209
20218
|
kind: external_exports.literal(SESSION_COMMANDS_UPDATED_KIND),
|
|
20210
|
-
sessionId:
|
|
20219
|
+
sessionId: identifierStringSchema
|
|
20211
20220
|
}).readonly();
|
|
20212
20221
|
var sessionInfoUpdatedEventSchema = external_exports.strictObject({
|
|
20213
20222
|
kind: external_exports.literal(SESSION_INFO_UPDATED_KIND),
|
|
20214
|
-
sessionId:
|
|
20223
|
+
sessionId: identifierStringSchema,
|
|
20215
20224
|
title: external_exports.string().max(500).nullable(),
|
|
20216
20225
|
updatedAt: external_exports.string().max(128)
|
|
20217
20226
|
}).readonly();
|
|
20218
20227
|
var sessionPermissionRequestedEventSchema = external_exports.strictObject({
|
|
20219
|
-
commandId:
|
|
20220
|
-
interactionId:
|
|
20228
|
+
commandId: identifierStringSchema,
|
|
20229
|
+
interactionId: identifierStringSchema,
|
|
20221
20230
|
kind: external_exports.literal(SESSION_PERMISSION_REQUESTED_KIND),
|
|
20222
20231
|
options: external_exports.array(permissionOptionSchema).min(1).max(20).readonly(),
|
|
20223
|
-
sessionId:
|
|
20232
|
+
sessionId: identifierStringSchema,
|
|
20224
20233
|
title: external_exports.string().min(1).max(500),
|
|
20225
20234
|
toolCallId: external_exports.string().min(1).max(255),
|
|
20226
20235
|
toolKind: external_exports.string().max(64)
|
|
20227
20236
|
}).readonly();
|
|
20228
20237
|
var sessionPermissionRespondCommandSchema = external_exports.strictObject({
|
|
20229
|
-
interactionId:
|
|
20238
|
+
interactionId: identifierStringSchema,
|
|
20230
20239
|
kind: external_exports.literal(SESSION_PERMISSION_RESPOND_KIND),
|
|
20231
20240
|
optionId: external_exports.string().max(255),
|
|
20232
20241
|
outcome: external_exports.enum(["cancelled", "selected"]),
|
|
20233
|
-
sessionId:
|
|
20242
|
+
sessionId: identifierStringSchema
|
|
20234
20243
|
}).readonly();
|
|
20235
20244
|
var sessionPermissionResolvedEventSchema = external_exports.strictObject({
|
|
20236
|
-
interactionId:
|
|
20245
|
+
interactionId: identifierStringSchema,
|
|
20237
20246
|
kind: external_exports.literal(SESSION_PERMISSION_RESOLVED_KIND),
|
|
20238
20247
|
optionId: external_exports.string().max(255),
|
|
20239
20248
|
outcome: external_exports.enum(["cancelled", "selected"]),
|
|
20240
|
-
sessionId:
|
|
20249
|
+
sessionId: identifierStringSchema
|
|
20241
20250
|
}).readonly();
|
|
20242
20251
|
var sessionElicitationRequestedEventSchema = external_exports.strictObject({
|
|
20243
20252
|
accepted: external_exports.boolean(),
|
|
20244
|
-
commandId:
|
|
20253
|
+
commandId: identifierStringSchema,
|
|
20245
20254
|
elicitationId: external_exports.string().max(255),
|
|
20246
20255
|
fields: external_exports.array(elicitationFieldSchema).max(100).readonly(),
|
|
20247
|
-
interactionId:
|
|
20256
|
+
interactionId: identifierStringSchema,
|
|
20248
20257
|
kind: external_exports.literal(SESSION_ELICITATION_REQUESTED_KIND),
|
|
20249
20258
|
message: external_exports.string().min(1).max(2e3),
|
|
20250
20259
|
mode: external_exports.enum(["form", "url"]),
|
|
20251
|
-
sessionId:
|
|
20260
|
+
sessionId: identifierStringSchema,
|
|
20252
20261
|
url: external_exports.string().max(4096)
|
|
20253
20262
|
}).readonly();
|
|
20254
20263
|
var sessionElicitationRespondCommandSchema = external_exports.strictObject({
|
|
20255
20264
|
action: external_exports.enum(["accept", "cancel", "decline"]),
|
|
20256
20265
|
content: external_exports.string().max(1e5),
|
|
20257
|
-
interactionId:
|
|
20266
|
+
interactionId: identifierStringSchema,
|
|
20258
20267
|
kind: external_exports.literal(SESSION_ELICITATION_RESPOND_KIND),
|
|
20259
|
-
sessionId:
|
|
20268
|
+
sessionId: identifierStringSchema
|
|
20260
20269
|
}).readonly();
|
|
20261
20270
|
var sessionElicitationResolvedEventSchema = external_exports.strictObject({
|
|
20262
20271
|
action: external_exports.enum(["accept", "cancel", "decline", "complete"]),
|
|
20263
|
-
interactionId:
|
|
20272
|
+
interactionId: identifierStringSchema,
|
|
20264
20273
|
kind: external_exports.literal(SESSION_ELICITATION_RESOLVED_KIND),
|
|
20265
|
-
sessionId:
|
|
20274
|
+
sessionId: identifierStringSchema
|
|
20266
20275
|
}).readonly();
|
|
20267
20276
|
var sessionOperationFailedEventSchema = external_exports.strictObject({
|
|
20268
|
-
code:
|
|
20277
|
+
code: identifierStringSchema,
|
|
20269
20278
|
kind: external_exports.literal(SESSION_OPERATION_FAILED_KIND),
|
|
20270
20279
|
message: external_exports.string().min(1).max(500),
|
|
20271
|
-
requestId:
|
|
20280
|
+
requestId: identifierStringSchema,
|
|
20272
20281
|
runtimeTimings: runtimeTimingsSchema.optional(),
|
|
20273
20282
|
sessionId: external_exports.string().max(128)
|
|
20274
20283
|
}).readonly();
|
|
20275
20284
|
var agentContentEventSchema = external_exports.strictObject({
|
|
20276
|
-
commandId:
|
|
20285
|
+
commandId: identifierStringSchema,
|
|
20277
20286
|
content: displayContentSchema,
|
|
20278
|
-
contentId:
|
|
20287
|
+
contentId: identifierStringSchema,
|
|
20279
20288
|
kind: external_exports.literal(AGENT_CONTENT_KIND),
|
|
20280
20289
|
messageId: external_exports.string().max(255),
|
|
20281
|
-
sessionId:
|
|
20290
|
+
sessionId: identifierStringSchema
|
|
20282
20291
|
}).readonly();
|
|
20283
20292
|
var agentInstallIdentityFields = {
|
|
20284
|
-
agentId:
|
|
20285
|
-
requestId:
|
|
20293
|
+
agentId: identifierStringSchema,
|
|
20294
|
+
requestId: identifierStringSchema
|
|
20286
20295
|
};
|
|
20287
20296
|
var agentInstallRequestCommandSchema = external_exports.strictObject({
|
|
20288
20297
|
...agentInstallIdentityFields,
|
|
@@ -20290,7 +20299,7 @@ var agentInstallRequestCommandSchema = external_exports.strictObject({
|
|
|
20290
20299
|
}).readonly();
|
|
20291
20300
|
var agentInstallCancelCommandSchema = external_exports.strictObject({
|
|
20292
20301
|
kind: external_exports.literal(AGENT_INSTALL_CANCEL_KIND),
|
|
20293
|
-
requestId:
|
|
20302
|
+
requestId: identifierStringSchema
|
|
20294
20303
|
}).readonly();
|
|
20295
20304
|
var agentInstallStartedEventSchema = external_exports.strictObject({
|
|
20296
20305
|
...agentInstallIdentityFields,
|
|
@@ -20315,7 +20324,7 @@ var agentInstallCompletedEventSchema = external_exports.strictObject({
|
|
|
20315
20324
|
}).readonly();
|
|
20316
20325
|
var agentInstallFailedEventSchema = external_exports.strictObject({
|
|
20317
20326
|
...agentInstallIdentityFields,
|
|
20318
|
-
code:
|
|
20327
|
+
code: identifierStringSchema,
|
|
20319
20328
|
kind: external_exports.literal(AGENT_INSTALL_FAILED_KIND),
|
|
20320
20329
|
message: external_exports.string().min(1).max(500)
|
|
20321
20330
|
}).readonly();
|
|
@@ -20424,12 +20433,14 @@ var encodeAgentInstallCancelledEvent = (message) => encode3(message, agentInstal
|
|
|
20424
20433
|
|
|
20425
20434
|
// ../protocol/src/messages.ts
|
|
20426
20435
|
var SESSION_PROMPT_KIND = "session.prompt";
|
|
20436
|
+
var SESSION_PROMPT_DISPOSITION_KIND = "session.prompt.disposition";
|
|
20427
20437
|
var RUNTIME_WORKSPACE_BINDING_ID = "workspace";
|
|
20428
20438
|
var SESSION_CANCEL_KIND = "session.cancel";
|
|
20429
20439
|
var RUNTIME_LIVENESS_READY_KIND = "runtime.liveness.ready";
|
|
20430
20440
|
var RUNTIME_HEARTBEAT_KIND = "runtime.heartbeat";
|
|
20431
20441
|
var RUNTIME_HEARTBEAT_ACK_KIND = "runtime.heartbeat.ack";
|
|
20432
20442
|
var SESSION_STARTED_KIND = "session.started";
|
|
20443
|
+
var SESSION_QUEUED_KIND = "session.queued";
|
|
20433
20444
|
var AGENT_MESSAGE_DELTA_KIND = "agent.message.delta";
|
|
20434
20445
|
var AGENT_ACTIVITY_KIND = "agent.activity";
|
|
20435
20446
|
var AGENT_ACTIVITY_NARRATION_KIND = "agent.activity.narration";
|
|
@@ -20447,7 +20458,6 @@ var SessionPromptDisposition = Object.freeze({
|
|
|
20447
20458
|
});
|
|
20448
20459
|
|
|
20449
20460
|
// ../protocol/src/codecs/messages.ts
|
|
20450
|
-
var IDENTIFIER_PATTERN2 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
|
|
20451
20461
|
var DIRECTORY_IDENTIFIER_PATTERN2 = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/;
|
|
20452
20462
|
var MAX_PROMPT_LENGTH = 1e4;
|
|
20453
20463
|
var MAX_PROMPT_ATTACHMENT_LENGTH = 6e6;
|
|
@@ -20628,11 +20638,11 @@ function readActivityDetail(value) {
|
|
|
20628
20638
|
throw new ProtocolMessageError("Invalid activity detail availability");
|
|
20629
20639
|
}
|
|
20630
20640
|
function readIdentifier(value, key) {
|
|
20631
|
-
|
|
20632
|
-
|
|
20633
|
-
|
|
20641
|
+
try {
|
|
20642
|
+
return decodeIdentifier(value[key]);
|
|
20643
|
+
} catch (cause) {
|
|
20644
|
+
throw new ProtocolMessageError(`Invalid identifier field: ${key}`, { cause });
|
|
20634
20645
|
}
|
|
20635
|
-
return field;
|
|
20636
20646
|
}
|
|
20637
20647
|
function readDirectoryIdentifier(value, key) {
|
|
20638
20648
|
const field = readString(value, key, 2048);
|
|
@@ -20681,7 +20691,7 @@ function decodeSessionPromptCommand(encoded) {
|
|
|
20681
20691
|
const disposition = readPromptDisposition(value);
|
|
20682
20692
|
const rawTargetCommandId = value["targetCommandId"];
|
|
20683
20693
|
const targetCommandId = rawTargetCommandId === void 0 ? "" : readText(value, "targetCommandId", 128);
|
|
20684
|
-
if (disposition === SessionPromptDisposition.Reject && targetCommandId.length > 0 || disposition !== SessionPromptDisposition.Reject && !
|
|
20694
|
+
if (disposition === SessionPromptDisposition.Reject && targetCommandId.length > 0 || disposition !== SessionPromptDisposition.Reject && !isIdentifier(targetCommandId)) {
|
|
20685
20695
|
throw new ProtocolMessageError("Prompt disposition has an invalid target command");
|
|
20686
20696
|
}
|
|
20687
20697
|
const sessionConfigurations = hasSessionConfigurations ? decodeSessionConfigurationSelections(value["sessionConfigurations"]) : [];
|
|
@@ -20714,6 +20724,30 @@ function decodeSessionCancelCommand(encoded) {
|
|
|
20714
20724
|
sessionId: readIdentifier(value, "sessionId")
|
|
20715
20725
|
};
|
|
20716
20726
|
}
|
|
20727
|
+
function decodeSessionPromptDispositionCommand(encoded) {
|
|
20728
|
+
const value = parseJson2(encoded);
|
|
20729
|
+
assertExactKeys(value, ["commandId", "disposition", "kind", "sessionId"]);
|
|
20730
|
+
assertKind(value, SESSION_PROMPT_DISPOSITION_KIND);
|
|
20731
|
+
if (readPromptDisposition(value) !== SessionPromptDisposition.Steer) {
|
|
20732
|
+
throw new ProtocolMessageError("Only queued prompts can be steered");
|
|
20733
|
+
}
|
|
20734
|
+
return {
|
|
20735
|
+
commandId: readIdentifier(value, "commandId"),
|
|
20736
|
+
disposition: SessionPromptDisposition.Steer,
|
|
20737
|
+
kind: SESSION_PROMPT_DISPOSITION_KIND,
|
|
20738
|
+
sessionId: readIdentifier(value, "sessionId")
|
|
20739
|
+
};
|
|
20740
|
+
}
|
|
20741
|
+
function decodeSessionQueuedEvent(encoded) {
|
|
20742
|
+
const value = parseJson2(encoded);
|
|
20743
|
+
assertExactKeys(value, ["commandId", "kind", "sessionId"]);
|
|
20744
|
+
assertKind(value, SESSION_QUEUED_KIND);
|
|
20745
|
+
return {
|
|
20746
|
+
commandId: readIdentifier(value, "commandId"),
|
|
20747
|
+
kind: SESSION_QUEUED_KIND,
|
|
20748
|
+
sessionId: readIdentifier(value, "sessionId")
|
|
20749
|
+
};
|
|
20750
|
+
}
|
|
20717
20751
|
function decodeRuntimeLivenessReadyEvent(encoded) {
|
|
20718
20752
|
const value = parseJson2(encoded);
|
|
20719
20753
|
assertExactKeys(value, ["kind"]);
|
|
@@ -20841,6 +20875,12 @@ function encodeSessionPromptCommand(message) {
|
|
|
20841
20875
|
function encodeSessionCancelCommand(message) {
|
|
20842
20876
|
return JSON.stringify(decodeSessionCancelCommand(JSON.stringify(message)));
|
|
20843
20877
|
}
|
|
20878
|
+
function encodeSessionPromptDispositionCommand(message) {
|
|
20879
|
+
return JSON.stringify(decodeSessionPromptDispositionCommand(JSON.stringify(message)));
|
|
20880
|
+
}
|
|
20881
|
+
function encodeSessionQueuedEvent(message) {
|
|
20882
|
+
return JSON.stringify(decodeSessionQueuedEvent(JSON.stringify(message)));
|
|
20883
|
+
}
|
|
20844
20884
|
function encodeRuntimeLivenessReadyEvent(message) {
|
|
20845
20885
|
return JSON.stringify(decodeRuntimeLivenessReadyEvent(JSON.stringify(message)));
|
|
20846
20886
|
}
|
|
@@ -20927,8 +20967,13 @@ var availableSessionHistoryObjectSchema = external_exports.strictObject({
|
|
|
20927
20967
|
status: external_exports.literal("available"),
|
|
20928
20968
|
messages: external_exports.array(historyMessage).max(SESSION_HISTORY_MESSAGE_LIMIT).readonly(),
|
|
20929
20969
|
truncated: external_exports.boolean(),
|
|
20930
|
-
coveredCommandIds: external_exports.array(
|
|
20931
|
-
coveredMessageIds: external_exports.array(
|
|
20970
|
+
coveredCommandIds: external_exports.array(identifierStringSchema).max(1e4).readonly(),
|
|
20971
|
+
coveredMessageIds: external_exports.array(
|
|
20972
|
+
external_exports.string().refine((value) => {
|
|
20973
|
+
const suffix = value.endsWith(":user") ? ":user" : value.endsWith(":agent") ? ":agent" : null;
|
|
20974
|
+
return suffix !== null && isIdentifier(value.slice(0, -suffix.length));
|
|
20975
|
+
})
|
|
20976
|
+
).max(2e4).readonly().default([])
|
|
20932
20977
|
});
|
|
20933
20978
|
var availableSessionHistorySchema = availableSessionHistoryObjectSchema.readonly();
|
|
20934
20979
|
var unavailableSessionHistoryObjectSchema = external_exports.strictObject({
|
|
@@ -20962,70 +21007,69 @@ var NATIVE_SESSION_REQUEST_KIND = "native.session.request";
|
|
|
20962
21007
|
var NATIVE_SESSION_RESULT_KIND = "native.session.result";
|
|
20963
21008
|
var NATIVE_SESSION_CANCEL_KIND = "native.session.cancel";
|
|
20964
21009
|
var ACTIVE_TURN_TEXT_LIMIT = 1e6;
|
|
20965
|
-
var identifier = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/);
|
|
20966
21010
|
var directoryId = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/);
|
|
20967
21011
|
var envelope = {
|
|
20968
|
-
requestId:
|
|
20969
|
-
sessionId:
|
|
21012
|
+
requestId: identifierStringSchema,
|
|
21013
|
+
sessionId: identifierStringSchema
|
|
20970
21014
|
};
|
|
20971
21015
|
var identity = {
|
|
20972
21016
|
...envelope,
|
|
20973
21017
|
kind: external_exports.literal(NATIVE_SESSION_REQUEST_KIND),
|
|
20974
21018
|
additionalDirectoryIds: external_exports.array(directoryId).max(16).readonly(),
|
|
20975
|
-
agentId:
|
|
20976
|
-
bindingId:
|
|
21019
|
+
agentId: identifierStringSchema,
|
|
21020
|
+
bindingId: identifierStringSchema,
|
|
20977
21021
|
directoryId
|
|
20978
21022
|
};
|
|
20979
21023
|
var nativeSessionRequestSchema = external_exports.discriminatedUnion("action", [
|
|
20980
21024
|
external_exports.strictObject({ ...identity, action: external_exports.literal("create") }).readonly(),
|
|
20981
|
-
external_exports.strictObject({ ...identity, action: external_exports.literal("active-turn"), targetSessionId:
|
|
20982
|
-
external_exports.strictObject({ ...identity, action: external_exports.literal("preview"), entryId:
|
|
20983
|
-
external_exports.strictObject({ ...identity, action: external_exports.literal("history"), entryId:
|
|
20984
|
-
external_exports.strictObject({ ...identity, action: external_exports.literal("find"), nativeSessionId:
|
|
21025
|
+
external_exports.strictObject({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifierStringSchema }).readonly(),
|
|
21026
|
+
external_exports.strictObject({ ...identity, action: external_exports.literal("preview"), entryId: identifierStringSchema }).readonly(),
|
|
21027
|
+
external_exports.strictObject({ ...identity, action: external_exports.literal("history"), entryId: identifierStringSchema }).readonly(),
|
|
21028
|
+
external_exports.strictObject({ ...identity, action: external_exports.literal("find"), nativeSessionId: identifierStringSchema }).readonly(),
|
|
20985
21029
|
external_exports.strictObject({
|
|
20986
21030
|
...identity,
|
|
20987
21031
|
action: external_exports.literal("list"),
|
|
20988
|
-
cursor:
|
|
21032
|
+
cursor: identifierStringSchema.nullable()
|
|
20989
21033
|
}).readonly(),
|
|
20990
21034
|
external_exports.strictObject({
|
|
20991
21035
|
...identity,
|
|
20992
21036
|
action: external_exports.enum(["import", "fork"]),
|
|
20993
|
-
entryId:
|
|
20994
|
-
targetSessionId:
|
|
21037
|
+
entryId: identifierStringSchema,
|
|
21038
|
+
targetSessionId: identifierStringSchema
|
|
20995
21039
|
}).readonly(),
|
|
20996
21040
|
external_exports.strictObject({
|
|
20997
21041
|
...identity,
|
|
20998
21042
|
action: external_exports.literal("delete"),
|
|
20999
|
-
entryId:
|
|
21043
|
+
entryId: identifierStringSchema
|
|
21000
21044
|
}).readonly()
|
|
21001
21045
|
]);
|
|
21002
21046
|
var nativeSessionCommandSchema = external_exports.discriminatedUnion("action", [
|
|
21003
21047
|
external_exports.strictObject({ ...identity, action: external_exports.literal("create") }).readonly(),
|
|
21004
|
-
external_exports.strictObject({ ...identity, action: external_exports.literal("active-turn"), targetSessionId:
|
|
21005
|
-
external_exports.strictObject({ ...identity, action: external_exports.literal("preview"), entryId:
|
|
21006
|
-
external_exports.strictObject({ ...identity, action: external_exports.literal("history"), entryId:
|
|
21007
|
-
external_exports.strictObject({ ...identity, action: external_exports.literal("find"), nativeSessionId:
|
|
21048
|
+
external_exports.strictObject({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifierStringSchema }).readonly(),
|
|
21049
|
+
external_exports.strictObject({ ...identity, action: external_exports.literal("preview"), entryId: identifierStringSchema }).readonly(),
|
|
21050
|
+
external_exports.strictObject({ ...identity, action: external_exports.literal("history"), entryId: identifierStringSchema }).readonly(),
|
|
21051
|
+
external_exports.strictObject({ ...identity, action: external_exports.literal("find"), nativeSessionId: identifierStringSchema }).readonly(),
|
|
21008
21052
|
external_exports.strictObject({
|
|
21009
21053
|
...identity,
|
|
21010
21054
|
action: external_exports.literal("list"),
|
|
21011
|
-
cursor:
|
|
21055
|
+
cursor: identifierStringSchema.nullable()
|
|
21012
21056
|
}).readonly(),
|
|
21013
21057
|
external_exports.strictObject({
|
|
21014
21058
|
...identity,
|
|
21015
21059
|
action: external_exports.enum(["import", "fork"]),
|
|
21016
|
-
entryId:
|
|
21017
|
-
targetSessionId:
|
|
21060
|
+
entryId: identifierStringSchema,
|
|
21061
|
+
targetSessionId: identifierStringSchema
|
|
21018
21062
|
}).readonly(),
|
|
21019
21063
|
external_exports.strictObject({
|
|
21020
21064
|
...identity,
|
|
21021
21065
|
action: external_exports.literal("delete"),
|
|
21022
|
-
entryId:
|
|
21066
|
+
entryId: identifierStringSchema
|
|
21023
21067
|
}).readonly()
|
|
21024
21068
|
]);
|
|
21025
21069
|
var nativeSessionEntrySchema = external_exports.strictObject({
|
|
21026
|
-
entryId:
|
|
21027
|
-
mobiusSessionIds: external_exports.array(
|
|
21028
|
-
nativeSessionId:
|
|
21070
|
+
entryId: identifierStringSchema,
|
|
21071
|
+
mobiusSessionIds: external_exports.array(identifierStringSchema).max(500).readonly(),
|
|
21072
|
+
nativeSessionId: identifierStringSchema,
|
|
21029
21073
|
title: external_exports.string().max(500),
|
|
21030
21074
|
directoryId,
|
|
21031
21075
|
directoryLabel: external_exports.string().min(1).max(2048),
|
|
@@ -21037,17 +21081,17 @@ var resultEnvelope = {
|
|
|
21037
21081
|
kind: external_exports.literal(NATIVE_SESSION_RESULT_KIND)
|
|
21038
21082
|
};
|
|
21039
21083
|
var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
|
|
21040
|
-
external_exports.strictObject({ ...resultEnvelope, action: external_exports.literal("create"), nativeSessionId:
|
|
21084
|
+
external_exports.strictObject({ ...resultEnvelope, action: external_exports.literal("create"), nativeSessionId: identifierStringSchema }).readonly(),
|
|
21041
21085
|
external_exports.strictObject({
|
|
21042
21086
|
...resultEnvelope,
|
|
21043
21087
|
action: external_exports.literal("active-turn"),
|
|
21044
|
-
targetSessionId:
|
|
21088
|
+
targetSessionId: identifierStringSchema,
|
|
21045
21089
|
turn: external_exports.strictObject({
|
|
21046
|
-
commandId:
|
|
21090
|
+
commandId: identifierStringSchema,
|
|
21047
21091
|
prompt: external_exports.string().max(1e5),
|
|
21048
21092
|
text: external_exports.string().max(ACTIVE_TURN_TEXT_LIMIT),
|
|
21049
21093
|
truncated: external_exports.boolean(),
|
|
21050
|
-
epoch:
|
|
21094
|
+
epoch: identifierStringSchema,
|
|
21051
21095
|
interaction: external_exports.discriminatedUnion("kind", [
|
|
21052
21096
|
sessionPermissionRequestedEventSchema,
|
|
21053
21097
|
sessionElicitationRequestedEventSchema
|
|
@@ -21066,20 +21110,20 @@ var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
|
|
|
21066
21110
|
action: external_exports.literal("list"),
|
|
21067
21111
|
capabilities: sessionCapabilitiesSchema,
|
|
21068
21112
|
entries: external_exports.array(nativeSessionEntrySchema).max(500).readonly(),
|
|
21069
|
-
nextCursor:
|
|
21113
|
+
nextCursor: identifierStringSchema.nullable()
|
|
21070
21114
|
}).readonly(),
|
|
21071
21115
|
external_exports.strictObject({
|
|
21072
21116
|
...resultEnvelope,
|
|
21073
21117
|
action: external_exports.enum(["import", "fork"]),
|
|
21074
|
-
targetSessionId:
|
|
21118
|
+
targetSessionId: identifierStringSchema,
|
|
21075
21119
|
ready: sessionReadyEventSchema,
|
|
21076
21120
|
title: external_exports.string().max(500)
|
|
21077
21121
|
}).readonly(),
|
|
21078
21122
|
external_exports.strictObject({
|
|
21079
21123
|
...resultEnvelope,
|
|
21080
21124
|
action: external_exports.literal("preview"),
|
|
21081
|
-
entryId:
|
|
21082
|
-
targetSessionId:
|
|
21125
|
+
entryId: identifierStringSchema,
|
|
21126
|
+
targetSessionId: identifierStringSchema,
|
|
21083
21127
|
reason: external_exports.enum(["continuation_unavailable", "requested"]),
|
|
21084
21128
|
history: sessionHistorySchema,
|
|
21085
21129
|
title: external_exports.string().max(500)
|
|
@@ -21087,15 +21131,15 @@ var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
|
|
|
21087
21131
|
external_exports.strictObject({
|
|
21088
21132
|
...resultEnvelope,
|
|
21089
21133
|
action: external_exports.literal("history"),
|
|
21090
|
-
entryId:
|
|
21134
|
+
entryId: identifierStringSchema,
|
|
21091
21135
|
history: sessionHistorySchema,
|
|
21092
21136
|
title: external_exports.string().max(500)
|
|
21093
21137
|
}).readonly(),
|
|
21094
21138
|
external_exports.strictObject({
|
|
21095
21139
|
...resultEnvelope,
|
|
21096
21140
|
action: external_exports.literal("delete"),
|
|
21097
|
-
entryId:
|
|
21098
|
-
deletedSessionIds: external_exports.array(
|
|
21141
|
+
entryId: identifierStringSchema,
|
|
21142
|
+
deletedSessionIds: external_exports.array(identifierStringSchema).max(500).readonly()
|
|
21099
21143
|
}).readonly()
|
|
21100
21144
|
]);
|
|
21101
21145
|
var nativeSessionCancelSchema = external_exports.strictObject({ ...envelope, kind: external_exports.literal(NATIVE_SESSION_CANCEL_KIND) }).readonly();
|
|
@@ -21117,17 +21161,16 @@ var encodeNativeSessionCancel = (value) => JSON.stringify(nativeSessionCancelSch
|
|
|
21117
21161
|
// ../protocol/src/session-events.ts
|
|
21118
21162
|
var SESSION_EVENT_KIND = "session.event";
|
|
21119
21163
|
var SESSION_EVENT_COMMITTED_KIND = "session.event.committed";
|
|
21120
|
-
var IDENTIFIER_PATTERN3 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
|
|
21121
21164
|
var MAX_RECORDED_EVENT_LENGTH = 8 * 1024 * 1024;
|
|
21122
21165
|
var eventEnvelopeSchema = external_exports.strictObject({
|
|
21123
21166
|
kind: external_exports.literal(SESSION_EVENT_KIND),
|
|
21124
21167
|
payload: external_exports.string().min(2).max(MAX_RECORDED_EVENT_LENGTH),
|
|
21125
|
-
sessionId:
|
|
21168
|
+
sessionId: identifierStringSchema
|
|
21126
21169
|
}).readonly();
|
|
21127
21170
|
var committedEventSchema = external_exports.strictObject({
|
|
21128
21171
|
kind: external_exports.literal(SESSION_EVENT_COMMITTED_KIND),
|
|
21129
21172
|
payload: external_exports.string().min(2).max(MAX_RECORDED_EVENT_LENGTH),
|
|
21130
|
-
sessionId:
|
|
21173
|
+
sessionId: identifierStringSchema
|
|
21131
21174
|
}).readonly();
|
|
21132
21175
|
function decode5(encoded, schema) {
|
|
21133
21176
|
let value;
|
|
@@ -21201,39 +21244,38 @@ var SESSION_LIVE_HISTORY_LOAD_KIND = "session.live-history.load";
|
|
|
21201
21244
|
var SESSION_LIVE_HISTORY_LOADED_KIND = "session.live-history.loaded";
|
|
21202
21245
|
var SESSION_LIVE_HISTORY_PAGE_LOAD_KIND = "session.live-history.page.load";
|
|
21203
21246
|
var SESSION_LIVE_HISTORY_PAGE_LOADED_KIND = "session.live-history.page.loaded";
|
|
21204
|
-
var identifier2 = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/);
|
|
21205
21247
|
var directoryIdentifier = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/);
|
|
21206
21248
|
var sessionLiveHistoryLoadSchema = external_exports.strictObject({
|
|
21207
21249
|
additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
|
|
21208
|
-
agentId:
|
|
21209
|
-
bindingId:
|
|
21250
|
+
agentId: identifierStringSchema,
|
|
21251
|
+
bindingId: identifierStringSchema,
|
|
21210
21252
|
directoryId: directoryIdentifier,
|
|
21211
21253
|
kind: external_exports.literal(SESSION_LIVE_HISTORY_LOAD_KIND),
|
|
21212
|
-
requestId:
|
|
21213
|
-
sessionId:
|
|
21254
|
+
requestId: identifierStringSchema,
|
|
21255
|
+
sessionId: identifierStringSchema
|
|
21214
21256
|
}).readonly();
|
|
21215
21257
|
var sessionLiveHistoryLoadedSchema = external_exports.strictObject({
|
|
21216
21258
|
history: sessionHistorySchema,
|
|
21217
21259
|
kind: external_exports.literal(SESSION_LIVE_HISTORY_LOADED_KIND),
|
|
21218
|
-
requestId:
|
|
21219
|
-
sessionId:
|
|
21260
|
+
requestId: identifierStringSchema,
|
|
21261
|
+
sessionId: identifierStringSchema
|
|
21220
21262
|
}).readonly();
|
|
21221
21263
|
var sessionLiveHistoryPageLoadSchema = external_exports.strictObject({
|
|
21222
21264
|
additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
|
|
21223
|
-
agentId:
|
|
21224
|
-
bindingId:
|
|
21265
|
+
agentId: identifierStringSchema,
|
|
21266
|
+
bindingId: identifierStringSchema,
|
|
21225
21267
|
cursor: external_exports.string().min(1).max(512).nullable(),
|
|
21226
21268
|
directoryId: directoryIdentifier,
|
|
21227
21269
|
kind: external_exports.literal(SESSION_LIVE_HISTORY_PAGE_LOAD_KIND),
|
|
21228
21270
|
limit: external_exports.number().int().min(1).max(100),
|
|
21229
|
-
requestId:
|
|
21230
|
-
sessionId:
|
|
21271
|
+
requestId: identifierStringSchema,
|
|
21272
|
+
sessionId: identifierStringSchema
|
|
21231
21273
|
}).readonly();
|
|
21232
21274
|
var sessionLiveHistoryPageLoadedSchema = external_exports.strictObject({
|
|
21233
21275
|
kind: external_exports.literal(SESSION_LIVE_HISTORY_PAGE_LOADED_KIND),
|
|
21234
21276
|
page: nativeMessagePageSchema,
|
|
21235
|
-
requestId:
|
|
21236
|
-
sessionId:
|
|
21277
|
+
requestId: identifierStringSchema,
|
|
21278
|
+
sessionId: identifierStringSchema
|
|
21237
21279
|
}).readonly();
|
|
21238
21280
|
function decode6(schema, encoded) {
|
|
21239
21281
|
try {
|
|
@@ -21349,6 +21391,11 @@ var serviceToDaemonSignatures = {
|
|
|
21349
21391
|
encodeSessionPromptCommand,
|
|
21350
21392
|
decodeSessionPromptCommand
|
|
21351
21393
|
),
|
|
21394
|
+
[SESSION_PROMPT_DISPOSITION_KIND]: defineMessageSignature(
|
|
21395
|
+
SESSION_PROMPT_DISPOSITION_KIND,
|
|
21396
|
+
encodeSessionPromptDispositionCommand,
|
|
21397
|
+
decodeSessionPromptDispositionCommand
|
|
21398
|
+
),
|
|
21352
21399
|
[WORKSPACE_LIST_KIND]: defineMessageSignature(
|
|
21353
21400
|
WORKSPACE_LIST_KIND,
|
|
21354
21401
|
encodeWorkspaceListCommand,
|
|
@@ -21419,6 +21466,11 @@ var daemonToServiceSignatures = {
|
|
|
21419
21466
|
encodeSessionsQueriedEvent,
|
|
21420
21467
|
decodeSessionsQueriedEvent
|
|
21421
21468
|
),
|
|
21469
|
+
[SESSION_QUEUED_KIND]: defineMessageSignature(
|
|
21470
|
+
SESSION_QUEUED_KIND,
|
|
21471
|
+
encodeSessionQueuedEvent,
|
|
21472
|
+
decodeSessionQueuedEvent
|
|
21473
|
+
),
|
|
21422
21474
|
[NATIVE_SESSION_RESULT_KIND]: defineMessageSignature(
|
|
21423
21475
|
NATIVE_SESSION_RESULT_KIND,
|
|
21424
21476
|
encodeNativeSessionResult,
|
|
@@ -27281,6 +27333,7 @@ var turnSchema = external_exports.object({
|
|
|
27281
27333
|
id: boundedText(256),
|
|
27282
27334
|
status: turnStatusSchema
|
|
27283
27335
|
});
|
|
27336
|
+
var turnSteerResponseSchema = external_exports.object({ turnId: boundedText(256) });
|
|
27284
27337
|
var turnNotificationSchema = external_exports.object({
|
|
27285
27338
|
thread: external_exports.object({ id: boundedText(256) }).nullish(),
|
|
27286
27339
|
threadId: boundedText(256),
|
|
@@ -27665,7 +27718,10 @@ function presentToolItem(item) {
|
|
|
27665
27718
|
kind: "execute",
|
|
27666
27719
|
locations: [],
|
|
27667
27720
|
rawInput: { command: item.command, cwd: item.cwd },
|
|
27668
|
-
rawOutput: {
|
|
27721
|
+
rawOutput: {
|
|
27722
|
+
...item.exitCode == null ? {} : { exitCode: item.exitCode },
|
|
27723
|
+
output: truncate4(output2, TOOL_OUTPUT_CHARACTER_LIMIT)
|
|
27724
|
+
},
|
|
27669
27725
|
status: commandStatus(item.status),
|
|
27670
27726
|
title: truncate4(firstLine(item.command), TITLE_CHARACTER_LIMIT)
|
|
27671
27727
|
};
|
|
@@ -27721,7 +27777,7 @@ function presentToolItem(item) {
|
|
|
27721
27777
|
}
|
|
27722
27778
|
return null;
|
|
27723
27779
|
}
|
|
27724
|
-
function toolCallUpdate(item) {
|
|
27780
|
+
function toolCallUpdate(item, lifecycle) {
|
|
27725
27781
|
const presentation = presentToolItem(item);
|
|
27726
27782
|
if (presentation === null) {
|
|
27727
27783
|
return null;
|
|
@@ -27732,7 +27788,7 @@ function toolCallUpdate(item) {
|
|
|
27732
27788
|
locations: [...presentation.locations],
|
|
27733
27789
|
rawInput: presentation.rawInput,
|
|
27734
27790
|
rawOutput: presentation.rawOutput,
|
|
27735
|
-
status: presentation.status,
|
|
27791
|
+
status: lifecycle === "completed" && presentation.status === "in_progress" ? "completed" : presentation.status,
|
|
27736
27792
|
title: presentation.title,
|
|
27737
27793
|
toolCallId: item.id
|
|
27738
27794
|
};
|
|
@@ -27841,6 +27897,54 @@ function promptInput(prompt) {
|
|
|
27841
27897
|
}
|
|
27842
27898
|
return input2;
|
|
27843
27899
|
}
|
|
27900
|
+
function steeringPromptInput(prompt) {
|
|
27901
|
+
const input2 = [];
|
|
27902
|
+
for (const block of prompt) {
|
|
27903
|
+
if (typeof block !== "object" || block === null) {
|
|
27904
|
+
throw new AcpExecutionError("Codex received an invalid steering prompt", {}, "invalid_request");
|
|
27905
|
+
}
|
|
27906
|
+
const type = Reflect.get(block, "type");
|
|
27907
|
+
if (type === "text") {
|
|
27908
|
+
const text = Reflect.get(block, "text");
|
|
27909
|
+
if (typeof text !== "string") {
|
|
27910
|
+
throw new AcpExecutionError("Codex received an invalid steering prompt", {}, "invalid_request");
|
|
27911
|
+
}
|
|
27912
|
+
input2.push({ text, text_elements: [], type: "text" });
|
|
27913
|
+
continue;
|
|
27914
|
+
}
|
|
27915
|
+
if (type === "image") {
|
|
27916
|
+
const data = Reflect.get(block, "data");
|
|
27917
|
+
const mimeType = Reflect.get(block, "mimeType");
|
|
27918
|
+
if (typeof data !== "string" || typeof mimeType !== "string") {
|
|
27919
|
+
throw new AcpExecutionError("Codex received an invalid steering prompt", {}, "invalid_request");
|
|
27920
|
+
}
|
|
27921
|
+
input2.push({ type: "image", url: `data:${mimeType};base64,${data}` });
|
|
27922
|
+
continue;
|
|
27923
|
+
}
|
|
27924
|
+
if (type === "resource") {
|
|
27925
|
+
const resource = Reflect.get(block, "resource");
|
|
27926
|
+
if (typeof resource !== "object" || resource === null) {
|
|
27927
|
+
throw new AcpExecutionError("Codex received an invalid steering prompt", {}, "invalid_request");
|
|
27928
|
+
}
|
|
27929
|
+
const text = Reflect.get(resource, "text");
|
|
27930
|
+
if (text !== void 0 && typeof text !== "string") {
|
|
27931
|
+
throw new AcpExecutionError("Codex received an invalid steering prompt", {}, "invalid_request");
|
|
27932
|
+
}
|
|
27933
|
+
input2.push({ text: text ?? "", text_elements: [], type: "text" });
|
|
27934
|
+
continue;
|
|
27935
|
+
}
|
|
27936
|
+
if (type === "resource_link") {
|
|
27937
|
+
const uri = Reflect.get(block, "uri");
|
|
27938
|
+
if (typeof uri !== "string") {
|
|
27939
|
+
throw new AcpExecutionError("Codex received an invalid steering prompt", {}, "invalid_request");
|
|
27940
|
+
}
|
|
27941
|
+
input2.push({ text: `Resource: ${uri}`, text_elements: [], type: "text" });
|
|
27942
|
+
continue;
|
|
27943
|
+
}
|
|
27944
|
+
throw new AcpExecutionError("Codex received an unsupported steering prompt", {}, "invalid_request");
|
|
27945
|
+
}
|
|
27946
|
+
return input2;
|
|
27947
|
+
}
|
|
27844
27948
|
function modelValues(models) {
|
|
27845
27949
|
return models.map((model) => ({
|
|
27846
27950
|
description: model.description ?? "",
|
|
@@ -28019,6 +28123,7 @@ var CodexAcpAgent = class {
|
|
|
28019
28123
|
this.#app = createAgentApp({ name: "mobius-codex" }).onConnect((connection) => {
|
|
28020
28124
|
this.#connection = connection;
|
|
28021
28125
|
}).onRequest(methods4.agent.initialize, async () => ({
|
|
28126
|
+
_meta: { steering: { supported: true } },
|
|
28022
28127
|
agentCapabilities: {
|
|
28023
28128
|
loadSession: true,
|
|
28024
28129
|
promptCapabilities: { embeddedContext: true, image: true },
|
|
@@ -28092,7 +28197,11 @@ var CodexAcpAgent = class {
|
|
|
28092
28197
|
return { configOptions: this.#configOptions() };
|
|
28093
28198
|
}).onRequest(methods4.agent.session.prompt, async (context) => {
|
|
28094
28199
|
return await this.#runTurn(promptInput(context.params.prompt), context.signal);
|
|
28095
|
-
}).onRequest(
|
|
28200
|
+
}).onRequest(
|
|
28201
|
+
"_session/steering",
|
|
28202
|
+
(params) => params,
|
|
28203
|
+
async (context) => await this.#steerTurn(context.params, context.signal)
|
|
28204
|
+
).onRequest(methods4.agent.session.list, async (context) => {
|
|
28096
28205
|
const decoded = threadListResponseSchema.parse(
|
|
28097
28206
|
await this.#appServer.request(
|
|
28098
28207
|
"thread/list",
|
|
@@ -28259,7 +28368,7 @@ var CodexAcpAgent = class {
|
|
|
28259
28368
|
});
|
|
28260
28369
|
continue;
|
|
28261
28370
|
}
|
|
28262
|
-
const update = toolCallUpdate(item);
|
|
28371
|
+
const update = toolCallUpdate(item, "snapshot");
|
|
28263
28372
|
if (update !== null) {
|
|
28264
28373
|
await this.#emit({ ...update, sessionUpdate: "tool_call_update" });
|
|
28265
28374
|
}
|
|
@@ -28456,7 +28565,7 @@ var CodexAcpAgent = class {
|
|
|
28456
28565
|
});
|
|
28457
28566
|
return;
|
|
28458
28567
|
}
|
|
28459
|
-
const update = toolCallUpdate(item);
|
|
28568
|
+
const update = toolCallUpdate(item, method === "item/completed" ? "completed" : "started");
|
|
28460
28569
|
if (update !== null) {
|
|
28461
28570
|
await this.#enqueue(async () => {
|
|
28462
28571
|
await this.#emit({ ...update, sessionUpdate: "tool_call_update" });
|
|
@@ -28642,6 +28751,35 @@ var CodexAcpAgent = class {
|
|
|
28642
28751
|
}
|
|
28643
28752
|
}
|
|
28644
28753
|
};
|
|
28754
|
+
#steerTurn = async (params, signal) => {
|
|
28755
|
+
if (typeof params !== "object" || params === null) {
|
|
28756
|
+
throw new AcpExecutionError("Codex received an invalid steering request", {}, "invalid_request");
|
|
28757
|
+
}
|
|
28758
|
+
const sessionId = Reflect.get(params, "sessionId");
|
|
28759
|
+
const prompt = Reflect.get(params, "prompt");
|
|
28760
|
+
if (typeof sessionId !== "string" || !Array.isArray(prompt)) {
|
|
28761
|
+
throw new AcpExecutionError("Codex received an invalid steering request", {}, "invalid_request");
|
|
28762
|
+
}
|
|
28763
|
+
const active = this.#turn;
|
|
28764
|
+
if (sessionId !== this.#nativeSessionId || active === null || active.turn.id.length === 0) {
|
|
28765
|
+
return { outcome: "promptRequired", reason: "noRunningTurn" };
|
|
28766
|
+
}
|
|
28767
|
+
const input2 = steeringPromptInput(prompt);
|
|
28768
|
+
if (input2.length === 0) {
|
|
28769
|
+
throw new AcpExecutionError("Codex received an empty steering request", {}, "invalid_request");
|
|
28770
|
+
}
|
|
28771
|
+
const response = turnSteerResponseSchema.parse(
|
|
28772
|
+
await this.#appServer.request(
|
|
28773
|
+
"turn/steer",
|
|
28774
|
+
{ expectedTurnId: active.turn.id, input: input2, threadId: this.#nativeSessionId },
|
|
28775
|
+
AbortSignal.any([signal, AbortSignal.timeout(APPROVAL_TIMEOUT_MILLISECONDS)])
|
|
28776
|
+
)
|
|
28777
|
+
);
|
|
28778
|
+
if (response.turnId !== active.turn.id) {
|
|
28779
|
+
throw new AcpExecutionError("Codex steered an unexpected turn", {}, "steering_target_unavailable");
|
|
28780
|
+
}
|
|
28781
|
+
return { outcome: "injected" };
|
|
28782
|
+
};
|
|
28645
28783
|
#interruptTurn = async () => {
|
|
28646
28784
|
const turn = this.#turn;
|
|
28647
28785
|
if (turn === null) {
|
|
@@ -30474,7 +30612,6 @@ import { dirname as dirname3, join as join15, resolve as resolve4 } from "node:p
|
|
|
30474
30612
|
var APPLICATION_ID_PATTERN = /^[a-z][a-z0-9]*(?:[.-][a-z0-9]+){1,31}$/;
|
|
30475
30613
|
var CONNECTION_ID_PATTERN = /^mcn_[a-f0-9]{32}$/;
|
|
30476
30614
|
var INSTALLATION_ID_PATTERN = /^min_[a-f0-9]{32}$/;
|
|
30477
|
-
var IDENTIFIER_PATTERN4 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
|
|
30478
30615
|
var RUNTIME_CREDENTIAL_PATTERN = /^[a-zA-Z0-9_-]{32,256}$/;
|
|
30479
30616
|
var MAX_FILE_LENGTH = 16 * 1024;
|
|
30480
30617
|
var INSTALLATION_POINTER_KEYS = ["installationId", "version"];
|
|
@@ -30552,7 +30689,7 @@ function validateApplicationId(value) {
|
|
|
30552
30689
|
return value;
|
|
30553
30690
|
}
|
|
30554
30691
|
function validateRemoteAppId(value) {
|
|
30555
|
-
if (!
|
|
30692
|
+
if (!isIdentifier(value)) {
|
|
30556
30693
|
throw new RuntimeInstallationStoreError("invalid_app_id", "The remote App ID is invalid");
|
|
30557
30694
|
}
|
|
30558
30695
|
return value;
|
|
@@ -30570,7 +30707,7 @@ function validateInstallationId(value) {
|
|
|
30570
30707
|
return value;
|
|
30571
30708
|
}
|
|
30572
30709
|
function validateIdentifier(value, code) {
|
|
30573
|
-
if (!
|
|
30710
|
+
if (!isIdentifier(value)) {
|
|
30574
30711
|
throw new RuntimeInstallationStoreError(code, "The saved Runtime connection is invalid");
|
|
30575
30712
|
}
|
|
30576
30713
|
return value;
|
|
@@ -30974,7 +31111,6 @@ async function openRuntimeInstallationStore(options, signal) {
|
|
|
30974
31111
|
// src/pairing/pair-local-machine.ts
|
|
30975
31112
|
var PAIRING_TIMEOUT_MILLISECONDS = 2e4;
|
|
30976
31113
|
var PAIRING_CODE_PATTERN = /^[A-HJ-NP-Z2-9]{4}(?:-[A-HJ-NP-Z2-9]{4}){4}$/;
|
|
30977
|
-
var IDENTIFIER_PATTERN5 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
|
|
30978
31114
|
var TOKEN_PATTERN = /^[a-zA-Z0-9_-]{32,256}$/;
|
|
30979
31115
|
var CLAIM_RESPONSE_KEYS = ["appId", "channelId", "daemonToken", "runtimeId"];
|
|
30980
31116
|
var REDEEM_RESPONSE_KEYS = ["appId", "channelId", "runtimeCredential", "runtimeId"];
|
|
@@ -31061,7 +31197,7 @@ function parsePairCommand(arguments_, defaultWorkspace) {
|
|
|
31061
31197
|
};
|
|
31062
31198
|
}
|
|
31063
31199
|
function validatePairingId(value) {
|
|
31064
|
-
if (!
|
|
31200
|
+
if (!isIdentifier(value)) {
|
|
31065
31201
|
throw new PairingClientError("invalid_pairing_id", "The Runtime pairing ID is invalid");
|
|
31066
31202
|
}
|
|
31067
31203
|
return value;
|
|
@@ -31130,7 +31266,7 @@ function decodePairingResponse(value, credentialField, expectedKeys) {
|
|
|
31130
31266
|
const channelId = value["channelId"];
|
|
31131
31267
|
const runtimeCredential2 = value[credentialField];
|
|
31132
31268
|
const runtimeId = value["runtimeId"];
|
|
31133
|
-
if (typeof appId !== "string" || !
|
|
31269
|
+
if (typeof appId !== "string" || !isIdentifier(appId) || typeof channelId !== "string" || !isIdentifier(channelId) || typeof runtimeCredential2 !== "string" || !TOKEN_PATTERN.test(runtimeCredential2) || typeof runtimeId !== "string" || !isIdentifier(runtimeId)) {
|
|
31134
31270
|
throw new PairingClientError("invalid_relay_response", "The relay returned an invalid pairing response");
|
|
31135
31271
|
}
|
|
31136
31272
|
return { appId, channelId, runtimeCredential: runtimeCredential2, runtimeId };
|
|
@@ -31808,7 +31944,6 @@ var ARTIFACT_SCHEME = "mobius-artifact:";
|
|
|
31808
31944
|
var ARTIFACT_DOWNLOAD_TIMEOUT_MILLISECONDS = 2e4;
|
|
31809
31945
|
var MAX_AGENT_IMAGE_BASE64_LENGTH = 4e6;
|
|
31810
31946
|
var MAX_AGENT_RESOURCE_BYTE_LENGTH = 1e6;
|
|
31811
|
-
var IDENTIFIER_PATTERN6 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
|
|
31812
31947
|
var PromptArtifactError = class extends Error {
|
|
31813
31948
|
code;
|
|
31814
31949
|
constructor(code, message, options = {}) {
|
|
@@ -31851,7 +31986,7 @@ function parseReference(resource) {
|
|
|
31851
31986
|
const encodedByteLength2 = url2.searchParams.get("byteLength") ?? "";
|
|
31852
31987
|
const sha256 = url2.searchParams.get("sha256") ?? "";
|
|
31853
31988
|
const byteLength = Number(encodedByteLength2);
|
|
31854
|
-
if (url2.protocol !== ARTIFACT_SCHEME || url2.hash.length > 0 || resource.type !== "link" || resource.text.length > 0 || !
|
|
31989
|
+
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)) {
|
|
31855
31990
|
throw new PromptArtifactError("artifact_reference_invalid", "The prompt artifact reference is invalid");
|
|
31856
31991
|
}
|
|
31857
31992
|
return new PromptArtifactReference(artifactId, byteLength, sha256, resource);
|
|
@@ -32554,7 +32689,7 @@ async function executeSessionConfigure(publisher, socket, command, config2, dire
|
|
|
32554
32689
|
reportOperationFailure(socket, command.requestId, command.sessionId, error62);
|
|
32555
32690
|
}
|
|
32556
32691
|
}
|
|
32557
|
-
async function executePrompt(operations, publisher, command, config2, directories, audit, sessions, attemptId, activateAttempt, waitForSessionAvailability, timer, signal, recordLiveText, cancellationRequested) {
|
|
32692
|
+
async function executePrompt(operations, publisher, command, config2, directories, audit, sessions, attemptId, activateAttempt, acknowledgeQueued, waitForSessionAvailability, timer, signal, recordLiveText, cancellationRequested) {
|
|
32558
32693
|
const activities = new CoalescingDaemonActivityPublisher(timer, (activity2) => {
|
|
32559
32694
|
publisher.publish(command.sessionId, daemonActivity(command, activity2));
|
|
32560
32695
|
});
|
|
@@ -32592,6 +32727,9 @@ async function executePrompt(operations, publisher, command, config2, directorie
|
|
|
32592
32727
|
AGENT_TEXT_MAXIMUM_LENGTH
|
|
32593
32728
|
);
|
|
32594
32729
|
try {
|
|
32730
|
+
if (command.disposition === SessionPromptDisposition.Queue) {
|
|
32731
|
+
acknowledgeQueued();
|
|
32732
|
+
}
|
|
32595
32733
|
const resolved = await resolveSessionDirectories(
|
|
32596
32734
|
directories,
|
|
32597
32735
|
command.bindingId,
|
|
@@ -32601,10 +32739,10 @@ async function executePrompt(operations, publisher, command, config2, directorie
|
|
|
32601
32739
|
);
|
|
32602
32740
|
const agent = config2.catalog.find(command.agentId);
|
|
32603
32741
|
const availability = await waitForSessionAvailability(signal);
|
|
32604
|
-
if (availability === "busy") {
|
|
32742
|
+
if (availability.kind === "busy") {
|
|
32605
32743
|
throw new AcpExecutionError("Another prompt is already running in this conversation", {}, "session_busy");
|
|
32606
32744
|
}
|
|
32607
|
-
if (availability === "queue-target-unavailable") {
|
|
32745
|
+
if (availability.kind === "queue-target-unavailable") {
|
|
32608
32746
|
throw new AcpExecutionError(
|
|
32609
32747
|
"The queued prompt target is unavailable",
|
|
32610
32748
|
{},
|
|
@@ -32622,7 +32760,7 @@ async function executePrompt(operations, publisher, command, config2, directorie
|
|
|
32622
32760
|
sessionId: command.sessionId,
|
|
32623
32761
|
signal
|
|
32624
32762
|
});
|
|
32625
|
-
if (
|
|
32763
|
+
if (availability.disposition === SessionPromptDisposition.Steer) {
|
|
32626
32764
|
assertAppliedSessionConfiguration(prepared.configOptions, sessionConfigurations ?? []);
|
|
32627
32765
|
} else {
|
|
32628
32766
|
await applyCompleteSessionConfiguration(
|
|
@@ -32657,7 +32795,7 @@ async function executePrompt(operations, publisher, command, config2, directorie
|
|
|
32657
32795
|
});
|
|
32658
32796
|
const attachments = await resolvePromptArtifacts(config2, command, signal);
|
|
32659
32797
|
let stopReason;
|
|
32660
|
-
if (
|
|
32798
|
+
if (availability.disposition === SessionPromptDisposition.Steer) {
|
|
32661
32799
|
await sessions.steerPrompt({
|
|
32662
32800
|
additionalDirectories: resolved.additionalDirectories,
|
|
32663
32801
|
agent: executionAgent,
|
|
@@ -32677,7 +32815,7 @@ async function executePrompt(operations, publisher, command, config2, directorie
|
|
|
32677
32815
|
agent: executionAgent,
|
|
32678
32816
|
commandId: command.commandId,
|
|
32679
32817
|
cwd: resolved.cwd,
|
|
32680
|
-
disposition:
|
|
32818
|
+
disposition: availability.disposition,
|
|
32681
32819
|
images: attachments.images,
|
|
32682
32820
|
onActivity: activities.record,
|
|
32683
32821
|
onNarration: (increment) => {
|
|
@@ -34244,25 +34382,42 @@ var ActiveDaemonTurn = class {
|
|
|
34244
34382
|
#controller;
|
|
34245
34383
|
#finished = Promise.withResolvers();
|
|
34246
34384
|
#cancellationRequested = false;
|
|
34247
|
-
#
|
|
34385
|
+
#dispatch;
|
|
34248
34386
|
#text = "";
|
|
34249
34387
|
#truncated = false;
|
|
34250
34388
|
#sequence = 0;
|
|
34251
34389
|
#interaction = null;
|
|
34252
|
-
#epoch = randomUUID3();
|
|
34390
|
+
#epoch = decodeIdentifier(randomUUID3());
|
|
34253
34391
|
constructor(command, attemptId) {
|
|
34254
34392
|
this.attemptId = attemptId;
|
|
34255
34393
|
this.command = command;
|
|
34256
34394
|
this.#controller = new AbortController();
|
|
34395
|
+
this.#dispatch = command.disposition === SessionPromptDisposition.Queue ? { kind: "queued", promotion: Promise.withResolvers() } : { kind: "pending" };
|
|
34257
34396
|
}
|
|
34258
34397
|
abortDaemon = () => {
|
|
34259
34398
|
this.#controller.abort();
|
|
34260
34399
|
};
|
|
34261
34400
|
finish = () => this.#finished.resolve();
|
|
34262
34401
|
accept = () => {
|
|
34263
|
-
this.#
|
|
34402
|
+
this.#dispatch = { kind: "accepted" };
|
|
34264
34403
|
return { epoch: this.#epoch, sequence: 0 };
|
|
34265
34404
|
};
|
|
34405
|
+
promoteQueuedPrompt = (command) => {
|
|
34406
|
+
if (command.commandId !== this.command.commandId || command.sessionId !== this.command.sessionId || this.#dispatch.kind !== "queued") {
|
|
34407
|
+
return false;
|
|
34408
|
+
}
|
|
34409
|
+
const promotion = this.#dispatch.promotion;
|
|
34410
|
+
this.#dispatch = { kind: "promoted" };
|
|
34411
|
+
promotion.resolve();
|
|
34412
|
+
return true;
|
|
34413
|
+
};
|
|
34414
|
+
queuePromotion = () => {
|
|
34415
|
+
if (this.#dispatch.kind === "queued") {
|
|
34416
|
+
return this.#dispatch.promotion.promise;
|
|
34417
|
+
}
|
|
34418
|
+
return this.#dispatch.kind === "promoted" ? Promise.resolve() : null;
|
|
34419
|
+
};
|
|
34420
|
+
effectiveDisposition = () => this.#dispatch.kind === "promoted" ? SessionPromptDisposition.Steer : this.command.disposition;
|
|
34266
34421
|
recordText = (delta) => {
|
|
34267
34422
|
this.#sequence += 1;
|
|
34268
34423
|
this.#text += delta;
|
|
@@ -34284,8 +34439,8 @@ var ActiveDaemonTurn = class {
|
|
|
34284
34439
|
this.#interaction = null;
|
|
34285
34440
|
}
|
|
34286
34441
|
};
|
|
34287
|
-
snapshot = () => this.#accepted ? {
|
|
34288
|
-
commandId: this.command.commandId,
|
|
34442
|
+
snapshot = () => this.#dispatch.kind === "accepted" ? {
|
|
34443
|
+
commandId: decodeIdentifier(this.command.commandId),
|
|
34289
34444
|
prompt: this.command.prompt,
|
|
34290
34445
|
text: this.#text,
|
|
34291
34446
|
truncated: this.#truncated,
|
|
@@ -34300,7 +34455,7 @@ var ActiveDaemonTurn = class {
|
|
|
34300
34455
|
return "already-requested";
|
|
34301
34456
|
}
|
|
34302
34457
|
this.#cancellationRequested = true;
|
|
34303
|
-
if (
|
|
34458
|
+
if (this.#dispatch.kind !== "accepted") {
|
|
34304
34459
|
this.#controller.abort(new Error("The queued Agent turn was cancelled"));
|
|
34305
34460
|
return "pending";
|
|
34306
34461
|
}
|
|
@@ -35055,7 +35210,7 @@ var NativeSessionService = class {
|
|
|
35055
35210
|
return {
|
|
35056
35211
|
action: "create",
|
|
35057
35212
|
kind: "native.session.result",
|
|
35058
|
-
nativeSessionId,
|
|
35213
|
+
nativeSessionId: decodeIdentifier(nativeSessionId),
|
|
35059
35214
|
requestId: command.requestId,
|
|
35060
35215
|
sessionId: command.sessionId
|
|
35061
35216
|
};
|
|
@@ -35075,7 +35230,7 @@ var NativeSessionService = class {
|
|
|
35075
35230
|
if (authorized === null) {
|
|
35076
35231
|
return null;
|
|
35077
35232
|
}
|
|
35078
|
-
const entryId = randomUUID4();
|
|
35233
|
+
const entryId = decodeIdentifier(randomUUID4());
|
|
35079
35234
|
if (this.#entries.size >= 5e3) {
|
|
35080
35235
|
this.#entries.clear();
|
|
35081
35236
|
}
|
|
@@ -35087,8 +35242,8 @@ var NativeSessionService = class {
|
|
|
35087
35242
|
});
|
|
35088
35243
|
return {
|
|
35089
35244
|
entryId,
|
|
35090
|
-
mobiusSessionIds: this.#sessions.findLinkedSessions(command.agentId, info.sessionId).filter((session) => session.prompted && session.cwd === authorized.cwd).map((session) => session.sessionId),
|
|
35091
|
-
nativeSessionId: info.sessionId,
|
|
35245
|
+
mobiusSessionIds: this.#sessions.findLinkedSessions(command.agentId, info.sessionId).filter((session) => session.prompted && session.cwd === authorized.cwd).map((session) => decodeIdentifier(session.sessionId)),
|
|
35246
|
+
nativeSessionId: decodeIdentifier(info.sessionId),
|
|
35092
35247
|
title: info.title ?? "Untitled session",
|
|
35093
35248
|
directoryId: authorized.directoryId,
|
|
35094
35249
|
directoryLabel: authorized.directoryLabel,
|
|
@@ -35131,7 +35286,7 @@ var NativeSessionService = class {
|
|
|
35131
35286
|
"invalid_native_session_response"
|
|
35132
35287
|
);
|
|
35133
35288
|
}
|
|
35134
|
-
nextCursor = randomUUID4();
|
|
35289
|
+
nextCursor = decodeIdentifier(randomUUID4());
|
|
35135
35290
|
if (this.#cursors.size >= 500) {
|
|
35136
35291
|
this.#cursors.clear();
|
|
35137
35292
|
}
|
|
@@ -35248,7 +35403,7 @@ var NativeSessionService = class {
|
|
|
35248
35403
|
...envelope2,
|
|
35249
35404
|
action: "delete",
|
|
35250
35405
|
entryId: command.entryId,
|
|
35251
|
-
deletedSessionIds
|
|
35406
|
+
deletedSessionIds: deletedSessionIds.map(decodeIdentifier)
|
|
35252
35407
|
};
|
|
35253
35408
|
}
|
|
35254
35409
|
const action = command.action;
|
|
@@ -36084,24 +36239,34 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
36084
36239
|
);
|
|
36085
36240
|
});
|
|
36086
36241
|
};
|
|
36087
|
-
const waitForSessionAvailability = async (command, waitSignal) => {
|
|
36088
|
-
if (
|
|
36089
|
-
return "available";
|
|
36242
|
+
const waitForSessionAvailability = async (command, queuedTurn, waitSignal) => {
|
|
36243
|
+
if (queuedTurn.effectiveDisposition() === SessionPromptDisposition.Steer) {
|
|
36244
|
+
return { disposition: SessionPromptDisposition.Steer, kind: "available" };
|
|
36090
36245
|
}
|
|
36091
36246
|
for (; ; ) {
|
|
36092
36247
|
const first = [...activeTurns.values()].find(
|
|
36093
36248
|
(turn) => turn.command.sessionId === command.sessionId && turn.command.disposition !== SessionPromptDisposition.Steer
|
|
36094
36249
|
);
|
|
36095
36250
|
if (first === void 0 || first.command.commandId === command.commandId) {
|
|
36096
|
-
return command.disposition !== SessionPromptDisposition.Queue || operations.isTerminalExecution(command.targetCommandId, command.sessionId) ? "available" : "queue-target-unavailable";
|
|
36251
|
+
return command.disposition !== SessionPromptDisposition.Queue || operations.isTerminalExecution(command.targetCommandId, command.sessionId) ? { disposition: queuedTurn.effectiveDisposition(), kind: "available" } : { kind: "queue-target-unavailable" };
|
|
36097
36252
|
}
|
|
36098
36253
|
if (command.disposition !== SessionPromptDisposition.Queue) {
|
|
36099
|
-
return "busy";
|
|
36254
|
+
return { kind: "busy" };
|
|
36100
36255
|
}
|
|
36101
36256
|
if (first.command.commandId !== command.targetCommandId) {
|
|
36102
|
-
return "queue-target-unavailable";
|
|
36257
|
+
return { kind: "queue-target-unavailable" };
|
|
36258
|
+
}
|
|
36259
|
+
const promotion = queuedTurn.queuePromotion();
|
|
36260
|
+
if (promotion === null) {
|
|
36261
|
+
throw new Error("The queued prompt cannot be promoted");
|
|
36262
|
+
}
|
|
36263
|
+
const decision = await Promise.race([
|
|
36264
|
+
waitForTurnCompletion(first, waitSignal).then(() => "target-completed"),
|
|
36265
|
+
promotion.then(() => "promoted")
|
|
36266
|
+
]);
|
|
36267
|
+
if (decision === "promoted") {
|
|
36268
|
+
return { disposition: SessionPromptDisposition.Steer, kind: "available" };
|
|
36103
36269
|
}
|
|
36104
|
-
await waitForTurnCompletion(first, waitSignal);
|
|
36105
36270
|
}
|
|
36106
36271
|
};
|
|
36107
36272
|
const connectionLiveness = new RelayConnectionLiveness(timer, {
|
|
@@ -36254,6 +36419,19 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
36254
36419
|
});
|
|
36255
36420
|
return;
|
|
36256
36421
|
}
|
|
36422
|
+
if (kind === SESSION_PROMPT_DISPOSITION_KIND) {
|
|
36423
|
+
const disposition = message;
|
|
36424
|
+
const turn2 = activeTurns.get(disposition.commandId);
|
|
36425
|
+
if (turn2 === void 0 || !turn2.promoteQueuedPrompt(disposition)) {
|
|
36426
|
+
reportOperationFailure(
|
|
36427
|
+
socket,
|
|
36428
|
+
disposition.commandId,
|
|
36429
|
+
disposition.sessionId,
|
|
36430
|
+
new Error("The queued prompt is unavailable")
|
|
36431
|
+
);
|
|
36432
|
+
}
|
|
36433
|
+
return;
|
|
36434
|
+
}
|
|
36257
36435
|
if (kind === WORKSPACE_LIST_KIND) {
|
|
36258
36436
|
const command2 = message;
|
|
36259
36437
|
void executeWorkspaceList(socket, command2, directories, audit, connectionController.signal);
|
|
@@ -36363,7 +36541,12 @@ async function runRelayConnection(config2, directories, audit, sessions, install
|
|
|
36363
36541
|
sessions,
|
|
36364
36542
|
receipt.attemptId,
|
|
36365
36543
|
turn.accept,
|
|
36366
|
-
(
|
|
36544
|
+
() => send(socket, {
|
|
36545
|
+
commandId: command.commandId,
|
|
36546
|
+
kind: SESSION_QUEUED_KIND,
|
|
36547
|
+
sessionId: command.sessionId
|
|
36548
|
+
}),
|
|
36549
|
+
(waitSignal) => waitForSessionAvailability(command, turn, waitSignal),
|
|
36367
36550
|
timer,
|
|
36368
36551
|
turn.signal,
|
|
36369
36552
|
turn.recordText,
|
|
@@ -36622,7 +36805,6 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
36622
36805
|
// src/runtime.ts
|
|
36623
36806
|
import { mkdir as mkdir6, realpath as realpath10, stat as stat9 } from "node:fs/promises";
|
|
36624
36807
|
import { resolve as resolve7 } from "node:path";
|
|
36625
|
-
var IDENTIFIER_PATTERN7 = /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/;
|
|
36626
36808
|
var RUNTIME_CREDENTIAL_PATTERN2 = /^[a-zA-Z0-9_-]{32,256}$/;
|
|
36627
36809
|
var MobiusRuntimeConfigurationError = class extends Error {
|
|
36628
36810
|
code = "runtime_configuration_invalid";
|
|
@@ -36674,7 +36856,7 @@ function relayUrlFromConnection(connection) {
|
|
|
36674
36856
|
}
|
|
36675
36857
|
function loadMobiusRuntimeConnection(environment = process.env) {
|
|
36676
36858
|
const channelId = requiredEnvironmentValue(environment, "MOBIUS_CHANNEL_ID");
|
|
36677
|
-
if (!
|
|
36859
|
+
if (!isIdentifier(channelId)) {
|
|
36678
36860
|
throw new MobiusRuntimeConfigurationError("MOBIUS_CHANNEL_ID is invalid");
|
|
36679
36861
|
}
|
|
36680
36862
|
return Object.freeze({
|