@jpcasabiancai/cayenne 0.5.12 → 0.5.13

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/cli.js +31 -12
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -12363,7 +12363,7 @@ function asInterrupted(row) {
12363
12363
  )
12364
12364
  };
12365
12365
  }
12366
- var SESSION_FLAG_SETTINGS, SESSION_ASK_TOOLS, GUARD_FAILED, WRITE_TOOLS_MATCHER, CONTEXT_HOOK_TIMEOUT_MS, ASK_TOOL_REASON, CAYENNE_CHECK_MS, CAYENNE_CHECK_POLL_MS, CAYENNE_UNCONFIRMED, TOOL_FAILED, toResult, INTERRUPTED, STOPPED_TURN, ClaudeSession;
12366
+ var SESSION_FLAG_SETTINGS, SESSION_ASK_TOOLS, GUARD_FAILED, WRITE_TOOLS_MATCHER, CONTEXT_HOOK_TIMEOUT_MS, ASK_TOOL_REASON, CAYENNE_CHECK_MS, CAYENNE_CHECK_POLL_MS, CAYENNE_UNLISTED_POLL_MS, CAYENNE_UNCONFIRMED, TOOL_FAILED, toResult, INTERRUPTED, STOPPED_TURN, ClaudeSession;
12367
12367
  var init_session2 = __esm({
12368
12368
  "src/claude/session.ts"() {
12369
12369
  "use strict";
@@ -12386,6 +12386,7 @@ var init_session2 = __esm({
12386
12386
  ASK_TOOL_REASON = "This session was started from a task, so every shell command needs the member's approval.";
12387
12387
  CAYENNE_CHECK_MS = 1e4;
12388
12388
  CAYENNE_CHECK_POLL_MS = 100;
12389
+ CAYENNE_UNLISTED_POLL_MS = 1e3;
12389
12390
  CAYENNE_UNCONFIRMED = "Refused: the cayenne MCP server is not confirmed as the runner\u2019s own.";
12390
12391
  TOOL_FAILED = "Cayenne could not answer this call.";
12391
12392
  toResult = (a) => ({
@@ -12665,15 +12666,21 @@ var init_session2 = __esm({
12665
12666
  *
12666
12667
  * Any other answer stops the session. A `cayenne` with another `serverInfo` or config type is a
12667
12668
  * foreign server (`CAYENNE_NAME_TAKEN`); one never confirmed (connected without `serverInfo`, a
12668
- * status other than `pending`, still pending or unlisted at the deadline, a status call that
12669
- * fails) ends with `CAYENNE_UNCONFIRMED_EXIT`, the reason logged at warn. Until confirmed,
12670
- * `canUseTool` refuses every `cayenne` tool. A session already stopping or ended is left alone.
12669
+ * status other than `pending`, still pending at the deadline, a status call that fails) ends with
12670
+ * `CAYENNE_UNCONFIRMED_EXIT`, the reason logged at warn. Until confirmed, `canUseTool` refuses
12671
+ * every `cayenne` tool. A session already stopping or ended is left alone.
12672
+ *
12673
+ * An unlisted `cayenne` is waited for, not stopped: the CLI answers `[]` before it registers its
12674
+ * MCP servers, and on a slow network that took longer than the window (three chats killed
12675
+ * 2026-10-21/22). Nothing answers under the name meanwhile, so no tool of it can be called.
12671
12676
  */
12672
12677
  async confirmCayenne(q) {
12673
12678
  let deadline;
12679
+ let unlistedSince;
12680
+ let unlistedWarned = false;
12681
+ const warn = this.opts.log?.warn ?? ((obj, m) => logger.warn(obj, m));
12674
12682
  const end = (fatal, fields, msg) => {
12675
12683
  if (this.ending) return false;
12676
- const warn = this.opts.log?.warn ?? ((obj, m) => logger.warn(obj, m));
12677
12684
  warn({ providerSessionId: this.providerSessionId, ...fields }, msg);
12678
12685
  this.fatal = fatal;
12679
12686
  void this.stop();
@@ -12688,21 +12695,33 @@ var init_session2 = __esm({
12688
12695
  for (; ; ) {
12689
12696
  if (this.ending) return false;
12690
12697
  const statuses = await q.mcpServerStatus();
12691
- deadline ??= Date.now() + CAYENNE_CHECK_MS;
12692
12698
  const entry = statuses.find((s) => s.name === CAYENNE_SERVER);
12693
- const config2 = entry?.config;
12694
- const info = entry?.serverInfo;
12699
+ if (!entry) {
12700
+ unlistedSince ??= Date.now();
12701
+ if (!unlistedWarned && Date.now() - unlistedSince >= CAYENNE_CHECK_MS) {
12702
+ unlistedWarned = true;
12703
+ warn(
12704
+ { providerSessionId: this.providerSessionId },
12705
+ "cayenne MCP server not listed yet; its tools stay refused until it is"
12706
+ );
12707
+ }
12708
+ await new Promise((r) => setTimeout(r, CAYENNE_UNLISTED_POLL_MS));
12709
+ continue;
12710
+ }
12711
+ deadline ??= Date.now() + CAYENNE_CHECK_MS;
12712
+ const config2 = entry.config;
12713
+ const info = entry.serverInfo;
12695
12714
  if (config2 !== void 0 && config2.type !== "sdk" || info !== void 0 && (info.name !== CAYENNE_SERVER || info.version !== this.cayenneVersion)) {
12696
- return end(CAYENNE_NAME_TAKEN, { scope: entry?.scope }, CAYENNE_NAME_TAKEN);
12715
+ return end(CAYENNE_NAME_TAKEN, { scope: entry.scope }, CAYENNE_NAME_TAKEN);
12697
12716
  }
12698
- if (entry?.status === "connected") {
12717
+ if (entry.status === "connected") {
12699
12718
  return info !== void 0 || unconfirmed("connected without serverInfo", entry.scope);
12700
12719
  }
12701
- if (entry && entry.status !== "pending") {
12720
+ if (entry.status !== "pending") {
12702
12721
  return unconfirmed(`status ${entry.status}`, entry.scope);
12703
12722
  }
12704
12723
  if (Date.now() >= deadline) {
12705
- return unconfirmed(entry ? "still pending" : "not listed by mcpServerStatus");
12724
+ return unconfirmed("still pending", entry.scope);
12706
12725
  }
12707
12726
  await new Promise((r) => setTimeout(r, CAYENNE_CHECK_POLL_MS));
12708
12727
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jpcasabiancai/cayenne",
3
- "version": "0.5.12",
3
+ "version": "0.5.13",
4
4
  "files": [
5
5
  "dist/cli.js"
6
6
  ],