@karmaniverous/jeeves-meta 0.16.3 → 0.18.0-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.
Files changed (93) hide show
  1. package/README.md +1 -2
  2. package/dist/cli/jeeves-meta/index.js +1386 -1350
  3. package/dist/prompts/architect.md +31 -59
  4. package/dist/prompts/critic.md +18 -33
  5. package/package.json +14 -22
  6. package/dist/archive/index.d.ts +0 -10
  7. package/dist/archive/listArchive.d.ts +0 -12
  8. package/dist/archive/prune.d.ts +0 -14
  9. package/dist/archive/readArchive.d.ts +0 -30
  10. package/dist/archive/readLatest.d.ts +0 -13
  11. package/dist/archive/snapshot.d.ts +0 -17
  12. package/dist/bootstrap.d.ts +0 -26
  13. package/dist/cache.d.ts +0 -22
  14. package/dist/cli/jeeves-meta/architect.md +0 -173
  15. package/dist/cli/jeeves-meta/critic.md +0 -104
  16. package/dist/cli.d.ts +0 -10
  17. package/dist/configHotReload.d.ts +0 -30
  18. package/dist/configLoader.d.ts +0 -36
  19. package/dist/constants.d.ts +0 -13
  20. package/dist/customCliCommands.d.ts +0 -13
  21. package/dist/descriptor.d.ts +0 -19
  22. package/dist/discovery/buildMinimalNode.d.ts +0 -22
  23. package/dist/discovery/computeSummary.d.ts +0 -17
  24. package/dist/discovery/discoverMetas.d.ts +0 -19
  25. package/dist/discovery/getAncestorMeta.d.ts +0 -16
  26. package/dist/discovery/index.d.ts +0 -12
  27. package/dist/discovery/listMetas.d.ts +0 -63
  28. package/dist/discovery/ownershipTree.d.ts +0 -25
  29. package/dist/discovery/scope.d.ts +0 -47
  30. package/dist/discovery/types.d.ts +0 -25
  31. package/dist/ema.d.ts +0 -14
  32. package/dist/errors.d.ts +0 -15
  33. package/dist/escapeGlob.d.ts +0 -23
  34. package/dist/executor/GatewayExecutor.d.ts +0 -79
  35. package/dist/executor/SpawnAbortedError.d.ts +0 -9
  36. package/dist/executor/SpawnTimeoutError.d.ts +0 -13
  37. package/dist/executor/index.d.ts +0 -8
  38. package/dist/index.d.ts +0 -35
  39. package/dist/index.js +0 -5798
  40. package/dist/interfaces/MetaContext.d.ts +0 -38
  41. package/dist/interfaces/MetaExecutor.d.ts +0 -44
  42. package/dist/interfaces/WatcherClient.d.ts +0 -75
  43. package/dist/interfaces/index.d.ts +0 -8
  44. package/dist/lock.d.ts +0 -70
  45. package/dist/logger/index.d.ts +0 -27
  46. package/dist/mtimeFilter.d.ts +0 -26
  47. package/dist/normalizePath.d.ts +0 -6
  48. package/dist/orchestrator/buildTask.d.ts +0 -38
  49. package/dist/orchestrator/contextPackage.d.ts +0 -30
  50. package/dist/orchestrator/index.d.ts +0 -10
  51. package/dist/orchestrator/orchestratePhase.d.ts +0 -44
  52. package/dist/orchestrator/parseOutput.d.ts +0 -42
  53. package/dist/orchestrator/runPhase.d.ts +0 -40
  54. package/dist/phaseState/derivePhaseState.d.ts +0 -39
  55. package/dist/phaseState/index.d.ts +0 -9
  56. package/dist/phaseState/invalidate.d.ts +0 -39
  57. package/dist/phaseState/phaseScheduler.d.ts +0 -76
  58. package/dist/phaseState/phaseTransitions.d.ts +0 -83
  59. package/dist/progress/index.d.ts +0 -44
  60. package/dist/prompts/index.d.ts +0 -12
  61. package/dist/queue/index.d.ts +0 -90
  62. package/dist/readMetaJson.d.ts +0 -17
  63. package/dist/routes/__testUtils.d.ts +0 -37
  64. package/dist/routes/config.d.ts +0 -11
  65. package/dist/routes/configApply.d.ts +0 -13
  66. package/dist/routes/index.d.ts +0 -50
  67. package/dist/routes/metas.d.ts +0 -9
  68. package/dist/routes/metasUpdate.d.ts +0 -11
  69. package/dist/routes/preview.d.ts +0 -8
  70. package/dist/routes/queue.d.ts +0 -13
  71. package/dist/routes/seed.d.ts +0 -8
  72. package/dist/routes/status.d.ts +0 -13
  73. package/dist/routes/synthesize.d.ts +0 -12
  74. package/dist/routes/unlock.d.ts +0 -8
  75. package/dist/rules/healthCheck.d.ts +0 -36
  76. package/dist/rules/index.d.ts +0 -37
  77. package/dist/rules/verify.d.ts +0 -22
  78. package/dist/scheduler/index.d.ts +0 -71
  79. package/dist/scheduling/index.d.ts +0 -7
  80. package/dist/scheduling/staleness.d.ts +0 -68
  81. package/dist/scheduling/weightedFormula.d.ts +0 -38
  82. package/dist/schema/config.d.ts +0 -57
  83. package/dist/schema/error.d.ts +0 -6
  84. package/dist/schema/index.d.ts +0 -8
  85. package/dist/schema/meta.d.ts +0 -72
  86. package/dist/seed/autoSeed.d.ts +0 -30
  87. package/dist/seed/createMeta.d.ts +0 -38
  88. package/dist/seed/index.d.ts +0 -7
  89. package/dist/server.d.ts +0 -24
  90. package/dist/shutdown/index.d.ts +0 -33
  91. package/dist/structureHash.d.ts +0 -15
  92. package/dist/watcher-client/HttpWatcherClient.d.ts +0 -38
  93. package/dist/watcher-client/index.d.ts +0 -6
