@karmaniverous/jeeves-watcher 0.17.7 → 0.17.9
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/cli/jeeves-watcher/{index-BRJ47BY6.js → index-07J6R3B8.js} +9 -10
- package/dist/cli/jeeves-watcher/index.js +8 -559
- package/dist/index.d.ts +5 -256
- package/dist/index.js +14 -565
- package/package.json +19 -26
package/dist/index.js
CHANGED
|
@@ -9,7 +9,9 @@ import picomatch from 'picomatch';
|
|
|
9
9
|
import Ajv from 'ajv';
|
|
10
10
|
import addFormats from 'ajv-formats';
|
|
11
11
|
import { z, ZodError } from 'zod';
|
|
12
|
-
import {
|
|
12
|
+
import { inferenceRuleSchema, jeevesWatcherConfigSchema, LOGGING_DEFAULTS, API_DEFAULTS, EMBEDDING_DEFAULTS, CONFIG_WATCH_DEFAULTS, WATCH_DEFAULTS, ROOT_DEFAULTS, INIT_CONFIG_TEMPLATE, DEFAULT_PORT as DEFAULT_PORT$1, PLUGIN_PACKAGE, SERVICE_PACKAGE, COMPONENT_NAME } from '@karmaniverous/jeeves-watcher-core';
|
|
13
|
+
export { apiConfigSchema, configWatchConfigSchema, embeddingConfigSchema, inferenceRuleSchema, jeevesWatcherConfigSchema, loggingConfigSchema, vectorStoreConfigSchema, watchConfigSchema } from '@karmaniverous/jeeves-watcher-core';
|
|
14
|
+
import { JsonMap } from '@karmaniverous/jsonmap';
|
|
13
15
|
import { pathToFileURL, fileURLToPath } from 'node:url';
|
|
14
16
|
import Handlebars from 'handlebars';
|
|
15
17
|
import dayjs from 'dayjs';
|
|
@@ -1435,495 +1437,6 @@ function createConfigReindexHandler(deps) {
|
|
|
1435
1437
|
}, deps.logger, 'Reindex request');
|
|
1436
1438
|
}
|
|
1437
1439
|
|
|
1438
|
-
/**
|
|
1439
|
-
* @module config/schemas/base
|
|
1440
|
-
* Base configuration schemas: watch, logging, API.
|
|
1441
|
-
*/
|
|
1442
|
-
/**
|
|
1443
|
-
* Watch configuration for file system monitoring.
|
|
1444
|
-
*/
|
|
1445
|
-
const watchConfigSchema = z.object({
|
|
1446
|
-
/** Glob patterns to watch. */
|
|
1447
|
-
paths: z
|
|
1448
|
-
.array(z.string())
|
|
1449
|
-
.min(1)
|
|
1450
|
-
.describe('Glob patterns for files to watch (e.g., "**/*.md"). At least one required.'),
|
|
1451
|
-
/** Glob patterns to ignore. */
|
|
1452
|
-
ignored: z
|
|
1453
|
-
.array(z.string())
|
|
1454
|
-
.default(['**/node_modules/**'])
|
|
1455
|
-
.describe('Glob patterns to exclude from watching (e.g., "**/node_modules/**").'),
|
|
1456
|
-
/** Polling interval in milliseconds. */
|
|
1457
|
-
pollIntervalMs: z
|
|
1458
|
-
.number()
|
|
1459
|
-
.optional()
|
|
1460
|
-
.describe('Polling interval in milliseconds when usePolling is enabled.'),
|
|
1461
|
-
/** Whether to use polling instead of native watchers. */
|
|
1462
|
-
usePolling: z
|
|
1463
|
-
.boolean()
|
|
1464
|
-
.optional()
|
|
1465
|
-
.describe('Use polling instead of native file system events (for network drives).'),
|
|
1466
|
-
/** Debounce delay in milliseconds for file change events. */
|
|
1467
|
-
debounceMs: z
|
|
1468
|
-
.number()
|
|
1469
|
-
.optional()
|
|
1470
|
-
.describe('Debounce delay in milliseconds for file change events.'),
|
|
1471
|
-
/** Time in milliseconds a file must be stable before processing. */
|
|
1472
|
-
stabilityThresholdMs: z
|
|
1473
|
-
.number()
|
|
1474
|
-
.optional()
|
|
1475
|
-
.describe('Time in milliseconds a file must remain unchanged before processing.'),
|
|
1476
|
-
/** Whether to respect .gitignore files when processing. */
|
|
1477
|
-
respectGitignore: z
|
|
1478
|
-
.boolean()
|
|
1479
|
-
.optional()
|
|
1480
|
-
.describe('Skip files ignored by .gitignore in git repositories. Only applies to repos with a .git directory. Default: true.'),
|
|
1481
|
-
/** Move detection configuration for correlating unlink+add as file moves. */
|
|
1482
|
-
moveDetection: z
|
|
1483
|
-
.object({
|
|
1484
|
-
/** Enable move correlation. Default: true. */
|
|
1485
|
-
enabled: z
|
|
1486
|
-
.boolean()
|
|
1487
|
-
.default(true)
|
|
1488
|
-
.describe('Enable move detection via content hash correlation.'),
|
|
1489
|
-
/** Buffer time in ms for holding unlink events before treating as deletes. Default: 2000. */
|
|
1490
|
-
bufferMs: z
|
|
1491
|
-
.number()
|
|
1492
|
-
.int()
|
|
1493
|
-
.min(100)
|
|
1494
|
-
.default(2000)
|
|
1495
|
-
.describe('How long (ms) to buffer unlink events before treating as deletes.'),
|
|
1496
|
-
})
|
|
1497
|
-
.optional()
|
|
1498
|
-
.describe('Move detection: correlate unlink+add events as file moves to avoid re-embedding.'),
|
|
1499
|
-
});
|
|
1500
|
-
/**
|
|
1501
|
-
* Configuration watch settings.
|
|
1502
|
-
*/
|
|
1503
|
-
const configWatchConfigSchema = z.object({
|
|
1504
|
-
/** Whether config file watching is enabled. */
|
|
1505
|
-
enabled: z
|
|
1506
|
-
.boolean()
|
|
1507
|
-
.optional()
|
|
1508
|
-
.describe('Enable automatic reloading when config file changes.'),
|
|
1509
|
-
/** Debounce delay in milliseconds for config change events. */
|
|
1510
|
-
debounceMs: z
|
|
1511
|
-
.number()
|
|
1512
|
-
.optional()
|
|
1513
|
-
.describe('Debounce delay in milliseconds for config file change detection.'),
|
|
1514
|
-
/** Reindex scope triggered on config change. */
|
|
1515
|
-
reindex: z
|
|
1516
|
-
.union([
|
|
1517
|
-
z
|
|
1518
|
-
.literal('issues')
|
|
1519
|
-
.describe('Re-process only files with recorded issues.'),
|
|
1520
|
-
z.literal('full').describe('Full reindex of all watched files.'),
|
|
1521
|
-
z
|
|
1522
|
-
.literal('rules')
|
|
1523
|
-
.describe('Re-apply inference rules to existing points without re-embedding.'),
|
|
1524
|
-
])
|
|
1525
|
-
.optional()
|
|
1526
|
-
.describe('Reindex scope triggered on config change. Default: issues.'),
|
|
1527
|
-
});
|
|
1528
|
-
/**
|
|
1529
|
-
* API server configuration.
|
|
1530
|
-
*/
|
|
1531
|
-
const apiConfigSchema = z.object({
|
|
1532
|
-
/** Host to bind to. */
|
|
1533
|
-
host: z
|
|
1534
|
-
.string()
|
|
1535
|
-
.optional()
|
|
1536
|
-
.describe('Host address for API server (e.g., "127.0.0.1", "0.0.0.0").'),
|
|
1537
|
-
/** Port to listen on. */
|
|
1538
|
-
port: z.number().optional().describe('Port for API server (e.g., 1936).'),
|
|
1539
|
-
/** Read endpoint cache TTL in milliseconds. */
|
|
1540
|
-
cacheTtlMs: z
|
|
1541
|
-
.number()
|
|
1542
|
-
.optional()
|
|
1543
|
-
.describe('TTL in milliseconds for caching read-heavy endpoints (e.g., /status, /config). Default: 30000.'),
|
|
1544
|
-
});
|
|
1545
|
-
/**
|
|
1546
|
-
* Logging configuration.
|
|
1547
|
-
*/
|
|
1548
|
-
const loggingConfigSchema = z.object({
|
|
1549
|
-
/** Log level. */
|
|
1550
|
-
level: z
|
|
1551
|
-
.string()
|
|
1552
|
-
.optional()
|
|
1553
|
-
.describe('Logging level (trace, debug, info, warn, error, fatal).'),
|
|
1554
|
-
/** Log file path. */
|
|
1555
|
-
file: z
|
|
1556
|
-
.string()
|
|
1557
|
-
.optional()
|
|
1558
|
-
.describe('Path to log file (logs to stdout if omitted).'),
|
|
1559
|
-
});
|
|
1560
|
-
|
|
1561
|
-
/**
|
|
1562
|
-
* @module config/schemas/inference
|
|
1563
|
-
* Inference rule and schema configuration schemas.
|
|
1564
|
-
*/
|
|
1565
|
-
/**
|
|
1566
|
-
* A JSON Schema property definition with optional custom keywords.
|
|
1567
|
-
* Supports standard JSON Schema keywords plus custom `set` and `uiHint`.
|
|
1568
|
-
*/
|
|
1569
|
-
const propertySchemaSchema = z.record(z.string(), z.unknown());
|
|
1570
|
-
/**
|
|
1571
|
-
* A schema object: properties with JSON Schema definitions.
|
|
1572
|
-
*/
|
|
1573
|
-
const schemaObjectSchema = z.object({
|
|
1574
|
-
type: z
|
|
1575
|
-
.literal('object')
|
|
1576
|
-
.optional()
|
|
1577
|
-
.describe('JSON Schema type (always "object" for schema definitions).'),
|
|
1578
|
-
properties: z
|
|
1579
|
-
.record(z.string(), propertySchemaSchema)
|
|
1580
|
-
.optional()
|
|
1581
|
-
.describe('Map of property names to JSON Schema property definitions.'),
|
|
1582
|
-
});
|
|
1583
|
-
/**
|
|
1584
|
-
* Global schema entry: inline object or file path.
|
|
1585
|
-
*/
|
|
1586
|
-
const schemaEntrySchema = z.union([
|
|
1587
|
-
schemaObjectSchema,
|
|
1588
|
-
z.string().describe('File path to a JSON schema file.'),
|
|
1589
|
-
]);
|
|
1590
|
-
/**
|
|
1591
|
-
* Schema reference: either a named schema reference (string) or an inline schema object.
|
|
1592
|
-
*/
|
|
1593
|
-
const schemaReferenceSchema = z.union([
|
|
1594
|
-
z.string().describe('Named reference to a global schema.'),
|
|
1595
|
-
schemaObjectSchema,
|
|
1596
|
-
]);
|
|
1597
|
-
/** Render body section. */
|
|
1598
|
-
const renderBodySectionSchema = z.object({
|
|
1599
|
-
/** Key path in the template context to render. */
|
|
1600
|
-
path: z.string().min(1).describe('Key path in template context to render.'),
|
|
1601
|
-
/** Markdown heading level for this section (1-6). */
|
|
1602
|
-
heading: z.number().min(1).max(6).describe('Markdown heading level (1-6).'),
|
|
1603
|
-
/** Override heading text (default: titlecased path). */
|
|
1604
|
-
label: z.string().optional().describe('Override heading text.'),
|
|
1605
|
-
/** Name of a registered Handlebars helper used as a format handler. */
|
|
1606
|
-
format: z
|
|
1607
|
-
.string()
|
|
1608
|
-
.optional()
|
|
1609
|
-
.describe('Name of a registered Handlebars helper used as a format handler.'),
|
|
1610
|
-
/** Additional args passed to the format helper. */
|
|
1611
|
-
formatArgs: z
|
|
1612
|
-
.array(z.unknown())
|
|
1613
|
-
.optional()
|
|
1614
|
-
.describe('Additional args passed to the format helper.'),
|
|
1615
|
-
/** If true, the value at path is treated as an array and iterated. */
|
|
1616
|
-
each: z
|
|
1617
|
-
.boolean()
|
|
1618
|
-
.optional()
|
|
1619
|
-
.describe('If true, the value at path is treated as an array and iterated.'),
|
|
1620
|
-
/** Handlebars template string for per-item heading text (used when each=true). */
|
|
1621
|
-
headingTemplate: z
|
|
1622
|
-
.string()
|
|
1623
|
-
.optional()
|
|
1624
|
-
.describe('Handlebars template string for per-item heading text (used when each=true).'),
|
|
1625
|
-
/** Key path within each item to use as renderable content (used when each=true). */
|
|
1626
|
-
contentPath: z
|
|
1627
|
-
.string()
|
|
1628
|
-
.optional()
|
|
1629
|
-
.describe('Key path within each item to use as renderable content (used when each=true).'),
|
|
1630
|
-
/** Key path within each item to sort by (used when each=true). */
|
|
1631
|
-
sort: z
|
|
1632
|
-
.string()
|
|
1633
|
-
.optional()
|
|
1634
|
-
.describe('Key path within each item to sort by (used when each=true).'),
|
|
1635
|
-
});
|
|
1636
|
-
/** Render config: YAML frontmatter + ordered body sections. */
|
|
1637
|
-
const renderConfigSchema = z.object({
|
|
1638
|
-
/** Keys or glob patterns to extract from context and include as YAML frontmatter. */
|
|
1639
|
-
frontmatter: z
|
|
1640
|
-
.array(z.string().min(1))
|
|
1641
|
-
.describe('Keys or glob patterns to include as YAML frontmatter. ' +
|
|
1642
|
-
'Supports picomatch globs (e.g. "*") and "!"-prefixed exclusion patterns (e.g. "!_*"). ' +
|
|
1643
|
-
'Explicit names preserve declaration order; glob-matched keys are sorted alphabetically.'),
|
|
1644
|
-
/** Ordered markdown body sections. */
|
|
1645
|
-
body: z
|
|
1646
|
-
.array(renderBodySectionSchema)
|
|
1647
|
-
.describe('Ordered markdown body sections.'),
|
|
1648
|
-
});
|
|
1649
|
-
/**
|
|
1650
|
-
* An inference rule that enriches document metadata.
|
|
1651
|
-
*/
|
|
1652
|
-
const inferenceRuleSchema = z
|
|
1653
|
-
.object({
|
|
1654
|
-
/** Unique name for this inference rule. */
|
|
1655
|
-
name: z
|
|
1656
|
-
.string()
|
|
1657
|
-
.min(1)
|
|
1658
|
-
.describe('Unique name identifying this inference rule.'),
|
|
1659
|
-
/** Human-readable description of what this rule does. */
|
|
1660
|
-
description: z
|
|
1661
|
-
.string()
|
|
1662
|
-
.min(1)
|
|
1663
|
-
.describe('Human-readable description of what this rule does.'),
|
|
1664
|
-
/** JSON Schema object to match against document metadata. */
|
|
1665
|
-
match: z
|
|
1666
|
-
.record(z.string(), z.unknown())
|
|
1667
|
-
.describe('JSON Schema object to match against file attributes.'),
|
|
1668
|
-
/** Array of schema references to merge (named refs and/or inline objects). */
|
|
1669
|
-
schema: z
|
|
1670
|
-
.array(schemaReferenceSchema)
|
|
1671
|
-
.optional()
|
|
1672
|
-
.describe('Array of schema references (named schema refs or inline objects) merged left-to-right.'),
|
|
1673
|
-
/** JsonMap transformation (inline or reference to named map). */
|
|
1674
|
-
map: z
|
|
1675
|
-
.union([jsonMapMapSchema, z.string()])
|
|
1676
|
-
.optional()
|
|
1677
|
-
.describe('JsonMap transformation (inline definition, named map reference, or .json file path).'),
|
|
1678
|
-
/** Handlebars template (inline string, named ref, or .hbs/.handlebars file path). */
|
|
1679
|
-
template: z
|
|
1680
|
-
.string()
|
|
1681
|
-
.optional()
|
|
1682
|
-
.describe('Handlebars content template (inline string, named ref, or .hbs/.handlebars file path).'),
|
|
1683
|
-
/** Declarative structured renderer configuration (mutually exclusive with template). */
|
|
1684
|
-
render: renderConfigSchema
|
|
1685
|
-
.optional()
|
|
1686
|
-
.describe('Declarative render configuration for frontmatter + structured Markdown output (mutually exclusive with template).'),
|
|
1687
|
-
/** Output file extension override (e.g. "md", "html", "txt"). Requires template or render. */
|
|
1688
|
-
renderAs: z
|
|
1689
|
-
.string()
|
|
1690
|
-
.regex(/^[a-z0-9]{1,10}$/, 'renderAs must be 1-10 lowercase alphanumeric characters')
|
|
1691
|
-
.optional()
|
|
1692
|
-
.describe('Output file extension override (without dot). Requires template or render.'),
|
|
1693
|
-
})
|
|
1694
|
-
.superRefine((val, ctx) => {
|
|
1695
|
-
if (val.render && val.template) {
|
|
1696
|
-
ctx.addIssue({
|
|
1697
|
-
code: 'custom',
|
|
1698
|
-
path: ['render'],
|
|
1699
|
-
message: 'render is mutually exclusive with template',
|
|
1700
|
-
});
|
|
1701
|
-
}
|
|
1702
|
-
if (val.renderAs && !val.template && !val.render) {
|
|
1703
|
-
ctx.addIssue({
|
|
1704
|
-
code: 'custom',
|
|
1705
|
-
path: ['renderAs'],
|
|
1706
|
-
message: 'renderAs requires template or render',
|
|
1707
|
-
});
|
|
1708
|
-
}
|
|
1709
|
-
});
|
|
1710
|
-
|
|
1711
|
-
/**
|
|
1712
|
-
* @module config/schemas/services
|
|
1713
|
-
* Service configuration schemas: embedding and vector store.
|
|
1714
|
-
*/
|
|
1715
|
-
/**
|
|
1716
|
-
* Embedding model configuration.
|
|
1717
|
-
*/
|
|
1718
|
-
const embeddingConfigSchema = z.object({
|
|
1719
|
-
/** The embedding model provider. */
|
|
1720
|
-
provider: z
|
|
1721
|
-
.string()
|
|
1722
|
-
.default('gemini')
|
|
1723
|
-
.describe('Embedding provider name (e.g., "gemini", "openai").'),
|
|
1724
|
-
/** The embedding model name. */
|
|
1725
|
-
model: z
|
|
1726
|
-
.string()
|
|
1727
|
-
.default('gemini-embedding-001')
|
|
1728
|
-
.describe('Embedding model identifier (e.g., "gemini-embedding-001", "text-embedding-3-small").'),
|
|
1729
|
-
/** Maximum tokens per chunk for splitting. */
|
|
1730
|
-
chunkSize: z
|
|
1731
|
-
.number()
|
|
1732
|
-
.optional()
|
|
1733
|
-
.describe('Maximum chunk size in characters for text splitting.'),
|
|
1734
|
-
/** Overlap between chunks in tokens. */
|
|
1735
|
-
chunkOverlap: z
|
|
1736
|
-
.number()
|
|
1737
|
-
.optional()
|
|
1738
|
-
.describe('Character overlap between consecutive chunks.'),
|
|
1739
|
-
/** Embedding vector dimensions. */
|
|
1740
|
-
dimensions: z
|
|
1741
|
-
.number()
|
|
1742
|
-
.optional()
|
|
1743
|
-
.describe('Embedding vector dimensions (must match model output).'),
|
|
1744
|
-
/** API key for the embedding provider. */
|
|
1745
|
-
apiKey: z
|
|
1746
|
-
.string()
|
|
1747
|
-
.optional()
|
|
1748
|
-
.describe('API key for embedding provider (supports ${ENV_VAR} substitution).'),
|
|
1749
|
-
/** Maximum embedding requests per minute. */
|
|
1750
|
-
rateLimitPerMinute: z
|
|
1751
|
-
.number()
|
|
1752
|
-
.optional()
|
|
1753
|
-
.describe('Maximum embedding API requests per minute (rate limiting).'),
|
|
1754
|
-
/** Maximum concurrent embedding requests. */
|
|
1755
|
-
concurrency: z
|
|
1756
|
-
.number()
|
|
1757
|
-
.optional()
|
|
1758
|
-
.describe('Maximum concurrent embedding requests.'),
|
|
1759
|
-
});
|
|
1760
|
-
/**
|
|
1761
|
-
* Vector store configuration for Qdrant.
|
|
1762
|
-
*/
|
|
1763
|
-
const vectorStoreConfigSchema = z.object({
|
|
1764
|
-
/** Qdrant server URL. */
|
|
1765
|
-
url: z
|
|
1766
|
-
.string()
|
|
1767
|
-
.describe('Qdrant server URL (e.g., "http://localhost:6333").'),
|
|
1768
|
-
/** Qdrant collection name. */
|
|
1769
|
-
collectionName: z
|
|
1770
|
-
.string()
|
|
1771
|
-
.describe('Qdrant collection name for vector storage.'),
|
|
1772
|
-
/** Qdrant API key. */
|
|
1773
|
-
apiKey: z
|
|
1774
|
-
.string()
|
|
1775
|
-
.optional()
|
|
1776
|
-
.describe('Qdrant API key for authentication (supports ${ENV_VAR} substitution).'),
|
|
1777
|
-
});
|
|
1778
|
-
|
|
1779
|
-
/**
|
|
1780
|
-
* @module config/schemas/root
|
|
1781
|
-
* Root configuration schema combining all sub-schemas.
|
|
1782
|
-
*/
|
|
1783
|
-
/**
|
|
1784
|
-
* Top-level configuration for jeeves-watcher.
|
|
1785
|
-
*/
|
|
1786
|
-
const jeevesWatcherConfigSchema = z.object({
|
|
1787
|
-
/** Optional description of this watcher deployment's organizational strategy. */
|
|
1788
|
-
description: z
|
|
1789
|
-
.string()
|
|
1790
|
-
.optional()
|
|
1791
|
-
.describe("Human-readable description of this deployment's organizational strategy and content domains."),
|
|
1792
|
-
/** Global named schema collection. */
|
|
1793
|
-
schemas: z
|
|
1794
|
-
.record(z.string(), schemaEntrySchema)
|
|
1795
|
-
.optional()
|
|
1796
|
-
.describe('Global named schema definitions (inline objects or file paths) referenced by inference rules.'),
|
|
1797
|
-
/** File system watch configuration. */
|
|
1798
|
-
watch: watchConfigSchema.describe('File system watch configuration.'),
|
|
1799
|
-
/** Configuration file watch settings. */
|
|
1800
|
-
configWatch: configWatchConfigSchema
|
|
1801
|
-
.optional()
|
|
1802
|
-
.describe('Configuration file watch settings.'),
|
|
1803
|
-
/** Embedding model configuration. */
|
|
1804
|
-
embedding: embeddingConfigSchema.describe('Embedding model configuration.'),
|
|
1805
|
-
/** Vector store configuration. */
|
|
1806
|
-
vectorStore: vectorStoreConfigSchema.describe('Qdrant vector store configuration.'),
|
|
1807
|
-
/** API server configuration. */
|
|
1808
|
-
api: apiConfigSchema.optional().describe('API server configuration.'),
|
|
1809
|
-
/** Directory for persistent state files (issues.json, values.json, enrichments.sqlite). */
|
|
1810
|
-
stateDir: z
|
|
1811
|
-
.string()
|
|
1812
|
-
.optional()
|
|
1813
|
-
.describe('Directory for persistent state files (issues.json, values.json, enrichments.sqlite). Defaults to .jeeves-metadata.'),
|
|
1814
|
-
/** Rules for inferring metadata from document properties (inline objects or file paths). */
|
|
1815
|
-
inferenceRules: z
|
|
1816
|
-
.array(z.union([inferenceRuleSchema, z.string()]))
|
|
1817
|
-
.optional()
|
|
1818
|
-
.describe('Rules for inferring metadata from file attributes. Each entry may be an inline rule object or a file path to a JSON rule file (resolved relative to config directory).'),
|
|
1819
|
-
/** Reusable named JsonMap transformations (inline objects or .json file paths). */
|
|
1820
|
-
maps: z
|
|
1821
|
-
.record(z.string(), z.union([
|
|
1822
|
-
jsonMapMapSchema,
|
|
1823
|
-
z.string(),
|
|
1824
|
-
z.object({
|
|
1825
|
-
/** The JsonMap definition (inline object or file path). */
|
|
1826
|
-
map: jsonMapMapSchema.or(z.string()),
|
|
1827
|
-
/** Optional human-readable description of this map. */
|
|
1828
|
-
description: z.string().optional(),
|
|
1829
|
-
}),
|
|
1830
|
-
]))
|
|
1831
|
-
.optional()
|
|
1832
|
-
.describe('Reusable named JsonMap transformations (inline definition or .json file path resolved relative to config directory).'),
|
|
1833
|
-
/** Reusable named Handlebars templates (inline strings or .hbs/.handlebars file paths). */
|
|
1834
|
-
templates: z
|
|
1835
|
-
.record(z.string(), z.union([
|
|
1836
|
-
z.string(),
|
|
1837
|
-
z.object({
|
|
1838
|
-
/** The Handlebars template source (inline string or file path). */
|
|
1839
|
-
template: z.string(),
|
|
1840
|
-
/** Optional human-readable description of this template. */
|
|
1841
|
-
description: z.string().optional(),
|
|
1842
|
-
}),
|
|
1843
|
-
]))
|
|
1844
|
-
.optional()
|
|
1845
|
-
.describe('Named reusable Handlebars templates (inline strings or .hbs/.handlebars file paths).'),
|
|
1846
|
-
/** Custom Handlebars helper registration. */
|
|
1847
|
-
templateHelpers: z
|
|
1848
|
-
.record(z.string(), z.object({
|
|
1849
|
-
/** File path to the helper module (resolved relative to config directory). */
|
|
1850
|
-
path: z.string(),
|
|
1851
|
-
/** Optional human-readable description of this helper. */
|
|
1852
|
-
description: z.string().optional(),
|
|
1853
|
-
}))
|
|
1854
|
-
.optional()
|
|
1855
|
-
.describe('Custom Handlebars helper registration.'),
|
|
1856
|
-
/** Custom JsonMap lib function registration. */
|
|
1857
|
-
mapHelpers: z
|
|
1858
|
-
.record(z.string(), z.object({
|
|
1859
|
-
/** File path to the helper module (resolved relative to config directory). */
|
|
1860
|
-
path: z.string(),
|
|
1861
|
-
/** Optional human-readable description of this helper. */
|
|
1862
|
-
description: z.string().optional(),
|
|
1863
|
-
}))
|
|
1864
|
-
.optional()
|
|
1865
|
-
.describe('Custom JsonMap lib function registration.'),
|
|
1866
|
-
/** Reindex configuration. */
|
|
1867
|
-
reindex: z
|
|
1868
|
-
.object({
|
|
1869
|
-
/** URL to call when reindex completes. */
|
|
1870
|
-
callbackUrl: z.url().optional(),
|
|
1871
|
-
/** Maximum concurrent file operations during reindex. */
|
|
1872
|
-
concurrency: z
|
|
1873
|
-
.number()
|
|
1874
|
-
.int()
|
|
1875
|
-
.min(1)
|
|
1876
|
-
.default(50)
|
|
1877
|
-
.describe('Maximum concurrent file operations during reindex (default 50).'),
|
|
1878
|
-
})
|
|
1879
|
-
.optional()
|
|
1880
|
-
.describe('Reindex configuration.'),
|
|
1881
|
-
/** Named Qdrant filter patterns for skill-activated behaviors. */
|
|
1882
|
-
/** Search configuration including score thresholds and hybrid search. */
|
|
1883
|
-
search: z
|
|
1884
|
-
.object({
|
|
1885
|
-
/** Score thresholds for categorizing search result quality. */
|
|
1886
|
-
scoreThresholds: z
|
|
1887
|
-
.object({
|
|
1888
|
-
/** Minimum score for a result to be considered a strong match. */
|
|
1889
|
-
strong: z.number().min(-1).max(1),
|
|
1890
|
-
/** Minimum score for a result to be considered relevant. */
|
|
1891
|
-
relevant: z.number().min(-1).max(1),
|
|
1892
|
-
/** Maximum score below which results are considered noise. */
|
|
1893
|
-
noise: z.number().min(-1).max(1),
|
|
1894
|
-
})
|
|
1895
|
-
.optional(),
|
|
1896
|
-
/** Hybrid search configuration combining vector and full-text search. */
|
|
1897
|
-
hybrid: z
|
|
1898
|
-
.object({
|
|
1899
|
-
/** Enable hybrid search with RRF fusion. Default: false. */
|
|
1900
|
-
enabled: z.boolean().default(false),
|
|
1901
|
-
/** Weight for text (BM25) results in RRF fusion. Default: 0.3. */
|
|
1902
|
-
textWeight: z.number().min(0).max(1).default(0.3),
|
|
1903
|
-
})
|
|
1904
|
-
.optional(),
|
|
1905
|
-
})
|
|
1906
|
-
.optional()
|
|
1907
|
-
.describe('Search configuration including score thresholds and hybrid search.'),
|
|
1908
|
-
/** Logging configuration. */
|
|
1909
|
-
logging: loggingConfigSchema.optional().describe('Logging configuration.'),
|
|
1910
|
-
/** Timeout in milliseconds for graceful shutdown. */
|
|
1911
|
-
shutdownTimeoutMs: z
|
|
1912
|
-
.number()
|
|
1913
|
-
.optional()
|
|
1914
|
-
.describe('Timeout in milliseconds for graceful shutdown.'),
|
|
1915
|
-
/** Maximum consecutive system-level failures before triggering fatal error. Default: Infinity. */
|
|
1916
|
-
maxRetries: z
|
|
1917
|
-
.number()
|
|
1918
|
-
.optional()
|
|
1919
|
-
.describe('Maximum consecutive system-level failures before triggering fatal error. Default: Infinity.'),
|
|
1920
|
-
/** Maximum backoff delay in milliseconds for system errors. Default: 60000. */
|
|
1921
|
-
maxBackoffMs: z
|
|
1922
|
-
.number()
|
|
1923
|
-
.optional()
|
|
1924
|
-
.describe('Maximum backoff delay in milliseconds for system errors. Default: 60000.'),
|
|
1925
|
-
});
|
|
1926
|
-
|
|
1927
1440
|
/**
|
|
1928
1441
|
* @module api/handlers/configSchema
|
|
1929
1442
|
* Returns the JSON Schema describing the merged config document.
|
|
@@ -2446,9 +1959,7 @@ function renderEach(hbs, section, value) {
|
|
|
2446
1959
|
: undefined;
|
|
2447
1960
|
const parts = [];
|
|
2448
1961
|
for (const item of items) {
|
|
2449
|
-
const headingText = headingTpl
|
|
2450
|
-
? headingTpl(item)
|
|
2451
|
-
: '';
|
|
1962
|
+
const headingText = headingTpl ? headingTpl(item) : '';
|
|
2452
1963
|
if (headingText) {
|
|
2453
1964
|
parts.push(`${'#'.repeat(subHeadingLevel)} ${headingText}`);
|
|
2454
1965
|
}
|
|
@@ -2937,8 +2448,8 @@ function validateFacetTypes(schema, ruleName) {
|
|
|
2937
2448
|
async function loadCustomMapHelpers(helpers, configDir) {
|
|
2938
2449
|
const namespaced = await loadNamespacedExports(helpers, configDir, (val) => typeof val === 'function');
|
|
2939
2450
|
const merged = {};
|
|
2940
|
-
for (const [namespace, exports
|
|
2941
|
-
for (const [key, val] of Object.entries(exports
|
|
2451
|
+
for (const [namespace, exports] of Object.entries(namespaced)) {
|
|
2452
|
+
for (const [key, val] of Object.entries(exports)) {
|
|
2942
2453
|
merged[`${namespace}_${key}`] = val;
|
|
2943
2454
|
}
|
|
2944
2455
|
}
|
|
@@ -3997,7 +3508,7 @@ function extractJsDocDescriptions(source) {
|
|
|
3997
3508
|
* @returns Introspection result with namespaced export names and descriptions.
|
|
3998
3509
|
*/
|
|
3999
3510
|
async function introspectHelperModule(filePath, namespace) {
|
|
4000
|
-
const exports
|
|
3511
|
+
const exports = {};
|
|
4001
3512
|
// Load module exports using shared utility (use parent dir as configDir, path as relative)
|
|
4002
3513
|
const namespaced = await loadNamespacedExports({ [namespace]: { path: filePath } }, '', (val) => typeof val === 'function');
|
|
4003
3514
|
// Try to read source for JSDoc extraction
|
|
@@ -4016,9 +3527,9 @@ async function introspectHelperModule(filePath, namespace) {
|
|
|
4016
3527
|
}
|
|
4017
3528
|
const nsExports = namespaced[namespace] ?? {};
|
|
4018
3529
|
for (const key of Object.keys(nsExports)) {
|
|
4019
|
-
exports
|
|
3530
|
+
exports[`${namespace}_${key}`] = jsDocMap[key] ?? '';
|
|
4020
3531
|
}
|
|
4021
|
-
return { exports
|
|
3532
|
+
return { exports };
|
|
4022
3533
|
}
|
|
4023
3534
|
/**
|
|
4024
3535
|
* Introspect all helper modules from config, returning exports for both mapHelpers and templateHelpers.
|
|
@@ -5224,68 +4735,6 @@ class ConfigWatcher {
|
|
|
5224
4735
|
}
|
|
5225
4736
|
}
|
|
5226
4737
|
|
|
5227
|
-
/**
|
|
5228
|
-
* @module config/defaults
|
|
5229
|
-
* Default configuration values for jeeves-watcher. Pure data export, no I/O or side effects.
|
|
5230
|
-
*/
|
|
5231
|
-
/** Default root-level config values. */
|
|
5232
|
-
const ROOT_DEFAULTS = {
|
|
5233
|
-
stateDir: '.jeeves-metadata',
|
|
5234
|
-
shutdownTimeoutMs: 10000,
|
|
5235
|
-
};
|
|
5236
|
-
/** Default configWatch values. */
|
|
5237
|
-
const CONFIG_WATCH_DEFAULTS = {
|
|
5238
|
-
enabled: true,
|
|
5239
|
-
debounceMs: 1000,
|
|
5240
|
-
};
|
|
5241
|
-
/** Default API values. */
|
|
5242
|
-
const API_DEFAULTS = {
|
|
5243
|
-
host: '127.0.0.1',
|
|
5244
|
-
port: DEFAULT_PORTS.watcher,
|
|
5245
|
-
cacheTtlMs: 30000,
|
|
5246
|
-
};
|
|
5247
|
-
/** Default logging values. */
|
|
5248
|
-
const LOGGING_DEFAULTS = {
|
|
5249
|
-
level: 'info',
|
|
5250
|
-
};
|
|
5251
|
-
/** Default watch configuration. */
|
|
5252
|
-
const WATCH_DEFAULTS = {
|
|
5253
|
-
debounceMs: 300,
|
|
5254
|
-
stabilityThresholdMs: 500,
|
|
5255
|
-
usePolling: false,
|
|
5256
|
-
pollIntervalMs: 1000,
|
|
5257
|
-
respectGitignore: true,
|
|
5258
|
-
};
|
|
5259
|
-
/** Default embedding configuration. */
|
|
5260
|
-
const EMBEDDING_DEFAULTS = {
|
|
5261
|
-
chunkSize: 1000,
|
|
5262
|
-
chunkOverlap: 200,
|
|
5263
|
-
dimensions: 3072,
|
|
5264
|
-
rateLimitPerMinute: 300,
|
|
5265
|
-
concurrency: 5,
|
|
5266
|
-
};
|
|
5267
|
-
/** Default init command config template. */
|
|
5268
|
-
const INIT_CONFIG_TEMPLATE = {
|
|
5269
|
-
$schema: 'node_modules/@karmaniverous/jeeves-watcher/config.schema.json',
|
|
5270
|
-
watch: {
|
|
5271
|
-
paths: ['**/*.{md,markdown,txt,text,json,html,htm,pdf,docx}'],
|
|
5272
|
-
ignored: ['**/node_modules/**', '**/.git/**', '**/.jeeves-watcher/**'],
|
|
5273
|
-
},
|
|
5274
|
-
configWatch: CONFIG_WATCH_DEFAULTS,
|
|
5275
|
-
embedding: {
|
|
5276
|
-
provider: 'gemini',
|
|
5277
|
-
model: 'gemini-embedding-001',
|
|
5278
|
-
dimensions: EMBEDDING_DEFAULTS.dimensions,
|
|
5279
|
-
},
|
|
5280
|
-
vectorStore: {
|
|
5281
|
-
url: 'http://127.0.0.1:6333',
|
|
5282
|
-
collectionName: 'jeeves-watcher',
|
|
5283
|
-
},
|
|
5284
|
-
stateDir: ROOT_DEFAULTS.stateDir,
|
|
5285
|
-
api: API_DEFAULTS,
|
|
5286
|
-
logging: LOGGING_DEFAULTS,
|
|
5287
|
-
};
|
|
5288
|
-
|
|
5289
4738
|
/**
|
|
5290
4739
|
* @module config/substituteEnvVars
|
|
5291
4740
|
*
|
|
@@ -8232,11 +7681,11 @@ const version = getPackageVersion(import.meta.url);
|
|
|
8232
7681
|
*/
|
|
8233
7682
|
const watcherDescriptor = {
|
|
8234
7683
|
// Identity
|
|
8235
|
-
name:
|
|
7684
|
+
name: COMPONENT_NAME,
|
|
8236
7685
|
version,
|
|
8237
|
-
servicePackage:
|
|
8238
|
-
pluginPackage:
|
|
8239
|
-
defaultPort:
|
|
7686
|
+
servicePackage: SERVICE_PACKAGE,
|
|
7687
|
+
pluginPackage: PLUGIN_PACKAGE,
|
|
7688
|
+
defaultPort: DEFAULT_PORT$1,
|
|
8240
7689
|
// Config
|
|
8241
7690
|
configSchema: jeevesWatcherConfigSchema,
|
|
8242
7691
|
configFileName: 'config.json',
|
|
@@ -8276,4 +7725,4 @@ const watcherDescriptor = {
|
|
|
8276
7725
|
},
|
|
8277
7726
|
};
|
|
8278
7727
|
|
|
8279
|
-
export { ContentHashCache, DocumentProcessor, EnrichmentStore, EventQueue, FileSystemWatcher, GitignoreFilter, InitialScanTracker, IssuesManager, JeevesWatcher, ReindexTracker, SystemHealth, TemplateEngine, ValuesManager, VectorStoreClient, VirtualRuleStore,
|
|
7728
|
+
export { ContentHashCache, DocumentProcessor, EnrichmentStore, EventQueue, FileSystemWatcher, GitignoreFilter, InitialScanTracker, IssuesManager, JeevesWatcher, ReindexTracker, SystemHealth, TemplateEngine, ValuesManager, VectorStoreClient, VirtualRuleStore, applyRules, buildAttributes, buildTemplateEngine, compileRules, contentHash, createApiServer, createEmbeddingProvider, createHandlebarsInstance, createLogger, extractText, issueRecordSchema, loadConfig, loadCustomHelpers, mergeEnrichment, pointId, registerBuiltinHelpers, resolveTemplateSource, startFromConfig, watcherDescriptor };
|