@kodizm/acp 0.6.0 → 0.6.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 +59 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -55643,6 +55643,41 @@ Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resour
|
|
|
55643
55643
|
iVe = new Set(["EBUSY", "EMFILE", "ENFILE", "ENOTEMPTY", "EPERM"]);
|
|
55644
55644
|
});
|
|
55645
55645
|
|
|
55646
|
+
// src/util/logger.ts
|
|
55647
|
+
function createLogger(options) {
|
|
55648
|
+
const raw = options.env.KODIZM_LOG_LEVEL;
|
|
55649
|
+
const configured = raw && raw in LEVEL_ORDER ? raw : "info";
|
|
55650
|
+
const threshold = LEVEL_ORDER[configured];
|
|
55651
|
+
const emit = (level, message, meta3) => {
|
|
55652
|
+
if (LEVEL_ORDER[level] < threshold) {
|
|
55653
|
+
return;
|
|
55654
|
+
}
|
|
55655
|
+
const line = JSON.stringify({
|
|
55656
|
+
level,
|
|
55657
|
+
message,
|
|
55658
|
+
timestamp: new Date().toISOString(),
|
|
55659
|
+
...meta3 ?? {}
|
|
55660
|
+
});
|
|
55661
|
+
process.stderr.write(`${line}
|
|
55662
|
+
`);
|
|
55663
|
+
};
|
|
55664
|
+
return {
|
|
55665
|
+
debug: (message, meta3) => emit("debug", message, meta3),
|
|
55666
|
+
info: (message, meta3) => emit("info", message, meta3),
|
|
55667
|
+
warn: (message, meta3) => emit("warn", message, meta3),
|
|
55668
|
+
error: (message, meta3) => emit("error", message, meta3)
|
|
55669
|
+
};
|
|
55670
|
+
}
|
|
55671
|
+
var LEVEL_ORDER;
|
|
55672
|
+
var init_logger = __esm(() => {
|
|
55673
|
+
LEVEL_ORDER = {
|
|
55674
|
+
debug: 10,
|
|
55675
|
+
info: 20,
|
|
55676
|
+
warn: 30,
|
|
55677
|
+
error: 40
|
|
55678
|
+
};
|
|
55679
|
+
});
|
|
55680
|
+
|
|
55646
55681
|
// src/backends/opencode/ask-user-question.ts
|
|
55647
55682
|
async function handleOpencodeQuestion(args) {
|
|
55648
55683
|
const kodizmQuestions = [];
|
|
@@ -62901,6 +62936,7 @@ class OpencodeDriver {
|
|
|
62901
62936
|
const subscriptionPromise = this.runEventLoop({
|
|
62902
62937
|
handle: state.handle,
|
|
62903
62938
|
controller,
|
|
62939
|
+
directory: state.configSnapshot.cwd,
|
|
62904
62940
|
handlers: {
|
|
62905
62941
|
onMessageBus: (method, properties) => eventMapper.handle(method, properties),
|
|
62906
62942
|
onPermissionAsked: (properties) => {
|
|
@@ -62928,8 +62964,11 @@ class OpencodeDriver {
|
|
|
62928
62964
|
signal: controller.signal
|
|
62929
62965
|
});
|
|
62930
62966
|
},
|
|
62931
|
-
onSessionError: () => {
|
|
62932
|
-
|
|
62967
|
+
onSessionError: (properties) => {
|
|
62968
|
+
logger.error("opencode session.error on the event bus", {
|
|
62969
|
+
sessionId,
|
|
62970
|
+
properties: JSON.stringify(properties).slice(0, 400)
|
|
62971
|
+
});
|
|
62933
62972
|
}
|
|
62934
62973
|
}
|
|
62935
62974
|
});
|
|
@@ -62984,17 +63023,27 @@ class OpencodeDriver {
|
|
|
62984
63023
|
}
|
|
62985
63024
|
async runEventLoop(args) {
|
|
62986
63025
|
const eventApi = args.handle.sdk.event;
|
|
62987
|
-
if (typeof eventApi.subscribe !== "function")
|
|
63026
|
+
if (typeof eventApi.subscribe !== "function") {
|
|
63027
|
+
logger.error("opencode sdk exposes no event.subscribe; no session events will be mapped");
|
|
62988
63028
|
return;
|
|
63029
|
+
}
|
|
62989
63030
|
let result;
|
|
62990
63031
|
try {
|
|
62991
|
-
result = await eventApi.subscribe({}, { signal: args.controller.signal });
|
|
62992
|
-
} catch {
|
|
63032
|
+
result = await eventApi.subscribe({ directory: args.directory }, { signal: args.controller.signal });
|
|
63033
|
+
} catch (e) {
|
|
63034
|
+
logger.error("opencode event.subscribe rejected; the turn will emit no content", {
|
|
63035
|
+
error: e instanceof Error ? e.message : String(e),
|
|
63036
|
+
directory: args.directory
|
|
63037
|
+
});
|
|
62993
63038
|
return;
|
|
62994
63039
|
}
|
|
62995
63040
|
const stream = result?.stream;
|
|
62996
|
-
if (stream === undefined)
|
|
63041
|
+
if (stream === undefined) {
|
|
63042
|
+
logger.error("opencode event.subscribe returned no stream", {
|
|
63043
|
+
keys: Object.keys(result ?? {}).join(",")
|
|
63044
|
+
});
|
|
62997
63045
|
return;
|
|
63046
|
+
}
|
|
62998
63047
|
for await (const frame of stream) {
|
|
62999
63048
|
if (args.controller.signal.aborted)
|
|
63000
63049
|
break;
|
|
@@ -63211,9 +63260,10 @@ class OpencodeDriver {
|
|
|
63211
63260
|
return event;
|
|
63212
63261
|
}
|
|
63213
63262
|
}
|
|
63214
|
-
var FULL_CAPABILITIES2, DEFAULT_BRIDGE_FACTORY = () => new OpencodeHttpBridge;
|
|
63263
|
+
var FULL_CAPABILITIES2, DEFAULT_BRIDGE_FACTORY = () => new OpencodeHttpBridge, logger;
|
|
63215
63264
|
var init_driver2 = __esm(() => {
|
|
63216
63265
|
init_errors();
|
|
63266
|
+
init_logger();
|
|
63217
63267
|
init_event_mapper();
|
|
63218
63268
|
init_http_bridge();
|
|
63219
63269
|
init_permission_bridge2();
|
|
@@ -63230,11 +63280,12 @@ var init_driver2 = __esm(() => {
|
|
|
63230
63280
|
debug: true,
|
|
63231
63281
|
askQuestion: true
|
|
63232
63282
|
};
|
|
63283
|
+
logger = createLogger({ env: process.env });
|
|
63233
63284
|
});
|
|
63234
63285
|
// package.json
|
|
63235
63286
|
var package_default = {
|
|
63236
63287
|
name: "@kodizm/acp",
|
|
63237
|
-
version: "0.6.
|
|
63288
|
+
version: "0.6.1",
|
|
63238
63289
|
description: "Custom ACP server bridging Claude Code, codex, and opencode CLIs through a single Kodizm-flavored protocol surface.",
|
|
63239
63290
|
type: "module",
|
|
63240
63291
|
bin: {
|