@vostride/agent-qa-knowledge-local 0.0.0-stage → 0.2.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.
@@ -0,0 +1,78 @@
1
+ import { z } from 'zod';
2
+
3
+ declare const EMBEDDER_WORKER_REGISTRATION_FILE = "embedder-worker.json";
4
+ declare const EMBEDDER_WORKER_REGISTRATION_SCHEMA_VERSION = 2;
5
+ /**
6
+ * What a worker records when it cannot attribute its own process.
7
+ *
8
+ * The field is required rather than optional on purpose: an absent incarnation would let a forged
9
+ * registration opt out of the check entirely. A worker that genuinely cannot resolve its own start
10
+ * time says so explicitly, and the host reads that as `unverifiable` — which withholds every
11
+ * signal, exactly as an unresolvable pid does.
12
+ */
13
+ declare const EMBEDDER_WORKER_UNVERIFIABLE_INCARNATION = "unresolved";
14
+ /** D-15 provisional request deadline; retune from daemon telemetry without adding config. */
15
+ declare const EMBEDDER_WORKER_REQUEST_TIMEOUT_MS = 30000;
16
+ /** D-15 provisional child-readiness deadline; retune from daemon telemetry without adding config. */
17
+ declare const EMBEDDER_WORKER_START_TIMEOUT_MS = 15000;
18
+ /** D-15 provisional TERM grace; retune from daemon telemetry without adding config. */
19
+ declare const EMBEDDER_WORKER_TERM_GRACE_MS = 5000;
20
+ type EmbedderWorkerTimeoutPhase = 'request' | 'start' | 'terminate';
21
+ /** A bounded worker wait expired; callers can defer by phase without parsing error text. */
22
+ declare class EmbedderWorkerTimeoutError extends Error {
23
+ readonly phase: EmbedderWorkerTimeoutPhase;
24
+ readonly timeoutMs: number;
25
+ constructor(phase: EmbedderWorkerTimeoutPhase, timeoutMs: number);
26
+ }
27
+ declare const embedderWorkerRegistrationSchema: z.ZodObject<{
28
+ schemaVersion: z.ZodLiteral<2>;
29
+ instanceId: z.ZodString;
30
+ pid: z.ZodNumber;
31
+ socketPath: z.ZodString;
32
+ profile: z.ZodObject<{
33
+ model_id: z.ZodString;
34
+ revision: z.ZodString;
35
+ dim: z.ZodNumber;
36
+ dtype: z.ZodLiteral<"q8">;
37
+ pooling: z.ZodLiteral<"mean">;
38
+ normalize: z.ZodLiteral<true>;
39
+ query_prefix: z.ZodString;
40
+ doc_prefix: z.ZodString;
41
+ backend: z.ZodEnum<{
42
+ node: "node";
43
+ static: "static";
44
+ }>;
45
+ session_options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
46
+ tau_dense: z.ZodNumber;
47
+ }, z.core.$strict>;
48
+ startedAtMs: z.ZodNumber;
49
+ incarnation: z.ZodString;
50
+ }, z.core.$strict>;
51
+ type EmbedderWorkerRegistration = z.infer<typeof embedderWorkerRegistrationSchema>;
52
+ type ReadEmbedderWorkerRegistrationOutcome = {
53
+ kind: 'absent';
54
+ } | {
55
+ kind: 'malformed';
56
+ } | {
57
+ kind: 'parsed';
58
+ registration: EmbedderWorkerRegistration;
59
+ };
60
+ /** Three-valued because the third value is a refusal, never a permissive default. */
61
+ type EmbedderWorkerIncarnationVerdict = 'match' | 'mismatch' | 'unverifiable';
62
+ /** Resolve an instance-scoped UDS path without crossing conservative POSIX sun_path limits. */
63
+ declare function embedderWorkerSocketPath(agentQaRoot: string, projectRoot: string, instanceId: string): string;
64
+ declare function writeEmbedderWorkerRegistration(agentQaRoot: string, registration: EmbedderWorkerRegistration): void;
65
+ declare function readEmbedderWorkerRegistration(agentQaRoot: string): ReadEmbedderWorkerRegistrationOutcome;
66
+ /** Signal-zero liveness probe: EPERM proves existence; only ESRCH proves a stale pid. */
67
+ declare function embedderWorkerProcessIsAlive(pid: number): boolean;
68
+ interface RemoveEmbedderWorkerRegistrationOptions {
69
+ /** Test-only barrier after quarantine publication and before ownership verification. */
70
+ readonly afterQuarantine?: (quarantinePath: string) => void;
71
+ /** Focused durability seam; production uses the best-effort platform fsync helper. */
72
+ readonly fsyncDirectory?: (directory: string) => void;
73
+ }
74
+ /** Atomically quarantine and remove only the exact registration owned by the caller. */
75
+ declare function removeEmbedderWorkerRegistration(agentQaRoot: string, expected: EmbedderWorkerRegistration, options?: RemoveEmbedderWorkerRegistrationOptions): boolean;
76
+ declare function probeEmbedderWorkerSocket(socketPath: string): Promise<boolean>;
77
+
78
+ export { type EmbedderWorkerRegistration as E, type ReadEmbedderWorkerRegistrationOutcome as R, type EmbedderWorkerIncarnationVerdict as a, EMBEDDER_WORKER_REGISTRATION_FILE as b, EMBEDDER_WORKER_REGISTRATION_SCHEMA_VERSION as c, EMBEDDER_WORKER_REQUEST_TIMEOUT_MS as d, EMBEDDER_WORKER_START_TIMEOUT_MS as e, EMBEDDER_WORKER_TERM_GRACE_MS as f, EMBEDDER_WORKER_UNVERIFIABLE_INCARNATION as g, EmbedderWorkerTimeoutError as h, type EmbedderWorkerTimeoutPhase as i, embedderWorkerProcessIsAlive as j, embedderWorkerSocketPath as k, removeEmbedderWorkerRegistration as l, probeEmbedderWorkerSocket as p, readEmbedderWorkerRegistration as r, writeEmbedderWorkerRegistration as w };
@@ -0,0 +1,78 @@
1
+ import { z } from 'zod';
2
+
3
+ declare const EMBEDDER_WORKER_REGISTRATION_FILE = "embedder-worker.json";
4
+ declare const EMBEDDER_WORKER_REGISTRATION_SCHEMA_VERSION = 2;
5
+ /**
6
+ * What a worker records when it cannot attribute its own process.
7
+ *
8
+ * The field is required rather than optional on purpose: an absent incarnation would let a forged
9
+ * registration opt out of the check entirely. A worker that genuinely cannot resolve its own start
10
+ * time says so explicitly, and the host reads that as `unverifiable` — which withholds every
11
+ * signal, exactly as an unresolvable pid does.
12
+ */
13
+ declare const EMBEDDER_WORKER_UNVERIFIABLE_INCARNATION = "unresolved";
14
+ /** D-15 provisional request deadline; retune from daemon telemetry without adding config. */
15
+ declare const EMBEDDER_WORKER_REQUEST_TIMEOUT_MS = 30000;
16
+ /** D-15 provisional child-readiness deadline; retune from daemon telemetry without adding config. */
17
+ declare const EMBEDDER_WORKER_START_TIMEOUT_MS = 15000;
18
+ /** D-15 provisional TERM grace; retune from daemon telemetry without adding config. */
19
+ declare const EMBEDDER_WORKER_TERM_GRACE_MS = 5000;
20
+ type EmbedderWorkerTimeoutPhase = 'request' | 'start' | 'terminate';
21
+ /** A bounded worker wait expired; callers can defer by phase without parsing error text. */
22
+ declare class EmbedderWorkerTimeoutError extends Error {
23
+ readonly phase: EmbedderWorkerTimeoutPhase;
24
+ readonly timeoutMs: number;
25
+ constructor(phase: EmbedderWorkerTimeoutPhase, timeoutMs: number);
26
+ }
27
+ declare const embedderWorkerRegistrationSchema: z.ZodObject<{
28
+ schemaVersion: z.ZodLiteral<2>;
29
+ instanceId: z.ZodString;
30
+ pid: z.ZodNumber;
31
+ socketPath: z.ZodString;
32
+ profile: z.ZodObject<{
33
+ model_id: z.ZodString;
34
+ revision: z.ZodString;
35
+ dim: z.ZodNumber;
36
+ dtype: z.ZodLiteral<"q8">;
37
+ pooling: z.ZodLiteral<"mean">;
38
+ normalize: z.ZodLiteral<true>;
39
+ query_prefix: z.ZodString;
40
+ doc_prefix: z.ZodString;
41
+ backend: z.ZodEnum<{
42
+ node: "node";
43
+ static: "static";
44
+ }>;
45
+ session_options: z.ZodRecord<z.ZodString, z.ZodUnknown>;
46
+ tau_dense: z.ZodNumber;
47
+ }, z.core.$strict>;
48
+ startedAtMs: z.ZodNumber;
49
+ incarnation: z.ZodString;
50
+ }, z.core.$strict>;
51
+ type EmbedderWorkerRegistration = z.infer<typeof embedderWorkerRegistrationSchema>;
52
+ type ReadEmbedderWorkerRegistrationOutcome = {
53
+ kind: 'absent';
54
+ } | {
55
+ kind: 'malformed';
56
+ } | {
57
+ kind: 'parsed';
58
+ registration: EmbedderWorkerRegistration;
59
+ };
60
+ /** Three-valued because the third value is a refusal, never a permissive default. */
61
+ type EmbedderWorkerIncarnationVerdict = 'match' | 'mismatch' | 'unverifiable';
62
+ /** Resolve an instance-scoped UDS path without crossing conservative POSIX sun_path limits. */
63
+ declare function embedderWorkerSocketPath(agentQaRoot: string, projectRoot: string, instanceId: string): string;
64
+ declare function writeEmbedderWorkerRegistration(agentQaRoot: string, registration: EmbedderWorkerRegistration): void;
65
+ declare function readEmbedderWorkerRegistration(agentQaRoot: string): ReadEmbedderWorkerRegistrationOutcome;
66
+ /** Signal-zero liveness probe: EPERM proves existence; only ESRCH proves a stale pid. */
67
+ declare function embedderWorkerProcessIsAlive(pid: number): boolean;
68
+ interface RemoveEmbedderWorkerRegistrationOptions {
69
+ /** Test-only barrier after quarantine publication and before ownership verification. */
70
+ readonly afterQuarantine?: (quarantinePath: string) => void;
71
+ /** Focused durability seam; production uses the best-effort platform fsync helper. */
72
+ readonly fsyncDirectory?: (directory: string) => void;
73
+ }
74
+ /** Atomically quarantine and remove only the exact registration owned by the caller. */
75
+ declare function removeEmbedderWorkerRegistration(agentQaRoot: string, expected: EmbedderWorkerRegistration, options?: RemoveEmbedderWorkerRegistrationOptions): boolean;
76
+ declare function probeEmbedderWorkerSocket(socketPath: string): Promise<boolean>;
77
+
78
+ export { type EmbedderWorkerRegistration as E, type ReadEmbedderWorkerRegistrationOutcome as R, type EmbedderWorkerIncarnationVerdict as a, EMBEDDER_WORKER_REGISTRATION_FILE as b, EMBEDDER_WORKER_REGISTRATION_SCHEMA_VERSION as c, EMBEDDER_WORKER_REQUEST_TIMEOUT_MS as d, EMBEDDER_WORKER_START_TIMEOUT_MS as e, EMBEDDER_WORKER_TERM_GRACE_MS as f, EMBEDDER_WORKER_UNVERIFIABLE_INCARNATION as g, EmbedderWorkerTimeoutError as h, type EmbedderWorkerTimeoutPhase as i, embedderWorkerProcessIsAlive as j, embedderWorkerSocketPath as k, removeEmbedderWorkerRegistration as l, probeEmbedderWorkerSocket as p, readEmbedderWorkerRegistration as r, writeEmbedderWorkerRegistration as w };
package/package.json CHANGED
@@ -1,6 +1,72 @@
1
1
  {
2
2
  "name": "@vostride/agent-qa-knowledge-local",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.1",
4
+ "private": false,
5
+ "description": "StorageImplementation shell for the future local memidex knowledge store in agent-qa.",
6
+ "keywords": [
7
+ "agent-qa",
8
+ "testing",
9
+ "agent",
10
+ "ports"
11
+ ],
12
+ "license": "SEE LICENSE IN LICENSE.md",
13
+ "homepage": "https://github.com/vostride/agent-qa#readme",
14
+ "bugs": {
15
+ "url": "https://github.com/vostride/agent-qa/issues"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/vostride/agent-qa.git",
20
+ "directory": "packages/knowledge-local"
21
+ },
22
+ "engines": {
23
+ "node": ">=24"
24
+ },
25
+ "publishConfig": {
26
+ "access": "public",
27
+ "registry": "https://registry.npmjs.org/"
28
+ },
29
+ "type": "module",
30
+ "exports": {
31
+ ".": {
32
+ "types": "./dist/index.d.ts",
33
+ "import": "./dist/index.js",
34
+ "require": "./dist/index.cjs"
35
+ },
36
+ "./reader": {
37
+ "types": "./dist/reader.d.ts",
38
+ "import": "./dist/reader.js",
39
+ "require": "./dist/reader.cjs"
40
+ }
41
+ },
42
+ "files": [
43
+ "assets",
44
+ "dist",
45
+ "LICENSE.md",
46
+ "NOTICE.md"
47
+ ],
48
+ "scripts": {
49
+ "build": "tsup",
50
+ "dev": "tsup --watch",
51
+ "test": "vitest run",
52
+ "typecheck": "tsc --noEmit",
53
+ "clean": "rm -rf dist .turbo"
54
+ },
55
+ "dependencies": {
56
+ "@huggingface/tokenizers": "0.1.3",
57
+ "@huggingface/transformers": "4.2.0",
58
+ "@vostride/agent-qa-agent": "0.2.1",
59
+ "@vostride/agent-qa-runner": "0.2.1",
60
+ "@vostride/agent-qa-safety": "0.2.1",
61
+ "@vostride/agent-qa-schema": "0.2.1",
62
+ "sqlite-vec": "0.1.9",
63
+ "zod": "4.6.7"
64
+ },
65
+ "devDependencies": {
66
+ "@types/node": "~24.12.2",
67
+ "@vostride/agent-qa-arch": "0.2.1",
68
+ "tsup": "~8.5.1",
69
+ "typescript": "~6.0.3",
70
+ "vitest": "~4.1.5"
71
+ }
72
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.