plasalid 0.7.2 → 0.7.3
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/README.md +14 -14
- package/dist/accounts/taxonomy.d.ts +1 -1
- package/dist/accounts/taxonomy.js +1 -1
- package/dist/ai/agent.d.ts +5 -5
- package/dist/ai/agent.js +6 -6
- package/dist/ai/personas.d.ts +1 -1
- package/dist/ai/personas.js +14 -14
- package/dist/ai/prompt-sections.d.ts +4 -4
- package/dist/ai/prompt-sections.js +1 -1
- package/dist/ai/system-prompt.d.ts +2 -2
- package/dist/ai/system-prompt.js +4 -4
- package/dist/ai/tools/clarify.d.ts +2 -0
- package/dist/ai/tools/clarify.js +169 -0
- package/dist/ai/tools/index.js +7 -7
- package/dist/ai/tools/ingest.d.ts +1 -1
- package/dist/ai/tools/ingest.js +8 -8
- package/dist/ai/tools/read.js +1 -1
- package/dist/ai/tools/record.js +5 -5
- package/dist/ai/tools/types.d.ts +2 -2
- package/dist/cli/commands/clarify.d.ts +5 -0
- package/dist/cli/commands/clarify.js +44 -0
- package/dist/cli/commands/rules.js +1 -1
- package/dist/cli/commands/scan.js +9 -9
- package/dist/cli/commands/status.js +1 -1
- package/dist/cli/index.js +6 -6
- package/dist/cli/ink/ScanDashboard.d.ts +1 -1
- package/dist/cli/ink/ScanDashboard.js +2 -2
- package/dist/cli/setup.js +1 -1
- package/dist/cli/ux.js +1 -1
- package/dist/scanner/clarifier-memory.d.ts +8 -0
- package/dist/scanner/clarifier-memory.js +24 -0
- package/dist/scanner/clarifier.d.ts +39 -0
- package/dist/scanner/clarifier.js +196 -0
- package/dist/scanner/engine.d.ts +3 -3
- package/dist/scanner/engine.js +8 -8
- package/dist/scanner/hooks.d.ts +3 -3
- package/dist/scanner/worker.d.ts +1 -1
- package/dist/scanner/worker.js +1 -1
- package/package.json +1 -1
package/dist/scanner/engine.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createProgress } from "./progress.js";
|
|
|
3
3
|
import { decryptPhase } from "./decrypt.js";
|
|
4
4
|
import { parsePhase } from "./parse.js";
|
|
5
5
|
import { chunkPdf } from "./pdf/chunker.js";
|
|
6
|
-
import {
|
|
6
|
+
import { runClarify } from "./clarifier.js";
|
|
7
7
|
import { errorMessage } from "./result.js";
|
|
8
8
|
const chunkPhase = async (_db, state, hooks) => {
|
|
9
9
|
await hooks.beforeChunk?.(state);
|
|
@@ -11,21 +11,21 @@ const chunkPhase = async (_db, state, hooks) => {
|
|
|
11
11
|
state.chunks.push(...await chunkPdf(file));
|
|
12
12
|
await hooks.afterChunk?.(state);
|
|
13
13
|
};
|
|
14
|
-
const
|
|
15
|
-
await hooks.
|
|
16
|
-
const summary = await
|
|
14
|
+
const clarifyPhase = async (db, state, hooks) => {
|
|
15
|
+
await hooks.beforeClarify?.(state);
|
|
16
|
+
const summary = await runClarify({
|
|
17
17
|
db,
|
|
18
18
|
scanId: state.scanId,
|
|
19
19
|
interactive: state.options.interactive ?? true,
|
|
20
20
|
});
|
|
21
|
-
state.
|
|
22
|
-
await hooks.
|
|
21
|
+
state.clarifySummary = summary;
|
|
22
|
+
await hooks.afterClarify?.(state, summary);
|
|
23
23
|
};
|
|
24
24
|
export const DEFAULT_PHASES = [
|
|
25
25
|
{ name: "decrypt", phase: decryptPhase },
|
|
26
26
|
{ name: "chunk", phase: chunkPhase },
|
|
27
27
|
{ name: "parse", phase: parsePhase },
|
|
28
|
-
{ name: "
|
|
28
|
+
{ name: "clarify", phase: clarifyPhase },
|
|
29
29
|
];
|
|
30
30
|
/**
|
|
31
31
|
* Composition root. Builds the progress sink once per scan run, threads it
|
|
@@ -45,7 +45,7 @@ export async function runScan(db, opts = {}, hooks = {}) {
|
|
|
45
45
|
skipped: [],
|
|
46
46
|
failed: [],
|
|
47
47
|
chunks: [],
|
|
48
|
-
|
|
48
|
+
clarifySummary: null,
|
|
49
49
|
errors: [],
|
|
50
50
|
};
|
|
51
51
|
await fire(hooks.onStart, state);
|
package/dist/scanner/hooks.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Chunk, ScanState, PhaseName } from "./engine.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ClarifySummary } from "./clarifier.js";
|
|
3
3
|
export type MaybePromise<T> = T | Promise<T>;
|
|
4
4
|
/**
|
|
5
5
|
* Lifecycle hooks the engine fires at phase edges. CLI registers spinner/Ink
|
|
@@ -16,8 +16,8 @@ export interface ScanHooks {
|
|
|
16
16
|
onWorkerStart?(workerId: string, chunk: Chunk): void;
|
|
17
17
|
onWorkerEnd?(workerId: string, chunk: Chunk, ok: boolean): void;
|
|
18
18
|
afterParse?(s: Readonly<ScanState>): MaybePromise<void>;
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
beforeClarify?(s: Readonly<ScanState>): MaybePromise<void>;
|
|
20
|
+
afterClarify?(s: Readonly<ScanState>, summary: ClarifySummary): MaybePromise<void>;
|
|
21
21
|
onError?(err: unknown, phase: PhaseName, s: Readonly<ScanState>): MaybePromise<void>;
|
|
22
22
|
onFinish?(s: Readonly<ScanState>): MaybePromise<void>;
|
|
23
23
|
}
|
package/dist/scanner/worker.d.ts
CHANGED
|
@@ -14,6 +14,6 @@ export interface ScanWorkerDeps {
|
|
|
14
14
|
* scanId + progress sink + scanned_files row injected through the agent
|
|
15
15
|
* context. Agent's record_transactions / note_question calls write directly to
|
|
16
16
|
* the DB; per-row ticks fan out via `progress.emit`. Failures land in the DB
|
|
17
|
-
* as a `chunk_failed` question so the
|
|
17
|
+
* as a `chunk_failed` question so the clarifier can pick them up.
|
|
18
18
|
*/
|
|
19
19
|
export declare function runScanWorker(deps: ScanWorkerDeps, hooks: ScanHooks): Promise<void>;
|
package/dist/scanner/worker.js
CHANGED
|
@@ -8,7 +8,7 @@ import { tryExecute } from "./result.js";
|
|
|
8
8
|
* scanId + progress sink + scanned_files row injected through the agent
|
|
9
9
|
* context. Agent's record_transactions / note_question calls write directly to
|
|
10
10
|
* the DB; per-row ticks fan out via `progress.emit`. Failures land in the DB
|
|
11
|
-
* as a `chunk_failed` question so the
|
|
11
|
+
* as a `chunk_failed` question so the clarifier can pick them up.
|
|
12
12
|
*/
|
|
13
13
|
export async function runScanWorker(deps, hooks) {
|
|
14
14
|
const workerId = `cw:${randomUUID()}`;
|