@@ -1,173 +0,0 @@
1
- # Architect Prompt
2
-
3
- You are the Architect in a knowledge synthesis pipeline. Your job is to craft a
4
- task brief for a Builder agent that will synthesize knowledge from source data.
5
-
6
- ## Context
7
-
8
- You are analyzing a directory where a .meta/ directory defines a synthesis target.
9
- The Builder will receive your task brief and execute it with full tool access: it
10
- can read files from the filesystem and search the semantic index (watcher_search)
11
- for cross-domain context.
12
-
13
- ## Inputs You Will Receive
14
-
15
- 1. Directory path and a listing of files in scope.
16
- 2. Steering prompt (_steer) — human-provided directive. High-priority guidance.
17
- 3. Previous task brief (_builder) — what you produced last time. Keep what worked.
18
- 4. Previous synthesis output (_content) — what the Builder produced last time.
19
- 5. Previous feedback (_feedback) — the Critic's evaluation. Address every concern.
20
- 6. Child meta outputs — subdirectory synthesis outputs (consume these, not raw files).
21
- 7. Cross-ref meta outputs — synthesis outputs from explicitly referenced metas
22
- (_crossRefs). These are metas from other parts of the hierarchy that the
23
- human declared relevant. Treat them like child metas: consume the synthesis,
24
- don't re-analyze their raw sources.
25
- 8. Archive snapshots — timestamped previous syntheses from .meta/archive/.
26
-
27
- ## Your Output: A Task Brief
28
-
29
- Respond with ONLY the task brief as plain Markdown. No JSON wrapping, no code
30
- fences around the entire output, no preamble. Just the numbered sections below.
31
-
32
- The task brief must include these sections:
33
-
34
- ### 1. Data Shape
35
-
36
- Describe the source data briefly. File types, schemas, structures, domain.
37
- On subsequent cycles (when previous output exists), focus on what changed.
38
-
39
- ### 2. Mandatory Reads
40
-
41
- List specific files the Builder must read before making claims. Include entity
42
- files, key source files, config/schema files, and test files where relevant.
43
-
44
- ### 3. Analytical Framework
45
-
46
- Define dimensions of analysis appropriate to this data shape and steering prompt.
47
- Always include:
48
- - Entity/issue status with verification (classify against source, not just metadata)
49
- - Cross-entity relationship analysis (connections, dependencies, supersession)
50
- - Health/quality assessment with evidence
51
- - Velocity/activity assessment
52
- - Human attention items (prioritized, quick wins first)
53
-
54
- ### 4. Cross-Reference Integration
55
-
56
- If cross-ref meta outputs are provided, describe how the Builder should
57
- integrate them:
58
- - What themes or entities from each referenced meta are relevant here?
59
- - How should cross-ref context supplement (not duplicate) local data analysis?
60
- - What cross-domain connections should the Builder look for?
61
-
62
- If no cross-refs are present, omit this section entirely.
63
-
64
- ### 5. Search Strategies (Not Specific Queries)
65
-
66
- Define PATTERNS for how the Builder should use watcher_search. Do NOT hardcode
67
- specific search terms — the Builder will instantiate these patterns against
68
- whatever it actually finds in the data.
69
-
70
- Examples of good search strategies:
71
- - "For each human sender with 3+ messages, search for their name + any
72
- company/project mentioned in the subject line."
73
- - "For each open issue, search for the issue title keywords to find related
74
- Slack discussions or meeting notes."
75
- - "For each financial notification, search for the institution name to find
76
- related planning discussions."
77
-
78
- Examples of BAD search strategies:
79
- - "Search for 'Pat Brady MoneyMatch'" (too specific, stale next cycle)
80
- - "Search for 'jeeves-runner CI pipeline broken'" (hardcoded to current state)
81
-
82
- The goal: teach the Builder HOW to search, not WHAT to search for. The brief
83
- should stay valid even when the underlying data changes between architect cycles.
84
-
85
- ### 6. Verification Requirements
86
-
87
- Define what "verify before asserting" means for this data shape:
88
- - For code repos: verify issue status against source files, cite exact lines
89
- - For email: verify thread status against message metadata (dates, labels)
90
- - For meetings: verify action items against follow-up evidence
91
- Always require: exact entity titles/names (not paraphrases), evidence citations,
92
- partial implementation notes, config default verification from schema files.
93
-
94
- {{#if (gt scope.fileCount 500)}}
95
- ## LARGE SCOPE — SAMPLING MODE
96
-
97
- This entity has {{scope.fileCount}} files. Do NOT attempt to read or
98
- explore the full scope. Instead:
99
-
100
- 1. Read _state and _content from previous cycles to understand existing
101
- data shape knowledge
102
- 2. Sample at most 5–10 representative files to verify the data shape
103
- hasn't fundamentally changed
104
- 3. Focus your brief updates on what the _feedback says needs improving
105
- 4. Preserve the existing progressive processing strategy unless the
106
- data shape has materially changed
107
-
108
- Your job on re-runs is refinement, not rediscovery.
109
- {{/if}}
110
-
111
- ### 7. Progressive Processing (_state)
112
-
113
- When the scope is large (hundreds of files or more), instruct the Builder to
114
- use progressive processing via `_state`. The Builder can set an opaque `_state`
115
- value in its output JSON. This state is persisted and passed back as context
116
- on the next cycle.
117
-
118
- Design a chunking strategy appropriate to the data shape:
119
- - For email archives: process by date range (e.g. most recent month first)
120
- - For Slack channels: process by message date range
121
- - For large codebases: process by directory subtree
122
- - For meetings: process N meetings per cycle
123
-
124
- The Builder should:
125
- 1. Read `_state` to determine what was already processed
126
- 2. Process the next chunk
127
- 3. Update `_state` with a cursor/bookmark for the next cycle
128
- 4. Merge new findings with previous `_content` (carried in context)
129
-
130
- If the scope is small enough to process in one pass, omit chunking instructions.
131
- ### 8. Output Structure
132
-
133
- Define non-underscore fields for structured data and the _content narrative
134
- structure. _content must not exceed \{{config.maxLines}} lines.
135
- IMPORTANT: The Builder returns its output as data. It does NOT write files.
136
- Do not instruct the Builder to write to any file path. The orchestrator
137
- handles all file I/O.
138
-
139
- ### 9. Previous Feedback Integration
140
-
141
- If _feedback is provided, turn every critique into an explicit directive.
142
- Quote the specific issue and state what to do differently.
143
-
144
- ## Template Variables
145
-
146
- Your task brief will be compiled as a Handlebars template before the Builder
147
- receives it. You can use these variables to write adaptive instructions:
148
-
149
- - `\{{config.maxLines}}` — Maximum _content lines
150
- - `\{{config.architectEvery}}` — Cycles between architect refreshes
151
- - `\{{config.maxArchive}}` — Archive snapshots retained
152
- - `\{{scope.fileCount}}` — Total files in scope
153
- - `\{{scope.deltaCount}}` — Files changed since last synthesis
154
- - `\{{scope.childCount}}` — Child metas
155
- - `\{{scope.crossRefCount}}` — Cross-referenced metas
156
- - `\{{meta._depth}}` — Scheduling depth
157
- - `\{{meta._emphasis}}` — Scheduling emphasis
158
-
159
- Example: "Process files in chunks of 50. Limit output to \{{config.maxLines}} lines."
160
-
161
- ## Constraints
162
-
163
- - Your output is a task brief, not a synthesis. Do not synthesize the data yourself.
164
- - Respond with ONLY plain Markdown. NEVER wrap your output in JSON or code fences.
165
- - The Builder has watcher_search + filesystem access.
166
- - Search strategies must be patterns, not hardcoded queries.
167
- - Keep the brief focused. The Builder is an intelligent agent.
168
- - _content must be Markdown suitable for human reading and semantic embedding.
169
- - When diagrams would aid understanding (architecture, relationships, workflows),
170
- instruct the Builder to use PlantUML syntax in fenced code blocks
171
- (` ```plantuml `). PlantUML is rendered natively by the serving infrastructure.
172
- NEVER use ASCII art.
173
- - Do NOT instruct the Builder to write to any file. It returns data; the engine writes.
@@ -1,104 +0,0 @@
1
- # Critic Prompt
2
-
3
- You are the Critic in a knowledge synthesis pipeline. Your job is to evaluate
4
- a synthesis produced by the Builder and provide actionable feedback that will
5
- improve future cycles.
6
-
7
- ## Context
8
-
9
- A Builder agent has just produced a synthesis (_content + structured fields) for
10
- a .meta/ directory. You have full tool access: you can read the same source files
11
- the Builder read, search the semantic index (watcher_search), and verify claims.
12
-
13
- ## Inputs You Will Receive
14
-
15
- 1. The synthesis output (_content and structured fields).
16
- 2. The task brief (_builder) that guided the Builder.
17
- 3. The steering prompt (_steer) — what the human cares about.
18
- 4. Previous feedback (_feedback) — what you said last time. Did it improve?
19
- 5. The source directory path and file listing.
20
-
21
- ## Your Job
22
-
23
- Evaluate the synthesis on these dimensions:
24
-
25
- ### 1. Steering Alignment
26
-
27
- Does the output address what the steering prompt asked for? What is missing
28
- or underweight?
29
-
30
- ### 2. Factual Accuracy
31
-
32
- Spot-check specific claims by reading source files yourself:
33
- - For code repos: verify line number citations, issue classifications,
34
- config default values, test file counts.
35
- - For email: verify thread status claims, sender names, financial amounts,
36
- date assertions.
37
- - For any domain: verify that "missing" claims are genuinely missing by
38
- reading the relevant files.
39
-
40
- IMPORTANT: Your own claims must also be verified. Do not introduce errors
41
- into the feedback loop. If you are unsure about a fact, say so explicitly
42
- rather than asserting incorrectly.
43
-
44
- ### 3. Analytical Depth
45
-
46
- Is the analysis shallow or insightful? Does it surface non-obvious connections?
47
- Does the cross-domain search add genuine value or just restate local content?
48
-
49
- ### 4. Cross-Reference Utilization
50
-
51
- If cross-ref metas were provided as context:
52
- - Were they meaningfully integrated, or just mentioned superficially?
53
- - Did the synthesis surface genuine cross-domain connections?
54
- - Were claims drawn from cross-ref context verified against the referenced
55
- meta's actual content?
56
- - Did the synthesis avoid re-analyzing raw sources that belong to the
57
- referenced meta's scope?
58
-
59
- If no cross-refs were provided, skip this section.
60
-
61
- ### 5. Output Quality
62
-
63
- Is _content well-structured and concise? Within maxLines? Would a human
64
- reading this learn something they did not already know?
65
-
66
- ### 6. What Is Missing
67
-
68
- What important aspects are not covered? What questions does the synthesis
69
- leave unanswered?
70
-
71
- ### 7. Previous Feedback Resolution
72
-
73
- If you provided feedback last cycle, check whether each issue was addressed.
74
- Note: resolved / partially resolved / still present for each.
75
-
76
- ## Your Output
77
-
78
- Produce a structured critique stored as _feedback. Use exactly this structure:
79
-
80
- ~~~~
81
- ## Overall Assessment
82
- [1-2 sentences]
83
-
84
- ## Strengths
85
- - [what worked well]
86
-
87
- ## Issues
88
- - [specific problems with evidence — cite file paths]
89
-
90
- ## Missing Coverage
91
- - [what should have been included]
92
-
93
- ## Recommendations for Next Cycle
94
- - [actionable improvements for both architect and builder]
95
- ~~~~
96
-
97
- ## Constraints
98
-
99
- - Be specific. Cite file paths and evidence when you find discrepancies.
100
- - Your feedback will be read by both the Architect and Builder. Make it useful.
101
- - Do NOT introduce factual errors. If you cannot verify a claim, say so.
102
- - Focus on issues that would change the reader's understanding or actions.
103
- Skip cosmetic concerns.
104
- - Return your critique as structured text. Do NOT write to any file.
package/dist/cli.d.ts DELETED
@@ -1,10 +0,0 @@
1
- /**
2
- * Commander CLI for jeeves-meta service.
3
- *
4
- * Uses `createServiceCli` from the core SDK for standard commands
5
- * (start, status, config, init, service). Custom domain-specific
6
- * commands are registered via `descriptor.customCliCommands`.
7
- *
8
- * @module cli
9
- */
10
- export {};
@@ -1,30 +0,0 @@
1
- /**
2
- * Shared live config hot-reload support.
3
- *
4
- * Used by both file-watch reloads in bootstrap and POST /config/apply
5
- * via the component descriptor's onConfigApply callback.
6
- *
7
- * @module configHotReload
8
- */
9
- import type { Logger } from 'pino';
10
- import type { Scheduler } from './scheduler/index.js';
11
- import type { ServiceConfig } from './schema/config.js';
12
- /**
13
- * Fields that require a service restart to take effect.
14
- *
15
- * Shared between the descriptor's `onConfigApply` and the file-watcher
16
- * hot-reload in `bootstrap.ts`.
17
- */
18
- export declare const RESTART_REQUIRED_FIELDS: readonly ["port", "watcherUrl", "gatewayUrl", "gatewayApiKey"];
19
- interface ConfigHotReloadRuntime {
20
- config: ServiceConfig;
21
- logger: Logger;
22
- scheduler: Scheduler | null;
23
- }
24
- /** Register the active service runtime for config-apply hot reload. */
25
- export declare function registerConfigHotReloadRuntime(nextRuntime: ConfigHotReloadRuntime): void;
26
- /** Clear the registered runtime. Primarily for tests. */
27
- export declare function clearConfigHotReloadRuntime(): void;
28
- /** Apply hot-reloadable config changes to the live shared config object. */
29
- export declare function applyHotReloadedConfig(newConfig: ServiceConfig): void;
30
- export {};
@@ -1,36 +0,0 @@
1
- /**
2
- * Load and resolve jeeves-meta service config.
3
- *
4
- * Supports environment-variable substitution (dollar-brace pattern).
5
- *
6
- * @module configLoader
7
- */
8
- import { type ServiceConfig } from './schema/config.js';
9
- /**
10
- * Migrate legacy config path to the new canonical location.
11
- *
12
- * If the old path `{configRoot}/jeeves-meta.config.json` exists and the new
13
- * path `{configRoot}/jeeves-meta/config.json` does NOT exist, copies the file
14
- * to the new location and logs a warning.
15
- *
16
- * @param configRoot - Root directory for configuration files.
17
- * @param warn - Optional callback for logging the migration warning.
18
- */
19
- export declare function migrateConfigPath(configRoot: string, warn?: (msg: string) => void): void;
20
- /**
21
- * Resolve config path from --config flag or JEEVES_META_CONFIG env var.
22
- *
23
- * @param args - CLI arguments (process.argv.slice(2)).
24
- * @returns Resolved config path.
25
- * @throws If no config path found.
26
- */
27
- export declare function resolveConfigPath(args: string[]): string;
28
- /**
29
- * Load service config from a JSON file.
30
- *
31
- * Substitutes environment-variable placeholders throughout.
32
- *
33
- * @param configPath - Path to config JSON file.
34
- * @returns Validated ServiceConfig.
35
- */
36
- export declare function loadServiceConfig(configPath: string): ServiceConfig;
@@ -1,13 +0,0 @@
1
- /**
2
- * Shared constants for the jeeves-meta service package.
3
- *
4
- * @module constants
5
- */
6
- /** Default HTTP port for the jeeves-meta service. */
7
- export declare const DEFAULT_PORT: 1938;
8
- /** Default port as a string (for Commander CLI defaults). */
9
- export declare const DEFAULT_PORT_STR: string;
10
- /** Service name identifier. */
11
- export declare const SERVICE_NAME = "jeeves-meta";
12
- /** Service version, read from package.json at startup. */
13
- export declare const SERVICE_VERSION: string;
@@ -1,13 +0,0 @@
1
- /**
2
- * Custom CLI commands for the jeeves-meta service.
3
- *
4
- * Registered via `descriptor.customCliCommands` and added to the
5
- * standard service CLI produced by `createServiceCli`.
6
- *
7
- * @module customCliCommands
8
- */
9
- import { type Command } from 'commander';
10
- /** Build the full API URL for a given port string and path. */
11
- export declare function apiUrl(port: string, apiPath: string): string;
12
- /** Register all custom meta commands on the parent program. */
13
- export declare function registerCustomCliCommands(program: Command): void;
@@ -1,19 +0,0 @@
1
- /**
2
- * Jeeves component descriptor for jeeves-meta.
3
- *
4
- * Single source of truth consumed by the service CLI, plugin writer, and
5
- * config-apply pipeline.
6
- *
7
- * @module descriptor
8
- */
9
- import { type JeevesComponentDescriptor } from '@karmaniverous/jeeves';
10
- import { RESTART_REQUIRED_FIELDS } from './configHotReload.js';
11
- import { loadServiceConfig } from './configLoader.js';
12
- import { type ServiceConfig } from './schema/config.js';
13
- export { RESTART_REQUIRED_FIELDS };
14
- /**
15
- * Parsed jeeves-meta component descriptor.
16
- */
17
- export declare const metaDescriptor: JeevesComponentDescriptor;
18
- export type { ServiceConfig };
19
- export { loadServiceConfig };
@@ -1,22 +0,0 @@
1
- /**
2
- * Build a minimal MetaNode from a known meta path using watcher walk.
3
- *
4
- * Used for targeted synthesis (when a specific path is requested) to avoid
5
- * the full discovery + ownership tree build. Discovers only immediate child
6
- * `.meta/` directories.
7
- *
8
- * @module discovery/buildMinimalNode
9
- */
10
- import type { WatcherClient } from '../interfaces/index.js';
11
- import type { MetaNode } from './types.js';
12
- /**
13
- * Build a minimal MetaNode for a known meta path.
14
- *
15
- * Walks the owner directory for child `.meta/meta.json` files and constructs
16
- * a shallow ownership tree (self + direct children only).
17
- *
18
- * @param metaPath - Absolute path to the `.meta/` directory.
19
- * @param watcher - WatcherClient for filesystem enumeration.
20
- * @returns MetaNode with direct children wired.
21
- */
22
- export declare function buildMinimalNode(metaPath: string, watcher: WatcherClient): Promise<MetaNode>;
@@ -1,17 +0,0 @@
1
- /**
2
- * Compute summary statistics from an array of MetaEntry objects.
3
- *
4
- * Shared between listMetas() (full list) and route handlers (filtered lists).
5
- *
6
- * @module discovery/computeSummary
7
- */
8
- import type { MetaListSummary } from '@karmaniverous/jeeves-meta-core';
9
- import type { MetaEntry } from './listMetas.js';
10
- /**
11
- * Compute summary statistics from a list of meta entries.
12
- *
13
- * @param entries - Enriched meta entries (full or filtered).
14
- * @param depthWeight - Config depth weight for effective staleness calculation.
15
- * @returns Aggregated summary statistics.
16
- */
17
- export declare function computeSummary(entries: MetaEntry[], depthWeight: number): MetaListSummary;
@@ -1,19 +0,0 @@
1
- /**
2
- * Discover .meta/ directories via watcher `/walk` endpoint.
3
- *
4
- * Uses filesystem enumeration through the watcher (not Qdrant) to find
5
- * all `.meta/meta.json` files and returns deduplicated meta directory paths.
6
- *
7
- * @module discovery/discoverMetas
8
- */
9
- import type { WatcherClient } from '../interfaces/index.js';
10
- /**
11
- * Discover all .meta/ directories via watcher walk.
12
- *
13
- * Uses the watcher's `/walk` endpoint to find all `.meta/meta.json` files
14
- * and returns deduplicated meta directory paths.
15
- *
16
- * @param watcher - WatcherClient for walk queries.
17
- * @returns Array of normalized .meta/ directory paths.
18
- */
19
- export declare function discoverMetas(watcher: WatcherClient): Promise<string[]>;
@@ -1,16 +0,0 @@
1
- /**
2
- * Retrieve the nearest ancestor meta node from the ownership tree.
3
- *
4
- * @module discovery/getAncestorMeta
5
- */
6
- import type { MetaNode } from './types.js';
7
- /**
8
- * Get the nearest ancestor MetaNode for a given node.
9
- *
10
- * Walks up the ownership tree (via the parent pointer set by
11
- * buildOwnershipTree) to find the closest ancestor .meta/ directory.
12
- *
13
- * @param node - The meta node to find the ancestor for.
14
- * @returns The parent MetaNode, or null for root-level metas.
15
- */
16
- export declare function getAncestorMeta(node: MetaNode): MetaNode | null;
@@ -1,12 +0,0 @@
1
- /**
2
- * Discovery module — glob .meta/ directories and build ownership tree.
3
- *
4
- * @module discovery
5
- */
6
- export { computeSummary } from './computeSummary.js';
7
- export { discoverMetas } from './discoverMetas.js';
8
- export { getAncestorMeta } from './getAncestorMeta.js';
9
- export { listMetas, type MetaEntry, type MetaListResult, type MetaListSummary, } from './listMetas.js';
10
- export { buildOwnershipTree, findNode } from './ownershipTree.js';
11
- export { filterInScope, getDeltaFiles, getScopeFiles, getScopePrefix, } from './scope.js';
12
- export type { MetaNode, OwnershipTree } from './types.js';
@@ -1,63 +0,0 @@
1
- /**
2
- * Unified meta listing: scan, dedup, enrich.
3
- *
4
- * Single source of truth for all consumers that need a list of metas
5
- * with enriched metadata. Replaces duplicated scan+dedup logic in
6
- * plugin tools, CLI, and prompt injection.
7
- *
8
- * @module discovery/listMetas
9
- */
10
- import type { MetaListSummary } from '@karmaniverous/jeeves-meta-core';
11
- import type { WatcherClient } from '../interfaces/index.js';
12
- import type { MetaConfig, MetaJson } from '../schema/index.js';
13
- import type { MetaNode, OwnershipTree } from './types.js';
14
- /** Enriched meta entry returned by listMetas(). */
15
- export interface MetaEntry {
16
- /** Normalized .meta/ directory path. */
17
- path: string;
18
- /** Tree depth (0 = leaf, higher = more abstract). */
19
- depth: number;
20
- /** Scheduling emphasis multiplier. */
21
- emphasis: number;
22
- /** Seconds since last synthesis, or Infinity if never synthesized. */
23
- stalenessSeconds: number;
24
- /** ISO timestamp of last synthesis, or null. */
25
- lastSynthesized: string | null;
26
- /** Whether the last synthesis had an error. */
27
- hasError: boolean;
28
- /** Whether this meta is currently locked. */
29
- locked: boolean;
30
- /** Whether this meta is disabled (skipped during staleness scheduling). */
31
- disabled: boolean;
32
- /** Cumulative architect tokens, or null if never run. */
33
- architectTokens: number | null;
34
- /** Cumulative builder tokens, or null if never run. */
35
- builderTokens: number | null;
36
- /** Cumulative critic tokens, or null if never run. */
37
- criticTokens: number | null;
38
- /** Number of direct children in the ownership tree. */
39
- children: number;
40
- /** The underlying MetaNode from the ownership tree. */
41
- node: MetaNode;
42
- /** The parsed meta.json content. */
43
- meta: MetaJson;
44
- }
45
- export type { MetaListSummary };
46
- /** Full result from listMetas(). */
47
- export interface MetaListResult {
48
- summary: MetaListSummary;
49
- entries: MetaEntry[];
50
- tree: OwnershipTree;
51
- }
52
- /**
53
- * Discover, deduplicate, and enrich all metas.
54
- *
55
- * This is the single consolidated function that replaces all duplicated
56
- * scan+dedup+enrich logic across the codebase. All enrichment comes from
57
- * reading meta.json on disk (the canonical source).
58
- *
59
- * @param config - Validated synthesis config.
60
- * @param watcher - Watcher HTTP client for discovery.
61
- * @returns Enriched meta list with summary statistics and ownership tree.
62
- */
63
- export declare function listMetas(config: MetaConfig, watcher: WatcherClient): Promise<MetaListResult>;
@@ -1,25 +0,0 @@
1
- /**
2
- * Build the ownership tree from discovered .meta/ paths.
3
- *
4
- * Each .meta/ directory owns its parent directory and all descendants,
5
- * except subtrees that contain their own .meta/. For those subtrees,
6
- * the parent meta consumes the child meta's synthesis output.
7
- *
8
- * @module discovery/ownershipTree
9
- */
10
- import type { MetaNode, OwnershipTree } from './types.js';
11
- /**
12
- * Build an ownership tree from an array of .meta/ directory paths.
13
- *
14
- * @param metaPaths - Absolute paths to .meta/ directories.
15
- * @returns The ownership tree with parent/child relationships.
16
- */
17
- export declare function buildOwnershipTree(metaPaths: string[]): OwnershipTree;
18
- /**
19
- * Find a node in the ownership tree by meta path or owner path.
20
- *
21
- * @param tree - The ownership tree to search.
22
- * @param targetPath - Path to search for (meta path or owner path).
23
- * @returns The matching node, or undefined if not found.
24
- */
25
- export declare function findNode(tree: OwnershipTree, targetPath: string): MetaNode | undefined;
@@ -1,47 +0,0 @@
1
- /**
2
- * Compute the file scope owned by a meta node.
3
- *
4
- * A meta owns: parent dir + all descendants, minus:
5
- * - Its own .meta/ subtree (outputs, not inputs)
6
- * - Child meta ownerPath subtrees (except their .meta/meta.json for rollups)
7
- *
8
- * All filesystem enumeration delegated to the watcher's `/walk` endpoint.
9
- *
10
- * @module discovery/scope
11
- */
12
- import type { WatcherClient } from '../interfaces/index.js';
13
- import type { MinimalLogger } from '../logger/index.js';
14
- import type { MetaNode } from './types.js';
15
- /**
16
- * Get the scope path prefix for a meta node.
17
- */
18
- export declare function getScopePrefix(node: MetaNode): string;
19
- /**
20
- * Filter a list of file paths to only those in scope for a meta node.
21
- *
22
- * Excludes:
23
- * - The node's own .meta/ subtree (synthesis outputs are not scope inputs)
24
- * - Child meta ownerPath subtrees (except child .meta/meta.json for rollups)
25
- *
26
- * Watcher walk returns normalized forward-slash paths.
27
- */
28
- export declare function filterInScope(node: MetaNode, files: string[]): string[];
29
- /** Result of getScopeFiles. */
30
- interface ScopeFilesResult {
31
- /** Files directly owned by this meta (excluding child subtrees and own .meta/). */
32
- scopeFiles: string[];
33
- /** All files under the owner path (including child subtrees). */
34
- allFiles: string[];
35
- }
36
- /**
37
- * Get all files in scope for a meta node via watcher walk.
38
- */
39
- export declare function getScopeFiles(node: MetaNode, watcher: WatcherClient, logger?: MinimalLogger): Promise<ScopeFilesResult>;
40
- /**
41
- * Get files modified since a given timestamp within a meta node's scope.
42
- *
43
- * If no generatedAt is provided (first run), returns all scope files.
44
- * Reuses scope files from getScopeFiles() and filters locally by mtime.
45
- */
46
- export declare function getDeltaFiles(generatedAt: string | undefined, scopeFiles: string[]): string[];
47
- export {};
@@ -1,25 +0,0 @@
1
- /**
2
- * Types for meta discovery and ownership tree.
3
- *
4
- * @module discovery/types
5
- */
6
- /** A discovered meta node in the ownership tree. */
7
- export interface MetaNode {
8
- /** Absolute path to the .meta directory. */
9
- metaPath: string;
10
- /** Absolute path to the parent directory that this meta owns. */
11
- ownerPath: string;
12
- /** Depth in the ownership tree (root = 0). */
13
- treeDepth: number;
14
- /** Child meta nodes (subtrees with their own .meta/). */
15
- children: MetaNode[];
16
- /** Parent meta node, or null for roots. */
17
- parent: MetaNode | null;
18
- }
19
- /** The full ownership tree discovered from watchPaths. */
20
- export interface OwnershipTree {
21
- /** All discovered meta nodes, keyed by metaPath. */
22
- nodes: Map<string, MetaNode>;
23
- /** Root nodes (metas with no parent meta). */
24
- roots: MetaNode[];
25
- }