@ngockhoale/ckit 0.0.0-stage → 0.1.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/.env.example +42 -0
- package/README.md +116 -2
- package/dist/src/adapters/agent/claude/errors.d.ts +13 -0
- package/dist/src/adapters/agent/claude/errors.js +16 -0
- package/dist/src/adapters/agent/claude/normalize.d.ts +11 -0
- package/dist/src/adapters/agent/claude/normalize.js +83 -0
- package/dist/src/adapters/agent/errors.d.ts +13 -0
- package/dist/src/adapters/agent/errors.js +19 -0
- package/dist/src/adapters/agent/fixtures/claude-transcript.d.ts +70 -0
- package/dist/src/adapters/agent/fixtures/claude-transcript.js +15 -0
- package/dist/src/adapters/agent/fixtures/omp-transcript.d.ts +60 -0
- package/dist/src/adapters/agent/fixtures/omp-transcript.js +14 -0
- package/dist/src/adapters/agent/normalize.d.ts +18 -0
- package/dist/src/adapters/agent/normalize.js +77 -0
- package/dist/src/adapters/agent/transport.d.ts +35 -0
- package/dist/src/adapters/agent/transport.js +39 -0
- package/dist/src/adapters/agent/worker-service.d.ts +49 -0
- package/dist/src/adapters/agent/worker-service.js +77 -0
- package/dist/src/adapters/fake/fake-advisor.d.ts +15 -0
- package/dist/src/adapters/fake/fake-advisor.js +29 -0
- package/dist/src/adapters/fake/fake-agent.d.ts +12 -0
- package/dist/src/adapters/fake/fake-agent.js +21 -0
- package/dist/src/adapters/fake/fake-store.d.ts +13 -0
- package/dist/src/adapters/fake/fake-store.js +23 -0
- package/dist/src/adapters/fake/fake-web.d.ts +12 -0
- package/dist/src/adapters/fake/fake-web.js +21 -0
- package/dist/src/adapters/fake/fault-injector.d.ts +18 -0
- package/dist/src/adapters/fake/fault-injector.js +64 -0
- package/dist/src/adapters/fake/virtual-clock.d.ts +12 -0
- package/dist/src/adapters/fake/virtual-clock.js +35 -0
- package/dist/src/adapters/launch/discover.d.ts +18 -0
- package/dist/src/adapters/launch/discover.js +55 -0
- package/dist/src/adapters/launch/executor.d.ts +117 -0
- package/dist/src/adapters/launch/executor.js +383 -0
- package/dist/src/adapters/launch/profile.d.ts +35 -0
- package/dist/src/adapters/launch/profile.js +73 -0
- package/dist/src/adapters/launch/spawn.d.ts +29 -0
- package/dist/src/adapters/launch/spawn.js +18 -0
- package/dist/src/adapters/openai/openai-advisor.d.ts +56 -0
- package/dist/src/adapters/openai/openai-advisor.js +146 -0
- package/dist/src/cli/ckit.d.ts +5 -0
- package/dist/src/cli/ckit.js +472 -0
- package/dist/src/cli/demo.d.ts +1 -0
- package/dist/src/cli/demo.js +30 -0
- package/dist/src/cli/sessions.d.ts +10 -0
- package/dist/src/cli/sessions.js +381 -0
- package/dist/src/cli/setup.d.ts +11 -0
- package/dist/src/cli/setup.js +115 -0
- package/dist/src/committee/decision.d.ts +84 -0
- package/dist/src/committee/decision.js +167 -0
- package/dist/src/committee/handover.d.ts +115 -0
- package/dist/src/committee/handover.js +191 -0
- package/dist/src/committee/no-progress.d.ts +44 -0
- package/dist/src/committee/no-progress.js +64 -0
- package/dist/src/committee/primary-registry.d.ts +15 -0
- package/dist/src/committee/primary-registry.js +60 -0
- package/dist/src/committee/reply-parser.d.ts +28 -0
- package/dist/src/committee/reply-parser.js +53 -0
- package/dist/src/committee/reviewer-scheduler.d.ts +101 -0
- package/dist/src/committee/reviewer-scheduler.js +163 -0
- package/dist/src/committee/role-epoch.d.ts +91 -0
- package/dist/src/committee/role-epoch.js +154 -0
- package/dist/src/core/control.d.ts +18 -0
- package/dist/src/core/control.js +29 -0
- package/dist/src/core/entities.d.ts +166 -0
- package/dist/src/core/entities.js +119 -0
- package/dist/src/core/errors.d.ts +9 -0
- package/dist/src/core/errors.js +17 -0
- package/dist/src/core/events.d.ts +72 -0
- package/dist/src/core/events.js +125 -0
- package/dist/src/core/ids.d.ts +47 -0
- package/dist/src/core/ids.js +32 -0
- package/dist/src/core/machine.d.ts +55 -0
- package/dist/src/core/machine.js +110 -0
- package/dist/src/core/policy.d.ts +34 -0
- package/dist/src/core/policy.js +59 -0
- package/dist/src/core/provenance.d.ts +20 -0
- package/dist/src/core/provenance.js +21 -0
- package/dist/src/core/record.d.ts +35 -0
- package/dist/src/core/record.js +67 -0
- package/dist/src/core/replay.d.ts +10 -0
- package/dist/src/core/replay.js +36 -0
- package/dist/src/core/run-task.d.ts +20 -0
- package/dist/src/core/run-task.js +48 -0
- package/dist/src/diagnostics/doctor.d.ts +78 -0
- package/dist/src/diagnostics/doctor.js +365 -0
- package/dist/src/diagnostics/journal-lock.d.ts +38 -0
- package/dist/src/diagnostics/journal-lock.js +181 -0
- package/dist/src/evidence/linker.d.ts +44 -0
- package/dist/src/evidence/linker.js +75 -0
- package/dist/src/evidence/report-parser.d.ts +27 -0
- package/dist/src/evidence/report-parser.js +17 -0
- package/dist/src/evidence/store.d.ts +36 -0
- package/dist/src/evidence/store.js +57 -0
- package/dist/src/gui/server.d.ts +27 -0
- package/dist/src/gui/server.js +497 -0
- package/dist/src/host/checkpoint.d.ts +22 -0
- package/dist/src/host/checkpoint.js +74 -0
- package/dist/src/host/export.d.ts +52 -0
- package/dist/src/host/export.js +45 -0
- package/dist/src/host/ipc.d.ts +57 -0
- package/dist/src/host/ipc.js +124 -0
- package/dist/src/host/leases.d.ts +27 -0
- package/dist/src/host/leases.js +40 -0
- package/dist/src/host/retention.d.ts +47 -0
- package/dist/src/host/retention.js +130 -0
- package/dist/src/host/supervisor.d.ts +59 -0
- package/dist/src/host/supervisor.js +64 -0
- package/dist/src/intake/owner-intake.d.ts +31 -0
- package/dist/src/intake/owner-intake.js +97 -0
- package/dist/src/intake/types.d.ts +46 -0
- package/dist/src/intake/types.js +2 -0
- package/dist/src/intent/context-packet.d.ts +68 -0
- package/dist/src/intent/context-packet.js +76 -0
- package/dist/src/intent/idea-ledger.d.ts +50 -0
- package/dist/src/intent/idea-ledger.js +136 -0
- package/dist/src/intent/ledger.d.ts +35 -0
- package/dist/src/intent/ledger.js +40 -0
- package/dist/src/intent/registry.d.ts +51 -0
- package/dist/src/intent/registry.js +44 -0
- package/dist/src/intent/revision.d.ts +37 -0
- package/dist/src/intent/revision.js +48 -0
- package/dist/src/orchestration/dispatcher.d.ts +32 -0
- package/dist/src/orchestration/dispatcher.js +136 -0
- package/dist/src/orchestration/milestone-loop.d.ts +149 -0
- package/dist/src/orchestration/milestone-loop.js +132 -0
- package/dist/src/orchestration/recovery-coordinator.d.ts +74 -0
- package/dist/src/orchestration/recovery-coordinator.js +180 -0
- package/dist/src/orchestration/work-order-contract.d.ts +44 -0
- package/dist/src/orchestration/work-order-contract.js +85 -0
- package/dist/src/orchestration/work-queue.d.ts +56 -0
- package/dist/src/orchestration/work-queue.js +95 -0
- package/dist/src/ports/advisor.d.ts +33 -0
- package/dist/src/ports/advisor.js +2 -0
- package/dist/src/ports/agent.d.ts +31 -0
- package/dist/src/ports/agent.js +2 -0
- package/dist/src/ports/capabilities.d.ts +3 -0
- package/dist/src/ports/capabilities.js +5 -0
- package/dist/src/ports/clock.d.ts +5 -0
- package/dist/src/ports/clock.js +5 -0
- package/dist/src/ports/store.d.ts +13 -0
- package/dist/src/ports/store.js +2 -0
- package/dist/src/ports/web.d.ts +29 -0
- package/dist/src/ports/web.js +2 -0
- package/dist/src/run/api-run.d.ts +49 -0
- package/dist/src/run/api-run.js +173 -0
- package/dist/src/run/plan-run.d.ts +22 -0
- package/dist/src/run/plan-run.js +233 -0
- package/dist/src/run/plan.d.ts +36 -0
- package/dist/src/run/plan.js +119 -0
- package/dist/src/run/verify.d.ts +25 -0
- package/dist/src/run/verify.js +81 -0
- package/dist/src/security/redact.d.ts +7 -0
- package/dist/src/security/redact.js +21 -0
- package/dist/src/settings/env-config.d.ts +64 -0
- package/dist/src/settings/env-config.js +232 -0
- package/dist/src/storage/artifacts.d.ts +30 -0
- package/dist/src/storage/artifacts.js +105 -0
- package/dist/src/storage/audit.d.ts +6 -0
- package/dist/src/storage/audit.js +6 -0
- package/dist/src/storage/db.d.ts +9 -0
- package/dist/src/storage/db.js +43 -0
- package/dist/src/storage/events.d.ts +20 -0
- package/dist/src/storage/events.js +69 -0
- package/dist/src/storage/migrations.d.ts +8 -0
- package/dist/src/storage/migrations.js +48 -0
- package/dist/src/storage/outbox.d.ts +25 -0
- package/dist/src/storage/outbox.js +40 -0
- package/dist/src/storage/projections.d.ts +18 -0
- package/dist/src/storage/projections.js +40 -0
- package/dist/src/storage/reconcile.d.ts +14 -0
- package/dist/src/storage/reconcile.js +93 -0
- package/dist/src/storage/reservations.d.ts +12 -0
- package/dist/src/storage/reservations.js +80 -0
- package/dist/src/storage/store.d.ts +34 -0
- package/dist/src/storage/store.js +105 -0
- package/dist/src/team/attachments.d.ts +22 -0
- package/dist/src/team/attachments.js +211 -0
- package/dist/src/team/cli-models.d.ts +24 -0
- package/dist/src/team/cli-models.js +72 -0
- package/dist/src/team/config.d.ts +20 -0
- package/dist/src/team/config.js +111 -0
- package/dist/src/team/engine.d.ts +28 -0
- package/dist/src/team/engine.js +443 -0
- package/dist/src/team/journal.d.ts +30 -0
- package/dist/src/team/journal.js +70 -0
- package/dist/src/team/runners.d.ts +79 -0
- package/dist/src/team/runners.js +436 -0
- package/dist/src/team/secrets.d.ts +10 -0
- package/dist/src/team/secrets.js +68 -0
- package/dist/src/team/types.d.ts +155 -0
- package/dist/src/team/types.js +5 -0
- package/dist/src/tui/app.d.ts +29 -0
- package/dist/src/tui/app.js +96 -0
- package/dist/src/tui/control-model.d.ts +101 -0
- package/dist/src/tui/control-model.js +109 -0
- package/dist/src/tui/control-screens.d.ts +27 -0
- package/dist/src/tui/control-screens.js +85 -0
- package/dist/src/tui/graph-model.d.ts +34 -0
- package/dist/src/tui/graph-model.js +29 -0
- package/dist/src/tui/graph-screens.d.ts +13 -0
- package/dist/src/tui/graph-screens.js +4 -0
- package/dist/src/tui/inspector-model.d.ts +150 -0
- package/dist/src/tui/inspector-model.js +15 -0
- package/dist/src/tui/inspector-screens.d.ts +14 -0
- package/dist/src/tui/inspector-screens.js +61 -0
- package/dist/src/tui/live.d.ts +16 -0
- package/dist/src/tui/live.js +39 -0
- package/dist/src/tui/mission-action-screens.d.ts +15 -0
- package/dist/src/tui/mission-action-screens.js +105 -0
- package/dist/src/tui/mission-actions.d.ts +46 -0
- package/dist/src/tui/mission-actions.js +53 -0
- package/dist/src/tui/mission-model.d.ts +120 -0
- package/dist/src/tui/mission-model.js +164 -0
- package/dist/src/tui/mission-nav.d.ts +82 -0
- package/dist/src/tui/mission-nav.js +131 -0
- package/dist/src/tui/mission-plan-screens.d.ts +11 -0
- package/dist/src/tui/mission-plan-screens.js +40 -0
- package/dist/src/tui/mission-plan.d.ts +45 -0
- package/dist/src/tui/mission-plan.js +166 -0
- package/dist/src/tui/mission-screens.d.ts +7 -0
- package/dist/src/tui/mission-screens.js +263 -0
- package/dist/src/tui/provenance-label.d.ts +11 -0
- package/dist/src/tui/provenance-label.js +16 -0
- package/dist/src/tui/screens.d.ts +10 -0
- package/dist/src/tui/screens.js +34 -0
- package/dist/src/tui/session-outcome.d.ts +14 -0
- package/dist/src/tui/session-outcome.js +57 -0
- package/dist/src/tui/setup-model.d.ts +159 -0
- package/dist/src/tui/setup-model.js +234 -0
- package/dist/src/tui/setup-screens.d.ts +66 -0
- package/dist/src/tui/setup-screens.js +72 -0
- package/dist/src/tui/team/app.d.ts +24 -0
- package/dist/src/tui/team/app.js +228 -0
- package/dist/src/tui/team/demo-handle.d.ts +22 -0
- package/dist/src/tui/team/demo-handle.js +42 -0
- package/dist/src/tui/team/model.d.ts +81 -0
- package/dist/src/tui/team/model.js +133 -0
- package/gui/app.css +177 -0
- package/gui/app.js +675 -0
- package/gui/index.html +51 -0
- package/gui/network.js +413 -0
- package/package.json +45 -4
- package/src/storage/schema.sql +42 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { EvidenceStore } from './store.js';
|
|
2
|
+
const LEVEL = { reported: 0, observed: 1, verified: 2 };
|
|
3
|
+
export class EvidenceLinker {
|
|
4
|
+
evidence;
|
|
5
|
+
criteria = new Map();
|
|
6
|
+
links = new Map();
|
|
7
|
+
justifications = new Map();
|
|
8
|
+
escalations = [];
|
|
9
|
+
constructor(evidence) {
|
|
10
|
+
this.evidence = evidence;
|
|
11
|
+
}
|
|
12
|
+
attach(criterion, evidenceId) {
|
|
13
|
+
if (!criterion.criterionId || !criterion.revision || !criterion.cwd)
|
|
14
|
+
throw new TypeError('criterion ID, revision and cwd are required');
|
|
15
|
+
const record = this.evidence.get(evidenceId);
|
|
16
|
+
if (!record)
|
|
17
|
+
throw new TypeError(`unknown evidence: ${evidenceId}`);
|
|
18
|
+
const existingCriterion = this.criteria.get(criterion.criterionId);
|
|
19
|
+
if (existingCriterion && existingCriterion.requiredLevel !== criterion.requiredLevel)
|
|
20
|
+
throw new TypeError(`cannot change required level for criterion: ${criterion.criterionId}`);
|
|
21
|
+
if (!existingCriterion)
|
|
22
|
+
this.criteria.set(criterion.criterionId, Object.freeze({ ...criterion }));
|
|
23
|
+
const link = Object.freeze({ criterionId: criterion.criterionId, evidenceId, verification: record.verification, revision: record.revision, cwd: record.cwd });
|
|
24
|
+
const list = this.links.get(criterion.criterionId) ?? [];
|
|
25
|
+
list.push(link);
|
|
26
|
+
this.links.set(criterion.criterionId, list);
|
|
27
|
+
return link;
|
|
28
|
+
}
|
|
29
|
+
justify(input) {
|
|
30
|
+
if (!input.reason.trim())
|
|
31
|
+
throw new TypeError('justification reason is required');
|
|
32
|
+
const criterion = this.criteria.get(input.criterionId);
|
|
33
|
+
const record = this.evidence.get(input.evidenceId);
|
|
34
|
+
if (!criterion || !record || !(this.links.get(input.criterionId) ?? []).some(link => link.evidenceId === input.evidenceId))
|
|
35
|
+
throw new TypeError('justification must identify linked evidence and criterion');
|
|
36
|
+
const key = `${input.criterionId}\0${input.evidenceId}`;
|
|
37
|
+
this.justifications.set(key, Object.freeze({ ...input }));
|
|
38
|
+
}
|
|
39
|
+
evaluate(criterionId, context) {
|
|
40
|
+
const criterion = this.criteria.get(criterionId);
|
|
41
|
+
const links = Object.freeze([...(this.links.get(criterionId) ?? [])]);
|
|
42
|
+
if (!criterion)
|
|
43
|
+
return Object.freeze({ criterionId, satisfied: false, links, escalation: null });
|
|
44
|
+
const candidates = [];
|
|
45
|
+
let mismatch = false;
|
|
46
|
+
for (const link of links) {
|
|
47
|
+
const record = this.evidence.get(link.evidenceId);
|
|
48
|
+
if (!record)
|
|
49
|
+
continue;
|
|
50
|
+
const bound = record.revision === context.revision && record.cwd === context.cwd;
|
|
51
|
+
const justified = this.justifications.has(`${criterionId}\0${record.id}`);
|
|
52
|
+
if (!bound && !justified) {
|
|
53
|
+
mismatch = true;
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
candidates.push(record);
|
|
57
|
+
}
|
|
58
|
+
const eligible = candidates.filter(record => LEVEL[record.verification] >= LEVEL[criterion.requiredLevel] && record.issues.length === 0);
|
|
59
|
+
const outcomes = new Set(eligible.map(record => record.outcome).filter(value => value !== 'unknown'));
|
|
60
|
+
if (outcomes.has('pass') && outcomes.has('fail')) {
|
|
61
|
+
const escalation = `contradictory evidence for ${criterionId}`;
|
|
62
|
+
if (!this.escalations.includes(escalation))
|
|
63
|
+
this.escalations.push(escalation);
|
|
64
|
+
return Object.freeze({ criterionId, satisfied: false, links, escalation });
|
|
65
|
+
}
|
|
66
|
+
const passed = eligible.some(record => record.outcome === 'pass');
|
|
67
|
+
return Object.freeze({ criterionId, satisfied: passed && !mismatch, links, escalation: mismatch ? `evidence binding mismatch for ${criterionId}` : null });
|
|
68
|
+
}
|
|
69
|
+
complete(criterionIds, context) {
|
|
70
|
+
return criterionIds.every(id => this.evaluate(id, context).satisfied);
|
|
71
|
+
}
|
|
72
|
+
getEscalations() { return Object.freeze([...this.escalations]); }
|
|
73
|
+
getJustifications() { return Object.freeze([...this.justifications.values()]); }
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=linker.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { EvidenceStore, type EvidenceRecord, type EvidenceOutcome, type VerificationLevel } from './store.js';
|
|
2
|
+
export { inferOutcome } from './store.js';
|
|
3
|
+
export interface ToolReportInput {
|
|
4
|
+
readonly source: string;
|
|
5
|
+
readonly raw: string;
|
|
6
|
+
readonly verification: VerificationLevel;
|
|
7
|
+
readonly revision: string;
|
|
8
|
+
readonly cwd: string;
|
|
9
|
+
readonly exitCode?: number | null;
|
|
10
|
+
readonly artifactRef?: string;
|
|
11
|
+
readonly artifactHash?: string;
|
|
12
|
+
readonly outcome?: EvidenceOutcome;
|
|
13
|
+
}
|
|
14
|
+
export interface PipelineReportInput {
|
|
15
|
+
readonly source: string;
|
|
16
|
+
readonly raw: string;
|
|
17
|
+
readonly revision: string;
|
|
18
|
+
readonly cwd: string;
|
|
19
|
+
readonly finalRunner?: {
|
|
20
|
+
readonly exitCode: number;
|
|
21
|
+
readonly proven: boolean;
|
|
22
|
+
};
|
|
23
|
+
readonly artifactRef?: string;
|
|
24
|
+
readonly artifactHash?: string;
|
|
25
|
+
}
|
|
26
|
+
export declare function parseToolReport(input: ToolReportInput, store?: EvidenceStore): EvidenceRecord;
|
|
27
|
+
export declare function parsePipelineReport(input: PipelineReportInput, store?: EvidenceStore): EvidenceRecord;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { EvidenceStore, inferOutcome } from './store.js';
|
|
2
|
+
export { inferOutcome } from './store.js';
|
|
3
|
+
export function parseToolReport(input, store = new EvidenceStore()) {
|
|
4
|
+
return store.add({ ...input, outcome: input.outcome ?? inferOutcome(input.raw) });
|
|
5
|
+
}
|
|
6
|
+
export function parsePipelineReport(input, store = new EvidenceStore()) {
|
|
7
|
+
const proven = input.finalRunner?.proven === true && Number.isInteger(input.finalRunner.exitCode);
|
|
8
|
+
return store.add({
|
|
9
|
+
source: input.source, raw: input.raw, revision: input.revision, cwd: input.cwd,
|
|
10
|
+
verification: proven && input.finalRunner?.exitCode === 0 ? 'verified' : 'reported',
|
|
11
|
+
pipeline: true, finalRunnerProven: proven, exitCode: proven ? input.finalRunner.exitCode : null,
|
|
12
|
+
...(input.artifactRef === undefined ? {} : { artifactRef: input.artifactRef }),
|
|
13
|
+
...(input.artifactHash === undefined ? {} : { artifactHash: input.artifactHash }),
|
|
14
|
+
outcome: proven ? input.finalRunner.exitCode === 0 ? 'pass' : 'fail' : 'unknown',
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=report-parser.js.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type VerificationLevel = 'reported' | 'observed' | 'verified';
|
|
2
|
+
export type EvidenceOutcome = 'pass' | 'fail' | 'unknown';
|
|
3
|
+
export interface EvidenceInput {
|
|
4
|
+
readonly source: string;
|
|
5
|
+
readonly raw: string;
|
|
6
|
+
readonly verification: VerificationLevel;
|
|
7
|
+
readonly revision: string;
|
|
8
|
+
readonly cwd: string;
|
|
9
|
+
readonly exitCode?: number | null;
|
|
10
|
+
readonly pipeline?: boolean;
|
|
11
|
+
readonly finalRunnerProven?: boolean;
|
|
12
|
+
readonly artifactRef?: string;
|
|
13
|
+
readonly artifactHash?: string;
|
|
14
|
+
readonly derivedFrom?: readonly string[];
|
|
15
|
+
readonly outcome?: EvidenceOutcome;
|
|
16
|
+
}
|
|
17
|
+
export interface EvidenceRecord extends Omit<EvidenceInput, 'artifactRef' | 'artifactHash' | 'derivedFrom' | 'exitCode' | 'pipeline' | 'finalRunnerProven' | 'outcome'> {
|
|
18
|
+
readonly id: string;
|
|
19
|
+
readonly verification: VerificationLevel;
|
|
20
|
+
readonly exitCode: number | null;
|
|
21
|
+
readonly pipeline: boolean;
|
|
22
|
+
readonly finalRunnerProven: boolean;
|
|
23
|
+
readonly artifactRef: string | null;
|
|
24
|
+
readonly artifactHash: string | null;
|
|
25
|
+
readonly derivedFrom: readonly string[];
|
|
26
|
+
readonly outcome: EvidenceOutcome;
|
|
27
|
+
readonly issues: readonly string[];
|
|
28
|
+
}
|
|
29
|
+
export declare class EvidenceStore {
|
|
30
|
+
private readonly records;
|
|
31
|
+
private nextId;
|
|
32
|
+
add(input: EvidenceInput): EvidenceRecord;
|
|
33
|
+
get(id: string): EvidenceRecord | undefined;
|
|
34
|
+
list(): readonly EvidenceRecord[];
|
|
35
|
+
}
|
|
36
|
+
export declare function inferOutcome(raw: string): EvidenceOutcome;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export class EvidenceStore {
|
|
2
|
+
records = new Map();
|
|
3
|
+
nextId = 1;
|
|
4
|
+
add(input) {
|
|
5
|
+
if (!input.source || !input.raw || !input.revision || !input.cwd)
|
|
6
|
+
throw new TypeError('evidence source, raw payload, revision and cwd are required');
|
|
7
|
+
if (!['reported', 'observed', 'verified'].includes(input.verification))
|
|
8
|
+
throw new TypeError('unknown verification level');
|
|
9
|
+
const issues = [];
|
|
10
|
+
let verification = input.verification;
|
|
11
|
+
let artifactRef = input.artifactRef ?? null;
|
|
12
|
+
let artifactHash = input.artifactHash ?? null;
|
|
13
|
+
if (artifactRef !== null && !/^[a-z][a-z0-9_-]{5,63}$/.test(artifactRef)) {
|
|
14
|
+
issues.push('invalid artifact reference');
|
|
15
|
+
artifactRef = null;
|
|
16
|
+
verification = 'reported';
|
|
17
|
+
}
|
|
18
|
+
if ((artifactRef === null) !== (artifactHash === null) || (artifactHash !== null && !/^[a-f0-9]{64}$/i.test(artifactHash))) {
|
|
19
|
+
issues.push('artifact hash missing or invalid');
|
|
20
|
+
verification = 'reported';
|
|
21
|
+
}
|
|
22
|
+
const pipeline = input.pipeline ?? false;
|
|
23
|
+
const finalRunnerProven = input.finalRunnerProven ?? false;
|
|
24
|
+
const exitCode = input.exitCode ?? null;
|
|
25
|
+
if (pipeline && (!finalRunnerProven || exitCode === null)) {
|
|
26
|
+
issues.push('pipeline final-runner exit is not proven');
|
|
27
|
+
if (verification === 'verified')
|
|
28
|
+
verification = 'reported';
|
|
29
|
+
}
|
|
30
|
+
if (pipeline && exitCode !== null && (!Number.isInteger(exitCode) || exitCode < 0)) {
|
|
31
|
+
issues.push('invalid final-runner exit code');
|
|
32
|
+
verification = 'reported';
|
|
33
|
+
}
|
|
34
|
+
const derivedFrom = Object.freeze([...(input.derivedFrom ?? [])]);
|
|
35
|
+
for (const id of derivedFrom)
|
|
36
|
+
if (!this.records.has(id))
|
|
37
|
+
issues.push(`unknown source evidence: ${id}`);
|
|
38
|
+
const id = `evidence-${String(this.nextId++).padStart(6, '0')}`;
|
|
39
|
+
const record = Object.freeze({
|
|
40
|
+
id, source: input.source, raw: input.raw, verification, revision: input.revision, cwd: input.cwd,
|
|
41
|
+
exitCode, pipeline, finalRunnerProven, artifactRef, artifactHash, derivedFrom,
|
|
42
|
+
outcome: input.outcome ?? inferOutcome(input.raw), issues: Object.freeze(issues),
|
|
43
|
+
});
|
|
44
|
+
this.records.set(id, record);
|
|
45
|
+
return record;
|
|
46
|
+
}
|
|
47
|
+
get(id) { return this.records.get(id); }
|
|
48
|
+
list() { return Object.freeze([...this.records.values()]); }
|
|
49
|
+
}
|
|
50
|
+
export function inferOutcome(raw) {
|
|
51
|
+
if (/\b(fail(?:ed|ure)?|error|not ok)\b/i.test(raw))
|
|
52
|
+
return 'fail';
|
|
53
|
+
if (/\b(pass(?:ed)?|success(?:ful)?)\b/i.test(raw))
|
|
54
|
+
return 'pass';
|
|
55
|
+
return 'unknown';
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** host: default 127.0.0.1 (this machine only). Any other value (e.g. 0.0.0.0) is an explicit opt-in to LAN access; the token is still required. */
|
|
2
|
+
export interface GuiServerOptions {
|
|
3
|
+
projectRoot: string;
|
|
4
|
+
port?: number;
|
|
5
|
+
host?: string;
|
|
6
|
+
open?: boolean; /** Fixed access token (owner-chosen, >= 16 chars); default is a fresh random token per start. */
|
|
7
|
+
token?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface GuiServer {
|
|
10
|
+
url: string;
|
|
11
|
+
close(): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export declare function openBrowser(url: string, platform?: NodeJS.Platform): void;
|
|
14
|
+
export declare function startGuiServer(opts: GuiServerOptions): Promise<GuiServer>;
|
|
15
|
+
/** Folder the GUI works in: the current folder itself (symlinks resolved), never a parent. */
|
|
16
|
+
export declare function guiWorkspace(cwd: string): string;
|
|
17
|
+
export interface GuiSettings {
|
|
18
|
+
host: string;
|
|
19
|
+
port: number;
|
|
20
|
+
explicitPort: boolean;
|
|
21
|
+
open: boolean;
|
|
22
|
+
token?: string;
|
|
23
|
+
tokenIgnored: boolean;
|
|
24
|
+
}
|
|
25
|
+
/** Where `ckit gui` listens. Order: flags > shell environment > project env file > .ckit/gui.json > default (this machine only). */
|
|
26
|
+
export declare function resolveGuiSettings(root: string, shellEnv: Readonly<Record<string, string | undefined>>, args: readonly string[], outerRoot?: string): GuiSettings;
|
|
27
|
+
export declare function runGuiCommand(args: string[]): Promise<number>;
|