@cotal-ai/connector-claude-code 0.91.0 → 0.92.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/mcp.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAyHtD,yFAAyF;AACzF,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IACvB,KAAK,EAAE,QAAQ,CAAC;IAChB,MAAM,EAAE,QAAQ,CAAC;IACjB;uDACmD;IACnD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;gFAC4E;IAC5E,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb;uDACmD;IACnD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED;;+BAE+B;AAC/B,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,aAAa,CAAC,CAQ3F"}
1
+ {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AA2HtD,yFAAyF;AACzF,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IACvB,KAAK,EAAE,QAAQ,CAAC;IAChB,MAAM,EAAE,QAAQ,CAAC;IACjB;uDACmD;IACnD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;gFAC4E;IAC5E,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb;uDACmD;IACnD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED;;+BAE+B;AAC/B,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,aAAa,CAAC,CAQ3F"}
package/dist/monitor.cjs CHANGED
@@ -55,6 +55,7 @@ function wakeSockets(claudePid) {
55
55
  // src/monitor.ts
56
56
  var SCAN_MS = 1e3;
57
57
  var wakeEvent = (id) => `Cotal: a new message for connection_id ${id}. Read it with cotal_inbox.`;
58
+ var previewEvent = (id, preview) => `Cotal preview for connection_id ${id}: ${JSON.stringify(preview)}`;
58
59
  function main() {
59
60
  if (hasIdentity()) return;
60
61
  const claude = process.argv.includes("--native") ? process.ppid : Number(process.env.CLAUDE_PID);
@@ -72,12 +73,22 @@ function main() {
72
73
  s.on("data", (d) => {
73
74
  buf += d;
74
75
  for (let i; (i = buf.indexOf("\n")) >= 0; ) {
75
- const id = buf.slice(0, i);
76
+ const line = buf.slice(0, i);
76
77
  buf = buf.slice(i + 1);
77
- if (WAKE_ID.test(id)) process.stdout.write(`${wakeEvent(id)}
78
+ try {
79
+ const frame = JSON.parse(line);
80
+ if (typeof frame.id !== "string" || !WAKE_ID.test(frame.id)) continue;
81
+ const preview = frame.preview;
82
+ if (!preview || !Number.isInteger(preview.unread) || !Array.isArray(preview.rows) || preview.rows.length > 8 || !preview.rows.every((row) => typeof row === "string" && Array.from(row).length <= 240)) continue;
83
+ process.stdout.write(`${previewEvent(frame.id, preview)}
84
+ ${wakeEvent(frame.id)}
78
85
  `);
86
+ } catch {
87
+ if (WAKE_ID.test(line)) process.stdout.write(`${wakeEvent(line)}
88
+ `);
89
+ }
79
90
  }
80
- if (buf.length > 256) s.destroy();
91
+ if (buf.length > 4096) s.destroy();
81
92
  });
82
93
  s.on("error", () => {
83
94
  });
@@ -1 +1 @@
1
- {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAMA,OAAO,EAKL,KAAK,sBAAsB,EAK5B,MAAM,gBAAgB,CAAC;AA2IxB,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM,GAAG,IAAI,CA8CvJ;AAqCD,oGAAoG;AACpG,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACxB,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACnE,CAKA;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAK/D;AA6PD,eAAO,MAAM,mBAAmB,EAAE,sBAgGjC,CAAC"}
1
+ {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAMA,OAAO,EAML,KAAK,sBAAsB,EAK5B,MAAM,gBAAgB,CAAC;AAqJxB,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM,GAAG,IAAI,CA8CvJ;AAqCD,oGAAoG;AACpG,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACxB,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACnE,CAKA;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAK/D;AA6PD,eAAO,MAAM,mBAAmB,EAAE,sBAsGjC,CAAC"}
@@ -1,3 +1,4 @@
1
+ import type { RenderedInboxPreview } from "@cotal-ai/connector-core";
1
2
  /** A connection id the feed carries. Gateway ids are UUIDs, so anything else is not one. */
2
3
  export declare const WAKE_ID: RegExp;
3
4
  /** The socket server `serverPid` opens for the Claude Code process `claudePid`. */
@@ -5,8 +6,8 @@ export declare function wakeSocketPath(claudePid: number, serverPid?: number): s
5
6
  /** The feed sockets of the Claude Code process `claudePid` whose server is running, one per server. */
6
7
  export declare function wakeSockets(claudePid: number): string[];
7
8
  export interface WakeFeed {
8
- /** Write `id` to every monitor reading the feed. False when none is. */
9
- send(id: string): boolean;
9
+ /** Write one bounded preview + `id` to every monitor reading the feed. False when none is. */
10
+ send(id: string, preview: RenderedInboxPreview): boolean;
10
11
  /** Whether a monitor is reading the feed now. */
11
12
  watched(): boolean;
12
13
  /** Run `fn` each time a monitor starts reading. */
@@ -1 +1 @@
1
- {"version":3,"file":"wake-feed.d.ts","sourceRoot":"","sources":["../src/wake-feed.ts"],"names":[],"mappings":"AAcA,4FAA4F;AAC5F,eAAO,MAAM,OAAO,QAA2B,CAAC;AA6BhD,mFAAmF;AACnF,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,GAAE,MAAoB,GAAG,MAAM,CAGzF;AAED,uGAAuG;AACv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_-]{1,128})\. Read it with cotal_inbox\.$/;
2
+ const PREVIEW = /^Cotal preview for connection_id ([A-Za-z0-9_-]{1,128}): (\{.*\})$/;
2
3
  const pending = new Set();
3
4
  const expanded = new Set();
4
5
  const wakeRows = new Set();
6
+ const previews = new Map();
5
7
  let submitting = false;
6
8
  let paused = false;
7
9
  let active = false;
@@ -54,7 +56,16 @@ async function listen($) {
54
56
  for (let end; (end = buffer.indexOf('\n')) >= 0;) {
55
57
  const line = buffer.slice(0, end);
56
58
  buffer = buffer.slice(end + 1);
57
- if (WAKE.test(line)) {
59
+ const preview = PREVIEW.exec(line);
60
+ if (preview) {
61
+ try {
62
+ const value = JSON.parse(preview[2]);
63
+ if (Number.isInteger(value.unread) && value.unread >= 0 && Array.isArray(value.rows) &&
64
+ value.rows.length <= 8 && value.rows.every(row => typeof row === 'string' && Array.from(row).length <= 240)) {
65
+ previews.set(preview[1], value);
66
+ }
67
+ } catch {}
68
+ } else if (WAKE.test(line)) {
58
69
  pending.add(line);
59
70
  void submit($);
60
71
  }
@@ -87,6 +98,8 @@ export function register(on) {
87
98
  // Some app versions include their attribution wrapper in the rendered text. Match only our
88
99
  // fixed wake line, and keep the full original available through the disclosure below.
89
100
  if (!e.props.text.split(/\r?\n/).some(line => WAKE.test(line))) return next(e);
101
+ const id = e.props.text.split(/\r?\n/).map(line => WAKE.exec(line)?.[1]).find(Boolean);
102
+ const preview = id ? previews.get(id) : undefined;
90
103
  const { Box, Button } = $.ui.resolve(e);
91
104
  const open = expanded.has(e.requestId);
92
105
  return Box({
@@ -94,7 +107,9 @@ export function register(on) {
94
107
  children: [
95
108
  Button({
96
109
  key: 'cotal-wake-details',
97
- label: open ? 'Cotal · new message ▾' : 'Cotal · new message ›',
110
+ label: preview
111
+ ? `Cotal · ${preview.unread} unread ${open ? '▾' : '›'}`
112
+ : open ? 'Cotal · new message ▾' : 'Cotal · new message ›',
98
113
  plain: true,
99
114
  onPress: () => {
100
115
  if (open) expanded.delete(e.requestId);
@@ -102,7 +117,9 @@ export function register(on) {
102
117
  $.ui.invalidate('ui.render');
103
118
  },
104
119
  }),
105
- ...(open ? [await next(e)] : []),
120
+ ...(open ? preview?.rows?.length
121
+ ? preview.rows.map((row, index) => Box({ key: `cotal-preview-${index}`, children: [row] }))
122
+ : [await next(e)] : []),
106
123
  ],
107
124
  });
108
125
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cotal-ai/connector-claude-code",
3
3
  "description": "Cotal connector for Claude Code: an installed plugin that joins a session to the mesh.",
4
- "version": "0.91.0",
4
+ "version": "0.92.1",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -25,8 +25,8 @@
25
25
  "@cotal-ai/core": ">=0.1.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@cotal-ai/connector-core": "0.91.0",
29
- "@cotal-ai/core": "0.91.0",
28
+ "@cotal-ai/connector-core": "0.92.1",
29
+ "@cotal-ai/core": "0.92.1",
30
30
  "@cotal-ai/smoke-kit": "0.0.0",
31
31
  "@modelcontextprotocol/sdk": "^1.29.0",
32
32
  "@nats-io/transport-node": "^3.4.0",
@@ -45,7 +45,7 @@
45
45
  "access": "public"
46
46
  },
47
47
  "scripts": {
48
- "test": "tsx smoke/launch-env.smoke.ts && tsx smoke/native-wake.smoke.ts",
48
+ "test": "tsx smoke/launch-env.smoke.ts && tsx smoke/native-wake.smoke.ts && tsx smoke/wake-preview-frame.smoke.ts",
49
49
  "test:desktop-setup": "tsx smoke/desktop-only-setup-live.smoke.ts",
50
50
  "test:upgrade": "tsx smoke/plugin-upgrade-live.smoke.ts",
51
51
  "typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.smoke.json",