@adhdev/daemon-core 0.9.82-rc.327 → 0.9.82-rc.329

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 (38) hide show
  1. package/dist/cli-adapters/provider-cli-shared.d.ts +1 -1
  2. package/dist/git/change-impact-config.d.ts +159 -0
  3. package/dist/git/git-status.d.ts +14 -0
  4. package/dist/git/index.d.ts +2 -0
  5. package/dist/index.d.ts +2 -2
  6. package/dist/index.js +1140 -607
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.mjs +1090 -564
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/mesh/mesh-active-work.d.ts +66 -0
  11. package/dist/mesh/mesh-events-stale.d.ts +1 -1
  12. package/dist/providers/status-monitor.d.ts +7 -7
  13. package/dist/shared-types.d.ts +1 -1
  14. package/package.json +2 -2
  15. package/src/agent-stream/provider-adapter.ts +1 -1
  16. package/src/cli-adapters/provider-cli-adapter.ts +2 -2
  17. package/src/cli-adapters/provider-cli-shared.ts +1 -1
  18. package/src/commands/chat-commands.ts +1 -1
  19. package/src/commands/cli-manager.ts +1 -1
  20. package/src/commands/router.ts +46 -0
  21. package/src/git/change-impact-config.ts +354 -0
  22. package/src/git/git-status.ts +182 -16
  23. package/src/git/index.ts +16 -0
  24. package/src/index.ts +2 -2
  25. package/src/mesh/mesh-active-work.ts +154 -0
  26. package/src/mesh/mesh-events-coordinator.ts +13 -12
  27. package/src/mesh/mesh-events-stale.ts +4 -4
  28. package/src/mesh/mesh-events-utils.ts +3 -3
  29. package/src/mesh/mesh-reconcile-loop.ts +144 -1
  30. package/src/providers/acp-provider-instance.ts +6 -5
  31. package/src/providers/cli-provider-instance.ts +14 -10
  32. package/src/providers/extension-provider-instance.ts +7 -6
  33. package/src/providers/ide-provider-instance.ts +10 -6
  34. package/src/providers/read-chat-contract.ts +1 -1
  35. package/src/providers/status-monitor.d.ts +7 -7
  36. package/src/providers/status-monitor.ts +37 -22
  37. package/src/shared-types.ts +3 -0
  38. package/src/status/reporter.ts +1 -1
