@kodizm/acp 0.6.7 → 0.6.8

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.
Files changed (2) hide show
  1. package/dist/index.js +112 -24
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5706,6 +5706,57 @@ function mapResult(sessionId, message) {
5706
5706
  return events;
5707
5707
  }
5708
5708
 
5709
+ // src/backends/claude/features.ts
5710
+ function translateFeaturesToClaude(features, permissionMode) {
5711
+ const out = { disallowedTools: [], env: {} };
5712
+ if (features === undefined) {
5713
+ return out;
5714
+ }
5715
+ for (const [family, envName] of Object.entries(FAMILY_ENV)) {
5716
+ if (features[family] === false && envName !== undefined) {
5717
+ out.env[envName] = "1";
5718
+ }
5719
+ }
5720
+ if (features.simple === true) {
5721
+ out.tools = [...SIMPLE_MODE_TOOLS];
5722
+ out.settingSources = [];
5723
+ out.strictMcpConfig = true;
5724
+ return out;
5725
+ }
5726
+ for (const [family, tools] of Object.entries(FAMILY_TOOLS)) {
5727
+ if (features[family] !== false) {
5728
+ continue;
5729
+ }
5730
+ for (const tool of tools) {
5731
+ if (tool === "ExitPlanMode" && permissionMode === "plan") {
5732
+ continue;
5733
+ }
5734
+ out.disallowedTools.push(tool);
5735
+ }
5736
+ }
5737
+ return out;
5738
+ }
5739
+ var FAMILY_TOOLS, FAMILY_ENV, SIMPLE_MODE_TOOLS;
5740
+ var init_features = __esm(() => {
5741
+ FAMILY_TOOLS = {
5742
+ todos: ["TodoWrite", "TaskCreate", "TaskGet", "TaskUpdate", "TaskList"],
5743
+ subagents: ["Agent", "Task", "SendMessage", "ListAgents"],
5744
+ scheduling: ["Monitor", "CronCreate", "CronDelete", "CronList", "ScheduleWakeup", "RemoteTrigger"],
5745
+ backgroundTasks: ["TaskStop"],
5746
+ planMode: ["EnterPlanMode", "ExitPlanMode"],
5747
+ worktree: ["EnterWorktree", "ExitWorktree"],
5748
+ notebook: ["NotebookEdit"],
5749
+ clientTools: ["DesignSync", "PushNotification", "ShareOnboardingGuide", "ReportFindings"]
5750
+ };
5751
+ FAMILY_ENV = {
5752
+ scheduling: "CLAUDE_CODE_DISABLE_CRON",
5753
+ backgroundTasks: "CLAUDE_CODE_DISABLE_BACKGROUND_TASKS",
5754
+ autoMemory: "CLAUDE_CODE_DISABLE_AUTO_MEMORY",
5755
+ bundledSkills: "CLAUDE_CODE_DISABLE_BUNDLED_SKILLS"
5756
+ };
5757
+ SIMPLE_MODE_TOOLS = ["WebFetch", "WebSearch"];
5758
+ });
5759
+
5709
5760
  // src/backends/claude/mcp-bridge.ts
5710
5761
  function translateMcpServers(servers) {
5711
5762
  const out = {};
@@ -6030,24 +6081,32 @@ class ClaudeDriver {
6030
6081
  this.sessions.set(sessionId, {
6031
6082
  sessionId,
6032
6083
  options,
6084
+ ...this.sessionTimings(params)
6085
+ });
6086
+ return { sessionId };
6087
+ }
6088
+ sessionTimings(params) {
6089
+ return {
6033
6090
  ...params.permissionTimeoutMs === undefined ? {} : { permissionTimeoutMs: params.permissionTimeoutMs },
6034
6091
  ...params.permissionDeferTimeoutMs === undefined ? {} : { permissionDeferTimeoutMs: params.permissionDeferTimeoutMs },
6035
6092
  ...params.heartbeatIntervalMs === undefined ? {} : { heartbeatIntervalMs: params.heartbeatIntervalMs },
6036
6093
  ...params.inactivityThresholdMs === undefined ? {} : { inactivityThresholdMs: params.inactivityThresholdMs }
6037
- });
6038
- return { sessionId };
6094
+ };
6039
6095
  }
6040
6096
  async loadSession(params) {
6041
6097
  const existing = this.sessions.get(params.sessionId);
6042
6098
  const resumeKey = existing?.sdkSessionId ?? params.sessionId;
6043
6099
  const options = {
6044
6100
  ...this.buildBaseSdkOptions(params),
6101
+ ...params.systemPrompt === undefined ? {} : { systemPrompt: this.buildSystemPrompt(params.systemPrompt) },
6102
+ ...params.model === undefined ? {} : { model: params.model },
6045
6103
  resume: resumeKey
6046
6104
  };
6047
6105
  this.sessions.set(params.sessionId, {
6048
6106
  sessionId: params.sessionId,
6049
6107
  options,
6050
- sdkSessionId: existing?.sdkSessionId
6108
+ sdkSessionId: existing?.sdkSessionId,
6109
+ ...this.sessionTimings(params)
6051
6110
  });
6052
6111
  return { sessionId: params.sessionId };
6053
6112
  }
