@kodizm/acp 0.9.0 → 0.9.1
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/index.js +212 -152
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -51,7 +51,7 @@ var package_default;
|
|
|
51
51
|
var init_package = __esm(() => {
|
|
52
52
|
package_default = {
|
|
53
53
|
name: "@kodizm/acp",
|
|
54
|
-
version: "0.9.
|
|
54
|
+
version: "0.9.1",
|
|
55
55
|
description: "Custom ACP server bridging Claude Code and opencode CLIs through a single Kodizm-flavored protocol surface.",
|
|
56
56
|
type: "module",
|
|
57
57
|
bin: {
|
|
@@ -5052,6 +5052,151 @@ var init_zod = __esm(() => {
|
|
|
5052
5052
|
init_external();
|
|
5053
5053
|
});
|
|
5054
5054
|
|
|
5055
|
+
// src/wire/schemas.ts
|
|
5056
|
+
function metaCarriesNoCanonicalFields(data) {
|
|
5057
|
+
if (data._meta === undefined) {
|
|
5058
|
+
return true;
|
|
5059
|
+
}
|
|
5060
|
+
for (const banned of CANONICAL_FIELDS_BANNED_IN_META) {
|
|
5061
|
+
if (banned in data._meta) {
|
|
5062
|
+
return false;
|
|
5063
|
+
}
|
|
5064
|
+
}
|
|
5065
|
+
return true;
|
|
5066
|
+
}
|
|
5067
|
+
function timeoutsAreExclusive(data) {
|
|
5068
|
+
return !(data.permissionTimeoutMs !== undefined && data.permissionDeferTimeoutMs !== undefined);
|
|
5069
|
+
}
|
|
5070
|
+
var AbsolutePathSchema, PLUGIN_ROOT = "/opt/kodizm/plugins/", PluginPathSchema, McpServerSchema, SystemPromptSchema, MetaSchema, CANONICAL_FIELDS_BANNED_IN_META, SettingSourcesSchema, PermissionModeSchema, ToolPolicySchema, FeaturesSchema, META_SMUGGLE_MESSAGE = "canonical fields (systemPrompt, additionalDirectories, mcpServers, model, skills, cwd) must be top-level, not nested in _meta", InitializeRequestSchema, SessionOptionFields, TIMEOUT_EXCLUSION, NewSessionRequestSchema, PromptRequestSchema, CancelRequestSchema, LoadSessionRequestSchema, CompactSessionRequestSchema, ForkSessionRequestSchema;
|
|
5071
|
+
var init_schemas3 = __esm(() => {
|
|
5072
|
+
init_zod();
|
|
5073
|
+
AbsolutePathSchema = string2().regex(/^\//, 'path must be absolute (start with "/")');
|
|
5074
|
+
PluginPathSchema = AbsolutePathSchema.refine((path) => path.length > PLUGIN_ROOT.length && path.startsWith(PLUGIN_ROOT) && !path.split("/").includes(".."), { message: `plugin path must live under ${PLUGIN_ROOT} with no ".." segment` });
|
|
5075
|
+
McpServerSchema = object({
|
|
5076
|
+
type: literal("http"),
|
|
5077
|
+
name: string2().min(1),
|
|
5078
|
+
url: string2().url(),
|
|
5079
|
+
headers: array(object({
|
|
5080
|
+
name: string2().min(1),
|
|
5081
|
+
value: string2()
|
|
5082
|
+
})).optional()
|
|
5083
|
+
});
|
|
5084
|
+
SystemPromptSchema = union([
|
|
5085
|
+
string2(),
|
|
5086
|
+
object({
|
|
5087
|
+
append: string2(),
|
|
5088
|
+
excludeDynamicSections: boolean2().optional()
|
|
5089
|
+
})
|
|
5090
|
+
]);
|
|
5091
|
+
MetaSchema = record(string2(), unknown());
|
|
5092
|
+
CANONICAL_FIELDS_BANNED_IN_META = [
|
|
5093
|
+
"systemPrompt",
|
|
5094
|
+
"additionalDirectories",
|
|
5095
|
+
"mcpServers",
|
|
5096
|
+
"model",
|
|
5097
|
+
"skills",
|
|
5098
|
+
"cwd",
|
|
5099
|
+
"sessionId",
|
|
5100
|
+
"sourceSessionId",
|
|
5101
|
+
"toolPolicy",
|
|
5102
|
+
"autoCompact",
|
|
5103
|
+
"permissionTimeoutMs",
|
|
5104
|
+
"permissionDeferTimeoutMs",
|
|
5105
|
+
"debug",
|
|
5106
|
+
"debugCaptureRawSdk",
|
|
5107
|
+
"debugCaptureRpc",
|
|
5108
|
+
"heartbeatIntervalMs",
|
|
5109
|
+
"inactivityThresholdMs",
|
|
5110
|
+
"settingSources",
|
|
5111
|
+
"features",
|
|
5112
|
+
"plugins"
|
|
5113
|
+
];
|
|
5114
|
+
SettingSourcesSchema = array(_enum(["user", "project", "local"]));
|
|
5115
|
+
PermissionModeSchema = _enum(["default", "acceptEdits", "plan", "dontAsk", "bypassPermissions"]);
|
|
5116
|
+
ToolPolicySchema = object({
|
|
5117
|
+
allow: array(string2()).optional(),
|
|
5118
|
+
deny: array(string2()).optional(),
|
|
5119
|
+
ask: array(string2()).optional(),
|
|
5120
|
+
defaultMode: PermissionModeSchema.optional()
|
|
5121
|
+
});
|
|
5122
|
+
FeaturesSchema = object({
|
|
5123
|
+
todos: boolean2().optional(),
|
|
5124
|
+
subagents: boolean2().optional(),
|
|
5125
|
+
backgroundTasks: boolean2().optional(),
|
|
5126
|
+
scheduling: boolean2().optional(),
|
|
5127
|
+
planMode: boolean2().optional(),
|
|
5128
|
+
worktree: boolean2().optional(),
|
|
5129
|
+
notebook: boolean2().optional(),
|
|
5130
|
+
clientTools: boolean2().optional(),
|
|
5131
|
+
autoMemory: boolean2().optional(),
|
|
5132
|
+
bundledSkills: boolean2().optional(),
|
|
5133
|
+
simple: boolean2().optional(),
|
|
5134
|
+
tools: array(string2().min(1)).optional()
|
|
5135
|
+
});
|
|
5136
|
+
InitializeRequestSchema = object({
|
|
5137
|
+
protocolVersion: number2().int().positive(),
|
|
5138
|
+
clientCapabilities: record(string2(), unknown()).optional(),
|
|
5139
|
+
_meta: MetaSchema.optional()
|
|
5140
|
+
});
|
|
5141
|
+
SessionOptionFields = {
|
|
5142
|
+
additionalDirectories: array(AbsolutePathSchema).optional(),
|
|
5143
|
+
plugins: array(PluginPathSchema).optional(),
|
|
5144
|
+
systemPrompt: SystemPromptSchema.optional(),
|
|
5145
|
+
model: string2().optional(),
|
|
5146
|
+
skills: array(string2()).optional(),
|
|
5147
|
+
toolPolicy: ToolPolicySchema.optional(),
|
|
5148
|
+
autoCompact: boolean2().optional(),
|
|
5149
|
+
permissionTimeoutMs: number2().int().positive().optional(),
|
|
5150
|
+
permissionDeferTimeoutMs: number2().int().positive().optional(),
|
|
5151
|
+
debug: boolean2().optional(),
|
|
5152
|
+
debugCaptureRawSdk: boolean2().optional(),
|
|
5153
|
+
debugCaptureRpc: boolean2().optional(),
|
|
5154
|
+
heartbeatIntervalMs: number2().int().positive().optional(),
|
|
5155
|
+
inactivityThresholdMs: number2().int().positive().optional(),
|
|
5156
|
+
settingSources: SettingSourcesSchema.optional(),
|
|
5157
|
+
features: FeaturesSchema.optional(),
|
|
5158
|
+
_meta: MetaSchema.optional()
|
|
5159
|
+
};
|
|
5160
|
+
TIMEOUT_EXCLUSION = {
|
|
5161
|
+
message: "permissionTimeoutMs and permissionDeferTimeoutMs are mutually exclusive (pick hard-deny on timeout OR soft-defer on timeout)",
|
|
5162
|
+
path: ["permissionDeferTimeoutMs"]
|
|
5163
|
+
};
|
|
5164
|
+
NewSessionRequestSchema = object({
|
|
5165
|
+
cwd: AbsolutePathSchema,
|
|
5166
|
+
mcpServers: array(McpServerSchema),
|
|
5167
|
+
...SessionOptionFields
|
|
5168
|
+
}).refine(metaCarriesNoCanonicalFields, { message: META_SMUGGLE_MESSAGE, path: ["_meta"] }).refine(timeoutsAreExclusive, TIMEOUT_EXCLUSION);
|
|
5169
|
+
PromptRequestSchema = object({
|
|
5170
|
+
sessionId: string2().min(1),
|
|
5171
|
+
prompt: array(unknown()),
|
|
5172
|
+
model: string2().optional(),
|
|
5173
|
+
_meta: MetaSchema.optional()
|
|
5174
|
+
}).refine(metaCarriesNoCanonicalFields, { message: META_SMUGGLE_MESSAGE, path: ["_meta"] });
|
|
5175
|
+
CancelRequestSchema = object({
|
|
5176
|
+
sessionId: string2().min(1)
|
|
5177
|
+
});
|
|
5178
|
+
LoadSessionRequestSchema = object({
|
|
5179
|
+
sessionId: string2().min(1),
|
|
5180
|
+
cwd: AbsolutePathSchema,
|
|
5181
|
+
mcpServers: array(McpServerSchema),
|
|
5182
|
+
...SessionOptionFields
|
|
5183
|
+
}).refine(metaCarriesNoCanonicalFields, { message: META_SMUGGLE_MESSAGE, path: ["_meta"] }).refine(timeoutsAreExclusive, TIMEOUT_EXCLUSION);
|
|
5184
|
+
CompactSessionRequestSchema = object({
|
|
5185
|
+
sessionId: string2().min(1)
|
|
5186
|
+
});
|
|
5187
|
+
ForkSessionRequestSchema = object({
|
|
5188
|
+
sourceSessionId: string2().min(1),
|
|
5189
|
+
cwd: AbsolutePathSchema,
|
|
5190
|
+
mcpServers: array(McpServerSchema),
|
|
5191
|
+
systemPrompt: SystemPromptSchema.optional(),
|
|
5192
|
+
model: string2().optional(),
|
|
5193
|
+
additionalDirectories: array(AbsolutePathSchema).optional(),
|
|
5194
|
+
settingSources: SettingSourcesSchema.optional(),
|
|
5195
|
+
features: FeaturesSchema.optional(),
|
|
5196
|
+
_meta: MetaSchema.optional()
|
|
5197
|
+
}).refine(metaCarriesNoCanonicalFields, { message: META_SMUGGLE_MESSAGE, path: ["_meta"] });
|
|
5198
|
+
});
|
|
5199
|
+
|
|
5055
5200
|
// src/server/heartbeat.ts
|
|
5056
5201
|
class HeartbeatTimer {
|
|
5057
5202
|
options;
|
|
@@ -52791,6 +52936,12 @@ function launchArgv(options) {
|
|
|
52791
52936
|
if (options.systemPromptFile !== undefined) {
|
|
52792
52937
|
argv.push("--append-system-prompt-file", options.systemPromptFile);
|
|
52793
52938
|
}
|
|
52939
|
+
if (options.tools !== undefined) {
|
|
52940
|
+
argv.push("--tools", options.tools.join(","));
|
|
52941
|
+
}
|
|
52942
|
+
if (options.disallowedTools !== undefined && options.disallowedTools.length > 0) {
|
|
52943
|
+
argv.push("--disallowedTools", options.disallowedTools.join(","));
|
|
52944
|
+
}
|
|
52794
52945
|
if (options.model !== undefined) {
|
|
52795
52946
|
argv.push("--model", options.model);
|
|
52796
52947
|
}
|
|
@@ -53148,6 +53299,24 @@ var init_policy4 = __esm(() => {
|
|
|
53148
53299
|
});
|
|
53149
53300
|
|
|
53150
53301
|
// src/live/start-flags.ts
|
|
53302
|
+
function parsePaneFeatures(content, permissionMode) {
|
|
53303
|
+
let json;
|
|
53304
|
+
try {
|
|
53305
|
+
json = JSON.parse(content);
|
|
53306
|
+
} catch {
|
|
53307
|
+
return null;
|
|
53308
|
+
}
|
|
53309
|
+
const parsed = FeaturesSchema.safeParse(json);
|
|
53310
|
+
if (!parsed.success || parsed.data.simple === true) {
|
|
53311
|
+
return null;
|
|
53312
|
+
}
|
|
53313
|
+
const names = parsed.data.tools;
|
|
53314
|
+
if (names !== undefined && (names.length === 0 || !names.every((name) => TOOL_NAME2.test(name)))) {
|
|
53315
|
+
return null;
|
|
53316
|
+
}
|
|
53317
|
+
const translated = translateFeaturesToClaude(parsed.data, permissionMode);
|
|
53318
|
+
return { tools: translated.tools, disallowedTools: translated.disallowedTools, env: translated.env };
|
|
53319
|
+
}
|
|
53151
53320
|
function parseStartExtras(args) {
|
|
53152
53321
|
for (const key of Object.keys(args)) {
|
|
53153
53322
|
if (!START_FLAGS.has(key)) {
|
|
@@ -53190,8 +53359,10 @@ function parseSeconds(value, min) {
|
|
|
53190
53359
|
const seconds = Number(value);
|
|
53191
53360
|
return seconds >= min && seconds <= MAX_SECONDS ? seconds : null;
|
|
53192
53361
|
}
|
|
53193
|
-
var START_FLAGS, START_FILE_FLAGS, MAX_SECONDS = 2147483, DIGITS;
|
|
53362
|
+
var START_FLAGS, START_FILE_FLAGS, TOOL_NAME2, MAX_SECONDS = 2147483, DIGITS;
|
|
53194
53363
|
var init_start_flags = __esm(() => {
|
|
53364
|
+
init_features();
|
|
53365
|
+
init_schemas3();
|
|
53195
53366
|
START_FLAGS = new Set([
|
|
53196
53367
|
"pane",
|
|
53197
53368
|
"cwd",
|
|
@@ -53202,12 +53373,20 @@ var init_start_flags = __esm(() => {
|
|
|
53202
53373
|
"mcp-config",
|
|
53203
53374
|
"tool-policy",
|
|
53204
53375
|
"system-prompt-file",
|
|
53376
|
+
"features",
|
|
53205
53377
|
"permission-mode",
|
|
53206
53378
|
"one-shot",
|
|
53207
53379
|
"deadline-seconds",
|
|
53208
53380
|
"retain-failed-seconds"
|
|
53209
53381
|
]);
|
|
53210
|
-
START_FILE_FLAGS = [
|
|
53382
|
+
START_FILE_FLAGS = [
|
|
53383
|
+
"env-file",
|
|
53384
|
+
"tool-policy",
|
|
53385
|
+
"system-prompt-file",
|
|
53386
|
+
"mcp-config",
|
|
53387
|
+
"features"
|
|
53388
|
+
];
|
|
53389
|
+
TOOL_NAME2 = /^[A-Za-z][A-Za-z0-9_]{0,63}$/;
|
|
53211
53390
|
DIGITS = /^[0-9]+$/;
|
|
53212
53391
|
});
|
|
53213
53392
|
|
|
@@ -53414,7 +53593,7 @@ function isRecord5(value) {
|
|
|
53414
53593
|
var INTERRUPT_MARKER = "[Request interrupted by user]", INTERRUPT_TOOL_MARKER = "[Request interrupted by user for tool use]", NEWLINE = 10, USAGE_LIMIT_TEXT, LIMIT_RESETS, NOT_A_USAGE_LIMIT, STATUS_REASONS, API_ERROR_DETAIL_MAX = 200;
|
|
53415
53594
|
var init_transcript = __esm(() => {
|
|
53416
53595
|
init_events2();
|
|
53417
|
-
USAGE_LIMIT_TEXT = /\b(usage|session|weekly) limit\b|\bhit your\b[^.\n]*\blimit\b/i;
|
|
53596
|
+
USAGE_LIMIT_TEXT = /\b(usage|session|weekly) limit\b|\bhit your\b[^.\n]*\blimit\b|\bout of extra usage\b/i;
|
|
53418
53597
|
LIMIT_RESETS = /\bresets?\b/i;
|
|
53419
53598
|
NOT_A_USAGE_LIMIT = /\bnot your (usage )?limit\b/i;
|
|
53420
53599
|
STATUS_REASONS = {
|
|
@@ -54375,6 +54554,7 @@ class LiveDaemon {
|
|
|
54375
54554
|
const policyFile = args["tool-policy"];
|
|
54376
54555
|
const systemPromptFile = args["system-prompt-file"];
|
|
54377
54556
|
const mcpConfig = args["mcp-config"];
|
|
54557
|
+
const featuresFile = args.features;
|
|
54378
54558
|
if (id === undefined || !PANE_ID2.test(id) || cwd === undefined || !isAbsolute4(cwd)) {
|
|
54379
54559
|
return refuse("usage_error");
|
|
54380
54560
|
}
|
|
@@ -54385,7 +54565,7 @@ class LiveDaemon {
|
|
|
54385
54565
|
return refuse("usage_error");
|
|
54386
54566
|
}
|
|
54387
54567
|
const extras = parseStartExtras(args);
|
|
54388
|
-
if (extras === null || [policyFile, systemPromptFile, mcpConfig].some((path) => !optionalAbsolute(path))) {
|
|
54568
|
+
if (extras === null || [policyFile, systemPromptFile, mcpConfig, featuresFile].some((path) => !optionalAbsolute(path))) {
|
|
54389
54569
|
return refuse("usage_error");
|
|
54390
54570
|
}
|
|
54391
54571
|
if (this.panes.has(id) || this.starting.has(id)) {
|
|
@@ -54406,6 +54586,7 @@ class LiveDaemon {
|
|
|
54406
54586
|
policyFile,
|
|
54407
54587
|
systemPromptFile,
|
|
54408
54588
|
mcpConfig,
|
|
54589
|
+
featuresFile,
|
|
54409
54590
|
extras
|
|
54410
54591
|
});
|
|
54411
54592
|
} finally {
|
|
@@ -54413,7 +54594,19 @@ class LiveDaemon {
|
|
|
54413
54594
|
}
|
|
54414
54595
|
}
|
|
54415
54596
|
async open(request) {
|
|
54416
|
-
const {
|
|
54597
|
+
const {
|
|
54598
|
+
id,
|
|
54599
|
+
cwd,
|
|
54600
|
+
model,
|
|
54601
|
+
resume,
|
|
54602
|
+
envFile,
|
|
54603
|
+
settingsBase,
|
|
54604
|
+
policyFile,
|
|
54605
|
+
systemPromptFile,
|
|
54606
|
+
mcpConfig,
|
|
54607
|
+
featuresFile,
|
|
54608
|
+
extras
|
|
54609
|
+
} = request;
|
|
54417
54610
|
const content = await readSecretFile(envFile);
|
|
54418
54611
|
const env = content === null ? null : parseStartEnv(content);
|
|
54419
54612
|
if (env === null) {
|
|
@@ -54428,6 +54621,10 @@ class LiveDaemon {
|
|
|
54428
54621
|
if (policy === null) {
|
|
54429
54622
|
return refuse("usage_error");
|
|
54430
54623
|
}
|
|
54624
|
+
const features = featuresFile === undefined ? undefined : await readPaneFeatures(featuresFile, extras.permissionMode);
|
|
54625
|
+
if (features === null) {
|
|
54626
|
+
return refuse("usage_error");
|
|
54627
|
+
}
|
|
54431
54628
|
const mcpSpellings = mcpConfig === undefined ? [] : [...new Set([mcpConfig, await realpath4(mcpConfig)])];
|
|
54432
54629
|
const settingsPath = join7(settingsBase, `${id}.settings.json`);
|
|
54433
54630
|
await mkdir4(settingsBase, { recursive: true, mode: 448 });
|
|
@@ -54451,11 +54648,13 @@ class LiveDaemon {
|
|
|
54451
54648
|
cwd,
|
|
54452
54649
|
home: this.options.home,
|
|
54453
54650
|
settingsPath,
|
|
54454
|
-
env: env.authEnv,
|
|
54651
|
+
env: { ...env.authEnv, ...features?.env },
|
|
54455
54652
|
model,
|
|
54456
54653
|
resumeSessionId: resume,
|
|
54457
54654
|
mcpConfig,
|
|
54458
54655
|
systemPromptFile,
|
|
54656
|
+
tools: features?.tools,
|
|
54657
|
+
disallowedTools: features?.disallowedTools,
|
|
54459
54658
|
permissionMode: extras.permissionMode,
|
|
54460
54659
|
claudeBin: this.options.claudeBin,
|
|
54461
54660
|
socket: pane.socket,
|
|
@@ -54826,6 +55025,10 @@ async function readToolPolicy(path) {
|
|
|
54826
55025
|
const content = await readSecretFile(path);
|
|
54827
55026
|
return content === null ? null : parseToolPolicy(content);
|
|
54828
55027
|
}
|
|
55028
|
+
async function readPaneFeatures(path, permissionMode) {
|
|
55029
|
+
const content = await readSecretFile(path);
|
|
55030
|
+
return content === null ? null : parsePaneFeatures(content, permissionMode);
|
|
55031
|
+
}
|
|
54829
55032
|
async function readFileOrNull(path) {
|
|
54830
55033
|
return readFile4(path, "utf8").catch((error) => {
|
|
54831
55034
|
if (error.code === "ENOENT" || error.code === "EISDIR") {
|
|
@@ -55272,7 +55475,7 @@ Commands:
|
|
|
55272
55475
|
Verbs: start, prompt, command, cancel, stop, rotate-token, status.
|
|
55273
55476
|
start also takes --permission-mode default|dontAsk, --one-shot 0|1,
|
|
55274
55477
|
--deadline-seconds N, --retain-failed-seconds N and
|
|
55275
|
-
--mcp-config/--tool-policy/--system-prompt-file PATH.
|
|
55478
|
+
--mcp-config/--tool-policy/--system-prompt-file/--features PATH.
|
|
55276
55479
|
hook <Event> --pane <id> --socket <path> Hook helper the pane settings run; reads the payload on stdin.
|
|
55277
55480
|
daemon Run the daemon in the foreground; ctl start spawns it detached.
|
|
55278
55481
|
|
|
@@ -55320,151 +55523,8 @@ function ensureCapability(caps, required, method) {
|
|
|
55320
55523
|
throw new MethodNotSupportedError(method, supported);
|
|
55321
55524
|
}
|
|
55322
55525
|
|
|
55323
|
-
// src/wire/schemas.ts
|
|
55324
|
-
init_zod();
|
|
55325
|
-
var AbsolutePathSchema = string2().regex(/^\//, 'path must be absolute (start with "/")');
|
|
55326
|
-
var PLUGIN_ROOT = "/opt/kodizm/plugins/";
|
|
55327
|
-
var PluginPathSchema = AbsolutePathSchema.refine((path) => path.length > PLUGIN_ROOT.length && path.startsWith(PLUGIN_ROOT) && !path.split("/").includes(".."), { message: `plugin path must live under ${PLUGIN_ROOT} with no ".." segment` });
|
|
55328
|
-
var McpServerSchema = object({
|
|
55329
|
-
type: literal("http"),
|
|
55330
|
-
name: string2().min(1),
|
|
55331
|
-
url: string2().url(),
|
|
55332
|
-
headers: array(object({
|
|
55333
|
-
name: string2().min(1),
|
|
55334
|
-
value: string2()
|
|
55335
|
-
})).optional()
|
|
55336
|
-
});
|
|
55337
|
-
var SystemPromptSchema = union([
|
|
55338
|
-
string2(),
|
|
55339
|
-
object({
|
|
55340
|
-
append: string2(),
|
|
55341
|
-
excludeDynamicSections: boolean2().optional()
|
|
55342
|
-
})
|
|
55343
|
-
]);
|
|
55344
|
-
var MetaSchema = record(string2(), unknown());
|
|
55345
|
-
var CANONICAL_FIELDS_BANNED_IN_META = [
|
|
55346
|
-
"systemPrompt",
|
|
55347
|
-
"additionalDirectories",
|
|
55348
|
-
"mcpServers",
|
|
55349
|
-
"model",
|
|
55350
|
-
"skills",
|
|
55351
|
-
"cwd",
|
|
55352
|
-
"sessionId",
|
|
55353
|
-
"sourceSessionId",
|
|
55354
|
-
"toolPolicy",
|
|
55355
|
-
"autoCompact",
|
|
55356
|
-
"permissionTimeoutMs",
|
|
55357
|
-
"permissionDeferTimeoutMs",
|
|
55358
|
-
"debug",
|
|
55359
|
-
"debugCaptureRawSdk",
|
|
55360
|
-
"debugCaptureRpc",
|
|
55361
|
-
"heartbeatIntervalMs",
|
|
55362
|
-
"inactivityThresholdMs",
|
|
55363
|
-
"settingSources",
|
|
55364
|
-
"features",
|
|
55365
|
-
"plugins"
|
|
55366
|
-
];
|
|
55367
|
-
var SettingSourcesSchema = array(_enum(["user", "project", "local"]));
|
|
55368
|
-
var PermissionModeSchema = _enum(["default", "acceptEdits", "plan", "dontAsk", "bypassPermissions"]);
|
|
55369
|
-
var ToolPolicySchema = object({
|
|
55370
|
-
allow: array(string2()).optional(),
|
|
55371
|
-
deny: array(string2()).optional(),
|
|
55372
|
-
ask: array(string2()).optional(),
|
|
55373
|
-
defaultMode: PermissionModeSchema.optional()
|
|
55374
|
-
});
|
|
55375
|
-
var FeaturesSchema = object({
|
|
55376
|
-
todos: boolean2().optional(),
|
|
55377
|
-
subagents: boolean2().optional(),
|
|
55378
|
-
backgroundTasks: boolean2().optional(),
|
|
55379
|
-
scheduling: boolean2().optional(),
|
|
55380
|
-
planMode: boolean2().optional(),
|
|
55381
|
-
worktree: boolean2().optional(),
|
|
55382
|
-
notebook: boolean2().optional(),
|
|
55383
|
-
clientTools: boolean2().optional(),
|
|
55384
|
-
autoMemory: boolean2().optional(),
|
|
55385
|
-
bundledSkills: boolean2().optional(),
|
|
55386
|
-
simple: boolean2().optional(),
|
|
55387
|
-
tools: array(string2().min(1)).optional()
|
|
55388
|
-
});
|
|
55389
|
-
function metaCarriesNoCanonicalFields(data) {
|
|
55390
|
-
if (data._meta === undefined) {
|
|
55391
|
-
return true;
|
|
55392
|
-
}
|
|
55393
|
-
for (const banned of CANONICAL_FIELDS_BANNED_IN_META) {
|
|
55394
|
-
if (banned in data._meta) {
|
|
55395
|
-
return false;
|
|
55396
|
-
}
|
|
55397
|
-
}
|
|
55398
|
-
return true;
|
|
55399
|
-
}
|
|
55400
|
-
var META_SMUGGLE_MESSAGE = "canonical fields (systemPrompt, additionalDirectories, mcpServers, model, skills, cwd) must be top-level, not nested in _meta";
|
|
55401
|
-
var InitializeRequestSchema = object({
|
|
55402
|
-
protocolVersion: number2().int().positive(),
|
|
55403
|
-
clientCapabilities: record(string2(), unknown()).optional(),
|
|
55404
|
-
_meta: MetaSchema.optional()
|
|
55405
|
-
});
|
|
55406
|
-
var SessionOptionFields = {
|
|
55407
|
-
additionalDirectories: array(AbsolutePathSchema).optional(),
|
|
55408
|
-
plugins: array(PluginPathSchema).optional(),
|
|
55409
|
-
systemPrompt: SystemPromptSchema.optional(),
|
|
55410
|
-
model: string2().optional(),
|
|
55411
|
-
skills: array(string2()).optional(),
|
|
55412
|
-
toolPolicy: ToolPolicySchema.optional(),
|
|
55413
|
-
autoCompact: boolean2().optional(),
|
|
55414
|
-
permissionTimeoutMs: number2().int().positive().optional(),
|
|
55415
|
-
permissionDeferTimeoutMs: number2().int().positive().optional(),
|
|
55416
|
-
debug: boolean2().optional(),
|
|
55417
|
-
debugCaptureRawSdk: boolean2().optional(),
|
|
55418
|
-
debugCaptureRpc: boolean2().optional(),
|
|
55419
|
-
heartbeatIntervalMs: number2().int().positive().optional(),
|
|
55420
|
-
inactivityThresholdMs: number2().int().positive().optional(),
|
|
55421
|
-
settingSources: SettingSourcesSchema.optional(),
|
|
55422
|
-
features: FeaturesSchema.optional(),
|
|
55423
|
-
_meta: MetaSchema.optional()
|
|
55424
|
-
};
|
|
55425
|
-
var TIMEOUT_EXCLUSION = {
|
|
55426
|
-
message: "permissionTimeoutMs and permissionDeferTimeoutMs are mutually exclusive (pick hard-deny on timeout OR soft-defer on timeout)",
|
|
55427
|
-
path: ["permissionDeferTimeoutMs"]
|
|
55428
|
-
};
|
|
55429
|
-
function timeoutsAreExclusive(data) {
|
|
55430
|
-
return !(data.permissionTimeoutMs !== undefined && data.permissionDeferTimeoutMs !== undefined);
|
|
55431
|
-
}
|
|
55432
|
-
var NewSessionRequestSchema = object({
|
|
55433
|
-
cwd: AbsolutePathSchema,
|
|
55434
|
-
mcpServers: array(McpServerSchema),
|
|
55435
|
-
...SessionOptionFields
|
|
55436
|
-
}).refine(metaCarriesNoCanonicalFields, { message: META_SMUGGLE_MESSAGE, path: ["_meta"] }).refine(timeoutsAreExclusive, TIMEOUT_EXCLUSION);
|
|
55437
|
-
var PromptRequestSchema = object({
|
|
55438
|
-
sessionId: string2().min(1),
|
|
55439
|
-
prompt: array(unknown()),
|
|
55440
|
-
model: string2().optional(),
|
|
55441
|
-
_meta: MetaSchema.optional()
|
|
55442
|
-
}).refine(metaCarriesNoCanonicalFields, { message: META_SMUGGLE_MESSAGE, path: ["_meta"] });
|
|
55443
|
-
var CancelRequestSchema = object({
|
|
55444
|
-
sessionId: string2().min(1)
|
|
55445
|
-
});
|
|
55446
|
-
var LoadSessionRequestSchema = object({
|
|
55447
|
-
sessionId: string2().min(1),
|
|
55448
|
-
cwd: AbsolutePathSchema,
|
|
55449
|
-
mcpServers: array(McpServerSchema),
|
|
55450
|
-
...SessionOptionFields
|
|
55451
|
-
}).refine(metaCarriesNoCanonicalFields, { message: META_SMUGGLE_MESSAGE, path: ["_meta"] }).refine(timeoutsAreExclusive, TIMEOUT_EXCLUSION);
|
|
55452
|
-
var CompactSessionRequestSchema = object({
|
|
55453
|
-
sessionId: string2().min(1)
|
|
55454
|
-
});
|
|
55455
|
-
var ForkSessionRequestSchema = object({
|
|
55456
|
-
sourceSessionId: string2().min(1),
|
|
55457
|
-
cwd: AbsolutePathSchema,
|
|
55458
|
-
mcpServers: array(McpServerSchema),
|
|
55459
|
-
systemPrompt: SystemPromptSchema.optional(),
|
|
55460
|
-
model: string2().optional(),
|
|
55461
|
-
additionalDirectories: array(AbsolutePathSchema).optional(),
|
|
55462
|
-
settingSources: SettingSourcesSchema.optional(),
|
|
55463
|
-
features: FeaturesSchema.optional(),
|
|
55464
|
-
_meta: MetaSchema.optional()
|
|
55465
|
-
}).refine(metaCarriesNoCanonicalFields, { message: META_SMUGGLE_MESSAGE, path: ["_meta"] });
|
|
55466
|
-
|
|
55467
55526
|
// src/server/acp-server.ts
|
|
55527
|
+
init_schemas3();
|
|
55468
55528
|
init_errors();
|
|
55469
55529
|
var JsonRpcErrorCode2 = {
|
|
55470
55530
|
ParseError: -32700,
|