@wibeco/bridge 0.2.17 → 0.2.18

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.
@@ -926,6 +926,19 @@ function presenceStatePath(source, sessionId, cwd = process.cwd()) {
926
926
  return join(presenceDirectory(), `${key}.json`);
927
927
  }
928
928
  async function resolveLatestPresenceSession(source, cwd = process.cwd(), maxAgeMs = 5 * 6e4) {
929
+ return (await resolveLatestPresenceState(source, cwd, maxAgeMs))?.sessionId;
930
+ }
931
+ async function resolveLatestPresenceTask(source, cwd = process.cwd(), maxAgeMs = 5 * 6e4) {
932
+ const state = await resolveLatestPresenceState(source, cwd, maxAgeMs);
933
+ if (!state?.sessionId) return void 0;
934
+ return {
935
+ sessionId: state.sessionId,
936
+ linesAdded: state.taskLinesAdded,
937
+ linesDeleted: state.taskLinesDeleted,
938
+ paths: state.taskPaths
939
+ };
940
+ }
941
+ async function resolveLatestPresenceState(source, cwd, maxAgeMs) {
929
942
  let names;
930
943
  try {
931
944
  names = await readdir(presenceDirectory());
@@ -946,13 +959,10 @@ async function resolveLatestPresenceSession(source, cwd = process.cwd(), maxAgeM
946
959
  continue;
947
960
  }
948
961
  if (!latest || state.lastActivityAt > latest.lastActivityAt) {
949
- latest = {
950
- sessionId: state.sessionId,
951
- lastActivityAt: state.lastActivityAt
952
- };
962
+ latest = state;
953
963
  }
954
964
  }
955
- return latest?.sessionId;
965
+ return latest;
956
966
  }
