@cotal-ai/connector-claude-code 0.4.0 → 0.5.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 CHANGED
@@ -3504,16 +3504,16 @@ var require_errors = __commonJS({
3504
3504
  }
3505
3505
  };
3506
3506
  exports2.ProtocolError = ProtocolError;
3507
- var RequestError = class extends Error {
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 NoRespondersError;
3513
+ return this.cause instanceof NoRespondersError2;
3514
3514
  }
3515
3515
  };
3516
- exports2.RequestError = 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 NoRespondersError = class extends Error {
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 = 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
  };
@@ -13797,7 +13797,7 @@ var require_kv = __commonJS({
13797
13797
  throw new Error(`invalid bucket name: ${name}`);
13798
13798
  }
13799
13799
  }
13800
- var Kvm5 = class {
13800
+ var Kvm6 = 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 = Kvm5;
13866
+ exports2.Kvm = Kvm6;
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,15 @@ 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
+
16419
16426
  // ../../packages/core/dist/agent-file.js
16420
16427
  var import_node_fs = require("node:fs");
16421
16428
  function unquote(v) {
@@ -16476,6 +16483,8 @@ function loadAgentFile(path) {
16476
16483
  const subscribe = list("subscribe");
16477
16484
  const allowSubscribe = list("allowSubscribe");
16478
16485
  const allowPublish = list("allowPublish");
16486
+ const quiet = list("quiet");
16487
+ const muted = list("muted");
16479
16488
  for (const ch of [...subscribe ?? [], ...allowSubscribe ?? [], ...allowPublish ?? []])
16480
16489
  try {
16481
16490
  assertValidChannel(ch);
@@ -16487,7 +16496,22 @@ function loadAgentFile(path) {
16487
16496
  for (const ch of effSubscribe)
16488
16497
  if (!channelInAllow(effAllow, ch))
16489
16498
  throw new Error(`agent file ${path}: subscribe channel "${ch}" is not within allowSubscribe [${effAllow.join(", ")}]`);
16490
- const known = /* @__PURE__ */ new Set(["name", "role", "kind", "description", "tags", "subscribe", "allowSubscribe", "allowPublish", "model", "capabilities", "owner"]);
16499
+ const both = (quiet ?? []).filter((c) => (muted ?? []).includes(c));
16500
+ if (both.length)
16501
+ throw new Error(`agent file ${path}: channel(s) [${both.join(", ")}] are in both quiet and muted \u2014 pick one`);
16502
+ for (const [field, chans] of [["quiet", quiet], ["muted", muted]])
16503
+ for (const ch of chans ?? []) {
16504
+ try {
16505
+ assertValidChannel(ch);
16506
+ } catch (e) {
16507
+ throw new Error(`agent file ${path}: ${e.message}`);
16508
+ }
16509
+ if (!isConcreteChannel(ch))
16510
+ throw new Error(`agent file ${path}: ${field} channel "${ch}" must be a concrete channel (no wildcard)`);
16511
+ if (!channelInAllow(effAllow, ch))
16512
+ throw new Error(`agent file ${path}: ${field} channel "${ch}" is not within your read ACL / allowSubscribe [${effAllow.join(", ")}]`);
16513
+ }
16514
+ const known = /* @__PURE__ */ new Set(["name", "role", "kind", "description", "tags", "subscribe", "allowSubscribe", "allowPublish", "quiet", "muted", "model", "capabilities", "owner"]);
16491
16515
  const meta = {};
16492
16516
  for (const [k, v] of Object.entries(fm))
16493
16517
  if (!known.has(k) && typeof v === "string")
@@ -16501,6 +16525,8 @@ function loadAgentFile(path) {
16501
16525
  subscribe,
16502
16526
  allowSubscribe,
16503
16527
  allowPublish,
16528
+ quiet,
16529
+ muted,
16504
16530
  model: str("model"),
16505
16531
  capabilities: list("capabilities"),
16506
16532
  owner: str("owner"),
@@ -16512,13 +16538,13 @@ function loadAgentFile(path) {
16512
16538
  // ../../packages/core/dist/endpoint.js
16513
16539
  var import_transport_node3 = __toESM(require_transport_node(), 1);
16514
16540
  var import_jetstream2 = __toESM(require_mod4(), 1);
16515
- var import_kv3 = __toESM(require_mod6(), 1);
16541
+ var import_kv4 = __toESM(require_mod6(), 1);
16516
16542
  var DEFAULT_SERVER = "nats://127.0.0.1:4222";
16517
16543
 
16518
16544
  // ../../packages/core/dist/spaces.js
16519
16545
  var import_transport_node4 = __toESM(require_transport_node(), 1);
16520
16546
  var import_jetstream3 = __toESM(require_mod4(), 1);
16521
- var import_kv4 = __toESM(require_mod6(), 1);
16547
+ var import_kv5 = __toESM(require_mod6(), 1);
16522
16548
 
16523
16549
  // ../../packages/core/dist/registry.js
16524
16550
  var Registry = class {
@@ -16572,6 +16598,20 @@ function configFromEnv(env = process.env) {
16572
16598
  const resolvedAllowPub = allowPub.length ? allowPub : def?.allowPublish ?? [];
16573
16599
  for (const ch of [...resolvedSubscribe, ...resolvedAllowSub, ...resolvedAllowPub])
16574
16600
  assertValidChannel(ch);
16601
+ const qEnv = splitList(env.COTAL_QUIET), mEnv = splitList(env.COTAL_MUTED);
16602
+ const resolvedQuiet = qEnv.length ? qEnv : def?.quiet ?? [];
16603
+ const resolvedMuted = mEnv.length ? mEnv : def?.muted ?? [];
16604
+ const bothModes = resolvedQuiet.filter((c) => resolvedMuted.includes(c));
16605
+ if (bothModes.length)
16606
+ throw new Error(`COTAL config: channel(s) [${bothModes.join(", ")}] are in both quiet and muted`);
16607
+ for (const [field, chans] of [["quiet", resolvedQuiet], ["muted", resolvedMuted]])
16608
+ for (const ch of chans) {
16609
+ assertValidChannel(ch);
16610
+ if (!isConcreteChannel(ch))
16611
+ throw new Error(`COTAL config: ${field} channel "${ch}" must be concrete (no wildcard)`);
16612
+ if (!channelInAllow(resolvedAllowSub, ch))
16613
+ throw new Error(`COTAL config: ${field} channel "${ch}" is not within allowSubscribe [${resolvedAllowSub.join(", ")}]`);
16614
+ }
16575
16615
  const credsPath = env.COTAL_CREDS?.trim();
16576
16616
  return {
16577
16617
  space: env.COTAL_SPACE?.trim() || link?.space || "demo",
@@ -16581,12 +16621,17 @@ function configFromEnv(env = process.env) {
16581
16621
  role: env.COTAL_ROLE?.trim() || def?.role || void 0,
16582
16622
  description: def?.description,
16583
16623
  tags: def?.tags,
16624
+ meta: def?.meta,
16625
+ capabilities: def?.capabilities,
16626
+ model: env.COTAL_MODEL?.trim() || def?.model || void 0,
16584
16627
  servers: env.COTAL_SERVERS?.trim() || link?.servers || DEFAULT_SERVER,
16585
16628
  subscribe: resolvedSubscribe,
16586
16629
  allowSubscribe: resolvedAllowSub,
16587
16630
  // Post ACL is default-DENY: only what's explicitly declared (env > agent-file). The broker
16588
16631
  // enforces it under auth; in open mode posting is unrestricted regardless (see laneLine).
16589
16632
  allowPublish: resolvedAllowPub,
16633
+ quiet: resolvedQuiet,
16634
+ muted: resolvedMuted,
16590
16635
  kind: env.COTAL_KIND?.trim() || def?.kind || "agent",
16591
16636
  token: env.COTAL_TOKEN?.trim() || link?.token,
16592
16637
  user: link?.user,