@wrongstack/governance 0.298.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.
Files changed (44) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +172 -0
  3. package/dist/admin-session.d.ts +56 -0
  4. package/dist/attachment-broker-controller.d.ts +73 -0
  5. package/dist/authenticated-project-service.d.ts +18 -0
  6. package/dist/autonomy-envelope.d.ts +40 -0
  7. package/dist/capability-grant.d.ts +122 -0
  8. package/dist/credential-lease-controller.d.ts +85 -0
  9. package/dist/daemon-control.d.ts +48 -0
  10. package/dist/daemon-launcher.d.ts +46 -0
  11. package/dist/daemon-metadata.d.ts +126 -0
  12. package/dist/daemon-protocol.d.ts +59 -0
  13. package/dist/event-store.d.ts +109 -0
  14. package/dist/evidence-candidate.d.ts +95 -0
  15. package/dist/index.d.ts +38 -0
  16. package/dist/index.js +8468 -0
  17. package/dist/ipc-endpoint.d.ts +6 -0
  18. package/dist/ipc-protocol.d.ts +24 -0
  19. package/dist/legacy-shadow-adapter.d.ts +33 -0
  20. package/dist/management-receipt-cache.d.ts +53 -0
  21. package/dist/plan-version.d.ts +91 -0
  22. package/dist/project-client.d.ts +31 -0
  23. package/dist/project-daemon.d.ts +2 -0
  24. package/dist/project-daemon.js +5722 -0
  25. package/dist/project-server.d.ts +48 -0
  26. package/dist/project-service.d.ts +121 -0
  27. package/dist/protocol-decoder.d.ts +16 -0
  28. package/dist/runtime-compatibility.d.ts +99 -0
  29. package/dist/sanitize.d.ts +11 -0
  30. package/dist/service-protocol.d.ts +82 -0
  31. package/dist/task-aggregate.d.ts +92 -0
  32. package/dist/task-contract.d.ts +74 -0
  33. package/dist/transition-engine.d.ts +37 -0
  34. package/dist/verification-check-binding.d.ts +23 -0
  35. package/dist/verification-check-registry.d.ts +43 -0
  36. package/dist/verification-execution-lease.d.ts +76 -0
  37. package/dist/verification-issuance-coordinator.d.ts +110 -0
  38. package/dist/verification-ledger-store.d.ts +20 -0
  39. package/dist/verification-planner.d.ts +76 -0
  40. package/dist/verification-run-contract.d.ts +84 -0
  41. package/dist/verification-tool-gateway.d.ts +74 -0
  42. package/dist/workflow-state.d.ts +5 -0
  43. package/dist/workspace-snapshot-fence.d.ts +20 -0
  44. package/package.json +44 -0