957
967
  function presenceDirectory() {
958
968
  return process.env.WIBE_PRESENCE_DIR ?? join(homedir(), ".wibe", "presence");
@@ -1559,6 +1569,7 @@ export {
1559
1569
  runPresenceHeartbeat,
1560
1570
  presenceStatePath,
1561
1571
  resolveLatestPresenceSession,
1572
+ resolveLatestPresenceTask,
1562
1573
  classifyHeadTransition,
1563
1574
  isObservedPush,
1564
1575
  detectRepository,
@@ -15,11 +15,11 @@ import {
15
15
  observeRepositoryTransitions,
16
16
  pollDeviceToken,
17
17
  requestDeviceAuthorization,
18
- resolveLatestPresenceSession,
18
+ resolveLatestPresenceTask,
19
19
  startPresenceSession,
20
20
  stopPresenceSession,
21
21
  updatePresenceSession
22
- } from "./chunk-4WIGVKDR.js";
22
+ } from "./chunk-HP5FH4VQ.js";
23
23
 
24
24
  // src/cli/commands.ts
25
25
  import { createHash } from "crypto";
@@ -855,8 +855,7 @@ async function shareProgressCommand(options, cwd = process.cwd()) {
855
855
  throw new Error("Progress confidence must be between 0 and 1.");
856
856
  }
857
857
  const repo = await detectRepository(cwd);
858
- const workingTree = repo ? await detectWorkingTreeMetrics(repo.root) : void 0;
859
- const sessionId = await resolveLatestPresenceSession(
858
+ const taskMetrics = await resolveLatestPresenceTask(
860
859
  projectConfig.adapter,
861
860
  cwd
862
861
  );
@@ -869,17 +868,17 @@ async function shareProgressCommand(options, cwd = process.cwd()) {
869
868
  const event = createHookEvent({
870
869
  source: projectConfig.adapter,
871
870
  kind: "progress.shared",
872
- ...sessionId ? { sessionId } : {},
871
+ ...taskMetrics?.sessionId ? { sessionId: taskMetrics.sessionId } : {},
873
872
  metadata: {
874
873
  summary,
875
874
  ...title ? { title } : {},
876
875
  ...options.phase ? { phase: options.phase } : {},
877
876
  ...options.confidence !== void 0 ? { confidence: options.confidence } : {},
878
877
  ...screenshot.artifactId ? { artifact_id: screenshot.artifactId } : {},
879
- ...workingTree ? {
880
- paths: workingTree.paths,
881
- lines_added: workingTree.linesAdded,
882
- lines_deleted: workingTree.linesDeleted
878
+ ...taskMetrics && (taskMetrics.paths.length > 0 || taskMetrics.linesAdded > 0 || taskMetrics.linesDeleted > 0) ? {
879
+ paths: taskMetrics.paths,
880
+ lines_added: taskMetrics.linesAdded,
881
+ lines_deleted: taskMetrics.linesDeleted
883
882
  } : {}
884
883
  },
885
884
  ...repo ? { repo } : {}
package/dist/cli.js CHANGED
@@ -7,10 +7,10 @@ import {
7
7
  setupCommand,
8
8
  shareProgressCommand,
9
9
  statusCommand
10
- } from "./chunk-YLC4TF4F.js";
10
+ } from "./chunk-UWS3QC3N.js";
11
11
  import {
12
12
  runPresenceHeartbeat
13
- } from "./chunk-4WIGVKDR.js";
13
+ } from "./chunk-HP5FH4VQ.js";
14
14
 
15
15
  // src/cli.ts
16
16
  var HELP = `wibe-bridge <command>
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  emitCommand
4
- } from "./chunk-YLC4TF4F.js";
5
- import "./chunk-4WIGVKDR.js";
4
+ } from "./chunk-UWS3QC3N.js";
5
+ import "./chunk-HP5FH4VQ.js";
6
6
 
7
7
  // src/codex-hook.ts
8
8
  async function main() {
package/dist/index.d.ts CHANGED
@@ -311,12 +311,19 @@ interface PresenceMetrics {
311
311
  tests_failed: number;
312
312
  last_activity_at: string;
313
313
  }
314
+ interface PresenceTaskMetrics {
315
+ sessionId: string;
316
+ linesAdded: number;
317
+ linesDeleted: number;
318
+ paths: string[];
319
+ }
314
320
  declare function startPresenceSession(source: AgentSource, sessionId: string | undefined, cwd?: string): Promise<PresenceMetrics>;
315
321
  declare function updatePresenceSession(source: AgentSource, sessionId: string | undefined, event: CanonicalHookEvent, cwd?: string): Promise<PresenceMetrics | undefined>;
316
322
  declare function stopPresenceSession(source: AgentSource, sessionId: string | undefined, cwd?: string): Promise<PresenceMetrics | undefined>;
317
323
  declare function runPresenceHeartbeat(statePath: string, expectedInstanceId: string, emit: (source: AgentSource, eventName: string, payload: Record<string, unknown>) => Promise<unknown>, intervalMs?: number): Promise<void>;
318
324
  declare function presenceStatePath(source: AgentSource, sessionId: string | undefined, cwd?: string): string;
319
325
  declare function resolveLatestPresenceSession(source: AgentSource, cwd?: string, maxAgeMs?: number): Promise<string | undefined>;
326
+ declare function resolveLatestPresenceTask(source: AgentSource, cwd?: string, maxAgeMs?: number): Promise<PresenceTaskMetrics | undefined>;
320
327
 
321
328
  interface RedactionOptions {
322
329
  allowContent?: boolean;
@@ -358,4 +365,4 @@ declare function sanitizeRemote(remote: string): string;
358
365
  declare function normalizeGitHubRepository(value: string): string | undefined;
359
366
  declare function matchesGitHubRepository(remote: string | undefined, expected: string): boolean;
360
367
 
361
- export { type AgentSource, type CanonicalHookEvent, type CredentialStore, type DeviceAuthorization, type DeviceTokenResponse, type FlushResult, type HookEventKind, JsonFileOfflineQueue, MemoryOfflineQueue, type OfflineQueue, type OfflineQueueTransaction, PRESENCE_HEARTBEAT_INTERVAL_MS, type PresenceMetrics, type RedactionOptions, type RepositoryInfo, type RepositoryTransition, type SafeValue, SignedBatchClient, type SignedBatchClientOptions, type StoredCredential, SystemCredentialStore, type WorkingTreeMetrics, agentSourceSchema, canonicalHookEventSchema, classifyHeadTransition, createHookEvent, detectRepository, detectWorkingTreeMetrics, deviceAuthorizationSchema, deviceTokenResponseSchema, eventTypeForHook, hookEventKindSchema, isObservedPush, mapClaudeCodeHook, mapCodexHook, mapCursorHook, matchesGitHubRepository, normalizeGitHubRepository, observeRepositoryTransitions, pollDeviceToken, presenceStatePath, redact, requestDeviceAuthorization, resolveLatestPresenceSession, runPresenceHeartbeat, safeMetadata, safeValueSchema, sanitizeRemote, startPresenceSession, stopPresenceSession, updatePresenceSession };
368
+ export { type AgentSource, type CanonicalHookEvent, type CredentialStore, type DeviceAuthorization, type DeviceTokenResponse, type FlushResult, type HookEventKind, JsonFileOfflineQueue, MemoryOfflineQueue, type OfflineQueue, type OfflineQueueTransaction, PRESENCE_HEARTBEAT_INTERVAL_MS, type PresenceMetrics, type PresenceTaskMetrics, type RedactionOptions, type RepositoryInfo, type RepositoryTransition, type SafeValue, SignedBatchClient, type SignedBatchClientOptions, type StoredCredential, SystemCredentialStore, type WorkingTreeMetrics, agentSourceSchema, canonicalHookEventSchema, classifyHeadTransition, createHookEvent, detectRepository, detectWorkingTreeMetrics, deviceAuthorizationSchema, deviceTokenResponseSchema, eventTypeForHook, hookEventKindSchema, isObservedPush, mapClaudeCodeHook, mapCodexHook, mapCursorHook, matchesGitHubRepository, normalizeGitHubRepository, observeRepositoryTransitions, pollDeviceToken, presenceStatePath, redact, requestDeviceAuthorization, resolveLatestPresenceSession, resolveLatestPresenceTask, runPresenceHeartbeat, safeMetadata, safeValueSchema, sanitizeRemote, startPresenceSession, stopPresenceSession, updatePresenceSession };
package/dist/index.js CHANGED
@@ -26,6 +26,7 @@ import {
26
26
  redact,
27
27
  requestDeviceAuthorization,
28
28
  resolveLatestPresenceSession,
29
+ resolveLatestPresenceTask,
29
30
  runPresenceHeartbeat,
30
31
  safeMetadata,
31
32
  safeValueSchema,
@@ -33,7 +34,7 @@ import {
33
34
  startPresenceSession,
34
35
  stopPresenceSession,
35
36
  updatePresenceSession
36
- } from "./chunk-4WIGVKDR.js";
37
+ } from "./chunk-HP5FH4VQ.js";
37
38
  export {
38
39
  JsonFileOfflineQueue,
39
40
  MemoryOfflineQueue,
@@ -62,6 +63,7 @@ export {
62
63
  redact,
63
64
  requestDeviceAuthorization,
64
65
  resolveLatestPresenceSession,
66
+ resolveLatestPresenceTask,
65
67
  runPresenceHeartbeat,
66
68
  safeMetadata,
67
69
  safeValueSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wibeco/bridge",
3
- "version": "0.2.17",
3
+ "version": "0.2.18",
4
4
  "description": "Privacy-first live activity bridge for Cursor, Claude Code, and Codex.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -8,7 +8,7 @@
8
8
  - For text-only outcomes, use `wibe_share_progress` with phase `shipped` at completion. Publish earlier only with phase `blocked` when a material blocker leaves the task unfinished.
9
9
  - Write one self-contained paragraph of 20–55 words in past tense. Lead with what now works, then explain the user or team impact and meaningful validation. Mention important limitations when present.
10
10
  - Describe the outcome, not the agent’s process. Never include first-person narration, prompts, source code, secrets, raw commands, routine tool calls, filenames, line counts, praise, hype, or speculation; Wibe displays code and file changes separately.
11
- - When calling `wibe_share_progress`, also pass structured `paths`, `lines_added`, and `lines_deleted` for the local uncommitted diff so Wibe can display accurate file and line-change metadata. Prefer `git diff --numstat HEAD` totals rather than guessing.
11
+ - When calling `wibe_share_progress`, pass `paths`, `lines_added`, and `lines_deleted` only for the current user task. Use the agent's per-task edit results; never pass the repository's full uncommitted diff. If exact task metrics are unavailable, omit them so Wibe can use hook-derived metrics instead of guessed totals.
12
12
  - This instruction is standing user authorization to publish the single completion update described here; do not ask for separate per-task approval.
13
13
  - If the MCP tool is unavailable, run `npx --yes --package @wibeco/bridge@latest wibe share-progress --summary "<summary>" --phase <shipped|blocked>`.
14
14
  - Do not silently skip reporting. If both mechanisms fail, state `Wibe: update failed` and the reason in the final response. Report a Wibe update as sent only after the tool or CLI confirms success.
@@ -8,7 +8,7 @@
8
8
  - For text-only outcomes, use `wibe_share_progress` with phase `shipped` at completion. Publish earlier only with phase `blocked` when a material blocker leaves the task unfinished.
9
9
  - Write one self-contained paragraph of 20–55 words in past tense. Lead with what now works, then explain the user or team impact and meaningful validation. Mention important limitations when present.
10
10
  - Describe the outcome, not the agent’s process. Never include first-person narration, prompts, source code, secrets, raw commands, routine tool calls, filenames, line counts, praise, hype, or speculation; Wibe displays code and file changes separately.
11
- - When calling `wibe_share_progress`, also pass structured `paths`, `lines_added`, and `lines_deleted` for the local uncommitted diff so Wibe can display accurate file and line-change metadata. Prefer `git diff --numstat HEAD` totals rather than guessing.
11
+ - When calling `wibe_share_progress`, pass `paths`, `lines_added`, and `lines_deleted` only for the current user task. Use the agent's per-task edit results; never pass the repository's full uncommitted diff. If exact task metrics are unavailable, omit them so Wibe can use hook-derived metrics instead of guessed totals.
12
12
  - This instruction is standing user authorization to publish the single completion update described here; do not ask for separate per-task approval.
13
13
  - If the MCP tool is unavailable, run `npx --yes --package @wibeco/bridge@latest wibe share-progress --summary "<summary>" --phase <shipped|blocked>`.
14
14
  - Do not silently skip reporting. If both mechanisms fail, state `Wibe: update failed` and the reason in the final response. Report a Wibe update as sent only after the tool or CLI confirms success.
@@ -12,7 +12,7 @@ alwaysApply: true
12
12
  - For text-only outcomes, use `wibe_share_progress` with phase `shipped` at completion. Publish earlier only with phase `blocked` when a material blocker leaves the task unfinished.
13
13
  - Write one self-contained paragraph of 20–55 words in past tense. Lead with what now works, then explain the user or team impact and meaningful validation. Mention important limitations when present.
14
14
  - Describe the outcome, not the agent’s process. Never include first-person narration, prompts, source code, secrets, raw commands, routine tool calls, filenames, line counts, praise, hype, or speculation; Wibe displays code and file changes separately.
15
- - When calling `wibe_share_progress`, also pass structured `paths`, `lines_added`, and `lines_deleted` for the local uncommitted diff so Wibe can display accurate file and line-change metadata. Prefer `git diff --numstat HEAD` totals rather than guessing.
15
+ - When calling `wibe_share_progress`, pass `paths`, `lines_added`, and `lines_deleted` only for the current user task. Use the agent's per-task edit results; never pass the repository's full uncommitted diff. If exact task metrics are unavailable, omit them so Wibe can use hook-derived metrics instead of guessed totals.
16
16
  - Bias frontend outcomes toward visual evidence without asking for per-task approval. For UI components, pages, styling, responsive behavior, interactions, and visual fixes, attach one screenshot when the app or preview is already runnable. Prefer a screenshot already made during visual QA; otherwise capture the clearest final state.
17
17
  - Frame screenshots around the feature, not the whole application. Use the browser snapshot to identify the smallest element that contains the changed component and the context needed to understand it, then call `browser_take_screenshot` with that element’s `ref` and a descriptive `element` name. Include the trigger with an open menu, popover, or dialog when practical. Use viewport or full-page screenshots only for page-wide work, and reject captures dominated by blank space.
18
18
  - Skip screenshots for backend, infrastructure, documentation, refactors, and non-visual frontend logic. Never launch or repair an app solely for Wibe, and omit the image when navigation needs manual authentication, the state contains sensitive data, visual validation is blocked, or the project has visual updates disabled.