@adhdev/daemon-core 0.9.82-rc.407 → 0.9.82-rc.409

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.
@@ -1,8 +1,19 @@
1
1
  import type { GitRepoStatus } from './git-types.js';
2
2
  import { type DaemonBuildInfo } from '../build-info.js';
3
3
  import { type ChangeImpactConfig } from './change-impact-config.js';
4
+ /**
5
+ * TTL for the happy-path result cache (C1). reconcile fires every 4s and mesh_status
6
+ * is polled; a single getGitRepoStatus on a 1-submodule repo spawns ~13-15 git
7
+ * processes (+ optional network fetch) which on Windows is ~10-15s. Within this short
8
+ * window, repeat callers that share the same option shape are served the already
9
+ * collected status instead of re-shelling. Kept well under the 4s reconcile cadence so
10
+ * a genuinely fresh probe still happens at least roughly once per reconcile tick.
11
+ */
12
+ export declare const GIT_STATUS_CACHE_TTL_MS = 1500;
4
13
  /** Test seam: clear the last-known-good status cache between cases. */
5
14
  export declare function __resetGitStatusCacheForTests(): void;
15
+ /** Alias matching the task's requested name. */
16
+ export declare const __resetGitStatusCache: typeof __resetGitStatusCacheForTests;
6
17
  /** Test-only introspection: number of memoized Change Impact evaluations. */
7
18
  export declare function __changeImpactEvalCacheSizeForTests(): number;
8
19
  export interface GitStatusOptions {
@@ -16,6 +27,18 @@ export interface GitStatusOptions {
16
27
  * Callers should opt into this only for convergence-critical surfaces.
17
28
  */
18
29
  refreshUpstream?: boolean;
30
+ /**
31
+ * When true, bypass the C1 TTL result cache: always re-collect a fresh status
32
+ * (ignoring any cached entry younger than GIT_STATUS_CACHE_TTL_MS). The freshly
33
+ * collected result still UPDATES the cache so subsequent normal callers benefit.
34
+ *
35
+ * Mutating / decision callers (mesh_fast_forward preflight + post-merge re-read,
36
+ * refine submodule alignment pre/post status) MUST set this — acting on a stale
37
+ * ahead/behind or submodule sync verdict is the primary correctness hazard of the
38
+ * cache. Read-only/observe callers (mesh_status, git-monitor, reconcile) leave it
39
+ * unset and enjoy the dedup.
40
+ */
41
+ forceFresh?: boolean;
19
42
  /**
20
43
  * Test/override seam for the daemon build stamp used by the stale-build
21
44
  * detector. Production callers omit this so the real baked-in build commit
@@ -34,9 +57,20 @@ export interface GitStatusOptions {
34
57
  */
35
58
  changeImpactConfig?: ChangeImpactConfig | null;
36
59
  }
60
+ /**
61
+ * C2: minimum interval between actual `git fetch` network calls per workspace. A
62
+ * refreshUpstream caller within this window does NOT re-fetch; it serves ahead/behind
63
+ * from the locally-re-read porcelain (which is always fresh every call). So
64
+ * refreshUpstream becomes "fetch if the local remote-tracking ref is stale" rather than
65
+ * "always pay a network round trip". Only the upstream ahead/behind can age up to this
66
+ * throttle; local working-tree status never does.
67
+ */
68
+ export declare const GIT_FETCH_THROTTLE_MS = 30000;
37
69
  export declare function getGitRepoStatus(workspace: string, options?: GitStatusOptions): Promise<GitRepoStatus>;
38
70
  interface ParsedPorcelainStatus {
39
71
  branch: string | null;
72
+ /** Full HEAD object id from `# branch.oid`, or null when detached/unborn. */
73
+ headOid: string | null;
40
74
  upstream: string | null;
41
75
  ahead: number;
42
76
  behind: number;
package/dist/index.d.ts CHANGED
@@ -51,7 +51,7 @@ export { fastForwardMeshNode } from './mesh/mesh-fast-forward.js';
51
51
  export type { MeshFastForwardNodeArgs, MeshFastForwardPlannedStep, MeshFastForwardResult } from './mesh/mesh-fast-forward.js';
52
52
  export { buildMeshLedgerReconciliationEvidence, buildMeshLedgerReplicaEvidence } from './mesh/mesh-ledger-reconciliation.js';
53
53
  export type { AnyLedgerSlice, MeshLedgerReconciliationEvidence, MeshLedgerReplicaEvidence, MeshLedgerReplicaStatus } from './mesh/mesh-ledger-reconciliation.js';
54
- export { enqueueTask, recordDirectDispatchTask, getQueue, claimNextTask, updateTaskStatus, updateSessionTaskStatus, cancelTask, requeueTask, getMeshQueueStats, getMeshQueueRevision, normalizeMeshTaskMode, validateMeshTaskModeRequest, buildMeshNodeCapabilityTags, nodeSatisfiesRequiredTags, normalizeMeshCapabilityTags, resolveConvergeRequiredTags, insertDirectDispatch, getActiveDirectDispatches, updateDirectDispatchStatus, cleanupTerminalDirectDispatches, markStaleDirectDispatches, deleteDirectDispatchesByTaskId, recordMeshToolCall, assertNoDependencyCycle, hasPendingDependents, describeTaskDependencyState } from './mesh/mesh-work-queue.js';
54
+ export { enqueueTask, recordDirectDispatchTask, getQueue, claimNextTask, updateTaskStatus, updateSessionTaskStatus, cancelTask, requeueTask, getMeshQueueStats, getMeshQueueRevision, normalizeMeshTaskMode, validateMeshTaskModeRequest, isTaskReadonly, buildMeshNodeCapabilityTags, nodeSatisfiesRequiredTags, normalizeMeshCapabilityTags, resolveConvergeRequiredTags, insertDirectDispatch, getActiveDirectDispatches, updateDirectDispatchStatus, cleanupTerminalDirectDispatches, markStaleDirectDispatches, deleteDirectDispatchesByTaskId, recordMeshToolCall, assertNoDependencyCycle, hasPendingDependents, describeTaskDependencyState } from './mesh/mesh-work-queue.js';
55
55
  export type { MeshWorkQueueEntry, MeshTaskStatus, MeshTaskMode, MeshWorkQueueStats, MeshQueueMutationOptions, MeshTaskModeValidationResult, DirectDispatchRecord, MeshToolCallRateResult } from './mesh/mesh-work-queue.js';
56
56
  export { buildCompactStaleDirectWorkSummary, buildMeshActiveWork, buildMeshActiveWorkSummary, classifyStaleDirectForPrune, pruneStaleDirectDispatches, PRUNABLE_ORPHAN_STALE_REASONS } from './mesh/mesh-active-work.js';
57
57
  export type { StaleDirectPruneClassification, StaleDirectPruneResult, PruneStaleDirectDispatchesOptions } from './mesh/mesh-active-work.js';