@kodizm/acp 0.8.0 → 0.8.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.
Files changed (2) hide show
  1. package/dist/index.js +47 -16
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -45544,7 +45544,7 @@ class OpencodeEventMapper {
45544
45544
  toPascalCase(name) {
45545
45545
  if (name.length === 0)
45546
45546
  return name;
45547
- return name.split("_").map((part) => part.length === 0 ? part : part[0].toUpperCase() + part.slice(1)).join("");
45547
+ return name.split("_").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
45548
45548
  }
45549
45549
  formatSubagentModel(model) {
45550
45550
  if (typeof model.providerID === "string" && typeof model.modelID === "string") {
@@ -51509,7 +51509,7 @@ function canonicalToolName(opencodePermission, mcpReverseMap) {
51509
51509
  const canonical = reverseToolName(opencodePermission, mcpReverseMap);
51510
51510
  if (canonical !== null)
51511
51511
  return canonical;
51512
- return opencodePermission.split("_").map((part) => part.length === 0 ? part : part[0].toUpperCase() + part.slice(1)).join("");
51512
+ return opencodePermission.split("_").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
51513
51513
  }
51514
51514
  async function safeReply2(sdk, requestId, body) {
51515
51515
  try {
@@ -52152,6 +52152,8 @@ var init_redact = __esm(() => {
52152
52152
  /kgw-[A-Za-z0-9]{8,}/g,
52153
52153
  /sk-ant-[\w-]+/g,
52154
52154
  /kdz-int-jwt\.[\w.-]+/g,
52155
+ /gh[pousr]_[A-Za-z0-9]{20,}/g,
52156
+ /github_pat_\w{20,}/g,
52155
52157
  /-----BEGIN[\s\S]*?(?:-----END[^\n]*?-----|$)/g
52156
52158
  ];
52157
52159
  URL_CREDENTIAL = /(x-access-token:)[^@\s/]+@/g;
@@ -53116,6 +53118,17 @@ class EventQueue {
53116
53118
  if (response.status === 409 && error.code === "seq_gap" && typeof error.expectedSeq === "number") {
53117
53119
  return this.acknowledge(error.expectedSeq - 1);
53118
53120
  }
53121
+ if (response.status === 410 && error.code === "session_closed") {
53122
+ this.options.logger.warn("tmuxd ingest says the session has ended", { gen: this.options.gen });
53123
+ return "stale";
53124
+ }
53125
+ if (response.status === 422) {
53126
+ this.options.logger.error("tmuxd ingest rejected the event stream as malformed", {
53127
+ gen: this.options.gen,
53128
+ code: error.code
53129
+ });
53130
+ return "stale";
53131
+ }
53119
53132
  this.options.logger.warn("tmuxd event push failed", {
53120
53133
  gen: this.options.gen,
53121
53134
  status: response.status,
@@ -53372,18 +53385,8 @@ class LivePane {
53372
53385
  }
53373
53386
  async askIngest(request, signal) {
53374
53387
  const timings = this.daemon.timings;
53375
- const opened = await fetchJson(`${this.ingestUrl}/permissions`, {
53376
- method: "POST",
53377
- bearer: this.token,
53378
- body: redactDeep({
53379
- gen: this.gen,
53380
- ...request
53381
- }, this.secrets),
53382
- timeoutMs: timings.ingestTimeoutMs,
53383
- signal
53384
- });
53385
- if (opened.status !== 200 && opened.status !== 201) {
53386
- this.daemon.logger.warn("tmuxd permission open failed", { pane: this.id, status: opened.status });
53388
+ const opened = await this.openPermission(request, signal);
53389
+ if (opened === undefined) {
53387
53390
  return;
53388
53391
  }
53389
53392
  const immediate = decisionFrom(opened.body);
@@ -53419,6 +53422,33 @@ class LivePane {
53419
53422
  }
53420
53423
  return;
53421
53424
  }
53425
+ async openPermission(request, signal) {
53426
+ const timings = this.daemon.timings;
53427
+ const deadline = Date.now() + timings.permissionOpenRetryMs;
53428
+ let failures = 0;
53429
+ for (;; ) {
53430
+ const opened = await fetchJson(`${this.ingestUrl}/permissions`, {
53431
+ method: "POST",
53432
+ bearer: this.token,
53433
+ body: redactDeep({
53434
+ gen: this.gen,
53435
+ ...request
53436
+ }, this.secrets),
53437
+ timeoutMs: timings.ingestTimeoutMs,
53438
+ signal
53439
+ });
53440
+ if (opened.status === 200 || opened.status === 201) {
53441
+ return opened;
53442
+ }
53443
+ const transient = opened.status === 0 || opened.status === 429 || opened.status >= 500;
53444
+ if (!transient || signal.aborted || Date.now() >= deadline) {
53445
+ this.daemon.logger.warn("tmuxd permission open failed", { pane: this.id, status: opened.status });
53446
+ return;
53447
+ }
53448
+ failures += 1;
53449
+ await Bun.sleep(Math.min(timings.retryMaxMs, timings.retryBaseMs * 2 ** (failures - 1)));
53450
+ }
53451
+ }
53422
53452
  closeTool(payload, status, output) {
53423
53453
  const toolCallId = text(payload.tool_use_id) ?? this.findOpenTool(payload);
53424
53454
  if (this.dialog !== undefined && this.isDialogOf(this.dialog, payload, toolCallId)) {
@@ -54237,7 +54267,7 @@ function notRunning(id) {
54237
54267
  running: false
54238
54268
  });
54239
54269
  }
54240
- var HEARTBEAT_INTERVAL_MS = 20000, WATCHDOG_QUIET_MS = 30000, CANCEL_TIMEOUT_MS = 3000, PERMISSION_POLL_MS = 1500, INGEST_TIMEOUT_MS = 1e4, MAX_BATCH = 200, DEFAULT_MAX_PANES = 4, STOP_DRAIN_MS = 1e4, PERMISSION_WAIT_MS, MIN_SECRET_LENGTH = 8, MAX_REQUEST_BYTES, PANE_ID2, ENV_KEY, LIVE_KEY_PREFIX = "KODIZM_LIVE_", TOKEN_PREFIX = "kdz-int-jwt.", COMMAND_NAMES, REJECTION_RULES, EXIT_CODES, DEFAULT_TIMINGS;
54270
+ var HEARTBEAT_INTERVAL_MS = 20000, WATCHDOG_QUIET_MS = 30000, CANCEL_TIMEOUT_MS = 3000, PERMISSION_POLL_MS = 1500, INGEST_TIMEOUT_MS = 1e4, MAX_BATCH = 200, DEFAULT_MAX_PANES = 4, STOP_DRAIN_MS = 1e4, PERMISSION_WAIT_MS, PERMISSION_OPEN_RETRY_MS = 90000, MIN_SECRET_LENGTH = 8, MAX_REQUEST_BYTES, PANE_ID2, ENV_KEY, LIVE_KEY_PREFIX = "KODIZM_LIVE_", TOKEN_PREFIX = "kdz-int-jwt.", COMMAND_NAMES, REJECTION_RULES, EXIT_CODES, DEFAULT_TIMINGS;
54241
54271
  var init_daemon = __esm(() => {
54242
54272
  init_logger();
54243
54273
  init_events2();
@@ -54273,6 +54303,7 @@ var init_daemon = __esm(() => {
54273
54303
  watchdogQuietMs: WATCHDOG_QUIET_MS,
54274
54304
  cancelTimeoutMs: CANCEL_TIMEOUT_MS,
54275
54305
  permissionPollMs: PERMISSION_POLL_MS,
54306
+ permissionOpenRetryMs: PERMISSION_OPEN_RETRY_MS,
54276
54307
  ingestTimeoutMs: INGEST_TIMEOUT_MS,
54277
54308
  monitorMs: 2000,
54278
54309
  transcriptPollMs: 250,
@@ -54493,7 +54524,7 @@ Environment:
54493
54524
  // package.json
54494
54525
  var package_default = {
54495
54526
  name: "@kodizm/acp",
54496
- version: "0.8.0",
54527
+ version: "0.8.1",
54497
54528
  description: "Custom ACP server bridging Claude Code and opencode CLIs through a single Kodizm-flavored protocol surface.",
54498
54529
  type: "module",
54499
54530
  bin: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kodizm/acp",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Custom ACP server bridging Claude Code and opencode CLIs through a single Kodizm-flavored protocol surface.",
5
5
  "type": "module",
6
6
  "bin": {