@insitue/capture-core 0.1.0 → 0.3.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/index.d.ts CHANGED
@@ -22,7 +22,7 @@ declare function breakpointFor(w: number): string;
22
22
  * `__reactFiber$*` expando React attaches to host DOM nodes in dev,
23
23
  * walks `_debugOwner`/`return`, and harvests `_debugSource`
24
24
  * ({ fileName, lineNumber, columnNumber }) plus component names.
25
- * Falls back to a build-injected `data-insitu-source` attribute.
25
+ * Falls back to a build-injected `data-insitue-source` attribute.
26
26
  */
27
27
 
28
28
  declare function resolveTarget(el: Element): CaptureTarget;
@@ -47,7 +47,7 @@ declare const CAPTURE_SCHEMA_VERSION: 3;
47
47
  /** Bump when the WS envelope below changes; companion/SDK pin it.
48
48
  * v2: agent edit-loop messages (M2). v3: session undo/commit (M3).
49
49
  * v4: agent-activity (M6 — live "what it's doing" feedback). */
50
- declare const PROTOCOL_VERSION: 4;
50
+ declare const PROTOCOL_VERSION: 5;
51
51
  interface SourceLoc {
52
52
  /** Repo-relative POSIX path, e.g. `components/MainBar.tsx`. */
53
53
  file: string;
@@ -343,9 +343,38 @@ interface AgentSessionCommittedMsg {
343
343
  commit: string;
344
344
  files: string[];
345
345
  }
346
+ /** Browser → companion: user clicked Send in the overlay's ASK
347
+ * textbox AND a CLI/MCP subscriber is attached. Companion
348
+ * re-broadcasts as `broadcast-ask` to subscribers and does NOT
349
+ * spawn its own headless agent. */
350
+ interface AgentAskExternalMsg {
351
+ t: "agent-ask-external";
352
+ turnId: string;
353
+ bundleId: string;
354
+ text: string;
355
+ }
356
+ /** Companion → CLI/MCP subscribers: a browser just sent an external
357
+ * ask. Joined with the matching `broadcast-capture` by `bundleId`
358
+ * in the subscriber (the MCP bridge holds picks for a few seconds
359
+ * so the ask catches up). */
360
+ interface BroadcastAskMsg {
361
+ t: "broadcast-ask";
362
+ bundleId: string;
363
+ text: string;
364
+ at: string;
365
+ }
366
+ /** Companion → browser: how many CLI/MCP subscribers are currently
367
+ * attached. Pushed on every connect + disconnect so the overlay
368
+ * can show/hide the "→ claude in terminal" badge and route Send
369
+ * accordingly. count=0 means "no external agent attached — Send
370
+ * goes to the in-overlay headless agent (today's behavior)". */
371
+ interface SubscribersAttachedMsg {
372
+ t: "subscribers-attached";
373
+ count: number;
374
+ }
346
375
  /** Client→server messages. */
347
- type ClientMessage = HelloMsg | PingMsg | CaptureSubmitMsg | AgentTurnMsg | AgentDecisionMsg | AgentCancelMsg | AgentUndoMsg | AgentUndoSessionMsg | AgentCommitSessionMsg;
376
+ type ClientMessage = HelloMsg | PingMsg | CaptureSubmitMsg | AgentTurnMsg | AgentAskExternalMsg | AgentDecisionMsg | AgentCancelMsg | AgentUndoMsg | AgentUndoSessionMsg | AgentCommitSessionMsg;
348
377
  /** Server→client messages. */
349
- type ServerMessage = HelloOkMsg | PongMsg | ErrorMsg | CaptureResolvedMsg | AgentStatusMsg | AgentStreamMsg | ChangesetProposedMsg | ChangesetAppliedMsg | AgentUndoneMsg | AgentSessionUndoneMsg | AgentSessionCommittedMsg;
378
+ type ServerMessage = HelloOkMsg | PongMsg | ErrorMsg | CaptureResolvedMsg | AgentStatusMsg | AgentStreamMsg | ChangesetProposedMsg | ChangesetAppliedMsg | AgentUndoneMsg | AgentSessionUndoneMsg | AgentSessionCommittedMsg | SubscribersAttachedMsg;
350
379
 
351
- export { type AgentCancelMsg, type AgentCommitSessionMsg, type AgentDecisionMsg, type AgentErrorCode, type AgentEvent, type AgentSessionCommittedMsg, type AgentSessionUndoneMsg, type AgentStatusMsg, type AgentStreamMsg, type AgentTurnMsg, type AgentUndoMsg, type AgentUndoSessionMsg, type AgentUndoneMsg, CAPTURE_SCHEMA_VERSION, type CaptureBundle, type CaptureCore, type CaptureResolvedMsg, type CaptureSink, type CaptureSubmitMsg, type CaptureTarget, type ChangesetAppliedMsg, type ChangesetProposedMsg, type ClientMessage, type ConsoleEntry, type ErrorMsg, type HelloMsg, type HelloOkMsg, type IssueDraft, IssueTrackerSink, type NetworkEntry, PROTOCOL_VERSION, type PingMsg, type PongMsg, type ProposedEdit, type ResolvedSource, type RuntimeError, type SelectionInput, type SelectionMode, type SerializedNode, type ServerMessage, type SourceConfidence, type SourceLoc, breakpointFor, buildSelector, curateComputedStyles, extractTailwindClasses, resolveTarget, serializeNode, toIssueDraft };
380
+ export { type AgentAskExternalMsg, type AgentCancelMsg, type AgentCommitSessionMsg, type AgentDecisionMsg, type AgentErrorCode, type AgentEvent, type AgentSessionCommittedMsg, type AgentSessionUndoneMsg, type AgentStatusMsg, type AgentStreamMsg, type AgentTurnMsg, type AgentUndoMsg, type AgentUndoSessionMsg, type AgentUndoneMsg, type BroadcastAskMsg, CAPTURE_SCHEMA_VERSION, type CaptureBundle, type CaptureCore, type CaptureResolvedMsg, type CaptureSink, type CaptureSubmitMsg, type CaptureTarget, type ChangesetAppliedMsg, type ChangesetProposedMsg, type ClientMessage, type ConsoleEntry, type ErrorMsg, type HelloMsg, type HelloOkMsg, type IssueDraft, IssueTrackerSink, type NetworkEntry, PROTOCOL_VERSION, type PingMsg, type PongMsg, type ProposedEdit, type ResolvedSource, type RuntimeError, type SelectionInput, type SelectionMode, type SerializedNode, type ServerMessage, type SourceConfidence, type SourceLoc, type SubscribersAttachedMsg, breakpointFor, buildSelector, curateComputedStyles, extractTailwindClasses, resolveTarget, serializeNode, toIssueDraft };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/dom.ts
2
2
  var SKIP_TAGS = /* @__PURE__ */ new Set(["SCRIPT", "STYLE", "NOSCRIPT", "TEMPLATE"]);
3
- var ATTR_DENY = /^(on|data-insitu)/i;
3
+ var ATTR_DENY = /^(on|data-insitue)/i;
4
4
  var SECRETISH = /(token|secret|key|password|authorization|bearer)/i;
5
5
  function serializeNode(el, depth = 3, maxChildren = 12) {
6
6
  const attrs = {};
@@ -138,7 +138,7 @@ function toLoc(workspaceCwdRelative) {
138
138
  function fromAttribute(el) {
139
139
  let cur = el;
140
140
  for (let i = 0; cur && i < 8; i++, cur = cur.parentElement) {
141
- const raw = cur.getAttribute("data-insitu-source");
141
+ const raw = cur.getAttribute("data-insitue-source");
142
142
  if (raw) {
143
143
  const m = /^(.*):(\d+):(\d+)$/.exec(raw);
144
144
  if (m) return { file: m[1], line: Number(m[2]), column: Number(m[3]) };
@@ -188,7 +188,7 @@ function resolveTarget(el) {
188
188
 
189
189
  // src/index.ts
190
190
  var CAPTURE_SCHEMA_VERSION = 3;
191
- var PROTOCOL_VERSION = 4;
191
+ var PROTOCOL_VERSION = 5;
192
192
  function toIssueDraft(bundle) {
193
193
  const t = bundle.target;
194
194
  const where = t?.source ? `\`${t.source.file}:${t.source.line}\` (${t.confidence})` : t ? `\`${t.selector}\` (selector-only \u2014 no source resolver)` : "(empty selection)";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@insitue/capture-core",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"