@@ -60,7 +60,7 @@ export interface CliSessionStatus {
60
60
  * Timestamp (ms) of the most recent *visible* terminal screen change.
61
61
  * Stricter than lastOutputAt — only advances when the rendered screen
62
62
  * content actually differs, so repeated keepalive bytes do not register as
63
- * progress. Preferred liveness signal for the long-generating watchdog.
63
+ * progress. Preferred liveness signal for the no-progress watchdog.
64
64
  */
65
65
  lastScreenChangeAt?: number;
66
66
  bufferState?: {
@@ -0,0 +1,159 @@
1
+ /**
2
+ * "Change Impact" — config-driven classification of which git changes between the
3
+ * live daemon's build commit and the workspace HEAD actually require a daemon
4
+ * rebuild/restart (vs. a web-only redeploy, vs. nothing).
5
+ *
6
+ * The daemon-core git surface only knows the FACTS (which files / packages changed
7
+ * between buildCommit..HEAD). The POLICY — which packages are daemon-runtime, which
8
+ * are web-only, which root files are non-runtime, and what command to recommend —
9
+ * is declarative config injected from outside. This keeps git-status.ts repo-agnostic
10
+ * while preserving ADHDev's exact built-in behavior when no config is present.
11
+ *
12
+ * SECURITY: config is declarative only. JSON/YAML are parsed; arbitrary JS config
13
+ * (.js) is intentionally NOT supported, so loading a config can never execute code.
14
+ */
15
+ /** A change-impact classification bucket. */
16
+ export type ChangeImpactKind = 'daemon' | 'web' | 'none';
17
+ /**
18
+ * Recommended action for a given impact classification. `recommendedAction` is the
19
+ * stable classification key (always one of daemon|web|none, NOT config-overridable);
20
+ * config customizes only the human-facing `recommendedCommand` recipe.
21
+ */
22
+ export interface ChangeImpactTarget {
23
+ /** Human-facing command/recipe to act on the impact (e.g. deploy + restart). */
24
+ recommendedCommand: string;
25
+ }
26
+ export interface ChangeImpactConfig {
27
+ /**
28
+ * Package names (the `<name>` in `packages/<name>/`) whose change means the
29
+ * daemon runtime is stale and must be rebuilt/redeployed + restarted. When
30
+ * provided, this REPLACES the built-in daemon-runtime set.
31
+ */
32
+ daemonRuntimePackages?: string[];
33
+ /**
34
+ * Package names that are web-only — a change to one does not require a daemon
35
+ * restart, only a web redeploy. When provided, this REPLACES the built-in
36
+ * web-only set.
37
+ */
38
+ webOnlyPackages?: string[];
39
+ /**
40
+ * Glob patterns for root-level (non-package) files that demonstrably cannot
41
+ * change what the daemon runtime executes (markers, docs, license text). These
42
+ * are added on top of the built-in non-runtime root-file detection.
43
+ */
44
+ nonRuntimeRootFilePatterns?: string[];
45
+ /** Recommended action/command per impact classification. Missing keys fall back to built-in defaults. */
46
+ impactTargets?: Partial<Record<ChangeImpactKind, ChangeImpactTarget>>;
47
+ }
48
+ export interface ChangeImpactConfigLoadResult {
49
+ config?: ChangeImpactConfig;
50
+ source: string;
51
+ sourceType: 'repo_file' | 'unavailable' | 'invalid';
52
+ path?: string;
53
+ error?: string;
54
+ /**
55
+ * Stable identity of the config SOURCE, used as part of a cache key so a config
56
+ * edit invalidates any cached impact evaluation. Combines the resolved path and
57
+ * its mtime (or the path for the unavailable/invalid case).
58
+ */
59
+ sourceKey: string;
60
+ }
61
+ export declare const CHANGE_IMPACT_CONFIG_LOCATIONS: string[];
62
+ export declare const CHANGE_IMPACT_CONFIG_SCHEMA: {
63
+ readonly $schema: "https://json-schema.org/draft/2020-12/schema";
64
+ readonly title: "ADHDev Change Impact Config";
65
+ readonly type: "object";
66
+ readonly additionalProperties: false;
67
+ readonly properties: {
68
+ readonly daemonRuntimePackages: {
69
+ readonly type: "array";
70
+ readonly items: {
71
+ readonly type: "string";
72
+ readonly minLength: 1;
73
+ };
74
+ };
75
+ readonly webOnlyPackages: {
76
+ readonly type: "array";
77
+ readonly items: {
78
+ readonly type: "string";
79
+ readonly minLength: 1;
80
+ };
81
+ };
82
+ readonly nonRuntimeRootFilePatterns: {
83
+ readonly type: "array";
84
+ readonly items: {
85
+ readonly type: "string";
86
+ readonly minLength: 1;
87
+ };
88
+ };
89
+ readonly impactTargets: {
90
+ readonly type: "object";
91
+ readonly additionalProperties: false;
92
+ readonly properties: {
93
+ readonly daemon: {
94
+ readonly $ref: "#/$defs/target";
95
+ };
96
+ readonly web: {
97
+ readonly $ref: "#/$defs/target";
98
+ };
99
+ readonly none: {
100
+ readonly $ref: "#/$defs/target";
101
+ };
102
+ };
103
+ };
104
+ };
105
+ readonly $defs: {
106
+ readonly target: {
107
+ readonly type: "object";
108
+ readonly additionalProperties: false;
109
+ readonly required: readonly ["recommendedCommand"];
110
+ readonly properties: {
111
+ readonly recommendedCommand: {
112
+ readonly type: "string";
113
+ readonly minLength: 1;
114
+ };
115
+ };
116
+ };
117
+ };
118
+ };
119
+ export declare function validateChangeImpactConfig(raw: unknown, source?: string): {
120
+ valid: boolean;
121
+ errors: string[];
122
+ config?: ChangeImpactConfig;
123
+ };
124
+ /**
125
+ * Locate and load the Change Impact config for a repo root. Declarative only —
126
+ * never executes config. Returns a sourceKey suitable for cache invalidation:
127
+ * config path + mtime, or the sentinel for the missing/invalid case.
128
+ */
129
+ export declare function loadChangeImpactConfig(repoRoot: string): ChangeImpactConfigLoadResult;
130
+ /**
131
+ * Translate a config glob pattern into a RegExp matched against a forward-slash
132
+ * file path. Supports `**` (any path segments), `*` (any chars except `/`), and
133
+ * `?` (single non-slash char). No brace/character-class expansion — declarative,
134
+ * minimal, predictable. All other characters are matched literally.
135
+ */
136
+ export declare function globToRegExp(pattern: string): RegExp;
137
+ export interface ChangeImpactConfigSuggestion {
138
+ /** A non-executable, declarative config draft a human can save verbatim. */
139
+ suggestedConfig: ChangeImpactConfig;
140
+ /** Per-field human-facing rationale for the proposed classification. */
141
+ notes: string[];
142
+ /** Package directories discovered under `packages/` (and `oss/packages/`). */
143
+ discoveredPackages: {
144
+ daemon: string[];
145
+ web: string[];
146
+ unclassified: string[];
147
+ };
148
+ }
149
+ /**
150
+ * Inspect a repo's package layout and propose a reasonable, declarative Change
151
+ * Impact config draft. This is heuristic scaffold ONLY — it never executes
152
+ * anything and the draft must be reviewed/saved by a human before it takes
153
+ * effect. The heuristic mirrors ADHDev's own conventions:
154
+ * - `web-*` / `*-web` packages → web-only (web redeploy, no daemon restart)
155
+ * - everything else under packages/ → daemon-runtime (rebuild + restart)
156
+ * - docs/license/marker root files → non-runtime
157
+ * Callers are expected to prune the draft to their actual runtime topology.
158
+ */
159
+ export declare function suggestChangeImpactConfig(repoRoot: string): ChangeImpactConfigSuggestion;
@@ -1,7 +1,10 @@
1
1
  import type { GitRepoStatus } from './git-types.js';
2
2
  import { type DaemonBuildInfo } from '../build-info.js';
3
+ import { type ChangeImpactConfig } from './change-impact-config.js';
3
4
  /** Test seam: clear the last-known-good status cache between cases. */
4
5
  export declare function __resetGitStatusCacheForTests(): void;
6
+ /** Test-only introspection: number of memoized Change Impact evaluations. */
7
+ export declare function __changeImpactEvalCacheSizeForTests(): number;
5
8
  export interface GitStatusOptions {
6
9
  timeoutMs?: number;
7
10
  /** When true, include submodule status in the result. Defaults to true. */
@@ -19,6 +22,17 @@ export interface GitStatusOptions {
19
22
  * (getDaemonBuildInfo) is used.
20
23
  */
21
24
  daemonBuildInfo?: DaemonBuildInfo;
25
+ /**
26
+ * Change Impact policy override. When provided, the daemonBuildBehind
27
+ * classifier uses this declarative config instead of auto-loading the repo's
28
+ * `.adhdev/change-impact.*` file. When omitted, getGitRepoStatus auto-loads the
29
+ * repo config (cached); when neither is present the built-in ADHDev default
30
+ * policy applies, preserving the legacy behavior exactly.
31
+ *
32
+ * Pass `null` to force the built-in default policy and skip auto-loading (used
33
+ * to assert legacy parity in tests).
34
+ */
35
+ changeImpactConfig?: ChangeImpactConfig | null;
22
36
  }
23
37
  export declare function getGitRepoStatus(workspace: string, options?: GitStatusOptions): Promise<GitRepoStatus>;
24
38
  interface ParsedPorcelainStatus {
@@ -3,6 +3,8 @@ export { GitCommandError, isPathInside, normalizeGitOutput, resolveGitRepository
3
3
  export type { GitCommandResult as GitExecutorCommandResult, GitExecutorOptions, RunGitOptions } from './git-executor.js';
4
4
  export { getGitRepoStatus, parsePorcelainV2Status } from './git-status.js';
5
5
  export type { GitStatusOptions } from './git-status.js';
6
+ export { CHANGE_IMPACT_CONFIG_LOCATIONS, CHANGE_IMPACT_CONFIG_SCHEMA, globToRegExp, loadChangeImpactConfig, suggestChangeImpactConfig, validateChangeImpactConfig, } from './change-impact-config.js';
7
+ export type { ChangeImpactConfig, ChangeImpactConfigLoadResult, ChangeImpactConfigSuggestion, ChangeImpactKind, ChangeImpactTarget, } from './change-impact-config.js';
6
8
  export { getGitDiffSummary, getGitFileDiff } from './git-diff.js';
7
9
  export type { GitDiffOptions, GitFileDiffResult } from './git-diff.js';
8
10
  export { createGitCompactSummary, summarizeGitStatus } from './git-summary.js';
package/dist/index.d.ts CHANGED
@@ -51,8 +51,8 @@ export { buildMeshLedgerReconciliationEvidence, buildMeshLedgerReplicaEvidence }
51
51
  export type { AnyLedgerSlice, MeshLedgerReconciliationEvidence, MeshLedgerReplicaEvidence, MeshLedgerReplicaStatus } from './mesh/mesh-ledger-reconciliation.js';
52
52
  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';
53
53
  export type { MeshWorkQueueEntry, MeshTaskStatus, MeshTaskMode, MeshWorkQueueStats, MeshQueueMutationOptions, MeshTaskModeValidationResult, DirectDispatchRecord, MeshToolCallRateResult } from './mesh/mesh-work-queue.js';
54
- export { buildCompactStaleDirectWorkSummary, buildMeshActiveWork, buildMeshActiveWorkSummary, classifyStaleDirectForPrune, PRUNABLE_ORPHAN_STALE_REASONS } from './mesh/mesh-active-work.js';
55
- export type { StaleDirectPruneClassification } from './mesh/mesh-active-work.js';
54
+ export { buildCompactStaleDirectWorkSummary, buildMeshActiveWork, buildMeshActiveWorkSummary, classifyStaleDirectForPrune, pruneStaleDirectDispatches, PRUNABLE_ORPHAN_STALE_REASONS } from './mesh/mesh-active-work.js';
55
+ export type { StaleDirectPruneClassification, StaleDirectPruneResult, PruneStaleDirectDispatchesOptions } from './mesh/mesh-active-work.js';
56
56
  export type { MeshActiveWorkRecord, MeshActiveWorkStatus, MeshActiveWorkSummary, MeshActiveWorkSource, MeshStaleDirectWorkSummary } from './mesh/mesh-active-work.js';
57
57
  export { buildMeshAsyncRefineJobs, summarizeMeshAsyncRefineJobs, STALE_TERMINAL_REFINE_WINDOW_MS, RECENT_TERMINAL_REFINE_CAP } from './mesh/mesh-refine-status.js';
58
58
  export type { MeshAsyncRefineJobStatus, MeshAsyncRefineJobSummary, MeshAsyncRefineJobsSummary } from './mesh/mesh-refine-status.js';