@happyvertical/smrt-core 0.47.0 → 0.47.1
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/AGENTS.md +1 -0
- package/agents/generators.md +19 -5
- package/agents/system-diagnostics.md +43 -0
- package/dist/browser.js +2 -1
- package/dist/change-feed.d.ts +8 -0
- package/dist/change-feed.d.ts.map +1 -1
- package/dist/change-feed.js +1 -1
- package/dist/change-feed.js.map +1 -1
- package/dist/index.js +2 -1
- package/dist/manifest/static-manifest.js +1 -1
- package/dist/manifest/static-manifest.js.map +1 -1
- package/dist/manifest/store.js +1 -1
- package/dist/manifest.json +1 -1
- package/dist/postgres-permissions.d.ts +3 -0
- package/dist/postgres-permissions.d.ts.map +1 -1
- package/dist/postgres-permissions.js +49 -6
- package/dist/postgres-permissions.js.map +1 -1
- package/dist/smrt-knowledge.json +14 -8
- package/dist/system/diagnostics.d.ts +299 -0
- package/dist/system/diagnostics.d.ts.map +1 -0
- package/dist/system/diagnostics.js +530 -0
- package/dist/system/diagnostics.js.map +1 -0
- package/dist/system/index.d.ts +1 -0
- package/dist/system/index.d.ts.map +1 -1
- package/dist/system/index.js +2 -1
- package/dist/utils/scanner-module.d.ts +16 -0
- package/dist/utils/scanner-module.d.ts.map +1 -1
- package/dist/vite-plugin/index.d.ts +34 -1
- package/dist/vite-plugin/index.d.ts.map +1 -1
- package/dist/vite-plugin/index.js +81 -2
- package/dist/vite-plugin/index.js.map +1 -1
- package/dist/vite-plugin.js +2 -2
- package/package.json +10 -10
package/AGENTS.md
CHANGED
|
@@ -20,6 +20,7 @@ and repository rules.
|
|
|
20
20
|
| `src/generators/`, `src/vite-plugin/web-collections.ts` | REST/CLI/MCP generation, manifest hashes, ETags | [agents/generators.md](agents/generators.md) |
|
|
21
21
|
| `src/vite-plugin/`, `src/consumer-plugin/`, `src/knowledge.ts` | Decorator UI hints, knowledge projection, generation snapshots | [agents/build-knowledge.md](agents/build-knowledge.md) |
|
|
22
22
|
| `src/object.ts`, `src/collection.ts`, `src/learning/memory.ts` | Context memory and semantic search | [agents/memory.md](agents/memory.md) |
|
|
23
|
+
| `src/system/diagnostics.ts` | SELECT-only `_smrt_*` diagnostics reader behind smrt-dev-mcp runtime tools (#1824) | [agents/system-diagnostics.md](agents/system-diagnostics.md) |
|
|
23
24
|
|
|
24
25
|
## Cross-module invariants
|
|
25
26
|
|
package/agents/generators.md
CHANGED
|
@@ -157,11 +157,25 @@ error nothing could clear.
|
|
|
157
157
|
Both `stale-*` codes are warnings by default and errors under `--strict`, which
|
|
158
158
|
is what CI runs. Alongside them: `agent-surface-missing-identity`,
|
|
159
159
|
`agent-surface-duplicate-identity`, and `agent-surface-empty-playbook` are
|
|
160
|
-
errors, and `agent-surface-not-static`
|
|
161
|
-
arrives as a *diagnostic* rather than two
|
|
162
|
-
dropped the loser — so that diagnostic
|
|
163
|
-
the not-static warning; otherwise the
|
|
164
|
-
exists to catch.
|
|
160
|
+
errors, and `agent-surface-not-static` and `agent-surface-tool-name-collision`
|
|
161
|
+
are warnings. A cross-file duplicate arrives as a *diagnostic* rather than two
|
|
162
|
+
entries — the scanner's merge already dropped the loser — so that diagnostic
|
|
163
|
+
maps to the duplicate error rather than the not-static warning; otherwise the
|
|
164
|
+
error would be unreachable for the case it exists to catch.
|
|
165
|
+
|
|
166
|
+
A `tool-name-collision` diagnostic (#2725) is derived from the MANIFEST, not
|
|
167
|
+
from the declaration: the plugin compares each emitted intent against
|
|
168
|
+
`buildWebMcpToolDefinitions` for the same build, which is already filtered by
|
|
169
|
+
the exposure policy, and appends the result to the surface. So it is excluded
|
|
170
|
+
from the drift comparison above — that pass re-derives declarations from source
|
|
171
|
+
alone and has no manifest, so counting one as "declared" would report every
|
|
172
|
+
collision as drift no rebuild could clear. The check is advisory and drops
|
|
173
|
+
nothing: `defineIntent` accepts the id, so the intent is emitted, and the
|
|
174
|
+
document-global tool-name lock (#2613) rejects whichever registers second — the
|
|
175
|
+
build-time notice is the earlier, cheaper form of the same answer. A build
|
|
176
|
+
cannot see the provider's WebMCP `namespace` or `effects` policy, either of
|
|
177
|
+
which separates the pair outright, so the message states that precondition
|
|
178
|
+
rather than asserting the collision.
|
|
165
179
|
|
|
166
180
|
`smrt doctor` prints the whole surface — model tools, intents, playbooks — from
|
|
167
181
|
these artifacts alone, with no application running.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<!-- Module doc for packages/core/AGENTS.md. Linked from the Modules table there. -->
|
|
2
|
+
|
|
3
|
+
# System diagnostics (#1824)
|
|
4
|
+
|
|
5
|
+
`src/system/diagnostics.ts` is the typed, SELECT-only reader over the
|
|
6
|
+
framework-owned `_smrt_*` tables for development tooling (smrt-dev-mcp runtime
|
|
7
|
+
diagnostics). It takes a `DatabaseInterface` and never resolves connections,
|
|
8
|
+
never writes, and never boots the app — connection resolution, redaction, and
|
|
9
|
+
provenance labeling belong to the caller (`packages/smrt-dev-mcp`
|
|
10
|
+
`tools/runtime/`).
|
|
11
|
+
|
|
12
|
+
Categories degrade individually: a missing table or failed read returns a
|
|
13
|
+
`CategoryUnavailable` result (`available: false` with `reason`
|
|
14
|
+
`table-missing`/`retired`/`read-error`) instead of throwing, an empty-but-
|
|
15
|
+
healthy category, or fabricated data. Callers must surface the reason, never
|
|
16
|
+
paper over it. `_smrt_registry` is a retired system table and is reported as
|
|
17
|
+
retired rather than read — only its existence is probed, never its rows.
|
|
18
|
+
|
|
19
|
+
Every read is a bounded `SELECT` with an explicit safe-column projection.
|
|
20
|
+
Sensitive columns are never selected, not selected-then-stripped: job
|
|
21
|
+
`args`/`result_pointer`/task payloads, schedule `agentConfig`/`methodArgs`, and
|
|
22
|
+
dispatch `payload`/`metadata` stay in the database; short error texts
|
|
23
|
+
(`last_error`, `error_message`) and statuses are surfaced for diagnosis, and
|
|
24
|
+
smrt-dev-mcp runs every string in a live result through
|
|
25
|
+
`redactConnectionString` before it reaches a client. Migration
|
|
26
|
+
counts use `MigrationTracker`'s real vocabulary (`completed`, `running`,
|
|
27
|
+
`failed`, `rolled_back`), never an invented `applied`/`pending`. A `running`
|
|
28
|
+
job is stuck only when its `worker_heartbeat` is stale or NULL **and** its
|
|
29
|
+
worker holds no fresh `_smrt_workers.lease_expires_at` — the same rule the
|
|
30
|
+
runner's recovery uses (#1474), so a handler blocking its event loop under a
|
|
31
|
+
live off-loop lease is not reported stuck; without the workers table the
|
|
32
|
+
heartbeat is the only signal. Row lists honor `DIAGNOSTICS_DEFAULT_LIMIT` (50)
|
|
33
|
+
capped at 500; `readRecentChanges()` pages `getChangesSince()` with
|
|
34
|
+
`drain: false` (default 200, same cap) so the PostgreSQL staged-entry drain —
|
|
35
|
+
a write — never runs from a diagnostic.
|
|
36
|
+
|
|
37
|
+
Engine compatibility lives in one place: `placeholders(db)` resolves `$n`
|
|
38
|
+
numbering (PostgreSQL) versus `?` (SQLite/DuckDB) via the shared
|
|
39
|
+
`getDatabaseEngine` convention — explicit `type`/config hint first, then the
|
|
40
|
+
connection URL's scheme — and identifiers are never interpolated from caller
|
|
41
|
+
input, only from the constant `SYSTEM_DIAGNOSTICS_TABLES` map.
|
|
42
|
+
`readSystemDiagnostics()` composes every
|
|
43
|
+
category for one-shot snapshots; per-category readers compose it.
|
package/dist/browser.js
CHANGED
|
@@ -22,7 +22,8 @@ import { SmrtHierarchical } from "./hierarchical.js";
|
|
|
22
22
|
import { SmrtJunction } from "./junction.js";
|
|
23
23
|
import { SmrtPolymorphicAssociation } from "./polymorphic-association.js";
|
|
24
24
|
import "./signals/index.js";
|
|
25
|
+
import { DIAGNOSTICS_DEFAULT_LIMIT, SYSTEM_DIAGNOSTICS_TABLES, readDispatchHealth, readJobHealth, readMigrationStatus, readRecentChanges, readRegistryDrift, readScheduleHealth, readSystemDiagnostics } from "./system/diagnostics.js";
|
|
25
26
|
import { DEFAULT_RETENTION_POLICY, clearRetentionTasks, getRetentionTasks, pruneAiUsage, pruneExpiredContexts, registerRetentionTask, runRetentionSweep, unregisterRetentionTask } from "./system/retention.js";
|
|
26
27
|
import "./system/index.js";
|
|
27
28
|
import "./tools/index.js";
|
|
28
|
-
export { AIError, AiUsageCollector, AiUsagePersistenceHandler, ConfigurationError, DEFAULT_AI_COST_RATES, DEFAULT_FACET_LIMIT, DEFAULT_RETENTION_POLICY, DatabaseError, ErrorUtils, FilesystemError, MAX_FACET_FIELDS, MAX_FACET_LIMIT, MAX_STI_READ_SCOPE_TYPES, MetricsAdapter, NetworkError, ObjectRegistry, PubSubAdapter, RuntimeError, SMRT_COLLECTION_BASE_NAMES, SignalBus, SignalSanitizer, SmrtClass, SmrtCollection, SmrtError, SmrtHierarchical, SmrtJunction, SmrtObject, SmrtPolymorphicAssociation, TenantIsolationError, ValidationError, ValidationReport, ValidationUtils, assertPostgresSystemTimestampsCurrent, classifyDatabaseError, classifyDialectMessage, clearRetentionTasks, config, convertTypeToJsonSchema, ensureBootstrapSystemTableCompatibility, ensureDeferredSystemTableCompatibility, ensureDispatchSubscriptionsSystemTableCompatibility, ensureDispatchSystemTableCompatibility, ensureJobEventsSystemTableCompatibility, ensureJobsSystemTableCompatibility, ensureLegacySystemTableCompatibility, ensureSystemTables, estimateAiUsageCost, executeToolCall, executeToolCalls, formatToolResults, generateToolFromMethod, generateToolManifest, getDatabaseEngine, getRetentionTasks, isAbortedTransactionError, isDeterministicDatabaseError, isFrameworkBaseClass, isNotNullViolationError, isSmrtCollectionExtendsName, isTransientDatabaseError, isUniqueViolationError, migratePostgresSystemTimestamps, planPostgresSystemTimestampMigrations, pruneAiUsage, pruneExpiredContexts, registerRetentionTask, runRetentionSweep, shouldIncludeMethod, smrt, smrt as smrtRegistry, tableExists, unregisterRetentionTask, validateToolCall };
|
|
29
|
+
export { AIError, AiUsageCollector, AiUsagePersistenceHandler, ConfigurationError, DEFAULT_AI_COST_RATES, DEFAULT_FACET_LIMIT, DEFAULT_RETENTION_POLICY, DIAGNOSTICS_DEFAULT_LIMIT, DatabaseError, ErrorUtils, FilesystemError, MAX_FACET_FIELDS, MAX_FACET_LIMIT, MAX_STI_READ_SCOPE_TYPES, MetricsAdapter, NetworkError, ObjectRegistry, PubSubAdapter, RuntimeError, SMRT_COLLECTION_BASE_NAMES, SYSTEM_DIAGNOSTICS_TABLES, SignalBus, SignalSanitizer, SmrtClass, SmrtCollection, SmrtError, SmrtHierarchical, SmrtJunction, SmrtObject, SmrtPolymorphicAssociation, TenantIsolationError, ValidationError, ValidationReport, ValidationUtils, assertPostgresSystemTimestampsCurrent, classifyDatabaseError, classifyDialectMessage, clearRetentionTasks, config, convertTypeToJsonSchema, ensureBootstrapSystemTableCompatibility, ensureDeferredSystemTableCompatibility, ensureDispatchSubscriptionsSystemTableCompatibility, ensureDispatchSystemTableCompatibility, ensureJobEventsSystemTableCompatibility, ensureJobsSystemTableCompatibility, ensureLegacySystemTableCompatibility, ensureSystemTables, estimateAiUsageCost, executeToolCall, executeToolCalls, formatToolResults, generateToolFromMethod, generateToolManifest, getDatabaseEngine, getRetentionTasks, isAbortedTransactionError, isDeterministicDatabaseError, isFrameworkBaseClass, isNotNullViolationError, isSmrtCollectionExtendsName, isTransientDatabaseError, isUniqueViolationError, migratePostgresSystemTimestamps, planPostgresSystemTimestampMigrations, pruneAiUsage, pruneExpiredContexts, readDispatchHealth, readJobHealth, readMigrationStatus, readRecentChanges, readRegistryDrift, readScheduleHealth, readSystemDiagnostics, registerRetentionTask, runRetentionSweep, shouldIncludeMethod, smrt, smrt as smrtRegistry, tableExists, unregisterRetentionTask, validateToolCall };
|
package/dist/change-feed.d.ts
CHANGED
|
@@ -66,6 +66,14 @@ export interface GetChangesOptions {
|
|
|
66
66
|
* resync before resuming from {@link ChangeFeedPage.resyncCursor}.
|
|
67
67
|
*/
|
|
68
68
|
since: number;
|
|
69
|
+
/**
|
|
70
|
+
* Whether to sequence staged entries before reading (default `true`). On
|
|
71
|
+
* PostgreSQL that drain writes through `_smrt_drain_changes()`; a
|
|
72
|
+
* diagnostics reader that must stay SELECT-only passes `false` and
|
|
73
|
+
* accepts that entries still staged by an open caller transaction remain
|
|
74
|
+
* invisible until a writer drains them.
|
|
75
|
+
*/
|
|
76
|
+
drain?: boolean;
|
|
69
77
|
/** Restrict to these physical table names. Empty/omitted → all tables. */
|
|
70
78
|
tables?: string[];
|
|
71
79
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"change-feed.d.ts","sourceRoot":"","sources":["../src/change-feed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkIG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAS5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAqB9C,wDAAwD;AACxD,eAAO,MAAM,iBAAiB,kBAAkB,CAAC;AAEjD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,2BAA2B,EAAE,WAAW,CAAC,MAAM,CAQ1D,CAAC;AAEH;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAEtE;AAED,8DAA8D;AAC9D,eAAO,MAAM,4BAA4B,qBAAqB,CAAC;AAE/D;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE7D,oCAAoC;AACpC,MAAM,WAAW,eAAe;IAC9B,uEAAuE;IACvE,GAAG,EAAE,MAAM,CAAC;IACZ,yFAAyF;IACzF,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,8DAA8D;IAC9D,SAAS,EAAE,eAAe,CAAC;IAC3B,+EAA+E;IAC/E,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,gEAAgE;IAChE,SA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ED,gFAAgF;AAChF,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,UAAU,EACpB,SAAS,GAAE,eAA0B,GACpC,OAAO,CAAC,IAAI,CAAC,CAEf;AA8DD;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAS9C"}
|
package/dist/change-feed.js
CHANGED
|
@@ -779,7 +779,7 @@ async function getChangesSince(db, options) {
|
|
|
779
779
|
const { since } = options;
|
|
780
780
|
if (!Number.isFinite(since) || since < 0) throw new Error(`getChangesSince requires a non-negative numeric cursor, got '${String(since)}'`);
|
|
781
781
|
const limit = Math.min(Math.max(Math.floor(options.limit ?? 500), 1), MAX_CHANGES_LIMIT);
|
|
782
|
-
await drainChangeFeedBestEffort(db);
|
|
782
|
+
if (options.drain !== false) await drainChangeFeedBestEffort(db);
|
|
783
783
|
const p = placeholders(db);
|
|
784
784
|
const boundsRows = getQueryRows(await db.query(getEngine(db) === "postgres" ? `SELECT MIN(seq) AS floor, MAX(seq) AS horizon, pg_current_xact_id_if_assigned() IS NOT NULL AS in_transaction FROM ${CHANGE_FEED_TABLE}` : `SELECT MIN(seq) AS floor, MAX(seq) AS horizon FROM ${CHANGE_FEED_TABLE}`));
|
|
785
785
|
const floor = toSeqNumber(boundsRows[0]?.floor);
|