@@ -0,0 +1,46 @@
1
+ import type { GovernanceServiceCredential } from './capability-grant.js';
2
+ import type { GovernanceServiceCapability } from './service-protocol.js';
3
+ export declare const GOVERNANCE_DAEMON_STARTUP_TIMEOUT_MS = 10000;
4
+ export type GovernanceDaemonAvailability = {
5
+ readonly kind: 'available';
6
+ readonly entrypoint: URL;
7
+ } | {
8
+ readonly kind: 'missing-build';
9
+ };
10
+ export type GovernanceDaemonLaunchErrorCode = 'missing_build' | 'spawn_failed' | 'startup_timeout' | 'startup_busy' | 'startup_failed' | 'owner_conflict' | 'endpoint_invalid' | 'invalid_handshake' | 'process_exited';
11
+ export declare class GovernanceDaemonLaunchError extends Error {
12
+ readonly code: GovernanceDaemonLaunchErrorCode;
13
+ constructor(code: GovernanceDaemonLaunchErrorCode, message: string);
14
+ }
15
+ export interface LaunchGovernanceProjectDaemonOptions {
16
+ readonly projectRoot: string;
17
+ readonly projectId: string;
18
+ readonly clientId: string;
19
+ readonly capabilities: readonly GovernanceServiceCapability[];
20
+ readonly ttlMs: number;
21
+ readonly timeoutMs?: number | undefined;
22
+ }
23
+ export interface GovernanceProjectDaemonLaunch {
24
+ readonly pid: number;
25
+ readonly projectRoot: string;
26
+ readonly projectId: string;
27
+ readonly instanceId: string;
28
+ readonly startedAt: string;
29
+ readonly grantId: string;
30
+ readonly expiresAt: string;
31
+ readonly credential: GovernanceServiceCredential;
32
+ }
33
+ interface GovernanceDaemonRuntime {
34
+ readonly entrypoint: URL;
35
+ readonly execArgv?: readonly string[] | undefined;
36
+ readonly cwd?: string | undefined;
37
+ readonly detached?: boolean | undefined;
38
+ readonly environment?: NodeJS.ProcessEnv | undefined;
39
+ }
40
+ export declare function governanceDaemonEnvironment(source: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
41
+ export declare function resolveGovernanceDaemonAvailability(moduleUrl?: string, exists?: (filePath: string) => boolean): GovernanceDaemonAvailability;
42
+ export declare function launchGovernanceProjectDaemon(options: LaunchGovernanceProjectDaemonOptions): Promise<GovernanceProjectDaemonLaunch>;
43
+ /** Internal seam for source-level process tests; public callers use the built entrypoint above. */
44
+ export declare function launchGovernanceProjectDaemonWithRuntime(options: LaunchGovernanceProjectDaemonOptions, runtime: GovernanceDaemonRuntime): Promise<GovernanceProjectDaemonLaunch>;
45
+ export {};
46
+ //# sourceMappingURL=daemon-launcher.d.ts.map
@@ -0,0 +1,126 @@
1
+ import type { GovernanceServiceCredential } from './capability-grant.js';
2
+ import { GOVERNANCE_SERVICE_PROTOCOL_VERSION } from './service-protocol.js';
3
+ export declare const GOVERNANCE_DAEMON_METADATA_SCHEMA_VERSION: 1;
4
+ export declare const GOVERNANCE_DAEMON_STARTUP_LEASE_SCHEMA_VERSION: 1;
5
+ export declare const GOVERNANCE_DAEMON_ATTACHMENT_BROKER_SCHEMA_VERSION: 1;
6
+ export declare const GOVERNANCE_DAEMON_METADATA_MAX_BYTES: number;
7
+ export declare const GOVERNANCE_DAEMON_ENDPOINT_PROBE_TIMEOUT_MS = 750;
8
+ export declare const GOVERNANCE_DAEMON_STARTUP_LEASE_TIMEOUT_MS = 10000;
9
+ export declare const GOVERNANCE_DAEMON_STARTUP_LEASE_RETRY_MS = 50;
10
+ export declare const GOVERNANCE_DAEMON_ATTACHMENT_BROKER_TTL_MS: number;
11
+ export declare const GOVERNANCE_DAEMON_METADATA_RELATIVE_PATH: string;
12
+ export declare const GOVERNANCE_DAEMON_STARTUP_LEASE_RELATIVE_PATH: string;
13
+ export declare const GOVERNANCE_DAEMON_ATTACHMENT_BROKER_RELATIVE_PATH: string;
14
+ export interface GovernanceDaemonMetadata {
15
+ readonly schemaVersion: typeof GOVERNANCE_DAEMON_METADATA_SCHEMA_VERSION;
16
+ readonly protocolVersion: typeof GOVERNANCE_SERVICE_PROTOCOL_VERSION;
17
+ readonly projectKey: string;
18
+ readonly projectRoot: string;
19
+ readonly projectId: string;
20
+ readonly endpoint: string;
21
+ readonly pid: number;
22
+ readonly instanceId: string;
23
+ readonly startedAt: string;
24
+ }
25
+ export interface GovernanceDaemonStartupLeaseRecord {
26
+ readonly schemaVersion: typeof GOVERNANCE_DAEMON_STARTUP_LEASE_SCHEMA_VERSION;
27
+ readonly projectKey: string;
28
+ readonly pid: number;
29
+ readonly instanceId: string;
30
+ readonly startedAt: string;
31
+ }
32
+ export interface GovernanceDaemonAttachmentBrokerRecord {
33
+ readonly schemaVersion: typeof GOVERNANCE_DAEMON_ATTACHMENT_BROKER_SCHEMA_VERSION;
34
+ readonly protocolVersion: typeof GOVERNANCE_SERVICE_PROTOCOL_VERSION;
35
+ readonly projectKey: string;
36
+ readonly projectRoot: string;
37
+ readonly projectId: string;
38
+ readonly pid: number;
39
+ readonly instanceId: string;
40
+ readonly grantId: string;
41
+ readonly expiresAt: string;
42
+ readonly credential: GovernanceServiceCredential;
43
+ }
44
+ export type GovernanceDaemonAttachmentBrokerReadResult = {
45
+ readonly kind: 'missing';
46
+ } | {
47
+ readonly kind: 'invalid';
48
+ readonly reason: string;
49
+ } | {
50
+ readonly kind: 'valid';
51
+ readonly broker: GovernanceDaemonAttachmentBrokerRecord;
52
+ };
53
+ export type GovernanceDaemonMetadataReadResult = {
54
+ readonly kind: 'missing';
55
+ } | {
56
+ readonly kind: 'invalid';
57
+ readonly reason: string;
58
+ } | {
59
+ readonly kind: 'valid';
60
+ readonly metadata: GovernanceDaemonMetadata;
61
+ };
62
+ export type GovernanceDaemonInspection = {
63
+ readonly kind: 'live';
64
+ readonly metadata: GovernanceDaemonMetadata;
65
+ } | {
66
+ readonly kind: 'stale';
67
+ readonly metadata: GovernanceDaemonMetadata | null;
68
+ readonly metadataState: 'missing' | 'invalid' | 'dead-owner';
69
+ } | {
70
+ readonly kind: 'endpoint_invalid';
71
+ readonly metadata: GovernanceDaemonMetadata | null;
72
+ readonly reason: string;
73
+ };
74
+ export type GovernanceDaemonStartupLeaseErrorCode = 'busy' | 'invalid_lease';
75
+ export declare class GovernanceDaemonStartupLeaseError extends Error {
76
+ readonly code: GovernanceDaemonStartupLeaseErrorCode;
77
+ constructor(code: GovernanceDaemonStartupLeaseErrorCode, message: string);
78
+ }
79
+ interface AcquireGovernanceDaemonStartupLeaseOptions {
80
+ readonly projectRoot: string;
81
+ readonly pid: number;
82
+ readonly instanceId: string;
83
+ readonly startedAt: string;
84
+ readonly timeoutMs?: number | undefined;
85
+ readonly retryMs?: number | undefined;
86
+ readonly now?: (() => number) | undefined;
87
+ readonly isProcessAlive?: ((pid: number) => boolean) | undefined;
88
+ }
89
+ export declare function governanceDaemonMetadataPath(projectRoot: string): string;
90
+ export declare function governanceDaemonStartupLeasePath(projectRoot: string): string;
91
+ export declare function governanceDaemonAttachmentBrokerPath(projectRoot: string): string;
92
+ export declare function createGovernanceDaemonAttachmentBroker(options: {
93
+ readonly metadata: GovernanceDaemonMetadata;
94
+ readonly grantId: string;
95
+ readonly expiresAt: string;
96
+ readonly credential: GovernanceServiceCredential;
97
+ }): GovernanceDaemonAttachmentBrokerRecord;
98
+ export declare function writeGovernanceDaemonAttachmentBroker(projectRoot: string, broker: GovernanceDaemonAttachmentBrokerRecord): Promise<void>;
99
+ export declare function readGovernanceDaemonAttachmentBroker(projectRoot: string): Promise<GovernanceDaemonAttachmentBrokerReadResult>;
100
+ export declare function removeOwnedGovernanceDaemonAttachmentBroker(projectRoot: string, owner: Pick<GovernanceDaemonMetadata, 'pid' | 'instanceId'>): Promise<boolean>;
101
+ export declare function createGovernanceDaemonMetadata(options: {
102
+ readonly projectRoot: string;
103
+ readonly projectId: string;
104
+ readonly pid: number;
105
+ readonly instanceId: string;
106
+ readonly startedAt: string;
107
+ }): GovernanceDaemonMetadata;
108
+ export declare function writeGovernanceDaemonMetadata(projectRoot: string, metadata: GovernanceDaemonMetadata): Promise<void>;
109
+ export declare function readGovernanceDaemonMetadata(projectRoot: string): Promise<GovernanceDaemonMetadataReadResult>;
110
+ export declare function removeOwnedGovernanceDaemonMetadata(projectRoot: string, owner: Pick<GovernanceDaemonMetadata, 'pid' | 'instanceId'>): Promise<boolean>;
111
+ export declare function isGovernanceProcessAlive(pid: number): boolean;
112
+ export declare function probeGovernanceDaemonEndpoint(projectRoot: string, timeoutMs?: number): Promise<boolean>;
113
+ export declare function inspectGovernanceDaemon(projectRoot: string): Promise<GovernanceDaemonInspection>;
114
+ export declare function shouldRecoverGovernanceEndpoint(platform: NodeJS.Platform, inspection: GovernanceDaemonInspection): boolean;
115
+ export declare class GovernanceDaemonStartupLease {
116
+ readonly projectRoot: string;
117
+ private readonly raw;
118
+ readonly path: string;
119
+ readonly record: GovernanceDaemonStartupLeaseRecord;
120
+ private released;
121
+ constructor(projectRoot: string, pathname: string, record: GovernanceDaemonStartupLeaseRecord, raw: string);
122
+ release(): Promise<boolean>;
123
+ }
124
+ export declare function acquireGovernanceDaemonStartupLease(options: AcquireGovernanceDaemonStartupLeaseOptions): Promise<GovernanceDaemonStartupLease>;
125
+ export {};
126
+ //# sourceMappingURL=daemon-metadata.d.ts.map
@@ -0,0 +1,59 @@
1
+ import type { GovernanceServiceCredential } from './capability-grant.js';
2
+ import { type GovernanceServiceCapability } from './service-protocol.js';
3
+ export declare const GOVERNANCE_DAEMON_BOOTSTRAP_PROTOCOL_VERSION: 2;
4
+ export interface GovernanceDaemonBootstrapRequest {
5
+ readonly type: 'bootstrap';
6
+ readonly protocolVersion: typeof GOVERNANCE_DAEMON_BOOTSTRAP_PROTOCOL_VERSION;
7
+ readonly nonce: string;
8
+ readonly clientId: string;
9
+ readonly capabilities: readonly GovernanceServiceCapability[];
10
+ readonly ttlMs: number;
11
+ }
12
+ export type GovernanceDaemonBootstrapErrorCode = 'invalid_bootstrap' | 'owner_conflict' | 'startup_busy' | 'endpoint_invalid' | 'startup_failed';
13
+ export type GovernanceDaemonBootstrapMessage = {
14
+ readonly type: 'ready';
15
+ readonly protocolVersion: typeof GOVERNANCE_DAEMON_BOOTSTRAP_PROTOCOL_VERSION;
16
+ readonly projectRoot: string;
17
+ readonly projectId: string;
18
+ readonly pid: number;
19
+ readonly instanceId: string;
20
+ readonly startedAt: string;
21
+ } | {
22
+ readonly type: 'bootstrap_result';
23
+ readonly protocolVersion: typeof GOVERNANCE_DAEMON_BOOTSTRAP_PROTOCOL_VERSION;
24
+ readonly nonce: string;
25
+ readonly projectRoot: string;
26
+ readonly projectId: string;
27
+ readonly pid: number;
28
+ readonly instanceId: string;
29
+ readonly startedAt: string;
30
+ readonly grantId: string;
31
+ readonly expiresAt: string;
32
+ readonly credential: GovernanceServiceCredential;
33
+ } | {
34
+ readonly type: 'bootstrap_error';
35
+ readonly protocolVersion: typeof GOVERNANCE_DAEMON_BOOTSTRAP_PROTOCOL_VERSION;
36
+ readonly code: GovernanceDaemonBootstrapErrorCode;
37
+ readonly message: string;
38
+ };
39
+ export interface GovernanceDaemonProtocolIssue {
40
+ readonly path: string;
41
+ readonly message: string;
42
+ }
43
+ export type GovernanceDaemonBootstrapRequestDecodeResult = {
44
+ readonly decoded: true;
45
+ readonly request: GovernanceDaemonBootstrapRequest;
46
+ } | {
47
+ readonly decoded: false;
48
+ readonly issues: readonly GovernanceDaemonProtocolIssue[];
49
+ };
50
+ export type GovernanceDaemonBootstrapMessageDecodeResult = {
51
+ readonly decoded: true;
52
+ readonly message: GovernanceDaemonBootstrapMessage;
53
+ } | {
54
+ readonly decoded: false;
55
+ readonly issues: readonly GovernanceDaemonProtocolIssue[];
56
+ };
57
+ export declare function decodeGovernanceDaemonBootstrapRequest(input: unknown): GovernanceDaemonBootstrapRequestDecodeResult;
58
+ export declare function decodeGovernanceDaemonBootstrapMessage(input: unknown): GovernanceDaemonBootstrapMessageDecodeResult;
59
+ //# sourceMappingURL=daemon-protocol.d.ts.map
@@ -0,0 +1,109 @@
1
+ import { type GovernanceCommand, type GovernanceCommandDecision, type GovernanceDecisionContext, type GovernanceEvent, type TaskAggregate } from './task-aggregate.js';
2
+ import type { ConsumeVerificationExecutionLeaseResult, IssueVerificationExecutionLeaseResult, VerificationExecutionBinding, VerificationExecutionLeaseCredential, VerificationExecutionLeaseStatus, VerificationLeaseIssuancePrecondition } from './verification-execution-lease.js';
3
+ import type { VerificationRunContract } from './verification-run-contract.js';
4
+ import type { RecordWorkspaceSnapshotResult, WorkspaceSnapshotFenceDescriptor } from './workspace-snapshot-fence.js';
5
+ export declare const GOVERNANCE_OBSERVATION_CATEGORIES: readonly ['task_created', 'status_changed', 'plan_updated', 'tool_invoked', 'evidence_candidate', 'verification_reported', 'review_reported', 'completion_claimed', 'failure_reported', 'capability_grant_issued', 'capability_grant_revoked', 'capability_grant_expired', 'capability_grant_rotated', 'daemon_attachment_broker_lifecycle', 'daemon_shutdown_requested'];
6
+ export type GovernanceObservationCategory = (typeof GOVERNANCE_OBSERVATION_CATEGORIES)[number];
7
+ export interface GovernanceObservation {
8
+ readonly observationId: string;
9
+ readonly projectId: string;
10
+ readonly taskId: string | null;
11
+ readonly source: string;
12
+ readonly category: GovernanceObservationCategory;
13
+ readonly observedAt: string;
14
+ readonly payload: Readonly<Record<string, unknown>>;
15
+ }
16
+ export interface StoredGovernanceObservation extends GovernanceObservation {
17
+ readonly sequence: number;
18
+ readonly recordedAt: string;
19
+ }
20
+ export type AppendGovernanceObservationResult = {
21
+ readonly handled: true;
22
+ readonly idempotentReplay: boolean;
23
+ readonly observation: StoredGovernanceObservation;
24
+ } | {
25
+ readonly handled: false;
26
+ readonly code: 'observation_id_conflict';
27
+ readonly message: string;
28
+ };
29
+ export interface GovernanceCommandReceipt {
30
+ readonly commandId: string;
31
+ readonly taskId: string;
32
+ readonly command: GovernanceCommand;
33
+ readonly decisionContext: GovernanceDecisionContext;
34
+ readonly decision: GovernanceCommandDecision;
35
+ readonly resultRevision: number;
36
+ readonly recordedAt: string;
37
+ }
38
+ export type GovernanceCommandExecution = {
39
+ readonly handled: true;
40
+ readonly idempotentReplay: boolean;
41
+ readonly decision: GovernanceCommandDecision;
42
+ readonly aggregate: TaskAggregate | null;
43
+ } | {
44
+ readonly handled: false;
45
+ readonly code: 'command_id_conflict';
46
+ readonly message: string;
47
+ };
48
+ export interface GovernanceEventStore {
49
+ execute(command: GovernanceCommand, context?: GovernanceDecisionContext): GovernanceCommandExecution;
50
+ readTask(taskId: string): TaskAggregate | null;
51
+ readEvents(taskId: string): readonly GovernanceEvent[];
52
+ readReceipt(commandId: string): GovernanceCommandReceipt | null;
53
+ appendObservation(observation: GovernanceObservation): AppendGovernanceObservationResult;
54
+ readObservations(projectId: string, taskId?: string): readonly StoredGovernanceObservation[];
55
+ readEvidenceCandidateObservations(projectId: string, taskId: string, options: {
56
+ readonly afterSequence: number;
57
+ readonly limit: number;
58
+ }): readonly StoredGovernanceObservation[];
59
+ recordWorkspaceSnapshot(projectId: string, manifestHash: string): RecordWorkspaceSnapshotResult;
60
+ readLatestWorkspaceSnapshot(projectId: string): WorkspaceSnapshotFenceDescriptor | null;
61
+ issueVerificationExecutionLease(run: VerificationRunContract): IssueVerificationExecutionLeaseResult;
62
+ issueVerificationExecutionLeaseIfCurrent(run: VerificationRunContract, precondition: VerificationLeaseIssuancePrecondition): IssueVerificationExecutionLeaseResult;
63
+ consumeVerificationExecutionLease(credential: VerificationExecutionLeaseCredential, binding: VerificationExecutionBinding): ConsumeVerificationExecutionLeaseResult;
64
+ readVerificationExecutionLeaseStatus(leaseId: string): VerificationExecutionLeaseStatus;
65
+ close(): void;
66
+ }
67
+ export interface SqliteGovernanceEventStoreOptions {
68
+ readonly now?: (() => string) | undefined;
69
+ readonly verificationLeaseSecret?: (() => string) | undefined;
70
+ }
71
+ export declare class GovernanceStoreCorruptionError extends Error {
72
+ constructor(message: string);
73
+ }
74
+ export declare class SqliteGovernanceEventStore implements GovernanceEventStore {
75
+ readonly databasePath: string;
76
+ private readonly db;
77
+ private readonly now;
78
+ private readonly verificationLedger;
79
+ private closed;
80
+ private constructor();
81
+ static open(databasePath: string, options?: SqliteGovernanceEventStoreOptions): SqliteGovernanceEventStore;
82
+ execute(command: GovernanceCommand, context?: GovernanceDecisionContext): GovernanceCommandExecution;
83
+ readTask(taskId: string): TaskAggregate | null;
84
+ readEvents(taskId: string): readonly GovernanceEvent[];
85
+ readReceipt(commandId: string): GovernanceCommandReceipt | null;
86
+ appendObservation(observation: GovernanceObservation): AppendGovernanceObservationResult;
87
+ readObservations(projectId: string, taskId?: string): readonly StoredGovernanceObservation[];
88
+ readEvidenceCandidateObservations(projectId: string, taskId: string, options: {
89
+ readonly afterSequence: number;
90
+ readonly limit: number;
91
+ }): readonly StoredGovernanceObservation[];
92
+ issueVerificationExecutionLease(run: VerificationRunContract): IssueVerificationExecutionLeaseResult;
93
+ recordWorkspaceSnapshot(projectId: string, manifestHash: string): RecordWorkspaceSnapshotResult;
94
+ readLatestWorkspaceSnapshot(projectId: string): WorkspaceSnapshotFenceDescriptor | null;
95
+ issueVerificationExecutionLeaseIfCurrent(run: VerificationRunContract, precondition: VerificationLeaseIssuancePrecondition): IssueVerificationExecutionLeaseResult;
96
+ consumeVerificationExecutionLease(credential: VerificationExecutionLeaseCredential, binding: VerificationExecutionBinding): ConsumeVerificationExecutionLeaseResult;
97
+ readVerificationExecutionLeaseStatus(leaseId: string): VerificationExecutionLeaseStatus;
98
+ close(): void;
99
+ private initializeSchema;
100
+ private readEventsUnlocked;
101
+ private readTaskUnlocked;
102
+ private readReceiptRow;
103
+ private readObservationRow;
104
+ private receiptFromRow;
105
+ private observationFromRow;
106
+ private executionFromReceipt;
107
+ private assertOpen;
108
+ }
109
+ //# sourceMappingURL=event-store.d.ts.map
@@ -0,0 +1,95 @@
1
+ export declare const GOVERNANCE_EVIDENCE_CANDIDATE_SCHEMA_VERSION: 1;
2
+ export declare const GOVERNANCE_EVIDENCE_CANDIDATE_DEFAULT_PAGE_SIZE = 50;
3
+ export declare const GOVERNANCE_EVIDENCE_CANDIDATE_MAX_PAGE_SIZE = 100;
4
+ export type GovernanceEvidenceCandidateMissingBinding = 'tool_call' | 'task' | 'plan' | 'workspace';
5
+ export interface GovernanceEvidenceTraceSnapshot {
6
+ readonly sessionId: string;
7
+ readonly task: {
8
+ readonly scope: 'session';
9
+ } | {
10
+ readonly scope: 'kanban_task';
11
+ readonly taskId: string;
12
+ readonly boardId: string | null;
13
+ };
14
+ readonly plan: {
15
+ readonly state: 'missing' | 'invalid' | 'unreadable' | 'refreshing';
16
+ } | {
17
+ readonly state: 'available';
18
+ readonly fingerprint: string;
19
+ };
20
+ readonly workspace: {
21
+ readonly state: 'not_captured' | 'unavailable';
22
+ } | {
23
+ readonly state: 'captured';
24
+ readonly manifestHash: string;
25
+ readonly baseHead: string;
26
+ };
27
+ }
28
+ export interface GovernanceToolOutcomeMetadata {
29
+ readonly toolCallId?: string | undefined;
30
+ readonly toolName: string;
31
+ readonly ok: boolean;
32
+ readonly durationMs: number;
33
+ readonly outputBytes?: number | undefined;
34
+ readonly outputTokens?: number | undefined;
35
+ readonly outputLines?: number | undefined;
36
+ }
37
+ export interface GovernanceEvidenceCandidate {
38
+ readonly schemaVersion: typeof GOVERNANCE_EVIDENCE_CANDIDATE_SCHEMA_VERSION;
39
+ readonly candidateType: 'tool_execution';
40
+ readonly status: 'unverified';
41
+ readonly candidateId: string | null;
42
+ readonly binding: {
43
+ readonly state: 'bound';
44
+ } | {
45
+ readonly state: 'incomplete';
46
+ readonly missing: readonly GovernanceEvidenceCandidateMissingBinding[];
47
+ };
48
+ readonly tool: {
49
+ readonly callId: string | null;
50
+ readonly name: string;
51
+ };
52
+ readonly outcome: {
53
+ readonly status: 'succeeded' | 'failed';
54
+ readonly durationMs: number;
55
+ readonly outputBytes?: number | undefined;
56
+ readonly outputTokens?: number | undefined;
57
+ readonly outputLines?: number | undefined;
58
+ };
59
+ }
60
+ export type GovernanceEvidenceCandidateIneligibilityReason = 'payload_invalid' | 'unsupported_schema' | 'binding_incomplete' | 'candidate_identity_missing' | 'candidate_identity_mismatch' | 'task_binding_mismatch' | 'trace_binding_incomplete';
61
+ export interface GovernanceEvidenceCandidateLedgerEntry {
62
+ readonly sequence: number;
63
+ readonly observationId: string;
64
+ readonly source: string;
65
+ readonly taskId: string | null;
66
+ readonly observedAt: string;
67
+ readonly recordedAt: string;
68
+ readonly candidateId: string | null;
69
+ readonly toolCallId: string | null;
70
+ readonly toolName: string | null;
71
+ readonly outcomeStatus: 'succeeded' | 'failed' | null;
72
+ readonly planFingerprint: string | null;
73
+ readonly workspaceManifestHash: string | null;
74
+ readonly workspaceBaseHead: string | null;
75
+ readonly evaluation: {
76
+ readonly state: 'eligible_for_evaluation';
77
+ readonly reasons: readonly GovernanceEvidenceCandidateIneligibilityReason[];
78
+ } | {
79
+ readonly state: 'ineligible';
80
+ readonly reasons: readonly GovernanceEvidenceCandidateIneligibilityReason[];
81
+ };
82
+ }
83
+ export interface GovernanceEvidenceCandidateObservation {
84
+ readonly sequence: number;
85
+ readonly observationId: string;
86
+ readonly source: string;
87
+ readonly taskId: string | null;
88
+ readonly category: string;
89
+ readonly observedAt: string;
90
+ readonly recordedAt: string;
91
+ readonly payload: Readonly<Record<string, unknown>>;
92
+ }
93
+ export declare function createGovernanceEvidenceCandidate(trace: GovernanceEvidenceTraceSnapshot, outcome: GovernanceToolOutcomeMetadata): GovernanceEvidenceCandidate;
94
+ export declare function evaluateGovernanceEvidenceCandidateObservation(observation: GovernanceEvidenceCandidateObservation): GovernanceEvidenceCandidateLedgerEntry;
95
+ //# sourceMappingURL=evidence-candidate.d.ts.map
@@ -0,0 +1,38 @@
1
+ export * from './admin-session.js';
2
+ export * from './attachment-broker-controller.js';
3
+ export * from './authenticated-project-service.js';
4
+ export * from './autonomy-envelope.js';
5
+ export * from './capability-grant.js';
6
+ export * from './credential-lease-controller.js';
7
+ export * from './daemon-control.js';
8
+ export type { GovernanceDaemonAvailability, GovernanceDaemonLaunchErrorCode, GovernanceProjectDaemonLaunch, LaunchGovernanceProjectDaemonOptions, } from './daemon-launcher.js';
9
+ export { GOVERNANCE_DAEMON_STARTUP_TIMEOUT_MS, GovernanceDaemonLaunchError, governanceDaemonEnvironment, launchGovernanceProjectDaemon, resolveGovernanceDaemonAvailability, } from './daemon-launcher.js';
10
+ export * from './daemon-metadata.js';
11
+ export * from './daemon-protocol.js';
12
+ export * from './event-store.js';
13
+ export * from './evidence-candidate.js';
14
+ export * from './ipc-endpoint.js';
15
+ export * from './ipc-protocol.js';
16
+ export * from './legacy-shadow-adapter.js';
17
+ export * from './management-receipt-cache.js';
18
+ export * from './plan-version.js';
19
+ export * from './project-client.js';
20
+ export * from './project-server.js';
21
+ export * from './project-service.js';
22
+ export * from './protocol-decoder.js';
23
+ export { type ExistingGovernanceAdminCredential, GOVERNANCE_COMPATIBILITY_ADMIN_TTL_MS, GOVERNANCE_COMPATIBILITY_MODEL_TTL_MS, type GovernanceCompatibilityCleanup, type GovernanceCompatibilityFallback, type GovernanceCompatibilityFallbackCode, GovernanceCompatibilityRuntime, type GovernanceCompatibilityRuntimeSnapshot, type GovernanceModelCapability, GovernanceModelSession, type GovernanceModelSessionSnapshot, type PrepareGovernanceCompatibilityOptions, type PrepareGovernanceCompatibilityResult, prepareGovernanceCompatibilityRuntime, } from './runtime-compatibility.js';
24
+ export * from './sanitize.js';
25
+ export * from './task-aggregate.js';
26
+ export * from './task-contract.js';
27
+ export * from './transition-engine.js';
28
+ export * from './verification-check-binding.js';
29
+ export * from './verification-check-registry.js';
30
+ export * from './verification-execution-lease.js';
31
+ export * from './verification-issuance-coordinator.js';
32
+ export * from './verification-ledger-store.js';
33
+ export * from './verification-planner.js';
34
+ export * from './verification-run-contract.js';
35
+ export * from './verification-tool-gateway.js';
36
+ export * from './workflow-state.js';
37
+ export * from './workspace-snapshot-fence.js';
38
+ //# sourceMappingURL=index.d.ts.map