@cat-factory/local-server 0.92.0 → 0.93.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.
- package/dist/container.js +17 -12
- package/dist/container.js.map +1 -1
- package/dist/mothership.d.ts +10 -1
- package/dist/mothership.d.ts.map +1 -1
- package/dist/mothership.js +6 -1
- package/dist/mothership.js.map +1 -1
- package/dist/sqlite/telemetryIngestReader.d.ts +62 -0
- package/dist/sqlite/telemetryIngestReader.d.ts.map +1 -0
- package/dist/sqlite/telemetryIngestReader.js +86 -0
- package/dist/sqlite/telemetryIngestReader.js.map +1 -0
- package/dist/sqlite/telemetryRows.d.ts +62 -0
- package/dist/sqlite/telemetryRows.d.ts.map +1 -0
- package/dist/sqlite/telemetryRows.js +87 -0
- package/dist/sqlite/telemetryRows.js.map +1 -0
- package/dist/sqlite/telemetryStore.d.ts +3 -1
- package/dist/sqlite/telemetryStore.d.ts.map +1 -1
- package/dist/sqlite/telemetryStore.js +87 -87
- package/dist/sqlite/telemetryStore.js.map +1 -1
- package/dist/telemetryIngest.d.ts +49 -0
- package/dist/telemetryIngest.d.ts.map +1 -0
- package/dist/telemetryIngest.js +226 -0
- package/dist/telemetryIngest.js.map +1 -0
- package/dist/telemetryRetention.d.ts +2 -0
- package/dist/telemetryRetention.d.ts.map +1 -1
- package/dist/telemetryRetention.js +5 -0
- package/dist/telemetryRetention.js.map +1 -1
- package/dist/telemetrySweeps.d.ts +28 -0
- package/dist/telemetrySweeps.d.ts.map +1 -0
- package/dist/telemetrySweeps.js +32 -0
- package/dist/telemetrySweeps.js.map +1 -0
- package/package.json +11 -11
|
@@ -8,6 +8,8 @@ export interface LocalTelemetryRetentionResult {
|
|
|
8
8
|
agentSearchQueries: number;
|
|
9
9
|
provisioningLog: number;
|
|
10
10
|
subscriptionQuotaCycles: number;
|
|
11
|
+
/** Upstream-ingest high-water marks (PR 5's sync UP) whose runs' rows are long gone. */
|
|
12
|
+
ingestState: number;
|
|
11
13
|
}
|
|
12
14
|
/**
|
|
13
15
|
* Prune each local telemetry table to its retention window. Pure over the store, so it is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetryRetention.d.ts","sourceRoot":"","sources":["../src/telemetryRetention.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAExD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AA4BrE,mEAAmE;AACnE,MAAM,WAAW,6BAA6B;IAC5C,cAAc,EAAE,MAAM,CAAA;IACtB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,kBAAkB,EAAE,MAAM,CAAA;IAC1B,eAAe,EAAE,MAAM,CAAA;IACvB,uBAAuB,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"telemetryRetention.d.ts","sourceRoot":"","sources":["../src/telemetryRetention.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAExD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AA4BrE,mEAAmE;AACnE,MAAM,WAAW,6BAA6B;IAC5C,cAAc,EAAE,MAAM,CAAA;IACtB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,kBAAkB,EAAE,MAAM,CAAA;IAC1B,eAAe,EAAE,MAAM,CAAA;IACvB,uBAAuB,EAAE,MAAM,CAAA;IAC/B,wFAAwF;IACxF,WAAW,EAAE,MAAM,CAAA;CACpB;AAYD;;;;;GAKG;AACH,wBAAsB,4BAA4B,CAChD,KAAK,EAAE,mBAAmB,EAC1B,SAAS,EAAE,eAAe,EAC1B,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,6BAA6B,CAAC,CAyBxC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,mBAAmB,EAC1B,SAAS,EAAE,eAAe,EAC1B,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,MAAM,GACV,MAAM,OAAO,CAAC,IAAI,CAAC,CA8BrB"}
|
|
@@ -41,6 +41,11 @@ export async function sweepLocalTelemetryRetention(store, retention, now) {
|
|
|
41
41
|
agentSearchQueries: await prune(retention.llmCallMetricsMs, now, (c) => store.agentSearchQueryRepository.deleteOlderThan(c)),
|
|
42
42
|
provisioningLog: await prune(retention.provisioningLogMs, now, (c) => store.provisioningLogRepository.deleteOlderThan(c)),
|
|
43
43
|
subscriptionQuotaCycles: await prune(SUBSCRIPTION_QUOTA_CYCLE_RETENTION_MS, now, (c) => store.subscriptionQuotaCycleRepository.deleteOlderThan(c)),
|
|
44
|
+
// The ingest bookkeeping rides the LLM-call window too, and the ordering is what makes that
|
|
45
|
+
// safe: a mark is stamped at ingest time, which is always at or after the newest row it covers,
|
|
46
|
+
// so the mark outlives the rows it describes and can never be dropped while a still-stored run
|
|
47
|
+
// would be re-uploaded because of it.
|
|
48
|
+
ingestState: await prune(retention.llmCallMetricsMs, now, async (c) => store.ingestReader.deleteIngestStateOlderThan(c)),
|
|
44
49
|
};
|
|
45
50
|
}
|
|
46
51
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetryRetention.js","sourceRoot":"","sources":["../src/telemetryRetention.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIvD,gGAAgG;AAChG,4FAA4F;AAC5F,iGAAiG;AACjG,kGAAkG;AAClG,kGAAkG;AAClG,8FAA8F;AAC9F,qCAAqC;AACrC,EAAE;AACF,iGAAiG;AACjG,mGAAmG;AACnG,wFAAwF;AAExF;;;;GAIG;AACH,MAAM,iCAAiC,GAAG,EAAE,GAAG,EAAE,GAAG,IAA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AAM,IAAI,CAAA;gBAC5B,IAAI,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;oBAChD,GAAG,CAAC,IAAI,CAAC,gDAAgD,EAAE,EAAE,GAAG,SAAS,EAAE,CAAC,CAAA;gBAC9E,CAAC;YACH,CAAC;oBAAS,CAAC;gBACT,IAAI,QAAQ,KAAK,IAAI;oBAAE,QAAQ,GAAG,SAAS,CAAA;YAC7C,CAAC;QACH,CAAC;KACF,CAAC,CAAA;IACF,OAAO,KAAK,IAAI,EAAE;QAChB,OAAO,GAAG,IAAI,CAAA;QACd,WAAW,EAAE,CAAA;QACb,+FAA+F;QAC/F,gGAAgG;QAChG,kFAAkF;QAClF,MAAM,QAAQ,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAA;IACxC,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Clock, Logger } from '@cat-factory/kernel';
|
|
2
|
+
import type { MachineTelemetryClient, RetentionConfig } from '@cat-factory/server';
|
|
3
|
+
import type { LocalTelemetryStore } from './sqlite/telemetryStore.js';
|
|
4
|
+
export interface MothershipTelemetrySweepDeps {
|
|
5
|
+
store: LocalTelemetryStore;
|
|
6
|
+
client: MachineTelemetryClient;
|
|
7
|
+
retention: RetentionConfig;
|
|
8
|
+
clock: Clock;
|
|
9
|
+
log: Logger;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Start the local telemetry PRUNE and the UPSTREAM ingest, returning one stop function that awaits
|
|
13
|
+
* both.
|
|
14
|
+
*
|
|
15
|
+
* - The prune is the only thing bounding the store: the mothership's cron owns ITS tables, and the
|
|
16
|
+
* Node facade's retention sweeper runs from `start()`, which a mothership-mode boot never calls.
|
|
17
|
+
* Left unpruned, `llm_call_metrics` — full per-call prompt + response bodies — grows without
|
|
18
|
+
* bound on the developer's disk.
|
|
19
|
+
* - The ingest is what stops the prune being a DATA LOSS: it carries a quiesced run's rows up to
|
|
20
|
+
* the mothership, so a run this laptop drove stays readable (by hosted teammates, and by anyone
|
|
21
|
+
* at all) after the local window passes.
|
|
22
|
+
*
|
|
23
|
+
* The returned stop is ASYNC and must be AWAITED before the store closes — each sweep's first pass
|
|
24
|
+
* is asynchronous, so an un-awaited one dies on "database is not open" and puts a spurious error
|
|
25
|
+
* line on every clean exit.
|
|
26
|
+
*/
|
|
27
|
+
export declare function startMothershipTelemetrySweeps(deps: MothershipTelemetrySweepDeps): () => Promise<void>;
|
|
28
|
+
//# sourceMappingURL=telemetrySweeps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetrySweeps.d.ts","sourceRoot":"","sources":["../src/telemetrySweeps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,KAAK,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAClF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAWrE,MAAM,WAAW,4BAA4B;IAC3C,KAAK,EAAE,mBAAmB,CAAA;IAC1B,MAAM,EAAE,sBAAsB,CAAA;IAC9B,SAAS,EAAE,eAAe,CAAA;IAC1B,KAAK,EAAE,KAAK,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;CACZ;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,4BAA4B,GACjC,MAAM,OAAO,CAAC,IAAI,CAAC,CAiBrB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { startTelemetryIngest } from './telemetryIngest.js';
|
|
2
|
+
import { startLocalTelemetryRetention } from './telemetryRetention.js';
|
|
3
|
+
/**
|
|
4
|
+
* Start the local telemetry PRUNE and the UPSTREAM ingest, returning one stop function that awaits
|
|
5
|
+
* both.
|
|
6
|
+
*
|
|
7
|
+
* - The prune is the only thing bounding the store: the mothership's cron owns ITS tables, and the
|
|
8
|
+
* Node facade's retention sweeper runs from `start()`, which a mothership-mode boot never calls.
|
|
9
|
+
* Left unpruned, `llm_call_metrics` — full per-call prompt + response bodies — grows without
|
|
10
|
+
* bound on the developer's disk.
|
|
11
|
+
* - The ingest is what stops the prune being a DATA LOSS: it carries a quiesced run's rows up to
|
|
12
|
+
* the mothership, so a run this laptop drove stays readable (by hosted teammates, and by anyone
|
|
13
|
+
* at all) after the local window passes.
|
|
14
|
+
*
|
|
15
|
+
* The returned stop is ASYNC and must be AWAITED before the store closes — each sweep's first pass
|
|
16
|
+
* is asynchronous, so an un-awaited one dies on "database is not open" and puts a spurious error
|
|
17
|
+
* line on every clean exit.
|
|
18
|
+
*/
|
|
19
|
+
export function startMothershipTelemetrySweeps(deps) {
|
|
20
|
+
const stopRetention = startLocalTelemetryRetention(deps.store, deps.retention, deps.clock, deps.log);
|
|
21
|
+
const stopIngest = startTelemetryIngest({
|
|
22
|
+
reader: deps.store.ingestReader,
|
|
23
|
+
client: deps.client,
|
|
24
|
+
clock: deps.clock,
|
|
25
|
+
log: deps.log,
|
|
26
|
+
});
|
|
27
|
+
return async () => {
|
|
28
|
+
await stopRetention();
|
|
29
|
+
await stopIngest();
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=telemetrySweeps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetrySweeps.js","sourceRoot":"","sources":["../src/telemetrySweeps.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAA;AAiBtE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,8BAA8B,CAC5C,IAAkC;IAElC,MAAM,aAAa,GAAG,4BAA4B,CAChD,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,GAAG,CACT,CAAA;IACD,MAAM,UAAU,GAAG,oBAAoB,CAAC;QACtC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY;QAC/B,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,GAAG,EAAE,IAAI,CAAC,GAAG;KACd,CAAC,CAAA;IACF,OAAO,KAAK,IAAI,EAAE;QAChB,MAAM,aAAa,EAAE,CAAA;QACrB,MAAM,UAAU,EAAE,CAAA;IACpB,CAAC,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cat-factory/local-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.93.0",
|
|
4
4
|
"description": "Local-mode runtime facade for the Agent Architecture Board: the @cat-factory/node-server stack with agent jobs run as local Docker/Podman containers and GitHub accessed via a personal access token — a developer can run the whole product on their own machine.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,23 +27,23 @@
|
|
|
27
27
|
"@hono/node-server": "^2.0.12",
|
|
28
28
|
"drizzle-orm": "1.0.0-rc.4",
|
|
29
29
|
"ws": "^8.21.1",
|
|
30
|
-
"@cat-factory/agents": "0.
|
|
30
|
+
"@cat-factory/agents": "0.95.1",
|
|
31
31
|
"@cat-factory/executor-harness": "1.82.0",
|
|
32
|
-
"@cat-factory/gitlab": "0.14.
|
|
33
|
-
"@cat-factory/integrations": "0.113.
|
|
34
|
-
"@cat-factory/contracts": "0.
|
|
35
|
-
"@cat-factory/
|
|
36
|
-
"@cat-factory/
|
|
37
|
-
"@cat-factory/
|
|
38
|
-
"@cat-factory/server": "0.
|
|
32
|
+
"@cat-factory/gitlab": "0.14.15",
|
|
33
|
+
"@cat-factory/integrations": "0.113.7",
|
|
34
|
+
"@cat-factory/contracts": "0.203.0",
|
|
35
|
+
"@cat-factory/kernel": "0.202.0",
|
|
36
|
+
"@cat-factory/node-server": "0.145.0",
|
|
37
|
+
"@cat-factory/orchestration": "0.178.1",
|
|
38
|
+
"@cat-factory/server": "0.187.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/node": "^26.1.1",
|
|
42
42
|
"@types/ws": "^8.18.1",
|
|
43
43
|
"typescript": "7.0.2",
|
|
44
44
|
"vitest": "^4.1.10",
|
|
45
|
-
"@cat-factory/
|
|
46
|
-
"@cat-factory/
|
|
45
|
+
"@cat-factory/conformance": "0.16.13",
|
|
46
|
+
"@cat-factory/gates": "0.8.32"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"build": "tsc -b tsconfig.build.json",
|