@@ -6369,10 +6428,15 @@ class ClaudeDriver {
6369
6428
  const additional = "additionalDirectories" in params && params.additionalDirectories !== undefined ? { additionalDirectories: [...params.additionalDirectories] } : {};
6370
6429
  const skills = "skills" in params && params.skills !== undefined && params.skills.length > 0 ? { skills: [...params.skills] } : {};
6371
6430
  const policyTranslation = "toolPolicy" in params && params.toolPolicy !== undefined ? translateToolPolicyToClaude(params.toolPolicy) : {};
6431
+ const permissionMode = policyTranslation.permissionMode ?? "bypassPermissions";
6432
+ const featureTranslation = translateFeaturesToClaude("features" in params ? params.features : undefined, permissionMode);
6433
+ const disallowedTools = [
6434
+ ...new Set([...policyTranslation.disallowedTools ?? [], ...featureTranslation.disallowedTools])
6435
+ ];
6372
6436
  const policyOptions = {
6373
6437
  ...policyTranslation.allowedTools !== undefined ? { allowedTools: policyTranslation.allowedTools } : {},
6374
- ...policyTranslation.disallowedTools !== undefined ? { disallowedTools: policyTranslation.disallowedTools } : {},
6375
- permissionMode: policyTranslation.permissionMode ?? "bypassPermissions",
6438
+ ...disallowedTools.length > 0 ? { disallowedTools } : {},
6439
+ permissionMode,
6376
6440
  ...policyTranslation.askRules !== undefined && policyTranslation.askRules.length > 0 ? {
6377
6441
  permissions: {
6378
6442
  rules: [
@@ -6386,21 +6450,22 @@ class ClaudeDriver {
6386
6450
  }
6387
6451
  } : {}
6388
6452
  };
6389
- const compactEnv = "autoCompact" in params && params.autoCompact === false ? {
6390
- env: {
6391
- ...process.env,
6392
- DISABLE_AUTO_COMPACT: "1"
6393
- }
6394
- } : {};
6395
- const settingSourcesOpt = "settingSources" in params && params.settingSources !== undefined ? { settingSources: [...params.settingSources] } : {};
6453
+ const extraEnv = {
6454
+ ...featureTranslation.env,
6455
+ ..."autoCompact" in params && params.autoCompact === false ? { DISABLE_AUTO_COMPACT: "1" } : {}
6456
+ };
6457
+ const envOpt = Object.keys(extraEnv).length > 0 ? { env: { ...process.env, ...extraEnv } } : {};
6458
+ const settingSourcesOpt = "settingSources" in params && params.settingSources !== undefined ? { settingSources: [...params.settingSources] } : featureTranslation.settingSources !== undefined ? { settingSources: featureTranslation.settingSources } : {};
6396
6459
  return {
6397
6460
  cwd: params.cwd,
6398
6461
  mcpServers: translateMcpServers(params.mcpServers),
6399
6462
  ...additional,
6400
6463
  ...skills,
6401
6464
  ...policyOptions,
6402
- ...compactEnv,
6403
- ...settingSourcesOpt
6465
+ ...envOpt,
6466
+ ...settingSourcesOpt,
6467
+ ...featureTranslation.tools !== undefined ? { tools: featureTranslation.tools } : {},
6468
+ ...featureTranslation.strictMcpConfig !== undefined ? { strictMcpConfig: featureTranslation.strictMcpConfig } : {}
6404
6469
  };
6405
6470
  }
6406
6471
  buildSystemPrompt(input) {
@@ -6442,6 +6507,7 @@ var init_driver = __esm(() => {
6442
6507
  init_ask_user_question();
6443
6508
  init_deferred_permission();
6444
6509
  init_error_classifier();
6510
+ init_features();
6445
6511
  init_permission_bridge();
6446
6512
  init_policy2();
6447
6513
  init_prompt_input();
@@ -52057,7 +52123,7 @@ var init_driver2 = __esm(() => {
52057
52123
  // package.json
52058
52124
  var package_default = {
52059
52125
  name: "@kodizm/acp",
52060
- version: "0.6.7",
52126
+ version: "0.6.8",
52061
52127
  description: "Custom ACP server bridging Claude Code, codex, and opencode CLIs through a single Kodizm-flavored protocol surface.",
52062
52128
  type: "module",
52063
52129
  bin: {
@@ -52173,7 +52239,8 @@ var CANONICAL_FIELDS_BANNED_IN_META = [
52173
52239
  "debugCaptureRpc",
52174
52240
  "heartbeatIntervalMs",
52175
52241
  "inactivityThresholdMs",
52176
- "settingSources"
52242
+ "settingSources",
52243
+ "features"
52177
52244
  ];
52178
52245
  var SettingSourcesSchema = array(_enum(["user", "project", "local"]));
52179
52246
  var PermissionModeSchema = _enum(["default", "acceptEdits", "plan", "dontAsk", "bypassPermissions"]);
@@ -52183,6 +52250,19 @@ var ToolPolicySchema = object({
52183
52250
  ask: array(string2()).optional(),
52184
52251
  defaultMode: PermissionModeSchema.optional()
52185
52252
  });
52253
+ var FeaturesSchema = object({
52254
+ todos: boolean2().optional(),
52255
+ subagents: boolean2().optional(),
52256
+ backgroundTasks: boolean2().optional(),
52257
+ scheduling: boolean2().optional(),
52258
+ planMode: boolean2().optional(),
52259
+ worktree: boolean2().optional(),
52260
+ notebook: boolean2().optional(),
52261
+ clientTools: boolean2().optional(),
52262
+ autoMemory: boolean2().optional(),
52263
+ bundledSkills: boolean2().optional(),
52264
+ simple: boolean2().optional()
52265
+ });
52186
52266
  function metaCarriesNoCanonicalFields(data) {
52187
52267
  if (data._meta === undefined) {
52188
52268
  return true;
@@ -52200,9 +52280,7 @@ var InitializeRequestSchema = object({
52200
52280
  clientCapabilities: record(string2(), unknown()).optional(),
52201
52281
  _meta: MetaSchema.optional()
52202
52282
  });
52203
- var NewSessionRequestSchema = object({
52204
- cwd: AbsolutePathSchema,
52205
- mcpServers: array(McpServerSchema),
52283
+ var SessionOptionFields = {
52206
52284
  additionalDirectories: array(AbsolutePathSchema).optional(),
52207
52285
  systemPrompt: SystemPromptSchema.optional(),
52208
52286
  model: string2().optional(),
@@ -52217,11 +52295,21 @@ var NewSessionRequestSchema = object({
52217
52295
  heartbeatIntervalMs: number2().int().positive().optional(),
52218
52296
  inactivityThresholdMs: number2().int().positive().optional(),
52219
52297
  settingSources: SettingSourcesSchema.optional(),
52298
+ features: FeaturesSchema.optional(),
52220
52299
  _meta: MetaSchema.optional()
52221
- }).refine(metaCarriesNoCanonicalFields, { message: META_SMUGGLE_MESSAGE, path: ["_meta"] }).refine((data) => !(data.permissionTimeoutMs !== undefined && data.permissionDeferTimeoutMs !== undefined), {
52300
+ };
52301
+ var TIMEOUT_EXCLUSION = {
52222
52302
  message: "permissionTimeoutMs and permissionDeferTimeoutMs are mutually exclusive (pick hard-deny on timeout OR soft-defer on timeout)",
52223
52303
  path: ["permissionDeferTimeoutMs"]
52224
- });
52304
+ };
52305
+ function timeoutsAreExclusive(data) {
52306
+ return !(data.permissionTimeoutMs !== undefined && data.permissionDeferTimeoutMs !== undefined);
52307
+ }
52308
+ var NewSessionRequestSchema = object({
52309
+ cwd: AbsolutePathSchema,
52310
+ mcpServers: array(McpServerSchema),
52311
+ ...SessionOptionFields
52312
+ }).refine(metaCarriesNoCanonicalFields, { message: META_SMUGGLE_MESSAGE, path: ["_meta"] }).refine(timeoutsAreExclusive, TIMEOUT_EXCLUSION);
52225
52313
  var PromptRequestSchema = object({
52226
52314
  sessionId: string2().min(1),
52227
52315
  prompt: array(unknown()),
@@ -52235,9 +52323,8 @@ var LoadSessionRequestSchema = object({
52235
52323
  sessionId: string2().min(1),
52236
52324
  cwd: AbsolutePathSchema,
52237
52325
  mcpServers: array(McpServerSchema),
52238
- settingSources: SettingSourcesSchema.optional(),
52239
- _meta: MetaSchema.optional()
52240
- }).refine(metaCarriesNoCanonicalFields, { message: META_SMUGGLE_MESSAGE, path: ["_meta"] });
52326
+ ...SessionOptionFields
52327
+ }).refine(metaCarriesNoCanonicalFields, { message: META_SMUGGLE_MESSAGE, path: ["_meta"] }).refine(timeoutsAreExclusive, TIMEOUT_EXCLUSION);
52241
52328
  var CompactSessionRequestSchema = object({
52242
52329
  sessionId: string2().min(1)
52243
52330
  });
@@ -52249,6 +52336,7 @@ var ForkSessionRequestSchema = object({
52249
52336
  model: string2().optional(),
52250
52337
  additionalDirectories: array(AbsolutePathSchema).optional(),
52251
52338
  settingSources: SettingSourcesSchema.optional(),
52339
+ features: FeaturesSchema.optional(),
52252
52340
  _meta: MetaSchema.optional()
52253
52341
  }).refine(metaCarriesNoCanonicalFields, { message: META_SMUGGLE_MESSAGE, path: ["_meta"] });
52254
52342
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kodizm/acp",
3
- "version": "0.6.7",
3
+ "version": "0.6.8",
4
4
  "description": "Custom ACP server bridging Claude Code, codex, and opencode CLIs through a single Kodizm-flavored protocol surface.",
5
5
  "type": "module",
6
6
  "bin": {