@cotal-ai/connector-jcode 0.28.0-hack-20260823234508 → 0.28.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/host.js CHANGED
@@ -20154,11 +20154,11 @@ var require_connect = __commonJS({
20154
20154
  "../../node_modules/.pnpm/@nats-io+transport-node@3.4.0/node_modules/@nats-io/transport-node/lib/connect.js"(exports) {
20155
20155
  "use strict";
20156
20156
  Object.defineProperty(exports, "__esModule", { value: true });
20157
- exports.connect = connect8;
20157
+ exports.connect = connect7;
20158
20158
  var node_transport_1 = require_node_transport();
20159
20159
  var nats_base_client_1 = require_nats_base_client();
20160
20160
  var nats_base_client_2 = require_nats_base_client();
20161
- function connect8(opts = {}) {
20161
+ function connect7(opts = {}) {
20162
20162
  if ((0, nats_base_client_2.hasWsProtocol)(opts)) {
20163
20163
  return Promise.reject(nats_base_client_2.errors.InvalidArgumentError.format(`servers`, `node client doesn't support websockets, use the 'wsconnect' function instead`));
20164
20164
  }
@@ -37550,49 +37550,33 @@ var SYS_LIMITS = { ...BASE_LIMITS, mem_storage: 0, disk_storage: 0 };
37550
37550
  var import_nkeys4 = __toESM(require_mod2(), 1);
37551
37551
 
37552
37552
  // ../../packages/core/dist/channels.js
37553
- var import_kv4 = __toESM(require_mod6(), 1);
37554
- var import_transport_node13 = __toESM(require_transport_node(), 1);
37555
- function parseDuration(s) {
37556
- const m = /^(\d+)(s|m|h|d)$/.exec(s.trim());
37557
- if (!m)
37558
- throw new Error(`invalid duration "${s}" - expected <number><s|m|h|d>, e.g. "24h"`);
37559
- const n = Number(m[1]);
37560
- const unit = { s: 1e3, m: 6e4, h: 36e5, d: 864e5 }[m[2]];
37561
- return n * unit;
37562
- }
37563
- function effectiveReplay(cfg, defaults) {
37564
- return cfg?.replay ?? defaults?.replay ?? true;
37565
- }
37566
- function effectiveReplayWindowMs(cfg, defaults) {
37567
- const w = cfg?.replayWindow ?? defaults?.replayWindow;
37568
- return w === void 0 ? void 0 : parseDuration(w);
37569
- }
37570
- function effectiveDeliveryClass(cfg, defaults) {
37571
- return cfg?.deliveryClass ?? defaults?.deliveryClass ?? "durable";
37572
- }
37573
- async function openChannelRegistry(nc, space, opts = {}) {
37574
- const kvm = new import_kv4.Kvm(nc);
37575
- return opts.create ? kvm.create(channelBucket(space)) : kvm.open(channelBucket(space));
37576
- }
37577
- async function readChannelConfig(kv, channel) {
37578
- return decode2(kv, channel);
37579
- }
37580
- async function readChannelDefaults(kv) {
37581
- return decode2(kv, CHANNEL_DEFAULTS_KEY);
37582
- }
37583
- async function decode2(kv, key) {
37584
- const e = await kv.get(key);
37585
- if (!e || e.operation === "DEL" || e.operation === "PURGE")
37586
- return void 0;
37587
- try {
37588
- return e.json();
37589
- } catch {
37590
- return void 0;
37591
- }
37553
+ var import_kv7 = __toESM(require_mod6(), 1);
37554
+ var import_transport_node15 = __toESM(require_transport_node(), 1);
37555
+
37556
+ // ../../packages/core/dist/endpoint.js
37557
+ var import_transport_node14 = __toESM(require_transport_node(), 1);
37558
+ var import_nats_core = __toESM(require_mod3(), 1);
37559
+ import { EventEmitter as EventEmitter2 } from "node:events";
37560
+ import { randomUUID } from "node:crypto";
37561
+ import { createConnection } from "node:net";
37562
+
37563
+ // ../../packages/core/dist/artifact.js
37564
+ var ARTIFACT_PART_KIND = "artifact";
37565
+ function isArtifactPart(value) {
37566
+ if (!value || typeof value !== "object")
37567
+ return false;
37568
+ const p = value;
37569
+ return p.kind === ARTIFACT_PART_KIND && typeof p.name === "string" && p.name.length > 0 && typeof p.mediaType === "string" && p.mediaType.length > 0 && typeof p.digest === "string" && isContractDigest(p.digest) && typeof p.size === "number" && Number.isSafeInteger(p.size) && p.size >= 0;
37592
37570
  }
37593
37571
 
37572
+ // ../../packages/core/dist/endpoint.js
37573
+ var import_jetstream13 = __toESM(require_mod4(), 1);
37574
+ var import_jetstream14 = __toESM(require_mod4(), 1);
37575
+ var import_kv6 = __toESM(require_mod6(), 1);
37576
+ var import_internal2 = __toESM(require_internal_mod3(), 1);
37577
+
37594
37578
  // ../../packages/core/dist/members.js
37595
- var import_kv5 = __toESM(require_mod6(), 1);
37579
+ var import_kv4 = __toESM(require_mod6(), 1);
37596
37580
  var StaleMembershipWrite = class extends Error {
37597
37581
  constructor(channel, owner, attempted, current) {
37598
37582
  super(`stale membership write for ${channel}/${owner}: generation ${attempted} < current ${current}`);
@@ -37600,7 +37584,7 @@ var StaleMembershipWrite = class extends Error {
37600
37584
  }
37601
37585
  };
37602
37586
  async function openMembersRegistry(nc, space, opts = {}) {
37603
- const kvm = new import_kv5.Kvm(nc);
37587
+ const kvm = new import_kv4.Kvm(nc);
37604
37588
  return opts.create ? kvm.create(membersBucket(space)) : kvm.open(membersBucket(space));
37605
37589
  }
37606
37590
  async function readMember(kv, channel, owner, lifecycleUid) {
@@ -37700,281 +37684,14 @@ function durableEligible(rec, seq) {
37700
37684
  return true;
37701
37685
  }
37702
37686
 
37703
- // ../../packages/core/dist/membership-feed.js
37704
- var import_transport_node14 = __toESM(require_transport_node(), 1);
37705
- var import_kv6 = __toESM(require_mod6(), 1);
37706
-
37707
- // ../../packages/core/dist/evict.js
37708
- var import_transport_node15 = __toESM(require_transport_node(), 1);
37709
-
37710
37687
  // ../../packages/core/dist/lease.js
37711
- var import_kv7 = __toESM(require_mod6(), 1);
37712
- var import_transport_node16 = __toESM(require_transport_node(), 1);
37688
+ var import_kv5 = __toESM(require_mod6(), 1);
37689
+ var import_transport_node13 = __toESM(require_transport_node(), 1);
37713
37690
  async function openDeliveryRegistry(nc, space) {
37714
- return new import_kv7.Kvm(nc).open(deliveryBucket(space));
37715
- }
37716
-
37717
- // ../../packages/core/dist/agent-file.js
37718
- import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
37719
- var import_yaml = __toESM(require_dist(), 1);
37720
- function parseFrontmatter(src, path4) {
37721
- let doc;
37722
- try {
37723
- doc = (0, import_yaml.parse)(src);
37724
- } catch (e) {
37725
- throw new Error(`agent file ${path4}: invalid YAML frontmatter; ${e.message}`);
37726
- }
37727
- if (doc === null || doc === void 0)
37728
- return {};
37729
- if (typeof doc !== "object" || Array.isArray(doc))
37730
- throw new Error(`agent file ${path4}: frontmatter must be a YAML mapping (key: value pairs)`);
37731
- return doc;
37732
- }
37733
- function loadAgentFile(path4) {
37734
- const src = readFileSync(path4, "utf8");
37735
- const m = /^---\n([\s\S]*?)\n---\n?([\s\S]*)$/.exec(src);
37736
- if (!m)
37737
- throw new Error(`agent file ${path4}: missing "---" frontmatter block`);
37738
- const fm = parseFrontmatter(m[1], path4);
37739
- const persona = m[2].trim();
37740
- const str2 = (k) => {
37741
- const v = fm[k];
37742
- if (v === void 0 || v === null)
37743
- return void 0;
37744
- if (typeof v === "object")
37745
- throw new Error(`agent file ${path4}: "${k}" must be a scalar`);
37746
- return String(v);
37747
- };
37748
- const list = (k) => {
37749
- const v = fm[k];
37750
- if (v === void 0 || v === null)
37751
- return void 0;
37752
- return (Array.isArray(v) ? v : [v]).map((x) => {
37753
- if (x === null || typeof x === "object")
37754
- throw new Error(`agent file ${path4}: "${k}" list items must be scalars`);
37755
- return String(x);
37756
- });
37757
- };
37758
- const name = str2("name");
37759
- if (!name)
37760
- throw new Error(`agent file ${path4}: "name" is required`);
37761
- assertValidName(name);
37762
- const kind = str2("kind");
37763
- if (kind && kind !== "agent" && kind !== "endpoint")
37764
- throw new Error(`agent file ${path4}: "kind" must be "agent" or "endpoint"`);
37765
- for (const old of ["channels", "publish"])
37766
- if (old in fm)
37767
- throw new Error(`agent file ${path4}: "${old}" was renamed - use "subscribe"/"allowSubscribe" (read) and "allowPublish" (post)`);
37768
- const subscribe = list("subscribe");
37769
- const allowSubscribe = list("allowSubscribe");
37770
- const allowPublish = list("allowPublish");
37771
- const quiet = list("quiet");
37772
- const muted = list("muted");
37773
- for (const ch of [...subscribe ?? [], ...allowSubscribe ?? [], ...allowPublish ?? []])
37774
- try {
37775
- assertValidChannel(ch);
37776
- } catch (e) {
37777
- throw new Error(`agent file ${path4}: ${e.message}`);
37778
- }
37779
- const effSubscribe = subscribe?.length ? subscribe : ["general"];
37780
- const effAllow = allowSubscribe?.length ? allowSubscribe : effSubscribe;
37781
- for (const ch of effSubscribe)
37782
- if (!channelInAllow(effAllow, ch))
37783
- throw new Error(`agent file ${path4}: subscribe channel "${ch}" is not within allowSubscribe [${effAllow.join(", ")}]`);
37784
- const both = (quiet ?? []).filter((c) => (muted ?? []).includes(c));
37785
- if (both.length)
37786
- throw new Error(`agent file ${path4}: channel(s) [${both.join(", ")}] are in both quiet and muted - pick one`);
37787
- for (const [field, chans] of [["quiet", quiet], ["muted", muted]])
37788
- for (const ch of chans ?? []) {
37789
- try {
37790
- assertValidChannel(ch);
37791
- } catch (e) {
37792
- throw new Error(`agent file ${path4}: ${e.message}`);
37793
- }
37794
- if (!isConcreteChannel(ch))
37795
- throw new Error(`agent file ${path4}: ${field} channel "${ch}" must be a concrete channel (no wildcard)`);
37796
- if (!channelInAllow(effAllow, ch))
37797
- throw new Error(`agent file ${path4}: ${field} channel "${ch}" is not within your read ACL / allowSubscribe [${effAllow.join(", ")}]`);
37798
- }
37799
- const launchOptionsRaw = fm["launchOptions"];
37800
- let launchOptions;
37801
- if (launchOptionsRaw !== void 0 && launchOptionsRaw !== null) {
37802
- if (typeof launchOptionsRaw !== "object" || Array.isArray(launchOptionsRaw))
37803
- throw new Error(`agent file ${path4}: "launchOptions" must be a mapping of key: value pairs`);
37804
- launchOptions = launchOptionsRaw;
37805
- }
37806
- const known = /* @__PURE__ */ new Set(["name", "role", "kind", "description", "tags", "subscribe", "allowSubscribe", "allowPublish", "quiet", "muted", "model", "variant", "launchOptions", "capabilities", "owner"]);
37807
- const meta3 = {};
37808
- for (const [k, v] of Object.entries(fm))
37809
- if (!known.has(k) && v !== null && typeof v !== "object")
37810
- meta3[k] = String(v);
37811
- return {
37812
- name,
37813
- role: str2("role"),
37814
- kind,
37815
- description: str2("description"),
37816
- tags: list("tags"),
37817
- subscribe,
37818
- allowSubscribe,
37819
- allowPublish,
37820
- quiet,
37821
- muted,
37822
- model: str2("model"),
37823
- variant: str2("variant"),
37824
- launchOptions,
37825
- capabilities: list("capabilities"),
37826
- owner: str2("owner"),
37827
- meta: Object.keys(meta3).length ? meta3 : void 0,
37828
- persona: persona || void 0
37829
- };
37830
- }
37831
-
37832
- // ../../packages/core/dist/secret-fs.js
37833
- import { chmodSync, mkdirSync as mkdirSync2, renameSync, unlinkSync, writeFileSync as writeFileSync2 } from "node:fs";
37834
- import { execFileSync } from "node:child_process";
37835
- import { join } from "node:path";
37836
- var isWin = process.platform === "win32";
37837
- function sys32(exe) {
37838
- const root = process.env.SystemRoot || process.env.windir || "C:\\Windows";
37839
- return join(root, "System32", exe);
37840
- }
37841
- var cachedSid;
37842
- function ownerSid() {
37843
- if (cachedSid)
37844
- return cachedSid;
37845
- const out = execFileSync(sys32("whoami.exe"), ["/user", "/fo", "csv", "/nh"], { encoding: "utf8" });
37846
- const sid = out.trim().split(",").pop()?.replace(/^"|"$/g, "").trim();
37847
- if (!sid || !/^S-1-/.test(sid))
37848
- throw new Error(`could not determine the current user's SID from \`whoami\` (got: ${out.trim()})`);
37849
- cachedSid = sid;
37850
- return sid;
37851
- }
37852
- var BROAD_SIDS = ["S-1-1-0", "S-1-5-11", "S-1-5-32-545"];
37853
- function hardenPrivate(path4, kind) {
37854
- if (!isWin) {
37855
- chmodSync(path4, kind === "dir" ? 448 : 384);
37856
- return;
37857
- }
37858
- const perm = kind === "dir" ? "(OI)(CI)(F)" : "(F)";
37859
- const removeBroad = BROAD_SIDS.flatMap((sid) => ["/remove:g", `*${sid}`]);
37860
- const grant = (sid) => ["/grant:r", `*${sid}:${perm}`];
37861
- try {
37862
- execFileSync(sys32("icacls.exe"), [
37863
- path4,
37864
- "/inheritance:r",
37865
- ...removeBroad,
37866
- ...grant(ownerSid()),
37867
- ...grant("S-1-5-18"),
37868
- ...grant("S-1-5-32-544")
37869
- ], { stdio: ["ignore", "ignore", "pipe"] });
37870
- } catch (e) {
37871
- throw new Error(`failed to harden ${kind} "${path4}" to private via icacls: ${e.message.trim()}. Cotal will not leave a secret with a permissive ACL - ensure the path is on an NTFS volume and %SystemRoot%\\System32\\icacls.exe is available.`);
37872
- }
37873
- }
37874
-
37875
- // ../../packages/core/dist/launch-material.js
37876
- import { mkdtempSync, readFileSync as readFileSync2, realpathSync, rmSync, rmdirSync, statSync } from "node:fs";
37877
- import { tmpdir } from "node:os";
37878
- import { basename, dirname, join as join2, resolve } from "node:path";
37879
- var DIR_PREFIX = "cotal-launch-";
37880
- var MATERIAL_FILE = "material.json";
37881
- var LAUNCH_MATERIAL_ENV = "COTAL_LAUNCH_MATERIAL";
37882
- function readLaunchMaterial(path4) {
37883
- let raw;
37884
- try {
37885
- if (process.platform !== "win32") {
37886
- const mode = statSync(path4).mode & 511;
37887
- if (mode & 63)
37888
- throw new Error(`is readable beyond its owner (mode ${mode.toString(8)}) - refusing to read connection material out of a file other local users can open`);
37889
- }
37890
- raw = readFileSync2(path4, "utf8");
37891
- } catch (e) {
37892
- throw new Error(`launch material: cannot read ${path4} (${e instanceof Error ? e.message : String(e)})`);
37893
- }
37894
- let parsed;
37895
- try {
37896
- parsed = JSON.parse(raw);
37897
- } catch {
37898
- throw new Error(`launch material: ${path4} is not valid JSON`);
37899
- }
37900
- if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
37901
- throw new Error(`launch material: ${path4} must contain a JSON object`);
37902
- return validate(parsed, path4);
37903
- }
37904
- function validate(raw, path4) {
37905
- const material = {};
37906
- const str2 = (key) => {
37907
- const v = raw[key];
37908
- if (v === void 0)
37909
- return;
37910
- if (typeof v !== "string" || !v.trim())
37911
- throw new Error(`launch material: ${path4} has a ${key} that is not a non-empty string`);
37912
- material[key] = v;
37913
- };
37914
- str2("servers");
37915
- str2("creds");
37916
- str2("token");
37917
- str2("controlToken");
37918
- if (raw.userAuth !== void 0) {
37919
- const u = raw.userAuth;
37920
- if (typeof u !== "object" || u === null || Array.isArray(u))
37921
- throw new Error(`launch material: ${path4} has a userAuth that is not an object`);
37922
- const { owner, actor, sentinelCredsPath, bearerCmd } = u;
37923
- const named = { owner, actor, sentinelCredsPath };
37924
- for (const [k, v] of Object.entries(named))
37925
- if (typeof v !== "string" || !v.trim())
37926
- throw new Error(`launch material: ${path4} has a userAuth.${k} that is not a non-empty string`);
37927
- if (!Array.isArray(bearerCmd) || bearerCmd.length === 0 || !bearerCmd.every((a) => typeof a === "string" && a))
37928
- throw new Error(`launch material: ${path4} has a userAuth.bearerCmd that is not a non-empty array of strings`);
37929
- material.userAuth = {
37930
- owner,
37931
- actor,
37932
- sentinelCredsPath,
37933
- bearerCmd
37934
- };
37935
- }
37936
- if (Object.keys(material).length === 0)
37937
- throw new Error(`launch material: ${path4} carries nothing this reader recognises. A launch that references material and supplies none is a broken launcher, not an open-mode launch, so it is refused rather than defaulted.`);
37938
- return material;
37939
- }
37940
- function discardLaunchMaterial(path4) {
37941
- const file2 = resolve(path4);
37942
- try {
37943
- rmSync(file2, { force: true });
37944
- } catch {
37945
- }
37946
- const dir = dirname(file2);
37947
- if (basename(file2) !== MATERIAL_FILE || !basename(dir).startsWith(DIR_PREFIX))
37948
- return;
37949
- try {
37950
- if (realpathSync(dirname(dir)) !== realpathSync(tmpdir()))
37951
- return;
37952
- rmdirSync(dir);
37953
- } catch {
37954
- }
37691
+ return new import_kv5.Kvm(nc).open(deliveryBucket(space));
37955
37692
  }
37956
37693
 
37957
37694
  // ../../packages/core/dist/endpoint.js
37958
- var import_transport_node17 = __toESM(require_transport_node(), 1);
37959
- var import_nats_core = __toESM(require_mod3(), 1);
37960
- import { EventEmitter as EventEmitter2 } from "node:events";
37961
- import { randomUUID } from "node:crypto";
37962
- import { createConnection } from "node:net";
37963
-
37964
- // ../../packages/core/dist/artifact.js
37965
- var ARTIFACT_PART_KIND = "artifact";
37966
- function isArtifactPart(value) {
37967
- if (!value || typeof value !== "object")
37968
- return false;
37969
- const p = value;
37970
- return p.kind === ARTIFACT_PART_KIND && typeof p.name === "string" && p.name.length > 0 && typeof p.mediaType === "string" && p.mediaType.length > 0 && typeof p.digest === "string" && isContractDigest(p.digest) && typeof p.size === "number" && Number.isSafeInteger(p.size) && p.size >= 0;
37971
- }
37972
-
37973
- // ../../packages/core/dist/endpoint.js
37974
- var import_jetstream13 = __toESM(require_mod4(), 1);
37975
- var import_jetstream14 = __toESM(require_mod4(), 1);
37976
- var import_kv8 = __toESM(require_mod6(), 1);
37977
- var import_internal2 = __toESM(require_internal_mod3(), 1);
37978
37695
  var DEFAULT_SERVER = "nats://127.0.0.1:4222";
37979
37696
  var PLANE3_FRAME_HEADER = "Cotal-Delivery-Frame";
37980
37697
  var READER_MAX_REDELIVERIES = 10;
@@ -38225,7 +37942,7 @@ var CotalEndpoint = class _CotalEndpoint extends EventEmitter2 {
38225
37942
  this.user = opts.user;
38226
37943
  this.pass = opts.pass;
38227
37944
  this.tls = opts.tls ?? false;
38228
- this.channels = opts.channels ?? ["general"];
37945
+ this.channels = opts.channels ?? [];
38229
37946
  this.heartbeatMs = opts.heartbeatMs ?? 2e3;
38230
37947
  this.ttlMs = opts.ttlMs ?? 6e3;
38231
37948
  this.doRegister = opts.registerPresence ?? true;
@@ -38488,7 +38205,7 @@ var CotalEndpoint = class _CotalEndpoint extends EventEmitter2 {
38488
38205
  this.watchStatus();
38489
38206
  this.js = (0, import_jetstream13.jetstream)(this.nc);
38490
38207
  if (this.doWatch || this.doRegister) {
38491
- const kvm = new import_kv8.Kvm(this.nc);
38208
+ const kvm = new import_kv6.Kvm(this.nc);
38492
38209
  this.kv = this.authed ? await kvm.open(presenceBucket(this.space)) : await kvm.create(presenceBucket(this.space), { ttl: this.ttlMs });
38493
38210
  }
38494
38211
  if (this.doWatch) {
@@ -38752,7 +38469,9 @@ var CotalEndpoint = class _CotalEndpoint extends EventEmitter2 {
38752
38469
  // ---- messaging -----------------------------------------------------------
38753
38470
  /** Multicast: broadcast to everyone on a channel. */
38754
38471
  async multicast(text, opts) {
38755
- const channel = opts?.channel ?? this.channels.find(isConcreteChannel) ?? "general";
38472
+ const channel = opts?.channel ?? this.channels.find(isConcreteChannel);
38473
+ if (!channel)
38474
+ throw new Error("send() needs a channel: this endpoint is on no concrete channel, so there is no default to fall back to - pass opts.channel");
38756
38475
  if (!isConcreteChannel(channel))
38757
38476
  throw new Error(`cannot publish to wildcard channel "${channel}" - pick a concrete sub-channel`);
38758
38477
  const msg = {
@@ -38868,7 +38587,7 @@ var CotalEndpoint = class _CotalEndpoint extends EventEmitter2 {
38868
38587
  throw new Error(`expectedLastSubjectSeq must be a non-negative safe integer, got ${JSON.stringify(opts.expectedLastSubjectSeq)}`);
38869
38588
  if (!Array.isArray(opts.parts) || opts.parts.length === 0)
38870
38589
  throw new Error("encodedSize requires at least one part");
38871
- const mh = (0, import_transport_node17.headers)();
38590
+ const mh = (0, import_transport_node14.headers)();
38872
38591
  mh.set("Nats-Msg-Id", opts.id);
38873
38592
  mh.set("Nats-Expected-Last-Subject-Sequence", `${opts.expectedLastSubjectSeq}`);
38874
38593
  const headerBytes = mh.encode().length;
@@ -39374,7 +39093,7 @@ var CotalEndpoint = class _CotalEndpoint extends EventEmitter2 {
39374
39093
  async membershipFeedRegistry() {
39375
39094
  if (!this.nc)
39376
39095
  throw new Error("endpoint not started");
39377
- this.membershipFeedKv ??= await new import_kv8.Kvm(this.nc).open(membershipBucket(this.space));
39096
+ this.membershipFeedKv ??= await new import_kv6.Kvm(this.nc).open(membershipBucket(this.space));
39378
39097
  return this.membershipFeedKv;
39379
39098
  }
39380
39099
  /**
@@ -39740,7 +39459,7 @@ var CotalEndpoint = class _CotalEndpoint extends EventEmitter2 {
39740
39459
  for await (const s of this.nc.status()) {
39741
39460
  if (s.type !== "error")
39742
39461
  continue;
39743
- if (s.error instanceof import_transport_node17.PermissionViolationError && this.confirmingChatSubs.has(s.error.subject))
39462
+ if (s.error instanceof import_transport_node14.PermissionViolationError && this.confirmingChatSubs.has(s.error.subject))
39744
39463
  continue;
39745
39464
  this.emit("error", describeStatusError(s.error));
39746
39465
  }
@@ -39963,7 +39682,7 @@ var CotalEndpoint = class _CotalEndpoint extends EventEmitter2 {
39963
39682
  throw new Error("endpoint not started");
39964
39683
  if (this.managerLeaseKv)
39965
39684
  return this.managerLeaseKv;
39966
- const kvm = new import_kv8.Kvm((0, import_jetstream13.jetstream)(this.nc, { timeout: MANAGER_LEASE_ATTEMPT_MS }));
39685
+ const kvm = new import_kv6.Kvm((0, import_jetstream13.jetstream)(this.nc, { timeout: MANAGER_LEASE_ATTEMPT_MS }));
39967
39686
  if (this.authed) {
39968
39687
  this.managerLeaseKv = await kvm.open(managerBucket(this.space));
39969
39688
  } else {
@@ -40193,7 +39912,7 @@ var CotalEndpoint = class _CotalEndpoint extends EventEmitter2 {
40193
39912
  filter_subject: subject,
40194
39913
  ack_policy: import_jetstream13.AckPolicy.None,
40195
39914
  mem_storage: true,
40196
- inactive_threshold: (0, import_transport_node17.nanos)(3e4),
39915
+ inactive_threshold: (0, import_transport_node14.nanos)(3e4),
40197
39916
  deliver_policy: import_jetstream13.DeliverPolicy.StartSequence,
40198
39917
  opt_start_seq: fromSeqExcl + 1
40199
39918
  });
@@ -40655,7 +40374,7 @@ var CotalEndpoint = class _CotalEndpoint extends EventEmitter2 {
40655
40374
  channel: entry.channel,
40656
40375
  msg: authenticatedChannelMessage(entry.msg, entry.channel)
40657
40376
  };
40658
- const frameHeaders = (0, import_transport_node17.headers)();
40377
+ const frameHeaders = (0, import_transport_node14.headers)();
40659
40378
  frameHeaders.set(PLANE3_FRAME_HEADER, "1");
40660
40379
  await this.js.publish(dlvSubject(this.space, pr.owner, pr.actor, pr.lifecycleUid), JSON.stringify(frame), {
40661
40380
  msgID: `${entry.msg.id}:${owner}:${pr.lifecycleUid}:${entry.generation}`,
@@ -40785,7 +40504,7 @@ var CotalEndpoint = class _CotalEndpoint extends EventEmitter2 {
40785
40504
  * distinct from a responder that errored. nats.js surfaces it as NoRespondersError, or a RequestError
40786
40505
  * whose `isNoResponders()` is true. */
40787
40506
  isNoResponders(e) {
40788
- return e instanceof import_transport_node17.NoRespondersError || e instanceof import_transport_node17.RequestError && e.isNoResponders();
40507
+ return e instanceof import_transport_node14.NoRespondersError || e instanceof import_transport_node14.RequestError && e.isNoResponders();
40789
40508
  }
40790
40509
  /** Agent-side: this session's CURRENT durable memberships (channel + join generation) from the
40791
40510
  * manager — the agent holds no read on the privileged members KV. `undefined` ⇒ NO control responder
@@ -41128,7 +40847,7 @@ var CotalEndpoint = class _CotalEndpoint extends EventEmitter2 {
41128
40847
  filter_subject: subject,
41129
40848
  ack_policy: import_jetstream13.AckPolicy.None,
41130
40849
  mem_storage: true,
41131
- inactive_threshold: (0, import_transport_node17.nanos)(3e4),
40850
+ inactive_threshold: (0, import_transport_node14.nanos)(3e4),
41132
40851
  ..."time" in start ? { deliver_policy: import_jetstream13.DeliverPolicy.StartTime, opt_start_time: start.time.toISOString() } : { deliver_policy: import_jetstream13.DeliverPolicy.StartSequence, opt_start_seq: start.seq }
41133
40852
  });
41134
40853
  try {
@@ -41489,7 +41208,7 @@ function authOpts(a) {
41489
41208
  if (!a.sentinelCreds)
41490
41209
  throw new Error("user-mode bearer requires sentinelCreds");
41491
41210
  return {
41492
- authenticator: [(0, import_transport_node17.credsAuthenticator)(new TextEncoder().encode(a.sentinelCreds)), (0, import_transport_node17.tokenAuthenticator)(a.bearer)],
41211
+ authenticator: [(0, import_transport_node14.credsAuthenticator)(new TextEncoder().encode(a.sentinelCreds)), (0, import_transport_node14.tokenAuthenticator)(a.bearer)],
41493
41212
  tls
41494
41213
  };
41495
41214
  }
@@ -41497,7 +41216,7 @@ function authOpts(a) {
41497
41216
  if (a.token || a.user || a.pass)
41498
41217
  throw new Error("creds are mutually exclusive with token/user/pass auth");
41499
41218
  const creds = a.creds;
41500
- const authenticator = typeof creds === "function" ? (nonce3) => (0, import_transport_node17.credsAuthenticator)(new TextEncoder().encode(creds()))(nonce3) : (0, import_transport_node17.credsAuthenticator)(new TextEncoder().encode(creds));
41219
+ const authenticator = typeof creds === "function" ? (nonce3) => (0, import_transport_node14.credsAuthenticator)(new TextEncoder().encode(creds()))(nonce3) : (0, import_transport_node14.credsAuthenticator)(new TextEncoder().encode(creds));
41501
41220
  return { authenticator, tls };
41502
41221
  }
41503
41222
  return { token: a.token, user: a.user, pass: a.pass, tls };
@@ -41532,25 +41251,32 @@ function decodeBearerPrincipal(bearer) {
41532
41251
  return { owner, actor };
41533
41252
  }
41534
41253
  function describeStatusError(err2) {
41535
- if (err2 instanceof import_transport_node17.PermissionViolationError) {
41254
+ if (err2 instanceof import_transport_node14.PermissionViolationError) {
41536
41255
  return new Error(`NATS permission denied: cannot ${err2.operation} "${err2.subject}" - check this endpoint's ACLs (a denied peer looks "absent" rather than blocked)`, { cause: err2 });
41537
41256
  }
41538
41257
  return err2;
41539
41258
  }
41540
41259
  function isPermissionDenied(e) {
41541
- if (e instanceof import_transport_node17.PermissionViolationError)
41260
+ if (e instanceof import_transport_node14.PermissionViolationError)
41542
41261
  return true;
41543
- if (e?.cause instanceof import_transport_node17.PermissionViolationError)
41262
+ if (e?.cause instanceof import_transport_node14.PermissionViolationError)
41544
41263
  return true;
41545
41264
  return /permissions?\s+violation/i.test(String(e?.message ?? ""));
41546
41265
  }
41547
41266
  function isPublishPermissionDenied(e) {
41548
- const typed = e instanceof import_transport_node17.PermissionViolationError ? e : e?.cause instanceof import_transport_node17.PermissionViolationError ? e.cause : void 0;
41267
+ const typed = e instanceof import_transport_node14.PermissionViolationError ? e : e?.cause instanceof import_transport_node14.PermissionViolationError ? e.cause : void 0;
41549
41268
  return typed?.operation === "publish";
41550
41269
  }
41270
+ function wsServers(servers) {
41271
+ return /^wss?:\/\//i.test((servers.split(",")[0] ?? "").trim());
41272
+ }
41551
41273
  function dialerFor(servers) {
41552
- const first = (servers.split(",")[0] ?? "").trim();
41553
- return /^wss?:\/\//i.test(first) ? import_nats_core.wsconnect : import_transport_node17.connect;
41274
+ if (!wsServers(servers))
41275
+ return import_transport_node14.connect;
41276
+ return ((opts) => {
41277
+ const { tls: _tls, ...rest } = opts ?? {};
41278
+ return (0, import_nats_core.wsconnect)(rest);
41279
+ });
41554
41280
  }
41555
41281
  function hostPort(server) {
41556
41282
  const raw = (server.split(",")[0] ?? "").trim();
@@ -41615,13 +41341,300 @@ function classifyProbeFailure(e, opts) {
41615
41341
  } catch {
41616
41342
  }
41617
41343
  }
41618
- if (e instanceof import_transport_node17.UserAuthenticationExpiredError)
41344
+ if (e instanceof import_transport_node14.UserAuthenticationExpiredError)
41619
41345
  return { ok: false, reason: "stale-auth" };
41620
- if (e instanceof import_transport_node17.AuthorizationError)
41346
+ if (e instanceof import_transport_node14.AuthorizationError)
41621
41347
  return { ok: false, reason: "auth-required" };
41622
41348
  return { ok: false, reason: "unreachable" };
41623
41349
  }
41624
41350
 
41351
+ // ../../packages/core/dist/channels.js
41352
+ function parseDuration(s) {
41353
+ const m = /^(\d+)(s|m|h|d)$/.exec(s.trim());
41354
+ if (!m)
41355
+ throw new Error(`invalid duration "${s}" - expected <number><s|m|h|d>, e.g. "24h"`);
41356
+ const n = Number(m[1]);
41357
+ const unit = { s: 1e3, m: 6e4, h: 36e5, d: 864e5 }[m[2]];
41358
+ return n * unit;
41359
+ }
41360
+ function effectiveReplay(cfg, defaults) {
41361
+ return cfg?.replay ?? defaults?.replay ?? true;
41362
+ }
41363
+ function effectiveReplayWindowMs(cfg, defaults) {
41364
+ const w = cfg?.replayWindow ?? defaults?.replayWindow;
41365
+ return w === void 0 ? void 0 : parseDuration(w);
41366
+ }
41367
+ function effectiveDeliveryClass(cfg, defaults) {
41368
+ return cfg?.deliveryClass ?? defaults?.deliveryClass ?? "durable";
41369
+ }
41370
+ async function openChannelRegistry(nc, space, opts = {}) {
41371
+ const kvm = new import_kv7.Kvm(nc);
41372
+ return opts.create ? kvm.create(channelBucket(space)) : kvm.open(channelBucket(space));
41373
+ }
41374
+ async function readChannelConfig(kv, channel) {
41375
+ return decode2(kv, channel);
41376
+ }
41377
+ async function readChannelDefaults(kv) {
41378
+ return decode2(kv, CHANNEL_DEFAULTS_KEY);
41379
+ }
41380
+ async function decode2(kv, key) {
41381
+ const e = await kv.get(key);
41382
+ if (!e || e.operation === "DEL" || e.operation === "PURGE")
41383
+ return void 0;
41384
+ try {
41385
+ return e.json();
41386
+ } catch {
41387
+ return void 0;
41388
+ }
41389
+ }
41390
+
41391
+ // ../../packages/core/dist/membership-feed.js
41392
+ var import_transport_node16 = __toESM(require_transport_node(), 1);
41393
+ var import_kv8 = __toESM(require_mod6(), 1);
41394
+
41395
+ // ../../packages/core/dist/evict.js
41396
+ var import_transport_node17 = __toESM(require_transport_node(), 1);
41397
+
41398
+ // ../../packages/core/dist/agent-file.js
41399
+ import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
41400
+ var import_yaml = __toESM(require_dist(), 1);
41401
+ function parseFrontmatter(src, path4) {
41402
+ let doc;
41403
+ try {
41404
+ doc = (0, import_yaml.parse)(src);
41405
+ } catch (e) {
41406
+ throw new Error(`agent file ${path4}: invalid YAML frontmatter; ${e.message}`);
41407
+ }
41408
+ if (doc === null || doc === void 0)
41409
+ return {};
41410
+ if (typeof doc !== "object" || Array.isArray(doc))
41411
+ throw new Error(`agent file ${path4}: frontmatter must be a YAML mapping (key: value pairs)`);
41412
+ return doc;
41413
+ }
41414
+ function loadAgentFile(path4) {
41415
+ const src = readFileSync(path4, "utf8");
41416
+ const m = /^---\n([\s\S]*?)\n---\n?([\s\S]*)$/.exec(src);
41417
+ if (!m)
41418
+ throw new Error(`agent file ${path4}: missing "---" frontmatter block`);
41419
+ const fm = parseFrontmatter(m[1], path4);
41420
+ const persona = m[2].trim();
41421
+ const str2 = (k) => {
41422
+ const v = fm[k];
41423
+ if (v === void 0 || v === null)
41424
+ return void 0;
41425
+ if (typeof v === "object")
41426
+ throw new Error(`agent file ${path4}: "${k}" must be a scalar`);
41427
+ return String(v);
41428
+ };
41429
+ const list = (k) => {
41430
+ const v = fm[k];
41431
+ if (v === void 0 || v === null)
41432
+ return void 0;
41433
+ return (Array.isArray(v) ? v : [v]).map((x) => {
41434
+ if (x === null || typeof x === "object")
41435
+ throw new Error(`agent file ${path4}: "${k}" list items must be scalars`);
41436
+ return String(x);
41437
+ });
41438
+ };
41439
+ const name = str2("name");
41440
+ if (!name)
41441
+ throw new Error(`agent file ${path4}: "name" is required`);
41442
+ assertValidName(name);
41443
+ const kind = str2("kind");
41444
+ if (kind && kind !== "agent" && kind !== "endpoint")
41445
+ throw new Error(`agent file ${path4}: "kind" must be "agent" or "endpoint"`);
41446
+ for (const old of ["channels", "publish"])
41447
+ if (old in fm)
41448
+ throw new Error(`agent file ${path4}: "${old}" was renamed - use "subscribe"/"allowSubscribe" (read) and "allowPublish" (post)`);
41449
+ const subscribe = list("subscribe");
41450
+ const allowSubscribe = list("allowSubscribe");
41451
+ const allowPublish = list("allowPublish");
41452
+ const quiet = list("quiet");
41453
+ const muted = list("muted");
41454
+ for (const ch of [...subscribe ?? [], ...allowSubscribe ?? [], ...allowPublish ?? []])
41455
+ try {
41456
+ assertValidChannel(ch);
41457
+ } catch (e) {
41458
+ throw new Error(`agent file ${path4}: ${e.message}`);
41459
+ }
41460
+ const effSubscribe = subscribe ?? [];
41461
+ const effAllow = allowSubscribe?.length ? allowSubscribe : effSubscribe;
41462
+ for (const ch of effSubscribe)
41463
+ if (!channelInAllow(effAllow, ch))
41464
+ throw new Error(`agent file ${path4}: subscribe channel "${ch}" is not within allowSubscribe [${effAllow.join(", ")}]`);
41465
+ const both = (quiet ?? []).filter((c) => (muted ?? []).includes(c));
41466
+ if (both.length)
41467
+ throw new Error(`agent file ${path4}: channel(s) [${both.join(", ")}] are in both quiet and muted - pick one`);
41468
+ for (const [field, chans] of [["quiet", quiet], ["muted", muted]])
41469
+ for (const ch of chans ?? []) {
41470
+ try {
41471
+ assertValidChannel(ch);
41472
+ } catch (e) {
41473
+ throw new Error(`agent file ${path4}: ${e.message}`);
41474
+ }
41475
+ if (!isConcreteChannel(ch))
41476
+ throw new Error(`agent file ${path4}: ${field} channel "${ch}" must be a concrete channel (no wildcard)`);
41477
+ if (!channelInAllow(effAllow, ch))
41478
+ throw new Error(`agent file ${path4}: ${field} channel "${ch}" is not within your read ACL / allowSubscribe [${effAllow.join(", ")}]`);
41479
+ }
41480
+ const launchOptionsRaw = fm["launchOptions"];
41481
+ let launchOptions;
41482
+ if (launchOptionsRaw !== void 0 && launchOptionsRaw !== null) {
41483
+ if (typeof launchOptionsRaw !== "object" || Array.isArray(launchOptionsRaw))
41484
+ throw new Error(`agent file ${path4}: "launchOptions" must be a mapping of key: value pairs`);
41485
+ launchOptions = launchOptionsRaw;
41486
+ }
41487
+ const known = /* @__PURE__ */ new Set(["name", "role", "kind", "description", "tags", "subscribe", "allowSubscribe", "allowPublish", "quiet", "muted", "model", "variant", "launchOptions", "capabilities", "owner"]);
41488
+ const meta3 = {};
41489
+ for (const [k, v] of Object.entries(fm))
41490
+ if (!known.has(k) && v !== null && typeof v !== "object")
41491
+ meta3[k] = String(v);
41492
+ return {
41493
+ name,
41494
+ role: str2("role"),
41495
+ kind,
41496
+ description: str2("description"),
41497
+ tags: list("tags"),
41498
+ subscribe,
41499
+ allowSubscribe,
41500
+ allowPublish,
41501
+ quiet,
41502
+ muted,
41503
+ model: str2("model"),
41504
+ variant: str2("variant"),
41505
+ launchOptions,
41506
+ capabilities: list("capabilities"),
41507
+ owner: str2("owner"),
41508
+ meta: Object.keys(meta3).length ? meta3 : void 0,
41509
+ persona: persona || void 0
41510
+ };
41511
+ }
41512
+
41513
+ // ../../packages/core/dist/secret-fs.js
41514
+ import { chmodSync, mkdirSync as mkdirSync2, renameSync, unlinkSync, writeFileSync as writeFileSync2 } from "node:fs";
41515
+ import { execFileSync } from "node:child_process";
41516
+ import { join } from "node:path";
41517
+ var isWin = process.platform === "win32";
41518
+ function sys32(exe) {
41519
+ const root = process.env.SystemRoot || process.env.windir || "C:\\Windows";
41520
+ return join(root, "System32", exe);
41521
+ }
41522
+ var cachedSid;
41523
+ function ownerSid() {
41524
+ if (cachedSid)
41525
+ return cachedSid;
41526
+ const out = execFileSync(sys32("whoami.exe"), ["/user", "/fo", "csv", "/nh"], { encoding: "utf8" });
41527
+ const sid = out.trim().split(",").pop()?.replace(/^"|"$/g, "").trim();
41528
+ if (!sid || !/^S-1-/.test(sid))
41529
+ throw new Error(`could not determine the current user's SID from \`whoami\` (got: ${out.trim()})`);
41530
+ cachedSid = sid;
41531
+ return sid;
41532
+ }
41533
+ var BROAD_SIDS = ["S-1-1-0", "S-1-5-11", "S-1-5-32-545"];
41534
+ function hardenPrivate(path4, kind) {
41535
+ if (!isWin) {
41536
+ chmodSync(path4, kind === "dir" ? 448 : 384);
41537
+ return;
41538
+ }
41539
+ const perm = kind === "dir" ? "(OI)(CI)(F)" : "(F)";
41540
+ const removeBroad = BROAD_SIDS.flatMap((sid) => ["/remove:g", `*${sid}`]);
41541
+ const grant = (sid) => ["/grant:r", `*${sid}:${perm}`];
41542
+ try {
41543
+ execFileSync(sys32("icacls.exe"), [
41544
+ path4,
41545
+ "/inheritance:r",
41546
+ ...removeBroad,
41547
+ ...grant(ownerSid()),
41548
+ ...grant("S-1-5-18"),
41549
+ ...grant("S-1-5-32-544")
41550
+ ], { stdio: ["ignore", "ignore", "pipe"] });
41551
+ } catch (e) {
41552
+ throw new Error(`failed to harden ${kind} "${path4}" to private via icacls: ${e.message.trim()}. Cotal will not leave a secret with a permissive ACL - ensure the path is on an NTFS volume and %SystemRoot%\\System32\\icacls.exe is available.`);
41553
+ }
41554
+ }
41555
+
41556
+ // ../../packages/core/dist/launch-material.js
41557
+ import { mkdtempSync, readFileSync as readFileSync2, realpathSync, rmSync, rmdirSync, statSync } from "node:fs";
41558
+ import { tmpdir } from "node:os";
41559
+ import { basename, dirname, join as join2, resolve } from "node:path";
41560
+ var DIR_PREFIX = "cotal-launch-";
41561
+ var MATERIAL_FILE = "material.json";
41562
+ var LAUNCH_MATERIAL_ENV = "COTAL_LAUNCH_MATERIAL";
41563
+ function readLaunchMaterial(path4) {
41564
+ let raw;
41565
+ try {
41566
+ if (process.platform !== "win32") {
41567
+ const mode = statSync(path4).mode & 511;
41568
+ if (mode & 63)
41569
+ throw new Error(`is readable beyond its owner (mode ${mode.toString(8)}) - refusing to read connection material out of a file other local users can open`);
41570
+ }
41571
+ raw = readFileSync2(path4, "utf8");
41572
+ } catch (e) {
41573
+ throw new Error(`launch material: cannot read ${path4} (${e instanceof Error ? e.message : String(e)})`);
41574
+ }
41575
+ let parsed;
41576
+ try {
41577
+ parsed = JSON.parse(raw);
41578
+ } catch {
41579
+ throw new Error(`launch material: ${path4} is not valid JSON`);
41580
+ }
41581
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
41582
+ throw new Error(`launch material: ${path4} must contain a JSON object`);
41583
+ return validate(parsed, path4);
41584
+ }
41585
+ function validate(raw, path4) {
41586
+ const material = {};
41587
+ const str2 = (key) => {
41588
+ const v = raw[key];
41589
+ if (v === void 0)
41590
+ return;
41591
+ if (typeof v !== "string" || !v.trim())
41592
+ throw new Error(`launch material: ${path4} has a ${key} that is not a non-empty string`);
41593
+ material[key] = v;
41594
+ };
41595
+ str2("servers");
41596
+ str2("creds");
41597
+ str2("token");
41598
+ str2("controlToken");
41599
+ if (raw.userAuth !== void 0) {
41600
+ const u = raw.userAuth;
41601
+ if (typeof u !== "object" || u === null || Array.isArray(u))
41602
+ throw new Error(`launch material: ${path4} has a userAuth that is not an object`);
41603
+ const { owner, actor, sentinelCredsPath, bearerCmd } = u;
41604
+ const named = { owner, actor, sentinelCredsPath };
41605
+ for (const [k, v] of Object.entries(named))
41606
+ if (typeof v !== "string" || !v.trim())
41607
+ throw new Error(`launch material: ${path4} has a userAuth.${k} that is not a non-empty string`);
41608
+ if (!Array.isArray(bearerCmd) || bearerCmd.length === 0 || !bearerCmd.every((a) => typeof a === "string" && a))
41609
+ throw new Error(`launch material: ${path4} has a userAuth.bearerCmd that is not a non-empty array of strings`);
41610
+ material.userAuth = {
41611
+ owner,
41612
+ actor,
41613
+ sentinelCredsPath,
41614
+ bearerCmd
41615
+ };
41616
+ }
41617
+ if (Object.keys(material).length === 0)
41618
+ throw new Error(`launch material: ${path4} carries nothing this reader recognises. A launch that references material and supplies none is a broken launcher, not an open-mode launch, so it is refused rather than defaulted.`);
41619
+ return material;
41620
+ }
41621
+ function discardLaunchMaterial(path4) {
41622
+ const file2 = resolve(path4);
41623
+ try {
41624
+ rmSync(file2, { force: true });
41625
+ } catch {
41626
+ }
41627
+ const dir = dirname(file2);
41628
+ if (basename(file2) !== MATERIAL_FILE || !basename(dir).startsWith(DIR_PREFIX))
41629
+ return;
41630
+ try {
41631
+ if (realpathSync(dirname(dir)) !== realpathSync(tmpdir()))
41632
+ return;
41633
+ rmdirSync(dir);
41634
+ } catch {
41635
+ }
41636
+ }
41637
+
41625
41638
  // ../../packages/core/dist/spaces.js
41626
41639
  var import_transport_node18 = __toESM(require_transport_node(), 1);
41627
41640
  var import_jetstream15 = __toESM(require_mod4(), 1);
@@ -42012,7 +42025,7 @@ function configFromEnv(env = process.env) {
42012
42025
  if (!name)
42013
42026
  throw new Error("COTAL_NAME, COTAL_AGENT_FILE or COTAL_LINK is required \u2014 a Cotal session needs an explicit identity from its launcher");
42014
42027
  const subscribe = splitList(env.COTAL_SUBSCRIBE);
42015
- const resolvedSubscribe = subscribe.length ? subscribe : def?.subscribe ?? link?.channels ?? ["general"];
42028
+ const resolvedSubscribe = subscribe.length ? subscribe : def?.subscribe ?? link?.channels ?? [];
42016
42029
  const allowSub = splitList(env.COTAL_ALLOW_SUBSCRIBE);
42017
42030
  const resolvedAllowSub = allowSub.length ? allowSub : def?.allowSubscribe ?? resolvedSubscribe;
42018
42031
  for (const ch of resolvedSubscribe)
@@ -57722,7 +57735,7 @@ config(en_default());
57722
57735
 
57723
57736
  // ../connector-core/dist/docs-bundle.generated.js
57724
57737
  var DOCS_BUNDLE = {
57725
- "version": "0.27.0",
57738
+ "version": "0.28.1",
57726
57739
  "generatedFrom": "docs/*.md + SPEC.md + spec/cotal-lang.md + spec/cotal.schema.json",
57727
57740
  "pages": [
57728
57741
  {
package/dist/index.js CHANGED
@@ -14830,7 +14830,7 @@ import { isConcreteChannel as isConcreteChannel3, channelInAllow as channelInAll
14830
14830
 
14831
14831
  // ../connector-core/dist/docs-bundle.generated.js
14832
14832
  var DOCS_BUNDLE = {
14833
- "version": "0.27.0",
14833
+ "version": "0.28.1",
14834
14834
  "generatedFrom": "docs/*.md + SPEC.md + spec/cotal-lang.md + spec/cotal.schema.json",
14835
14835
  "pages": [
14836
14836
  {
package/dist/mcp.js CHANGED
@@ -20471,11 +20471,11 @@ var require_connect = __commonJS({
20471
20471
  "../../node_modules/.pnpm/@nats-io+transport-node@3.4.0/node_modules/@nats-io/transport-node/lib/connect.js"(exports) {
20472
20472
  "use strict";
20473
20473
  Object.defineProperty(exports, "__esModule", { value: true });
20474
- exports.connect = connect8;
20474
+ exports.connect = connect7;
20475
20475
  var node_transport_1 = require_node_transport();
20476
20476
  var nats_base_client_1 = require_nats_base_client();
20477
20477
  var nats_base_client_2 = require_nats_base_client();
20478
- function connect8(opts = {}) {
20478
+ function connect7(opts = {}) {
20479
20479
  if ((0, nats_base_client_2.hasWsProtocol)(opts)) {
20480
20480
  return Promise.reject(nats_base_client_2.errors.InvalidArgumentError.format(`servers`, `node client doesn't support websockets, use the 'wsconnect' function instead`));
20481
20481
  }
@@ -57225,44 +57225,46 @@ var SYS_LIMITS = { ...BASE_LIMITS, mem_storage: 0, disk_storage: 0 };
57225
57225
  var import_nkeys4 = __toESM(require_mod2(), 1);
57226
57226
 
57227
57227
  // ../../packages/core/dist/channels.js
57228
- var import_kv4 = __toESM(require_mod6(), 1);
57229
- var import_transport_node13 = __toESM(require_transport_node(), 1);
57230
-
57231
- // ../../packages/core/dist/members.js
57232
- var import_kv5 = __toESM(require_mod6(), 1);
57228
+ var import_kv7 = __toESM(require_mod6(), 1);
57229
+ var import_transport_node15 = __toESM(require_transport_node(), 1);
57233
57230
 
57234
- // ../../packages/core/dist/membership-feed.js
57231
+ // ../../packages/core/dist/endpoint.js
57235
57232
  var import_transport_node14 = __toESM(require_transport_node(), 1);
57233
+ var import_nats_core = __toESM(require_mod3(), 1);
57234
+ var import_jetstream13 = __toESM(require_mod4(), 1);
57235
+ var import_jetstream14 = __toESM(require_mod4(), 1);
57236
57236
  var import_kv6 = __toESM(require_mod6(), 1);
57237
+ var import_internal2 = __toESM(require_internal_mod3(), 1);
57237
57238
 
57238
- // ../../packages/core/dist/evict.js
57239
- var import_transport_node15 = __toESM(require_transport_node(), 1);
57239
+ // ../../packages/core/dist/members.js
57240
+ var import_kv4 = __toESM(require_mod6(), 1);
57240
57241
 
57241
57242
  // ../../packages/core/dist/lease.js
57242
- var import_kv7 = __toESM(require_mod6(), 1);
57243
- var import_transport_node16 = __toESM(require_transport_node(), 1);
57244
-
57245
- // ../../packages/core/dist/agent-file.js
57246
- var import_yaml = __toESM(require_dist2(), 1);
57247
-
57248
- // ../../packages/core/dist/secret-fs.js
57249
- var isWin = process.platform === "win32";
57243
+ var import_kv5 = __toESM(require_mod6(), 1);
57244
+ var import_transport_node13 = __toESM(require_transport_node(), 1);
57250
57245
 
57251
57246
  // ../../packages/core/dist/endpoint.js
57252
- var import_transport_node17 = __toESM(require_transport_node(), 1);
57253
- var import_nats_core = __toESM(require_mod3(), 1);
57254
- var import_jetstream13 = __toESM(require_mod4(), 1);
57255
- var import_jetstream14 = __toESM(require_mod4(), 1);
57256
- var import_kv8 = __toESM(require_mod6(), 1);
57257
- var import_internal2 = __toESM(require_internal_mod3(), 1);
57258
57247
  function isPermissionDenied(e) {
57259
- if (e instanceof import_transport_node17.PermissionViolationError)
57248
+ if (e instanceof import_transport_node14.PermissionViolationError)
57260
57249
  return true;
57261
- if (e?.cause instanceof import_transport_node17.PermissionViolationError)
57250
+ if (e?.cause instanceof import_transport_node14.PermissionViolationError)
57262
57251
  return true;
57263
57252
  return /permissions?\s+violation/i.test(String(e?.message ?? ""));
57264
57253
  }
57265
57254
 
57255
+ // ../../packages/core/dist/membership-feed.js
57256
+ var import_transport_node16 = __toESM(require_transport_node(), 1);
57257
+ var import_kv8 = __toESM(require_mod6(), 1);
57258
+
57259
+ // ../../packages/core/dist/evict.js
57260
+ var import_transport_node17 = __toESM(require_transport_node(), 1);
57261
+
57262
+ // ../../packages/core/dist/agent-file.js
57263
+ var import_yaml = __toESM(require_dist2(), 1);
57264
+
57265
+ // ../../packages/core/dist/secret-fs.js
57266
+ var isWin = process.platform === "win32";
57267
+
57266
57268
  // ../../packages/core/dist/spaces.js
57267
57269
  var import_transport_node18 = __toESM(require_transport_node(), 1);
57268
57270
  var import_jetstream15 = __toESM(require_mod4(), 1);
@@ -57518,7 +57520,7 @@ import { execFileSync } from "node:child_process";
57518
57520
 
57519
57521
  // ../connector-core/dist/docs-bundle.generated.js
57520
57522
  var DOCS_BUNDLE = {
57521
- "version": "0.27.0",
57523
+ "version": "0.28.1",
57522
57524
  "generatedFrom": "docs/*.md + SPEC.md + spec/cotal-lang.md + spec/cotal.schema.json",
57523
57525
  "pages": [
57524
57526
  {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cotal-ai/connector-jcode",
3
3
  "description": "Cotal connector for Jcode: a host-mode mesh peer driven through Jcode's Harness API bridge.",
4
- "version": "0.28.0-hack-20260823234508",
4
+ "version": "0.28.1",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -18,7 +18,7 @@
18
18
  }
19
19
  },
20
20
  "peerDependencies": {
21
- "@cotal-ai/core": "0.28.0-hack-20260823234508"
21
+ "@cotal-ai/core": ">=0.1.0"
22
22
  },
23
23
  "dependencies": {
24
24
  "@1jehuang/jcode-sdk": "^1.1.0",
@@ -28,9 +28,9 @@
28
28
  "esbuild": "^0.28.0",
29
29
  "tsx": "^4.22.4",
30
30
  "zod": "^4.4.3",
31
- "@cotal-ai/connector-core": "0.28.0-hack-20260823234508",
32
- "@cotal-ai/core": "0.28.0-hack-20260823234508",
33
- "@cotal-ai/smoke-kit": "0.0.0"
31
+ "@cotal-ai/connector-core": "0.28.1",
32
+ "@cotal-ai/smoke-kit": "0.0.0",
33
+ "@cotal-ai/core": "0.28.1"
34
34
  },
35
35
  "files": [
36
36
  "dist"