@moxt-ai/mobius 0.0.165 → 0.0.167
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/agent-query-processes.d.ts +2 -1
- package/dist/acp/agent-query-processes.d.ts.map +1 -1
- package/dist/acp/agent-query-processes.js +6 -4
- package/dist/acp/agent-query-processes.js.map +1 -1
- package/dist/acp/agent-runtime-manager.d.ts +2 -1
- package/dist/acp/agent-runtime-manager.d.ts.map +1 -1
- package/dist/acp/agent-runtime-manager.js +11 -6
- package/dist/acp/agent-runtime-manager.js.map +1 -1
- package/dist/acp/agent-session.d.ts +3 -2
- package/dist/acp/agent-session.d.ts.map +1 -1
- package/dist/acp/agent-session.js +9 -6
- package/dist/acp/agent-session.js.map +1 -1
- package/dist/artifacts/local-file-streamer.d.ts +2 -1
- package/dist/artifacts/local-file-streamer.d.ts.map +1 -1
- package/dist/artifacts/local-file-streamer.js +6 -5
- package/dist/artifacts/local-file-streamer.js.map +1 -1
- package/dist/cli.js +585 -327
- package/dist/cli.js.map +4 -4
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/dist/daemon-command-handler.d.ts +3 -1
- package/dist/daemon-command-handler.d.ts.map +1 -1
- package/dist/daemon-command-handler.js +2 -2
- package/dist/daemon-command-handler.js.map +1 -1
- package/dist/external-content/acp-content-externalizer.d.ts +8 -0
- package/dist/external-content/acp-content-externalizer.d.ts.map +1 -0
- package/dist/external-content/acp-content-externalizer.js +131 -0
- package/dist/external-content/acp-content-externalizer.js.map +1 -0
- package/dist/external-content/local-external-content-store.d.ts +32 -0
- package/dist/external-content/local-external-content-store.d.ts.map +1 -0
- package/dist/external-content/local-external-content-store.js +88 -0
- package/dist/external-content/local-external-content-store.js.map +1 -0
- package/dist/index.js +643 -391
- package/dist/index.js.map +4 -4
- package/dist/relay-connection/run-relay-connection.d.ts +3 -1
- package/dist/relay-connection/run-relay-connection.d.ts.map +1 -1
- package/dist/relay-connection/run-relay-connection.js +11 -2
- package/dist/relay-connection/run-relay-connection.js.map +1 -1
- package/dist/run-daemon.d.ts.map +1 -1
- package/dist/run-daemon.js +5 -1
- package/dist/run-daemon.js.map +1 -1
- package/dist/runtime.d.ts +2 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +584 -331
- package/dist/runtime.js.map +4 -4
- package/package.json +16 -10
package/dist/index.js
CHANGED
|
@@ -19827,61 +19827,61 @@ var DIRECTORY_IDENTIFIER_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/;
|
|
|
19827
19827
|
var DIRECTORY_IDENTIFIER = external_exports.string().min(1).max(2048).regex(DIRECTORY_IDENTIFIER_PATTERN);
|
|
19828
19828
|
var SHORT_TEXT = external_exports.string().max(500);
|
|
19829
19829
|
var LONG_TEXT = external_exports.string().max(1e5);
|
|
19830
|
-
var workspaceEntrySchema = external_exports.
|
|
19830
|
+
var workspaceEntrySchema = external_exports.object({
|
|
19831
19831
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
19832
19832
|
name: external_exports.string().min(1).max(255)
|
|
19833
19833
|
}).readonly();
|
|
19834
19834
|
var sessionStatusSchema = external_exports.discriminatedUnion("kind", [
|
|
19835
|
-
external_exports.
|
|
19836
|
-
external_exports.
|
|
19835
|
+
external_exports.object({ kind: external_exports.literal("idle") }).readonly(),
|
|
19836
|
+
external_exports.object({
|
|
19837
19837
|
commandId: identifierStringSchema,
|
|
19838
19838
|
kind: external_exports.literal("working")
|
|
19839
19839
|
}).readonly()
|
|
19840
19840
|
]);
|
|
19841
|
-
var sessionStatusChangedEventSchema = external_exports.
|
|
19841
|
+
var sessionStatusChangedEventSchema = external_exports.object({
|
|
19842
19842
|
kind: external_exports.literal(SESSION_STATUS_CHANGED_KIND),
|
|
19843
19843
|
sessionId: identifierStringSchema,
|
|
19844
19844
|
status: sessionStatusSchema
|
|
19845
19845
|
}).readonly();
|
|
19846
|
-
var sessionMetadataSchema = external_exports.
|
|
19846
|
+
var sessionMetadataSchema = external_exports.object({
|
|
19847
19847
|
additionalDirectories: external_exports.array(workspaceEntrySchema).max(16).readonly(),
|
|
19848
19848
|
agentId: identifierStringSchema,
|
|
19849
19849
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
19850
19850
|
directoryLabel: external_exports.string().min(1).max(2048),
|
|
19851
19851
|
prompted: external_exports.boolean(),
|
|
19852
19852
|
sessionId: identifierStringSchema,
|
|
19853
|
-
status: sessionStatusSchema,
|
|
19853
|
+
status: sessionStatusSchema.default({ kind: "idle" }),
|
|
19854
19854
|
title: external_exports.string().max(500),
|
|
19855
19855
|
updatedAt: external_exports.iso.datetime({ offset: true })
|
|
19856
19856
|
}).readonly();
|
|
19857
|
-
var sessionListCommandSchema = external_exports.
|
|
19857
|
+
var sessionListCommandSchema = external_exports.object({
|
|
19858
19858
|
kind: external_exports.literal(SESSION_LIST_KIND),
|
|
19859
19859
|
limit: external_exports.number().int().positive().max(500),
|
|
19860
19860
|
requestId: identifierStringSchema
|
|
19861
19861
|
}).readonly();
|
|
19862
|
-
var sessionsListedEventSchema = external_exports.
|
|
19862
|
+
var sessionsListedEventSchema = external_exports.object({
|
|
19863
19863
|
entries: external_exports.array(sessionMetadataSchema).max(500).readonly(),
|
|
19864
19864
|
kind: external_exports.literal(SESSION_LISTED_KIND),
|
|
19865
19865
|
requestId: identifierStringSchema
|
|
19866
19866
|
}).readonly();
|
|
19867
|
-
var sessionQueryCommandSchema = external_exports.
|
|
19867
|
+
var sessionQueryCommandSchema = external_exports.object({
|
|
19868
19868
|
kind: external_exports.literal(SESSION_QUERY_KIND),
|
|
19869
19869
|
requestId: identifierStringSchema,
|
|
19870
19870
|
sessionIds: external_exports.array(identifierStringSchema).min(1).max(500).readonly()
|
|
19871
19871
|
}).readonly();
|
|
19872
|
-
var sessionsQueriedEventSchema = external_exports.
|
|
19872
|
+
var sessionsQueriedEventSchema = external_exports.object({
|
|
19873
19873
|
entries: external_exports.array(sessionMetadataSchema).max(500).readonly(),
|
|
19874
19874
|
kind: external_exports.literal(SESSION_QUERIED_KIND),
|
|
19875
19875
|
requestId: identifierStringSchema
|
|
19876
19876
|
}).readonly();
|
|
19877
|
-
var fileReadCommandSchema = external_exports.
|
|
19877
|
+
var fileReadCommandSchema = external_exports.object({
|
|
19878
19878
|
kind: external_exports.literal(FILE_READ_KIND),
|
|
19879
19879
|
maxBytes: external_exports.number().int().positive().max(128 * 1024 * 1024),
|
|
19880
19880
|
requestId: identifierStringSchema,
|
|
19881
19881
|
sessionId: identifierStringSchema,
|
|
19882
19882
|
path: external_exports.string().min(1).max(4096)
|
|
19883
19883
|
}).readonly();
|
|
19884
|
-
var fileBeginEventSchema = external_exports.
|
|
19884
|
+
var fileBeginEventSchema = external_exports.object({
|
|
19885
19885
|
byteLength: external_exports.number().int().positive().max(128 * 1024 * 1024),
|
|
19886
19886
|
kind: external_exports.literal(FILE_BEGIN_KIND),
|
|
19887
19887
|
mediaType: external_exports.string().min(1).max(255),
|
|
@@ -19890,26 +19890,26 @@ var fileBeginEventSchema = external_exports.strictObject({
|
|
|
19890
19890
|
requestId: identifierStringSchema,
|
|
19891
19891
|
sessionId: identifierStringSchema
|
|
19892
19892
|
}).readonly();
|
|
19893
|
-
var fileChunkEventSchema = external_exports.
|
|
19893
|
+
var fileChunkEventSchema = external_exports.object({
|
|
19894
19894
|
data: external_exports.string().min(1).max(4e5),
|
|
19895
19895
|
kind: external_exports.literal(FILE_CHUNK_KIND),
|
|
19896
19896
|
requestId: identifierStringSchema,
|
|
19897
19897
|
sequence: external_exports.number().int().nonnegative().max(1024),
|
|
19898
19898
|
sessionId: identifierStringSchema
|
|
19899
19899
|
}).readonly();
|
|
19900
|
-
var fileEndEventSchema = external_exports.
|
|
19900
|
+
var fileEndEventSchema = external_exports.object({
|
|
19901
19901
|
kind: external_exports.literal(FILE_END_KIND),
|
|
19902
19902
|
requestId: identifierStringSchema,
|
|
19903
19903
|
sessionId: identifierStringSchema
|
|
19904
19904
|
}).readonly();
|
|
19905
|
-
var fileFailedEventSchema = external_exports.
|
|
19905
|
+
var fileFailedEventSchema = external_exports.object({
|
|
19906
19906
|
code: identifierStringSchema,
|
|
19907
19907
|
kind: external_exports.literal(FILE_FAILED_KIND),
|
|
19908
19908
|
message: external_exports.string().min(1).max(500),
|
|
19909
19909
|
requestId: identifierStringSchema,
|
|
19910
19910
|
sessionId: identifierStringSchema
|
|
19911
19911
|
}).readonly();
|
|
19912
|
-
var configValueSchema = external_exports.
|
|
19912
|
+
var configValueSchema = external_exports.object({
|
|
19913
19913
|
description: SHORT_TEXT,
|
|
19914
19914
|
groupId: external_exports.string().max(128),
|
|
19915
19915
|
groupName: external_exports.string().max(255),
|
|
@@ -19920,7 +19920,7 @@ var configValueSchema = external_exports.strictObject({
|
|
|
19920
19920
|
// by length alone.
|
|
19921
19921
|
value: external_exports.string().max(500)
|
|
19922
19922
|
}).readonly();
|
|
19923
|
-
var sessionConfigOptionSchema = external_exports.
|
|
19923
|
+
var sessionConfigOptionSchema = external_exports.object({
|
|
19924
19924
|
booleanValue: external_exports.boolean(),
|
|
19925
19925
|
category: external_exports.string().max(128),
|
|
19926
19926
|
currentValue: external_exports.string().max(500),
|
|
@@ -19931,7 +19931,7 @@ var sessionConfigOptionSchema = external_exports.strictObject({
|
|
|
19931
19931
|
values: external_exports.array(configValueSchema).max(500).readonly()
|
|
19932
19932
|
}).readonly();
|
|
19933
19933
|
var sessionConfigOptionsSchema = external_exports.array(sessionConfigOptionSchema).max(100).readonly();
|
|
19934
|
-
var agentSettingSchema = external_exports.
|
|
19934
|
+
var agentSettingSchema = external_exports.object({
|
|
19935
19935
|
booleanValue: external_exports.boolean(),
|
|
19936
19936
|
category: external_exports.string().max(128),
|
|
19937
19937
|
defaultValue: external_exports.string().max(500),
|
|
@@ -19950,20 +19950,20 @@ var agentModelEffortResolutionSchema = external_exports.enum([
|
|
|
19950
19950
|
AGENT_MODEL_EFFORT_RESOLUTION_ON_MODEL_SELECTION,
|
|
19951
19951
|
AGENT_MODEL_EFFORT_RESOLUTION_UNAVAILABLE
|
|
19952
19952
|
]);
|
|
19953
|
-
var agentModelEffortSchema = external_exports.
|
|
19953
|
+
var agentModelEffortSchema = external_exports.object({
|
|
19954
19954
|
effortSettingId: external_exports.string().max(128),
|
|
19955
19955
|
modelSettingId: external_exports.string().max(128),
|
|
19956
19956
|
resolution: agentModelEffortResolutionSchema,
|
|
19957
19957
|
unsupportedModelIds: external_exports.array(external_exports.string().min(1).max(500)).max(500).readonly().default([]),
|
|
19958
19958
|
valuesByModel: external_exports.record(external_exports.string().min(1).max(500), external_exports.array(configValueSchema).max(500).readonly()).readonly()
|
|
19959
19959
|
}).readonly();
|
|
19960
|
-
var agentSettingsDiscoverCommandSchema = external_exports.
|
|
19960
|
+
var agentSettingsDiscoverCommandSchema = external_exports.object({
|
|
19961
19961
|
agentId: identifierStringSchema,
|
|
19962
19962
|
kind: external_exports.literal(AGENT_SETTINGS_DISCOVER_KIND),
|
|
19963
19963
|
model: external_exports.string().min(1).max(500).optional(),
|
|
19964
19964
|
requestId: identifierStringSchema
|
|
19965
19965
|
}).readonly();
|
|
19966
|
-
var agentSettingsDiscoveredEventSchema = external_exports.
|
|
19966
|
+
var agentSettingsDiscoveredEventSchema = external_exports.object({
|
|
19967
19967
|
agentId: identifierStringSchema,
|
|
19968
19968
|
agentName: external_exports.string().max(255),
|
|
19969
19969
|
agentVersion: external_exports.string().max(128),
|
|
@@ -19973,27 +19973,27 @@ var agentSettingsDiscoveredEventSchema = external_exports.strictObject({
|
|
|
19973
19973
|
settings: agentSettingsSchema,
|
|
19974
19974
|
settingsRevision: external_exports.string().regex(/^[a-f0-9]{64}$/)
|
|
19975
19975
|
}).readonly();
|
|
19976
|
-
var agentSettingsDiscoveryFailedEventSchema = external_exports.
|
|
19976
|
+
var agentSettingsDiscoveryFailedEventSchema = external_exports.object({
|
|
19977
19977
|
code: identifierStringSchema,
|
|
19978
19978
|
kind: external_exports.literal(AGENT_SETTINGS_DISCOVERY_FAILED_KIND),
|
|
19979
19979
|
message: external_exports.string().min(1).max(500),
|
|
19980
19980
|
requestId: identifierStringSchema
|
|
19981
19981
|
}).readonly();
|
|
19982
|
-
var agentCatalogRefreshCommandSchema = external_exports.
|
|
19982
|
+
var agentCatalogRefreshCommandSchema = external_exports.object({
|
|
19983
19983
|
kind: external_exports.literal(AGENT_CATALOG_REFRESH_KIND),
|
|
19984
19984
|
requestId: identifierStringSchema
|
|
19985
19985
|
}).readonly();
|
|
19986
|
-
var agentCatalogRefreshedEventSchema = external_exports.
|
|
19986
|
+
var agentCatalogRefreshedEventSchema = external_exports.object({
|
|
19987
19987
|
kind: external_exports.literal(AGENT_CATALOG_REFRESHED_KIND),
|
|
19988
19988
|
requestId: identifierStringSchema
|
|
19989
19989
|
}).readonly();
|
|
19990
|
-
var agentCatalogRefreshFailedEventSchema = external_exports.
|
|
19990
|
+
var agentCatalogRefreshFailedEventSchema = external_exports.object({
|
|
19991
19991
|
code: identifierStringSchema,
|
|
19992
19992
|
kind: external_exports.literal(AGENT_CATALOG_REFRESH_FAILED_KIND),
|
|
19993
19993
|
message: external_exports.string().min(1).max(500),
|
|
19994
19994
|
requestId: identifierStringSchema
|
|
19995
19995
|
}).readonly();
|
|
19996
|
-
var sessionConfigurationSelectionSchema = external_exports.
|
|
19996
|
+
var sessionConfigurationSelectionSchema = external_exports.object({
|
|
19997
19997
|
booleanValue: external_exports.boolean(),
|
|
19998
19998
|
configId: identifierStringSchema,
|
|
19999
19999
|
value: external_exports.string().max(500),
|
|
@@ -20007,7 +20007,7 @@ var AGENT_PERMISSION_MODES = Object.freeze([
|
|
|
20007
20007
|
"workspace-write",
|
|
20008
20008
|
"danger-full-access"
|
|
20009
20009
|
]);
|
|
20010
|
-
var agentExecutionConfigurationSchema = external_exports.
|
|
20010
|
+
var agentExecutionConfigurationSchema = external_exports.object({
|
|
20011
20011
|
model: sessionConfigurationSelectionSchema,
|
|
20012
20012
|
permissionMode: external_exports.string().refine((value) => AGENT_PERMISSION_MODES.includes(value)),
|
|
20013
20013
|
reasoningEffort: sessionConfigurationSelectionSchema
|
|
@@ -20051,7 +20051,7 @@ var sessionConfigurationSelectionsSchema = external_exports.array(sessionConfigu
|
|
|
20051
20051
|
identifiers.add(selection.configId);
|
|
20052
20052
|
}
|
|
20053
20053
|
}).readonly();
|
|
20054
|
-
var sessionCapabilitiesSchema = external_exports.
|
|
20054
|
+
var sessionCapabilitiesSchema = external_exports.object({
|
|
20055
20055
|
additionalDirectories: external_exports.boolean(),
|
|
20056
20056
|
audioPrompt: external_exports.boolean(),
|
|
20057
20057
|
closeSession: external_exports.boolean(),
|
|
@@ -20065,22 +20065,22 @@ var sessionCapabilitiesSchema = external_exports.strictObject({
|
|
|
20065
20065
|
steering: external_exports.boolean().default(false),
|
|
20066
20066
|
unstableForkSession: external_exports.boolean().default(false)
|
|
20067
20067
|
}).readonly();
|
|
20068
|
-
var sessionCommandSchema = external_exports.
|
|
20068
|
+
var sessionCommandSchema = external_exports.object({
|
|
20069
20069
|
description: SHORT_TEXT,
|
|
20070
20070
|
inputHint: external_exports.string().max(255),
|
|
20071
20071
|
name: external_exports.string().min(1).max(128)
|
|
20072
20072
|
}).readonly();
|
|
20073
|
-
var permissionOptionSchema = external_exports.
|
|
20073
|
+
var permissionOptionSchema = external_exports.object({
|
|
20074
20074
|
kind: external_exports.enum(["allow_once", "allow_always", "reject_once", "reject_always"]),
|
|
20075
20075
|
name: external_exports.string().min(1).max(255),
|
|
20076
20076
|
optionId: external_exports.string().min(1).max(255)
|
|
20077
20077
|
}).readonly();
|
|
20078
|
-
var elicitationOptionSchema = external_exports.
|
|
20078
|
+
var elicitationOptionSchema = external_exports.object({
|
|
20079
20079
|
description: SHORT_TEXT,
|
|
20080
20080
|
label: external_exports.string().min(1).max(255),
|
|
20081
20081
|
value: external_exports.string().max(500)
|
|
20082
20082
|
}).readonly();
|
|
20083
|
-
var elicitationFieldSchema = external_exports.
|
|
20083
|
+
var elicitationFieldSchema = external_exports.object({
|
|
20084
20084
|
defaultBooleanValue: external_exports.boolean(),
|
|
20085
20085
|
defaultNumberValue: external_exports.number().finite(),
|
|
20086
20086
|
defaultStringValue: external_exports.string().max(1e4),
|
|
@@ -20098,7 +20098,7 @@ var elicitationFieldSchema = external_exports.strictObject({
|
|
|
20098
20098
|
title: external_exports.string().min(1).max(255),
|
|
20099
20099
|
type: external_exports.enum(["boolean", "integer", "multiselect", "number", "select", "string"])
|
|
20100
20100
|
}).readonly();
|
|
20101
|
-
var displayContentSchema = external_exports.
|
|
20101
|
+
var displayContentSchema = external_exports.object({
|
|
20102
20102
|
artifactId: external_exports.string().max(128).default(""),
|
|
20103
20103
|
data: external_exports.string().max(4e6),
|
|
20104
20104
|
mimeType: external_exports.string().max(255),
|
|
@@ -20111,7 +20111,7 @@ var displayContentSchema = external_exports.strictObject({
|
|
|
20111
20111
|
type: external_exports.enum(["diff", "image", "resource", "resource_link", "terminal", "text", "video"]),
|
|
20112
20112
|
uri: external_exports.string().max(4096)
|
|
20113
20113
|
}).readonly();
|
|
20114
|
-
var recordedDisplayContentSchema = external_exports.
|
|
20114
|
+
var recordedDisplayContentSchema = external_exports.object({
|
|
20115
20115
|
artifactId: external_exports.string().max(128).default(""),
|
|
20116
20116
|
data: external_exports.string().max(4e6),
|
|
20117
20117
|
mimeType: external_exports.string().max(255),
|
|
@@ -20124,25 +20124,25 @@ var recordedDisplayContentSchema = external_exports.strictObject({
|
|
|
20124
20124
|
type: external_exports.enum(["diff", "image", "resource", "resource_link", "terminal", "text", "video"]),
|
|
20125
20125
|
uri: external_exports.string().max(4096)
|
|
20126
20126
|
}).readonly();
|
|
20127
|
-
var promptImageSchema = external_exports.
|
|
20127
|
+
var promptImageSchema = external_exports.object({
|
|
20128
20128
|
data: external_exports.string().min(1).max(4e6),
|
|
20129
20129
|
mimeType: external_exports.string().min(1).max(255),
|
|
20130
20130
|
name: external_exports.string().min(1).max(500)
|
|
20131
20131
|
}).readonly();
|
|
20132
|
-
var promptResourceSchema = external_exports.
|
|
20132
|
+
var promptResourceSchema = external_exports.object({
|
|
20133
20133
|
mimeType: external_exports.string().max(255),
|
|
20134
20134
|
name: external_exports.string().min(1).max(500),
|
|
20135
20135
|
text: external_exports.string().max(1e6),
|
|
20136
20136
|
type: external_exports.enum(["embedded", "link"]),
|
|
20137
20137
|
uri: external_exports.string().min(1).max(4096)
|
|
20138
20138
|
}).readonly();
|
|
20139
|
-
var workspaceListCommandSchema = external_exports.
|
|
20139
|
+
var workspaceListCommandSchema = external_exports.object({
|
|
20140
20140
|
bindingId: identifierStringSchema,
|
|
20141
20141
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
20142
20142
|
kind: external_exports.literal(WORKSPACE_LIST_KIND),
|
|
20143
20143
|
requestId: identifierStringSchema
|
|
20144
20144
|
}).readonly();
|
|
20145
|
-
var workspaceEntriesEventSchema = external_exports.
|
|
20145
|
+
var workspaceEntriesEventSchema = external_exports.object({
|
|
20146
20146
|
bindingId: identifierStringSchema,
|
|
20147
20147
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
20148
20148
|
directoryLabel: external_exports.string().min(1).max(2048),
|
|
@@ -20158,9 +20158,9 @@ var sessionIdentityFields = {
|
|
|
20158
20158
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
20159
20159
|
sessionId: identifierStringSchema
|
|
20160
20160
|
};
|
|
20161
|
-
var sessionPrepareCommandSchema = external_exports.
|
|
20161
|
+
var sessionPrepareCommandSchema = external_exports.object({
|
|
20162
20162
|
...sessionIdentityFields,
|
|
20163
|
-
configuration: external_exports.
|
|
20163
|
+
configuration: external_exports.object({
|
|
20164
20164
|
booleanValue: external_exports.boolean(),
|
|
20165
20165
|
configId: external_exports.string().min(1).max(128),
|
|
20166
20166
|
value: external_exports.string().max(500),
|
|
@@ -20181,12 +20181,12 @@ var sessionPrepareCommandSchema = external_exports.strictObject({
|
|
|
20181
20181
|
}
|
|
20182
20182
|
}).readonly();
|
|
20183
20183
|
var runtimeTimingsSchema = external_exports.array(
|
|
20184
|
-
external_exports.
|
|
20184
|
+
external_exports.object({
|
|
20185
20185
|
durationMilliseconds: external_exports.number().finite().nonnegative().max(12e4),
|
|
20186
20186
|
name: external_exports.string().regex(/^[a-z][a-z0-9-]{0,63}$/)
|
|
20187
20187
|
}).readonly()
|
|
20188
20188
|
).max(16).readonly();
|
|
20189
|
-
var sessionReadyEventSchema = external_exports.
|
|
20189
|
+
var sessionReadyEventSchema = external_exports.object({
|
|
20190
20190
|
additionalDirectories: external_exports.array(workspaceEntrySchema).max(16).readonly(),
|
|
20191
20191
|
agentId: identifierStringSchema,
|
|
20192
20192
|
agentName: external_exports.string().max(255),
|
|
@@ -20202,7 +20202,7 @@ var sessionReadyEventSchema = external_exports.strictObject({
|
|
|
20202
20202
|
runtimeTimings: runtimeTimingsSchema.optional(),
|
|
20203
20203
|
sessionId: identifierStringSchema
|
|
20204
20204
|
}).readonly();
|
|
20205
|
-
var sessionConfigureCommandSchema = external_exports.
|
|
20205
|
+
var sessionConfigureCommandSchema = external_exports.object({
|
|
20206
20206
|
...sessionIdentityFields,
|
|
20207
20207
|
booleanValue: external_exports.boolean(),
|
|
20208
20208
|
configId: external_exports.string().min(1).max(128),
|
|
@@ -20211,13 +20211,13 @@ var sessionConfigureCommandSchema = external_exports.strictObject({
|
|
|
20211
20211
|
value: external_exports.string().max(500),
|
|
20212
20212
|
valueType: external_exports.enum(["boolean", "select"])
|
|
20213
20213
|
}).readonly();
|
|
20214
|
-
var sessionConfigUpdatedEventSchema = external_exports.
|
|
20214
|
+
var sessionConfigUpdatedEventSchema = external_exports.object({
|
|
20215
20215
|
configOptions: sessionConfigOptionsSchema,
|
|
20216
20216
|
kind: external_exports.literal(SESSION_CONFIG_UPDATED_KIND),
|
|
20217
20217
|
requestId: identifierStringSchema,
|
|
20218
20218
|
sessionId: identifierStringSchema
|
|
20219
20219
|
}).readonly();
|
|
20220
|
-
var sessionContextUsageUpdatedEventSchema = external_exports.
|
|
20220
|
+
var sessionContextUsageUpdatedEventSchema = external_exports.object({
|
|
20221
20221
|
costAmount: external_exports.number().finite().nonnegative(),
|
|
20222
20222
|
costCurrency: external_exports.string().max(16),
|
|
20223
20223
|
hasCost: external_exports.boolean(),
|
|
@@ -20227,7 +20227,7 @@ var sessionContextUsageUpdatedEventSchema = external_exports.strictObject({
|
|
|
20227
20227
|
source: external_exports.literal("context").default("context"),
|
|
20228
20228
|
used: external_exports.number().int().nonnegative()
|
|
20229
20229
|
}).readonly();
|
|
20230
|
-
var sessionPromptUsageUpdatedEventSchema = external_exports.
|
|
20230
|
+
var sessionPromptUsageUpdatedEventSchema = external_exports.object({
|
|
20231
20231
|
_meta: promptMetadataSchema.nullable(),
|
|
20232
20232
|
commandId: identifierStringSchema,
|
|
20233
20233
|
kind: external_exports.literal(SESSION_USAGE_UPDATED_KIND),
|
|
@@ -20239,18 +20239,18 @@ var sessionUsageUpdatedEventSchema = external_exports.union([
|
|
|
20239
20239
|
sessionContextUsageUpdatedEventSchema,
|
|
20240
20240
|
sessionPromptUsageUpdatedEventSchema
|
|
20241
20241
|
]);
|
|
20242
|
-
var sessionCommandsUpdatedEventSchema = external_exports.
|
|
20242
|
+
var sessionCommandsUpdatedEventSchema = external_exports.object({
|
|
20243
20243
|
commands: external_exports.array(sessionCommandSchema).max(500).readonly(),
|
|
20244
20244
|
kind: external_exports.literal(SESSION_COMMANDS_UPDATED_KIND),
|
|
20245
20245
|
sessionId: identifierStringSchema
|
|
20246
20246
|
}).readonly();
|
|
20247
|
-
var sessionInfoUpdatedEventSchema = external_exports.
|
|
20247
|
+
var sessionInfoUpdatedEventSchema = external_exports.object({
|
|
20248
20248
|
kind: external_exports.literal(SESSION_INFO_UPDATED_KIND),
|
|
20249
20249
|
sessionId: identifierStringSchema,
|
|
20250
20250
|
title: external_exports.string().max(500).nullable(),
|
|
20251
20251
|
updatedAt: external_exports.string().max(128)
|
|
20252
20252
|
}).readonly();
|
|
20253
|
-
var sessionPermissionRequestedEventSchema = external_exports.
|
|
20253
|
+
var sessionPermissionRequestedEventSchema = external_exports.object({
|
|
20254
20254
|
commandId: identifierStringSchema,
|
|
20255
20255
|
interactionId: identifierStringSchema,
|
|
20256
20256
|
kind: external_exports.literal(SESSION_PERMISSION_REQUESTED_KIND),
|
|
@@ -20260,21 +20260,21 @@ var sessionPermissionRequestedEventSchema = external_exports.strictObject({
|
|
|
20260
20260
|
toolCallId: external_exports.string().min(1).max(255),
|
|
20261
20261
|
toolKind: external_exports.string().max(64)
|
|
20262
20262
|
}).readonly();
|
|
20263
|
-
var sessionPermissionRespondCommandSchema = external_exports.
|
|
20263
|
+
var sessionPermissionRespondCommandSchema = external_exports.object({
|
|
20264
20264
|
interactionId: identifierStringSchema,
|
|
20265
20265
|
kind: external_exports.literal(SESSION_PERMISSION_RESPOND_KIND),
|
|
20266
20266
|
optionId: external_exports.string().max(255),
|
|
20267
20267
|
outcome: external_exports.enum(["cancelled", "selected"]),
|
|
20268
20268
|
sessionId: identifierStringSchema
|
|
20269
20269
|
}).readonly();
|
|
20270
|
-
var sessionPermissionResolvedEventSchema = external_exports.
|
|
20270
|
+
var sessionPermissionResolvedEventSchema = external_exports.object({
|
|
20271
20271
|
interactionId: identifierStringSchema,
|
|
20272
20272
|
kind: external_exports.literal(SESSION_PERMISSION_RESOLVED_KIND),
|
|
20273
20273
|
optionId: external_exports.string().max(255),
|
|
20274
20274
|
outcome: external_exports.enum(["cancelled", "selected"]),
|
|
20275
20275
|
sessionId: identifierStringSchema
|
|
20276
20276
|
}).readonly();
|
|
20277
|
-
var sessionElicitationRequestedEventSchema = external_exports.
|
|
20277
|
+
var sessionElicitationRequestedEventSchema = external_exports.object({
|
|
20278
20278
|
accepted: external_exports.boolean(),
|
|
20279
20279
|
commandId: identifierStringSchema,
|
|
20280
20280
|
elicitationId: external_exports.string().max(255),
|
|
@@ -20286,20 +20286,20 @@ var sessionElicitationRequestedEventSchema = external_exports.strictObject({
|
|
|
20286
20286
|
sessionId: identifierStringSchema,
|
|
20287
20287
|
url: external_exports.string().max(4096)
|
|
20288
20288
|
}).readonly();
|
|
20289
|
-
var sessionElicitationRespondCommandSchema = external_exports.
|
|
20289
|
+
var sessionElicitationRespondCommandSchema = external_exports.object({
|
|
20290
20290
|
action: external_exports.enum(["accept", "cancel", "decline"]),
|
|
20291
20291
|
content: external_exports.string().max(1e5),
|
|
20292
20292
|
interactionId: identifierStringSchema,
|
|
20293
20293
|
kind: external_exports.literal(SESSION_ELICITATION_RESPOND_KIND),
|
|
20294
20294
|
sessionId: identifierStringSchema
|
|
20295
20295
|
}).readonly();
|
|
20296
|
-
var sessionElicitationResolvedEventSchema = external_exports.
|
|
20296
|
+
var sessionElicitationResolvedEventSchema = external_exports.object({
|
|
20297
20297
|
action: external_exports.enum(["accept", "cancel", "decline", "complete"]),
|
|
20298
20298
|
interactionId: identifierStringSchema,
|
|
20299
20299
|
kind: external_exports.literal(SESSION_ELICITATION_RESOLVED_KIND),
|
|
20300
20300
|
sessionId: identifierStringSchema
|
|
20301
20301
|
}).readonly();
|
|
20302
|
-
var sessionOperationFailedEventSchema = external_exports.
|
|
20302
|
+
var sessionOperationFailedEventSchema = external_exports.object({
|
|
20303
20303
|
code: identifierStringSchema,
|
|
20304
20304
|
kind: external_exports.literal(SESSION_OPERATION_FAILED_KIND),
|
|
20305
20305
|
message: external_exports.string().min(1).max(500),
|
|
@@ -20307,7 +20307,7 @@ var sessionOperationFailedEventSchema = external_exports.strictObject({
|
|
|
20307
20307
|
runtimeTimings: runtimeTimingsSchema.optional(),
|
|
20308
20308
|
sessionId: external_exports.string().max(128)
|
|
20309
20309
|
}).readonly();
|
|
20310
|
-
var agentContentEventSchema = external_exports.
|
|
20310
|
+
var agentContentEventSchema = external_exports.object({
|
|
20311
20311
|
commandId: identifierStringSchema,
|
|
20312
20312
|
content: displayContentSchema,
|
|
20313
20313
|
contentId: identifierStringSchema,
|
|
@@ -20319,15 +20319,15 @@ var agentInstallIdentityFields = {
|
|
|
20319
20319
|
agentId: identifierStringSchema,
|
|
20320
20320
|
requestId: identifierStringSchema
|
|
20321
20321
|
};
|
|
20322
|
-
var agentInstallRequestCommandSchema = external_exports.
|
|
20322
|
+
var agentInstallRequestCommandSchema = external_exports.object({
|
|
20323
20323
|
...agentInstallIdentityFields,
|
|
20324
20324
|
kind: external_exports.literal(AGENT_INSTALL_REQUEST_KIND)
|
|
20325
20325
|
}).readonly();
|
|
20326
|
-
var agentInstallCancelCommandSchema = external_exports.
|
|
20326
|
+
var agentInstallCancelCommandSchema = external_exports.object({
|
|
20327
20327
|
kind: external_exports.literal(AGENT_INSTALL_CANCEL_KIND),
|
|
20328
20328
|
requestId: identifierStringSchema
|
|
20329
20329
|
}).readonly();
|
|
20330
|
-
var agentInstallStartedEventSchema = external_exports.
|
|
20330
|
+
var agentInstallStartedEventSchema = external_exports.object({
|
|
20331
20331
|
...agentInstallIdentityFields,
|
|
20332
20332
|
kind: external_exports.literal(AGENT_INSTALL_STARTED_KIND)
|
|
20333
20333
|
}).readonly();
|
|
@@ -20338,23 +20338,23 @@ var installationStageSchema = external_exports.enum([
|
|
|
20338
20338
|
"installing_adapter",
|
|
20339
20339
|
"checking_acp"
|
|
20340
20340
|
]);
|
|
20341
|
-
var agentInstallProgressEventSchema = external_exports.
|
|
20341
|
+
var agentInstallProgressEventSchema = external_exports.object({
|
|
20342
20342
|
...agentInstallIdentityFields,
|
|
20343
20343
|
kind: external_exports.literal(AGENT_INSTALL_PROGRESS_KIND),
|
|
20344
20344
|
stage: installationStageSchema
|
|
20345
20345
|
}).readonly();
|
|
20346
|
-
var agentInstallCompletedEventSchema = external_exports.
|
|
20346
|
+
var agentInstallCompletedEventSchema = external_exports.object({
|
|
20347
20347
|
...agentInstallIdentityFields,
|
|
20348
20348
|
authenticationMayBeRequired: external_exports.boolean(),
|
|
20349
20349
|
kind: external_exports.literal(AGENT_INSTALL_COMPLETED_KIND)
|
|
20350
20350
|
}).readonly();
|
|
20351
|
-
var agentInstallFailedEventSchema = external_exports.
|
|
20351
|
+
var agentInstallFailedEventSchema = external_exports.object({
|
|
20352
20352
|
...agentInstallIdentityFields,
|
|
20353
20353
|
code: identifierStringSchema,
|
|
20354
20354
|
kind: external_exports.literal(AGENT_INSTALL_FAILED_KIND),
|
|
20355
20355
|
message: external_exports.string().min(1).max(500)
|
|
20356
20356
|
}).readonly();
|
|
20357
|
-
var agentInstallCancelledEventSchema = external_exports.
|
|
20357
|
+
var agentInstallCancelledEventSchema = external_exports.object({
|
|
20358
20358
|
...agentInstallIdentityFields,
|
|
20359
20359
|
kind: external_exports.literal(AGENT_INSTALL_CANCELLED_KIND)
|
|
20360
20360
|
}).readonly();
|
|
@@ -20517,6 +20517,17 @@ var ProtocolMessageError = class extends Error {
|
|
|
20517
20517
|
this.name = "ProtocolMessageError";
|
|
20518
20518
|
}
|
|
20519
20519
|
};
|
|
20520
|
+
var UnsupportedProtocolMessageKindError = class extends Error {
|
|
20521
|
+
code = "unsupported_protocol_message_kind";
|
|
20522
|
+
direction;
|
|
20523
|
+
messageKind;
|
|
20524
|
+
constructor(direction, messageKind) {
|
|
20525
|
+
super(`Unsupported ${direction} message kind: ${messageKind}`);
|
|
20526
|
+
this.name = "UnsupportedProtocolMessageKindError";
|
|
20527
|
+
this.direction = direction;
|
|
20528
|
+
this.messageKind = messageKind;
|
|
20529
|
+
}
|
|
20530
|
+
};
|
|
20520
20531
|
function isRecord(value) {
|
|
20521
20532
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
20522
20533
|
}
|
|
@@ -20534,13 +20545,6 @@ function parseJson2(encoded) {
|
|
|
20534
20545
|
}
|
|
20535
20546
|
return value;
|
|
20536
20547
|
}
|
|
20537
|
-
function assertExactKeys(value, allowedKeys) {
|
|
20538
|
-
for (const key of Object.keys(value)) {
|
|
20539
|
-
if (!allowedKeys.includes(key)) {
|
|
20540
|
-
throw new ProtocolMessageError(`Unexpected message field: ${key}`);
|
|
20541
|
-
}
|
|
20542
|
-
}
|
|
20543
|
-
}
|
|
20544
20548
|
function readString(value, key, maximumLength) {
|
|
20545
20549
|
const field = value[key];
|
|
20546
20550
|
if (typeof field !== "string" || field.length === 0 || field.length > maximumLength) {
|
|
@@ -20631,18 +20635,15 @@ function readActivityDetail(value) {
|
|
|
20631
20635
|
}
|
|
20632
20636
|
const kind = readString(field, "kind", 32);
|
|
20633
20637
|
if (kind === "available") {
|
|
20634
|
-
assertExactKeys(field, ["artifactId", "kind"]);
|
|
20635
20638
|
return {
|
|
20636
20639
|
artifactId: readIdentifier(field, "artifactId"),
|
|
20637
20640
|
kind
|
|
20638
20641
|
};
|
|
20639
20642
|
}
|
|
20640
20643
|
if (kind === "unrecorded") {
|
|
20641
|
-
assertExactKeys(field, ["kind"]);
|
|
20642
20644
|
return { kind };
|
|
20643
20645
|
}
|
|
20644
20646
|
if (kind === "truncated") {
|
|
20645
|
-
assertExactKeys(field, ["capturedBytes", "kind", "originalBytes"]);
|
|
20646
20647
|
const capturedBytes = readSequence(field, "capturedBytes");
|
|
20647
20648
|
const originalBytes = readSequence(field, "originalBytes");
|
|
20648
20649
|
if (capturedBytes > originalBytes) {
|
|
@@ -20651,7 +20652,6 @@ function readActivityDetail(value) {
|
|
|
20651
20652
|
return { capturedBytes, kind, originalBytes };
|
|
20652
20653
|
}
|
|
20653
20654
|
if (kind === "recorded") {
|
|
20654
|
-
assertExactKeys(field, ["content", "input", "kind", "output"]);
|
|
20655
20655
|
const contentValue = field["content"];
|
|
20656
20656
|
if (!Array.isArray(contentValue) || contentValue.length > 100) {
|
|
20657
20657
|
throw new ProtocolMessageError("Invalid recorded activity content");
|
|
@@ -20694,21 +20694,6 @@ function decodeMessageKind(encoded) {
|
|
|
20694
20694
|
function decodeSessionPromptCommand(encoded) {
|
|
20695
20695
|
const value = parseJson2(encoded);
|
|
20696
20696
|
const hasSessionConfigurations = Object.hasOwn(value, "sessionConfigurations");
|
|
20697
|
-
assertExactKeys(value, [
|
|
20698
|
-
"additionalDirectoryIds",
|
|
20699
|
-
"agentId",
|
|
20700
|
-
"bindingId",
|
|
20701
|
-
"commandId",
|
|
20702
|
-
"directoryId",
|
|
20703
|
-
"disposition",
|
|
20704
|
-
"images",
|
|
20705
|
-
"kind",
|
|
20706
|
-
"prompt",
|
|
20707
|
-
"resources",
|
|
20708
|
-
...hasSessionConfigurations ? ["sessionConfigurations"] : [],
|
|
20709
|
-
"sessionId",
|
|
20710
|
-
"targetCommandId"
|
|
20711
|
-
]);
|
|
20712
20697
|
assertKind(value, SESSION_PROMPT_KIND);
|
|
20713
20698
|
const prompt = readText(value, "prompt", MAX_PROMPT_LENGTH);
|
|
20714
20699
|
const images = decodePromptImagesValue(value["images"]);
|
|
@@ -20748,7 +20733,6 @@ function decodeSessionPromptCommand(encoded) {
|
|
|
20748
20733
|
}
|
|
20749
20734
|
function decodeSessionCancelCommand(encoded) {
|
|
20750
20735
|
const value = parseJson2(encoded);
|
|
20751
|
-
assertExactKeys(value, ["commandId", "kind", "sessionId"]);
|
|
20752
20736
|
assertKind(value, SESSION_CANCEL_KIND);
|
|
20753
20737
|
return {
|
|
20754
20738
|
commandId: readIdentifier(value, "commandId"),
|
|
@@ -20758,7 +20742,6 @@ function decodeSessionCancelCommand(encoded) {
|
|
|
20758
20742
|
}
|
|
20759
20743
|
function decodeSessionPromptDispositionCommand(encoded) {
|
|
20760
20744
|
const value = parseJson2(encoded);
|
|
20761
|
-
assertExactKeys(value, ["commandId", "disposition", "kind", "sessionId"]);
|
|
20762
20745
|
assertKind(value, SESSION_PROMPT_DISPOSITION_KIND);
|
|
20763
20746
|
if (readPromptDisposition(value) !== SessionPromptDisposition.Steer) {
|
|
20764
20747
|
throw new ProtocolMessageError("Only queued prompts can be steered");
|
|
@@ -20772,7 +20755,6 @@ function decodeSessionPromptDispositionCommand(encoded) {
|
|
|
20772
20755
|
}
|
|
20773
20756
|
function decodeSessionQueuedEvent(encoded) {
|
|
20774
20757
|
const value = parseJson2(encoded);
|
|
20775
|
-
assertExactKeys(value, ["commandId", "kind", "sessionId"]);
|
|
20776
20758
|
assertKind(value, SESSION_QUEUED_KIND);
|
|
20777
20759
|
return {
|
|
20778
20760
|
commandId: readIdentifier(value, "commandId"),
|
|
@@ -20783,12 +20765,10 @@ function decodeSessionQueuedEvent(encoded) {
|
|
|
20783
20765
|
function decodeRuntimeLivenessReadyEvent(encoded) {
|
|
20784
20766
|
const value = parseJson2(encoded);
|
|
20785
20767
|
assertKind(value, RUNTIME_LIVENESS_READY_KIND);
|
|
20786
|
-
assertExactKeys(value, ["kind"]);
|
|
20787
20768
|
return { kind: RUNTIME_LIVENESS_READY_KIND };
|
|
20788
20769
|
}
|
|
20789
20770
|
function decodeRuntimeHeartbeatEvent(encoded) {
|
|
20790
20771
|
const value = parseJson2(encoded);
|
|
20791
|
-
assertExactKeys(value, ["heartbeatId", "kind"]);
|
|
20792
20772
|
assertKind(value, RUNTIME_HEARTBEAT_KIND);
|
|
20793
20773
|
return {
|
|
20794
20774
|
heartbeatId: readIdentifier(value, "heartbeatId"),
|
|
@@ -20797,7 +20777,6 @@ function decodeRuntimeHeartbeatEvent(encoded) {
|
|
|
20797
20777
|
}
|
|
20798
20778
|
function decodeRuntimeHeartbeatAckEvent(encoded) {
|
|
20799
20779
|
const value = parseJson2(encoded);
|
|
20800
|
-
assertExactKeys(value, ["heartbeatId", "kind"]);
|
|
20801
20780
|
assertKind(value, RUNTIME_HEARTBEAT_ACK_KIND);
|
|
20802
20781
|
return {
|
|
20803
20782
|
heartbeatId: readIdentifier(value, "heartbeatId"),
|
|
@@ -20806,7 +20785,6 @@ function decodeRuntimeHeartbeatAckEvent(encoded) {
|
|
|
20806
20785
|
}
|
|
20807
20786
|
function decodeSessionStartedEvent(encoded) {
|
|
20808
20787
|
const value = parseJson2(encoded);
|
|
20809
|
-
assertExactKeys(value, ["commandId", "epoch", "kind", "attemptId", "prompt", "sequence", "sessionId"]);
|
|
20810
20788
|
assertKind(value, SESSION_STARTED_KIND);
|
|
20811
20789
|
const sequence = readSequence(value, "sequence");
|
|
20812
20790
|
if (sequence !== 0) {
|
|
@@ -20824,7 +20802,6 @@ function decodeSessionStartedEvent(encoded) {
|
|
|
20824
20802
|
}
|
|
20825
20803
|
function decodeAgentMessageDeltaEvent(encoded) {
|
|
20826
20804
|
const value = parseJson2(encoded);
|
|
20827
|
-
assertExactKeys(value, ["commandId", "epoch", "kind", "messageId", "sequence", "sessionId", "text"]);
|
|
20828
20805
|
assertKind(value, AGENT_MESSAGE_DELTA_KIND);
|
|
20829
20806
|
const sequence = readSequence(value, "sequence");
|
|
20830
20807
|
if (sequence === 0) {
|
|
@@ -20842,23 +20819,6 @@ function decodeAgentMessageDeltaEvent(encoded) {
|
|
|
20842
20819
|
}
|
|
20843
20820
|
function decodeAgentActivityEvent(encoded) {
|
|
20844
20821
|
const value = parseJson2(encoded);
|
|
20845
|
-
assertExactKeys(value, [
|
|
20846
|
-
"activityId",
|
|
20847
|
-
"activityType",
|
|
20848
|
-
"commandId",
|
|
20849
|
-
"content",
|
|
20850
|
-
"detail",
|
|
20851
|
-
"input",
|
|
20852
|
-
"kind",
|
|
20853
|
-
"locations",
|
|
20854
|
-
"name",
|
|
20855
|
-
"output",
|
|
20856
|
-
"sequence",
|
|
20857
|
-
"sessionId",
|
|
20858
|
-
"status",
|
|
20859
|
-
"title",
|
|
20860
|
-
"toolKind"
|
|
20861
|
-
]);
|
|
20862
20822
|
assertKind(value, AGENT_ACTIVITY_KIND);
|
|
20863
20823
|
return {
|
|
20864
20824
|
activityId: readIdentifier(value, "activityId"),
|
|
@@ -20880,7 +20840,6 @@ function decodeAgentActivityEvent(encoded) {
|
|
|
20880
20840
|
}
|
|
20881
20841
|
function decodeSessionCompletedEvent(encoded) {
|
|
20882
20842
|
const value = parseJson2(encoded);
|
|
20883
|
-
assertExactKeys(value, ["commandId", "kind", "sessionId", "stopReason"]);
|
|
20884
20843
|
assertKind(value, SESSION_COMPLETED_KIND);
|
|
20885
20844
|
return {
|
|
20886
20845
|
commandId: readIdentifier(value, "commandId"),
|
|
@@ -20891,7 +20850,6 @@ function decodeSessionCompletedEvent(encoded) {
|
|
|
20891
20850
|
}
|
|
20892
20851
|
function decodeSessionFailedEvent(encoded) {
|
|
20893
20852
|
const value = parseJson2(encoded);
|
|
20894
|
-
assertExactKeys(value, ["code", "commandId", "kind", "message", "sessionId"]);
|
|
20895
20853
|
assertKind(value, SESSION_FAILED_KIND);
|
|
20896
20854
|
return {
|
|
20897
20855
|
code: readIdentifier(value, "code"),
|
|
@@ -20924,7 +20882,6 @@ function encodeRuntimeHeartbeatAckEvent(message) {
|
|
|
20924
20882
|
}
|
|
20925
20883
|
function decodeAgentActivityNarrationEvent(encoded) {
|
|
20926
20884
|
const value = parseJson2(encoded);
|
|
20927
|
-
assertExactKeys(value, ["activityId", "activityType", "commandId", "kind", "sequence", "sessionId", "text"]);
|
|
20928
20885
|
assertKind(value, AGENT_ACTIVITY_NARRATION_KIND);
|
|
20929
20886
|
return {
|
|
20930
20887
|
activityId: readIdentifier(value, "activityId"),
|
|
@@ -20942,7 +20899,7 @@ var SESSION_HISTORY_CHARACTER_LIMIT = 256e3;
|
|
|
20942
20899
|
var SESSION_HISTORY_MESSAGE_LIMIT = 1e3;
|
|
20943
20900
|
var SESSION_HISTORY_PREVIEW_MESSAGE_LIMIT = 10;
|
|
20944
20901
|
var SESSION_HISTORY_IMAGE_CHARACTER_LIMIT = 4e6;
|
|
20945
|
-
var historyImage = external_exports.
|
|
20902
|
+
var historyImage = external_exports.object({
|
|
20946
20903
|
data: external_exports.string().min(4).max(SESSION_HISTORY_IMAGE_CHARACTER_LIMIT).refine((data) => data.length % 4 === 0 && /^[A-Za-z0-9+/]*={0,2}$/.test(data)),
|
|
20947
20904
|
mimeType: external_exports.enum(["image/png", "image/jpeg", "image/gif", "image/webp"]),
|
|
20948
20905
|
name: external_exports.string().min(1).max(500)
|
|
@@ -20969,7 +20926,7 @@ function parseNativeHistoryText(text2) {
|
|
|
20969
20926
|
});
|
|
20970
20927
|
return { text: plainText, images };
|
|
20971
20928
|
}
|
|
20972
|
-
var nativeMessageActivitySchema = external_exports.
|
|
20929
|
+
var nativeMessageActivitySchema = external_exports.object({
|
|
20973
20930
|
activityId: external_exports.string().min(1).max(128),
|
|
20974
20931
|
activityType: external_exports.string().min(1).max(128),
|
|
20975
20932
|
content: external_exports.array(displayContentSchema).max(100).readonly(),
|
|
@@ -20982,12 +20939,12 @@ var nativeMessageActivitySchema = external_exports.strictObject({
|
|
|
20982
20939
|
title: external_exports.string().max(500),
|
|
20983
20940
|
toolKind: external_exports.string().max(64)
|
|
20984
20941
|
}).readonly();
|
|
20985
|
-
var userHistoryMessage = external_exports.
|
|
20942
|
+
var userHistoryMessage = external_exports.object({
|
|
20986
20943
|
role: external_exports.literal("user"),
|
|
20987
20944
|
text: external_exports.string().max(SESSION_HISTORY_CHARACTER_LIMIT),
|
|
20988
20945
|
images: external_exports.array(historyImage).max(8).readonly().optional()
|
|
20989
20946
|
}).readonly();
|
|
20990
|
-
var assistantHistoryMessageSchema = external_exports.
|
|
20947
|
+
var assistantHistoryMessageSchema = external_exports.object({
|
|
20991
20948
|
activities: external_exports.array(nativeMessageActivitySchema).max(100).readonly().default([]),
|
|
20992
20949
|
content: external_exports.array(displayContentSchema).max(100).readonly().default([]),
|
|
20993
20950
|
role: external_exports.literal("assistant"),
|
|
@@ -20997,8 +20954,8 @@ var assistantHistoryMessageSchema = external_exports.strictObject({
|
|
|
20997
20954
|
images: external_exports.array(historyImage).max(8).readonly().optional()
|
|
20998
20955
|
}).readonly();
|
|
20999
20956
|
var historyMessage = external_exports.discriminatedUnion("role", [userHistoryMessage, assistantHistoryMessageSchema]);
|
|
21000
|
-
var availableSessionHistoryObjectSchema = external_exports.
|
|
21001
|
-
streamPosition: external_exports.
|
|
20957
|
+
var availableSessionHistoryObjectSchema = external_exports.object({
|
|
20958
|
+
streamPosition: external_exports.object({
|
|
21002
20959
|
commandId: identifierStringSchema,
|
|
21003
20960
|
epoch: identifierStringSchema,
|
|
21004
20961
|
sequence: external_exports.number().int().nonnegative()
|
|
@@ -21015,9 +20972,9 @@ var availableSessionHistoryObjectSchema = external_exports.strictObject({
|
|
|
21015
20972
|
).max(2e4).readonly().default([])
|
|
21016
20973
|
});
|
|
21017
20974
|
var availableSessionHistorySchema = availableSessionHistoryObjectSchema.readonly();
|
|
21018
|
-
var unavailableSessionHistoryObjectSchema = external_exports.
|
|
20975
|
+
var unavailableSessionHistoryObjectSchema = external_exports.object({
|
|
21019
20976
|
status: external_exports.literal("unavailable"),
|
|
21020
|
-
cause: external_exports.
|
|
20977
|
+
cause: external_exports.object({
|
|
21021
20978
|
code: external_exports.string().regex(/^[a-z][a-z0-9_]{0,127}$/),
|
|
21022
20979
|
message: external_exports.string().min(1).max(1e3)
|
|
21023
20980
|
}).readonly()
|
|
@@ -21050,7 +21007,7 @@ var envelope = {
|
|
|
21050
21007
|
requestId: identifierStringSchema,
|
|
21051
21008
|
sessionId: identifierStringSchema
|
|
21052
21009
|
};
|
|
21053
|
-
var activeTurnActivitySchema = external_exports.
|
|
21010
|
+
var activeTurnActivitySchema = external_exports.object({
|
|
21054
21011
|
activityId: external_exports.string().min(1).max(128),
|
|
21055
21012
|
activityType: external_exports.string().min(1).max(128),
|
|
21056
21013
|
content: external_exports.array(displayContentSchema).max(100).readonly(),
|
|
@@ -21063,13 +21020,13 @@ var activeTurnActivitySchema = external_exports.strictObject({
|
|
|
21063
21020
|
title: external_exports.string().max(500),
|
|
21064
21021
|
toolKind: external_exports.string().max(64)
|
|
21065
21022
|
}).readonly();
|
|
21066
|
-
var activeTurnUserMessageSchema = external_exports.
|
|
21023
|
+
var activeTurnUserMessageSchema = external_exports.object({
|
|
21067
21024
|
id: identifierStringSchema,
|
|
21068
21025
|
images: external_exports.array(promptImageSchema).max(8).readonly().optional(),
|
|
21069
21026
|
role: external_exports.literal("user"),
|
|
21070
21027
|
text: external_exports.string().max(SESSION_HISTORY_CHARACTER_LIMIT)
|
|
21071
21028
|
}).readonly();
|
|
21072
|
-
var activeTurnAssistantMessageSchema = external_exports.
|
|
21029
|
+
var activeTurnAssistantMessageSchema = external_exports.object({
|
|
21073
21030
|
activities: external_exports.array(activeTurnActivitySchema).max(100).readonly().default([]),
|
|
21074
21031
|
content: external_exports.array(displayContentSchema).max(100).readonly().default([]),
|
|
21075
21032
|
id: identifierStringSchema,
|
|
@@ -21080,7 +21037,7 @@ var activeTurnMessageSchema = external_exports.discriminatedUnion("role", [
|
|
|
21080
21037
|
activeTurnUserMessageSchema,
|
|
21081
21038
|
activeTurnAssistantMessageSchema
|
|
21082
21039
|
]);
|
|
21083
|
-
var activeTurnSnapshotSchema = external_exports.
|
|
21040
|
+
var activeTurnSnapshotSchema = external_exports.object({
|
|
21084
21041
|
commandId: identifierStringSchema,
|
|
21085
21042
|
epoch: identifierStringSchema,
|
|
21086
21043
|
hasOlder: external_exports.boolean(),
|
|
@@ -21105,64 +21062,64 @@ var identity = {
|
|
|
21105
21062
|
directoryId
|
|
21106
21063
|
};
|
|
21107
21064
|
var nativeSessionRequestSchema = external_exports.discriminatedUnion("action", [
|
|
21108
|
-
external_exports.
|
|
21109
|
-
external_exports.
|
|
21110
|
-
external_exports.
|
|
21111
|
-
external_exports.
|
|
21112
|
-
external_exports.
|
|
21113
|
-
external_exports.
|
|
21065
|
+
external_exports.object({ ...identity, action: external_exports.literal("create") }).readonly(),
|
|
21066
|
+
external_exports.object({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifierStringSchema }).readonly(),
|
|
21067
|
+
external_exports.object({ ...identity, action: external_exports.literal("preview"), entryId: identifierStringSchema }).readonly(),
|
|
21068
|
+
external_exports.object({ ...identity, action: external_exports.literal("history"), entryId: identifierStringSchema }).readonly(),
|
|
21069
|
+
external_exports.object({ ...identity, action: external_exports.literal("find"), nativeSessionId: identifierStringSchema }).readonly(),
|
|
21070
|
+
external_exports.object({
|
|
21114
21071
|
...identity,
|
|
21115
21072
|
action: external_exports.literal("list"),
|
|
21116
21073
|
cursor: identifierStringSchema.nullable()
|
|
21117
21074
|
}).readonly(),
|
|
21118
|
-
external_exports.
|
|
21075
|
+
external_exports.object({
|
|
21119
21076
|
...identity,
|
|
21120
21077
|
action: external_exports.enum(["import", "fork"]),
|
|
21121
21078
|
entryId: identifierStringSchema,
|
|
21122
21079
|
targetSessionId: identifierStringSchema
|
|
21123
21080
|
}).readonly(),
|
|
21124
|
-
external_exports.
|
|
21081
|
+
external_exports.object({
|
|
21125
21082
|
...identity,
|
|
21126
21083
|
action: external_exports.literal("fork-recorded"),
|
|
21127
21084
|
targetSessionId: identifierStringSchema,
|
|
21128
21085
|
throughCommandId: identifierStringSchema
|
|
21129
21086
|
}).readonly(),
|
|
21130
|
-
external_exports.
|
|
21087
|
+
external_exports.object({
|
|
21131
21088
|
...identity,
|
|
21132
21089
|
action: external_exports.literal("delete"),
|
|
21133
21090
|
entryId: identifierStringSchema
|
|
21134
21091
|
}).readonly()
|
|
21135
21092
|
]);
|
|
21136
21093
|
var nativeSessionCommandSchema = external_exports.discriminatedUnion("action", [
|
|
21137
|
-
external_exports.
|
|
21138
|
-
external_exports.
|
|
21139
|
-
external_exports.
|
|
21140
|
-
external_exports.
|
|
21141
|
-
external_exports.
|
|
21142
|
-
external_exports.
|
|
21094
|
+
external_exports.object({ ...identity, action: external_exports.literal("create") }).readonly(),
|
|
21095
|
+
external_exports.object({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifierStringSchema }).readonly(),
|
|
21096
|
+
external_exports.object({ ...identity, action: external_exports.literal("preview"), entryId: identifierStringSchema }).readonly(),
|
|
21097
|
+
external_exports.object({ ...identity, action: external_exports.literal("history"), entryId: identifierStringSchema }).readonly(),
|
|
21098
|
+
external_exports.object({ ...identity, action: external_exports.literal("find"), nativeSessionId: identifierStringSchema }).readonly(),
|
|
21099
|
+
external_exports.object({
|
|
21143
21100
|
...identity,
|
|
21144
21101
|
action: external_exports.literal("list"),
|
|
21145
21102
|
cursor: identifierStringSchema.nullable()
|
|
21146
21103
|
}).readonly(),
|
|
21147
|
-
external_exports.
|
|
21104
|
+
external_exports.object({
|
|
21148
21105
|
...identity,
|
|
21149
21106
|
action: external_exports.enum(["import", "fork"]),
|
|
21150
21107
|
entryId: identifierStringSchema,
|
|
21151
21108
|
targetSessionId: identifierStringSchema
|
|
21152
21109
|
}).readonly(),
|
|
21153
|
-
external_exports.
|
|
21110
|
+
external_exports.object({
|
|
21154
21111
|
...identity,
|
|
21155
21112
|
action: external_exports.literal("fork-recorded"),
|
|
21156
21113
|
targetSessionId: identifierStringSchema,
|
|
21157
21114
|
throughCommandId: identifierStringSchema
|
|
21158
21115
|
}).readonly(),
|
|
21159
|
-
external_exports.
|
|
21116
|
+
external_exports.object({
|
|
21160
21117
|
...identity,
|
|
21161
21118
|
action: external_exports.literal("delete"),
|
|
21162
21119
|
entryId: identifierStringSchema
|
|
21163
21120
|
}).readonly()
|
|
21164
21121
|
]);
|
|
21165
|
-
var nativeSessionEntrySchema = external_exports.
|
|
21122
|
+
var nativeSessionEntrySchema = external_exports.object({
|
|
21166
21123
|
entryId: identifierStringSchema,
|
|
21167
21124
|
mobiusSessionIds: external_exports.array(identifierStringSchema).max(500).readonly(),
|
|
21168
21125
|
nativeSessionId: identifierStringSchema,
|
|
@@ -21170,20 +21127,20 @@ var nativeSessionEntrySchema = external_exports.strictObject({
|
|
|
21170
21127
|
directoryId,
|
|
21171
21128
|
directoryLabel: external_exports.string().min(1).max(2048),
|
|
21172
21129
|
updatedAt: external_exports.iso.datetime({ offset: true }).nullable(),
|
|
21173
|
-
additionalDirectories: external_exports.array(external_exports.
|
|
21130
|
+
additionalDirectories: external_exports.array(external_exports.object({ directoryId, name: external_exports.string().min(1).max(255) }).readonly()).max(16).readonly()
|
|
21174
21131
|
}).readonly();
|
|
21175
21132
|
var resultEnvelope = {
|
|
21176
21133
|
...envelope,
|
|
21177
21134
|
kind: external_exports.literal(NATIVE_SESSION_RESULT_KIND)
|
|
21178
21135
|
};
|
|
21179
21136
|
var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
|
|
21180
|
-
external_exports.
|
|
21181
|
-
external_exports.
|
|
21137
|
+
external_exports.object({ ...resultEnvelope, action: external_exports.literal("create"), nativeSessionId: identifierStringSchema }).readonly(),
|
|
21138
|
+
external_exports.object({
|
|
21182
21139
|
...resultEnvelope,
|
|
21183
21140
|
action: external_exports.literal("active-turn"),
|
|
21184
21141
|
targetSessionId: identifierStringSchema,
|
|
21185
21142
|
queued: external_exports.array(
|
|
21186
|
-
external_exports.
|
|
21143
|
+
external_exports.object({
|
|
21187
21144
|
commandId: identifierStringSchema,
|
|
21188
21145
|
prompt: external_exports.string().max(1e5),
|
|
21189
21146
|
images: external_exports.array(promptImageSchema).max(8).readonly()
|
|
@@ -21191,26 +21148,26 @@ var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
|
|
|
21191
21148
|
).readonly(),
|
|
21192
21149
|
turn: activeTurnSnapshotSchema.nullable()
|
|
21193
21150
|
}).readonly(),
|
|
21194
|
-
external_exports.
|
|
21151
|
+
external_exports.object({
|
|
21195
21152
|
...resultEnvelope,
|
|
21196
21153
|
action: external_exports.literal("find"),
|
|
21197
21154
|
entry: nativeSessionEntrySchema
|
|
21198
21155
|
}).readonly(),
|
|
21199
|
-
external_exports.
|
|
21156
|
+
external_exports.object({
|
|
21200
21157
|
...resultEnvelope,
|
|
21201
21158
|
action: external_exports.literal("list"),
|
|
21202
21159
|
capabilities: sessionCapabilitiesSchema,
|
|
21203
21160
|
entries: external_exports.array(nativeSessionEntrySchema).max(500).readonly(),
|
|
21204
21161
|
nextCursor: identifierStringSchema.nullable()
|
|
21205
21162
|
}).readonly(),
|
|
21206
|
-
external_exports.
|
|
21163
|
+
external_exports.object({
|
|
21207
21164
|
...resultEnvelope,
|
|
21208
21165
|
action: external_exports.enum(["import", "fork", "fork-recorded"]),
|
|
21209
21166
|
targetSessionId: identifierStringSchema,
|
|
21210
21167
|
ready: sessionReadyEventSchema,
|
|
21211
21168
|
title: external_exports.string().max(500)
|
|
21212
21169
|
}).readonly(),
|
|
21213
|
-
external_exports.
|
|
21170
|
+
external_exports.object({
|
|
21214
21171
|
...resultEnvelope,
|
|
21215
21172
|
action: external_exports.literal("preview"),
|
|
21216
21173
|
entryId: identifierStringSchema,
|
|
@@ -21219,21 +21176,21 @@ var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
|
|
|
21219
21176
|
history: sessionHistorySchema,
|
|
21220
21177
|
title: external_exports.string().max(500)
|
|
21221
21178
|
}).readonly(),
|
|
21222
|
-
external_exports.
|
|
21179
|
+
external_exports.object({
|
|
21223
21180
|
...resultEnvelope,
|
|
21224
21181
|
action: external_exports.literal("history"),
|
|
21225
21182
|
entryId: identifierStringSchema,
|
|
21226
21183
|
history: sessionHistorySchema,
|
|
21227
21184
|
title: external_exports.string().max(500)
|
|
21228
21185
|
}).readonly(),
|
|
21229
|
-
external_exports.
|
|
21186
|
+
external_exports.object({
|
|
21230
21187
|
...resultEnvelope,
|
|
21231
21188
|
action: external_exports.literal("delete"),
|
|
21232
21189
|
entryId: identifierStringSchema,
|
|
21233
21190
|
deletedSessionIds: external_exports.array(identifierStringSchema).max(500).readonly()
|
|
21234
21191
|
}).readonly()
|
|
21235
21192
|
]);
|
|
21236
|
-
var nativeSessionCancelSchema = external_exports.
|
|
21193
|
+
var nativeSessionCancelSchema = external_exports.object({ ...envelope, kind: external_exports.literal(NATIVE_SESSION_CANCEL_KIND) }).readonly();
|
|
21237
21194
|
function decode4(schema, encoded) {
|
|
21238
21195
|
try {
|
|
21239
21196
|
const value = JSON.parse(encoded);
|
|
@@ -21258,6 +21215,7 @@ var MAX_JSON_KEYS = 1e3;
|
|
|
21258
21215
|
var SESSION_EVENT_V2_KIND = "session.event.v2";
|
|
21259
21216
|
var boundedString = external_exports.string().max(MAX_CONTENT_LENGTH);
|
|
21260
21217
|
var shortString = external_exports.string().max(2048);
|
|
21218
|
+
var externalContentKeySchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
|
|
21261
21219
|
function boundedJsonIssue(value, depth = 0) {
|
|
21262
21220
|
if (depth > MAX_JSON_DEPTH) {
|
|
21263
21221
|
return "JSON nesting exceeds the maximum depth";
|
|
@@ -21309,23 +21267,47 @@ var boundedJsonSchema = external_exports.unknown().superRefine((value, context)
|
|
|
21309
21267
|
});
|
|
21310
21268
|
var metadataSchema = external_exports.record(external_exports.string().max(255), boundedJsonSchema).readonly();
|
|
21311
21269
|
var optionalMetadata = metadataSchema.nullable().optional();
|
|
21312
|
-
var annotationsSchema = external_exports.
|
|
21270
|
+
var annotationsSchema = external_exports.object({
|
|
21313
21271
|
_meta: optionalMetadata,
|
|
21314
21272
|
audience: external_exports.array(external_exports.enum(["assistant", "user"])).max(2).readonly().nullable().optional(),
|
|
21315
21273
|
lastModified: shortString.nullable().optional(),
|
|
21316
21274
|
priority: external_exports.number().finite().nullable().optional()
|
|
21317
21275
|
}).readonly();
|
|
21318
21276
|
var contentFields = { _meta: optionalMetadata, annotations: annotationsSchema.nullable().optional() };
|
|
21319
|
-
var textContentSchema = external_exports.
|
|
21320
|
-
var imageContentSchema = external_exports.
|
|
21277
|
+
var textContentSchema = external_exports.object({ ...contentFields, text: boundedString, type: external_exports.literal("text") }).readonly();
|
|
21278
|
+
var imageContentSchema = external_exports.object({
|
|
21321
21279
|
...contentFields,
|
|
21322
21280
|
data: boundedString,
|
|
21323
21281
|
mimeType: shortString,
|
|
21324
21282
|
type: external_exports.literal("image"),
|
|
21325
21283
|
uri: boundedString.nullable().optional()
|
|
21326
21284
|
}).readonly();
|
|
21327
|
-
var audioContentSchema = external_exports.
|
|
21328
|
-
var
|
|
21285
|
+
var audioContentSchema = external_exports.object({ ...contentFields, data: boundedString, mimeType: shortString, type: external_exports.literal("audio") }).readonly();
|
|
21286
|
+
var externalImageContentSchema = external_exports.strictObject({
|
|
21287
|
+
...contentFields,
|
|
21288
|
+
byteLength: external_exports.number().int().positive().safe(),
|
|
21289
|
+
imageKey: externalContentKeySchema,
|
|
21290
|
+
mimeType: shortString,
|
|
21291
|
+
type: external_exports.literal("external_image"),
|
|
21292
|
+
uri: boundedString.nullable().optional()
|
|
21293
|
+
}).readonly();
|
|
21294
|
+
var externalAudioContentSchema = external_exports.strictObject({
|
|
21295
|
+
...contentFields,
|
|
21296
|
+
audioKey: externalContentKeySchema,
|
|
21297
|
+
byteLength: external_exports.number().int().positive().safe(),
|
|
21298
|
+
mimeType: shortString,
|
|
21299
|
+
type: external_exports.literal("external_audio")
|
|
21300
|
+
}).readonly();
|
|
21301
|
+
var externalResourceContentSchema = external_exports.strictObject({
|
|
21302
|
+
...contentFields,
|
|
21303
|
+
byteLength: external_exports.number().int().positive().safe(),
|
|
21304
|
+
encoding: external_exports.enum(["binary", "text"]),
|
|
21305
|
+
mimeType: shortString.nullable().optional(),
|
|
21306
|
+
resourceKey: externalContentKeySchema,
|
|
21307
|
+
type: external_exports.literal("external_resource"),
|
|
21308
|
+
uri: boundedString
|
|
21309
|
+
}).readonly();
|
|
21310
|
+
var resourceLinkSchema = external_exports.object({
|
|
21329
21311
|
...contentFields,
|
|
21330
21312
|
description: boundedString.nullable().optional(),
|
|
21331
21313
|
mimeType: shortString.nullable().optional(),
|
|
@@ -21335,19 +21317,19 @@ var resourceLinkSchema = external_exports.strictObject({
|
|
|
21335
21317
|
type: external_exports.literal("resource_link"),
|
|
21336
21318
|
uri: boundedString
|
|
21337
21319
|
}).readonly();
|
|
21338
|
-
var textResourceSchema = external_exports.
|
|
21320
|
+
var textResourceSchema = external_exports.object({
|
|
21339
21321
|
_meta: optionalMetadata,
|
|
21340
21322
|
mimeType: shortString.nullable().optional(),
|
|
21341
21323
|
text: boundedString,
|
|
21342
21324
|
uri: boundedString
|
|
21343
21325
|
}).readonly();
|
|
21344
|
-
var blobResourceSchema = external_exports.
|
|
21326
|
+
var blobResourceSchema = external_exports.object({
|
|
21345
21327
|
_meta: optionalMetadata,
|
|
21346
21328
|
blob: boundedString,
|
|
21347
21329
|
mimeType: shortString.nullable().optional(),
|
|
21348
21330
|
uri: boundedString
|
|
21349
21331
|
}).readonly();
|
|
21350
|
-
var embeddedResourceSchema = external_exports.
|
|
21332
|
+
var embeddedResourceSchema = external_exports.object({
|
|
21351
21333
|
...contentFields,
|
|
21352
21334
|
resource: external_exports.union([textResourceSchema, blobResourceSchema]),
|
|
21353
21335
|
type: external_exports.literal("resource")
|
|
@@ -21357,20 +21339,23 @@ var contentBlockV2Schema = external_exports.discriminatedUnion("type", [
|
|
|
21357
21339
|
imageContentSchema,
|
|
21358
21340
|
audioContentSchema,
|
|
21359
21341
|
resourceLinkSchema,
|
|
21360
|
-
embeddedResourceSchema
|
|
21342
|
+
embeddedResourceSchema,
|
|
21343
|
+
externalImageContentSchema,
|
|
21344
|
+
externalAudioContentSchema,
|
|
21345
|
+
externalResourceContentSchema
|
|
21361
21346
|
]);
|
|
21362
21347
|
var toolCallContentSchema = external_exports.discriminatedUnion("type", [
|
|
21363
|
-
external_exports.
|
|
21364
|
-
external_exports.
|
|
21348
|
+
external_exports.object({ _meta: optionalMetadata, content: contentBlockV2Schema, type: external_exports.literal("content") }).readonly(),
|
|
21349
|
+
external_exports.object({
|
|
21365
21350
|
_meta: optionalMetadata,
|
|
21366
21351
|
newText: boundedString,
|
|
21367
21352
|
oldText: boundedString.nullable().optional(),
|
|
21368
21353
|
path: boundedString,
|
|
21369
21354
|
type: external_exports.literal("diff")
|
|
21370
21355
|
}).readonly(),
|
|
21371
|
-
external_exports.
|
|
21356
|
+
external_exports.object({ _meta: optionalMetadata, terminalId: shortString, type: external_exports.literal("terminal") }).readonly()
|
|
21372
21357
|
]);
|
|
21373
|
-
var toolCallLocationSchema = external_exports.
|
|
21358
|
+
var toolCallLocationSchema = external_exports.object({
|
|
21374
21359
|
_meta: optionalMetadata,
|
|
21375
21360
|
line: external_exports.number().int().nonnegative().safe().nullable().optional(),
|
|
21376
21361
|
path: boundedString
|
|
@@ -21399,40 +21384,40 @@ var toolPatchFields = {
|
|
|
21399
21384
|
status: toolStatusSchema.nullable().optional(),
|
|
21400
21385
|
title: boundedString.nullable().optional()
|
|
21401
21386
|
};
|
|
21402
|
-
var planEntrySchema = external_exports.
|
|
21387
|
+
var planEntrySchema = external_exports.object({
|
|
21403
21388
|
_meta: optionalMetadata,
|
|
21404
21389
|
content: boundedString,
|
|
21405
21390
|
priority: external_exports.enum(["high", "medium", "low"]),
|
|
21406
21391
|
status: external_exports.enum(["pending", "in_progress", "completed"])
|
|
21407
21392
|
}).readonly();
|
|
21408
21393
|
var planContentSchema = external_exports.discriminatedUnion("type", [
|
|
21409
|
-
external_exports.
|
|
21394
|
+
external_exports.object({
|
|
21410
21395
|
_meta: optionalMetadata,
|
|
21411
21396
|
entries: external_exports.array(planEntrySchema).max(MAX_COLLECTION_SIZE).readonly(),
|
|
21412
21397
|
planId: shortString,
|
|
21413
21398
|
type: external_exports.literal("items")
|
|
21414
21399
|
}).readonly(),
|
|
21415
|
-
external_exports.
|
|
21416
|
-
external_exports.
|
|
21400
|
+
external_exports.object({ _meta: optionalMetadata, planId: shortString, type: external_exports.literal("file"), uri: boundedString }).readonly(),
|
|
21401
|
+
external_exports.object({
|
|
21417
21402
|
_meta: optionalMetadata,
|
|
21418
21403
|
content: boundedString,
|
|
21419
21404
|
planId: shortString,
|
|
21420
21405
|
type: external_exports.literal("markdown")
|
|
21421
21406
|
}).readonly()
|
|
21422
21407
|
]);
|
|
21423
|
-
var commandSchema = external_exports.
|
|
21408
|
+
var commandSchema = external_exports.object({
|
|
21424
21409
|
_meta: optionalMetadata,
|
|
21425
21410
|
description: boundedString,
|
|
21426
|
-
input: external_exports.
|
|
21411
|
+
input: external_exports.object({ _meta: optionalMetadata, hint: boundedString }).readonly().nullable().optional(),
|
|
21427
21412
|
name: shortString
|
|
21428
21413
|
}).readonly();
|
|
21429
|
-
var configSelectOptionSchema = external_exports.
|
|
21414
|
+
var configSelectOptionSchema = external_exports.object({
|
|
21430
21415
|
_meta: optionalMetadata,
|
|
21431
21416
|
description: boundedString.nullable().optional(),
|
|
21432
21417
|
name: shortString,
|
|
21433
21418
|
value: shortString
|
|
21434
21419
|
}).readonly();
|
|
21435
|
-
var configSelectGroupSchema = external_exports.
|
|
21420
|
+
var configSelectGroupSchema = external_exports.object({
|
|
21436
21421
|
_meta: optionalMetadata,
|
|
21437
21422
|
group: shortString,
|
|
21438
21423
|
name: shortString,
|
|
@@ -21446,7 +21431,7 @@ var configBaseFields = {
|
|
|
21446
21431
|
name: shortString
|
|
21447
21432
|
};
|
|
21448
21433
|
var sessionConfigOptionSchema2 = external_exports.discriminatedUnion("type", [
|
|
21449
|
-
external_exports.
|
|
21434
|
+
external_exports.object({
|
|
21450
21435
|
...configBaseFields,
|
|
21451
21436
|
currentValue: shortString,
|
|
21452
21437
|
options: external_exports.union([
|
|
@@ -21455,7 +21440,7 @@ var sessionConfigOptionSchema2 = external_exports.discriminatedUnion("type", [
|
|
|
21455
21440
|
]),
|
|
21456
21441
|
type: external_exports.literal("select")
|
|
21457
21442
|
}).readonly(),
|
|
21458
|
-
external_exports.
|
|
21443
|
+
external_exports.object({ ...configBaseFields, currentValue: external_exports.boolean(), type: external_exports.literal("boolean") }).readonly()
|
|
21459
21444
|
]);
|
|
21460
21445
|
var contentChunkFields = {
|
|
21461
21446
|
_meta: optionalMetadata,
|
|
@@ -21463,10 +21448,10 @@ var contentChunkFields = {
|
|
|
21463
21448
|
messageId: shortString.nullable().optional()
|
|
21464
21449
|
};
|
|
21465
21450
|
var acpSessionUpdateV2Schema = external_exports.discriminatedUnion("sessionUpdate", [
|
|
21466
|
-
external_exports.
|
|
21467
|
-
external_exports.
|
|
21468
|
-
external_exports.
|
|
21469
|
-
external_exports.
|
|
21451
|
+
external_exports.object({ ...contentChunkFields, sessionUpdate: external_exports.literal("user_message_chunk") }).readonly(),
|
|
21452
|
+
external_exports.object({ ...contentChunkFields, sessionUpdate: external_exports.literal("agent_message_chunk") }).readonly(),
|
|
21453
|
+
external_exports.object({ ...contentChunkFields, sessionUpdate: external_exports.literal("agent_thought_chunk") }).readonly(),
|
|
21454
|
+
external_exports.object({
|
|
21470
21455
|
_meta: optionalMetadata,
|
|
21471
21456
|
content: external_exports.array(toolCallContentSchema).max(MAX_COLLECTION_SIZE).readonly().optional(),
|
|
21472
21457
|
kind: toolKindSchema.optional(),
|
|
@@ -21479,43 +21464,43 @@ var acpSessionUpdateV2Schema = external_exports.discriminatedUnion("sessionUpdat
|
|
|
21479
21464
|
title: boundedString,
|
|
21480
21465
|
toolCallId: shortString
|
|
21481
21466
|
}).readonly(),
|
|
21482
|
-
external_exports.
|
|
21483
|
-
external_exports.
|
|
21467
|
+
external_exports.object({ ...toolPatchFields, sessionUpdate: external_exports.literal("tool_call_update"), toolCallId: shortString }).readonly(),
|
|
21468
|
+
external_exports.object({
|
|
21484
21469
|
_meta: optionalMetadata,
|
|
21485
21470
|
entries: external_exports.array(planEntrySchema).max(MAX_COLLECTION_SIZE).readonly(),
|
|
21486
21471
|
sessionUpdate: external_exports.literal("plan")
|
|
21487
21472
|
}).readonly(),
|
|
21488
|
-
external_exports.
|
|
21489
|
-
external_exports.
|
|
21490
|
-
external_exports.
|
|
21473
|
+
external_exports.object({ _meta: optionalMetadata, plan: planContentSchema, sessionUpdate: external_exports.literal("plan_update") }).readonly(),
|
|
21474
|
+
external_exports.object({ _meta: optionalMetadata, planId: shortString, sessionUpdate: external_exports.literal("plan_removed") }).readonly(),
|
|
21475
|
+
external_exports.object({
|
|
21491
21476
|
_meta: optionalMetadata,
|
|
21492
21477
|
availableCommands: external_exports.array(commandSchema).max(MAX_COLLECTION_SIZE).readonly(),
|
|
21493
21478
|
sessionUpdate: external_exports.literal("available_commands_update")
|
|
21494
21479
|
}).readonly(),
|
|
21495
|
-
external_exports.
|
|
21480
|
+
external_exports.object({
|
|
21496
21481
|
_meta: optionalMetadata,
|
|
21497
21482
|
currentModeId: shortString,
|
|
21498
21483
|
sessionUpdate: external_exports.literal("current_mode_update")
|
|
21499
21484
|
}).readonly(),
|
|
21500
|
-
external_exports.
|
|
21485
|
+
external_exports.object({
|
|
21501
21486
|
_meta: optionalMetadata,
|
|
21502
21487
|
configOptions: external_exports.array(sessionConfigOptionSchema2).max(MAX_COLLECTION_SIZE).readonly(),
|
|
21503
21488
|
sessionUpdate: external_exports.literal("config_option_update")
|
|
21504
21489
|
}).readonly(),
|
|
21505
|
-
external_exports.
|
|
21490
|
+
external_exports.object({
|
|
21506
21491
|
_meta: optionalMetadata,
|
|
21507
21492
|
sessionUpdate: external_exports.literal("session_info_update"),
|
|
21508
21493
|
title: boundedString.nullable().optional(),
|
|
21509
21494
|
updatedAt: shortString.nullable().optional()
|
|
21510
21495
|
}).readonly(),
|
|
21511
|
-
external_exports.
|
|
21496
|
+
external_exports.object({
|
|
21512
21497
|
_meta: optionalMetadata,
|
|
21513
|
-
cost: external_exports.
|
|
21498
|
+
cost: external_exports.object({ _meta: optionalMetadata, amount: external_exports.number().finite(), currency: external_exports.string().max(16) }).readonly().nullable().optional(),
|
|
21514
21499
|
sessionUpdate: external_exports.literal("usage_update"),
|
|
21515
21500
|
size: external_exports.number().int().nonnegative().safe(),
|
|
21516
21501
|
used: external_exports.number().int().nonnegative().safe()
|
|
21517
21502
|
}).readonly(),
|
|
21518
|
-
external_exports.
|
|
21503
|
+
external_exports.object({
|
|
21519
21504
|
_meta: optionalMetadata,
|
|
21520
21505
|
compactionId: shortString,
|
|
21521
21506
|
error: boundedString.nullable().optional(),
|
|
@@ -21523,7 +21508,7 @@ var acpSessionUpdateV2Schema = external_exports.discriminatedUnion("sessionUpdat
|
|
|
21523
21508
|
status: shortString,
|
|
21524
21509
|
summary: external_exports.array(contentBlockV2Schema).max(MAX_COLLECTION_SIZE).readonly().nullable().optional()
|
|
21525
21510
|
}).readonly(),
|
|
21526
|
-
external_exports.
|
|
21511
|
+
external_exports.object({
|
|
21527
21512
|
_meta: optionalMetadata,
|
|
21528
21513
|
compactionId: shortString,
|
|
21529
21514
|
content: contentBlockV2Schema,
|
|
@@ -21532,28 +21517,28 @@ var acpSessionUpdateV2Schema = external_exports.discriminatedUnion("sessionUpdat
|
|
|
21532
21517
|
]);
|
|
21533
21518
|
var lifecycleBase = { commandId: identifierStringSchema };
|
|
21534
21519
|
var lifecycleMetadataV2Schema = external_exports.discriminatedUnion("kind", [
|
|
21535
|
-
external_exports.
|
|
21536
|
-
external_exports.
|
|
21537
|
-
external_exports.
|
|
21538
|
-
external_exports.
|
|
21520
|
+
external_exports.object({ kind: external_exports.literal("session.queue.changed") }).readonly(),
|
|
21521
|
+
external_exports.object({ event: sessionPermissionRequestedEventSchema, kind: external_exports.literal("session.permission.requested") }).readonly(),
|
|
21522
|
+
external_exports.object({ event: sessionPermissionResolvedEventSchema, kind: external_exports.literal("session.permission.resolved") }).readonly(),
|
|
21523
|
+
external_exports.object({
|
|
21539
21524
|
event: sessionElicitationRequestedEventSchema,
|
|
21540
21525
|
kind: external_exports.literal("session.elicitation.requested")
|
|
21541
21526
|
}).readonly(),
|
|
21542
|
-
external_exports.
|
|
21543
|
-
external_exports.
|
|
21527
|
+
external_exports.object({ event: sessionElicitationResolvedEventSchema, kind: external_exports.literal("session.elicitation.resolved") }).readonly(),
|
|
21528
|
+
external_exports.object({
|
|
21544
21529
|
...lifecycleBase,
|
|
21545
21530
|
content: external_exports.array(contentBlockV2Schema).min(1).max(100).readonly(),
|
|
21546
21531
|
kind: external_exports.literal("prompt.requested")
|
|
21547
21532
|
}).readonly(),
|
|
21548
|
-
external_exports.
|
|
21549
|
-
external_exports.
|
|
21550
|
-
external_exports.
|
|
21533
|
+
external_exports.object({ ...lifecycleBase, attemptId: identifierStringSchema, epoch: identifierStringSchema, kind: external_exports.literal("prompt.started") }).readonly(),
|
|
21534
|
+
external_exports.object({ ...lifecycleBase, kind: external_exports.literal("prompt.completed"), stopReason: shortString }).readonly(),
|
|
21535
|
+
external_exports.object({
|
|
21551
21536
|
...lifecycleBase,
|
|
21552
21537
|
code: identifierStringSchema,
|
|
21553
21538
|
kind: external_exports.literal("prompt.failed-before-start"),
|
|
21554
21539
|
message: external_exports.string().min(1).max(500)
|
|
21555
21540
|
}).readonly(),
|
|
21556
|
-
external_exports.
|
|
21541
|
+
external_exports.object({
|
|
21557
21542
|
...lifecycleBase,
|
|
21558
21543
|
attemptId: identifierStringSchema,
|
|
21559
21544
|
code: identifierStringSchema,
|
|
@@ -21562,19 +21547,19 @@ var lifecycleMetadataV2Schema = external_exports.discriminatedUnion("kind", [
|
|
|
21562
21547
|
}).readonly()
|
|
21563
21548
|
]);
|
|
21564
21549
|
var sessionEventPayloadV2Schema = external_exports.discriminatedUnion("type", [
|
|
21565
|
-
external_exports.
|
|
21566
|
-
external_exports.
|
|
21550
|
+
external_exports.object({ payload: acpSessionUpdateV2Schema, type: external_exports.literal("acp") }).readonly(),
|
|
21551
|
+
external_exports.object({ payload: lifecycleMetadataV2Schema, type: external_exports.literal("lifecycle-metadata") }).readonly()
|
|
21567
21552
|
]);
|
|
21568
21553
|
var positionSchema = external_exports.string().regex(/^(0|[1-9][0-9]*)$/);
|
|
21569
21554
|
var provenanceSchema = external_exports.discriminatedUnion("kind", [
|
|
21570
|
-
external_exports.
|
|
21571
|
-
external_exports.
|
|
21555
|
+
external_exports.object({ kind: external_exports.literal("original") }).readonly(),
|
|
21556
|
+
external_exports.object({
|
|
21572
21557
|
kind: external_exports.literal("imported"),
|
|
21573
21558
|
sourceEventId: identifierStringSchema,
|
|
21574
21559
|
sourcePosition: positionSchema,
|
|
21575
21560
|
sourceSessionId: identifierStringSchema
|
|
21576
21561
|
}).readonly(),
|
|
21577
|
-
external_exports.
|
|
21562
|
+
external_exports.object({
|
|
21578
21563
|
kind: external_exports.literal("forked"),
|
|
21579
21564
|
sourceEventId: identifierStringSchema,
|
|
21580
21565
|
sourcePosition: positionSchema,
|
|
@@ -21589,15 +21574,15 @@ var sessionEventFieldsV2 = {
|
|
|
21589
21574
|
sessionId: identifierStringSchema
|
|
21590
21575
|
};
|
|
21591
21576
|
var sessionEventV2Schema = external_exports.discriminatedUnion("type", [
|
|
21592
|
-
external_exports.
|
|
21593
|
-
external_exports.
|
|
21577
|
+
external_exports.object({ ...sessionEventFieldsV2, payload: acpSessionUpdateV2Schema, type: external_exports.literal("acp") }).readonly(),
|
|
21578
|
+
external_exports.object({
|
|
21594
21579
|
...sessionEventFieldsV2,
|
|
21595
21580
|
payload: lifecycleMetadataV2Schema,
|
|
21596
21581
|
type: external_exports.literal("lifecycle-metadata")
|
|
21597
21582
|
}).readonly()
|
|
21598
21583
|
]);
|
|
21599
|
-
var sessionExportV2Schema = external_exports.
|
|
21600
|
-
binding: external_exports.
|
|
21584
|
+
var sessionExportV2Schema = external_exports.object({
|
|
21585
|
+
binding: external_exports.object({
|
|
21601
21586
|
bindingId: identifierStringSchema,
|
|
21602
21587
|
runtimeId: identifierStringSchema
|
|
21603
21588
|
}).readonly(),
|
|
@@ -21634,20 +21619,20 @@ var sessionExportV2Schema = external_exports.strictObject({
|
|
|
21634
21619
|
eventIds.add(event.eventId);
|
|
21635
21620
|
}
|
|
21636
21621
|
});
|
|
21637
|
-
var mobiusSessionExportV2Schema = external_exports.
|
|
21622
|
+
var mobiusSessionExportV2Schema = external_exports.object({
|
|
21638
21623
|
formatVersion: external_exports.literal("2"),
|
|
21639
21624
|
session: sessionExportV2Schema
|
|
21640
21625
|
}).readonly();
|
|
21641
|
-
var sessionEventEnvelopeV2Schema = external_exports.
|
|
21642
|
-
var sessionEventLogPageV2Schema = external_exports.
|
|
21626
|
+
var sessionEventEnvelopeV2Schema = external_exports.object({ event: sessionEventV2Schema, kind: external_exports.literal(SESSION_EVENT_V2_KIND) }).readonly();
|
|
21627
|
+
var sessionEventLogPageV2Schema = external_exports.object({
|
|
21643
21628
|
events: external_exports.array(sessionEventV2Schema).max(MAX_EVENT_COUNT).readonly(),
|
|
21644
21629
|
nextCursor: external_exports.string().min(1).max(512).nullable(),
|
|
21645
21630
|
tailCursor: external_exports.string().max(512),
|
|
21646
21631
|
truncated: external_exports.boolean(),
|
|
21647
21632
|
version: external_exports.literal(2)
|
|
21648
21633
|
}).readonly();
|
|
21649
|
-
var nativeEventPageRequestV2Schema = external_exports.
|
|
21650
|
-
var executingPromptRequestEventLogV2Schema = external_exports.
|
|
21634
|
+
var nativeEventPageRequestV2Schema = external_exports.object({ cursor: external_exports.string().min(1).max(512).nullable(), eventLimit: external_exports.number().int().min(1).max(1e4) }).readonly();
|
|
21635
|
+
var executingPromptRequestEventLogV2Schema = external_exports.object({
|
|
21651
21636
|
attemptId: identifierStringSchema,
|
|
21652
21637
|
commandId: identifierStringSchema,
|
|
21653
21638
|
epoch: identifierStringSchema,
|
|
@@ -21655,7 +21640,7 @@ var executingPromptRequestEventLogV2Schema = external_exports.strictObject({
|
|
|
21655
21640
|
tailCursor: external_exports.string().max(512),
|
|
21656
21641
|
truncated: external_exports.boolean()
|
|
21657
21642
|
}).readonly();
|
|
21658
|
-
var nativeSessionEventsV2Schema = external_exports.
|
|
21643
|
+
var nativeSessionEventsV2Schema = external_exports.object({
|
|
21659
21644
|
executingPromptRequest: executingPromptRequestEventLogV2Schema.nullable(),
|
|
21660
21645
|
history: sessionEventLogPageV2Schema
|
|
21661
21646
|
}).readonly();
|
|
@@ -21690,14 +21675,14 @@ var decodeAcpSessionUpdateV2 = (value) => decode5(value, acpSessionUpdateV2Schem
|
|
|
21690
21675
|
var SESSION_EVENT_KIND = "session.event";
|
|
21691
21676
|
var SESSION_FORKED_KIND = "session.forked";
|
|
21692
21677
|
var MAX_RECORDED_EVENT_LENGTH = 8 * 1024 * 1024;
|
|
21693
|
-
var sessionEventEnvelopeSchema = external_exports.
|
|
21678
|
+
var sessionEventEnvelopeSchema = external_exports.object({
|
|
21694
21679
|
kind: external_exports.literal(SESSION_EVENT_KIND),
|
|
21695
21680
|
payload: external_exports.string().min(2).max(MAX_RECORDED_EVENT_LENGTH),
|
|
21696
21681
|
sessionId: identifierStringSchema
|
|
21697
21682
|
}).readonly();
|
|
21698
21683
|
var SESSION_QUEUE_CHANGED_KIND = "session.queue.changed";
|
|
21699
|
-
var sessionQueueChangedSchema = external_exports.
|
|
21700
|
-
var sessionForkedSchema = external_exports.
|
|
21684
|
+
var sessionQueueChangedSchema = external_exports.object({ kind: external_exports.literal(SESSION_QUEUE_CHANGED_KIND), sessionId: identifierStringSchema }).readonly();
|
|
21685
|
+
var sessionForkedSchema = external_exports.object({
|
|
21701
21686
|
kind: external_exports.literal(SESSION_FORKED_KIND),
|
|
21702
21687
|
sessionId: identifierStringSchema,
|
|
21703
21688
|
sourceSessionId: identifierStringSchema,
|
|
@@ -21769,7 +21754,7 @@ function decodeRecordedSessionEvent(encoded) {
|
|
|
21769
21754
|
case SESSION_USAGE_UPDATED_KIND:
|
|
21770
21755
|
return decodeSessionUsageUpdatedEvent(encoded);
|
|
21771
21756
|
default:
|
|
21772
|
-
throw new
|
|
21757
|
+
throw new UnsupportedProtocolMessageKindError("daemon-to-service", kind);
|
|
21773
21758
|
}
|
|
21774
21759
|
}
|
|
21775
21760
|
var encodeRecordedSessionEvent = (event) => JSON.stringify(decodeRecordedSessionEvent(JSON.stringify(event)));
|
|
@@ -21782,7 +21767,7 @@ var SESSION_LIVE_HISTORY_PAGE_LOADED_KIND = "session.live-history.page.loaded";
|
|
|
21782
21767
|
var SESSION_LIVE_HISTORY_V2_PAGE_LOAD_KIND = "session.live-history.v2.page.load";
|
|
21783
21768
|
var SESSION_LIVE_HISTORY_V2_PAGE_LOADED_KIND = "session.live-history.v2.page.loaded";
|
|
21784
21769
|
var directoryIdentifier = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/);
|
|
21785
|
-
var sessionLiveHistoryLoadSchema = external_exports.
|
|
21770
|
+
var sessionLiveHistoryLoadSchema = external_exports.object({
|
|
21786
21771
|
additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
|
|
21787
21772
|
agentId: identifierStringSchema,
|
|
21788
21773
|
bindingId: identifierStringSchema,
|
|
@@ -21791,13 +21776,13 @@ var sessionLiveHistoryLoadSchema = external_exports.strictObject({
|
|
|
21791
21776
|
requestId: identifierStringSchema,
|
|
21792
21777
|
sessionId: identifierStringSchema
|
|
21793
21778
|
}).readonly();
|
|
21794
|
-
var sessionLiveHistoryLoadedSchema = external_exports.
|
|
21779
|
+
var sessionLiveHistoryLoadedSchema = external_exports.object({
|
|
21795
21780
|
history: sessionHistorySchema,
|
|
21796
21781
|
kind: external_exports.literal(SESSION_LIVE_HISTORY_LOADED_KIND),
|
|
21797
21782
|
requestId: identifierStringSchema,
|
|
21798
21783
|
sessionId: identifierStringSchema
|
|
21799
21784
|
}).readonly();
|
|
21800
|
-
var sessionLiveHistoryPageLoadSchema = external_exports.
|
|
21785
|
+
var sessionLiveHistoryPageLoadSchema = external_exports.object({
|
|
21801
21786
|
additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
|
|
21802
21787
|
agentId: identifierStringSchema,
|
|
21803
21788
|
bindingId: identifierStringSchema,
|
|
@@ -21808,13 +21793,13 @@ var sessionLiveHistoryPageLoadSchema = external_exports.strictObject({
|
|
|
21808
21793
|
requestId: identifierStringSchema,
|
|
21809
21794
|
sessionId: identifierStringSchema
|
|
21810
21795
|
}).readonly();
|
|
21811
|
-
var sessionLiveHistoryPageLoadedSchema = external_exports.
|
|
21796
|
+
var sessionLiveHistoryPageLoadedSchema = external_exports.object({
|
|
21812
21797
|
kind: external_exports.literal(SESSION_LIVE_HISTORY_PAGE_LOADED_KIND),
|
|
21813
21798
|
page: nativeMessagePageSchema,
|
|
21814
21799
|
requestId: identifierStringSchema,
|
|
21815
21800
|
sessionId: identifierStringSchema
|
|
21816
21801
|
}).readonly();
|
|
21817
|
-
var sessionLiveHistoryV2PageLoadSchema = external_exports.
|
|
21802
|
+
var sessionLiveHistoryV2PageLoadSchema = external_exports.object({
|
|
21818
21803
|
additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
|
|
21819
21804
|
agentId: identifierStringSchema,
|
|
21820
21805
|
bindingId: identifierStringSchema,
|
|
@@ -21825,7 +21810,7 @@ var sessionLiveHistoryV2PageLoadSchema = external_exports.strictObject({
|
|
|
21825
21810
|
requestId: identifierStringSchema,
|
|
21826
21811
|
sessionId: identifierStringSchema
|
|
21827
21812
|
}).readonly();
|
|
21828
|
-
var sessionLiveHistoryV2PageLoadedSchema = external_exports.
|
|
21813
|
+
var sessionLiveHistoryV2PageLoadedSchema = external_exports.object({
|
|
21829
21814
|
events: nativeSessionEventsV2Schema,
|
|
21830
21815
|
kind: external_exports.literal(SESSION_LIVE_HISTORY_V2_PAGE_LOADED_KIND),
|
|
21831
21816
|
requestId: identifierStringSchema,
|
|
@@ -21971,7 +21956,7 @@ function decodeServiceToDaemonMessage(encoded) {
|
|
|
21971
21956
|
const kind = decodeMessageKind(encoded);
|
|
21972
21957
|
const signature = serviceToDaemonRegistry[kind];
|
|
21973
21958
|
if (signature === void 0) {
|
|
21974
|
-
throw new
|
|
21959
|
+
throw new UnsupportedProtocolMessageKindError("service-to-daemon", kind);
|
|
21975
21960
|
}
|
|
21976
21961
|
return signature.decoder(encoded);
|
|
21977
21962
|
}
|
|
@@ -26408,7 +26393,7 @@ function sql(strings, ...params) {
|
|
|
26408
26393
|
return new SQL([new StringChunk(str)]);
|
|
26409
26394
|
}
|
|
26410
26395
|
sql2.raw = raw;
|
|
26411
|
-
function
|
|
26396
|
+
function join20(chunks, separator) {
|
|
26412
26397
|
const result = [];
|
|
26413
26398
|
for (const [i, chunk] of chunks.entries()) {
|
|
26414
26399
|
if (i > 0 && separator !== void 0) {
|
|
@@ -26418,7 +26403,7 @@ function sql(strings, ...params) {
|
|
|
26418
26403
|
}
|
|
26419
26404
|
return new SQL(result);
|
|
26420
26405
|
}
|
|
26421
|
-
sql2.join =
|
|
26406
|
+
sql2.join = join20;
|
|
26422
26407
|
function identifier(value) {
|
|
26423
26408
|
return new Name(value);
|
|
26424
26409
|
}
|
|
@@ -28962,7 +28947,7 @@ var SQLiteSelectQueryBuilderBase = class extends TypedQueryBuilder {
|
|
|
28962
28947
|
const baseTableName = this.tableName;
|
|
28963
28948
|
const tableName = getTableLikeName(table);
|
|
28964
28949
|
for (const item of extractUsedTable(table)) this.usedTables.add(item);
|
|
28965
|
-
if (typeof tableName === "string" && this.config.joins?.some((
|
|
28950
|
+
if (typeof tableName === "string" && this.config.joins?.some((join20) => join20.alias === tableName)) {
|
|
28966
28951
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
|
28967
28952
|
}
|
|
28968
28953
|
if (!this.isPartialSelect) {
|
|
@@ -29821,7 +29806,7 @@ var SQLiteUpdateBase = class extends QueryPromise {
|
|
|
29821
29806
|
createJoin(joinType) {
|
|
29822
29807
|
return (table, on) => {
|
|
29823
29808
|
const tableName = getTableLikeName(table);
|
|
29824
|
-
if (typeof tableName === "string" && this.config.joins.some((
|
|
29809
|
+
if (typeof tableName === "string" && this.config.joins.some((join20) => join20.alias === tableName)) {
|
|
29825
29810
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
|
29826
29811
|
}
|
|
29827
29812
|
if (typeof on === "function") {
|
|
@@ -31144,6 +31129,7 @@ function recordsEqual(left, right) {
|
|
|
31144
31129
|
}
|
|
31145
31130
|
var AgentSession = class _AgentSession {
|
|
31146
31131
|
#connection;
|
|
31132
|
+
#contentExternalizer;
|
|
31147
31133
|
#interactions;
|
|
31148
31134
|
#additionalDirectories;
|
|
31149
31135
|
#agentId;
|
|
@@ -31171,7 +31157,7 @@ var AgentSession = class _AgentSession {
|
|
|
31171
31157
|
#sessionTitle = null;
|
|
31172
31158
|
#sessionUpdatedAt = "";
|
|
31173
31159
|
#turn = new IdleAcpTurn();
|
|
31174
|
-
constructor(agent, cwd, additionalDirectories, mobiusSessionId, getObserver, store, metrics) {
|
|
31160
|
+
constructor(agent, cwd, additionalDirectories, mobiusSessionId, getObserver, store, metrics, contentExternalizer) {
|
|
31175
31161
|
this.#updates = new AgentUpdateStream((notification) => this.#processUpdate(notification));
|
|
31176
31162
|
this.#additionalDirectories = [...additionalDirectories];
|
|
31177
31163
|
this.#agentId = agent.id;
|
|
@@ -31191,8 +31177,9 @@ var AgentSession = class _AgentSession {
|
|
|
31191
31177
|
observer: getObserver
|
|
31192
31178
|
});
|
|
31193
31179
|
this.#connection = new AgentConnection(agent, cwd, this);
|
|
31180
|
+
this.#contentExternalizer = contentExternalizer;
|
|
31194
31181
|
}
|
|
31195
|
-
static async #start(options, getObserver, store, initialize, metrics) {
|
|
31182
|
+
static async #start(options, getObserver, store, initialize, metrics, contentExternalizer) {
|
|
31196
31183
|
for (let attempt = 1; attempt <= 2; attempt += 1) {
|
|
31197
31184
|
options.signal.throwIfAborted();
|
|
31198
31185
|
const unchanged = await metrics.measure(
|
|
@@ -31220,7 +31207,8 @@ var AgentSession = class _AgentSession {
|
|
|
31220
31207
|
options.sessionId,
|
|
31221
31208
|
getObserver,
|
|
31222
31209
|
store,
|
|
31223
|
-
metrics
|
|
31210
|
+
metrics,
|
|
31211
|
+
contentExternalizer
|
|
31224
31212
|
)
|
|
31225
31213
|
);
|
|
31226
31214
|
try {
|
|
@@ -31243,19 +31231,21 @@ var AgentSession = class _AgentSession {
|
|
|
31243
31231
|
}
|
|
31244
31232
|
throw new AcpExecutionError("ACP agent initialization failed");
|
|
31245
31233
|
}
|
|
31246
|
-
static start = async (options, getObserver, store, metrics
|
|
31234
|
+
static start = async (options, getObserver, store, metrics, contentExternalizer) => await _AgentSession.#start(
|
|
31247
31235
|
options,
|
|
31248
31236
|
getObserver,
|
|
31249
31237
|
store,
|
|
31250
31238
|
async (runtime) => await runtime.initialize(options.signal, options.origin),
|
|
31251
|
-
metrics
|
|
31239
|
+
metrics,
|
|
31240
|
+
contentExternalizer
|
|
31252
31241
|
);
|
|
31253
|
-
static startNativeSessionBrowser = async (options, getObserver, store) => await _AgentSession.#start(
|
|
31242
|
+
static startNativeSessionBrowser = async (options, getObserver, store, contentExternalizer) => await _AgentSession.#start(
|
|
31254
31243
|
options,
|
|
31255
31244
|
getObserver,
|
|
31256
31245
|
store,
|
|
31257
31246
|
async (runtime) => await runtime.#initializeAgent(options.signal),
|
|
31258
|
-
unmeasuredOperationMetrics
|
|
31247
|
+
unmeasuredOperationMetrics,
|
|
31248
|
+
contentExternalizer
|
|
31259
31249
|
);
|
|
31260
31250
|
belongsTo = (agentId, cwd, additionalDirectories) => this.#agentId === agentId && this.#cwd === cwd && arraysEqual(this.#additionalDirectories, additionalDirectories);
|
|
31261
31251
|
usesEnvironment = (environment) => recordsEqual(this.#environment, environment);
|
|
@@ -31960,7 +31950,12 @@ var AgentSession = class _AgentSession {
|
|
|
31960
31950
|
#processUpdate = async (notification) => {
|
|
31961
31951
|
this.assertNativeSession(notification.sessionId);
|
|
31962
31952
|
const update = notification.update;
|
|
31963
|
-
const
|
|
31953
|
+
const externalized = await this.#contentExternalizer.update(
|
|
31954
|
+
this.#mobiusSessionId,
|
|
31955
|
+
update,
|
|
31956
|
+
AbortSignal.timeout(3e4)
|
|
31957
|
+
);
|
|
31958
|
+
const rawUpdate = decodeAcpSessionUpdateV2(JSON.stringify(externalized));
|
|
31964
31959
|
if (this.#sessionLoad.kind === "capturing") {
|
|
31965
31960
|
await this.#sessionLoad.history.record(update, rawUpdate);
|
|
31966
31961
|
} else {
|
|
@@ -32247,8 +32242,10 @@ var AgentQueryProcesses = class {
|
|
|
32247
32242
|
#processes;
|
|
32248
32243
|
#observer = new NullAcpSessionObserver();
|
|
32249
32244
|
#store = new MemoryAcpSessionStore();
|
|
32250
|
-
|
|
32245
|
+
#contentExternalizer;
|
|
32246
|
+
constructor(processes, contentExternalizer) {
|
|
32251
32247
|
this.#processes = processes;
|
|
32248
|
+
this.#contentExternalizer = contentExternalizer;
|
|
32252
32249
|
this.#processesByQuery = new RetainedAgentProcesses({
|
|
32253
32250
|
touch: processes.touch,
|
|
32254
32251
|
changed: processes.notifyChanged
|
|
@@ -32264,7 +32261,12 @@ var AgentQueryProcesses = class {
|
|
|
32264
32261
|
async #startRetained(options) {
|
|
32265
32262
|
const runtime = await this.#processes.startRetained(
|
|
32266
32263
|
options.signal,
|
|
32267
|
-
() => AgentSession.startNativeSessionBrowser(
|
|
32264
|
+
() => AgentSession.startNativeSessionBrowser(
|
|
32265
|
+
options,
|
|
32266
|
+
() => this.#observer,
|
|
32267
|
+
this.#store,
|
|
32268
|
+
this.#contentExternalizer
|
|
32269
|
+
),
|
|
32268
32270
|
{
|
|
32269
32271
|
isBusy: () => this.#processesByQuery.isBusy(options.sessionId),
|
|
32270
32272
|
retire: (runtime2) => this.retire(options.sessionId, runtime2)
|
|
@@ -32340,7 +32342,8 @@ var AgentQueryProcesses = class {
|
|
|
32340
32342
|
async () => await AgentSession.startNativeSessionBrowser(
|
|
32341
32343
|
options,
|
|
32342
32344
|
() => this.#observer,
|
|
32343
|
-
new MemoryAcpSessionStore()
|
|
32345
|
+
new MemoryAcpSessionStore(),
|
|
32346
|
+
this.#contentExternalizer
|
|
32344
32347
|
),
|
|
32345
32348
|
async (runtime) => {
|
|
32346
32349
|
runtime.selectNativeSession(nativeSessionId);
|
|
@@ -32355,7 +32358,8 @@ var AgentQueryProcesses = class {
|
|
|
32355
32358
|
async () => await AgentSession.startNativeSessionBrowser(
|
|
32356
32359
|
options,
|
|
32357
32360
|
() => this.#observer,
|
|
32358
|
-
new MemoryAcpSessionStore()
|
|
32361
|
+
new MemoryAcpSessionStore(),
|
|
32362
|
+
this.#contentExternalizer
|
|
32359
32363
|
),
|
|
32360
32364
|
async (runtime) => {
|
|
32361
32365
|
runtime.selectNativeSession(nativeSessionId);
|
|
@@ -32371,6 +32375,220 @@ var AgentQueryProcesses = class {
|
|
|
32371
32375
|
};
|
|
32372
32376
|
};
|
|
32373
32377
|
|
|
32378
|
+
// src/external-content/acp-content-externalizer.ts
|
|
32379
|
+
var MAXIMUM_ENCODED_CONTENT_CHARACTERS = 4e6;
|
|
32380
|
+
function decodeBase64(data) {
|
|
32381
|
+
if (data.length > MAXIMUM_ENCODED_CONTENT_CHARACTERS || data.length % 4 !== 0 || !/^[A-Za-z0-9+/]*={0,2}$/u.test(data)) {
|
|
32382
|
+
throw new Error("The ACP embedded content is not valid bounded base64");
|
|
32383
|
+
}
|
|
32384
|
+
return Buffer.from(data, "base64");
|
|
32385
|
+
}
|
|
32386
|
+
var AcpContentExternalizer = class {
|
|
32387
|
+
#store;
|
|
32388
|
+
constructor(store) {
|
|
32389
|
+
this.#store = store;
|
|
32390
|
+
}
|
|
32391
|
+
async #content(sessionId, content, signal) {
|
|
32392
|
+
switch (content.type) {
|
|
32393
|
+
case "text":
|
|
32394
|
+
case "resource_link":
|
|
32395
|
+
return content;
|
|
32396
|
+
case "image": {
|
|
32397
|
+
if (content.data.length === 0) {
|
|
32398
|
+
return content;
|
|
32399
|
+
}
|
|
32400
|
+
const stored = await this.#store.put({
|
|
32401
|
+
bytes: decodeBase64(content.data),
|
|
32402
|
+
kind: "image",
|
|
32403
|
+
mediaType: content.mimeType,
|
|
32404
|
+
name: "image",
|
|
32405
|
+
sessionId,
|
|
32406
|
+
signal
|
|
32407
|
+
});
|
|
32408
|
+
return {
|
|
32409
|
+
_meta: content._meta,
|
|
32410
|
+
annotations: content.annotations,
|
|
32411
|
+
byteLength: stored.byteLength,
|
|
32412
|
+
imageKey: stored.key,
|
|
32413
|
+
mimeType: content.mimeType,
|
|
32414
|
+
type: "external_image",
|
|
32415
|
+
uri: content.uri
|
|
32416
|
+
};
|
|
32417
|
+
}
|
|
32418
|
+
case "audio": {
|
|
32419
|
+
if (content.data.length === 0) {
|
|
32420
|
+
return content;
|
|
32421
|
+
}
|
|
32422
|
+
const stored = await this.#store.put({
|
|
32423
|
+
bytes: decodeBase64(content.data),
|
|
32424
|
+
kind: "audio",
|
|
32425
|
+
mediaType: content.mimeType,
|
|
32426
|
+
name: "audio",
|
|
32427
|
+
sessionId,
|
|
32428
|
+
signal
|
|
32429
|
+
});
|
|
32430
|
+
return {
|
|
32431
|
+
_meta: content._meta,
|
|
32432
|
+
annotations: content.annotations,
|
|
32433
|
+
audioKey: stored.key,
|
|
32434
|
+
byteLength: stored.byteLength,
|
|
32435
|
+
mimeType: content.mimeType,
|
|
32436
|
+
type: "external_audio"
|
|
32437
|
+
};
|
|
32438
|
+
}
|
|
32439
|
+
case "resource": {
|
|
32440
|
+
const embedded = content.resource;
|
|
32441
|
+
const encoding = "text" in embedded ? "text" : "binary";
|
|
32442
|
+
const bytes = "text" in embedded ? Buffer.from(embedded.text, "utf8") : decodeBase64(embedded.blob);
|
|
32443
|
+
if (bytes.byteLength === 0) {
|
|
32444
|
+
return content;
|
|
32445
|
+
}
|
|
32446
|
+
const mediaType = embedded.mimeType ?? "application/octet-stream";
|
|
32447
|
+
const stored = await this.#store.put({
|
|
32448
|
+
bytes,
|
|
32449
|
+
kind: "resource",
|
|
32450
|
+
mediaType,
|
|
32451
|
+
name: "resource",
|
|
32452
|
+
sessionId,
|
|
32453
|
+
signal
|
|
32454
|
+
});
|
|
32455
|
+
return {
|
|
32456
|
+
_meta: content._meta,
|
|
32457
|
+
annotations: content.annotations,
|
|
32458
|
+
byteLength: stored.byteLength,
|
|
32459
|
+
encoding,
|
|
32460
|
+
mimeType: embedded.mimeType,
|
|
32461
|
+
resourceKey: stored.key,
|
|
32462
|
+
type: "external_resource",
|
|
32463
|
+
uri: embedded.uri
|
|
32464
|
+
};
|
|
32465
|
+
}
|
|
32466
|
+
}
|
|
32467
|
+
}
|
|
32468
|
+
async #toolContent(sessionId, item, signal) {
|
|
32469
|
+
return item.type === "content" ? { ...item, content: await this.#content(sessionId, item.content, signal) } : item;
|
|
32470
|
+
}
|
|
32471
|
+
update = async (sessionId, update, signal) => {
|
|
32472
|
+
switch (update.sessionUpdate) {
|
|
32473
|
+
case "user_message_chunk":
|
|
32474
|
+
case "agent_message_chunk":
|
|
32475
|
+
case "agent_thought_chunk":
|
|
32476
|
+
case "compaction_summary_chunk":
|
|
32477
|
+
return { ...update, content: await this.#content(sessionId, update.content, signal) };
|
|
32478
|
+
case "tool_call":
|
|
32479
|
+
case "tool_call_update":
|
|
32480
|
+
return update.content === void 0 || update.content === null ? update : {
|
|
32481
|
+
...update,
|
|
32482
|
+
content: await Promise.all(
|
|
32483
|
+
update.content.map(async (item) => await this.#toolContent(sessionId, item, signal))
|
|
32484
|
+
)
|
|
32485
|
+
};
|
|
32486
|
+
case "compaction_update":
|
|
32487
|
+
return update.summary === void 0 || update.summary === null ? update : {
|
|
32488
|
+
...update,
|
|
32489
|
+
summary: await Promise.all(
|
|
32490
|
+
update.summary.map(async (content) => await this.#content(sessionId, content, signal))
|
|
32491
|
+
)
|
|
32492
|
+
};
|
|
32493
|
+
case "plan":
|
|
32494
|
+
case "plan_update":
|
|
32495
|
+
case "plan_removed":
|
|
32496
|
+
case "available_commands_update":
|
|
32497
|
+
case "current_mode_update":
|
|
32498
|
+
case "config_option_update":
|
|
32499
|
+
case "session_info_update":
|
|
32500
|
+
case "usage_update":
|
|
32501
|
+
return update;
|
|
32502
|
+
}
|
|
32503
|
+
};
|
|
32504
|
+
};
|
|
32505
|
+
|
|
32506
|
+
// src/external-content/local-external-content-store.ts
|
|
32507
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
32508
|
+
import { lstat, mkdir, readFile as readFile3, realpath as realpath3, rename, rm, stat as stat3, writeFile } from "node:fs/promises";
|
|
32509
|
+
import { dirname as dirname2, join as join4 } from "node:path";
|
|
32510
|
+
var contentRequest = /^mobius-content:(image|audio|resource):([a-f0-9]{64})$/u;
|
|
32511
|
+
var metadataSchema2 = external_exports.strictObject({
|
|
32512
|
+
kind: external_exports.enum(["image", "audio", "resource"]),
|
|
32513
|
+
mediaType: external_exports.string().min(1).max(2048).regex(/^[\u0020-\u007e]+$/u),
|
|
32514
|
+
name: external_exports.string().min(1).max(500)
|
|
32515
|
+
});
|
|
32516
|
+
var UnretainedExternalContentStore = class {
|
|
32517
|
+
put = async ({ bytes, signal }) => {
|
|
32518
|
+
signal.throwIfAborted();
|
|
32519
|
+
return { byteLength: bytes.byteLength, key: createHash("sha256").update(bytes).digest("hex") };
|
|
32520
|
+
};
|
|
32521
|
+
resolve = (_sessionId, _request, signal) => {
|
|
32522
|
+
signal.throwIfAborted();
|
|
32523
|
+
return Promise.resolve(null);
|
|
32524
|
+
};
|
|
32525
|
+
};
|
|
32526
|
+
function sessionScope(sessionId) {
|
|
32527
|
+
return createHash("sha256").update(sessionId).digest("hex");
|
|
32528
|
+
}
|
|
32529
|
+
async function atomicWrite(path2, bytes, signal) {
|
|
32530
|
+
const temporary = `${path2}.${randomUUID()}.tmp`;
|
|
32531
|
+
try {
|
|
32532
|
+
await writeFile(temporary, bytes, { mode: 384, signal });
|
|
32533
|
+
signal.throwIfAborted();
|
|
32534
|
+
await rename(temporary, path2);
|
|
32535
|
+
} finally {
|
|
32536
|
+
await rm(temporary, { force: true });
|
|
32537
|
+
}
|
|
32538
|
+
}
|
|
32539
|
+
var LocalExternalContentStore = class {
|
|
32540
|
+
#root;
|
|
32541
|
+
constructor(stateDirectory) {
|
|
32542
|
+
this.#root = join4(stateDirectory, "tmp", "session-content");
|
|
32543
|
+
}
|
|
32544
|
+
put = async ({ bytes, kind, mediaType, name, sessionId, signal }) => {
|
|
32545
|
+
signal.throwIfAborted();
|
|
32546
|
+
const key = createHash("sha256").update(bytes).digest("hex");
|
|
32547
|
+
const directory = join4(this.#root, sessionScope(sessionId), kind);
|
|
32548
|
+
await mkdir(directory, { mode: 448, recursive: true });
|
|
32549
|
+
signal.throwIfAborted();
|
|
32550
|
+
const path2 = join4(directory, key);
|
|
32551
|
+
await atomicWrite(path2, bytes, signal);
|
|
32552
|
+
await atomicWrite(
|
|
32553
|
+
`${path2}.json`,
|
|
32554
|
+
Buffer.from(JSON.stringify(metadataSchema2.parse({ kind, mediaType, name })), "utf8"),
|
|
32555
|
+
signal
|
|
32556
|
+
);
|
|
32557
|
+
return { byteLength: bytes.byteLength, key };
|
|
32558
|
+
};
|
|
32559
|
+
resolve = async (sessionId, request, signal) => {
|
|
32560
|
+
const matched = contentRequest.exec(request);
|
|
32561
|
+
if (matched === null) {
|
|
32562
|
+
return null;
|
|
32563
|
+
}
|
|
32564
|
+
const kind = matched[1];
|
|
32565
|
+
const key = matched[2];
|
|
32566
|
+
if (kind !== "image" && kind !== "audio" && kind !== "resource" || key === void 0) {
|
|
32567
|
+
return null;
|
|
32568
|
+
}
|
|
32569
|
+
const directory = join4(this.#root, sessionScope(sessionId), kind);
|
|
32570
|
+
const path2 = join4(directory, key);
|
|
32571
|
+
try {
|
|
32572
|
+
const [resolvedDirectory, resolvedPath, file2, metadata] = await Promise.all([
|
|
32573
|
+
realpath3(directory),
|
|
32574
|
+
realpath3(path2),
|
|
32575
|
+
lstat(path2),
|
|
32576
|
+
readFile3(`${path2}.json`, "utf8").then((value) => metadataSchema2.parse(JSON.parse(value)))
|
|
32577
|
+
]);
|
|
32578
|
+
signal.throwIfAborted();
|
|
32579
|
+
if (!file2.isFile() || dirname2(resolvedPath) !== resolvedDirectory || metadata.kind !== kind) {
|
|
32580
|
+
return null;
|
|
32581
|
+
}
|
|
32582
|
+
await stat3(resolvedPath);
|
|
32583
|
+
signal.throwIfAborted();
|
|
32584
|
+
return { mediaType: metadata.mediaType, name: metadata.name, path: resolvedPath };
|
|
32585
|
+
} catch {
|
|
32586
|
+
signal.throwIfAborted();
|
|
32587
|
+
return null;
|
|
32588
|
+
}
|
|
32589
|
+
};
|
|
32590
|
+
};
|
|
32591
|
+
|
|
32374
32592
|
// src/native-sessions/chat-agent.ts
|
|
32375
32593
|
function supportsNativeChat(agentId) {
|
|
32376
32594
|
return agentId === "codex" || agentId === "claude" || agentId === "opencode" || agentId === "pi";
|
|
@@ -32587,7 +32805,7 @@ var AgentRuntimeManager = class {
|
|
|
32587
32805
|
touch: this.#processes.touch,
|
|
32588
32806
|
changed: this.#processes.notifyChanged
|
|
32589
32807
|
});
|
|
32590
|
-
#queryProcesses
|
|
32808
|
+
#queryProcesses;
|
|
32591
32809
|
#executions = new ActiveExecutions();
|
|
32592
32810
|
#agentSettingsObserver = new NullAcpSessionObserver();
|
|
32593
32811
|
#nativeOperations = /* @__PURE__ */ new Set();
|
|
@@ -32595,13 +32813,16 @@ var AgentRuntimeManager = class {
|
|
|
32595
32813
|
#nativeHistoryReader;
|
|
32596
32814
|
#sessionIdentity;
|
|
32597
32815
|
#onSessionStatusChanged;
|
|
32816
|
+
#contentExternalizer;
|
|
32598
32817
|
#observer;
|
|
32599
|
-
constructor(observer = new NullAcpSessionObserver(), store = new MemoryAcpSessionStore(), nativeHistoryReader = null, sessionIdentity = "assigned", onSessionStatusChanged = () => void 0) {
|
|
32818
|
+
constructor(observer = new NullAcpSessionObserver(), store = new MemoryAcpSessionStore(), nativeHistoryReader = null, sessionIdentity = "assigned", onSessionStatusChanged = () => void 0, contentExternalizer = new AcpContentExternalizer(new UnretainedExternalContentStore())) {
|
|
32600
32819
|
this.#observer = observer;
|
|
32601
32820
|
this.#store = store;
|
|
32602
32821
|
this.#nativeHistoryReader = nativeHistoryReader;
|
|
32603
32822
|
this.#sessionIdentity = sessionIdentity;
|
|
32604
32823
|
this.#onSessionStatusChanged = onSessionStatusChanged;
|
|
32824
|
+
this.#contentExternalizer = contentExternalizer;
|
|
32825
|
+
this.#queryProcesses = new AgentQueryProcesses(this.#processes, contentExternalizer);
|
|
32605
32826
|
}
|
|
32606
32827
|
setObserver = (observer) => {
|
|
32607
32828
|
this.#observer = observer;
|
|
@@ -32642,7 +32863,8 @@ var AgentRuntimeManager = class {
|
|
|
32642
32863
|
options.origin === void 0 && this.#sessionIdentity === "native" && isNativeChatSessionId(options.agent.id, options.sessionId) && this.#store.read(options.sessionId) instanceof MissingAcpStoredSession ? { ...options, origin: { kind: "import", nativeSessionId: options.sessionId } } : options,
|
|
32643
32864
|
() => this.#observer,
|
|
32644
32865
|
this.#store,
|
|
32645
|
-
metrics
|
|
32866
|
+
metrics,
|
|
32867
|
+
this.#contentExternalizer
|
|
32646
32868
|
)
|
|
32647
32869
|
);
|
|
32648
32870
|
});
|
|
@@ -32657,7 +32879,13 @@ var AgentRuntimeManager = class {
|
|
|
32657
32879
|
this.#store.remove(options.sessionId);
|
|
32658
32880
|
return await this.#startRetainedSessionProcess(
|
|
32659
32881
|
options,
|
|
32660
|
-
async () => await AgentSession.start(
|
|
32882
|
+
async () => await AgentSession.start(
|
|
32883
|
+
options,
|
|
32884
|
+
() => this.#observer,
|
|
32885
|
+
this.#store,
|
|
32886
|
+
metrics,
|
|
32887
|
+
this.#contentExternalizer
|
|
32888
|
+
)
|
|
32661
32889
|
);
|
|
32662
32890
|
});
|
|
32663
32891
|
}
|
|
@@ -32667,7 +32895,13 @@ var AgentRuntimeManager = class {
|
|
|
32667
32895
|
await this.#retireSessionProcess(options.sessionId, existing, async () => await existing.close());
|
|
32668
32896
|
const runtime = await this.#startRetainedSessionProcess(
|
|
32669
32897
|
options,
|
|
32670
|
-
async () => await AgentSession.start(
|
|
32898
|
+
async () => await AgentSession.start(
|
|
32899
|
+
options,
|
|
32900
|
+
() => this.#observer,
|
|
32901
|
+
this.#store,
|
|
32902
|
+
unmeasuredOperationMetrics,
|
|
32903
|
+
this.#contentExternalizer
|
|
32904
|
+
)
|
|
32671
32905
|
);
|
|
32672
32906
|
try {
|
|
32673
32907
|
for (const desired of desiredConfigOptions) {
|
|
@@ -32763,7 +32997,9 @@ var AgentRuntimeManager = class {
|
|
|
32763
32997
|
sessionId: `agent-settings-${crypto.randomUUID()}`
|
|
32764
32998
|
},
|
|
32765
32999
|
() => this.#agentSettingsObserver,
|
|
32766
|
-
new MemoryAcpSessionStore()
|
|
33000
|
+
new MemoryAcpSessionStore(),
|
|
33001
|
+
unmeasuredOperationMetrics,
|
|
33002
|
+
this.#contentExternalizer
|
|
32767
33003
|
),
|
|
32768
33004
|
async (runtime) => {
|
|
32769
33005
|
const prepared = runtime.prepared();
|
|
@@ -33293,7 +33529,7 @@ var LocalAuthorizationError = class extends Error {
|
|
|
33293
33529
|
};
|
|
33294
33530
|
|
|
33295
33531
|
// src/pairing/pair-local-machine.ts
|
|
33296
|
-
import { mkdir as
|
|
33532
|
+
import { mkdir as mkdir6, realpath as realpath8, stat as stat7 } from "node:fs/promises";
|
|
33297
33533
|
import { hostname as hostname3 } from "node:os";
|
|
33298
33534
|
import { basename as basename3, resolve as resolve5 } from "node:path";
|
|
33299
33535
|
import { fetch as fetch2 } from "undici";
|
|
@@ -33438,8 +33674,8 @@ var LocalAgentInventory = class {
|
|
|
33438
33674
|
};
|
|
33439
33675
|
|
|
33440
33676
|
// src/agent-installation/managed-npm-package.ts
|
|
33441
|
-
import { mkdir, mkdtemp, open as open3, realpath as
|
|
33442
|
-
import { delimiter, dirname as
|
|
33677
|
+
import { mkdir as mkdir2, mkdtemp, open as open3, realpath as realpath4, rename as rename2, rm as rm2, stat as stat4 } from "node:fs/promises";
|
|
33678
|
+
import { delimiter, dirname as dirname3, isAbsolute as isAbsolute2, join as join5, relative, sep } from "node:path";
|
|
33443
33679
|
var INSTALL_TIMEOUT_MILLISECONDS = 5 * 60 * 1e3;
|
|
33444
33680
|
var PACKAGE_METADATA_LIMIT_BYTES = 64 * 1024;
|
|
33445
33681
|
var PACKAGE_LOCK_LIMIT_BYTES = 8 * 1024 * 1024;
|
|
@@ -33490,7 +33726,7 @@ function isRecord6(value) {
|
|
|
33490
33726
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
33491
33727
|
}
|
|
33492
33728
|
function packagePath(root, packageName) {
|
|
33493
|
-
return
|
|
33729
|
+
return join5(root, "node_modules", ...packageName.split("/"));
|
|
33494
33730
|
}
|
|
33495
33731
|
function isContainedPath(root, candidate) {
|
|
33496
33732
|
const difference = relative(root, candidate);
|
|
@@ -33595,14 +33831,14 @@ function verifyPackageLockEntry(lock, definition, verifyDependencyClosure) {
|
|
|
33595
33831
|
}
|
|
33596
33832
|
}
|
|
33597
33833
|
async function verifyRequiredDependency(rootPath, lock, definition) {
|
|
33598
|
-
const dependencyRoot = await
|
|
33834
|
+
const dependencyRoot = await realpath4(packagePath(rootPath, definition.packageName));
|
|
33599
33835
|
if (!isContainedPath(rootPath, dependencyRoot)) {
|
|
33600
33836
|
throw new ManagedNpmPackageError(
|
|
33601
33837
|
"managed_package_verification_failed",
|
|
33602
33838
|
"The required managed npm dependency escaped its private cache"
|
|
33603
33839
|
);
|
|
33604
33840
|
}
|
|
33605
|
-
const metadata = await readJsonRecord(
|
|
33841
|
+
const metadata = await readJsonRecord(join5(dependencyRoot, "package.json"), PACKAGE_METADATA_LIMIT_BYTES);
|
|
33606
33842
|
if (metadata["name"] !== definition.packageName || metadata["version"] !== definition.version) {
|
|
33607
33843
|
throw new ManagedNpmPackageError(
|
|
33608
33844
|
"managed_package_verification_failed",
|
|
@@ -33624,15 +33860,15 @@ async function validateManagedNpmPackage(root, definition) {
|
|
|
33624
33860
|
}
|
|
33625
33861
|
}
|
|
33626
33862
|
async function validateManagedNpmPackageContents(root, definition) {
|
|
33627
|
-
const rootPath = await
|
|
33628
|
-
const packageRoot = await
|
|
33863
|
+
const rootPath = await realpath4(root);
|
|
33864
|
+
const packageRoot = await realpath4(packagePath(rootPath, definition.packageName));
|
|
33629
33865
|
if (!isContainedPath(rootPath, packageRoot)) {
|
|
33630
33866
|
throw new ManagedNpmPackageError(
|
|
33631
33867
|
"managed_package_verification_failed",
|
|
33632
33868
|
"The managed npm package escaped its private cache"
|
|
33633
33869
|
);
|
|
33634
33870
|
}
|
|
33635
|
-
const metadata = await readJsonRecord(
|
|
33871
|
+
const metadata = await readJsonRecord(join5(packageRoot, "package.json"), PACKAGE_METADATA_LIMIT_BYTES);
|
|
33636
33872
|
if (metadata["name"] !== definition.packageName || metadata["version"] !== definition.version) {
|
|
33637
33873
|
throw new ManagedNpmPackageError(
|
|
33638
33874
|
"managed_package_verification_failed",
|
|
@@ -33640,14 +33876,14 @@ async function validateManagedNpmPackageContents(root, definition) {
|
|
|
33640
33876
|
);
|
|
33641
33877
|
}
|
|
33642
33878
|
if (definition instanceof SriManagedNpmPackageDefinition) {
|
|
33643
|
-
const lock = await readJsonRecord(
|
|
33879
|
+
const lock = await readJsonRecord(join5(rootPath, "package-lock.json"), PACKAGE_LOCK_LIMIT_BYTES);
|
|
33644
33880
|
verifyPackageLockEntry(lock, definition, definition.verifyDependencyClosure);
|
|
33645
33881
|
for (const dependency of definition.requiredDependencies) {
|
|
33646
33882
|
await verifyRequiredDependency(rootPath, lock, dependency);
|
|
33647
33883
|
}
|
|
33648
33884
|
}
|
|
33649
33885
|
const declaredBin = readBinPath(metadata, definition.executableName);
|
|
33650
|
-
const executable = await resolveExecutablePath(
|
|
33886
|
+
const executable = await resolveExecutablePath(join5(packageRoot, declaredBin));
|
|
33651
33887
|
if (executable === null || !isContainedPath(rootPath, executable.path)) {
|
|
33652
33888
|
throw new ManagedNpmPackageError(
|
|
33653
33889
|
"managed_package_verification_failed",
|
|
@@ -33660,7 +33896,7 @@ var ManagedNpmPackageInstaller = class {
|
|
|
33660
33896
|
install = async (root, definition, environment, signal) => {
|
|
33661
33897
|
signal.throwIfAborted();
|
|
33662
33898
|
try {
|
|
33663
|
-
const metadata = await
|
|
33899
|
+
const metadata = await stat4(root);
|
|
33664
33900
|
if (metadata.isDirectory()) {
|
|
33665
33901
|
return await validateManagedNpmPackage(root, definition);
|
|
33666
33902
|
}
|
|
@@ -33669,9 +33905,9 @@ var ManagedNpmPackageInstaller = class {
|
|
|
33669
33905
|
throw error62;
|
|
33670
33906
|
}
|
|
33671
33907
|
}
|
|
33672
|
-
const parent =
|
|
33673
|
-
await
|
|
33674
|
-
const staging = await mkdtemp(
|
|
33908
|
+
const parent = dirname3(root);
|
|
33909
|
+
await mkdir2(parent, { mode: 448, recursive: true });
|
|
33910
|
+
const staging = await mkdtemp(join5(parent, `.${definition.version}.staging-`));
|
|
33675
33911
|
try {
|
|
33676
33912
|
const npm = await findExecutableOnPath(process.platform === "win32" ? "npm.cmd" : "npm", environment);
|
|
33677
33913
|
if (npm === null) {
|
|
@@ -33697,14 +33933,14 @@ var ManagedNpmPackageInstaller = class {
|
|
|
33697
33933
|
`${definition.packageName}@${definition.version}`
|
|
33698
33934
|
);
|
|
33699
33935
|
const installEnvironment = {
|
|
33700
|
-
HOME:
|
|
33936
|
+
HOME: join5(staging, "home"),
|
|
33701
33937
|
NPM_CONFIG_AUDIT: "false",
|
|
33702
|
-
NPM_CONFIG_CACHE:
|
|
33938
|
+
NPM_CONFIG_CACHE: join5(staging, ".npm-cache"),
|
|
33703
33939
|
NPM_CONFIG_FUND: "false",
|
|
33704
33940
|
NPM_CONFIG_IGNORE_SCRIPTS: "true",
|
|
33705
33941
|
NPM_CONFIG_PACKAGE_LOCK: "true",
|
|
33706
33942
|
NPM_CONFIG_REGISTRY: "https://registry.npmjs.org/",
|
|
33707
|
-
PATH: `${
|
|
33943
|
+
PATH: `${dirname3(process.execPath)}${delimiter}/usr/bin${delimiter}/bin`
|
|
33708
33944
|
};
|
|
33709
33945
|
if (definition.includeOptionalDependencies) {
|
|
33710
33946
|
installEnvironment["NPM_CONFIG_INCLUDE"] = "optional";
|
|
@@ -33721,12 +33957,12 @@ var ManagedNpmPackageInstaller = class {
|
|
|
33721
33957
|
timeoutMilliseconds: INSTALL_TIMEOUT_MILLISECONDS
|
|
33722
33958
|
});
|
|
33723
33959
|
await Promise.all([
|
|
33724
|
-
|
|
33725
|
-
|
|
33960
|
+
rm2(join5(staging, ".npm-cache"), { force: true, recursive: true }),
|
|
33961
|
+
rm2(join5(staging, "home"), { force: true, recursive: true })
|
|
33726
33962
|
]);
|
|
33727
33963
|
await validateManagedNpmPackage(staging, definition);
|
|
33728
33964
|
try {
|
|
33729
|
-
await
|
|
33965
|
+
await rename2(staging, root);
|
|
33730
33966
|
} catch (error62) {
|
|
33731
33967
|
try {
|
|
33732
33968
|
return await validateManagedNpmPackage(root, definition);
|
|
@@ -33752,13 +33988,13 @@ var ManagedNpmPackageInstaller = class {
|
|
|
33752
33988
|
{ cause: error62 }
|
|
33753
33989
|
);
|
|
33754
33990
|
} finally {
|
|
33755
|
-
await
|
|
33991
|
+
await rm2(staging, { force: true, recursive: true });
|
|
33756
33992
|
}
|
|
33757
33993
|
};
|
|
33758
33994
|
};
|
|
33759
33995
|
|
|
33760
33996
|
// src/agent-catalog/agent-specification.ts
|
|
33761
|
-
import { join as
|
|
33997
|
+
import { join as join6 } from "node:path";
|
|
33762
33998
|
|
|
33763
33999
|
// src/agent-catalog/version-output.ts
|
|
33764
34000
|
function normalizeVersionOutput(output2) {
|
|
@@ -33781,7 +34017,7 @@ var LocalAgentSpecification = class {
|
|
|
33781
34017
|
resolveManagedAgent = async (stateDirectory, platform, signal) => {
|
|
33782
34018
|
signal.throwIfAborted();
|
|
33783
34019
|
const executable = await resolveExecutablePath(
|
|
33784
|
-
|
|
34020
|
+
join6(stateDirectory, ...this.managedAgentExecutablePath),
|
|
33785
34021
|
platform
|
|
33786
34022
|
);
|
|
33787
34023
|
signal.throwIfAborted();
|
|
@@ -35707,7 +35943,7 @@ var AgentProbeError = class extends Error {
|
|
|
35707
35943
|
};
|
|
35708
35944
|
|
|
35709
35945
|
// src/agent-catalog/agents/resolve-user-local-executable.ts
|
|
35710
|
-
import { isAbsolute as isAbsolute3, join as
|
|
35946
|
+
import { isAbsolute as isAbsolute3, join as join7 } from "node:path";
|
|
35711
35947
|
async function resolveUserLocalExecutable(executableName, context) {
|
|
35712
35948
|
context.signal.throwIfAborted();
|
|
35713
35949
|
const platform = context.platform ?? process.platform;
|
|
@@ -35715,7 +35951,7 @@ async function resolveUserLocalExecutable(executableName, context) {
|
|
|
35715
35951
|
if (platform === "win32" || homeDirectory === void 0 || !isAbsolute3(homeDirectory)) {
|
|
35716
35952
|
return [];
|
|
35717
35953
|
}
|
|
35718
|
-
const executable = await resolveExecutablePath(
|
|
35954
|
+
const executable = await resolveExecutablePath(join7(homeDirectory, ".local", "bin", executableName), platform);
|
|
35719
35955
|
context.signal.throwIfAborted();
|
|
35720
35956
|
return executable === null ? [] : [executable];
|
|
35721
35957
|
}
|
|
@@ -35804,8 +36040,8 @@ var CursorCliAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
35804
36040
|
};
|
|
35805
36041
|
|
|
35806
36042
|
// src/agent-catalog/agents/deepseek-harness-agent.ts
|
|
35807
|
-
import { mkdir as
|
|
35808
|
-
import { isAbsolute as isAbsolute4, join as
|
|
36043
|
+
import { mkdir as mkdir3, realpath as realpath5, stat as stat5, writeFile as writeFile2 } from "node:fs/promises";
|
|
36044
|
+
import { isAbsolute as isAbsolute4, join as join8, normalize as normalize2 } from "node:path";
|
|
35809
36045
|
|
|
35810
36046
|
// src/agent-installation/deepseek-managed-package.ts
|
|
35811
36047
|
var DeepSeekHarnessManagedPackage = class extends SriManagedNpmPackageDefinition {
|
|
@@ -35834,15 +36070,15 @@ async function prepareAgentHome(path2, imagePrompts) {
|
|
|
35834
36070
|
}
|
|
35835
36071
|
try {
|
|
35836
36072
|
if (imagePrompts) {
|
|
35837
|
-
await
|
|
36073
|
+
await mkdir3(path2, { mode: 448, recursive: true });
|
|
35838
36074
|
}
|
|
35839
|
-
const resolved = await
|
|
35840
|
-
const metadata = await
|
|
36075
|
+
const resolved = await realpath5(path2);
|
|
36076
|
+
const metadata = await stat5(resolved);
|
|
35841
36077
|
if (!metadata.isDirectory() || typeof process.getuid === "function" && metadata.uid !== process.getuid()) {
|
|
35842
36078
|
throw new Error("Agent home is not a user-owned directory");
|
|
35843
36079
|
}
|
|
35844
36080
|
if (imagePrompts) {
|
|
35845
|
-
await
|
|
36081
|
+
await writeFile2(join8(resolved, "cordis.patch.yml"), DEEPSEEK_HARNESS_IMAGE_PROMPT_PATCH, {
|
|
35846
36082
|
mode: 384
|
|
35847
36083
|
});
|
|
35848
36084
|
}
|
|
@@ -35890,7 +36126,7 @@ var DeepSeekHarnessAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
35890
36126
|
context.signal
|
|
35891
36127
|
);
|
|
35892
36128
|
if (managed.path === agent.path) {
|
|
35893
|
-
selectedHome =
|
|
36129
|
+
selectedHome = join8(readStateDirectory(context.environment), "agents", this.id, "home");
|
|
35894
36130
|
managedHome = true;
|
|
35895
36131
|
}
|
|
35896
36132
|
} catch {
|
|
@@ -35906,7 +36142,7 @@ var DeepSeekHarnessAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
35906
36142
|
resolveManagedAgent = async (stateDirectory, _platform, signal) => {
|
|
35907
36143
|
signal.throwIfAborted();
|
|
35908
36144
|
const executable = await validateManagedNpmPackage(
|
|
35909
|
-
|
|
36145
|
+
join8(stateDirectory, "agents", this.id, DEEPSEEK_HARNESS_PACKAGE.version),
|
|
35910
36146
|
DEEPSEEK_HARNESS_PACKAGE
|
|
35911
36147
|
);
|
|
35912
36148
|
signal.throwIfAborted();
|
|
@@ -35960,8 +36196,8 @@ var GeminiCliAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
35960
36196
|
};
|
|
35961
36197
|
|
|
35962
36198
|
// src/agent-catalog/agents/grok-build-agent.ts
|
|
35963
|
-
import { realpath as
|
|
35964
|
-
import { isAbsolute as isAbsolute5, join as
|
|
36199
|
+
import { realpath as realpath6 } from "node:fs/promises";
|
|
36200
|
+
import { isAbsolute as isAbsolute5, join as join9, relative as relative2, sep as sep2 } from "node:path";
|
|
35965
36201
|
import {
|
|
35966
36202
|
RequestError as RequestError2
|
|
35967
36203
|
} from "@agentclientprotocol/sdk";
|
|
@@ -36056,8 +36292,8 @@ var GrokBuildAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
36056
36292
|
);
|
|
36057
36293
|
if (managed.path === agent.path) {
|
|
36058
36294
|
return Object.freeze({
|
|
36059
|
-
GROK_HOME: await
|
|
36060
|
-
|
|
36295
|
+
GROK_HOME: await realpath6(
|
|
36296
|
+
join9(stateDirectory, "agents", this.id, GROK_BUILD_MANAGED_VERSION, "home")
|
|
36061
36297
|
)
|
|
36062
36298
|
});
|
|
36063
36299
|
}
|
|
@@ -36068,9 +36304,9 @@ var GrokBuildAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
36068
36304
|
};
|
|
36069
36305
|
resolveManagedAgent = async (stateDirectory, platform, signal) => {
|
|
36070
36306
|
signal.throwIfAborted();
|
|
36071
|
-
const versionRoot = await
|
|
36072
|
-
await validateManagedNpmPackage(
|
|
36073
|
-
const executable = await resolveExecutablePath(
|
|
36307
|
+
const versionRoot = await realpath6(join9(stateDirectory, "agents", this.id, GROK_BUILD_MANAGED_VERSION));
|
|
36308
|
+
await validateManagedNpmPackage(join9(versionRoot, "package"), grokBuildManagedPackage(platform, process.arch));
|
|
36309
|
+
const executable = await resolveExecutablePath(join9(versionRoot, "home", "bin", "grok"), platform);
|
|
36074
36310
|
signal.throwIfAborted();
|
|
36075
36311
|
if (executable === null || !isContainedPath2(versionRoot, executable.path)) {
|
|
36076
36312
|
throw new AgentProbeError("managed_agent_invalid", "The managed Grok Build executable is invalid");
|
|
@@ -36170,13 +36406,13 @@ var OhMyPiAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
36170
36406
|
};
|
|
36171
36407
|
|
|
36172
36408
|
// src/agent-catalog/agents/opencode-agent.ts
|
|
36173
|
-
import { join as
|
|
36409
|
+
import { join as join11 } from "node:path";
|
|
36174
36410
|
|
|
36175
36411
|
// src/agent-installation/managed-agent-archive.ts
|
|
36176
|
-
import { createHash } from "node:crypto";
|
|
36412
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
36177
36413
|
import { createReadStream } from "node:fs";
|
|
36178
|
-
import { chmod, copyFile, mkdir as
|
|
36179
|
-
import { delimiter as delimiter2, dirname as
|
|
36414
|
+
import { chmod, copyFile, mkdir as mkdir4, mkdtemp as mkdtemp2, open as open4, realpath as realpath7, rename as rename3, rm as rm3, stat as stat6, writeFile as writeFile3 } from "node:fs/promises";
|
|
36415
|
+
import { delimiter as delimiter2, dirname as dirname4, isAbsolute as isAbsolute6, join as join10, relative as relative3, sep as sep3 } from "node:path";
|
|
36180
36416
|
|
|
36181
36417
|
// src/agent-installation/verified-download.ts
|
|
36182
36418
|
import { fetch } from "undici";
|
|
@@ -36286,7 +36522,7 @@ function isContainedPath3(root, candidate) {
|
|
|
36286
36522
|
}
|
|
36287
36523
|
async function hashFile(path2, signal) {
|
|
36288
36524
|
signal.throwIfAborted();
|
|
36289
|
-
const digest =
|
|
36525
|
+
const digest = createHash2("sha256");
|
|
36290
36526
|
const stream = createReadStream(path2, { signal });
|
|
36291
36527
|
try {
|
|
36292
36528
|
for await (const chunk of stream) {
|
|
@@ -36356,16 +36592,16 @@ async function readManifest(path2) {
|
|
|
36356
36592
|
}
|
|
36357
36593
|
async function validateManagedAgentArchive(root, definition, signal) {
|
|
36358
36594
|
try {
|
|
36359
|
-
const rootPath = await
|
|
36360
|
-
const rootMetadata = await
|
|
36595
|
+
const rootPath = await realpath7(root);
|
|
36596
|
+
const rootMetadata = await stat6(rootPath);
|
|
36361
36597
|
if (!rootMetadata.isDirectory() || typeof process.getuid === "function" && rootMetadata.uid !== process.getuid()) {
|
|
36362
36598
|
throw new Error("Managed Agent root is not user-owned");
|
|
36363
36599
|
}
|
|
36364
|
-
const manifest = await readManifest(
|
|
36600
|
+
const manifest = await readManifest(join10(rootPath, "archive.json"));
|
|
36365
36601
|
if (manifest["archiveSha256"] !== definition.archiveSha256 || manifest["archiveUrl"] !== definition.archiveUrl.toString() || manifest["version"] !== definition.version || typeof manifest["executableSha256"] !== "string") {
|
|
36366
36602
|
throw new Error("Managed Agent archive identity is invalid");
|
|
36367
36603
|
}
|
|
36368
|
-
const executable = await resolveExecutablePath(
|
|
36604
|
+
const executable = await resolveExecutablePath(join10(rootPath, "bin", definition.executableName));
|
|
36369
36605
|
if (executable === null || !isContainedPath3(rootPath, executable.path) || await hashFile(executable.path, signal) !== manifest["executableSha256"]) {
|
|
36370
36606
|
throw new Error("Managed Agent executable is invalid");
|
|
36371
36607
|
}
|
|
@@ -36557,7 +36793,7 @@ var OpenCodeAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
36557
36793
|
return Object.freeze(environment);
|
|
36558
36794
|
};
|
|
36559
36795
|
resolveManagedAgent = async (stateDirectory, platform, signal) => await validateManagedAgentArchive(
|
|
36560
|
-
|
|
36796
|
+
join11(stateDirectory, "agents", this.id, OPENCODE_MANAGED_VERSION),
|
|
36561
36797
|
openCodeManagedArchive(platform, process.arch),
|
|
36562
36798
|
signal
|
|
36563
36799
|
);
|
|
@@ -36575,7 +36811,7 @@ var OpenCodeAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
36575
36811
|
};
|
|
36576
36812
|
|
|
36577
36813
|
// src/agent-catalog/agents/pi-agent.ts
|
|
36578
|
-
import { join as
|
|
36814
|
+
import { join as join12 } from "node:path";
|
|
36579
36815
|
import {
|
|
36580
36816
|
methods as methods7
|
|
36581
36817
|
} from "@agentclientprotocol/sdk";
|
|
@@ -36634,7 +36870,7 @@ var PiAgentSpecification = class extends BridgedAcpAgentDefinition {
|
|
|
36634
36870
|
resolveManagedAgent = async (stateDirectory, _platform, signal) => {
|
|
36635
36871
|
signal.throwIfAborted();
|
|
36636
36872
|
const executable = await validateManagedNpmPackage(
|
|
36637
|
-
|
|
36873
|
+
join12(stateDirectory, "agents", this.id, PI_AGENT_PACKAGE.version),
|
|
36638
36874
|
PI_AGENT_PACKAGE
|
|
36639
36875
|
);
|
|
36640
36876
|
signal.throwIfAborted();
|
|
@@ -36672,7 +36908,7 @@ var PiAgentSpecification = class extends BridgedAcpAgentDefinition {
|
|
|
36672
36908
|
};
|
|
36673
36909
|
|
|
36674
36910
|
// src/agent-catalog/agents/workbuddy-agent.ts
|
|
36675
|
-
import { isAbsolute as isAbsolute7, join as
|
|
36911
|
+
import { isAbsolute as isAbsolute7, join as join13 } from "node:path";
|
|
36676
36912
|
|
|
36677
36913
|
// src/agent-installation/workbuddy-managed-package.ts
|
|
36678
36914
|
var WORKBUDDY_MANAGED_VERSION = "2.146.0";
|
|
@@ -36727,7 +36963,7 @@ var WorkBuddyAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
36727
36963
|
resolveManagedAgent = async (stateDirectory, _platform, signal) => {
|
|
36728
36964
|
signal.throwIfAborted();
|
|
36729
36965
|
const executable = await validateManagedNpmPackage(
|
|
36730
|
-
|
|
36966
|
+
join13(stateDirectory, "agents", this.id, WORKBUDDY_MANAGED_VERSION),
|
|
36731
36967
|
WORKBUDDY_MANAGED_PACKAGE
|
|
36732
36968
|
);
|
|
36733
36969
|
signal.throwIfAborted();
|
|
@@ -36738,10 +36974,10 @@ var WorkBuddyAgentSpecification = class extends DirectAcpAgentDefinition {
|
|
|
36738
36974
|
if ((context.platform ?? process.platform) !== "darwin") {
|
|
36739
36975
|
return [];
|
|
36740
36976
|
}
|
|
36741
|
-
const requestedPaths = [
|
|
36977
|
+
const requestedPaths = [join13("/Applications", ...WORKBUDDY_MACOS_EXECUTABLE_PATH)];
|
|
36742
36978
|
const homeDirectory = context.environment["HOME"];
|
|
36743
36979
|
if (homeDirectory !== void 0 && isAbsolute7(homeDirectory)) {
|
|
36744
|
-
requestedPaths.unshift(
|
|
36980
|
+
requestedPaths.unshift(join13(homeDirectory, "Applications", ...WORKBUDDY_MACOS_EXECUTABLE_PATH));
|
|
36745
36981
|
}
|
|
36746
36982
|
const executables = [];
|
|
36747
36983
|
for (const requestedPath2 of requestedPaths) {
|
|
@@ -37076,10 +37312,10 @@ function isAgentVersionSupported(reportedVersion, minimumSupportedVersion) {
|
|
|
37076
37312
|
}
|
|
37077
37313
|
|
|
37078
37314
|
// src/agent-catalog/executable-discovery.ts
|
|
37079
|
-
import { isAbsolute as isAbsolute8, join as
|
|
37315
|
+
import { isAbsolute as isAbsolute8, join as join15 } from "node:path";
|
|
37080
37316
|
|
|
37081
37317
|
// src/agent-installation/managed-adapter-installer.ts
|
|
37082
|
-
import { join as
|
|
37318
|
+
import { join as join14 } from "node:path";
|
|
37083
37319
|
var ManagedAdapterInstallError = class extends Error {
|
|
37084
37320
|
code;
|
|
37085
37321
|
constructor(code, message, options = {}) {
|
|
@@ -37136,7 +37372,7 @@ var ManagedAdapterInstaller = class {
|
|
|
37136
37372
|
this.#stateDirectory = options.stateDirectory;
|
|
37137
37373
|
}
|
|
37138
37374
|
install = async (specification, signal) => {
|
|
37139
|
-
const root =
|
|
37375
|
+
const root = join14(this.#stateDirectory, "adapters", specification.id, specification.adapterVersion);
|
|
37140
37376
|
try {
|
|
37141
37377
|
return await this.#npmInstaller.install(
|
|
37142
37378
|
root,
|
|
@@ -37170,7 +37406,7 @@ async function resolveManagedAdapterExecutable(specification, context) {
|
|
|
37170
37406
|
let managed;
|
|
37171
37407
|
try {
|
|
37172
37408
|
managed = await validateManagedAdapter(
|
|
37173
|
-
|
|
37409
|
+
join15(readStateDirectory(context.environment), "adapters", specification.id, specification.adapterVersion),
|
|
37174
37410
|
specification
|
|
37175
37411
|
);
|
|
37176
37412
|
} catch {
|
|
@@ -37484,9 +37720,9 @@ async function discoverLocalAgentInventory(options) {
|
|
|
37484
37720
|
}
|
|
37485
37721
|
|
|
37486
37722
|
// src/storage/runtime-installation-store.ts
|
|
37487
|
-
import { createHash as
|
|
37488
|
-
import { mkdir as
|
|
37489
|
-
import { dirname as
|
|
37723
|
+
import { createHash as createHash3, randomUUID as randomUUID2 } from "node:crypto";
|
|
37724
|
+
import { mkdir as mkdir5, open as open5, readdir as readdir2, rename as rename4, unlink, writeFile as writeFile4 } from "node:fs/promises";
|
|
37725
|
+
import { dirname as dirname5, join as join16, resolve as resolve4 } from "node:path";
|
|
37490
37726
|
var APPLICATION_ID_PATTERN = /^[a-z][a-z0-9]*(?:[.-][a-z0-9]+){1,31}$/;
|
|
37491
37727
|
var CONNECTION_ID_PATTERN = /^mcn_[a-f0-9]{32}$/;
|
|
37492
37728
|
var INSTALLATION_ID_PATTERN = /^min_[a-f0-9]{32}$/;
|
|
@@ -37614,13 +37850,13 @@ function parseRelayOrigin(value) {
|
|
|
37614
37850
|
return origin;
|
|
37615
37851
|
}
|
|
37616
37852
|
function connectionId() {
|
|
37617
|
-
return `mcn_${
|
|
37853
|
+
return `mcn_${randomUUID2().replaceAll("-", "")}`;
|
|
37618
37854
|
}
|
|
37619
37855
|
function installationId() {
|
|
37620
|
-
return `min_${
|
|
37856
|
+
return `min_${randomUUID2().replaceAll("-", "")}`;
|
|
37621
37857
|
}
|
|
37622
37858
|
function channelIndexFileName(channelId) {
|
|
37623
|
-
return `mci_${
|
|
37859
|
+
return `mci_${createHash3("sha256").update(channelId).digest("hex")}.json`;
|
|
37624
37860
|
}
|
|
37625
37861
|
function decodeInstallationPointer(value) {
|
|
37626
37862
|
if (!isRecord8(value) || !hasExactKeys(value, INSTALLATION_POINTER_KEYS) || value["version"] !== 1) {
|
|
@@ -37728,15 +37964,15 @@ async function readJsonFile(path2, signal, missingCode) {
|
|
|
37728
37964
|
}
|
|
37729
37965
|
async function writeJsonAtomically(path2, value, signal) {
|
|
37730
37966
|
signal.throwIfAborted();
|
|
37731
|
-
const directory =
|
|
37732
|
-
const temporaryPath =
|
|
37967
|
+
const directory = dirname5(path2);
|
|
37968
|
+
const temporaryPath = join16(directory, `.${randomUUID2()}.tmp`);
|
|
37733
37969
|
try {
|
|
37734
|
-
await
|
|
37970
|
+
await mkdir5(directory, { mode: 448, recursive: true });
|
|
37735
37971
|
signal.throwIfAborted();
|
|
37736
|
-
await
|
|
37972
|
+
await writeFile4(temporaryPath, `${JSON.stringify(value, null, 2)}
|
|
37737
37973
|
`, { flag: "wx", mode: 384 });
|
|
37738
37974
|
signal.throwIfAborted();
|
|
37739
|
-
await
|
|
37975
|
+
await rename4(temporaryPath, path2);
|
|
37740
37976
|
} catch (cause) {
|
|
37741
37977
|
await unlink(temporaryPath).catch(() => void 0);
|
|
37742
37978
|
signal.throwIfAborted();
|
|
@@ -37755,16 +37991,16 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
|
|
|
37755
37991
|
this.applicationId = applicationId;
|
|
37756
37992
|
this.installationId = installationId2;
|
|
37757
37993
|
this.stateDirectory = stateDirectory;
|
|
37758
|
-
this.#channelDirectory =
|
|
37759
|
-
this.#connectionDirectory =
|
|
37994
|
+
this.#channelDirectory = join16(stateDirectory, "channels");
|
|
37995
|
+
this.#connectionDirectory = join16(stateDirectory, "connections");
|
|
37760
37996
|
}
|
|
37761
37997
|
static open = async (options, signal) => {
|
|
37762
37998
|
signal.throwIfAborted();
|
|
37763
37999
|
const applicationId = validateApplicationId(options.applicationId);
|
|
37764
38000
|
const rootDirectory = resolve4(options.stateDirectory);
|
|
37765
|
-
const applicationDirectory =
|
|
38001
|
+
const applicationDirectory = join16(rootDirectory, "installations", applicationId);
|
|
37766
38002
|
try {
|
|
37767
|
-
await
|
|
38003
|
+
await mkdir5(applicationDirectory, { mode: 448, recursive: true });
|
|
37768
38004
|
} catch (cause) {
|
|
37769
38005
|
throw new RuntimeInstallationStoreError(
|
|
37770
38006
|
"installation_unavailable",
|
|
@@ -37775,9 +38011,9 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
|
|
|
37775
38011
|
);
|
|
37776
38012
|
}
|
|
37777
38013
|
const storedInstallationId = await readOrCreateInstallationId(applicationDirectory, signal);
|
|
37778
|
-
const stateDirectory =
|
|
38014
|
+
const stateDirectory = join16(applicationDirectory, storedInstallationId);
|
|
37779
38015
|
try {
|
|
37780
|
-
await
|
|
38016
|
+
await mkdir5(stateDirectory, { mode: 448, recursive: true });
|
|
37781
38017
|
} catch (cause) {
|
|
37782
38018
|
throw new RuntimeInstallationStoreError(
|
|
37783
38019
|
"installation_unavailable",
|
|
@@ -37790,8 +38026,8 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
|
|
|
37790
38026
|
signal.throwIfAborted();
|
|
37791
38027
|
return new _RuntimeInstallationStore(applicationId, storedInstallationId, stateDirectory);
|
|
37792
38028
|
};
|
|
37793
|
-
connectionPath = (connectionId2) =>
|
|
37794
|
-
channelIndexPath = (channelId) =>
|
|
38029
|
+
connectionPath = (connectionId2) => join16(this.#connectionDirectory, `${validateConnectionId(connectionId2)}.json`);
|
|
38030
|
+
channelIndexPath = (channelId) => join16(this.#channelDirectory, channelIndexFileName(validateIdentifier(channelId, "invalid_channel_id")));
|
|
37795
38031
|
readConnection = async (connectionId2, signal) => {
|
|
37796
38032
|
const stored = decodeConnection(
|
|
37797
38033
|
await readJsonFile(this.connectionPath(connectionId2), signal, "connection_not_found")
|
|
@@ -37953,7 +38189,7 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
|
|
|
37953
38189
|
};
|
|
37954
38190
|
};
|
|
37955
38191
|
async function readOrCreateInstallationId(applicationDirectory, signal) {
|
|
37956
|
-
const pointerPath =
|
|
38192
|
+
const pointerPath = join16(applicationDirectory, "current.json");
|
|
37957
38193
|
try {
|
|
37958
38194
|
return decodeInstallationPointer(await readJsonFile(pointerPath, signal, "installation_not_found")).installationId;
|
|
37959
38195
|
} catch (cause) {
|
|
@@ -37963,7 +38199,7 @@ async function readOrCreateInstallationId(applicationDirectory, signal) {
|
|
|
37963
38199
|
}
|
|
37964
38200
|
const candidate = installationId();
|
|
37965
38201
|
try {
|
|
37966
|
-
await
|
|
38202
|
+
await writeFile4(pointerPath, `${JSON.stringify({ installationId: candidate, version: 1 })}
|
|
37967
38203
|
`, {
|
|
37968
38204
|
flag: "wx",
|
|
37969
38205
|
mode: 384
|
|
@@ -38093,9 +38329,9 @@ function parseResumeConnectionId(arguments_) {
|
|
|
38093
38329
|
async function resolveDefaultWorkspace(path2) {
|
|
38094
38330
|
const requestedWorkspace = resolve5(path2);
|
|
38095
38331
|
try {
|
|
38096
|
-
await
|
|
38097
|
-
const defaultWorkspace = await
|
|
38098
|
-
const metadata = await
|
|
38332
|
+
await mkdir6(requestedWorkspace, { recursive: true, mode: 448 });
|
|
38333
|
+
const defaultWorkspace = await realpath8(requestedWorkspace);
|
|
38334
|
+
const metadata = await stat7(defaultWorkspace);
|
|
38099
38335
|
if (!metadata.isDirectory()) {
|
|
38100
38336
|
throw new PairingClientError("invalid_workspace", "The default workspace is not a directory");
|
|
38101
38337
|
}
|
|
@@ -38319,8 +38555,8 @@ function isRuntimeRelayRevocation(closeCode, closeReason) {
|
|
|
38319
38555
|
}
|
|
38320
38556
|
|
|
38321
38557
|
// src/run-daemon.ts
|
|
38322
|
-
import { createHash as
|
|
38323
|
-
import { join as
|
|
38558
|
+
import { createHash as createHash8, randomUUID as randomUUID8 } from "node:crypto";
|
|
38559
|
+
import { join as join19 } from "node:path";
|
|
38324
38560
|
import { styleText } from "node:util";
|
|
38325
38561
|
|
|
38326
38562
|
// src/agent-catalog/publish-agent-catalog.ts
|
|
@@ -38896,9 +39132,9 @@ var FixedInstallationExecutor = class {
|
|
|
38896
39132
|
};
|
|
38897
39133
|
|
|
38898
39134
|
// src/authorization/workspace-directory.ts
|
|
38899
|
-
import { readdir as readdir3, realpath as
|
|
39135
|
+
import { readdir as readdir3, realpath as realpath9, stat as stat8 } from "node:fs/promises";
|
|
38900
39136
|
import { homedir as homedir2 } from "node:os";
|
|
38901
|
-
import { basename as basename4, dirname as
|
|
39137
|
+
import { basename as basename4, dirname as dirname6, isAbsolute as isAbsolute9, join as join17, normalize as normalize3, relative as relative4 } from "node:path";
|
|
38902
39138
|
var WorkspaceDirectoryListing = class {
|
|
38903
39139
|
directoryId;
|
|
38904
39140
|
directoryLabel;
|
|
@@ -38966,9 +39202,9 @@ var WorkspaceDirectoryService = class {
|
|
|
38966
39202
|
throw new LocalAuthorizationError("The local directory path is invalid");
|
|
38967
39203
|
}
|
|
38968
39204
|
try {
|
|
38969
|
-
const target = await
|
|
39205
|
+
const target = await realpath9(requested);
|
|
38970
39206
|
signal.throwIfAborted();
|
|
38971
|
-
const metadata = await
|
|
39207
|
+
const metadata = await stat8(target);
|
|
38972
39208
|
signal.throwIfAborted();
|
|
38973
39209
|
if (!isAbsolute9(target) || normalize3(target) !== target || !metadata.isDirectory()) {
|
|
38974
39210
|
throw new LocalAuthorizationError("The selected location is not a directory");
|
|
@@ -39016,7 +39252,7 @@ var WorkspaceDirectoryService = class {
|
|
|
39016
39252
|
continue;
|
|
39017
39253
|
}
|
|
39018
39254
|
try {
|
|
39019
|
-
const path2 = await this.resolvePath(
|
|
39255
|
+
const path2 = await this.resolvePath(join17(target, child2.name), signal);
|
|
39020
39256
|
entries.push({ directoryId: encodePath(path2), name: child2.name });
|
|
39021
39257
|
} catch (cause) {
|
|
39022
39258
|
signal.throwIfAborted();
|
|
@@ -39026,7 +39262,7 @@ var WorkspaceDirectoryService = class {
|
|
|
39026
39262
|
}
|
|
39027
39263
|
}
|
|
39028
39264
|
entries.sort((a, b) => a.name.localeCompare(b.name));
|
|
39029
|
-
const parent =
|
|
39265
|
+
const parent = dirname6(target);
|
|
39030
39266
|
return new WorkspaceDirectoryListing(
|
|
39031
39267
|
id,
|
|
39032
39268
|
this.label(target),
|
|
@@ -39052,15 +39288,15 @@ var WorkspaceDirectoryService = class {
|
|
|
39052
39288
|
|
|
39053
39289
|
// src/daemon-diagnostic-log.ts
|
|
39054
39290
|
import { appendFileSync, mkdirSync as mkdirSync2, readFileSync as readFileSync2, renameSync, statSync as statSync3, writeFileSync } from "node:fs";
|
|
39055
|
-
import { join as
|
|
39291
|
+
import { join as join18 } from "node:path";
|
|
39056
39292
|
var MAXIMUM_DAEMON_LOG_BYTES = 1 * 1024 * 1024;
|
|
39057
39293
|
var DaemonDiagnosticLog = class {
|
|
39058
39294
|
#directory;
|
|
39059
39295
|
#path;
|
|
39060
39296
|
#maximumBytes;
|
|
39061
39297
|
constructor(stateDirectory, maximumBytes = MAXIMUM_DAEMON_LOG_BYTES) {
|
|
39062
|
-
this.#directory =
|
|
39063
|
-
this.#path =
|
|
39298
|
+
this.#directory = join18(stateDirectory, "logs");
|
|
39299
|
+
this.#path = join18(this.#directory, "daemon.log");
|
|
39064
39300
|
this.#maximumBytes = maximumBytes;
|
|
39065
39301
|
}
|
|
39066
39302
|
record = (diagnostic) => {
|
|
@@ -39105,7 +39341,7 @@ import { WebSocket as WebSocket2 } from "undici";
|
|
|
39105
39341
|
import { WebSocket } from "undici";
|
|
39106
39342
|
|
|
39107
39343
|
// src/prompt-artifact-resolver.ts
|
|
39108
|
-
import { createHash as
|
|
39344
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
39109
39345
|
import { fetch as fetch4 } from "undici";
|
|
39110
39346
|
var ARTIFACT_SCHEME = "mobius-artifact:";
|
|
39111
39347
|
var ARTIFACT_DOWNLOAD_TIMEOUT_MILLISECONDS = 2e4;
|
|
@@ -39243,7 +39479,7 @@ async function download(config2, command, reference, signal) {
|
|
|
39243
39479
|
);
|
|
39244
39480
|
}
|
|
39245
39481
|
const bytes = await responseBytes(response, reference.byteLength, requestSignal);
|
|
39246
|
-
if (
|
|
39482
|
+
if (createHash4("sha256").update(bytes).digest("hex") !== reference.sha256) {
|
|
39247
39483
|
throw new PromptArtifactError(
|
|
39248
39484
|
"artifact_integrity_failed",
|
|
39249
39485
|
"The prompt artifact failed integrity validation"
|
|
@@ -39548,7 +39784,7 @@ var DaemonInstallationObserver = class {
|
|
|
39548
39784
|
};
|
|
39549
39785
|
|
|
39550
39786
|
// src/daemon-active-turn.ts
|
|
39551
|
-
import { randomUUID as
|
|
39787
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
39552
39788
|
function activeMessageCharacters(message) {
|
|
39553
39789
|
return message.text.length + (message.role === "assistant" ? JSON.stringify(message.activities).length + JSON.stringify(message.content).length : 0);
|
|
39554
39790
|
}
|
|
@@ -39582,7 +39818,7 @@ var ActiveDaemonTurn = class {
|
|
|
39582
39818
|
#timeline;
|
|
39583
39819
|
#sequence = 0;
|
|
39584
39820
|
#interaction = null;
|
|
39585
|
-
#epoch = decodeIdentifier(
|
|
39821
|
+
#epoch = decodeIdentifier(randomUUID3());
|
|
39586
39822
|
constructor(command, attemptId) {
|
|
39587
39823
|
this.attemptId = attemptId;
|
|
39588
39824
|
this.command = command;
|
|
@@ -39644,7 +39880,7 @@ var ActiveDaemonTurn = class {
|
|
|
39644
39880
|
if (!this.#activities.has(event.activityId)) {
|
|
39645
39881
|
this.#timeline = [
|
|
39646
39882
|
...this.#timeline,
|
|
39647
|
-
{ activityId: event.activityId, id: decodeIdentifier(
|
|
39883
|
+
{ activityId: event.activityId, id: decodeIdentifier(randomUUID3()), kind: "activity" }
|
|
39648
39884
|
];
|
|
39649
39885
|
}
|
|
39650
39886
|
this.#activities.set(event.activityId, {
|
|
@@ -39665,7 +39901,7 @@ var ActiveDaemonTurn = class {
|
|
|
39665
39901
|
if (previous === void 0) {
|
|
39666
39902
|
this.#timeline = [
|
|
39667
39903
|
...this.#timeline,
|
|
39668
|
-
{ activityId: event.activityId, id: decodeIdentifier(
|
|
39904
|
+
{ activityId: event.activityId, id: decodeIdentifier(randomUUID3()), kind: "activity" }
|
|
39669
39905
|
];
|
|
39670
39906
|
}
|
|
39671
39907
|
this.#activities.set(event.activityId, {
|
|
@@ -39690,7 +39926,7 @@ var ActiveDaemonTurn = class {
|
|
|
39690
39926
|
...this.#timeline,
|
|
39691
39927
|
{
|
|
39692
39928
|
content: /* @__PURE__ */ new Map([[event.contentId, event.content]]),
|
|
39693
|
-
id: decodeIdentifier(
|
|
39929
|
+
id: decodeIdentifier(randomUUID3()),
|
|
39694
39930
|
kind: "message",
|
|
39695
39931
|
sourceMessageId: event.messageId,
|
|
39696
39932
|
text: ""
|
|
@@ -39730,7 +39966,7 @@ var ActiveDaemonTurn = class {
|
|
|
39730
39966
|
...this.#timeline,
|
|
39731
39967
|
{
|
|
39732
39968
|
content: /* @__PURE__ */ new Map(),
|
|
39733
|
-
id: decodeIdentifier(
|
|
39969
|
+
id: decodeIdentifier(randomUUID3()),
|
|
39734
39970
|
kind: "message",
|
|
39735
39971
|
sourceMessageId: messageId,
|
|
39736
39972
|
text: remaining.slice(0, ACTIVE_TURN_TEXT_CHUNK_LIMIT)
|
|
@@ -40706,7 +40942,7 @@ var readCodexFullHistory = async (agent, cwd, nativeSessionId, signal, nativeTur
|
|
|
40706
40942
|
});
|
|
40707
40943
|
|
|
40708
40944
|
// src/native-sessions/service.ts
|
|
40709
|
-
import { randomUUID as
|
|
40945
|
+
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
40710
40946
|
import { basename as basename5 } from "node:path";
|
|
40711
40947
|
|
|
40712
40948
|
// src/native-sessions/acp-history.ts
|
|
@@ -40921,7 +41157,7 @@ var NativeSessionService = class {
|
|
|
40921
41157
|
if (authorized === null) {
|
|
40922
41158
|
return null;
|
|
40923
41159
|
}
|
|
40924
|
-
const entryId = decodeIdentifier(
|
|
41160
|
+
const entryId = decodeIdentifier(randomUUID4());
|
|
40925
41161
|
if (this.#entries.size >= 5e3) {
|
|
40926
41162
|
this.#entries.clear();
|
|
40927
41163
|
}
|
|
@@ -40977,7 +41213,7 @@ var NativeSessionService = class {
|
|
|
40977
41213
|
"invalid_native_session_response"
|
|
40978
41214
|
);
|
|
40979
41215
|
}
|
|
40980
|
-
nextCursor = decodeIdentifier(
|
|
41216
|
+
nextCursor = decodeIdentifier(randomUUID4());
|
|
40981
41217
|
if (this.#cursors.size >= 500) {
|
|
40982
41218
|
this.#cursors.clear();
|
|
40983
41219
|
}
|
|
@@ -41259,7 +41495,7 @@ var NativeSessionService = class {
|
|
|
41259
41495
|
};
|
|
41260
41496
|
|
|
41261
41497
|
// src/relay-connection/daemon-operation-state.ts
|
|
41262
|
-
import { createHash as
|
|
41498
|
+
import { createHash as createHash5, randomUUID as randomUUID5 } from "node:crypto";
|
|
41263
41499
|
var MAX_TERMINAL_RECEIPTS = 1024;
|
|
41264
41500
|
function isTerminal(state) {
|
|
41265
41501
|
return state === "succeeded" || state === "failed" || state === "cancelled";
|
|
@@ -41268,7 +41504,7 @@ var DaemonOperationState = class {
|
|
|
41268
41504
|
#executions = /* @__PURE__ */ new Map();
|
|
41269
41505
|
#terminalCount = 0;
|
|
41270
41506
|
claimExecution = (commandId, sessionId, commandJson) => {
|
|
41271
|
-
const commandHash =
|
|
41507
|
+
const commandHash = createHash5("sha256").update(commandJson).digest("hex");
|
|
41272
41508
|
const existing = this.#executions.get(commandId);
|
|
41273
41509
|
if (existing !== void 0) {
|
|
41274
41510
|
if (existing.sessionId !== sessionId || existing.commandHash !== commandHash) {
|
|
@@ -41276,7 +41512,7 @@ var DaemonOperationState = class {
|
|
|
41276
41512
|
}
|
|
41277
41513
|
return { attemptId: existing.attemptId, commandId, kind: "duplicate", state: existing.state };
|
|
41278
41514
|
}
|
|
41279
|
-
const attemptId =
|
|
41515
|
+
const attemptId = randomUUID5();
|
|
41280
41516
|
this.#executions.set(commandId, { attemptId, commandHash, sessionId, state: "dispatching" });
|
|
41281
41517
|
return { attemptId, commandId, kind: "accepted", state: "dispatching" };
|
|
41282
41518
|
};
|
|
@@ -41612,7 +41848,7 @@ function createAgentCatalogRefreshHandler(dependencies) {
|
|
|
41612
41848
|
import { WebSocket as WebSocket4 } from "undici";
|
|
41613
41849
|
|
|
41614
41850
|
// src/agent-catalog/discover-agent-settings.ts
|
|
41615
|
-
import { createHash as
|
|
41851
|
+
import { createHash as createHash6 } from "node:crypto";
|
|
41616
41852
|
|
|
41617
41853
|
// src/agent-catalog/agent-settings-base.ts
|
|
41618
41854
|
var AgentSettingsConfigurationError = class extends Error {
|
|
@@ -42076,7 +42312,7 @@ function settingsRevision(agent, reportedAgentVersion, settings, modelEffort) {
|
|
|
42076
42312
|
unsupportedModelIds: modelEffort.unsupportedModelIds,
|
|
42077
42313
|
valuesByModel: {}
|
|
42078
42314
|
};
|
|
42079
|
-
return
|
|
42315
|
+
return createHash6("sha256").update(
|
|
42080
42316
|
JSON.stringify({
|
|
42081
42317
|
adapterVersion: agent.kind === "acp-adapter-process" ? agent.adapterVersion : agent.agentVersion,
|
|
42082
42318
|
agentId: agent.id,
|
|
@@ -42227,7 +42463,7 @@ function createAgentSettingsDiscoveryHandler(dependencies) {
|
|
|
42227
42463
|
|
|
42228
42464
|
// src/artifacts/local-file-streamer.ts
|
|
42229
42465
|
import { createReadStream as createReadStream2 } from "node:fs";
|
|
42230
|
-
import { realpath as
|
|
42466
|
+
import { realpath as realpath10, stat as stat9 } from "node:fs/promises";
|
|
42231
42467
|
import { basename as basename6, isAbsolute as isAbsolute10, normalize as normalize4, resolve as resolve7 } from "node:path";
|
|
42232
42468
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
42233
42469
|
var CHUNK_BYTES = 192 * 1024;
|
|
@@ -42255,7 +42491,7 @@ async function resolveFile(value, workingDirectory, signal) {
|
|
|
42255
42491
|
return null;
|
|
42256
42492
|
}
|
|
42257
42493
|
try {
|
|
42258
|
-
const target = await
|
|
42494
|
+
const target = await realpath10(requested);
|
|
42259
42495
|
signal.throwIfAborted();
|
|
42260
42496
|
return isAbsolute10(target) && normalize4(target) === target ? target : null;
|
|
42261
42497
|
} catch {
|
|
@@ -42263,23 +42499,24 @@ async function resolveFile(value, workingDirectory, signal) {
|
|
|
42263
42499
|
return null;
|
|
42264
42500
|
}
|
|
42265
42501
|
}
|
|
42266
|
-
async function streamLocalFile(command, send2, signal, workingDirectory) {
|
|
42267
|
-
const
|
|
42502
|
+
async function streamLocalFile(command, send2, signal, workingDirectory, externalContent) {
|
|
42503
|
+
const external = await externalContent.resolve(command.sessionId, command.path, signal);
|
|
42504
|
+
const target = external?.path ?? await resolveFile(command.path, workingDirectory, signal);
|
|
42268
42505
|
if (target === null) {
|
|
42269
42506
|
throw new Error("The local file is unavailable");
|
|
42270
42507
|
}
|
|
42271
|
-
const before = await
|
|
42508
|
+
const before = await stat9(target);
|
|
42272
42509
|
signal.throwIfAborted();
|
|
42273
42510
|
if (!before.isFile() || before.size < 1 || before.size > command.maxBytes) {
|
|
42274
42511
|
throw new Error("The local file is too large to read");
|
|
42275
42512
|
}
|
|
42276
|
-
const raster = await readLocalRaster(target, signal);
|
|
42513
|
+
const raster = external === null ? await readLocalRaster(target, signal) : null;
|
|
42277
42514
|
send2({
|
|
42278
42515
|
byteLength: before.size,
|
|
42279
42516
|
kind: FILE_BEGIN_KIND,
|
|
42280
|
-
mediaType: raster?.mimeType ?? "application/octet-stream",
|
|
42517
|
+
mediaType: external?.mediaType ?? raster?.mimeType ?? "application/octet-stream",
|
|
42281
42518
|
modifiedAt: before.mtime.toISOString(),
|
|
42282
|
-
name: basename6(target) || "file",
|
|
42519
|
+
name: external?.name ?? (basename6(target) || "file"),
|
|
42283
42520
|
requestId: command.requestId,
|
|
42284
42521
|
sessionId: command.sessionId
|
|
42285
42522
|
});
|
|
@@ -42296,7 +42533,7 @@ async function streamLocalFile(command, send2, signal, workingDirectory) {
|
|
|
42296
42533
|
});
|
|
42297
42534
|
sequence += 1;
|
|
42298
42535
|
}
|
|
42299
|
-
const after = await
|
|
42536
|
+
const after = await stat9(target);
|
|
42300
42537
|
signal.throwIfAborted();
|
|
42301
42538
|
if (after.size !== before.size || after.mtimeMs !== before.mtimeMs) {
|
|
42302
42539
|
throw new Error("The local file changed during transfer");
|
|
@@ -42309,7 +42546,7 @@ async function streamLocalFile(command, send2, signal, workingDirectory) {
|
|
|
42309
42546
|
}
|
|
42310
42547
|
|
|
42311
42548
|
// src/daemon-history-commands.ts
|
|
42312
|
-
import { createHash as
|
|
42549
|
+
import { createHash as createHash7 } from "node:crypto";
|
|
42313
42550
|
|
|
42314
42551
|
// src/authorization/resolve-session-directories.ts
|
|
42315
42552
|
import { basename as basename7 } from "node:path";
|
|
@@ -42703,7 +42940,7 @@ async function executeSessionLiveHistoryPageLoad(socket, command, config2, direc
|
|
|
42703
42940
|
}
|
|
42704
42941
|
function replayEvent(sessionId, position, update) {
|
|
42705
42942
|
const encoded = JSON.stringify(update);
|
|
42706
|
-
const eventId = `native-${
|
|
42943
|
+
const eventId = `native-${createHash7("sha256").update(sessionId).update(":").update(position.toString()).update(":").update(encoded).digest("hex")}`;
|
|
42707
42944
|
return {
|
|
42708
42945
|
eventId,
|
|
42709
42946
|
payload: update,
|
|
@@ -42786,7 +43023,7 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
|
|
|
42786
43023
|
}
|
|
42787
43024
|
|
|
42788
43025
|
// src/acp/session-config/apply-session-configuration.ts
|
|
42789
|
-
import { randomUUID as
|
|
43026
|
+
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
42790
43027
|
function invalidSessionConfiguration(message) {
|
|
42791
43028
|
return new AcpExecutionError(message, {}, "invalid_session_configuration");
|
|
42792
43029
|
}
|
|
@@ -42927,7 +43164,7 @@ async function applySessionConfigurationSelection(sessions, audit, options, sele
|
|
|
42927
43164
|
booleanValue: selection.booleanValue,
|
|
42928
43165
|
configId: selection.configId,
|
|
42929
43166
|
cwd,
|
|
42930
|
-
requestId: `cfg_${
|
|
43167
|
+
requestId: `cfg_${randomUUID6()}`,
|
|
42931
43168
|
sessionId,
|
|
42932
43169
|
signal,
|
|
42933
43170
|
value: selection.value,
|
|
@@ -43601,6 +43838,7 @@ function createDaemonCommandHandler({
|
|
|
43601
43838
|
operations,
|
|
43602
43839
|
publisher,
|
|
43603
43840
|
eventLogV2,
|
|
43841
|
+
externalContent,
|
|
43604
43842
|
activeTurns,
|
|
43605
43843
|
diagnostics,
|
|
43606
43844
|
socket,
|
|
@@ -43709,7 +43947,8 @@ function createDaemonCommandHandler({
|
|
|
43709
43947
|
command2,
|
|
43710
43948
|
(message2) => send(socket, message2),
|
|
43711
43949
|
signal,
|
|
43712
|
-
sessions.findSessions([command2.sessionId])[0]?.cwd ?? null
|
|
43950
|
+
sessions.findSessions([command2.sessionId])[0]?.cwd ?? null,
|
|
43951
|
+
externalContent
|
|
43713
43952
|
).catch((error62) => {
|
|
43714
43953
|
if (socket.readyState !== WebSocket6.OPEN || signal.aborted) {
|
|
43715
43954
|
return;
|
|
@@ -44028,7 +44267,7 @@ function connectRelay(url2, signal) {
|
|
|
44028
44267
|
}
|
|
44029
44268
|
|
|
44030
44269
|
// src/relay-connection/liveness.ts
|
|
44031
|
-
import { randomUUID as
|
|
44270
|
+
import { randomUUID as randomUUID7 } from "node:crypto";
|
|
44032
44271
|
var HEARTBEAT_ACK_TIMEOUT_MILLISECONDS = 1e4;
|
|
44033
44272
|
var HEARTBEAT_INTERVAL_MILLISECONDS = 2e4;
|
|
44034
44273
|
var RelayLivenessState = class {
|
|
@@ -44117,7 +44356,7 @@ var RelayConnectionLiveness = class {
|
|
|
44117
44356
|
}
|
|
44118
44357
|
throw new Error("Heartbeat was scheduled in an invalid state");
|
|
44119
44358
|
}
|
|
44120
|
-
const heartbeatId =
|
|
44359
|
+
const heartbeatId = randomUUID7();
|
|
44121
44360
|
this.#state = new AwaitingHeartbeatAckState(
|
|
44122
44361
|
heartbeatId,
|
|
44123
44362
|
this.#timer.schedule(this.#handleTimeout, HEARTBEAT_ACK_TIMEOUT_MILLISECONDS)
|
|
@@ -44157,6 +44396,7 @@ async function runRelayConnection({
|
|
|
44157
44396
|
operations,
|
|
44158
44397
|
publisher,
|
|
44159
44398
|
eventLogV2,
|
|
44399
|
+
externalContent,
|
|
44160
44400
|
activeTurns,
|
|
44161
44401
|
connectionEpoch,
|
|
44162
44402
|
diagnostics,
|
|
@@ -44180,6 +44420,7 @@ async function runRelayConnection({
|
|
|
44180
44420
|
operations,
|
|
44181
44421
|
publisher,
|
|
44182
44422
|
eventLogV2,
|
|
44423
|
+
externalContent,
|
|
44183
44424
|
activeTurns,
|
|
44184
44425
|
diagnostics,
|
|
44185
44426
|
socket,
|
|
@@ -44297,6 +44538,14 @@ async function runRelayConnection({
|
|
|
44297
44538
|
}
|
|
44298
44539
|
commands.handle(message);
|
|
44299
44540
|
} catch (error62) {
|
|
44541
|
+
if (error62 instanceof UnsupportedProtocolMessageKindError) {
|
|
44542
|
+
console.warn("Mobius daemon skipped an unsupported Relay message", {
|
|
44543
|
+
code: error62.code,
|
|
44544
|
+
direction: error62.direction,
|
|
44545
|
+
messageKind: error62.messageKind
|
|
44546
|
+
});
|
|
44547
|
+
return;
|
|
44548
|
+
}
|
|
44300
44549
|
console.error("Mobius daemon rejected a message", error62);
|
|
44301
44550
|
failAndClose(
|
|
44302
44551
|
new Error("Relay sent an invalid protocol message", { cause: error62 }),
|
|
@@ -44650,7 +44899,7 @@ async function installDetectedAgentIntegrations(config2, installations, signal)
|
|
|
44650
44899
|
{
|
|
44651
44900
|
agentId: agent.id,
|
|
44652
44901
|
kind: AGENT_INSTALL_REQUEST_KIND,
|
|
44653
|
-
requestId: `automatic-integration-${
|
|
44902
|
+
requestId: `automatic-integration-${randomUUID8()}`
|
|
44654
44903
|
},
|
|
44655
44904
|
signal
|
|
44656
44905
|
);
|
|
@@ -44669,8 +44918,9 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
44669
44918
|
stateDirectory
|
|
44670
44919
|
});
|
|
44671
44920
|
const sessionStore = new SqliteAcpSessionStore(
|
|
44672
|
-
|
|
44921
|
+
join19(stateDirectory, "sessions", `${createHash8("sha256").update(config2.channelId).digest("hex")}.sqlite`)
|
|
44673
44922
|
);
|
|
44923
|
+
const externalContent = new LocalExternalContentStore(stateDirectory);
|
|
44674
44924
|
const operations = new DaemonOperationState();
|
|
44675
44925
|
const publisher = new DaemonSessionEventPublisher(sessionStore);
|
|
44676
44926
|
const eventLogV2 = new DaemonSessionEventLogV2(publisher, sessionStore);
|
|
@@ -44691,7 +44941,8 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
44691
44941
|
)).history : null
|
|
44692
44942
|
},
|
|
44693
44943
|
"native",
|
|
44694
|
-
publisher.publishStatus
|
|
44944
|
+
publisher.publishStatus,
|
|
44945
|
+
new AcpContentExternalizer(externalContent)
|
|
44695
44946
|
);
|
|
44696
44947
|
const directories = new WorkspaceDirectoryService(config2.bindingId, config2.defaultWorkspace);
|
|
44697
44948
|
const installationObserver = new DaemonInstallationObserver();
|
|
@@ -44805,6 +45056,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
44805
45056
|
operations,
|
|
44806
45057
|
publisher,
|
|
44807
45058
|
eventLogV2,
|
|
45059
|
+
externalContent,
|
|
44808
45060
|
activeTurns,
|
|
44809
45061
|
connectionEpoch,
|
|
44810
45062
|
diagnostics,
|
|
@@ -44861,7 +45113,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
44861
45113
|
}
|
|
44862
45114
|
|
|
44863
45115
|
// src/runtime.ts
|
|
44864
|
-
import { mkdir as
|
|
45116
|
+
import { mkdir as mkdir7, realpath as realpath11, stat as stat10 } from "node:fs/promises";
|
|
44865
45117
|
import { resolve as resolve8 } from "node:path";
|
|
44866
45118
|
var RUNTIME_CREDENTIAL_PATTERN2 = /^[a-zA-Z0-9_-]{32,256}$/;
|
|
44867
45119
|
var MobiusRuntimeConfigurationError = class extends Error {
|
|
@@ -44927,9 +45179,9 @@ function loadMobiusRuntimeConnection(environment = process.env) {
|
|
|
44927
45179
|
async function resolveWorkspace(path2) {
|
|
44928
45180
|
const requested = resolve8(path2);
|
|
44929
45181
|
try {
|
|
44930
|
-
await
|
|
44931
|
-
const resolved = await
|
|
44932
|
-
const metadata = await
|
|
45182
|
+
await mkdir7(requested, { recursive: true, mode: 448 });
|
|
45183
|
+
const resolved = await realpath11(requested);
|
|
45184
|
+
const metadata = await stat10(resolved);
|
|
44933
45185
|
if (!metadata.isDirectory()) {
|
|
44934
45186
|
throw new MobiusRuntimeConfigurationError("The Runtime workspace is not a directory");
|
|
44935
45187
|
}
|