@cotal-ai/connector-claude-code 0.4.0 → 0.6.0
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/hook.cjs +70 -18
- package/dist/mcp.cjs +1567 -219
- package/dist/mcp.js +20 -8
- package/dist/mcp.js.map +1 -1
- package/package.json +3 -3
package/dist/hook.cjs
CHANGED
|
@@ -3504,16 +3504,16 @@ var require_errors = __commonJS({
|
|
|
3504
3504
|
}
|
|
3505
3505
|
};
|
|
3506
3506
|
exports2.ProtocolError = ProtocolError;
|
|
3507
|
-
var
|
|
3507
|
+
var RequestError2 = class extends Error {
|
|
3508
3508
|
constructor(message = "", options) {
|
|
3509
3509
|
super(message, options);
|
|
3510
3510
|
this.name = "RequestError";
|
|
3511
3511
|
}
|
|
3512
3512
|
isNoResponders() {
|
|
3513
|
-
return this.cause instanceof
|
|
3513
|
+
return this.cause instanceof NoRespondersError2;
|
|
3514
3514
|
}
|
|
3515
3515
|
};
|
|
3516
|
-
exports2.RequestError =
|
|
3516
|
+
exports2.RequestError = RequestError2;
|
|
3517
3517
|
var TimeoutError = class extends Error {
|
|
3518
3518
|
constructor(options) {
|
|
3519
3519
|
super("timeout", options);
|
|
@@ -3521,7 +3521,7 @@ var require_errors = __commonJS({
|
|
|
3521
3521
|
}
|
|
3522
3522
|
};
|
|
3523
3523
|
exports2.TimeoutError = TimeoutError;
|
|
3524
|
-
var
|
|
3524
|
+
var NoRespondersError2 = class extends Error {
|
|
3525
3525
|
subject;
|
|
3526
3526
|
constructor(subject, options) {
|
|
3527
3527
|
super(`no responders: '${subject}'`, options);
|
|
@@ -3529,7 +3529,7 @@ var require_errors = __commonJS({
|
|
|
3529
3529
|
this.name = "NoResponders";
|
|
3530
3530
|
}
|
|
3531
3531
|
};
|
|
3532
|
-
exports2.NoRespondersError =
|
|
3532
|
+
exports2.NoRespondersError = NoRespondersError2;
|
|
3533
3533
|
var PermissionViolationError2 = class _PermissionViolationError extends Error {
|
|
3534
3534
|
operation;
|
|
3535
3535
|
subject;
|
|
@@ -3572,10 +3572,10 @@ var require_errors = __commonJS({
|
|
|
3572
3572
|
InvalidArgumentError,
|
|
3573
3573
|
InvalidOperationError,
|
|
3574
3574
|
InvalidSubjectError,
|
|
3575
|
-
NoRespondersError,
|
|
3575
|
+
NoRespondersError: NoRespondersError2,
|
|
3576
3576
|
PermissionViolationError: PermissionViolationError2,
|
|
3577
3577
|
ProtocolError,
|
|
3578
|
-
RequestError,
|
|
3578
|
+
RequestError: RequestError2,
|
|
3579
3579
|
TimeoutError,
|
|
3580
3580
|
UserAuthenticationExpiredError: UserAuthenticationExpiredError2
|
|
3581
3581
|
};
|
|
@@ -6421,7 +6421,7 @@ var require_authenticator = __commonJS({
|
|
|
6421
6421
|
exports2.tokenAuthenticator = tokenAuthenticator;
|
|
6422
6422
|
exports2.nkeyAuthenticator = nkeyAuthenticator;
|
|
6423
6423
|
exports2.jwtAuthenticator = jwtAuthenticator;
|
|
6424
|
-
exports2.credsAuthenticator =
|
|
6424
|
+
exports2.credsAuthenticator = credsAuthenticator6;
|
|
6425
6425
|
var nkeys_1 = require_nkeys2();
|
|
6426
6426
|
var encoders_1 = require_encoders();
|
|
6427
6427
|
function multiAuthenticator(authenticators) {
|
|
@@ -6471,7 +6471,7 @@ var require_authenticator = __commonJS({
|
|
|
6471
6471
|
return { jwt, nkey, sig };
|
|
6472
6472
|
};
|
|
6473
6473
|
}
|
|
6474
|
-
function
|
|
6474
|
+
function credsAuthenticator6(creds) {
|
|
6475
6475
|
const fn = typeof creds !== "function" ? () => creds : creds;
|
|
6476
6476
|
const parse = () => {
|
|
6477
6477
|
const CREDS = /\s*(?:(?:[-]{3,}[^\n]*[-]{3,}\n)(.+)(?:\n\s*[-]{3,}[^\n]*[-]{3,}\n))/ig;
|
|
@@ -13601,11 +13601,11 @@ var require_connect = __commonJS({
|
|
|
13601
13601
|
"../../node_modules/.pnpm/@nats-io+transport-node@3.4.0/node_modules/@nats-io/transport-node/lib/connect.js"(exports2) {
|
|
13602
13602
|
"use strict";
|
|
13603
13603
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
13604
|
-
exports2.connect =
|
|
13604
|
+
exports2.connect = connect7;
|
|
13605
13605
|
var node_transport_1 = require_node_transport();
|
|
13606
13606
|
var nats_base_client_1 = require_nats_base_client();
|
|
13607
13607
|
var nats_base_client_2 = require_nats_base_client();
|
|
13608
|
-
function
|
|
13608
|
+
function connect7(opts = {}) {
|
|
13609
13609
|
if ((0, nats_base_client_2.hasWsProtocol)(opts)) {
|
|
13610
13610
|
return Promise.reject(nats_base_client_2.errors.InvalidArgumentError.format(`servers`, `node client doesn't support websockets, use the 'wsconnect' function instead`));
|
|
13611
13611
|
}
|
|
@@ -13797,7 +13797,7 @@ var require_kv = __commonJS({
|
|
|
13797
13797
|
throw new Error(`invalid bucket name: ${name}`);
|
|
13798
13798
|
}
|
|
13799
13799
|
}
|
|
13800
|
-
var
|
|
13800
|
+
var Kvm8 = class {
|
|
13801
13801
|
js;
|
|
13802
13802
|
/**
|
|
13803
13803
|
* Creates an instance of the Kv that allows you to create and access KV stores.
|
|
@@ -13863,7 +13863,7 @@ var require_kv = __commonJS({
|
|
|
13863
13863
|
return new internal_2.ListerImpl(subj, filter, this.js);
|
|
13864
13864
|
}
|
|
13865
13865
|
};
|
|
13866
|
-
exports2.Kvm =
|
|
13866
|
+
exports2.Kvm = Kvm8;
|
|
13867
13867
|
var Bucket = class _Bucket {
|
|
13868
13868
|
js;
|
|
13869
13869
|
jsm;
|
|
@@ -14709,6 +14709,9 @@ var import_node_os = require("node:os");
|
|
|
14709
14709
|
var import_node_fs2 = require("node:fs");
|
|
14710
14710
|
|
|
14711
14711
|
// ../../packages/core/dist/subjects.js
|
|
14712
|
+
function isConcreteChannel(channel) {
|
|
14713
|
+
return !channel.split(".").some((s) => s.trim() === "*" || s.trim() === ">");
|
|
14714
|
+
}
|
|
14712
14715
|
function subjectMatches(pattern, subject) {
|
|
14713
14716
|
const p = pattern.split(".");
|
|
14714
14717
|
const s = subject.split(".");
|
|
@@ -16411,11 +16414,22 @@ var SYS_LIMITS = { ...BASE_LIMITS, mem_storage: 0, disk_storage: 0 };
|
|
|
16411
16414
|
var import_jetstream = __toESM(require_mod4(), 1);
|
|
16412
16415
|
var import_transport_node = __toESM(require_transport_node(), 1);
|
|
16413
16416
|
var import_kv = __toESM(require_mod6(), 1);
|
|
16417
|
+
var PLANE3_DEDUP_WINDOW_MS = 2 * 60 * 60 * 1e3;
|
|
16414
16418
|
|
|
16415
16419
|
// ../../packages/core/dist/channels.js
|
|
16416
16420
|
var import_kv2 = __toESM(require_mod6(), 1);
|
|
16417
16421
|
var import_transport_node2 = __toESM(require_transport_node(), 1);
|
|
16418
16422
|
|
|
16423
|
+
// ../../packages/core/dist/members.js
|
|
16424
|
+
var import_kv3 = __toESM(require_mod6(), 1);
|
|
16425
|
+
|
|
16426
|
+
// ../../packages/core/dist/acls.js
|
|
16427
|
+
var import_kv4 = __toESM(require_mod6(), 1);
|
|
16428
|
+
|
|
16429
|
+
// ../../packages/core/dist/lease.js
|
|
16430
|
+
var import_kv5 = __toESM(require_mod6(), 1);
|
|
16431
|
+
var import_transport_node3 = __toESM(require_transport_node(), 1);
|
|
16432
|
+
|
|
16419
16433
|
// ../../packages/core/dist/agent-file.js
|
|
16420
16434
|
var import_node_fs = require("node:fs");
|
|
16421
16435
|
function unquote(v) {
|
|
@@ -16476,6 +16490,8 @@ function loadAgentFile(path) {
|
|
|
16476
16490
|
const subscribe = list("subscribe");
|
|
16477
16491
|
const allowSubscribe = list("allowSubscribe");
|
|
16478
16492
|
const allowPublish = list("allowPublish");
|
|
16493
|
+
const quiet = list("quiet");
|
|
16494
|
+
const muted = list("muted");
|
|
16479
16495
|
for (const ch of [...subscribe ?? [], ...allowSubscribe ?? [], ...allowPublish ?? []])
|
|
16480
16496
|
try {
|
|
16481
16497
|
assertValidChannel(ch);
|
|
@@ -16487,7 +16503,22 @@ function loadAgentFile(path) {
|
|
|
16487
16503
|
for (const ch of effSubscribe)
|
|
16488
16504
|
if (!channelInAllow(effAllow, ch))
|
|
16489
16505
|
throw new Error(`agent file ${path}: subscribe channel "${ch}" is not within allowSubscribe [${effAllow.join(", ")}]`);
|
|
16490
|
-
const
|
|
16506
|
+
const both = (quiet ?? []).filter((c) => (muted ?? []).includes(c));
|
|
16507
|
+
if (both.length)
|
|
16508
|
+
throw new Error(`agent file ${path}: channel(s) [${both.join(", ")}] are in both quiet and muted \u2014 pick one`);
|
|
16509
|
+
for (const [field, chans] of [["quiet", quiet], ["muted", muted]])
|
|
16510
|
+
for (const ch of chans ?? []) {
|
|
16511
|
+
try {
|
|
16512
|
+
assertValidChannel(ch);
|
|
16513
|
+
} catch (e) {
|
|
16514
|
+
throw new Error(`agent file ${path}: ${e.message}`);
|
|
16515
|
+
}
|
|
16516
|
+
if (!isConcreteChannel(ch))
|
|
16517
|
+
throw new Error(`agent file ${path}: ${field} channel "${ch}" must be a concrete channel (no wildcard)`);
|
|
16518
|
+
if (!channelInAllow(effAllow, ch))
|
|
16519
|
+
throw new Error(`agent file ${path}: ${field} channel "${ch}" is not within your read ACL / allowSubscribe [${effAllow.join(", ")}]`);
|
|
16520
|
+
}
|
|
16521
|
+
const known = /* @__PURE__ */ new Set(["name", "role", "kind", "description", "tags", "subscribe", "allowSubscribe", "allowPublish", "quiet", "muted", "model", "capabilities", "owner"]);
|
|
16491
16522
|
const meta = {};
|
|
16492
16523
|
for (const [k, v] of Object.entries(fm))
|
|
16493
16524
|
if (!known.has(k) && typeof v === "string")
|
|
@@ -16501,6 +16532,8 @@ function loadAgentFile(path) {
|
|
|
16501
16532
|
subscribe,
|
|
16502
16533
|
allowSubscribe,
|
|
16503
16534
|
allowPublish,
|
|
16535
|
+
quiet,
|
|
16536
|
+
muted,
|
|
16504
16537
|
model: str("model"),
|
|
16505
16538
|
capabilities: list("capabilities"),
|
|
16506
16539
|
owner: str("owner"),
|
|
@@ -16510,15 +16543,15 @@ function loadAgentFile(path) {
|
|
|
16510
16543
|
}
|
|
16511
16544
|
|
|
16512
16545
|
// ../../packages/core/dist/endpoint.js
|
|
16513
|
-
var
|
|
16546
|
+
var import_transport_node4 = __toESM(require_transport_node(), 1);
|
|
16514
16547
|
var import_jetstream2 = __toESM(require_mod4(), 1);
|
|
16515
|
-
var
|
|
16548
|
+
var import_kv6 = __toESM(require_mod6(), 1);
|
|
16516
16549
|
var DEFAULT_SERVER = "nats://127.0.0.1:4222";
|
|
16517
16550
|
|
|
16518
16551
|
// ../../packages/core/dist/spaces.js
|
|
16519
|
-
var
|
|
16552
|
+
var import_transport_node5 = __toESM(require_transport_node(), 1);
|
|
16520
16553
|
var import_jetstream3 = __toESM(require_mod4(), 1);
|
|
16521
|
-
var
|
|
16554
|
+
var import_kv7 = __toESM(require_mod6(), 1);
|
|
16522
16555
|
|
|
16523
16556
|
// ../../packages/core/dist/registry.js
|
|
16524
16557
|
var Registry = class {
|
|
@@ -16572,6 +16605,20 @@ function configFromEnv(env = process.env) {
|
|
|
16572
16605
|
const resolvedAllowPub = allowPub.length ? allowPub : def?.allowPublish ?? [];
|
|
16573
16606
|
for (const ch of [...resolvedSubscribe, ...resolvedAllowSub, ...resolvedAllowPub])
|
|
16574
16607
|
assertValidChannel(ch);
|
|
16608
|
+
const qEnv = splitList(env.COTAL_QUIET), mEnv = splitList(env.COTAL_MUTED);
|
|
16609
|
+
const resolvedQuiet = qEnv.length ? qEnv : def?.quiet ?? [];
|
|
16610
|
+
const resolvedMuted = mEnv.length ? mEnv : def?.muted ?? [];
|
|
16611
|
+
const bothModes = resolvedQuiet.filter((c) => resolvedMuted.includes(c));
|
|
16612
|
+
if (bothModes.length)
|
|
16613
|
+
throw new Error(`COTAL config: channel(s) [${bothModes.join(", ")}] are in both quiet and muted`);
|
|
16614
|
+
for (const [field, chans] of [["quiet", resolvedQuiet], ["muted", resolvedMuted]])
|
|
16615
|
+
for (const ch of chans) {
|
|
16616
|
+
assertValidChannel(ch);
|
|
16617
|
+
if (!isConcreteChannel(ch))
|
|
16618
|
+
throw new Error(`COTAL config: ${field} channel "${ch}" must be concrete (no wildcard)`);
|
|
16619
|
+
if (!channelInAllow(resolvedAllowSub, ch))
|
|
16620
|
+
throw new Error(`COTAL config: ${field} channel "${ch}" is not within allowSubscribe [${resolvedAllowSub.join(", ")}]`);
|
|
16621
|
+
}
|
|
16575
16622
|
const credsPath = env.COTAL_CREDS?.trim();
|
|
16576
16623
|
return {
|
|
16577
16624
|
space: env.COTAL_SPACE?.trim() || link?.space || "demo",
|
|
@@ -16581,12 +16628,17 @@ function configFromEnv(env = process.env) {
|
|
|
16581
16628
|
role: env.COTAL_ROLE?.trim() || def?.role || void 0,
|
|
16582
16629
|
description: def?.description,
|
|
16583
16630
|
tags: def?.tags,
|
|
16631
|
+
meta: def?.meta,
|
|
16632
|
+
capabilities: def?.capabilities,
|
|
16633
|
+
model: env.COTAL_MODEL?.trim() || def?.model || void 0,
|
|
16584
16634
|
servers: env.COTAL_SERVERS?.trim() || link?.servers || DEFAULT_SERVER,
|
|
16585
16635
|
subscribe: resolvedSubscribe,
|
|
16586
16636
|
allowSubscribe: resolvedAllowSub,
|
|
16587
16637
|
// Post ACL is default-DENY: only what's explicitly declared (env > agent-file). The broker
|
|
16588
16638
|
// enforces it under auth; in open mode posting is unrestricted regardless (see laneLine).
|
|
16589
16639
|
allowPublish: resolvedAllowPub,
|
|
16640
|
+
quiet: resolvedQuiet,
|
|
16641
|
+
muted: resolvedMuted,
|
|
16590
16642
|
kind: env.COTAL_KIND?.trim() || def?.kind || "agent",
|
|
16591
16643
|
token: env.COTAL_TOKEN?.trim() || link?.token,
|
|
16592
16644
|
user: link?.user,
|