@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/runtime.js
CHANGED
|
@@ -5,7 +5,7 @@ var __export = (target, all) => {
|
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
// src/runtime.ts
|
|
8
|
-
import { mkdir as
|
|
8
|
+
import { mkdir as mkdir7, realpath as realpath11, stat as stat10 } from "node:fs/promises";
|
|
9
9
|
import { resolve as resolve8 } from "node:path";
|
|
10
10
|
|
|
11
11
|
// ../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/classic/external.js
|
|
@@ -19801,61 +19801,61 @@ var DIRECTORY_IDENTIFIER_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/;
|
|
|
19801
19801
|
var DIRECTORY_IDENTIFIER = external_exports.string().min(1).max(2048).regex(DIRECTORY_IDENTIFIER_PATTERN);
|
|
19802
19802
|
var SHORT_TEXT = external_exports.string().max(500);
|
|
19803
19803
|
var LONG_TEXT = external_exports.string().max(1e5);
|
|
19804
|
-
var workspaceEntrySchema = external_exports.
|
|
19804
|
+
var workspaceEntrySchema = external_exports.object({
|
|
19805
19805
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
19806
19806
|
name: external_exports.string().min(1).max(255)
|
|
19807
19807
|
}).readonly();
|
|
19808
19808
|
var sessionStatusSchema = external_exports.discriminatedUnion("kind", [
|
|
19809
|
-
external_exports.
|
|
19810
|
-
external_exports.
|
|
19809
|
+
external_exports.object({ kind: external_exports.literal("idle") }).readonly(),
|
|
19810
|
+
external_exports.object({
|
|
19811
19811
|
commandId: identifierStringSchema,
|
|
19812
19812
|
kind: external_exports.literal("working")
|
|
19813
19813
|
}).readonly()
|
|
19814
19814
|
]);
|
|
19815
|
-
var sessionStatusChangedEventSchema = external_exports.
|
|
19815
|
+
var sessionStatusChangedEventSchema = external_exports.object({
|
|
19816
19816
|
kind: external_exports.literal(SESSION_STATUS_CHANGED_KIND),
|
|
19817
19817
|
sessionId: identifierStringSchema,
|
|
19818
19818
|
status: sessionStatusSchema
|
|
19819
19819
|
}).readonly();
|
|
19820
|
-
var sessionMetadataSchema = external_exports.
|
|
19820
|
+
var sessionMetadataSchema = external_exports.object({
|
|
19821
19821
|
additionalDirectories: external_exports.array(workspaceEntrySchema).max(16).readonly(),
|
|
19822
19822
|
agentId: identifierStringSchema,
|
|
19823
19823
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
19824
19824
|
directoryLabel: external_exports.string().min(1).max(2048),
|
|
19825
19825
|
prompted: external_exports.boolean(),
|
|
19826
19826
|
sessionId: identifierStringSchema,
|
|
19827
|
-
status: sessionStatusSchema,
|
|
19827
|
+
status: sessionStatusSchema.default({ kind: "idle" }),
|
|
19828
19828
|
title: external_exports.string().max(500),
|
|
19829
19829
|
updatedAt: external_exports.iso.datetime({ offset: true })
|
|
19830
19830
|
}).readonly();
|
|
19831
|
-
var sessionListCommandSchema = external_exports.
|
|
19831
|
+
var sessionListCommandSchema = external_exports.object({
|
|
19832
19832
|
kind: external_exports.literal(SESSION_LIST_KIND),
|
|
19833
19833
|
limit: external_exports.number().int().positive().max(500),
|
|
19834
19834
|
requestId: identifierStringSchema
|
|
19835
19835
|
}).readonly();
|
|
19836
|
-
var sessionsListedEventSchema = external_exports.
|
|
19836
|
+
var sessionsListedEventSchema = external_exports.object({
|
|
19837
19837
|
entries: external_exports.array(sessionMetadataSchema).max(500).readonly(),
|
|
19838
19838
|
kind: external_exports.literal(SESSION_LISTED_KIND),
|
|
19839
19839
|
requestId: identifierStringSchema
|
|
19840
19840
|
}).readonly();
|
|
19841
|
-
var sessionQueryCommandSchema = external_exports.
|
|
19841
|
+
var sessionQueryCommandSchema = external_exports.object({
|
|
19842
19842
|
kind: external_exports.literal(SESSION_QUERY_KIND),
|
|
19843
19843
|
requestId: identifierStringSchema,
|
|
19844
19844
|
sessionIds: external_exports.array(identifierStringSchema).min(1).max(500).readonly()
|
|
19845
19845
|
}).readonly();
|
|
19846
|
-
var sessionsQueriedEventSchema = external_exports.
|
|
19846
|
+
var sessionsQueriedEventSchema = external_exports.object({
|
|
19847
19847
|
entries: external_exports.array(sessionMetadataSchema).max(500).readonly(),
|
|
19848
19848
|
kind: external_exports.literal(SESSION_QUERIED_KIND),
|
|
19849
19849
|
requestId: identifierStringSchema
|
|
19850
19850
|
}).readonly();
|
|
19851
|
-
var fileReadCommandSchema = external_exports.
|
|
19851
|
+
var fileReadCommandSchema = external_exports.object({
|
|
19852
19852
|
kind: external_exports.literal(FILE_READ_KIND),
|
|
19853
19853
|
maxBytes: external_exports.number().int().positive().max(128 * 1024 * 1024),
|
|
19854
19854
|
requestId: identifierStringSchema,
|
|
19855
19855
|
sessionId: identifierStringSchema,
|
|
19856
19856
|
path: external_exports.string().min(1).max(4096)
|
|
19857
19857
|
}).readonly();
|
|
19858
|
-
var fileBeginEventSchema = external_exports.
|
|
19858
|
+
var fileBeginEventSchema = external_exports.object({
|
|
19859
19859
|
byteLength: external_exports.number().int().positive().max(128 * 1024 * 1024),
|
|
19860
19860
|
kind: external_exports.literal(FILE_BEGIN_KIND),
|
|
19861
19861
|
mediaType: external_exports.string().min(1).max(255),
|
|
@@ -19864,26 +19864,26 @@ var fileBeginEventSchema = external_exports.strictObject({
|
|
|
19864
19864
|
requestId: identifierStringSchema,
|
|
19865
19865
|
sessionId: identifierStringSchema
|
|
19866
19866
|
}).readonly();
|
|
19867
|
-
var fileChunkEventSchema = external_exports.
|
|
19867
|
+
var fileChunkEventSchema = external_exports.object({
|
|
19868
19868
|
data: external_exports.string().min(1).max(4e5),
|
|
19869
19869
|
kind: external_exports.literal(FILE_CHUNK_KIND),
|
|
19870
19870
|
requestId: identifierStringSchema,
|
|
19871
19871
|
sequence: external_exports.number().int().nonnegative().max(1024),
|
|
19872
19872
|
sessionId: identifierStringSchema
|
|
19873
19873
|
}).readonly();
|
|
19874
|
-
var fileEndEventSchema = external_exports.
|
|
19874
|
+
var fileEndEventSchema = external_exports.object({
|
|
19875
19875
|
kind: external_exports.literal(FILE_END_KIND),
|
|
19876
19876
|
requestId: identifierStringSchema,
|
|
19877
19877
|
sessionId: identifierStringSchema
|
|
19878
19878
|
}).readonly();
|
|
19879
|
-
var fileFailedEventSchema = external_exports.
|
|
19879
|
+
var fileFailedEventSchema = external_exports.object({
|
|
19880
19880
|
code: identifierStringSchema,
|
|
19881
19881
|
kind: external_exports.literal(FILE_FAILED_KIND),
|
|
19882
19882
|
message: external_exports.string().min(1).max(500),
|
|
19883
19883
|
requestId: identifierStringSchema,
|
|
19884
19884
|
sessionId: identifierStringSchema
|
|
19885
19885
|
}).readonly();
|
|
19886
|
-
var configValueSchema = external_exports.
|
|
19886
|
+
var configValueSchema = external_exports.object({
|
|
19887
19887
|
description: SHORT_TEXT,
|
|
19888
19888
|
groupId: external_exports.string().max(128),
|
|
19889
19889
|
groupName: external_exports.string().max(255),
|
|
@@ -19894,7 +19894,7 @@ var configValueSchema = external_exports.strictObject({
|
|
|
19894
19894
|
// by length alone.
|
|
19895
19895
|
value: external_exports.string().max(500)
|
|
19896
19896
|
}).readonly();
|
|
19897
|
-
var sessionConfigOptionSchema = external_exports.
|
|
19897
|
+
var sessionConfigOptionSchema = external_exports.object({
|
|
19898
19898
|
booleanValue: external_exports.boolean(),
|
|
19899
19899
|
category: external_exports.string().max(128),
|
|
19900
19900
|
currentValue: external_exports.string().max(500),
|
|
@@ -19905,7 +19905,7 @@ var sessionConfigOptionSchema = external_exports.strictObject({
|
|
|
19905
19905
|
values: external_exports.array(configValueSchema).max(500).readonly()
|
|
19906
19906
|
}).readonly();
|
|
19907
19907
|
var sessionConfigOptionsSchema = external_exports.array(sessionConfigOptionSchema).max(100).readonly();
|
|
19908
|
-
var agentSettingSchema = external_exports.
|
|
19908
|
+
var agentSettingSchema = external_exports.object({
|
|
19909
19909
|
booleanValue: external_exports.boolean(),
|
|
19910
19910
|
category: external_exports.string().max(128),
|
|
19911
19911
|
defaultValue: external_exports.string().max(500),
|
|
@@ -19924,20 +19924,20 @@ var agentModelEffortResolutionSchema = external_exports.enum([
|
|
|
19924
19924
|
AGENT_MODEL_EFFORT_RESOLUTION_ON_MODEL_SELECTION,
|
|
19925
19925
|
AGENT_MODEL_EFFORT_RESOLUTION_UNAVAILABLE
|
|
19926
19926
|
]);
|
|
19927
|
-
var agentModelEffortSchema = external_exports.
|
|
19927
|
+
var agentModelEffortSchema = external_exports.object({
|
|
19928
19928
|
effortSettingId: external_exports.string().max(128),
|
|
19929
19929
|
modelSettingId: external_exports.string().max(128),
|
|
19930
19930
|
resolution: agentModelEffortResolutionSchema,
|
|
19931
19931
|
unsupportedModelIds: external_exports.array(external_exports.string().min(1).max(500)).max(500).readonly().default([]),
|
|
19932
19932
|
valuesByModel: external_exports.record(external_exports.string().min(1).max(500), external_exports.array(configValueSchema).max(500).readonly()).readonly()
|
|
19933
19933
|
}).readonly();
|
|
19934
|
-
var agentSettingsDiscoverCommandSchema = external_exports.
|
|
19934
|
+
var agentSettingsDiscoverCommandSchema = external_exports.object({
|
|
19935
19935
|
agentId: identifierStringSchema,
|
|
19936
19936
|
kind: external_exports.literal(AGENT_SETTINGS_DISCOVER_KIND),
|
|
19937
19937
|
model: external_exports.string().min(1).max(500).optional(),
|
|
19938
19938
|
requestId: identifierStringSchema
|
|
19939
19939
|
}).readonly();
|
|
19940
|
-
var agentSettingsDiscoveredEventSchema = external_exports.
|
|
19940
|
+
var agentSettingsDiscoveredEventSchema = external_exports.object({
|
|
19941
19941
|
agentId: identifierStringSchema,
|
|
19942
19942
|
agentName: external_exports.string().max(255),
|
|
19943
19943
|
agentVersion: external_exports.string().max(128),
|
|
@@ -19947,27 +19947,27 @@ var agentSettingsDiscoveredEventSchema = external_exports.strictObject({
|
|
|
19947
19947
|
settings: agentSettingsSchema,
|
|
19948
19948
|
settingsRevision: external_exports.string().regex(/^[a-f0-9]{64}$/)
|
|
19949
19949
|
}).readonly();
|
|
19950
|
-
var agentSettingsDiscoveryFailedEventSchema = external_exports.
|
|
19950
|
+
var agentSettingsDiscoveryFailedEventSchema = external_exports.object({
|
|
19951
19951
|
code: identifierStringSchema,
|
|
19952
19952
|
kind: external_exports.literal(AGENT_SETTINGS_DISCOVERY_FAILED_KIND),
|
|
19953
19953
|
message: external_exports.string().min(1).max(500),
|
|
19954
19954
|
requestId: identifierStringSchema
|
|
19955
19955
|
}).readonly();
|
|
19956
|
-
var agentCatalogRefreshCommandSchema = external_exports.
|
|
19956
|
+
var agentCatalogRefreshCommandSchema = external_exports.object({
|
|
19957
19957
|
kind: external_exports.literal(AGENT_CATALOG_REFRESH_KIND),
|
|
19958
19958
|
requestId: identifierStringSchema
|
|
19959
19959
|
}).readonly();
|
|
19960
|
-
var agentCatalogRefreshedEventSchema = external_exports.
|
|
19960
|
+
var agentCatalogRefreshedEventSchema = external_exports.object({
|
|
19961
19961
|
kind: external_exports.literal(AGENT_CATALOG_REFRESHED_KIND),
|
|
19962
19962
|
requestId: identifierStringSchema
|
|
19963
19963
|
}).readonly();
|
|
19964
|
-
var agentCatalogRefreshFailedEventSchema = external_exports.
|
|
19964
|
+
var agentCatalogRefreshFailedEventSchema = external_exports.object({
|
|
19965
19965
|
code: identifierStringSchema,
|
|
19966
19966
|
kind: external_exports.literal(AGENT_CATALOG_REFRESH_FAILED_KIND),
|
|
19967
19967
|
message: external_exports.string().min(1).max(500),
|
|
19968
19968
|
requestId: identifierStringSchema
|
|
19969
19969
|
}).readonly();
|
|
19970
|
-
var sessionConfigurationSelectionSchema = external_exports.
|
|
19970
|
+
var sessionConfigurationSelectionSchema = external_exports.object({
|
|
19971
19971
|
booleanValue: external_exports.boolean(),
|
|
19972
19972
|
configId: identifierStringSchema,
|
|
19973
19973
|
value: external_exports.string().max(500),
|
|
@@ -19981,7 +19981,7 @@ var AGENT_PERMISSION_MODES = Object.freeze([
|
|
|
19981
19981
|
"workspace-write",
|
|
19982
19982
|
"danger-full-access"
|
|
19983
19983
|
]);
|
|
19984
|
-
var agentExecutionConfigurationSchema = external_exports.
|
|
19984
|
+
var agentExecutionConfigurationSchema = external_exports.object({
|
|
19985
19985
|
model: sessionConfigurationSelectionSchema,
|
|
19986
19986
|
permissionMode: external_exports.string().refine((value) => AGENT_PERMISSION_MODES.includes(value)),
|
|
19987
19987
|
reasoningEffort: sessionConfigurationSelectionSchema
|
|
@@ -20025,7 +20025,7 @@ var sessionConfigurationSelectionsSchema = external_exports.array(sessionConfigu
|
|
|
20025
20025
|
identifiers.add(selection.configId);
|
|
20026
20026
|
}
|
|
20027
20027
|
}).readonly();
|
|
20028
|
-
var sessionCapabilitiesSchema = external_exports.
|
|
20028
|
+
var sessionCapabilitiesSchema = external_exports.object({
|
|
20029
20029
|
additionalDirectories: external_exports.boolean(),
|
|
20030
20030
|
audioPrompt: external_exports.boolean(),
|
|
20031
20031
|
closeSession: external_exports.boolean(),
|
|
@@ -20039,22 +20039,22 @@ var sessionCapabilitiesSchema = external_exports.strictObject({
|
|
|
20039
20039
|
steering: external_exports.boolean().default(false),
|
|
20040
20040
|
unstableForkSession: external_exports.boolean().default(false)
|
|
20041
20041
|
}).readonly();
|
|
20042
|
-
var sessionCommandSchema = external_exports.
|
|
20042
|
+
var sessionCommandSchema = external_exports.object({
|
|
20043
20043
|
description: SHORT_TEXT,
|
|
20044
20044
|
inputHint: external_exports.string().max(255),
|
|
20045
20045
|
name: external_exports.string().min(1).max(128)
|
|
20046
20046
|
}).readonly();
|
|
20047
|
-
var permissionOptionSchema = external_exports.
|
|
20047
|
+
var permissionOptionSchema = external_exports.object({
|
|
20048
20048
|
kind: external_exports.enum(["allow_once", "allow_always", "reject_once", "reject_always"]),
|
|
20049
20049
|
name: external_exports.string().min(1).max(255),
|
|
20050
20050
|
optionId: external_exports.string().min(1).max(255)
|
|
20051
20051
|
}).readonly();
|
|
20052
|
-
var elicitationOptionSchema = external_exports.
|
|
20052
|
+
var elicitationOptionSchema = external_exports.object({
|
|
20053
20053
|
description: SHORT_TEXT,
|
|
20054
20054
|
label: external_exports.string().min(1).max(255),
|
|
20055
20055
|
value: external_exports.string().max(500)
|
|
20056
20056
|
}).readonly();
|
|
20057
|
-
var elicitationFieldSchema = external_exports.
|
|
20057
|
+
var elicitationFieldSchema = external_exports.object({
|
|
20058
20058
|
defaultBooleanValue: external_exports.boolean(),
|
|
20059
20059
|
defaultNumberValue: external_exports.number().finite(),
|
|
20060
20060
|
defaultStringValue: external_exports.string().max(1e4),
|
|
@@ -20072,7 +20072,7 @@ var elicitationFieldSchema = external_exports.strictObject({
|
|
|
20072
20072
|
title: external_exports.string().min(1).max(255),
|
|
20073
20073
|
type: external_exports.enum(["boolean", "integer", "multiselect", "number", "select", "string"])
|
|
20074
20074
|
}).readonly();
|
|
20075
|
-
var displayContentSchema = external_exports.
|
|
20075
|
+
var displayContentSchema = external_exports.object({
|
|
20076
20076
|
artifactId: external_exports.string().max(128).default(""),
|
|
20077
20077
|
data: external_exports.string().max(4e6),
|
|
20078
20078
|
mimeType: external_exports.string().max(255),
|
|
@@ -20085,7 +20085,7 @@ var displayContentSchema = external_exports.strictObject({
|
|
|
20085
20085
|
type: external_exports.enum(["diff", "image", "resource", "resource_link", "terminal", "text", "video"]),
|
|
20086
20086
|
uri: external_exports.string().max(4096)
|
|
20087
20087
|
}).readonly();
|
|
20088
|
-
var recordedDisplayContentSchema = external_exports.
|
|
20088
|
+
var recordedDisplayContentSchema = external_exports.object({
|
|
20089
20089
|
artifactId: external_exports.string().max(128).default(""),
|
|
20090
20090
|
data: external_exports.string().max(4e6),
|
|
20091
20091
|
mimeType: external_exports.string().max(255),
|
|
@@ -20098,25 +20098,25 @@ var recordedDisplayContentSchema = external_exports.strictObject({
|
|
|
20098
20098
|
type: external_exports.enum(["diff", "image", "resource", "resource_link", "terminal", "text", "video"]),
|
|
20099
20099
|
uri: external_exports.string().max(4096)
|
|
20100
20100
|
}).readonly();
|
|
20101
|
-
var promptImageSchema = external_exports.
|
|
20101
|
+
var promptImageSchema = external_exports.object({
|
|
20102
20102
|
data: external_exports.string().min(1).max(4e6),
|
|
20103
20103
|
mimeType: external_exports.string().min(1).max(255),
|
|
20104
20104
|
name: external_exports.string().min(1).max(500)
|
|
20105
20105
|
}).readonly();
|
|
20106
|
-
var promptResourceSchema = external_exports.
|
|
20106
|
+
var promptResourceSchema = external_exports.object({
|
|
20107
20107
|
mimeType: external_exports.string().max(255),
|
|
20108
20108
|
name: external_exports.string().min(1).max(500),
|
|
20109
20109
|
text: external_exports.string().max(1e6),
|
|
20110
20110
|
type: external_exports.enum(["embedded", "link"]),
|
|
20111
20111
|
uri: external_exports.string().min(1).max(4096)
|
|
20112
20112
|
}).readonly();
|
|
20113
|
-
var workspaceListCommandSchema = external_exports.
|
|
20113
|
+
var workspaceListCommandSchema = external_exports.object({
|
|
20114
20114
|
bindingId: identifierStringSchema,
|
|
20115
20115
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
20116
20116
|
kind: external_exports.literal(WORKSPACE_LIST_KIND),
|
|
20117
20117
|
requestId: identifierStringSchema
|
|
20118
20118
|
}).readonly();
|
|
20119
|
-
var workspaceEntriesEventSchema = external_exports.
|
|
20119
|
+
var workspaceEntriesEventSchema = external_exports.object({
|
|
20120
20120
|
bindingId: identifierStringSchema,
|
|
20121
20121
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
20122
20122
|
directoryLabel: external_exports.string().min(1).max(2048),
|
|
@@ -20132,9 +20132,9 @@ var sessionIdentityFields = {
|
|
|
20132
20132
|
directoryId: DIRECTORY_IDENTIFIER,
|
|
20133
20133
|
sessionId: identifierStringSchema
|
|
20134
20134
|
};
|
|
20135
|
-
var sessionPrepareCommandSchema = external_exports.
|
|
20135
|
+
var sessionPrepareCommandSchema = external_exports.object({
|
|
20136
20136
|
...sessionIdentityFields,
|
|
20137
|
-
configuration: external_exports.
|
|
20137
|
+
configuration: external_exports.object({
|
|
20138
20138
|
booleanValue: external_exports.boolean(),
|
|
20139
20139
|
configId: external_exports.string().min(1).max(128),
|
|
20140
20140
|
value: external_exports.string().max(500),
|
|
@@ -20155,12 +20155,12 @@ var sessionPrepareCommandSchema = external_exports.strictObject({
|
|
|
20155
20155
|
}
|
|
20156
20156
|
}).readonly();
|
|
20157
20157
|
var runtimeTimingsSchema = external_exports.array(
|
|
20158
|
-
external_exports.
|
|
20158
|
+
external_exports.object({
|
|
20159
20159
|
durationMilliseconds: external_exports.number().finite().nonnegative().max(12e4),
|
|
20160
20160
|
name: external_exports.string().regex(/^[a-z][a-z0-9-]{0,63}$/)
|
|
20161
20161
|
}).readonly()
|
|
20162
20162
|
).max(16).readonly();
|
|
20163
|
-
var sessionReadyEventSchema = external_exports.
|
|
20163
|
+
var sessionReadyEventSchema = external_exports.object({
|
|
20164
20164
|
additionalDirectories: external_exports.array(workspaceEntrySchema).max(16).readonly(),
|
|
20165
20165
|
agentId: identifierStringSchema,
|
|
20166
20166
|
agentName: external_exports.string().max(255),
|
|
@@ -20176,7 +20176,7 @@ var sessionReadyEventSchema = external_exports.strictObject({
|
|
|
20176
20176
|
runtimeTimings: runtimeTimingsSchema.optional(),
|
|
20177
20177
|
sessionId: identifierStringSchema
|
|
20178
20178
|
}).readonly();
|
|
20179
|
-
var sessionConfigureCommandSchema = external_exports.
|
|
20179
|
+
var sessionConfigureCommandSchema = external_exports.object({
|
|
20180
20180
|
...sessionIdentityFields,
|
|
20181
20181
|
booleanValue: external_exports.boolean(),
|
|
20182
20182
|
configId: external_exports.string().min(1).max(128),
|
|
@@ -20185,13 +20185,13 @@ var sessionConfigureCommandSchema = external_exports.strictObject({
|
|
|
20185
20185
|
value: external_exports.string().max(500),
|
|
20186
20186
|
valueType: external_exports.enum(["boolean", "select"])
|
|
20187
20187
|
}).readonly();
|
|
20188
|
-
var sessionConfigUpdatedEventSchema = external_exports.
|
|
20188
|
+
var sessionConfigUpdatedEventSchema = external_exports.object({
|
|
20189
20189
|
configOptions: sessionConfigOptionsSchema,
|
|
20190
20190
|
kind: external_exports.literal(SESSION_CONFIG_UPDATED_KIND),
|
|
20191
20191
|
requestId: identifierStringSchema,
|
|
20192
20192
|
sessionId: identifierStringSchema
|
|
20193
20193
|
}).readonly();
|
|
20194
|
-
var sessionContextUsageUpdatedEventSchema = external_exports.
|
|
20194
|
+
var sessionContextUsageUpdatedEventSchema = external_exports.object({
|
|
20195
20195
|
costAmount: external_exports.number().finite().nonnegative(),
|
|
20196
20196
|
costCurrency: external_exports.string().max(16),
|
|
20197
20197
|
hasCost: external_exports.boolean(),
|
|
@@ -20201,7 +20201,7 @@ var sessionContextUsageUpdatedEventSchema = external_exports.strictObject({
|
|
|
20201
20201
|
source: external_exports.literal("context").default("context"),
|
|
20202
20202
|
used: external_exports.number().int().nonnegative()
|
|
20203
20203
|
}).readonly();
|
|
20204
|
-
var sessionPromptUsageUpdatedEventSchema = external_exports.
|
|
20204
|
+
var sessionPromptUsageUpdatedEventSchema = external_exports.object({
|
|
20205
20205
|
_meta: promptMetadataSchema.nullable(),
|
|
20206
20206
|
commandId: identifierStringSchema,
|
|
20207
20207
|
kind: external_exports.literal(SESSION_USAGE_UPDATED_KIND),
|
|
@@ -20213,18 +20213,18 @@ var sessionUsageUpdatedEventSchema = external_exports.union([
|
|
|
20213
20213
|
sessionContextUsageUpdatedEventSchema,
|
|
20214
20214
|
sessionPromptUsageUpdatedEventSchema
|
|
20215
20215
|
]);
|
|
20216
|
-
var sessionCommandsUpdatedEventSchema = external_exports.
|
|
20216
|
+
var sessionCommandsUpdatedEventSchema = external_exports.object({
|
|
20217
20217
|
commands: external_exports.array(sessionCommandSchema).max(500).readonly(),
|
|
20218
20218
|
kind: external_exports.literal(SESSION_COMMANDS_UPDATED_KIND),
|
|
20219
20219
|
sessionId: identifierStringSchema
|
|
20220
20220
|
}).readonly();
|
|
20221
|
-
var sessionInfoUpdatedEventSchema = external_exports.
|
|
20221
|
+
var sessionInfoUpdatedEventSchema = external_exports.object({
|
|
20222
20222
|
kind: external_exports.literal(SESSION_INFO_UPDATED_KIND),
|
|
20223
20223
|
sessionId: identifierStringSchema,
|
|
20224
20224
|
title: external_exports.string().max(500).nullable(),
|
|
20225
20225
|
updatedAt: external_exports.string().max(128)
|
|
20226
20226
|
}).readonly();
|
|
20227
|
-
var sessionPermissionRequestedEventSchema = external_exports.
|
|
20227
|
+
var sessionPermissionRequestedEventSchema = external_exports.object({
|
|
20228
20228
|
commandId: identifierStringSchema,
|
|
20229
20229
|
interactionId: identifierStringSchema,
|
|
20230
20230
|
kind: external_exports.literal(SESSION_PERMISSION_REQUESTED_KIND),
|
|
@@ -20234,21 +20234,21 @@ var sessionPermissionRequestedEventSchema = external_exports.strictObject({
|
|
|
20234
20234
|
toolCallId: external_exports.string().min(1).max(255),
|
|
20235
20235
|
toolKind: external_exports.string().max(64)
|
|
20236
20236
|
}).readonly();
|
|
20237
|
-
var sessionPermissionRespondCommandSchema = external_exports.
|
|
20237
|
+
var sessionPermissionRespondCommandSchema = external_exports.object({
|
|
20238
20238
|
interactionId: identifierStringSchema,
|
|
20239
20239
|
kind: external_exports.literal(SESSION_PERMISSION_RESPOND_KIND),
|
|
20240
20240
|
optionId: external_exports.string().max(255),
|
|
20241
20241
|
outcome: external_exports.enum(["cancelled", "selected"]),
|
|
20242
20242
|
sessionId: identifierStringSchema
|
|
20243
20243
|
}).readonly();
|
|
20244
|
-
var sessionPermissionResolvedEventSchema = external_exports.
|
|
20244
|
+
var sessionPermissionResolvedEventSchema = external_exports.object({
|
|
20245
20245
|
interactionId: identifierStringSchema,
|
|
20246
20246
|
kind: external_exports.literal(SESSION_PERMISSION_RESOLVED_KIND),
|
|
20247
20247
|
optionId: external_exports.string().max(255),
|
|
20248
20248
|
outcome: external_exports.enum(["cancelled", "selected"]),
|
|
20249
20249
|
sessionId: identifierStringSchema
|
|
20250
20250
|
}).readonly();
|
|
20251
|
-
var sessionElicitationRequestedEventSchema = external_exports.
|
|
20251
|
+
var sessionElicitationRequestedEventSchema = external_exports.object({
|
|
20252
20252
|
accepted: external_exports.boolean(),
|
|
20253
20253
|
commandId: identifierStringSchema,
|
|
20254
20254
|
elicitationId: external_exports.string().max(255),
|
|
@@ -20260,20 +20260,20 @@ var sessionElicitationRequestedEventSchema = external_exports.strictObject({
|
|
|
20260
20260
|
sessionId: identifierStringSchema,
|
|
20261
20261
|
url: external_exports.string().max(4096)
|
|
20262
20262
|
}).readonly();
|
|
20263
|
-
var sessionElicitationRespondCommandSchema = external_exports.
|
|
20263
|
+
var sessionElicitationRespondCommandSchema = external_exports.object({
|
|
20264
20264
|
action: external_exports.enum(["accept", "cancel", "decline"]),
|
|
20265
20265
|
content: external_exports.string().max(1e5),
|
|
20266
20266
|
interactionId: identifierStringSchema,
|
|
20267
20267
|
kind: external_exports.literal(SESSION_ELICITATION_RESPOND_KIND),
|
|
20268
20268
|
sessionId: identifierStringSchema
|
|
20269
20269
|
}).readonly();
|
|
20270
|
-
var sessionElicitationResolvedEventSchema = external_exports.
|
|
20270
|
+
var sessionElicitationResolvedEventSchema = external_exports.object({
|
|
20271
20271
|
action: external_exports.enum(["accept", "cancel", "decline", "complete"]),
|
|
20272
20272
|
interactionId: identifierStringSchema,
|
|
20273
20273
|
kind: external_exports.literal(SESSION_ELICITATION_RESOLVED_KIND),
|
|
20274
20274
|
sessionId: identifierStringSchema
|
|
20275
20275
|
}).readonly();
|
|
20276
|
-
var sessionOperationFailedEventSchema = external_exports.
|
|
20276
|
+
var sessionOperationFailedEventSchema = external_exports.object({
|
|
20277
20277
|
code: identifierStringSchema,
|
|
20278
20278
|
kind: external_exports.literal(SESSION_OPERATION_FAILED_KIND),
|
|
20279
20279
|
message: external_exports.string().min(1).max(500),
|
|
@@ -20281,7 +20281,7 @@ var sessionOperationFailedEventSchema = external_exports.strictObject({
|
|
|
20281
20281
|
runtimeTimings: runtimeTimingsSchema.optional(),
|
|
20282
20282
|
sessionId: external_exports.string().max(128)
|
|
20283
20283
|
}).readonly();
|
|
20284
|
-
var agentContentEventSchema = external_exports.
|
|
20284
|
+
var agentContentEventSchema = external_exports.object({
|
|
20285
20285
|
commandId: identifierStringSchema,
|
|
20286
20286
|
content: displayContentSchema,
|
|
20287
20287
|
contentId: identifierStringSchema,
|
|
@@ -20293,15 +20293,15 @@ var agentInstallIdentityFields = {
|
|
|
20293
20293
|
agentId: identifierStringSchema,
|
|
20294
20294
|
requestId: identifierStringSchema
|
|
20295
20295
|
};
|
|
20296
|
-
var agentInstallRequestCommandSchema = external_exports.
|
|
20296
|
+
var agentInstallRequestCommandSchema = external_exports.object({
|
|
20297
20297
|
...agentInstallIdentityFields,
|
|
20298
20298
|
kind: external_exports.literal(AGENT_INSTALL_REQUEST_KIND)
|
|
20299
20299
|
}).readonly();
|
|
20300
|
-
var agentInstallCancelCommandSchema = external_exports.
|
|
20300
|
+
var agentInstallCancelCommandSchema = external_exports.object({
|
|
20301
20301
|
kind: external_exports.literal(AGENT_INSTALL_CANCEL_KIND),
|
|
20302
20302
|
requestId: identifierStringSchema
|
|
20303
20303
|
}).readonly();
|
|
20304
|
-
var agentInstallStartedEventSchema = external_exports.
|
|
20304
|
+
var agentInstallStartedEventSchema = external_exports.object({
|
|
20305
20305
|
...agentInstallIdentityFields,
|
|
20306
20306
|
kind: external_exports.literal(AGENT_INSTALL_STARTED_KIND)
|
|
20307
20307
|
}).readonly();
|
|
@@ -20312,23 +20312,23 @@ var installationStageSchema = external_exports.enum([
|
|
|
20312
20312
|
"installing_adapter",
|
|
20313
20313
|
"checking_acp"
|
|
20314
20314
|
]);
|
|
20315
|
-
var agentInstallProgressEventSchema = external_exports.
|
|
20315
|
+
var agentInstallProgressEventSchema = external_exports.object({
|
|
20316
20316
|
...agentInstallIdentityFields,
|
|
20317
20317
|
kind: external_exports.literal(AGENT_INSTALL_PROGRESS_KIND),
|
|
20318
20318
|
stage: installationStageSchema
|
|
20319
20319
|
}).readonly();
|
|
20320
|
-
var agentInstallCompletedEventSchema = external_exports.
|
|
20320
|
+
var agentInstallCompletedEventSchema = external_exports.object({
|
|
20321
20321
|
...agentInstallIdentityFields,
|
|
20322
20322
|
authenticationMayBeRequired: external_exports.boolean(),
|
|
20323
20323
|
kind: external_exports.literal(AGENT_INSTALL_COMPLETED_KIND)
|
|
20324
20324
|
}).readonly();
|
|
20325
|
-
var agentInstallFailedEventSchema = external_exports.
|
|
20325
|
+
var agentInstallFailedEventSchema = external_exports.object({
|
|
20326
20326
|
...agentInstallIdentityFields,
|
|
20327
20327
|
code: identifierStringSchema,
|
|
20328
20328
|
kind: external_exports.literal(AGENT_INSTALL_FAILED_KIND),
|
|
20329
20329
|
message: external_exports.string().min(1).max(500)
|
|
20330
20330
|
}).readonly();
|
|
20331
|
-
var agentInstallCancelledEventSchema = external_exports.
|
|
20331
|
+
var agentInstallCancelledEventSchema = external_exports.object({
|
|
20332
20332
|
...agentInstallIdentityFields,
|
|
20333
20333
|
kind: external_exports.literal(AGENT_INSTALL_CANCELLED_KIND)
|
|
20334
20334
|
}).readonly();
|
|
@@ -20491,6 +20491,17 @@ var ProtocolMessageError = class extends Error {
|
|
|
20491
20491
|
this.name = "ProtocolMessageError";
|
|
20492
20492
|
}
|
|
20493
20493
|
};
|
|
20494
|
+
var UnsupportedProtocolMessageKindError = class extends Error {
|
|
20495
|
+
code = "unsupported_protocol_message_kind";
|
|
20496
|
+
direction;
|
|
20497
|
+
messageKind;
|
|
20498
|
+
constructor(direction, messageKind) {
|
|
20499
|
+
super(`Unsupported ${direction} message kind: ${messageKind}`);
|
|
20500
|
+
this.name = "UnsupportedProtocolMessageKindError";
|
|
20501
|
+
this.direction = direction;
|
|
20502
|
+
this.messageKind = messageKind;
|
|
20503
|
+
}
|
|
20504
|
+
};
|
|
20494
20505
|
function isRecord(value) {
|
|
20495
20506
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
20496
20507
|
}
|
|
@@ -20508,13 +20519,6 @@ function parseJson2(encoded) {
|
|
|
20508
20519
|
}
|
|
20509
20520
|
return value;
|
|
20510
20521
|
}
|
|
20511
|
-
function assertExactKeys(value, allowedKeys) {
|
|
20512
|
-
for (const key of Object.keys(value)) {
|
|
20513
|
-
if (!allowedKeys.includes(key)) {
|
|
20514
|
-
throw new ProtocolMessageError(`Unexpected message field: ${key}`);
|
|
20515
|
-
}
|
|
20516
|
-
}
|
|
20517
|
-
}
|
|
20518
20522
|
function readString(value, key, maximumLength) {
|
|
20519
20523
|
const field = value[key];
|
|
20520
20524
|
if (typeof field !== "string" || field.length === 0 || field.length > maximumLength) {
|
|
@@ -20605,18 +20609,15 @@ function readActivityDetail(value) {
|
|
|
20605
20609
|
}
|
|
20606
20610
|
const kind = readString(field, "kind", 32);
|
|
20607
20611
|
if (kind === "available") {
|
|
20608
|
-
assertExactKeys(field, ["artifactId", "kind"]);
|
|
20609
20612
|
return {
|
|
20610
20613
|
artifactId: readIdentifier(field, "artifactId"),
|
|
20611
20614
|
kind
|
|
20612
20615
|
};
|
|
20613
20616
|
}
|
|
20614
20617
|
if (kind === "unrecorded") {
|
|
20615
|
-
assertExactKeys(field, ["kind"]);
|
|
20616
20618
|
return { kind };
|
|
20617
20619
|
}
|
|
20618
20620
|
if (kind === "truncated") {
|
|
20619
|
-
assertExactKeys(field, ["capturedBytes", "kind", "originalBytes"]);
|
|
20620
20621
|
const capturedBytes = readSequence(field, "capturedBytes");
|
|
20621
20622
|
const originalBytes = readSequence(field, "originalBytes");
|
|
20622
20623
|
if (capturedBytes > originalBytes) {
|
|
@@ -20625,7 +20626,6 @@ function readActivityDetail(value) {
|
|
|
20625
20626
|
return { capturedBytes, kind, originalBytes };
|
|
20626
20627
|
}
|
|
20627
20628
|
if (kind === "recorded") {
|
|
20628
|
-
assertExactKeys(field, ["content", "input", "kind", "output"]);
|
|
20629
20629
|
const contentValue = field["content"];
|
|
20630
20630
|
if (!Array.isArray(contentValue) || contentValue.length > 100) {
|
|
20631
20631
|
throw new ProtocolMessageError("Invalid recorded activity content");
|
|
@@ -20668,21 +20668,6 @@ function decodeMessageKind(encoded) {
|
|
|
20668
20668
|
function decodeSessionPromptCommand(encoded) {
|
|
20669
20669
|
const value = parseJson2(encoded);
|
|
20670
20670
|
const hasSessionConfigurations = Object.hasOwn(value, "sessionConfigurations");
|
|
20671
|
-
assertExactKeys(value, [
|
|
20672
|
-
"additionalDirectoryIds",
|
|
20673
|
-
"agentId",
|
|
20674
|
-
"bindingId",
|
|
20675
|
-
"commandId",
|
|
20676
|
-
"directoryId",
|
|
20677
|
-
"disposition",
|
|
20678
|
-
"images",
|
|
20679
|
-
"kind",
|
|
20680
|
-
"prompt",
|
|
20681
|
-
"resources",
|
|
20682
|
-
...hasSessionConfigurations ? ["sessionConfigurations"] : [],
|
|
20683
|
-
"sessionId",
|
|
20684
|
-
"targetCommandId"
|
|
20685
|
-
]);
|
|
20686
20671
|
assertKind(value, SESSION_PROMPT_KIND);
|
|
20687
20672
|
const prompt = readText(value, "prompt", MAX_PROMPT_LENGTH);
|
|
20688
20673
|
const images = decodePromptImagesValue(value["images"]);
|
|
@@ -20722,7 +20707,6 @@ function decodeSessionPromptCommand(encoded) {
|
|
|
20722
20707
|
}
|
|
20723
20708
|
function decodeSessionCancelCommand(encoded) {
|
|
20724
20709
|
const value = parseJson2(encoded);
|
|
20725
|
-
assertExactKeys(value, ["commandId", "kind", "sessionId"]);
|
|
20726
20710
|
assertKind(value, SESSION_CANCEL_KIND);
|
|
20727
20711
|
return {
|
|
20728
20712
|
commandId: readIdentifier(value, "commandId"),
|
|
@@ -20732,7 +20716,6 @@ function decodeSessionCancelCommand(encoded) {
|
|
|
20732
20716
|
}
|
|
20733
20717
|
function decodeSessionPromptDispositionCommand(encoded) {
|
|
20734
20718
|
const value = parseJson2(encoded);
|
|
20735
|
-
assertExactKeys(value, ["commandId", "disposition", "kind", "sessionId"]);
|
|
20736
20719
|
assertKind(value, SESSION_PROMPT_DISPOSITION_KIND);
|
|
20737
20720
|
if (readPromptDisposition(value) !== SessionPromptDisposition.Steer) {
|
|
20738
20721
|
throw new ProtocolMessageError("Only queued prompts can be steered");
|
|
@@ -20746,7 +20729,6 @@ function decodeSessionPromptDispositionCommand(encoded) {
|
|
|
20746
20729
|
}
|
|
20747
20730
|
function decodeSessionQueuedEvent(encoded) {
|
|
20748
20731
|
const value = parseJson2(encoded);
|
|
20749
|
-
assertExactKeys(value, ["commandId", "kind", "sessionId"]);
|
|
20750
20732
|
assertKind(value, SESSION_QUEUED_KIND);
|
|
20751
20733
|
return {
|
|
20752
20734
|
commandId: readIdentifier(value, "commandId"),
|
|
@@ -20757,12 +20739,10 @@ function decodeSessionQueuedEvent(encoded) {
|
|
|
20757
20739
|
function decodeRuntimeLivenessReadyEvent(encoded) {
|
|
20758
20740
|
const value = parseJson2(encoded);
|
|
20759
20741
|
assertKind(value, RUNTIME_LIVENESS_READY_KIND);
|
|
20760
|
-
assertExactKeys(value, ["kind"]);
|
|
20761
20742
|
return { kind: RUNTIME_LIVENESS_READY_KIND };
|
|
20762
20743
|
}
|
|
20763
20744
|
function decodeRuntimeHeartbeatEvent(encoded) {
|
|
20764
20745
|
const value = parseJson2(encoded);
|
|
20765
|
-
assertExactKeys(value, ["heartbeatId", "kind"]);
|
|
20766
20746
|
assertKind(value, RUNTIME_HEARTBEAT_KIND);
|
|
20767
20747
|
return {
|
|
20768
20748
|
heartbeatId: readIdentifier(value, "heartbeatId"),
|
|
@@ -20771,7 +20751,6 @@ function decodeRuntimeHeartbeatEvent(encoded) {
|
|
|
20771
20751
|
}
|
|
20772
20752
|
function decodeRuntimeHeartbeatAckEvent(encoded) {
|
|
20773
20753
|
const value = parseJson2(encoded);
|
|
20774
|
-
assertExactKeys(value, ["heartbeatId", "kind"]);
|
|
20775
20754
|
assertKind(value, RUNTIME_HEARTBEAT_ACK_KIND);
|
|
20776
20755
|
return {
|
|
20777
20756
|
heartbeatId: readIdentifier(value, "heartbeatId"),
|
|
@@ -20780,7 +20759,6 @@ function decodeRuntimeHeartbeatAckEvent(encoded) {
|
|
|
20780
20759
|
}
|
|
20781
20760
|
function decodeSessionStartedEvent(encoded) {
|
|
20782
20761
|
const value = parseJson2(encoded);
|
|
20783
|
-
assertExactKeys(value, ["commandId", "epoch", "kind", "attemptId", "prompt", "sequence", "sessionId"]);
|
|
20784
20762
|
assertKind(value, SESSION_STARTED_KIND);
|
|
20785
20763
|
const sequence = readSequence(value, "sequence");
|
|
20786
20764
|
if (sequence !== 0) {
|
|
@@ -20798,7 +20776,6 @@ function decodeSessionStartedEvent(encoded) {
|
|
|
20798
20776
|
}
|
|
20799
20777
|
function decodeAgentMessageDeltaEvent(encoded) {
|
|
20800
20778
|
const value = parseJson2(encoded);
|
|
20801
|
-
assertExactKeys(value, ["commandId", "epoch", "kind", "messageId", "sequence", "sessionId", "text"]);
|
|
20802
20779
|
assertKind(value, AGENT_MESSAGE_DELTA_KIND);
|
|
20803
20780
|
const sequence = readSequence(value, "sequence");
|
|
20804
20781
|
if (sequence === 0) {
|
|
@@ -20816,23 +20793,6 @@ function decodeAgentMessageDeltaEvent(encoded) {
|
|
|
20816
20793
|
}
|
|
20817
20794
|
function decodeAgentActivityEvent(encoded) {
|
|
20818
20795
|
const value = parseJson2(encoded);
|
|
20819
|
-
assertExactKeys(value, [
|
|
20820
|
-
"activityId",
|
|
20821
|
-
"activityType",
|
|
20822
|
-
"commandId",
|
|
20823
|
-
"content",
|
|
20824
|
-
"detail",
|
|
20825
|
-
"input",
|
|
20826
|
-
"kind",
|
|
20827
|
-
"locations",
|
|
20828
|
-
"name",
|
|
20829
|
-
"output",
|
|
20830
|
-
"sequence",
|
|
20831
|
-
"sessionId",
|
|
20832
|
-
"status",
|
|
20833
|
-
"title",
|
|
20834
|
-
"toolKind"
|
|
20835
|
-
]);
|
|
20836
20796
|
assertKind(value, AGENT_ACTIVITY_KIND);
|
|
20837
20797
|
return {
|
|
20838
20798
|
activityId: readIdentifier(value, "activityId"),
|
|
@@ -20854,7 +20814,6 @@ function decodeAgentActivityEvent(encoded) {
|
|
|
20854
20814
|
}
|
|
20855
20815
|
function decodeSessionCompletedEvent(encoded) {
|
|
20856
20816
|
const value = parseJson2(encoded);
|
|
20857
|
-
assertExactKeys(value, ["commandId", "kind", "sessionId", "stopReason"]);
|
|
20858
20817
|
assertKind(value, SESSION_COMPLETED_KIND);
|
|
20859
20818
|
return {
|
|
20860
20819
|
commandId: readIdentifier(value, "commandId"),
|
|
@@ -20865,7 +20824,6 @@ function decodeSessionCompletedEvent(encoded) {
|
|
|
20865
20824
|
}
|
|
20866
20825
|
function decodeSessionFailedEvent(encoded) {
|
|
20867
20826
|
const value = parseJson2(encoded);
|
|
20868
|
-
assertExactKeys(value, ["code", "commandId", "kind", "message", "sessionId"]);
|
|
20869
20827
|
assertKind(value, SESSION_FAILED_KIND);
|
|
20870
20828
|
return {
|
|
20871
20829
|
code: readIdentifier(value, "code"),
|
|
@@ -20898,7 +20856,6 @@ function encodeRuntimeHeartbeatAckEvent(message) {
|
|
|
20898
20856
|
}
|
|
20899
20857
|
function decodeAgentActivityNarrationEvent(encoded) {
|
|
20900
20858
|
const value = parseJson2(encoded);
|
|
20901
|
-
assertExactKeys(value, ["activityId", "activityType", "commandId", "kind", "sequence", "sessionId", "text"]);
|
|
20902
20859
|
assertKind(value, AGENT_ACTIVITY_NARRATION_KIND);
|
|
20903
20860
|
return {
|
|
20904
20861
|
activityId: readIdentifier(value, "activityId"),
|
|
@@ -20916,7 +20873,7 @@ var SESSION_HISTORY_CHARACTER_LIMIT = 256e3;
|
|
|
20916
20873
|
var SESSION_HISTORY_MESSAGE_LIMIT = 1e3;
|
|
20917
20874
|
var SESSION_HISTORY_PREVIEW_MESSAGE_LIMIT = 10;
|
|
20918
20875
|
var SESSION_HISTORY_IMAGE_CHARACTER_LIMIT = 4e6;
|
|
20919
|
-
var historyImage = external_exports.
|
|
20876
|
+
var historyImage = external_exports.object({
|
|
20920
20877
|
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)),
|
|
20921
20878
|
mimeType: external_exports.enum(["image/png", "image/jpeg", "image/gif", "image/webp"]),
|
|
20922
20879
|
name: external_exports.string().min(1).max(500)
|
|
@@ -20943,7 +20900,7 @@ function parseNativeHistoryText(text2) {
|
|
|
20943
20900
|
});
|
|
20944
20901
|
return { text: plainText, images };
|
|
20945
20902
|
}
|
|
20946
|
-
var nativeMessageActivitySchema = external_exports.
|
|
20903
|
+
var nativeMessageActivitySchema = external_exports.object({
|
|
20947
20904
|
activityId: external_exports.string().min(1).max(128),
|
|
20948
20905
|
activityType: external_exports.string().min(1).max(128),
|
|
20949
20906
|
content: external_exports.array(displayContentSchema).max(100).readonly(),
|
|
@@ -20956,12 +20913,12 @@ var nativeMessageActivitySchema = external_exports.strictObject({
|
|
|
20956
20913
|
title: external_exports.string().max(500),
|
|
20957
20914
|
toolKind: external_exports.string().max(64)
|
|
20958
20915
|
}).readonly();
|
|
20959
|
-
var userHistoryMessage = external_exports.
|
|
20916
|
+
var userHistoryMessage = external_exports.object({
|
|
20960
20917
|
role: external_exports.literal("user"),
|
|
20961
20918
|
text: external_exports.string().max(SESSION_HISTORY_CHARACTER_LIMIT),
|
|
20962
20919
|
images: external_exports.array(historyImage).max(8).readonly().optional()
|
|
20963
20920
|
}).readonly();
|
|
20964
|
-
var assistantHistoryMessageSchema = external_exports.
|
|
20921
|
+
var assistantHistoryMessageSchema = external_exports.object({
|
|
20965
20922
|
activities: external_exports.array(nativeMessageActivitySchema).max(100).readonly().default([]),
|
|
20966
20923
|
content: external_exports.array(displayContentSchema).max(100).readonly().default([]),
|
|
20967
20924
|
role: external_exports.literal("assistant"),
|
|
@@ -20971,8 +20928,8 @@ var assistantHistoryMessageSchema = external_exports.strictObject({
|
|
|
20971
20928
|
images: external_exports.array(historyImage).max(8).readonly().optional()
|
|
20972
20929
|
}).readonly();
|
|
20973
20930
|
var historyMessage = external_exports.discriminatedUnion("role", [userHistoryMessage, assistantHistoryMessageSchema]);
|
|
20974
|
-
var availableSessionHistoryObjectSchema = external_exports.
|
|
20975
|
-
streamPosition: external_exports.
|
|
20931
|
+
var availableSessionHistoryObjectSchema = external_exports.object({
|
|
20932
|
+
streamPosition: external_exports.object({
|
|
20976
20933
|
commandId: identifierStringSchema,
|
|
20977
20934
|
epoch: identifierStringSchema,
|
|
20978
20935
|
sequence: external_exports.number().int().nonnegative()
|
|
@@ -20989,9 +20946,9 @@ var availableSessionHistoryObjectSchema = external_exports.strictObject({
|
|
|
20989
20946
|
).max(2e4).readonly().default([])
|
|
20990
20947
|
});
|
|
20991
20948
|
var availableSessionHistorySchema = availableSessionHistoryObjectSchema.readonly();
|
|
20992
|
-
var unavailableSessionHistoryObjectSchema = external_exports.
|
|
20949
|
+
var unavailableSessionHistoryObjectSchema = external_exports.object({
|
|
20993
20950
|
status: external_exports.literal("unavailable"),
|
|
20994
|
-
cause: external_exports.
|
|
20951
|
+
cause: external_exports.object({
|
|
20995
20952
|
code: external_exports.string().regex(/^[a-z][a-z0-9_]{0,127}$/),
|
|
20996
20953
|
message: external_exports.string().min(1).max(1e3)
|
|
20997
20954
|
}).readonly()
|
|
@@ -21024,7 +20981,7 @@ var envelope = {
|
|
|
21024
20981
|
requestId: identifierStringSchema,
|
|
21025
20982
|
sessionId: identifierStringSchema
|
|
21026
20983
|
};
|
|
21027
|
-
var activeTurnActivitySchema = external_exports.
|
|
20984
|
+
var activeTurnActivitySchema = external_exports.object({
|
|
21028
20985
|
activityId: external_exports.string().min(1).max(128),
|
|
21029
20986
|
activityType: external_exports.string().min(1).max(128),
|
|
21030
20987
|
content: external_exports.array(displayContentSchema).max(100).readonly(),
|
|
@@ -21037,13 +20994,13 @@ var activeTurnActivitySchema = external_exports.strictObject({
|
|
|
21037
20994
|
title: external_exports.string().max(500),
|
|
21038
20995
|
toolKind: external_exports.string().max(64)
|
|
21039
20996
|
}).readonly();
|
|
21040
|
-
var activeTurnUserMessageSchema = external_exports.
|
|
20997
|
+
var activeTurnUserMessageSchema = external_exports.object({
|
|
21041
20998
|
id: identifierStringSchema,
|
|
21042
20999
|
images: external_exports.array(promptImageSchema).max(8).readonly().optional(),
|
|
21043
21000
|
role: external_exports.literal("user"),
|
|
21044
21001
|
text: external_exports.string().max(SESSION_HISTORY_CHARACTER_LIMIT)
|
|
21045
21002
|
}).readonly();
|
|
21046
|
-
var activeTurnAssistantMessageSchema = external_exports.
|
|
21003
|
+
var activeTurnAssistantMessageSchema = external_exports.object({
|
|
21047
21004
|
activities: external_exports.array(activeTurnActivitySchema).max(100).readonly().default([]),
|
|
21048
21005
|
content: external_exports.array(displayContentSchema).max(100).readonly().default([]),
|
|
21049
21006
|
id: identifierStringSchema,
|
|
@@ -21054,7 +21011,7 @@ var activeTurnMessageSchema = external_exports.discriminatedUnion("role", [
|
|
|
21054
21011
|
activeTurnUserMessageSchema,
|
|
21055
21012
|
activeTurnAssistantMessageSchema
|
|
21056
21013
|
]);
|
|
21057
|
-
var activeTurnSnapshotSchema = external_exports.
|
|
21014
|
+
var activeTurnSnapshotSchema = external_exports.object({
|
|
21058
21015
|
commandId: identifierStringSchema,
|
|
21059
21016
|
epoch: identifierStringSchema,
|
|
21060
21017
|
hasOlder: external_exports.boolean(),
|
|
@@ -21079,64 +21036,64 @@ var identity = {
|
|
|
21079
21036
|
directoryId
|
|
21080
21037
|
};
|
|
21081
21038
|
var nativeSessionRequestSchema = external_exports.discriminatedUnion("action", [
|
|
21082
|
-
external_exports.
|
|
21083
|
-
external_exports.
|
|
21084
|
-
external_exports.
|
|
21085
|
-
external_exports.
|
|
21086
|
-
external_exports.
|
|
21087
|
-
external_exports.
|
|
21039
|
+
external_exports.object({ ...identity, action: external_exports.literal("create") }).readonly(),
|
|
21040
|
+
external_exports.object({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifierStringSchema }).readonly(),
|
|
21041
|
+
external_exports.object({ ...identity, action: external_exports.literal("preview"), entryId: identifierStringSchema }).readonly(),
|
|
21042
|
+
external_exports.object({ ...identity, action: external_exports.literal("history"), entryId: identifierStringSchema }).readonly(),
|
|
21043
|
+
external_exports.object({ ...identity, action: external_exports.literal("find"), nativeSessionId: identifierStringSchema }).readonly(),
|
|
21044
|
+
external_exports.object({
|
|
21088
21045
|
...identity,
|
|
21089
21046
|
action: external_exports.literal("list"),
|
|
21090
21047
|
cursor: identifierStringSchema.nullable()
|
|
21091
21048
|
}).readonly(),
|
|
21092
|
-
external_exports.
|
|
21049
|
+
external_exports.object({
|
|
21093
21050
|
...identity,
|
|
21094
21051
|
action: external_exports.enum(["import", "fork"]),
|
|
21095
21052
|
entryId: identifierStringSchema,
|
|
21096
21053
|
targetSessionId: identifierStringSchema
|
|
21097
21054
|
}).readonly(),
|
|
21098
|
-
external_exports.
|
|
21055
|
+
external_exports.object({
|
|
21099
21056
|
...identity,
|
|
21100
21057
|
action: external_exports.literal("fork-recorded"),
|
|
21101
21058
|
targetSessionId: identifierStringSchema,
|
|
21102
21059
|
throughCommandId: identifierStringSchema
|
|
21103
21060
|
}).readonly(),
|
|
21104
|
-
external_exports.
|
|
21061
|
+
external_exports.object({
|
|
21105
21062
|
...identity,
|
|
21106
21063
|
action: external_exports.literal("delete"),
|
|
21107
21064
|
entryId: identifierStringSchema
|
|
21108
21065
|
}).readonly()
|
|
21109
21066
|
]);
|
|
21110
21067
|
var nativeSessionCommandSchema = external_exports.discriminatedUnion("action", [
|
|
21111
|
-
external_exports.
|
|
21112
|
-
external_exports.
|
|
21113
|
-
external_exports.
|
|
21114
|
-
external_exports.
|
|
21115
|
-
external_exports.
|
|
21116
|
-
external_exports.
|
|
21068
|
+
external_exports.object({ ...identity, action: external_exports.literal("create") }).readonly(),
|
|
21069
|
+
external_exports.object({ ...identity, action: external_exports.literal("active-turn"), targetSessionId: identifierStringSchema }).readonly(),
|
|
21070
|
+
external_exports.object({ ...identity, action: external_exports.literal("preview"), entryId: identifierStringSchema }).readonly(),
|
|
21071
|
+
external_exports.object({ ...identity, action: external_exports.literal("history"), entryId: identifierStringSchema }).readonly(),
|
|
21072
|
+
external_exports.object({ ...identity, action: external_exports.literal("find"), nativeSessionId: identifierStringSchema }).readonly(),
|
|
21073
|
+
external_exports.object({
|
|
21117
21074
|
...identity,
|
|
21118
21075
|
action: external_exports.literal("list"),
|
|
21119
21076
|
cursor: identifierStringSchema.nullable()
|
|
21120
21077
|
}).readonly(),
|
|
21121
|
-
external_exports.
|
|
21078
|
+
external_exports.object({
|
|
21122
21079
|
...identity,
|
|
21123
21080
|
action: external_exports.enum(["import", "fork"]),
|
|
21124
21081
|
entryId: identifierStringSchema,
|
|
21125
21082
|
targetSessionId: identifierStringSchema
|
|
21126
21083
|
}).readonly(),
|
|
21127
|
-
external_exports.
|
|
21084
|
+
external_exports.object({
|
|
21128
21085
|
...identity,
|
|
21129
21086
|
action: external_exports.literal("fork-recorded"),
|
|
21130
21087
|
targetSessionId: identifierStringSchema,
|
|
21131
21088
|
throughCommandId: identifierStringSchema
|
|
21132
21089
|
}).readonly(),
|
|
21133
|
-
external_exports.
|
|
21090
|
+
external_exports.object({
|
|
21134
21091
|
...identity,
|
|
21135
21092
|
action: external_exports.literal("delete"),
|
|
21136
21093
|
entryId: identifierStringSchema
|
|
21137
21094
|
}).readonly()
|
|
21138
21095
|
]);
|
|
21139
|
-
var nativeSessionEntrySchema = external_exports.
|
|
21096
|
+
var nativeSessionEntrySchema = external_exports.object({
|
|
21140
21097
|
entryId: identifierStringSchema,
|
|
21141
21098
|
mobiusSessionIds: external_exports.array(identifierStringSchema).max(500).readonly(),
|
|
21142
21099
|
nativeSessionId: identifierStringSchema,
|
|
@@ -21144,20 +21101,20 @@ var nativeSessionEntrySchema = external_exports.strictObject({
|
|
|
21144
21101
|
directoryId,
|
|
21145
21102
|
directoryLabel: external_exports.string().min(1).max(2048),
|
|
21146
21103
|
updatedAt: external_exports.iso.datetime({ offset: true }).nullable(),
|
|
21147
|
-
additionalDirectories: external_exports.array(external_exports.
|
|
21104
|
+
additionalDirectories: external_exports.array(external_exports.object({ directoryId, name: external_exports.string().min(1).max(255) }).readonly()).max(16).readonly()
|
|
21148
21105
|
}).readonly();
|
|
21149
21106
|
var resultEnvelope = {
|
|
21150
21107
|
...envelope,
|
|
21151
21108
|
kind: external_exports.literal(NATIVE_SESSION_RESULT_KIND)
|
|
21152
21109
|
};
|
|
21153
21110
|
var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
|
|
21154
|
-
external_exports.
|
|
21155
|
-
external_exports.
|
|
21111
|
+
external_exports.object({ ...resultEnvelope, action: external_exports.literal("create"), nativeSessionId: identifierStringSchema }).readonly(),
|
|
21112
|
+
external_exports.object({
|
|
21156
21113
|
...resultEnvelope,
|
|
21157
21114
|
action: external_exports.literal("active-turn"),
|
|
21158
21115
|
targetSessionId: identifierStringSchema,
|
|
21159
21116
|
queued: external_exports.array(
|
|
21160
|
-
external_exports.
|
|
21117
|
+
external_exports.object({
|
|
21161
21118
|
commandId: identifierStringSchema,
|
|
21162
21119
|
prompt: external_exports.string().max(1e5),
|
|
21163
21120
|
images: external_exports.array(promptImageSchema).max(8).readonly()
|
|
@@ -21165,26 +21122,26 @@ var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
|
|
|
21165
21122
|
).readonly(),
|
|
21166
21123
|
turn: activeTurnSnapshotSchema.nullable()
|
|
21167
21124
|
}).readonly(),
|
|
21168
|
-
external_exports.
|
|
21125
|
+
external_exports.object({
|
|
21169
21126
|
...resultEnvelope,
|
|
21170
21127
|
action: external_exports.literal("find"),
|
|
21171
21128
|
entry: nativeSessionEntrySchema
|
|
21172
21129
|
}).readonly(),
|
|
21173
|
-
external_exports.
|
|
21130
|
+
external_exports.object({
|
|
21174
21131
|
...resultEnvelope,
|
|
21175
21132
|
action: external_exports.literal("list"),
|
|
21176
21133
|
capabilities: sessionCapabilitiesSchema,
|
|
21177
21134
|
entries: external_exports.array(nativeSessionEntrySchema).max(500).readonly(),
|
|
21178
21135
|
nextCursor: identifierStringSchema.nullable()
|
|
21179
21136
|
}).readonly(),
|
|
21180
|
-
external_exports.
|
|
21137
|
+
external_exports.object({
|
|
21181
21138
|
...resultEnvelope,
|
|
21182
21139
|
action: external_exports.enum(["import", "fork", "fork-recorded"]),
|
|
21183
21140
|
targetSessionId: identifierStringSchema,
|
|
21184
21141
|
ready: sessionReadyEventSchema,
|
|
21185
21142
|
title: external_exports.string().max(500)
|
|
21186
21143
|
}).readonly(),
|
|
21187
|
-
external_exports.
|
|
21144
|
+
external_exports.object({
|
|
21188
21145
|
...resultEnvelope,
|
|
21189
21146
|
action: external_exports.literal("preview"),
|
|
21190
21147
|
entryId: identifierStringSchema,
|
|
@@ -21193,21 +21150,21 @@ var nativeSessionResultSchema = external_exports.discriminatedUnion("action", [
|
|
|
21193
21150
|
history: sessionHistorySchema,
|
|
21194
21151
|
title: external_exports.string().max(500)
|
|
21195
21152
|
}).readonly(),
|
|
21196
|
-
external_exports.
|
|
21153
|
+
external_exports.object({
|
|
21197
21154
|
...resultEnvelope,
|
|
21198
21155
|
action: external_exports.literal("history"),
|
|
21199
21156
|
entryId: identifierStringSchema,
|
|
21200
21157
|
history: sessionHistorySchema,
|
|
21201
21158
|
title: external_exports.string().max(500)
|
|
21202
21159
|
}).readonly(),
|
|
21203
|
-
external_exports.
|
|
21160
|
+
external_exports.object({
|
|
21204
21161
|
...resultEnvelope,
|
|
21205
21162
|
action: external_exports.literal("delete"),
|
|
21206
21163
|
entryId: identifierStringSchema,
|
|
21207
21164
|
deletedSessionIds: external_exports.array(identifierStringSchema).max(500).readonly()
|
|
21208
21165
|
}).readonly()
|
|
21209
21166
|
]);
|
|
21210
|
-
var nativeSessionCancelSchema = external_exports.
|
|
21167
|
+
var nativeSessionCancelSchema = external_exports.object({ ...envelope, kind: external_exports.literal(NATIVE_SESSION_CANCEL_KIND) }).readonly();
|
|
21211
21168
|
function decode4(schema, encoded) {
|
|
21212
21169
|
try {
|
|
21213
21170
|
const value = JSON.parse(encoded);
|
|
@@ -21232,6 +21189,7 @@ var MAX_JSON_KEYS = 1e3;
|
|
|
21232
21189
|
var SESSION_EVENT_V2_KIND = "session.event.v2";
|
|
21233
21190
|
var boundedString = external_exports.string().max(MAX_CONTENT_LENGTH);
|
|
21234
21191
|
var shortString = external_exports.string().max(2048);
|
|
21192
|
+
var externalContentKeySchema = external_exports.string().regex(/^[a-f0-9]{64}$/u);
|
|
21235
21193
|
function boundedJsonIssue(value, depth = 0) {
|
|
21236
21194
|
if (depth > MAX_JSON_DEPTH) {
|
|
21237
21195
|
return "JSON nesting exceeds the maximum depth";
|
|
@@ -21283,23 +21241,47 @@ var boundedJsonSchema = external_exports.unknown().superRefine((value, context)
|
|
|
21283
21241
|
});
|
|
21284
21242
|
var metadataSchema = external_exports.record(external_exports.string().max(255), boundedJsonSchema).readonly();
|
|
21285
21243
|
var optionalMetadata = metadataSchema.nullable().optional();
|
|
21286
|
-
var annotationsSchema = external_exports.
|
|
21244
|
+
var annotationsSchema = external_exports.object({
|
|
21287
21245
|
_meta: optionalMetadata,
|
|
21288
21246
|
audience: external_exports.array(external_exports.enum(["assistant", "user"])).max(2).readonly().nullable().optional(),
|
|
21289
21247
|
lastModified: shortString.nullable().optional(),
|
|
21290
21248
|
priority: external_exports.number().finite().nullable().optional()
|
|
21291
21249
|
}).readonly();
|
|
21292
21250
|
var contentFields = { _meta: optionalMetadata, annotations: annotationsSchema.nullable().optional() };
|
|
21293
|
-
var textContentSchema = external_exports.
|
|
21294
|
-
var imageContentSchema = external_exports.
|
|
21251
|
+
var textContentSchema = external_exports.object({ ...contentFields, text: boundedString, type: external_exports.literal("text") }).readonly();
|
|
21252
|
+
var imageContentSchema = external_exports.object({
|
|
21295
21253
|
...contentFields,
|
|
21296
21254
|
data: boundedString,
|
|
21297
21255
|
mimeType: shortString,
|
|
21298
21256
|
type: external_exports.literal("image"),
|
|
21299
21257
|
uri: boundedString.nullable().optional()
|
|
21300
21258
|
}).readonly();
|
|
21301
|
-
var audioContentSchema = external_exports.
|
|
21302
|
-
var
|
|
21259
|
+
var audioContentSchema = external_exports.object({ ...contentFields, data: boundedString, mimeType: shortString, type: external_exports.literal("audio") }).readonly();
|
|
21260
|
+
var externalImageContentSchema = external_exports.strictObject({
|
|
21261
|
+
...contentFields,
|
|
21262
|
+
byteLength: external_exports.number().int().positive().safe(),
|
|
21263
|
+
imageKey: externalContentKeySchema,
|
|
21264
|
+
mimeType: shortString,
|
|
21265
|
+
type: external_exports.literal("external_image"),
|
|
21266
|
+
uri: boundedString.nullable().optional()
|
|
21267
|
+
}).readonly();
|
|
21268
|
+
var externalAudioContentSchema = external_exports.strictObject({
|
|
21269
|
+
...contentFields,
|
|
21270
|
+
audioKey: externalContentKeySchema,
|
|
21271
|
+
byteLength: external_exports.number().int().positive().safe(),
|
|
21272
|
+
mimeType: shortString,
|
|
21273
|
+
type: external_exports.literal("external_audio")
|
|
21274
|
+
}).readonly();
|
|
21275
|
+
var externalResourceContentSchema = external_exports.strictObject({
|
|
21276
|
+
...contentFields,
|
|
21277
|
+
byteLength: external_exports.number().int().positive().safe(),
|
|
21278
|
+
encoding: external_exports.enum(["binary", "text"]),
|
|
21279
|
+
mimeType: shortString.nullable().optional(),
|
|
21280
|
+
resourceKey: externalContentKeySchema,
|
|
21281
|
+
type: external_exports.literal("external_resource"),
|
|
21282
|
+
uri: boundedString
|
|
21283
|
+
}).readonly();
|
|
21284
|
+
var resourceLinkSchema = external_exports.object({
|
|
21303
21285
|
...contentFields,
|
|
21304
21286
|
description: boundedString.nullable().optional(),
|
|
21305
21287
|
mimeType: shortString.nullable().optional(),
|
|
@@ -21309,19 +21291,19 @@ var resourceLinkSchema = external_exports.strictObject({
|
|
|
21309
21291
|
type: external_exports.literal("resource_link"),
|
|
21310
21292
|
uri: boundedString
|
|
21311
21293
|
}).readonly();
|
|
21312
|
-
var textResourceSchema = external_exports.
|
|
21294
|
+
var textResourceSchema = external_exports.object({
|
|
21313
21295
|
_meta: optionalMetadata,
|
|
21314
21296
|
mimeType: shortString.nullable().optional(),
|
|
21315
21297
|
text: boundedString,
|
|
21316
21298
|
uri: boundedString
|
|
21317
21299
|
}).readonly();
|
|
21318
|
-
var blobResourceSchema = external_exports.
|
|
21300
|
+
var blobResourceSchema = external_exports.object({
|
|
21319
21301
|
_meta: optionalMetadata,
|
|
21320
21302
|
blob: boundedString,
|
|
21321
21303
|
mimeType: shortString.nullable().optional(),
|
|
21322
21304
|
uri: boundedString
|
|
21323
21305
|
}).readonly();
|
|
21324
|
-
var embeddedResourceSchema = external_exports.
|
|
21306
|
+
var embeddedResourceSchema = external_exports.object({
|
|
21325
21307
|
...contentFields,
|
|
21326
21308
|
resource: external_exports.union([textResourceSchema, blobResourceSchema]),
|
|
21327
21309
|
type: external_exports.literal("resource")
|
|
@@ -21331,20 +21313,23 @@ var contentBlockV2Schema = external_exports.discriminatedUnion("type", [
|
|
|
21331
21313
|
imageContentSchema,
|
|
21332
21314
|
audioContentSchema,
|
|
21333
21315
|
resourceLinkSchema,
|
|
21334
|
-
embeddedResourceSchema
|
|
21316
|
+
embeddedResourceSchema,
|
|
21317
|
+
externalImageContentSchema,
|
|
21318
|
+
externalAudioContentSchema,
|
|
21319
|
+
externalResourceContentSchema
|
|
21335
21320
|
]);
|
|
21336
21321
|
var toolCallContentSchema = external_exports.discriminatedUnion("type", [
|
|
21337
|
-
external_exports.
|
|
21338
|
-
external_exports.
|
|
21322
|
+
external_exports.object({ _meta: optionalMetadata, content: contentBlockV2Schema, type: external_exports.literal("content") }).readonly(),
|
|
21323
|
+
external_exports.object({
|
|
21339
21324
|
_meta: optionalMetadata,
|
|
21340
21325
|
newText: boundedString,
|
|
21341
21326
|
oldText: boundedString.nullable().optional(),
|
|
21342
21327
|
path: boundedString,
|
|
21343
21328
|
type: external_exports.literal("diff")
|
|
21344
21329
|
}).readonly(),
|
|
21345
|
-
external_exports.
|
|
21330
|
+
external_exports.object({ _meta: optionalMetadata, terminalId: shortString, type: external_exports.literal("terminal") }).readonly()
|
|
21346
21331
|
]);
|
|
21347
|
-
var toolCallLocationSchema = external_exports.
|
|
21332
|
+
var toolCallLocationSchema = external_exports.object({
|
|
21348
21333
|
_meta: optionalMetadata,
|
|
21349
21334
|
line: external_exports.number().int().nonnegative().safe().nullable().optional(),
|
|
21350
21335
|
path: boundedString
|
|
@@ -21373,40 +21358,40 @@ var toolPatchFields = {
|
|
|
21373
21358
|
status: toolStatusSchema.nullable().optional(),
|
|
21374
21359
|
title: boundedString.nullable().optional()
|
|
21375
21360
|
};
|
|
21376
|
-
var planEntrySchema = external_exports.
|
|
21361
|
+
var planEntrySchema = external_exports.object({
|
|
21377
21362
|
_meta: optionalMetadata,
|
|
21378
21363
|
content: boundedString,
|
|
21379
21364
|
priority: external_exports.enum(["high", "medium", "low"]),
|
|
21380
21365
|
status: external_exports.enum(["pending", "in_progress", "completed"])
|
|
21381
21366
|
}).readonly();
|
|
21382
21367
|
var planContentSchema = external_exports.discriminatedUnion("type", [
|
|
21383
|
-
external_exports.
|
|
21368
|
+
external_exports.object({
|
|
21384
21369
|
_meta: optionalMetadata,
|
|
21385
21370
|
entries: external_exports.array(planEntrySchema).max(MAX_COLLECTION_SIZE).readonly(),
|
|
21386
21371
|
planId: shortString,
|
|
21387
21372
|
type: external_exports.literal("items")
|
|
21388
21373
|
}).readonly(),
|
|
21389
|
-
external_exports.
|
|
21390
|
-
external_exports.
|
|
21374
|
+
external_exports.object({ _meta: optionalMetadata, planId: shortString, type: external_exports.literal("file"), uri: boundedString }).readonly(),
|
|
21375
|
+
external_exports.object({
|
|
21391
21376
|
_meta: optionalMetadata,
|
|
21392
21377
|
content: boundedString,
|
|
21393
21378
|
planId: shortString,
|
|
21394
21379
|
type: external_exports.literal("markdown")
|
|
21395
21380
|
}).readonly()
|
|
21396
21381
|
]);
|
|
21397
|
-
var commandSchema = external_exports.
|
|
21382
|
+
var commandSchema = external_exports.object({
|
|
21398
21383
|
_meta: optionalMetadata,
|
|
21399
21384
|
description: boundedString,
|
|
21400
|
-
input: external_exports.
|
|
21385
|
+
input: external_exports.object({ _meta: optionalMetadata, hint: boundedString }).readonly().nullable().optional(),
|
|
21401
21386
|
name: shortString
|
|
21402
21387
|
}).readonly();
|
|
21403
|
-
var configSelectOptionSchema = external_exports.
|
|
21388
|
+
var configSelectOptionSchema = external_exports.object({
|
|
21404
21389
|
_meta: optionalMetadata,
|
|
21405
21390
|
description: boundedString.nullable().optional(),
|
|
21406
21391
|
name: shortString,
|
|
21407
21392
|
value: shortString
|
|
21408
21393
|
}).readonly();
|
|
21409
|
-
var configSelectGroupSchema = external_exports.
|
|
21394
|
+
var configSelectGroupSchema = external_exports.object({
|
|
21410
21395
|
_meta: optionalMetadata,
|
|
21411
21396
|
group: shortString,
|
|
21412
21397
|
name: shortString,
|
|
@@ -21420,7 +21405,7 @@ var configBaseFields = {
|
|
|
21420
21405
|
name: shortString
|
|
21421
21406
|
};
|
|
21422
21407
|
var sessionConfigOptionSchema2 = external_exports.discriminatedUnion("type", [
|
|
21423
|
-
external_exports.
|
|
21408
|
+
external_exports.object({
|
|
21424
21409
|
...configBaseFields,
|
|
21425
21410
|
currentValue: shortString,
|
|
21426
21411
|
options: external_exports.union([
|
|
@@ -21429,7 +21414,7 @@ var sessionConfigOptionSchema2 = external_exports.discriminatedUnion("type", [
|
|
|
21429
21414
|
]),
|
|
21430
21415
|
type: external_exports.literal("select")
|
|
21431
21416
|
}).readonly(),
|
|
21432
|
-
external_exports.
|
|
21417
|
+
external_exports.object({ ...configBaseFields, currentValue: external_exports.boolean(), type: external_exports.literal("boolean") }).readonly()
|
|
21433
21418
|
]);
|
|
21434
21419
|
var contentChunkFields = {
|
|
21435
21420
|
_meta: optionalMetadata,
|
|
@@ -21437,10 +21422,10 @@ var contentChunkFields = {
|
|
|
21437
21422
|
messageId: shortString.nullable().optional()
|
|
21438
21423
|
};
|
|
21439
21424
|
var acpSessionUpdateV2Schema = external_exports.discriminatedUnion("sessionUpdate", [
|
|
21440
|
-
external_exports.
|
|
21441
|
-
external_exports.
|
|
21442
|
-
external_exports.
|
|
21443
|
-
external_exports.
|
|
21425
|
+
external_exports.object({ ...contentChunkFields, sessionUpdate: external_exports.literal("user_message_chunk") }).readonly(),
|
|
21426
|
+
external_exports.object({ ...contentChunkFields, sessionUpdate: external_exports.literal("agent_message_chunk") }).readonly(),
|
|
21427
|
+
external_exports.object({ ...contentChunkFields, sessionUpdate: external_exports.literal("agent_thought_chunk") }).readonly(),
|
|
21428
|
+
external_exports.object({
|
|
21444
21429
|
_meta: optionalMetadata,
|
|
21445
21430
|
content: external_exports.array(toolCallContentSchema).max(MAX_COLLECTION_SIZE).readonly().optional(),
|
|
21446
21431
|
kind: toolKindSchema.optional(),
|
|
@@ -21453,43 +21438,43 @@ var acpSessionUpdateV2Schema = external_exports.discriminatedUnion("sessionUpdat
|
|
|
21453
21438
|
title: boundedString,
|
|
21454
21439
|
toolCallId: shortString
|
|
21455
21440
|
}).readonly(),
|
|
21456
|
-
external_exports.
|
|
21457
|
-
external_exports.
|
|
21441
|
+
external_exports.object({ ...toolPatchFields, sessionUpdate: external_exports.literal("tool_call_update"), toolCallId: shortString }).readonly(),
|
|
21442
|
+
external_exports.object({
|
|
21458
21443
|
_meta: optionalMetadata,
|
|
21459
21444
|
entries: external_exports.array(planEntrySchema).max(MAX_COLLECTION_SIZE).readonly(),
|
|
21460
21445
|
sessionUpdate: external_exports.literal("plan")
|
|
21461
21446
|
}).readonly(),
|
|
21462
|
-
external_exports.
|
|
21463
|
-
external_exports.
|
|
21464
|
-
external_exports.
|
|
21447
|
+
external_exports.object({ _meta: optionalMetadata, plan: planContentSchema, sessionUpdate: external_exports.literal("plan_update") }).readonly(),
|
|
21448
|
+
external_exports.object({ _meta: optionalMetadata, planId: shortString, sessionUpdate: external_exports.literal("plan_removed") }).readonly(),
|
|
21449
|
+
external_exports.object({
|
|
21465
21450
|
_meta: optionalMetadata,
|
|
21466
21451
|
availableCommands: external_exports.array(commandSchema).max(MAX_COLLECTION_SIZE).readonly(),
|
|
21467
21452
|
sessionUpdate: external_exports.literal("available_commands_update")
|
|
21468
21453
|
}).readonly(),
|
|
21469
|
-
external_exports.
|
|
21454
|
+
external_exports.object({
|
|
21470
21455
|
_meta: optionalMetadata,
|
|
21471
21456
|
currentModeId: shortString,
|
|
21472
21457
|
sessionUpdate: external_exports.literal("current_mode_update")
|
|
21473
21458
|
}).readonly(),
|
|
21474
|
-
external_exports.
|
|
21459
|
+
external_exports.object({
|
|
21475
21460
|
_meta: optionalMetadata,
|
|
21476
21461
|
configOptions: external_exports.array(sessionConfigOptionSchema2).max(MAX_COLLECTION_SIZE).readonly(),
|
|
21477
21462
|
sessionUpdate: external_exports.literal("config_option_update")
|
|
21478
21463
|
}).readonly(),
|
|
21479
|
-
external_exports.
|
|
21464
|
+
external_exports.object({
|
|
21480
21465
|
_meta: optionalMetadata,
|
|
21481
21466
|
sessionUpdate: external_exports.literal("session_info_update"),
|
|
21482
21467
|
title: boundedString.nullable().optional(),
|
|
21483
21468
|
updatedAt: shortString.nullable().optional()
|
|
21484
21469
|
}).readonly(),
|
|
21485
|
-
external_exports.
|
|
21470
|
+
external_exports.object({
|
|
21486
21471
|
_meta: optionalMetadata,
|
|
21487
|
-
cost: external_exports.
|
|
21472
|
+
cost: external_exports.object({ _meta: optionalMetadata, amount: external_exports.number().finite(), currency: external_exports.string().max(16) }).readonly().nullable().optional(),
|
|
21488
21473
|
sessionUpdate: external_exports.literal("usage_update"),
|
|
21489
21474
|
size: external_exports.number().int().nonnegative().safe(),
|
|
21490
21475
|
used: external_exports.number().int().nonnegative().safe()
|
|
21491
21476
|
}).readonly(),
|
|
21492
|
-
external_exports.
|
|
21477
|
+
external_exports.object({
|
|
21493
21478
|
_meta: optionalMetadata,
|
|
21494
21479
|
compactionId: shortString,
|
|
21495
21480
|
error: boundedString.nullable().optional(),
|
|
@@ -21497,7 +21482,7 @@ var acpSessionUpdateV2Schema = external_exports.discriminatedUnion("sessionUpdat
|
|
|
21497
21482
|
status: shortString,
|
|
21498
21483
|
summary: external_exports.array(contentBlockV2Schema).max(MAX_COLLECTION_SIZE).readonly().nullable().optional()
|
|
21499
21484
|
}).readonly(),
|
|
21500
|
-
external_exports.
|
|
21485
|
+
external_exports.object({
|
|
21501
21486
|
_meta: optionalMetadata,
|
|
21502
21487
|
compactionId: shortString,
|
|
21503
21488
|
content: contentBlockV2Schema,
|
|
@@ -21506,28 +21491,28 @@ var acpSessionUpdateV2Schema = external_exports.discriminatedUnion("sessionUpdat
|
|
|
21506
21491
|
]);
|
|
21507
21492
|
var lifecycleBase = { commandId: identifierStringSchema };
|
|
21508
21493
|
var lifecycleMetadataV2Schema = external_exports.discriminatedUnion("kind", [
|
|
21509
|
-
external_exports.
|
|
21510
|
-
external_exports.
|
|
21511
|
-
external_exports.
|
|
21512
|
-
external_exports.
|
|
21494
|
+
external_exports.object({ kind: external_exports.literal("session.queue.changed") }).readonly(),
|
|
21495
|
+
external_exports.object({ event: sessionPermissionRequestedEventSchema, kind: external_exports.literal("session.permission.requested") }).readonly(),
|
|
21496
|
+
external_exports.object({ event: sessionPermissionResolvedEventSchema, kind: external_exports.literal("session.permission.resolved") }).readonly(),
|
|
21497
|
+
external_exports.object({
|
|
21513
21498
|
event: sessionElicitationRequestedEventSchema,
|
|
21514
21499
|
kind: external_exports.literal("session.elicitation.requested")
|
|
21515
21500
|
}).readonly(),
|
|
21516
|
-
external_exports.
|
|
21517
|
-
external_exports.
|
|
21501
|
+
external_exports.object({ event: sessionElicitationResolvedEventSchema, kind: external_exports.literal("session.elicitation.resolved") }).readonly(),
|
|
21502
|
+
external_exports.object({
|
|
21518
21503
|
...lifecycleBase,
|
|
21519
21504
|
content: external_exports.array(contentBlockV2Schema).min(1).max(100).readonly(),
|
|
21520
21505
|
kind: external_exports.literal("prompt.requested")
|
|
21521
21506
|
}).readonly(),
|
|
21522
|
-
external_exports.
|
|
21523
|
-
external_exports.
|
|
21524
|
-
external_exports.
|
|
21507
|
+
external_exports.object({ ...lifecycleBase, attemptId: identifierStringSchema, epoch: identifierStringSchema, kind: external_exports.literal("prompt.started") }).readonly(),
|
|
21508
|
+
external_exports.object({ ...lifecycleBase, kind: external_exports.literal("prompt.completed"), stopReason: shortString }).readonly(),
|
|
21509
|
+
external_exports.object({
|
|
21525
21510
|
...lifecycleBase,
|
|
21526
21511
|
code: identifierStringSchema,
|
|
21527
21512
|
kind: external_exports.literal("prompt.failed-before-start"),
|
|
21528
21513
|
message: external_exports.string().min(1).max(500)
|
|
21529
21514
|
}).readonly(),
|
|
21530
|
-
external_exports.
|
|
21515
|
+
external_exports.object({
|
|
21531
21516
|
...lifecycleBase,
|
|
21532
21517
|
attemptId: identifierStringSchema,
|
|
21533
21518
|
code: identifierStringSchema,
|
|
@@ -21536,19 +21521,19 @@ var lifecycleMetadataV2Schema = external_exports.discriminatedUnion("kind", [
|
|
|
21536
21521
|
}).readonly()
|
|
21537
21522
|
]);
|
|
21538
21523
|
var sessionEventPayloadV2Schema = external_exports.discriminatedUnion("type", [
|
|
21539
|
-
external_exports.
|
|
21540
|
-
external_exports.
|
|
21524
|
+
external_exports.object({ payload: acpSessionUpdateV2Schema, type: external_exports.literal("acp") }).readonly(),
|
|
21525
|
+
external_exports.object({ payload: lifecycleMetadataV2Schema, type: external_exports.literal("lifecycle-metadata") }).readonly()
|
|
21541
21526
|
]);
|
|
21542
21527
|
var positionSchema = external_exports.string().regex(/^(0|[1-9][0-9]*)$/);
|
|
21543
21528
|
var provenanceSchema = external_exports.discriminatedUnion("kind", [
|
|
21544
|
-
external_exports.
|
|
21545
|
-
external_exports.
|
|
21529
|
+
external_exports.object({ kind: external_exports.literal("original") }).readonly(),
|
|
21530
|
+
external_exports.object({
|
|
21546
21531
|
kind: external_exports.literal("imported"),
|
|
21547
21532
|
sourceEventId: identifierStringSchema,
|
|
21548
21533
|
sourcePosition: positionSchema,
|
|
21549
21534
|
sourceSessionId: identifierStringSchema
|
|
21550
21535
|
}).readonly(),
|
|
21551
|
-
external_exports.
|
|
21536
|
+
external_exports.object({
|
|
21552
21537
|
kind: external_exports.literal("forked"),
|
|
21553
21538
|
sourceEventId: identifierStringSchema,
|
|
21554
21539
|
sourcePosition: positionSchema,
|
|
@@ -21563,15 +21548,15 @@ var sessionEventFieldsV2 = {
|
|
|
21563
21548
|
sessionId: identifierStringSchema
|
|
21564
21549
|
};
|
|
21565
21550
|
var sessionEventV2Schema = external_exports.discriminatedUnion("type", [
|
|
21566
|
-
external_exports.
|
|
21567
|
-
external_exports.
|
|
21551
|
+
external_exports.object({ ...sessionEventFieldsV2, payload: acpSessionUpdateV2Schema, type: external_exports.literal("acp") }).readonly(),
|
|
21552
|
+
external_exports.object({
|
|
21568
21553
|
...sessionEventFieldsV2,
|
|
21569
21554
|
payload: lifecycleMetadataV2Schema,
|
|
21570
21555
|
type: external_exports.literal("lifecycle-metadata")
|
|
21571
21556
|
}).readonly()
|
|
21572
21557
|
]);
|
|
21573
|
-
var sessionExportV2Schema = external_exports.
|
|
21574
|
-
binding: external_exports.
|
|
21558
|
+
var sessionExportV2Schema = external_exports.object({
|
|
21559
|
+
binding: external_exports.object({
|
|
21575
21560
|
bindingId: identifierStringSchema,
|
|
21576
21561
|
runtimeId: identifierStringSchema
|
|
21577
21562
|
}).readonly(),
|
|
@@ -21608,20 +21593,20 @@ var sessionExportV2Schema = external_exports.strictObject({
|
|
|
21608
21593
|
eventIds.add(event.eventId);
|
|
21609
21594
|
}
|
|
21610
21595
|
});
|
|
21611
|
-
var mobiusSessionExportV2Schema = external_exports.
|
|
21596
|
+
var mobiusSessionExportV2Schema = external_exports.object({
|
|
21612
21597
|
formatVersion: external_exports.literal("2"),
|
|
21613
21598
|
session: sessionExportV2Schema
|
|
21614
21599
|
}).readonly();
|
|
21615
|
-
var sessionEventEnvelopeV2Schema = external_exports.
|
|
21616
|
-
var sessionEventLogPageV2Schema = external_exports.
|
|
21600
|
+
var sessionEventEnvelopeV2Schema = external_exports.object({ event: sessionEventV2Schema, kind: external_exports.literal(SESSION_EVENT_V2_KIND) }).readonly();
|
|
21601
|
+
var sessionEventLogPageV2Schema = external_exports.object({
|
|
21617
21602
|
events: external_exports.array(sessionEventV2Schema).max(MAX_EVENT_COUNT).readonly(),
|
|
21618
21603
|
nextCursor: external_exports.string().min(1).max(512).nullable(),
|
|
21619
21604
|
tailCursor: external_exports.string().max(512),
|
|
21620
21605
|
truncated: external_exports.boolean(),
|
|
21621
21606
|
version: external_exports.literal(2)
|
|
21622
21607
|
}).readonly();
|
|
21623
|
-
var nativeEventPageRequestV2Schema = external_exports.
|
|
21624
|
-
var executingPromptRequestEventLogV2Schema = external_exports.
|
|
21608
|
+
var nativeEventPageRequestV2Schema = external_exports.object({ cursor: external_exports.string().min(1).max(512).nullable(), eventLimit: external_exports.number().int().min(1).max(1e4) }).readonly();
|
|
21609
|
+
var executingPromptRequestEventLogV2Schema = external_exports.object({
|
|
21625
21610
|
attemptId: identifierStringSchema,
|
|
21626
21611
|
commandId: identifierStringSchema,
|
|
21627
21612
|
epoch: identifierStringSchema,
|
|
@@ -21629,7 +21614,7 @@ var executingPromptRequestEventLogV2Schema = external_exports.strictObject({
|
|
|
21629
21614
|
tailCursor: external_exports.string().max(512),
|
|
21630
21615
|
truncated: external_exports.boolean()
|
|
21631
21616
|
}).readonly();
|
|
21632
|
-
var nativeSessionEventsV2Schema = external_exports.
|
|
21617
|
+
var nativeSessionEventsV2Schema = external_exports.object({
|
|
21633
21618
|
executingPromptRequest: executingPromptRequestEventLogV2Schema.nullable(),
|
|
21634
21619
|
history: sessionEventLogPageV2Schema
|
|
21635
21620
|
}).readonly();
|
|
@@ -21664,14 +21649,14 @@ var decodeAcpSessionUpdateV2 = (value) => decode5(value, acpSessionUpdateV2Schem
|
|
|
21664
21649
|
var SESSION_EVENT_KIND = "session.event";
|
|
21665
21650
|
var SESSION_FORKED_KIND = "session.forked";
|
|
21666
21651
|
var MAX_RECORDED_EVENT_LENGTH = 8 * 1024 * 1024;
|
|
21667
|
-
var sessionEventEnvelopeSchema = external_exports.
|
|
21652
|
+
var sessionEventEnvelopeSchema = external_exports.object({
|
|
21668
21653
|
kind: external_exports.literal(SESSION_EVENT_KIND),
|
|
21669
21654
|
payload: external_exports.string().min(2).max(MAX_RECORDED_EVENT_LENGTH),
|
|
21670
21655
|
sessionId: identifierStringSchema
|
|
21671
21656
|
}).readonly();
|
|
21672
21657
|
var SESSION_QUEUE_CHANGED_KIND = "session.queue.changed";
|
|
21673
|
-
var sessionQueueChangedSchema = external_exports.
|
|
21674
|
-
var sessionForkedSchema = external_exports.
|
|
21658
|
+
var sessionQueueChangedSchema = external_exports.object({ kind: external_exports.literal(SESSION_QUEUE_CHANGED_KIND), sessionId: identifierStringSchema }).readonly();
|
|
21659
|
+
var sessionForkedSchema = external_exports.object({
|
|
21675
21660
|
kind: external_exports.literal(SESSION_FORKED_KIND),
|
|
21676
21661
|
sessionId: identifierStringSchema,
|
|
21677
21662
|
sourceSessionId: identifierStringSchema,
|
|
@@ -21743,7 +21728,7 @@ function decodeRecordedSessionEvent(encoded) {
|
|
|
21743
21728
|
case SESSION_USAGE_UPDATED_KIND:
|
|
21744
21729
|
return decodeSessionUsageUpdatedEvent(encoded);
|
|
21745
21730
|
default:
|
|
21746
|
-
throw new
|
|
21731
|
+
throw new UnsupportedProtocolMessageKindError("daemon-to-service", kind);
|
|
21747
21732
|
}
|
|
21748
21733
|
}
|
|
21749
21734
|
var encodeRecordedSessionEvent = (event) => JSON.stringify(decodeRecordedSessionEvent(JSON.stringify(event)));
|
|
@@ -21756,7 +21741,7 @@ var SESSION_LIVE_HISTORY_PAGE_LOADED_KIND = "session.live-history.page.loaded";
|
|
|
21756
21741
|
var SESSION_LIVE_HISTORY_V2_PAGE_LOAD_KIND = "session.live-history.v2.page.load";
|
|
21757
21742
|
var SESSION_LIVE_HISTORY_V2_PAGE_LOADED_KIND = "session.live-history.v2.page.loaded";
|
|
21758
21743
|
var directoryIdentifier = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,2047}$/);
|
|
21759
|
-
var sessionLiveHistoryLoadSchema = external_exports.
|
|
21744
|
+
var sessionLiveHistoryLoadSchema = external_exports.object({
|
|
21760
21745
|
additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
|
|
21761
21746
|
agentId: identifierStringSchema,
|
|
21762
21747
|
bindingId: identifierStringSchema,
|
|
@@ -21765,13 +21750,13 @@ var sessionLiveHistoryLoadSchema = external_exports.strictObject({
|
|
|
21765
21750
|
requestId: identifierStringSchema,
|
|
21766
21751
|
sessionId: identifierStringSchema
|
|
21767
21752
|
}).readonly();
|
|
21768
|
-
var sessionLiveHistoryLoadedSchema = external_exports.
|
|
21753
|
+
var sessionLiveHistoryLoadedSchema = external_exports.object({
|
|
21769
21754
|
history: sessionHistorySchema,
|
|
21770
21755
|
kind: external_exports.literal(SESSION_LIVE_HISTORY_LOADED_KIND),
|
|
21771
21756
|
requestId: identifierStringSchema,
|
|
21772
21757
|
sessionId: identifierStringSchema
|
|
21773
21758
|
}).readonly();
|
|
21774
|
-
var sessionLiveHistoryPageLoadSchema = external_exports.
|
|
21759
|
+
var sessionLiveHistoryPageLoadSchema = external_exports.object({
|
|
21775
21760
|
additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
|
|
21776
21761
|
agentId: identifierStringSchema,
|
|
21777
21762
|
bindingId: identifierStringSchema,
|
|
@@ -21782,13 +21767,13 @@ var sessionLiveHistoryPageLoadSchema = external_exports.strictObject({
|
|
|
21782
21767
|
requestId: identifierStringSchema,
|
|
21783
21768
|
sessionId: identifierStringSchema
|
|
21784
21769
|
}).readonly();
|
|
21785
|
-
var sessionLiveHistoryPageLoadedSchema = external_exports.
|
|
21770
|
+
var sessionLiveHistoryPageLoadedSchema = external_exports.object({
|
|
21786
21771
|
kind: external_exports.literal(SESSION_LIVE_HISTORY_PAGE_LOADED_KIND),
|
|
21787
21772
|
page: nativeMessagePageSchema,
|
|
21788
21773
|
requestId: identifierStringSchema,
|
|
21789
21774
|
sessionId: identifierStringSchema
|
|
21790
21775
|
}).readonly();
|
|
21791
|
-
var sessionLiveHistoryV2PageLoadSchema = external_exports.
|
|
21776
|
+
var sessionLiveHistoryV2PageLoadSchema = external_exports.object({
|
|
21792
21777
|
additionalDirectoryIds: external_exports.array(directoryIdentifier).max(16).readonly(),
|
|
21793
21778
|
agentId: identifierStringSchema,
|
|
21794
21779
|
bindingId: identifierStringSchema,
|
|
@@ -21799,7 +21784,7 @@ var sessionLiveHistoryV2PageLoadSchema = external_exports.strictObject({
|
|
|
21799
21784
|
requestId: identifierStringSchema,
|
|
21800
21785
|
sessionId: identifierStringSchema
|
|
21801
21786
|
}).readonly();
|
|
21802
|
-
var sessionLiveHistoryV2PageLoadedSchema = external_exports.
|
|
21787
|
+
var sessionLiveHistoryV2PageLoadedSchema = external_exports.object({
|
|
21803
21788
|
events: nativeSessionEventsV2Schema,
|
|
21804
21789
|
kind: external_exports.literal(SESSION_LIVE_HISTORY_V2_PAGE_LOADED_KIND),
|
|
21805
21790
|
requestId: identifierStringSchema,
|
|
@@ -21945,7 +21930,7 @@ function decodeServiceToDaemonMessage(encoded) {
|
|
|
21945
21930
|
const kind = decodeMessageKind(encoded);
|
|
21946
21931
|
const signature = serviceToDaemonRegistry[kind];
|
|
21947
21932
|
if (signature === void 0) {
|
|
21948
|
-
throw new
|
|
21933
|
+
throw new UnsupportedProtocolMessageKindError("service-to-daemon", kind);
|
|
21949
21934
|
}
|
|
21950
21935
|
return signature.decoder(encoded);
|
|
21951
21936
|
}
|
|
@@ -27226,8 +27211,8 @@ function createDaemonConfig(connection, agents = [], installableAgents = [], loc
|
|
|
27226
27211
|
}
|
|
27227
27212
|
|
|
27228
27213
|
// src/run-daemon.ts
|
|
27229
|
-
import { createHash as
|
|
27230
|
-
import { join as
|
|
27214
|
+
import { createHash as createHash7, randomUUID as randomUUID7 } from "node:crypto";
|
|
27215
|
+
import { join as join18 } from "node:path";
|
|
27231
27216
|
import { styleText } from "node:util";
|
|
27232
27217
|
|
|
27233
27218
|
// src/acp/active-executions.ts
|
|
@@ -30599,7 +30584,7 @@ function sql(strings, ...params) {
|
|
|
30599
30584
|
return new SQL([new StringChunk(str)]);
|
|
30600
30585
|
}
|
|
30601
30586
|
sql2.raw = raw;
|
|
30602
|
-
function
|
|
30587
|
+
function join20(chunks, separator) {
|
|
30603
30588
|
const result = [];
|
|
30604
30589
|
for (const [i, chunk] of chunks.entries()) {
|
|
30605
30590
|
if (i > 0 && separator !== void 0) {
|
|
@@ -30609,7 +30594,7 @@ function sql(strings, ...params) {
|
|
|
30609
30594
|
}
|
|
30610
30595
|
return new SQL(result);
|
|
30611
30596
|
}
|
|
30612
|
-
sql2.join =
|
|
30597
|
+
sql2.join = join20;
|
|
30613
30598
|
function identifier(value) {
|
|
30614
30599
|
return new Name(value);
|
|
30615
30600
|
}
|
|
@@ -33153,7 +33138,7 @@ var SQLiteSelectQueryBuilderBase = class extends TypedQueryBuilder {
|
|
|
33153
33138
|
const baseTableName = this.tableName;
|
|
33154
33139
|
const tableName = getTableLikeName(table);
|
|
33155
33140
|
for (const item of extractUsedTable(table)) this.usedTables.add(item);
|
|
33156
|
-
if (typeof tableName === "string" && this.config.joins?.some((
|
|
33141
|
+
if (typeof tableName === "string" && this.config.joins?.some((join20) => join20.alias === tableName)) {
|
|
33157
33142
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
|
33158
33143
|
}
|
|
33159
33144
|
if (!this.isPartialSelect) {
|
|
@@ -34012,7 +33997,7 @@ var SQLiteUpdateBase = class extends QueryPromise {
|
|
|
34012
33997
|
createJoin(joinType) {
|
|
34013
33998
|
return (table, on) => {
|
|
34014
33999
|
const tableName = getTableLikeName(table);
|
|
34015
|
-
if (typeof tableName === "string" && this.config.joins.some((
|
|
34000
|
+
if (typeof tableName === "string" && this.config.joins.some((join20) => join20.alias === tableName)) {
|
|
34016
34001
|
throw new Error(`Alias "${tableName}" is already used in this query`);
|
|
34017
34002
|
}
|
|
34018
34003
|
if (typeof on === "function") {
|
|
@@ -35335,6 +35320,7 @@ function recordsEqual(left, right) {
|
|
|
35335
35320
|
}
|
|
35336
35321
|
var AgentSession = class _AgentSession {
|
|
35337
35322
|
#connection;
|
|
35323
|
+
#contentExternalizer;
|
|
35338
35324
|
#interactions;
|
|
35339
35325
|
#additionalDirectories;
|
|
35340
35326
|
#agentId;
|
|
@@ -35362,7 +35348,7 @@ var AgentSession = class _AgentSession {
|
|
|
35362
35348
|
#sessionTitle = null;
|
|
35363
35349
|
#sessionUpdatedAt = "";
|
|
35364
35350
|
#turn = new IdleAcpTurn();
|
|
35365
|
-
constructor(agent, cwd, additionalDirectories, mobiusSessionId, getObserver, store, metrics) {
|
|
35351
|
+
constructor(agent, cwd, additionalDirectories, mobiusSessionId, getObserver, store, metrics, contentExternalizer) {
|
|
35366
35352
|
this.#updates = new AgentUpdateStream((notification) => this.#processUpdate(notification));
|
|
35367
35353
|
this.#additionalDirectories = [...additionalDirectories];
|
|
35368
35354
|
this.#agentId = agent.id;
|
|
@@ -35382,8 +35368,9 @@ var AgentSession = class _AgentSession {
|
|
|
35382
35368
|
observer: getObserver
|
|
35383
35369
|
});
|
|
35384
35370
|
this.#connection = new AgentConnection(agent, cwd, this);
|
|
35371
|
+
this.#contentExternalizer = contentExternalizer;
|
|
35385
35372
|
}
|
|
35386
|
-
static async #start(options, getObserver, store, initialize, metrics) {
|
|
35373
|
+
static async #start(options, getObserver, store, initialize, metrics, contentExternalizer) {
|
|
35387
35374
|
for (let attempt = 1; attempt <= 2; attempt += 1) {
|
|
35388
35375
|
options.signal.throwIfAborted();
|
|
35389
35376
|
const unchanged = await metrics.measure(
|
|
@@ -35411,7 +35398,8 @@ var AgentSession = class _AgentSession {
|
|
|
35411
35398
|
options.sessionId,
|
|
35412
35399
|
getObserver,
|
|
35413
35400
|
store,
|
|
35414
|
-
metrics
|
|
35401
|
+
metrics,
|
|
35402
|
+
contentExternalizer
|
|
35415
35403
|
)
|
|
35416
35404
|
);
|
|
35417
35405
|
try {
|
|
@@ -35434,19 +35422,21 @@ var AgentSession = class _AgentSession {
|
|
|
35434
35422
|
}
|
|
35435
35423
|
throw new AcpExecutionError("ACP agent initialization failed");
|
|
35436
35424
|
}
|
|
35437
|
-
static start = async (options, getObserver, store, metrics
|
|
35425
|
+
static start = async (options, getObserver, store, metrics, contentExternalizer) => await _AgentSession.#start(
|
|
35438
35426
|
options,
|
|
35439
35427
|
getObserver,
|
|
35440
35428
|
store,
|
|
35441
35429
|
async (runtime) => await runtime.initialize(options.signal, options.origin),
|
|
35442
|
-
metrics
|
|
35430
|
+
metrics,
|
|
35431
|
+
contentExternalizer
|
|
35443
35432
|
);
|
|
35444
|
-
static startNativeSessionBrowser = async (options, getObserver, store) => await _AgentSession.#start(
|
|
35433
|
+
static startNativeSessionBrowser = async (options, getObserver, store, contentExternalizer) => await _AgentSession.#start(
|
|
35445
35434
|
options,
|
|
35446
35435
|
getObserver,
|
|
35447
35436
|
store,
|
|
35448
35437
|
async (runtime) => await runtime.#initializeAgent(options.signal),
|
|
35449
|
-
unmeasuredOperationMetrics
|
|
35438
|
+
unmeasuredOperationMetrics,
|
|
35439
|
+
contentExternalizer
|
|
35450
35440
|
);
|
|
35451
35441
|
belongsTo = (agentId, cwd, additionalDirectories) => this.#agentId === agentId && this.#cwd === cwd && arraysEqual(this.#additionalDirectories, additionalDirectories);
|
|
35452
35442
|
usesEnvironment = (environment) => recordsEqual(this.#environment, environment);
|
|
@@ -36151,7 +36141,12 @@ var AgentSession = class _AgentSession {
|
|
|
36151
36141
|
#processUpdate = async (notification) => {
|
|
36152
36142
|
this.assertNativeSession(notification.sessionId);
|
|
36153
36143
|
const update = notification.update;
|
|
36154
|
-
const
|
|
36144
|
+
const externalized = await this.#contentExternalizer.update(
|
|
36145
|
+
this.#mobiusSessionId,
|
|
36146
|
+
update,
|
|
36147
|
+
AbortSignal.timeout(3e4)
|
|
36148
|
+
);
|
|
36149
|
+
const rawUpdate = decodeAcpSessionUpdateV2(JSON.stringify(externalized));
|
|
36155
36150
|
if (this.#sessionLoad.kind === "capturing") {
|
|
36156
36151
|
await this.#sessionLoad.history.record(update, rawUpdate);
|
|
36157
36152
|
} else {
|
|
@@ -36438,8 +36433,10 @@ var AgentQueryProcesses = class {
|
|
|
36438
36433
|
#processes;
|
|
36439
36434
|
#observer = new NullAcpSessionObserver();
|
|
36440
36435
|
#store = new MemoryAcpSessionStore();
|
|
36441
|
-
|
|
36436
|
+
#contentExternalizer;
|
|
36437
|
+
constructor(processes, contentExternalizer) {
|
|
36442
36438
|
this.#processes = processes;
|
|
36439
|
+
this.#contentExternalizer = contentExternalizer;
|
|
36443
36440
|
this.#processesByQuery = new RetainedAgentProcesses({
|
|
36444
36441
|
touch: processes.touch,
|
|
36445
36442
|
changed: processes.notifyChanged
|
|
@@ -36455,7 +36452,12 @@ var AgentQueryProcesses = class {
|
|
|
36455
36452
|
async #startRetained(options) {
|
|
36456
36453
|
const runtime = await this.#processes.startRetained(
|
|
36457
36454
|
options.signal,
|
|
36458
|
-
() => AgentSession.startNativeSessionBrowser(
|
|
36455
|
+
() => AgentSession.startNativeSessionBrowser(
|
|
36456
|
+
options,
|
|
36457
|
+
() => this.#observer,
|
|
36458
|
+
this.#store,
|
|
36459
|
+
this.#contentExternalizer
|
|
36460
|
+
),
|
|
36459
36461
|
{
|
|
36460
36462
|
isBusy: () => this.#processesByQuery.isBusy(options.sessionId),
|
|
36461
36463
|
retire: (runtime2) => this.retire(options.sessionId, runtime2)
|
|
@@ -36531,7 +36533,8 @@ var AgentQueryProcesses = class {
|
|
|
36531
36533
|
async () => await AgentSession.startNativeSessionBrowser(
|
|
36532
36534
|
options,
|
|
36533
36535
|
() => this.#observer,
|
|
36534
|
-
new MemoryAcpSessionStore()
|
|
36536
|
+
new MemoryAcpSessionStore(),
|
|
36537
|
+
this.#contentExternalizer
|
|
36535
36538
|
),
|
|
36536
36539
|
async (runtime) => {
|
|
36537
36540
|
runtime.selectNativeSession(nativeSessionId);
|
|
@@ -36546,7 +36549,8 @@ var AgentQueryProcesses = class {
|
|
|
36546
36549
|
async () => await AgentSession.startNativeSessionBrowser(
|
|
36547
36550
|
options,
|
|
36548
36551
|
() => this.#observer,
|
|
36549
|
-
new MemoryAcpSessionStore()
|
|
36552
|
+
new MemoryAcpSessionStore(),
|
|
36553
|
+
this.#contentExternalizer
|
|
36550
36554
|
),
|
|
36551
36555
|
async (runtime) => {
|
|
36552
36556
|
runtime.selectNativeSession(nativeSessionId);
|
|
@@ -36562,6 +36566,220 @@ var AgentQueryProcesses = class {
|
|
|
36562
36566
|
};
|
|
36563
36567
|
};
|
|
36564
36568
|
|
|
36569
|
+
// src/external-content/acp-content-externalizer.ts
|
|
36570
|
+
var MAXIMUM_ENCODED_CONTENT_CHARACTERS = 4e6;
|
|
36571
|
+
function decodeBase64(data) {
|
|
36572
|
+
if (data.length > MAXIMUM_ENCODED_CONTENT_CHARACTERS || data.length % 4 !== 0 || !/^[A-Za-z0-9+/]*={0,2}$/u.test(data)) {
|
|
36573
|
+
throw new Error("The ACP embedded content is not valid bounded base64");
|
|
36574
|
+
}
|
|
36575
|
+
return Buffer.from(data, "base64");
|
|
36576
|
+
}
|
|
36577
|
+
var AcpContentExternalizer = class {
|
|
36578
|
+
#store;
|
|
36579
|
+
constructor(store) {
|
|
36580
|
+
this.#store = store;
|
|
36581
|
+
}
|
|
36582
|
+
async #content(sessionId, content, signal) {
|
|
36583
|
+
switch (content.type) {
|
|
36584
|
+
case "text":
|
|
36585
|
+
case "resource_link":
|
|
36586
|
+
return content;
|
|
36587
|
+
case "image": {
|
|
36588
|
+
if (content.data.length === 0) {
|
|
36589
|
+
return content;
|
|
36590
|
+
}
|
|
36591
|
+
const stored = await this.#store.put({
|
|
36592
|
+
bytes: decodeBase64(content.data),
|
|
36593
|
+
kind: "image",
|
|
36594
|
+
mediaType: content.mimeType,
|
|
36595
|
+
name: "image",
|
|
36596
|
+
sessionId,
|
|
36597
|
+
signal
|
|
36598
|
+
});
|
|
36599
|
+
return {
|
|
36600
|
+
_meta: content._meta,
|
|
36601
|
+
annotations: content.annotations,
|
|
36602
|
+
byteLength: stored.byteLength,
|
|
36603
|
+
imageKey: stored.key,
|
|
36604
|
+
mimeType: content.mimeType,
|
|
36605
|
+
type: "external_image",
|
|
36606
|
+
uri: content.uri
|
|
36607
|
+
};
|
|
36608
|
+
}
|
|
36609
|
+
case "audio": {
|
|
36610
|
+
if (content.data.length === 0) {
|
|
36611
|
+
return content;
|
|
36612
|
+
}
|
|
36613
|
+
const stored = await this.#store.put({
|
|
36614
|
+
bytes: decodeBase64(content.data),
|
|
36615
|
+
kind: "audio",
|
|
36616
|
+
mediaType: content.mimeType,
|
|
36617
|
+
name: "audio",
|
|
36618
|
+
sessionId,
|
|
36619
|
+
signal
|
|
36620
|
+
});
|
|
36621
|
+
return {
|
|
36622
|
+
_meta: content._meta,
|
|
36623
|
+
annotations: content.annotations,
|
|
36624
|
+
audioKey: stored.key,
|
|
36625
|
+
byteLength: stored.byteLength,
|
|
36626
|
+
mimeType: content.mimeType,
|
|
36627
|
+
type: "external_audio"
|
|
36628
|
+
};
|
|
36629
|
+
}
|
|
36630
|
+
case "resource": {
|
|
36631
|
+
const embedded = content.resource;
|
|
36632
|
+
const encoding = "text" in embedded ? "text" : "binary";
|
|
36633
|
+
const bytes = "text" in embedded ? Buffer.from(embedded.text, "utf8") : decodeBase64(embedded.blob);
|
|
36634
|
+
if (bytes.byteLength === 0) {
|
|
36635
|
+
return content;
|
|
36636
|
+
}
|
|
36637
|
+
const mediaType = embedded.mimeType ?? "application/octet-stream";
|
|
36638
|
+
const stored = await this.#store.put({
|
|
36639
|
+
bytes,
|
|
36640
|
+
kind: "resource",
|
|
36641
|
+
mediaType,
|
|
36642
|
+
name: "resource",
|
|
36643
|
+
sessionId,
|
|
36644
|
+
signal
|
|
36645
|
+
});
|
|
36646
|
+
return {
|
|
36647
|
+
_meta: content._meta,
|
|
36648
|
+
annotations: content.annotations,
|
|
36649
|
+
byteLength: stored.byteLength,
|
|
36650
|
+
encoding,
|
|
36651
|
+
mimeType: embedded.mimeType,
|
|
36652
|
+
resourceKey: stored.key,
|
|
36653
|
+
type: "external_resource",
|
|
36654
|
+
uri: embedded.uri
|
|
36655
|
+
};
|
|
36656
|
+
}
|
|
36657
|
+
}
|
|
36658
|
+
}
|
|
36659
|
+
async #toolContent(sessionId, item, signal) {
|
|
36660
|
+
return item.type === "content" ? { ...item, content: await this.#content(sessionId, item.content, signal) } : item;
|
|
36661
|
+
}
|
|
36662
|
+
update = async (sessionId, update, signal) => {
|
|
36663
|
+
switch (update.sessionUpdate) {
|
|
36664
|
+
case "user_message_chunk":
|
|
36665
|
+
case "agent_message_chunk":
|
|
36666
|
+
case "agent_thought_chunk":
|
|
36667
|
+
case "compaction_summary_chunk":
|
|
36668
|
+
return { ...update, content: await this.#content(sessionId, update.content, signal) };
|
|
36669
|
+
case "tool_call":
|
|
36670
|
+
case "tool_call_update":
|
|
36671
|
+
return update.content === void 0 || update.content === null ? update : {
|
|
36672
|
+
...update,
|
|
36673
|
+
content: await Promise.all(
|
|
36674
|
+
update.content.map(async (item) => await this.#toolContent(sessionId, item, signal))
|
|
36675
|
+
)
|
|
36676
|
+
};
|
|
36677
|
+
case "compaction_update":
|
|
36678
|
+
return update.summary === void 0 || update.summary === null ? update : {
|
|
36679
|
+
...update,
|
|
36680
|
+
summary: await Promise.all(
|
|
36681
|
+
update.summary.map(async (content) => await this.#content(sessionId, content, signal))
|
|
36682
|
+
)
|
|
36683
|
+
};
|
|
36684
|
+
case "plan":
|
|
36685
|
+
case "plan_update":
|
|
36686
|
+
case "plan_removed":
|
|
36687
|
+
case "available_commands_update":
|
|
36688
|
+
case "current_mode_update":
|
|
36689
|
+
case "config_option_update":
|
|
36690
|
+
case "session_info_update":
|
|
36691
|
+
case "usage_update":
|
|
36692
|
+
return update;
|
|
36693
|
+
}
|
|
36694
|
+
};
|
|
36695
|
+
};
|
|
36696
|
+
|
|
36697
|
+
// src/external-content/local-external-content-store.ts
|
|
36698
|
+
import { createHash as createHash2, randomUUID } from "node:crypto";
|
|
36699
|
+
import { lstat, mkdir as mkdir4, readFile as readFile3, realpath as realpath7, rename as rename3, rm as rm3, stat as stat6, writeFile as writeFile3 } from "node:fs/promises";
|
|
36700
|
+
import { dirname as dirname4, join as join15 } from "node:path";
|
|
36701
|
+
var contentRequest = /^mobius-content:(image|audio|resource):([a-f0-9]{64})$/u;
|
|
36702
|
+
var metadataSchema2 = external_exports.strictObject({
|
|
36703
|
+
kind: external_exports.enum(["image", "audio", "resource"]),
|
|
36704
|
+
mediaType: external_exports.string().min(1).max(2048).regex(/^[\u0020-\u007e]+$/u),
|
|
36705
|
+
name: external_exports.string().min(1).max(500)
|
|
36706
|
+
});
|
|
36707
|
+
var UnretainedExternalContentStore = class {
|
|
36708
|
+
put = async ({ bytes, signal }) => {
|
|
36709
|
+
signal.throwIfAborted();
|
|
36710
|
+
return { byteLength: bytes.byteLength, key: createHash2("sha256").update(bytes).digest("hex") };
|
|
36711
|
+
};
|
|
36712
|
+
resolve = (_sessionId, _request, signal) => {
|
|
36713
|
+
signal.throwIfAborted();
|
|
36714
|
+
return Promise.resolve(null);
|
|
36715
|
+
};
|
|
36716
|
+
};
|
|
36717
|
+
function sessionScope(sessionId) {
|
|
36718
|
+
return createHash2("sha256").update(sessionId).digest("hex");
|
|
36719
|
+
}
|
|
36720
|
+
async function atomicWrite(path2, bytes, signal) {
|
|
36721
|
+
const temporary = `${path2}.${randomUUID()}.tmp`;
|
|
36722
|
+
try {
|
|
36723
|
+
await writeFile3(temporary, bytes, { mode: 384, signal });
|
|
36724
|
+
signal.throwIfAborted();
|
|
36725
|
+
await rename3(temporary, path2);
|
|
36726
|
+
} finally {
|
|
36727
|
+
await rm3(temporary, { force: true });
|
|
36728
|
+
}
|
|
36729
|
+
}
|
|
36730
|
+
var LocalExternalContentStore = class {
|
|
36731
|
+
#root;
|
|
36732
|
+
constructor(stateDirectory) {
|
|
36733
|
+
this.#root = join15(stateDirectory, "tmp", "session-content");
|
|
36734
|
+
}
|
|
36735
|
+
put = async ({ bytes, kind, mediaType, name, sessionId, signal }) => {
|
|
36736
|
+
signal.throwIfAborted();
|
|
36737
|
+
const key = createHash2("sha256").update(bytes).digest("hex");
|
|
36738
|
+
const directory = join15(this.#root, sessionScope(sessionId), kind);
|
|
36739
|
+
await mkdir4(directory, { mode: 448, recursive: true });
|
|
36740
|
+
signal.throwIfAborted();
|
|
36741
|
+
const path2 = join15(directory, key);
|
|
36742
|
+
await atomicWrite(path2, bytes, signal);
|
|
36743
|
+
await atomicWrite(
|
|
36744
|
+
`${path2}.json`,
|
|
36745
|
+
Buffer.from(JSON.stringify(metadataSchema2.parse({ kind, mediaType, name })), "utf8"),
|
|
36746
|
+
signal
|
|
36747
|
+
);
|
|
36748
|
+
return { byteLength: bytes.byteLength, key };
|
|
36749
|
+
};
|
|
36750
|
+
resolve = async (sessionId, request, signal) => {
|
|
36751
|
+
const matched = contentRequest.exec(request);
|
|
36752
|
+
if (matched === null) {
|
|
36753
|
+
return null;
|
|
36754
|
+
}
|
|
36755
|
+
const kind = matched[1];
|
|
36756
|
+
const key = matched[2];
|
|
36757
|
+
if (kind !== "image" && kind !== "audio" && kind !== "resource" || key === void 0) {
|
|
36758
|
+
return null;
|
|
36759
|
+
}
|
|
36760
|
+
const directory = join15(this.#root, sessionScope(sessionId), kind);
|
|
36761
|
+
const path2 = join15(directory, key);
|
|
36762
|
+
try {
|
|
36763
|
+
const [resolvedDirectory, resolvedPath, file2, metadata] = await Promise.all([
|
|
36764
|
+
realpath7(directory),
|
|
36765
|
+
realpath7(path2),
|
|
36766
|
+
lstat(path2),
|
|
36767
|
+
readFile3(`${path2}.json`, "utf8").then((value) => metadataSchema2.parse(JSON.parse(value)))
|
|
36768
|
+
]);
|
|
36769
|
+
signal.throwIfAborted();
|
|
36770
|
+
if (!file2.isFile() || dirname4(resolvedPath) !== resolvedDirectory || metadata.kind !== kind) {
|
|
36771
|
+
return null;
|
|
36772
|
+
}
|
|
36773
|
+
await stat6(resolvedPath);
|
|
36774
|
+
signal.throwIfAborted();
|
|
36775
|
+
return { mediaType: metadata.mediaType, name: metadata.name, path: resolvedPath };
|
|
36776
|
+
} catch {
|
|
36777
|
+
signal.throwIfAborted();
|
|
36778
|
+
return null;
|
|
36779
|
+
}
|
|
36780
|
+
};
|
|
36781
|
+
};
|
|
36782
|
+
|
|
36565
36783
|
// src/native-sessions/chat-agent.ts
|
|
36566
36784
|
function supportsNativeChat(agentId) {
|
|
36567
36785
|
return agentId === "codex" || agentId === "claude" || agentId === "opencode" || agentId === "pi";
|
|
@@ -36778,7 +36996,7 @@ var AgentRuntimeManager = class {
|
|
|
36778
36996
|
touch: this.#processes.touch,
|
|
36779
36997
|
changed: this.#processes.notifyChanged
|
|
36780
36998
|
});
|
|
36781
|
-
#queryProcesses
|
|
36999
|
+
#queryProcesses;
|
|
36782
37000
|
#executions = new ActiveExecutions();
|
|
36783
37001
|
#agentSettingsObserver = new NullAcpSessionObserver();
|
|
36784
37002
|
#nativeOperations = /* @__PURE__ */ new Set();
|
|
@@ -36786,13 +37004,16 @@ var AgentRuntimeManager = class {
|
|
|
36786
37004
|
#nativeHistoryReader;
|
|
36787
37005
|
#sessionIdentity;
|
|
36788
37006
|
#onSessionStatusChanged;
|
|
37007
|
+
#contentExternalizer;
|
|
36789
37008
|
#observer;
|
|
36790
|
-
constructor(observer = new NullAcpSessionObserver(), store = new MemoryAcpSessionStore(), nativeHistoryReader = null, sessionIdentity = "assigned", onSessionStatusChanged = () => void 0) {
|
|
37009
|
+
constructor(observer = new NullAcpSessionObserver(), store = new MemoryAcpSessionStore(), nativeHistoryReader = null, sessionIdentity = "assigned", onSessionStatusChanged = () => void 0, contentExternalizer = new AcpContentExternalizer(new UnretainedExternalContentStore())) {
|
|
36791
37010
|
this.#observer = observer;
|
|
36792
37011
|
this.#store = store;
|
|
36793
37012
|
this.#nativeHistoryReader = nativeHistoryReader;
|
|
36794
37013
|
this.#sessionIdentity = sessionIdentity;
|
|
36795
37014
|
this.#onSessionStatusChanged = onSessionStatusChanged;
|
|
37015
|
+
this.#contentExternalizer = contentExternalizer;
|
|
37016
|
+
this.#queryProcesses = new AgentQueryProcesses(this.#processes, contentExternalizer);
|
|
36796
37017
|
}
|
|
36797
37018
|
setObserver = (observer) => {
|
|
36798
37019
|
this.#observer = observer;
|
|
@@ -36833,7 +37054,8 @@ var AgentRuntimeManager = class {
|
|
|
36833
37054
|
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,
|
|
36834
37055
|
() => this.#observer,
|
|
36835
37056
|
this.#store,
|
|
36836
|
-
metrics
|
|
37057
|
+
metrics,
|
|
37058
|
+
this.#contentExternalizer
|
|
36837
37059
|
)
|
|
36838
37060
|
);
|
|
36839
37061
|
});
|
|
@@ -36848,7 +37070,13 @@ var AgentRuntimeManager = class {
|
|
|
36848
37070
|
this.#store.remove(options.sessionId);
|
|
36849
37071
|
return await this.#startRetainedSessionProcess(
|
|
36850
37072
|
options,
|
|
36851
|
-
async () => await AgentSession.start(
|
|
37073
|
+
async () => await AgentSession.start(
|
|
37074
|
+
options,
|
|
37075
|
+
() => this.#observer,
|
|
37076
|
+
this.#store,
|
|
37077
|
+
metrics,
|
|
37078
|
+
this.#contentExternalizer
|
|
37079
|
+
)
|
|
36852
37080
|
);
|
|
36853
37081
|
});
|
|
36854
37082
|
}
|
|
@@ -36858,7 +37086,13 @@ var AgentRuntimeManager = class {
|
|
|
36858
37086
|
await this.#retireSessionProcess(options.sessionId, existing, async () => await existing.close());
|
|
36859
37087
|
const runtime = await this.#startRetainedSessionProcess(
|
|
36860
37088
|
options,
|
|
36861
|
-
async () => await AgentSession.start(
|
|
37089
|
+
async () => await AgentSession.start(
|
|
37090
|
+
options,
|
|
37091
|
+
() => this.#observer,
|
|
37092
|
+
this.#store,
|
|
37093
|
+
unmeasuredOperationMetrics,
|
|
37094
|
+
this.#contentExternalizer
|
|
37095
|
+
)
|
|
36862
37096
|
);
|
|
36863
37097
|
try {
|
|
36864
37098
|
for (const desired of desiredConfigOptions) {
|
|
@@ -36954,7 +37188,9 @@ var AgentRuntimeManager = class {
|
|
|
36954
37188
|
sessionId: `agent-settings-${crypto.randomUUID()}`
|
|
36955
37189
|
},
|
|
36956
37190
|
() => this.#agentSettingsObserver,
|
|
36957
|
-
new MemoryAcpSessionStore()
|
|
37191
|
+
new MemoryAcpSessionStore(),
|
|
37192
|
+
unmeasuredOperationMetrics,
|
|
37193
|
+
this.#contentExternalizer
|
|
36958
37194
|
),
|
|
36959
37195
|
async (runtime) => {
|
|
36960
37196
|
const prepared = runtime.prepared();
|
|
@@ -38007,9 +38243,9 @@ var FixedInstallationExecutor = class {
|
|
|
38007
38243
|
};
|
|
38008
38244
|
|
|
38009
38245
|
// src/authorization/workspace-directory.ts
|
|
38010
|
-
import { readdir as readdir2, realpath as
|
|
38246
|
+
import { readdir as readdir2, realpath as realpath8, stat as stat7 } from "node:fs/promises";
|
|
38011
38247
|
import { homedir as homedir2 } from "node:os";
|
|
38012
|
-
import { basename as basename3, dirname as
|
|
38248
|
+
import { basename as basename3, dirname as dirname5, isAbsolute as isAbsolute9, join as join16, normalize as normalize3, relative as relative4 } from "node:path";
|
|
38013
38249
|
|
|
38014
38250
|
// src/authorization/local-authorization-error.ts
|
|
38015
38251
|
var LocalAuthorizationError = class extends Error {
|
|
@@ -38088,9 +38324,9 @@ var WorkspaceDirectoryService = class {
|
|
|
38088
38324
|
throw new LocalAuthorizationError("The local directory path is invalid");
|
|
38089
38325
|
}
|
|
38090
38326
|
try {
|
|
38091
|
-
const target = await
|
|
38327
|
+
const target = await realpath8(requested);
|
|
38092
38328
|
signal.throwIfAborted();
|
|
38093
|
-
const metadata = await
|
|
38329
|
+
const metadata = await stat7(target);
|
|
38094
38330
|
signal.throwIfAborted();
|
|
38095
38331
|
if (!isAbsolute9(target) || normalize3(target) !== target || !metadata.isDirectory()) {
|
|
38096
38332
|
throw new LocalAuthorizationError("The selected location is not a directory");
|
|
@@ -38138,7 +38374,7 @@ var WorkspaceDirectoryService = class {
|
|
|
38138
38374
|
continue;
|
|
38139
38375
|
}
|
|
38140
38376
|
try {
|
|
38141
|
-
const path2 = await this.resolvePath(
|
|
38377
|
+
const path2 = await this.resolvePath(join16(target, child2.name), signal);
|
|
38142
38378
|
entries.push({ directoryId: encodePath(path2), name: child2.name });
|
|
38143
38379
|
} catch (cause) {
|
|
38144
38380
|
signal.throwIfAborted();
|
|
@@ -38148,7 +38384,7 @@ var WorkspaceDirectoryService = class {
|
|
|
38148
38384
|
}
|
|
38149
38385
|
}
|
|
38150
38386
|
entries.sort((a, b) => a.name.localeCompare(b.name));
|
|
38151
|
-
const parent =
|
|
38387
|
+
const parent = dirname5(target);
|
|
38152
38388
|
return new WorkspaceDirectoryListing(
|
|
38153
38389
|
id,
|
|
38154
38390
|
this.label(target),
|
|
@@ -38174,15 +38410,15 @@ var WorkspaceDirectoryService = class {
|
|
|
38174
38410
|
|
|
38175
38411
|
// src/daemon-diagnostic-log.ts
|
|
38176
38412
|
import { appendFileSync, mkdirSync as mkdirSync2, readFileSync as readFileSync2, renameSync, statSync as statSync3, writeFileSync } from "node:fs";
|
|
38177
|
-
import { join as
|
|
38413
|
+
import { join as join17 } from "node:path";
|
|
38178
38414
|
var MAXIMUM_DAEMON_LOG_BYTES = 1 * 1024 * 1024;
|
|
38179
38415
|
var DaemonDiagnosticLog = class {
|
|
38180
38416
|
#directory;
|
|
38181
38417
|
#path;
|
|
38182
38418
|
#maximumBytes;
|
|
38183
38419
|
constructor(stateDirectory, maximumBytes = MAXIMUM_DAEMON_LOG_BYTES) {
|
|
38184
|
-
this.#directory =
|
|
38185
|
-
this.#path =
|
|
38420
|
+
this.#directory = join17(stateDirectory, "logs");
|
|
38421
|
+
this.#path = join17(this.#directory, "daemon.log");
|
|
38186
38422
|
this.#maximumBytes = maximumBytes;
|
|
38187
38423
|
}
|
|
38188
38424
|
record = (diagnostic) => {
|
|
@@ -38227,7 +38463,7 @@ import { WebSocket as WebSocket2 } from "undici";
|
|
|
38227
38463
|
import { WebSocket } from "undici";
|
|
38228
38464
|
|
|
38229
38465
|
// src/prompt-artifact-resolver.ts
|
|
38230
|
-
import { createHash as
|
|
38466
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
38231
38467
|
import { fetch as fetch3 } from "undici";
|
|
38232
38468
|
var ARTIFACT_SCHEME = "mobius-artifact:";
|
|
38233
38469
|
var ARTIFACT_DOWNLOAD_TIMEOUT_MILLISECONDS = 2e4;
|
|
@@ -38365,7 +38601,7 @@ async function download(config2, command, reference, signal) {
|
|
|
38365
38601
|
);
|
|
38366
38602
|
}
|
|
38367
38603
|
const bytes = await responseBytes(response, reference.byteLength, requestSignal);
|
|
38368
|
-
if (
|
|
38604
|
+
if (createHash3("sha256").update(bytes).digest("hex") !== reference.sha256) {
|
|
38369
38605
|
throw new PromptArtifactError(
|
|
38370
38606
|
"artifact_integrity_failed",
|
|
38371
38607
|
"The prompt artifact failed integrity validation"
|
|
@@ -38670,7 +38906,7 @@ var DaemonInstallationObserver = class {
|
|
|
38670
38906
|
};
|
|
38671
38907
|
|
|
38672
38908
|
// src/daemon-active-turn.ts
|
|
38673
|
-
import { randomUUID } from "node:crypto";
|
|
38909
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
38674
38910
|
function activeMessageCharacters(message) {
|
|
38675
38911
|
return message.text.length + (message.role === "assistant" ? JSON.stringify(message.activities).length + JSON.stringify(message.content).length : 0);
|
|
38676
38912
|
}
|
|
@@ -38704,7 +38940,7 @@ var ActiveDaemonTurn = class {
|
|
|
38704
38940
|
#timeline;
|
|
38705
38941
|
#sequence = 0;
|
|
38706
38942
|
#interaction = null;
|
|
38707
|
-
#epoch = decodeIdentifier(
|
|
38943
|
+
#epoch = decodeIdentifier(randomUUID2());
|
|
38708
38944
|
constructor(command, attemptId) {
|
|
38709
38945
|
this.attemptId = attemptId;
|
|
38710
38946
|
this.command = command;
|
|
@@ -38766,7 +39002,7 @@ var ActiveDaemonTurn = class {
|
|
|
38766
39002
|
if (!this.#activities.has(event.activityId)) {
|
|
38767
39003
|
this.#timeline = [
|
|
38768
39004
|
...this.#timeline,
|
|
38769
|
-
{ activityId: event.activityId, id: decodeIdentifier(
|
|
39005
|
+
{ activityId: event.activityId, id: decodeIdentifier(randomUUID2()), kind: "activity" }
|
|
38770
39006
|
];
|
|
38771
39007
|
}
|
|
38772
39008
|
this.#activities.set(event.activityId, {
|
|
@@ -38787,7 +39023,7 @@ var ActiveDaemonTurn = class {
|
|
|
38787
39023
|
if (previous === void 0) {
|
|
38788
39024
|
this.#timeline = [
|
|
38789
39025
|
...this.#timeline,
|
|
38790
|
-
{ activityId: event.activityId, id: decodeIdentifier(
|
|
39026
|
+
{ activityId: event.activityId, id: decodeIdentifier(randomUUID2()), kind: "activity" }
|
|
38791
39027
|
];
|
|
38792
39028
|
}
|
|
38793
39029
|
this.#activities.set(event.activityId, {
|
|
@@ -38812,7 +39048,7 @@ var ActiveDaemonTurn = class {
|
|
|
38812
39048
|
...this.#timeline,
|
|
38813
39049
|
{
|
|
38814
39050
|
content: /* @__PURE__ */ new Map([[event.contentId, event.content]]),
|
|
38815
|
-
id: decodeIdentifier(
|
|
39051
|
+
id: decodeIdentifier(randomUUID2()),
|
|
38816
39052
|
kind: "message",
|
|
38817
39053
|
sourceMessageId: event.messageId,
|
|
38818
39054
|
text: ""
|
|
@@ -38852,7 +39088,7 @@ var ActiveDaemonTurn = class {
|
|
|
38852
39088
|
...this.#timeline,
|
|
38853
39089
|
{
|
|
38854
39090
|
content: /* @__PURE__ */ new Map(),
|
|
38855
|
-
id: decodeIdentifier(
|
|
39091
|
+
id: decodeIdentifier(randomUUID2()),
|
|
38856
39092
|
kind: "message",
|
|
38857
39093
|
sourceMessageId: messageId,
|
|
38858
39094
|
text: remaining.slice(0, ACTIVE_TURN_TEXT_CHUNK_LIMIT)
|
|
@@ -39828,7 +40064,7 @@ var readCodexFullHistory = async (agent, cwd, nativeSessionId, signal, nativeTur
|
|
|
39828
40064
|
});
|
|
39829
40065
|
|
|
39830
40066
|
// src/native-sessions/service.ts
|
|
39831
|
-
import { randomUUID as
|
|
40067
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
39832
40068
|
import { basename as basename4 } from "node:path";
|
|
39833
40069
|
|
|
39834
40070
|
// src/native-sessions/acp-history.ts
|
|
@@ -40043,7 +40279,7 @@ var NativeSessionService = class {
|
|
|
40043
40279
|
if (authorized === null) {
|
|
40044
40280
|
return null;
|
|
40045
40281
|
}
|
|
40046
|
-
const entryId = decodeIdentifier(
|
|
40282
|
+
const entryId = decodeIdentifier(randomUUID3());
|
|
40047
40283
|
if (this.#entries.size >= 5e3) {
|
|
40048
40284
|
this.#entries.clear();
|
|
40049
40285
|
}
|
|
@@ -40099,7 +40335,7 @@ var NativeSessionService = class {
|
|
|
40099
40335
|
"invalid_native_session_response"
|
|
40100
40336
|
);
|
|
40101
40337
|
}
|
|
40102
|
-
nextCursor = decodeIdentifier(
|
|
40338
|
+
nextCursor = decodeIdentifier(randomUUID3());
|
|
40103
40339
|
if (this.#cursors.size >= 500) {
|
|
40104
40340
|
this.#cursors.clear();
|
|
40105
40341
|
}
|
|
@@ -40381,7 +40617,7 @@ var NativeSessionService = class {
|
|
|
40381
40617
|
};
|
|
40382
40618
|
|
|
40383
40619
|
// src/relay-connection/daemon-operation-state.ts
|
|
40384
|
-
import { createHash as
|
|
40620
|
+
import { createHash as createHash4, randomUUID as randomUUID4 } from "node:crypto";
|
|
40385
40621
|
var MAX_TERMINAL_RECEIPTS = 1024;
|
|
40386
40622
|
function isTerminal(state) {
|
|
40387
40623
|
return state === "succeeded" || state === "failed" || state === "cancelled";
|
|
@@ -40390,7 +40626,7 @@ var DaemonOperationState = class {
|
|
|
40390
40626
|
#executions = /* @__PURE__ */ new Map();
|
|
40391
40627
|
#terminalCount = 0;
|
|
40392
40628
|
claimExecution = (commandId, sessionId, commandJson) => {
|
|
40393
|
-
const commandHash =
|
|
40629
|
+
const commandHash = createHash4("sha256").update(commandJson).digest("hex");
|
|
40394
40630
|
const existing = this.#executions.get(commandId);
|
|
40395
40631
|
if (existing !== void 0) {
|
|
40396
40632
|
if (existing.sessionId !== sessionId || existing.commandHash !== commandHash) {
|
|
@@ -40398,7 +40634,7 @@ var DaemonOperationState = class {
|
|
|
40398
40634
|
}
|
|
40399
40635
|
return { attemptId: existing.attemptId, commandId, kind: "duplicate", state: existing.state };
|
|
40400
40636
|
}
|
|
40401
|
-
const attemptId =
|
|
40637
|
+
const attemptId = randomUUID4();
|
|
40402
40638
|
this.#executions.set(commandId, { attemptId, commandHash, sessionId, state: "dispatching" });
|
|
40403
40639
|
return { attemptId, commandId, kind: "accepted", state: "dispatching" };
|
|
40404
40640
|
};
|
|
@@ -40734,7 +40970,7 @@ function createAgentCatalogRefreshHandler(dependencies) {
|
|
|
40734
40970
|
import { WebSocket as WebSocket4 } from "undici";
|
|
40735
40971
|
|
|
40736
40972
|
// src/agent-catalog/discover-agent-settings.ts
|
|
40737
|
-
import { createHash as
|
|
40973
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
40738
40974
|
|
|
40739
40975
|
// src/agent-catalog/agent-settings-base.ts
|
|
40740
40976
|
var AgentSettingsConfigurationError = class extends Error {
|
|
@@ -41198,7 +41434,7 @@ function settingsRevision(agent, reportedAgentVersion, settings, modelEffort) {
|
|
|
41198
41434
|
unsupportedModelIds: modelEffort.unsupportedModelIds,
|
|
41199
41435
|
valuesByModel: {}
|
|
41200
41436
|
};
|
|
41201
|
-
return
|
|
41437
|
+
return createHash5("sha256").update(
|
|
41202
41438
|
JSON.stringify({
|
|
41203
41439
|
adapterVersion: agent.kind === "acp-adapter-process" ? agent.adapterVersion : agent.agentVersion,
|
|
41204
41440
|
agentId: agent.id,
|
|
@@ -41349,7 +41585,7 @@ function createAgentSettingsDiscoveryHandler(dependencies) {
|
|
|
41349
41585
|
|
|
41350
41586
|
// src/artifacts/local-file-streamer.ts
|
|
41351
41587
|
import { createReadStream as createReadStream2 } from "node:fs";
|
|
41352
|
-
import { realpath as
|
|
41588
|
+
import { realpath as realpath9, stat as stat8 } from "node:fs/promises";
|
|
41353
41589
|
import { basename as basename5, isAbsolute as isAbsolute10, normalize as normalize4, resolve as resolve5 } from "node:path";
|
|
41354
41590
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
41355
41591
|
var CHUNK_BYTES = 192 * 1024;
|
|
@@ -41377,7 +41613,7 @@ async function resolveFile(value, workingDirectory, signal) {
|
|
|
41377
41613
|
return null;
|
|
41378
41614
|
}
|
|
41379
41615
|
try {
|
|
41380
|
-
const target = await
|
|
41616
|
+
const target = await realpath9(requested);
|
|
41381
41617
|
signal.throwIfAborted();
|
|
41382
41618
|
return isAbsolute10(target) && normalize4(target) === target ? target : null;
|
|
41383
41619
|
} catch {
|
|
@@ -41385,23 +41621,24 @@ async function resolveFile(value, workingDirectory, signal) {
|
|
|
41385
41621
|
return null;
|
|
41386
41622
|
}
|
|
41387
41623
|
}
|
|
41388
|
-
async function streamLocalFile(command, send2, signal, workingDirectory) {
|
|
41389
|
-
const
|
|
41624
|
+
async function streamLocalFile(command, send2, signal, workingDirectory, externalContent) {
|
|
41625
|
+
const external = await externalContent.resolve(command.sessionId, command.path, signal);
|
|
41626
|
+
const target = external?.path ?? await resolveFile(command.path, workingDirectory, signal);
|
|
41390
41627
|
if (target === null) {
|
|
41391
41628
|
throw new Error("The local file is unavailable");
|
|
41392
41629
|
}
|
|
41393
|
-
const before = await
|
|
41630
|
+
const before = await stat8(target);
|
|
41394
41631
|
signal.throwIfAborted();
|
|
41395
41632
|
if (!before.isFile() || before.size < 1 || before.size > command.maxBytes) {
|
|
41396
41633
|
throw new Error("The local file is too large to read");
|
|
41397
41634
|
}
|
|
41398
|
-
const raster = await readLocalRaster(target, signal);
|
|
41635
|
+
const raster = external === null ? await readLocalRaster(target, signal) : null;
|
|
41399
41636
|
send2({
|
|
41400
41637
|
byteLength: before.size,
|
|
41401
41638
|
kind: FILE_BEGIN_KIND,
|
|
41402
|
-
mediaType: raster?.mimeType ?? "application/octet-stream",
|
|
41639
|
+
mediaType: external?.mediaType ?? raster?.mimeType ?? "application/octet-stream",
|
|
41403
41640
|
modifiedAt: before.mtime.toISOString(),
|
|
41404
|
-
name: basename5(target) || "file",
|
|
41641
|
+
name: external?.name ?? (basename5(target) || "file"),
|
|
41405
41642
|
requestId: command.requestId,
|
|
41406
41643
|
sessionId: command.sessionId
|
|
41407
41644
|
});
|
|
@@ -41418,7 +41655,7 @@ async function streamLocalFile(command, send2, signal, workingDirectory) {
|
|
|
41418
41655
|
});
|
|
41419
41656
|
sequence += 1;
|
|
41420
41657
|
}
|
|
41421
|
-
const after = await
|
|
41658
|
+
const after = await stat8(target);
|
|
41422
41659
|
signal.throwIfAborted();
|
|
41423
41660
|
if (after.size !== before.size || after.mtimeMs !== before.mtimeMs) {
|
|
41424
41661
|
throw new Error("The local file changed during transfer");
|
|
@@ -41431,7 +41668,7 @@ async function streamLocalFile(command, send2, signal, workingDirectory) {
|
|
|
41431
41668
|
}
|
|
41432
41669
|
|
|
41433
41670
|
// src/daemon-history-commands.ts
|
|
41434
|
-
import { createHash as
|
|
41671
|
+
import { createHash as createHash6 } from "node:crypto";
|
|
41435
41672
|
|
|
41436
41673
|
// src/authorization/resolve-session-directories.ts
|
|
41437
41674
|
import { basename as basename6 } from "node:path";
|
|
@@ -41825,7 +42062,7 @@ async function executeSessionLiveHistoryPageLoad(socket, command, config2, direc
|
|
|
41825
42062
|
}
|
|
41826
42063
|
function replayEvent(sessionId, position, update) {
|
|
41827
42064
|
const encoded = JSON.stringify(update);
|
|
41828
|
-
const eventId = `native-${
|
|
42065
|
+
const eventId = `native-${createHash6("sha256").update(sessionId).update(":").update(position.toString()).update(":").update(encoded).digest("hex")}`;
|
|
41829
42066
|
return {
|
|
41830
42067
|
eventId,
|
|
41831
42068
|
payload: update,
|
|
@@ -41908,7 +42145,7 @@ async function executeSessionLiveHistoryV2PageLoad(socket, command, config2, dir
|
|
|
41908
42145
|
}
|
|
41909
42146
|
|
|
41910
42147
|
// src/acp/session-config/apply-session-configuration.ts
|
|
41911
|
-
import { randomUUID as
|
|
42148
|
+
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
41912
42149
|
function invalidSessionConfiguration(message) {
|
|
41913
42150
|
return new AcpExecutionError(message, {}, "invalid_session_configuration");
|
|
41914
42151
|
}
|
|
@@ -42049,7 +42286,7 @@ async function applySessionConfigurationSelection(sessions, audit, options, sele
|
|
|
42049
42286
|
booleanValue: selection.booleanValue,
|
|
42050
42287
|
configId: selection.configId,
|
|
42051
42288
|
cwd,
|
|
42052
|
-
requestId: `cfg_${
|
|
42289
|
+
requestId: `cfg_${randomUUID5()}`,
|
|
42053
42290
|
sessionId,
|
|
42054
42291
|
signal,
|
|
42055
42292
|
value: selection.value,
|
|
@@ -42723,6 +42960,7 @@ function createDaemonCommandHandler({
|
|
|
42723
42960
|
operations,
|
|
42724
42961
|
publisher,
|
|
42725
42962
|
eventLogV2,
|
|
42963
|
+
externalContent,
|
|
42726
42964
|
activeTurns,
|
|
42727
42965
|
diagnostics,
|
|
42728
42966
|
socket,
|
|
@@ -42831,7 +43069,8 @@ function createDaemonCommandHandler({
|
|
|
42831
43069
|
command2,
|
|
42832
43070
|
(message2) => send(socket, message2),
|
|
42833
43071
|
signal,
|
|
42834
|
-
sessions.findSessions([command2.sessionId])[0]?.cwd ?? null
|
|
43072
|
+
sessions.findSessions([command2.sessionId])[0]?.cwd ?? null,
|
|
43073
|
+
externalContent
|
|
42835
43074
|
).catch((error62) => {
|
|
42836
43075
|
if (socket.readyState !== WebSocket6.OPEN || signal.aborted) {
|
|
42837
43076
|
return;
|
|
@@ -43170,7 +43409,7 @@ function connectRelay(url2, signal) {
|
|
|
43170
43409
|
}
|
|
43171
43410
|
|
|
43172
43411
|
// src/relay-connection/liveness.ts
|
|
43173
|
-
import { randomUUID as
|
|
43412
|
+
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
43174
43413
|
var HEARTBEAT_ACK_TIMEOUT_MILLISECONDS = 1e4;
|
|
43175
43414
|
var HEARTBEAT_INTERVAL_MILLISECONDS = 2e4;
|
|
43176
43415
|
var RelayLivenessState = class {
|
|
@@ -43259,7 +43498,7 @@ var RelayConnectionLiveness = class {
|
|
|
43259
43498
|
}
|
|
43260
43499
|
throw new Error("Heartbeat was scheduled in an invalid state");
|
|
43261
43500
|
}
|
|
43262
|
-
const heartbeatId =
|
|
43501
|
+
const heartbeatId = randomUUID6();
|
|
43263
43502
|
this.#state = new AwaitingHeartbeatAckState(
|
|
43264
43503
|
heartbeatId,
|
|
43265
43504
|
this.#timer.schedule(this.#handleTimeout, HEARTBEAT_ACK_TIMEOUT_MILLISECONDS)
|
|
@@ -43299,6 +43538,7 @@ async function runRelayConnection({
|
|
|
43299
43538
|
operations,
|
|
43300
43539
|
publisher,
|
|
43301
43540
|
eventLogV2,
|
|
43541
|
+
externalContent,
|
|
43302
43542
|
activeTurns,
|
|
43303
43543
|
connectionEpoch,
|
|
43304
43544
|
diagnostics,
|
|
@@ -43322,6 +43562,7 @@ async function runRelayConnection({
|
|
|
43322
43562
|
operations,
|
|
43323
43563
|
publisher,
|
|
43324
43564
|
eventLogV2,
|
|
43565
|
+
externalContent,
|
|
43325
43566
|
activeTurns,
|
|
43326
43567
|
diagnostics,
|
|
43327
43568
|
socket,
|
|
@@ -43439,6 +43680,14 @@ async function runRelayConnection({
|
|
|
43439
43680
|
}
|
|
43440
43681
|
commands.handle(message);
|
|
43441
43682
|
} catch (error62) {
|
|
43683
|
+
if (error62 instanceof UnsupportedProtocolMessageKindError) {
|
|
43684
|
+
console.warn("Mobius daemon skipped an unsupported Relay message", {
|
|
43685
|
+
code: error62.code,
|
|
43686
|
+
direction: error62.direction,
|
|
43687
|
+
messageKind: error62.messageKind
|
|
43688
|
+
});
|
|
43689
|
+
return;
|
|
43690
|
+
}
|
|
43442
43691
|
console.error("Mobius daemon rejected a message", error62);
|
|
43443
43692
|
failAndClose(
|
|
43444
43693
|
new Error("Relay sent an invalid protocol message", { cause: error62 }),
|
|
@@ -43792,7 +44041,7 @@ async function installDetectedAgentIntegrations(config2, installations, signal)
|
|
|
43792
44041
|
{
|
|
43793
44042
|
agentId: agent.id,
|
|
43794
44043
|
kind: AGENT_INSTALL_REQUEST_KIND,
|
|
43795
|
-
requestId: `automatic-integration-${
|
|
44044
|
+
requestId: `automatic-integration-${randomUUID7()}`
|
|
43796
44045
|
},
|
|
43797
44046
|
signal
|
|
43798
44047
|
);
|
|
@@ -43811,8 +44060,9 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
43811
44060
|
stateDirectory
|
|
43812
44061
|
});
|
|
43813
44062
|
const sessionStore = new SqliteAcpSessionStore(
|
|
43814
|
-
|
|
44063
|
+
join18(stateDirectory, "sessions", `${createHash7("sha256").update(config2.channelId).digest("hex")}.sqlite`)
|
|
43815
44064
|
);
|
|
44065
|
+
const externalContent = new LocalExternalContentStore(stateDirectory);
|
|
43816
44066
|
const operations = new DaemonOperationState();
|
|
43817
44067
|
const publisher = new DaemonSessionEventPublisher(sessionStore);
|
|
43818
44068
|
const eventLogV2 = new DaemonSessionEventLogV2(publisher, sessionStore);
|
|
@@ -43833,7 +44083,8 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
43833
44083
|
)).history : null
|
|
43834
44084
|
},
|
|
43835
44085
|
"native",
|
|
43836
|
-
publisher.publishStatus
|
|
44086
|
+
publisher.publishStatus,
|
|
44087
|
+
new AcpContentExternalizer(externalContent)
|
|
43837
44088
|
);
|
|
43838
44089
|
const directories = new WorkspaceDirectoryService(config2.bindingId, config2.defaultWorkspace);
|
|
43839
44090
|
const installationObserver = new DaemonInstallationObserver();
|
|
@@ -43947,6 +44198,7 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
43947
44198
|
operations,
|
|
43948
44199
|
publisher,
|
|
43949
44200
|
eventLogV2,
|
|
44201
|
+
externalContent,
|
|
43950
44202
|
activeTurns,
|
|
43951
44203
|
connectionEpoch,
|
|
43952
44204
|
diagnostics,
|
|
@@ -44003,15 +44255,15 @@ async function runDaemon(config2, audit, signal, timer = systemDaemonTimer, opti
|
|
|
44003
44255
|
}
|
|
44004
44256
|
|
|
44005
44257
|
// src/pairing/pair-local-machine.ts
|
|
44006
|
-
import { mkdir as
|
|
44258
|
+
import { mkdir as mkdir6, realpath as realpath10, stat as stat9 } from "node:fs/promises";
|
|
44007
44259
|
import { hostname as hostname3 } from "node:os";
|
|
44008
44260
|
import { basename as basename7, resolve as resolve7 } from "node:path";
|
|
44009
44261
|
import { fetch as fetch4 } from "undici";
|
|
44010
44262
|
|
|
44011
44263
|
// src/storage/runtime-installation-store.ts
|
|
44012
|
-
import { createHash as
|
|
44013
|
-
import { mkdir as
|
|
44014
|
-
import { dirname as
|
|
44264
|
+
import { createHash as createHash8, randomUUID as randomUUID8 } from "node:crypto";
|
|
44265
|
+
import { mkdir as mkdir5, open as open5, readdir as readdir3, rename as rename4, unlink, writeFile as writeFile4 } from "node:fs/promises";
|
|
44266
|
+
import { dirname as dirname6, join as join19, resolve as resolve6 } from "node:path";
|
|
44015
44267
|
var APPLICATION_ID_PATTERN = /^[a-z][a-z0-9]*(?:[.-][a-z0-9]+){1,31}$/;
|
|
44016
44268
|
var CONNECTION_ID_PATTERN = /^mcn_[a-f0-9]{32}$/;
|
|
44017
44269
|
var INSTALLATION_ID_PATTERN = /^min_[a-f0-9]{32}$/;
|
|
@@ -44139,13 +44391,13 @@ function parseRelayOrigin(value) {
|
|
|
44139
44391
|
return origin;
|
|
44140
44392
|
}
|
|
44141
44393
|
function connectionId() {
|
|
44142
|
-
return `mcn_${
|
|
44394
|
+
return `mcn_${randomUUID8().replaceAll("-", "")}`;
|
|
44143
44395
|
}
|
|
44144
44396
|
function installationId() {
|
|
44145
|
-
return `min_${
|
|
44397
|
+
return `min_${randomUUID8().replaceAll("-", "")}`;
|
|
44146
44398
|
}
|
|
44147
44399
|
function channelIndexFileName(channelId) {
|
|
44148
|
-
return `mci_${
|
|
44400
|
+
return `mci_${createHash8("sha256").update(channelId).digest("hex")}.json`;
|
|
44149
44401
|
}
|
|
44150
44402
|
function decodeInstallationPointer(value) {
|
|
44151
44403
|
if (!isRecord9(value) || !hasExactKeys(value, INSTALLATION_POINTER_KEYS) || value["version"] !== 1) {
|
|
@@ -44253,15 +44505,15 @@ async function readJsonFile(path2, signal, missingCode) {
|
|
|
44253
44505
|
}
|
|
44254
44506
|
async function writeJsonAtomically(path2, value, signal) {
|
|
44255
44507
|
signal.throwIfAborted();
|
|
44256
|
-
const directory =
|
|
44257
|
-
const temporaryPath =
|
|
44508
|
+
const directory = dirname6(path2);
|
|
44509
|
+
const temporaryPath = join19(directory, `.${randomUUID8()}.tmp`);
|
|
44258
44510
|
try {
|
|
44259
|
-
await
|
|
44511
|
+
await mkdir5(directory, { mode: 448, recursive: true });
|
|
44260
44512
|
signal.throwIfAborted();
|
|
44261
|
-
await
|
|
44513
|
+
await writeFile4(temporaryPath, `${JSON.stringify(value, null, 2)}
|
|
44262
44514
|
`, { flag: "wx", mode: 384 });
|
|
44263
44515
|
signal.throwIfAborted();
|
|
44264
|
-
await
|
|
44516
|
+
await rename4(temporaryPath, path2);
|
|
44265
44517
|
} catch (cause) {
|
|
44266
44518
|
await unlink(temporaryPath).catch(() => void 0);
|
|
44267
44519
|
signal.throwIfAborted();
|
|
@@ -44280,16 +44532,16 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
|
|
|
44280
44532
|
this.applicationId = applicationId;
|
|
44281
44533
|
this.installationId = installationId2;
|
|
44282
44534
|
this.stateDirectory = stateDirectory;
|
|
44283
|
-
this.#channelDirectory =
|
|
44284
|
-
this.#connectionDirectory =
|
|
44535
|
+
this.#channelDirectory = join19(stateDirectory, "channels");
|
|
44536
|
+
this.#connectionDirectory = join19(stateDirectory, "connections");
|
|
44285
44537
|
}
|
|
44286
44538
|
static open = async (options, signal) => {
|
|
44287
44539
|
signal.throwIfAborted();
|
|
44288
44540
|
const applicationId = validateApplicationId(options.applicationId);
|
|
44289
44541
|
const rootDirectory = resolve6(options.stateDirectory);
|
|
44290
|
-
const applicationDirectory =
|
|
44542
|
+
const applicationDirectory = join19(rootDirectory, "installations", applicationId);
|
|
44291
44543
|
try {
|
|
44292
|
-
await
|
|
44544
|
+
await mkdir5(applicationDirectory, { mode: 448, recursive: true });
|
|
44293
44545
|
} catch (cause) {
|
|
44294
44546
|
throw new RuntimeInstallationStoreError(
|
|
44295
44547
|
"installation_unavailable",
|
|
@@ -44300,9 +44552,9 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
|
|
|
44300
44552
|
);
|
|
44301
44553
|
}
|
|
44302
44554
|
const storedInstallationId = await readOrCreateInstallationId(applicationDirectory, signal);
|
|
44303
|
-
const stateDirectory =
|
|
44555
|
+
const stateDirectory = join19(applicationDirectory, storedInstallationId);
|
|
44304
44556
|
try {
|
|
44305
|
-
await
|
|
44557
|
+
await mkdir5(stateDirectory, { mode: 448, recursive: true });
|
|
44306
44558
|
} catch (cause) {
|
|
44307
44559
|
throw new RuntimeInstallationStoreError(
|
|
44308
44560
|
"installation_unavailable",
|
|
@@ -44315,8 +44567,8 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
|
|
|
44315
44567
|
signal.throwIfAborted();
|
|
44316
44568
|
return new _RuntimeInstallationStore(applicationId, storedInstallationId, stateDirectory);
|
|
44317
44569
|
};
|
|
44318
|
-
connectionPath = (connectionId2) =>
|
|
44319
|
-
channelIndexPath = (channelId) =>
|
|
44570
|
+
connectionPath = (connectionId2) => join19(this.#connectionDirectory, `${validateConnectionId(connectionId2)}.json`);
|
|
44571
|
+
channelIndexPath = (channelId) => join19(this.#channelDirectory, channelIndexFileName(validateIdentifier(channelId, "invalid_channel_id")));
|
|
44320
44572
|
readConnection = async (connectionId2, signal) => {
|
|
44321
44573
|
const stored = decodeConnection(
|
|
44322
44574
|
await readJsonFile(this.connectionPath(connectionId2), signal, "connection_not_found")
|
|
@@ -44478,7 +44730,7 @@ var RuntimeInstallationStore = class _RuntimeInstallationStore {
|
|
|
44478
44730
|
};
|
|
44479
44731
|
};
|
|
44480
44732
|
async function readOrCreateInstallationId(applicationDirectory, signal) {
|
|
44481
|
-
const pointerPath =
|
|
44733
|
+
const pointerPath = join19(applicationDirectory, "current.json");
|
|
44482
44734
|
try {
|
|
44483
44735
|
return decodeInstallationPointer(await readJsonFile(pointerPath, signal, "installation_not_found")).installationId;
|
|
44484
44736
|
} catch (cause) {
|
|
@@ -44488,7 +44740,7 @@ async function readOrCreateInstallationId(applicationDirectory, signal) {
|
|
|
44488
44740
|
}
|
|
44489
44741
|
const candidate = installationId();
|
|
44490
44742
|
try {
|
|
44491
|
-
await
|
|
44743
|
+
await writeFile4(pointerPath, `${JSON.stringify({ installationId: candidate, version: 1 })}
|
|
44492
44744
|
`, {
|
|
44493
44745
|
flag: "wx",
|
|
44494
44746
|
mode: 384
|
|
@@ -44572,9 +44824,9 @@ function validatePairingId(value) {
|
|
|
44572
44824
|
async function resolveDefaultWorkspace2(path2) {
|
|
44573
44825
|
const requestedWorkspace = resolve7(path2);
|
|
44574
44826
|
try {
|
|
44575
|
-
await
|
|
44576
|
-
const defaultWorkspace = await
|
|
44577
|
-
const metadata = await
|
|
44827
|
+
await mkdir6(requestedWorkspace, { recursive: true, mode: 448 });
|
|
44828
|
+
const defaultWorkspace = await realpath10(requestedWorkspace);
|
|
44829
|
+
const metadata = await stat9(defaultWorkspace);
|
|
44578
44830
|
if (!metadata.isDirectory()) {
|
|
44579
44831
|
throw new PairingClientError("invalid_workspace", "The default workspace is not a directory");
|
|
44580
44832
|
}
|
|
@@ -44808,9 +45060,9 @@ function loadMobiusRuntimeConnection(environment = process.env) {
|
|
|
44808
45060
|
async function resolveWorkspace(path2) {
|
|
44809
45061
|
const requested = resolve8(path2);
|
|
44810
45062
|
try {
|
|
44811
|
-
await
|
|
44812
|
-
const resolved = await
|
|
44813
|
-
const metadata = await
|
|
45063
|
+
await mkdir7(requested, { recursive: true, mode: 448 });
|
|
45064
|
+
const resolved = await realpath11(requested);
|
|
45065
|
+
const metadata = await stat10(resolved);
|
|
44814
45066
|
if (!metadata.isDirectory()) {
|
|
44815
45067
|
throw new MobiusRuntimeConfigurationError("The Runtime workspace is not a directory");
|
|
44816
45068
|
}
|
|
@@ -44878,6 +45130,7 @@ var MobiusRuntimeEngine = class {
|
|
|
44878
45130
|
export {
|
|
44879
45131
|
DaemonLocalContext,
|
|
44880
45132
|
DaemonReconnectTarget,
|
|
45133
|
+
InProcessAcpAgentDefinition,
|
|
44881
45134
|
MobiusRuntimeConfigurationError,
|
|
44882
45135
|
MobiusRuntimeEngine,
|
|
44883
45136
|
OpaqueDaemonReconnectTarget,
|