@principles/pd-cli 1.156.1 → 1.157.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/commands/runtime-internalization-audit-artificer-evidence.d.ts +44 -0
- package/dist/commands/runtime-internalization-audit-artificer-evidence.d.ts.map +1 -0
- package/dist/commands/runtime-internalization-audit-artificer-evidence.js +138 -0
- package/dist/commands/runtime-internalization-audit-artificer-evidence.js.map +1 -0
- package/dist/commands/runtime-internalization-evidence.d.ts +72 -0
- package/dist/commands/runtime-internalization-evidence.d.ts.map +1 -0
- package/dist/commands/runtime-internalization-evidence.js +424 -0
- package/dist/commands/runtime-internalization-evidence.js.map +1 -0
- package/dist/commands/runtime-internalization-run-once.d.ts.map +1 -1
- package/dist/commands/runtime-internalization-run-once.js +22 -1
- package/dist/commands/runtime-internalization-run-once.js.map +1 -1
- package/dist/commands/runtime-internalization-run-rulehost.d.ts.map +1 -1
- package/dist/commands/runtime-internalization-run-rulehost.js +45 -4
- package/dist/commands/runtime-internalization-run-rulehost.js.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/services/artificer-evidence-audit.d.ts +156 -0
- package/dist/services/artificer-evidence-audit.d.ts.map +1 -0
- package/dist/services/artificer-evidence-audit.js +321 -0
- package/dist/services/artificer-evidence-audit.js.map +1 -0
- package/dist/services/rulehost-pipeline-runner.d.ts.map +1 -1
- package/dist/services/rulehost-pipeline-runner.js +17 -3
- package/dist/services/rulehost-pipeline-runner.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pd runtime internalization audit-artificer-evidence — read-only history audit
|
|
3
|
+
* (SPEC-PD-IAER-001 FR-09, T11, AC-10; PRI-985).
|
|
4
|
+
*
|
|
5
|
+
* Scans the workspace runtime state DB for runs that failed with the
|
|
6
|
+
* `behavior_example_pack_missing` signature (runtime kinds `pi-ai-l2` AND
|
|
7
|
+
* `pi-ai`), aggregates them BY TASK ID (production evidence: ~385 runs across
|
|
8
|
+
* ~82 tasks — runs are not tasks), and reports four anomaly markers per task
|
|
9
|
+
* plus a summary. This command is read-only BY CONSTRUCTION:
|
|
10
|
+
*
|
|
11
|
+
* - the DB is opened with `readonly: true, bootstrapIfMissing: false`
|
|
12
|
+
* (ERR-023 precedent from runtime-artifact-repair.ts) — a missing state.db
|
|
13
|
+
* is a structured refusal, never a fresh workspace;
|
|
14
|
+
* - no --confirm exists and no write path exists in this file (cli-4 moot:
|
|
15
|
+
* there is nothing to confirm; cli-5: failure paths mutate nothing);
|
|
16
|
+
* - no recovery/reschedule is performed here (that is the FR-09 B-side,
|
|
17
|
+
* handled by the existing retry / failed-tasks recovery entries).
|
|
18
|
+
*
|
|
19
|
+
* CLI contract (EP-04): `--json` prints exactly one parseable JSON object on
|
|
20
|
+
* stdout (cli-1); no matching data is a structured EMPTY result with a
|
|
21
|
+
* nextAction, not an error; a missing/unreadable DB or missing tables is a
|
|
22
|
+
* structured refusal with exit code 1 (cli-2/cli-6).
|
|
23
|
+
*/
|
|
24
|
+
import type { Command } from 'commander';
|
|
25
|
+
import { type ArtificerEvidenceAuditReport } from '../services/artificer-evidence-audit.js';
|
|
26
|
+
export interface AuditArtificerEvidenceOptions {
|
|
27
|
+
workspace?: string;
|
|
28
|
+
json?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface AuditArtificerEvidenceOutput {
|
|
31
|
+
ok: boolean;
|
|
32
|
+
mode: 'read_only_audit';
|
|
33
|
+
workspace: string;
|
|
34
|
+
status: 'complete' | 'empty' | 'failed';
|
|
35
|
+
summary?: ArtificerEvidenceAuditReport['summary'];
|
|
36
|
+
tasks?: ArtificerEvidenceAuditReport['tasks'];
|
|
37
|
+
governanceDetection?: string;
|
|
38
|
+
reason?: string;
|
|
39
|
+
nextAction?: string;
|
|
40
|
+
}
|
|
41
|
+
export declare function handleRuntimeInternalizationAuditArtificerEvidence(opts: AuditArtificerEvidenceOptions): Promise<void>;
|
|
42
|
+
/** Register the production `pd runtime internalization audit-artificer-evidence` command. */
|
|
43
|
+
export declare function registerRuntimeInternalizationAuditArtificerEvidenceCommand(internalizationCmd: Command, handler?: (opts: AuditArtificerEvidenceOptions) => Promise<void>): Command;
|
|
44
|
+
//# sourceMappingURL=runtime-internalization-audit-artificer-evidence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-internalization-audit-artificer-evidence.d.ts","sourceRoot":"","sources":["../../src/commands/runtime-internalization-audit-artificer-evidence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,OAAO,EAGL,KAAK,4BAA4B,EAClC,MAAM,yCAAyC,CAAC;AAEjD,MAAM,WAAW,6BAA6B;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,4BAA4B;IAC3C,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE,iBAAiB,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,UAAU,GAAG,OAAO,GAAG,QAAQ,CAAC;IACxC,OAAO,CAAC,EAAE,4BAA4B,CAAC,SAAS,CAAC,CAAC;IAClD,KAAK,CAAC,EAAE,4BAA4B,CAAC,OAAO,CAAC,CAAC;IAC9C,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AA6CD,wBAAsB,kDAAkD,CAAC,IAAI,EAAE,6BAA6B,GAAG,OAAO,CAAC,IAAI,CAAC,CAwD3H;AAED,6FAA6F;AAC7F,wBAAgB,2DAA2D,CACzE,kBAAkB,EAAE,OAAO,EAC3B,OAAO,GAAE,CAAC,IAAI,EAAE,6BAA6B,KAAK,OAAO,CAAC,IAAI,CAAsD,GACnH,OAAO,CAST"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pd runtime internalization audit-artificer-evidence — read-only history audit
|
|
3
|
+
* (SPEC-PD-IAER-001 FR-09, T11, AC-10; PRI-985).
|
|
4
|
+
*
|
|
5
|
+
* Scans the workspace runtime state DB for runs that failed with the
|
|
6
|
+
* `behavior_example_pack_missing` signature (runtime kinds `pi-ai-l2` AND
|
|
7
|
+
* `pi-ai`), aggregates them BY TASK ID (production evidence: ~385 runs across
|
|
8
|
+
* ~82 tasks — runs are not tasks), and reports four anomaly markers per task
|
|
9
|
+
* plus a summary. This command is read-only BY CONSTRUCTION:
|
|
10
|
+
*
|
|
11
|
+
* - the DB is opened with `readonly: true, bootstrapIfMissing: false`
|
|
12
|
+
* (ERR-023 precedent from runtime-artifact-repair.ts) — a missing state.db
|
|
13
|
+
* is a structured refusal, never a fresh workspace;
|
|
14
|
+
* - no --confirm exists and no write path exists in this file (cli-4 moot:
|
|
15
|
+
* there is nothing to confirm; cli-5: failure paths mutate nothing);
|
|
16
|
+
* - no recovery/reschedule is performed here (that is the FR-09 B-side,
|
|
17
|
+
* handled by the existing retry / failed-tasks recovery entries).
|
|
18
|
+
*
|
|
19
|
+
* CLI contract (EP-04): `--json` prints exactly one parseable JSON object on
|
|
20
|
+
* stdout (cli-1); no matching data is a structured EMPTY result with a
|
|
21
|
+
* nextAction, not an error; a missing/unreadable DB or missing tables is a
|
|
22
|
+
* structured refusal with exit code 1 (cli-2/cli-6).
|
|
23
|
+
*/
|
|
24
|
+
import * as path from 'path';
|
|
25
|
+
import { SqliteConnection } from '@principles/core/runtime-v2';
|
|
26
|
+
import { resolveWorkspaceDir } from '../resolve-workspace.js';
|
|
27
|
+
import { aggregateArtificerEvidenceRuns, loadArtificerEvidenceAuditInputs, } from '../services/artificer-evidence-audit.js';
|
|
28
|
+
function emit(out, json) {
|
|
29
|
+
if (json) {
|
|
30
|
+
// cli-1-strict-json: exactly one parseable JSON object on stdout.
|
|
31
|
+
console.log(JSON.stringify(out, null, 2));
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
console.log(`Artificer Evidence Audit (${out.mode}) — ${out.workspace}`);
|
|
35
|
+
if (out.status === 'failed') {
|
|
36
|
+
console.log(` status: failed`);
|
|
37
|
+
console.log(` reason: ${out.reason ?? 'unknown'}`);
|
|
38
|
+
console.log(` nextAction: ${out.nextAction ?? ''}`);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const s = out.summary;
|
|
42
|
+
console.log(` status: ${out.status}`);
|
|
43
|
+
console.log(` pack-missing runs: ${s?.totalRuns ?? 0}`);
|
|
44
|
+
console.log(` distinct tasks: ${s?.distinctTasks ?? 0}`);
|
|
45
|
+
console.log(` by runtime kind: ${Object.entries(s?.byRuntimeKind ?? {}).map(([k, v]) => `${k}=${v}`).join(', ') || '-'}`);
|
|
46
|
+
console.log(` by final status: ${Object.entries(s?.byFinalTaskStatus ?? {}).map(([k, v]) => `${k}=${v}`).join(', ') || '-'}`);
|
|
47
|
+
console.log(` anomalies: repeatedRetry=${s?.anomalyCounts.repeatedRetryConsumption ?? 0}, succeededArtifactThenFailed=${s?.anomalyCounts.succeededArtifactThenFailed ?? 0}, governanceSideEffects=${s?.anomalyCounts.hasGovernanceSideEffects ?? 0} (detection: ${out.governanceDetection ?? 'unknown'})`);
|
|
48
|
+
console.log(` nextAction: ${out.nextAction ?? ''}`);
|
|
49
|
+
const tasks = out.tasks ?? [];
|
|
50
|
+
if (tasks.length > 0) {
|
|
51
|
+
console.log('');
|
|
52
|
+
console.log('Tasks (oldest first):');
|
|
53
|
+
for (const t of tasks) {
|
|
54
|
+
console.log(` - ${t.taskId}`);
|
|
55
|
+
console.log(` taskKind: ${t.taskKind ?? '-'}`);
|
|
56
|
+
console.log(` status: ${t.taskStatus ?? 'unknown (no task row)'}${t.attemptCount !== null ? ` (${t.attemptCount}/${t.maxAttempts} attempts)` : ''}`);
|
|
57
|
+
console.log(` runs: ${t.runCount}${Object.keys(t.failureCategories).length > 0 ? ` [${Object.entries(t.failureCategories).map(([k, v]) => `${k}=${v}`).join(', ')}]` : ''}`);
|
|
58
|
+
console.log(` window: ${t.firstFailureAt} .. ${t.lastFailureAt}`);
|
|
59
|
+
const flags = [
|
|
60
|
+
t.anomalies.repeatedRetryConsumption ? 'repeated_retry_consumption' : null,
|
|
61
|
+
t.anomalies.succeededArtifactThenFailed ? 'succeeded_artifact_then_failed' : null,
|
|
62
|
+
t.anomalies.hasGovernanceSideEffects ? 'has_governance_side_effects' : null,
|
|
63
|
+
t.anomalies.packMissingFailure ? 'pack_missing_failure' : null,
|
|
64
|
+
].filter((f) => f !== null);
|
|
65
|
+
console.log(` anomalies: ${flags.length > 0 ? flags.join(', ') : '(none)'}`);
|
|
66
|
+
console.log(` nextAction: ${t.nextAction}`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export async function handleRuntimeInternalizationAuditArtificerEvidence(opts) {
|
|
71
|
+
// Resolution runs inside the try so an unresolvable default workspace is
|
|
72
|
+
// also a structured refusal (cli-6); if resolution itself fails, the
|
|
73
|
+
// refusal reports the raw --workspace value, when one was given.
|
|
74
|
+
let resolvedWorkspace = null;
|
|
75
|
+
let conn = null;
|
|
76
|
+
try {
|
|
77
|
+
const workspaceDir = path.resolve(resolveWorkspaceDir(opts.workspace));
|
|
78
|
+
resolvedWorkspace = workspaceDir;
|
|
79
|
+
// ERR-023 precedent: read-only audit opens the DB readonly and must not
|
|
80
|
+
// bootstrap an empty state.db — a missing state.db is a refusal.
|
|
81
|
+
conn = new SqliteConnection({ workspaceDir, readonly: true, bootstrapIfMissing: false });
|
|
82
|
+
const db = conn.getDb();
|
|
83
|
+
const inputs = loadArtificerEvidenceAuditInputs(db);
|
|
84
|
+
const report = aggregateArtificerEvidenceRuns(inputs);
|
|
85
|
+
const empty = report.summary.distinctTasks === 0;
|
|
86
|
+
const out = {
|
|
87
|
+
ok: true,
|
|
88
|
+
mode: 'read_only_audit',
|
|
89
|
+
workspace: workspaceDir,
|
|
90
|
+
status: empty ? 'empty' : 'complete',
|
|
91
|
+
summary: report.summary,
|
|
92
|
+
tasks: report.tasks,
|
|
93
|
+
governanceDetection: report.governanceDetection,
|
|
94
|
+
reason: empty
|
|
95
|
+
? 'No runs match the behavior_example_pack_missing signature for runtime kinds pi-ai-l2/pi-ai'
|
|
96
|
+
: undefined,
|
|
97
|
+
nextAction: empty
|
|
98
|
+
? 'Nothing to audit. If a failure is expected, verify the workspace path: this audit scans <workspace>/.pd/state.db'
|
|
99
|
+
: report.summary.anomalyCounts.packMissingFailure > 0
|
|
100
|
+
? 'Read-only result — nothing was modified. Recovery is per-task and Owner-driven: attach evidence via the recovery entry (PRI-983), then use the per-task nextAction (pd runtime internalization retry --confirm for needs_human_review, pd runtime recovery failed-tasks --confirm for failed).'
|
|
101
|
+
: 'Read-only result — nothing was modified.',
|
|
102
|
+
};
|
|
103
|
+
emit(out, opts.json);
|
|
104
|
+
}
|
|
105
|
+
catch (err) {
|
|
106
|
+
// Structured refusal (cli-6): reason + nextAction, exit 1, no repair attempts.
|
|
107
|
+
const out = {
|
|
108
|
+
ok: false,
|
|
109
|
+
mode: 'read_only_audit',
|
|
110
|
+
workspace: resolvedWorkspace ?? opts.workspace ?? '(workspace unresolved)',
|
|
111
|
+
status: 'failed',
|
|
112
|
+
reason: err instanceof Error ? err.message : String(err),
|
|
113
|
+
nextAction: 'Verify --workspace points at a workspace with an initialized .pd/state.db (pd runtime init), then retry. This audit does not create or repair databases.',
|
|
114
|
+
};
|
|
115
|
+
emit(out, opts.json);
|
|
116
|
+
process.exitCode = 1;
|
|
117
|
+
}
|
|
118
|
+
finally {
|
|
119
|
+
try {
|
|
120
|
+
conn?.close();
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
// best-effort close of a read-only handle; the report is already emitted
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/** Register the production `pd runtime internalization audit-artificer-evidence` command. */
|
|
128
|
+
export function registerRuntimeInternalizationAuditArtificerEvidenceCommand(internalizationCmd, handler = handleRuntimeInternalizationAuditArtificerEvidence) {
|
|
129
|
+
return internalizationCmd
|
|
130
|
+
.command('audit-artificer-evidence')
|
|
131
|
+
.description('Read-only history audit: aggregate behavior_example_pack_missing failures by task (FR-09)')
|
|
132
|
+
.option('-w, --workspace <path>', 'Workspace directory')
|
|
133
|
+
.option('--json', 'Output as JSON')
|
|
134
|
+
.action(async (opts) => {
|
|
135
|
+
await handler(opts);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=runtime-internalization-audit-artificer-evidence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-internalization-audit-artificer-evidence.js","sourceRoot":"","sources":["../../src/commands/runtime-internalization-audit-artificer-evidence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EACL,8BAA8B,EAC9B,gCAAgC,GAEjC,MAAM,yCAAyC,CAAC;AAmBjD,SAAS,IAAI,CAAC,GAAiC,EAAE,IAAc;IAC7D,IAAI,IAAI,EAAE,CAAC;QACT,kEAAkE;QAClE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC1C,OAAO;IACT,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,6BAA6B,GAAG,CAAC,IAAI,OAAO,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC;IACzE,IAAI,GAAG,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAA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C,CAAC,MAAM,CAAC,GAAG,CAAC;YACxD,UAAU,EAAE,0JAA0J;SACvK,CAAC;QACF,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACrB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;YAAS,CAAC;QACT,IAAI,CAAC;YACH,IAAI,EAAE,KAAK,EAAE,CAAC;QAChB,CAAC;QAAC,MAAM,CAAC;YACP,yEAAyE;QAC3E,CAAC;IACH,CAAC;AACH,CAAC;AAED,6FAA6F;AAC7F,MAAM,UAAU,2DAA2D,CACzE,kBAA2B,EAC3B,OAAO,GAA2D,kDAAkD;IAEpH,OAAO,kBAAkB;SACtB,OAAO,CAAC,0BAA0B,CAAC;SACnC,WAAW,CAAC,2FAA2F,CAAC;SACxG,MAAM,CAAC,wBAAwB,EAAE,qBAAqB,CAAC;SACvD,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;SAClC,MAAM,CAAC,KAAK,EAAE,IAAmC,EAAE,EAAE;QACpD,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pd runtime internalization evidence — Owner evidence attach/resume (B1).
|
|
3
|
+
*
|
|
4
|
+
* SPEC-PD-IAER-001 FR-03/FR-06 (PRI-983): the Owner recovery entry for
|
|
5
|
+
* Artificer tasks blocked on evidence (needs_human_review + a stable FR-04
|
|
6
|
+
* evidence reasonCode). Three subcommands, ALL default dry-run; `--confirm`
|
|
7
|
+
* performs the mutation (cli-4):
|
|
8
|
+
*
|
|
9
|
+
* evidence list --workspace <dir> [--json]
|
|
10
|
+
* Read-only: tasks waiting for Owner evidence with pain linkage,
|
|
11
|
+
* missing fields and the concrete next action (FR-06 1/2).
|
|
12
|
+
*
|
|
13
|
+
* evidence attach --task <id> --pain <painId> --negative <id>
|
|
14
|
+
* --positive <id>... --outcome <text>
|
|
15
|
+
* [--decidedBy <label>] [--json] [--confirm]
|
|
16
|
+
* Assembles the labelled examples through the production assembler
|
|
17
|
+
* (same chain as run-rulehost), and on --confirm persists the
|
|
18
|
+
* digest-verified selection into pi_metadata via CAS. The task STAYS
|
|
19
|
+
* needs_human_review — attach never unblocks (FR-06 6).
|
|
20
|
+
*
|
|
21
|
+
* evidence resume --task <id> [--decidedBy <label>] [--json] [--confirm]
|
|
22
|
+
* Re-assembles, verifies the stored contentDigest, and on --confirm
|
|
23
|
+
* performs the ATOMIC authority reset through the single recovery
|
|
24
|
+
* authority (ownerRetryNeedsHumanReviewTask, CAS precondition) — at
|
|
25
|
+
* most one concurrent resume wins (FR-06 7, §6.3, T06).
|
|
26
|
+
*
|
|
27
|
+
* Authorization expression (repo reality — no owner authentication exists):
|
|
28
|
+
* explicit --confirm + decidedBy label + append-only audit
|
|
29
|
+
* (.state/recovery_actions.jsonl) + revision/contentDigest provenance.
|
|
30
|
+
*
|
|
31
|
+
* CLI contract: --json prints exactly ONE parseable JSON object (cli-1);
|
|
32
|
+
* refusal paths set exit 1 with stable reason + nextAction and mutate
|
|
33
|
+
* nothing (cli-2/cli-5/cli-6). No V1 fallback exists on any path (PRI-780).
|
|
34
|
+
* No new feature flag: rollback = git revert (mvp-q-3).
|
|
35
|
+
*
|
|
36
|
+
* Lazy plugin import: `principles-disciple/rulehost-evidence` is loaded only
|
|
37
|
+
* when an attach/resume actually needs assembly — same rationale as
|
|
38
|
+
* run-rulehost (pd --version must not pull the plugin bundle).
|
|
39
|
+
*/
|
|
40
|
+
import type { Command } from 'commander';
|
|
41
|
+
export interface EvidenceListOptions {
|
|
42
|
+
workspace?: string;
|
|
43
|
+
json?: boolean;
|
|
44
|
+
}
|
|
45
|
+
export declare function handleRuntimeInternalizationEvidenceList(opts: EvidenceListOptions): Promise<void>;
|
|
46
|
+
export interface EvidenceAttachOptions {
|
|
47
|
+
workspace?: string;
|
|
48
|
+
task?: string;
|
|
49
|
+
pain?: string;
|
|
50
|
+
negative?: number;
|
|
51
|
+
positive?: string[];
|
|
52
|
+
outcome?: string;
|
|
53
|
+
decidedBy?: string;
|
|
54
|
+
json?: boolean;
|
|
55
|
+
confirm?: boolean;
|
|
56
|
+
}
|
|
57
|
+
export declare function handleRuntimeInternalizationEvidenceAttach(opts: EvidenceAttachOptions): Promise<void>;
|
|
58
|
+
export interface EvidenceResumeOptions {
|
|
59
|
+
workspace?: string;
|
|
60
|
+
task?: string;
|
|
61
|
+
decidedBy?: string;
|
|
62
|
+
json?: boolean;
|
|
63
|
+
confirm?: boolean;
|
|
64
|
+
}
|
|
65
|
+
export declare function handleRuntimeInternalizationEvidenceResume(opts: EvidenceResumeOptions): Promise<void>;
|
|
66
|
+
/** Register `pd runtime internalization evidence list|attach|resume`. */
|
|
67
|
+
export declare function registerRuntimeInternalizationEvidenceCommand(internalizationCmd: Command, handlers?: {
|
|
68
|
+
list?: typeof handleRuntimeInternalizationEvidenceList;
|
|
69
|
+
attach?: typeof handleRuntimeInternalizationEvidenceAttach;
|
|
70
|
+
resume?: typeof handleRuntimeInternalizationEvidenceResume;
|
|
71
|
+
}): Command;
|
|
72
|
+
//# sourceMappingURL=runtime-internalization-evidence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-internalization-evidence.d.ts","sourceRoot":"","sources":["../../src/commands/runtime-internalization-evidence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgFzC,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAsB,wCAAwC,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqDvG;AAID,MAAM,WAAW,qBAAqB;IACpC,SAAS,CAAC,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