@aiwg/cli 2026.9.0 → 2026.9.2
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/agentic/code/providers/capability-matrix.yaml +41 -0
- package/agentic/code/providers/model-capabilities.v1.json +11 -0
- package/agentic/code/providers/model-catalog.v1.json +8 -0
- package/agentic/code/providers/pi/aiwg-bridge.ts +26 -0
- package/bin/aiwg.mjs +15 -3
- package/dist/src/api/index.d.ts +3 -0
- package/dist/src/api/index.js +3 -0
- package/dist/src/auth/credential-store.js +6 -0
- package/dist/src/channel/manager.mjs +2 -2
- package/dist/src/cli/handlers/dataset.js +186 -0
- package/dist/src/cli/handlers/help.js +2 -1
- package/dist/src/cli/handlers/index.js +5 -1
- package/dist/src/cli/handlers/init.js +1 -0
- package/dist/src/cli/handlers/output-mode.js +18 -1
- package/dist/src/cli/handlers/run.js +11 -3
- package/dist/src/cli/handlers/schema.js +221 -0
- package/dist/src/cli/handlers/sessions.js +30 -12
- package/dist/src/cli/handlers/steward.js +11 -1
- package/dist/src/cli/handlers/use.js +6 -2
- package/dist/src/cli/hooks/builtin/activity-log-hook.js +6 -0
- package/dist/src/cli/router.js +1 -1
- package/dist/src/cli/scope-resolver.js +22 -0
- package/dist/src/dataset/adapter-sdk.d.ts +41 -0
- package/dist/src/dataset/adapter-sdk.js +147 -0
- package/dist/src/dataset/adapter-types.d.ts +179 -0
- package/dist/src/dataset/adapter-types.js +2 -0
- package/dist/src/dataset/adapters.d.ts +104 -0
- package/dist/src/dataset/adapters.js +518 -0
- package/dist/src/dataset/conformance-types.d.ts +84 -0
- package/dist/src/dataset/conformance-types.js +3 -0
- package/dist/src/dataset/conformance.d.ts +13 -0
- package/dist/src/dataset/conformance.js +90 -0
- package/dist/src/dataset/contracts.d.ts +17 -0
- package/dist/src/dataset/contracts.js +236 -0
- package/dist/src/dataset/file-orchestration-repository.d.ts +19 -0
- package/dist/src/dataset/file-orchestration-repository.js +68 -0
- package/dist/src/dataset/fortemi-execution-bridge.d.ts +33 -0
- package/dist/src/dataset/fortemi-execution-bridge.js +35 -0
- package/dist/src/dataset/index.d.ts +21 -0
- package/dist/src/dataset/index.js +21 -0
- package/dist/src/dataset/ledger-types.d.ts +141 -0
- package/dist/src/dataset/ledger-types.js +2 -0
- package/dist/src/dataset/ledger.d.ts +27 -0
- package/dist/src/dataset/ledger.js +100 -0
- package/dist/src/dataset/local-execution-backend.d.ts +10 -0
- package/dist/src/dataset/local-execution-backend.js +32 -0
- package/dist/src/dataset/orchestration-repository.d.ts +29 -0
- package/dist/src/dataset/orchestration-repository.js +34 -0
- package/dist/src/dataset/orchestration-service.d.ts +56 -0
- package/dist/src/dataset/orchestration-service.js +466 -0
- package/dist/src/dataset/orchestration-types.d.ts +83 -0
- package/dist/src/dataset/orchestration-types.js +2 -0
- package/dist/src/dataset/presentation.d.ts +3 -0
- package/dist/src/dataset/presentation.js +8 -0
- package/dist/src/dataset/projections.d.ts +42 -0
- package/dist/src/dataset/projections.js +192 -0
- package/dist/src/dataset/schema-governance.d.ts +71 -0
- package/dist/src/dataset/schema-governance.js +135 -0
- package/dist/src/dataset/standards-types.d.ts +66 -0
- package/dist/src/dataset/standards-types.js +10 -0
- package/dist/src/dataset/standards.d.ts +13 -0
- package/dist/src/dataset/standards.js +291 -0
- package/dist/src/dataset/types.d.ts +258 -0
- package/dist/src/dataset/types.js +2 -0
- package/dist/src/extensions/commands/definitions.js +27 -1
- package/dist/src/installation/manager.mjs +5 -1
- package/dist/src/models/model-capabilities.v1.json +11 -0
- package/dist/src/models/model-catalog.v1.json +8 -0
- package/dist/src/models/model-discovery.js +32 -0
- package/dist/src/models/provider-policy.js +3 -2
- package/dist/src/output-modes/index.js +4 -0
- package/dist/src/output-modes/registry.js +68 -24
- package/dist/src/output-modes/runtime.js +10 -8
- package/dist/src/plugin/skill-command-translator.js +1 -0
- package/dist/src/providers/capability-matrix.yaml +41 -0
- package/dist/src/providers/provider-definitions.js +72 -0
- package/dist/src/providers/provider-inventory.js +1 -0
- package/dist/src/schema/catalog.js +234 -0
- package/dist/src/schema/compatibility.js +42 -0
- package/dist/src/schema/diagnostics.js +36 -0
- package/dist/src/schema/index.js +8 -0
- package/dist/src/schema/policy.js +58 -0
- package/dist/src/schema/resolver.js +76 -0
- package/dist/src/schema/types.js +2 -0
- package/dist/src/schema/validator.js +82 -0
- package/dist/src/sessions/adapters/pi.js +141 -0
- package/dist/src/sessions/contracts.js +1 -1
- package/dist/src/sessions/index.js +1 -0
- package/dist/src/sessions/workspace-discovery.js +10 -0
- package/dist/src/storage/backends/fortemi.js +6 -0
- package/dist/src/storage/config.js +18 -4
- package/dist/src/storage/fortemi-qualification.js +106 -0
- package/dist/src/storage/index.js +1 -0
- package/dist/src/storage/types.js +1 -1
- package/package.json +3 -1
- package/schemas/dataset/conformance-manifest.v1.schema.json +35 -0
- package/schemas/dataset/conformance-receipt.v1.schema.json +22 -0
- package/schemas/dataset/dataset-contracts.v1.schema.json +117 -0
- package/schemas/dataset/dataset-deprecations.v1.schema.json +37 -0
- package/schemas/dataset/dataset-schema-governance.v1.schema.json +92 -0
- package/schemas/dataset/dataset-standards-exchange.v1.schema.json +59 -0
- package/schemas/dataset/profiles/openlineage-1.0.0.schema.json +15 -0
- package/schemas/dataset/profiles/prov-json-20130430.schema.json +12 -0
- package/schemas/dataset/run-ledger.v1.schema.json +39 -0
- package/schemas/dataset/source-adapter.v1.schema.json +112 -0
- package/tools/agents/deploy-agents.mjs +9 -3
- package/tools/agents/providers/pi.mjs +176 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import type { Digest, PrivacyClassification, ProcessingRun } from './types.js';
|
|
2
|
+
export declare const RUN_LEDGER_VERSION: "aiwg.run-ledger/v1";
|
|
3
|
+
export type RunLedgerVersion = typeof RUN_LEDGER_VERSION;
|
|
4
|
+
export type ProvenanceBasis = 'declared' | 'observed' | 'imported' | 'inferred';
|
|
5
|
+
export type PrincipalKind = 'person' | 'organization' | 'software' | 'service';
|
|
6
|
+
export interface StructuredLocator {
|
|
7
|
+
scheme: 'file' | 'uri' | 'json-pointer' | 'line-column' | 'record-key' | 'external-id';
|
|
8
|
+
value: string;
|
|
9
|
+
field?: string;
|
|
10
|
+
line?: number;
|
|
11
|
+
column?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface LedgerEntity {
|
|
14
|
+
recordType: 'entity';
|
|
15
|
+
id: string;
|
|
16
|
+
entityType: string;
|
|
17
|
+
revision?: string;
|
|
18
|
+
digest?: Digest;
|
|
19
|
+
privacy: PrivacyClassification;
|
|
20
|
+
retentionPolicy?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface LedgerActivity {
|
|
23
|
+
recordType: 'activity';
|
|
24
|
+
id: string;
|
|
25
|
+
activityType: string;
|
|
26
|
+
runId?: string;
|
|
27
|
+
startedAt?: string;
|
|
28
|
+
endedAt?: string;
|
|
29
|
+
planDigest?: Digest;
|
|
30
|
+
}
|
|
31
|
+
export interface LedgerAgent {
|
|
32
|
+
recordType: 'agent';
|
|
33
|
+
id: string;
|
|
34
|
+
principalKind: PrincipalKind;
|
|
35
|
+
version?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface LedgerEvidence {
|
|
38
|
+
recordType: 'evidence';
|
|
39
|
+
id: string;
|
|
40
|
+
source: StructuredLocator;
|
|
41
|
+
target?: StructuredLocator;
|
|
42
|
+
method: string;
|
|
43
|
+
confidence: number;
|
|
44
|
+
privacy: PrivacyClassification;
|
|
45
|
+
retentionPolicy?: string;
|
|
46
|
+
runId?: string;
|
|
47
|
+
responsibleAgentId: string;
|
|
48
|
+
observedAt: string;
|
|
49
|
+
}
|
|
50
|
+
export interface LedgerAssertion {
|
|
51
|
+
recordType: 'assertion';
|
|
52
|
+
id: string;
|
|
53
|
+
subjectId: string;
|
|
54
|
+
predicate: string;
|
|
55
|
+
objectId: string;
|
|
56
|
+
basis: ProvenanceBasis;
|
|
57
|
+
evidenceIds: string[];
|
|
58
|
+
activityId?: string;
|
|
59
|
+
runId?: string;
|
|
60
|
+
field?: string;
|
|
61
|
+
privacy: PrivacyClassification;
|
|
62
|
+
retentionPolicy?: string;
|
|
63
|
+
}
|
|
64
|
+
export interface LedgerCorrection {
|
|
65
|
+
recordType: 'correction';
|
|
66
|
+
id: string;
|
|
67
|
+
correctsEventId: string;
|
|
68
|
+
replacementEventId?: string;
|
|
69
|
+
reason: string;
|
|
70
|
+
responsibleAgentId: string;
|
|
71
|
+
}
|
|
72
|
+
export interface LedgerSupersession {
|
|
73
|
+
recordType: 'supersession';
|
|
74
|
+
id: string;
|
|
75
|
+
supersedesEventId: string;
|
|
76
|
+
successorEventId: string;
|
|
77
|
+
reason?: string;
|
|
78
|
+
}
|
|
79
|
+
export type LedgerRecord = LedgerEntity | LedgerActivity | LedgerAgent | LedgerEvidence | LedgerAssertion | LedgerCorrection | LedgerSupersession;
|
|
80
|
+
export interface LedgerEvent {
|
|
81
|
+
schemaVersion: RunLedgerVersion;
|
|
82
|
+
eventId: string;
|
|
83
|
+
runId?: string;
|
|
84
|
+
sequence: number;
|
|
85
|
+
recordedAt: string;
|
|
86
|
+
producer: {
|
|
87
|
+
id: string;
|
|
88
|
+
version: string;
|
|
89
|
+
};
|
|
90
|
+
record: LedgerRecord;
|
|
91
|
+
eventDigest: Digest;
|
|
92
|
+
}
|
|
93
|
+
export interface RunLedgerSnapshot {
|
|
94
|
+
schemaVersion: RunLedgerVersion;
|
|
95
|
+
events: LedgerEvent[];
|
|
96
|
+
}
|
|
97
|
+
export interface ProjectionLossItem {
|
|
98
|
+
path: string;
|
|
99
|
+
reason: string;
|
|
100
|
+
severity: 'information' | 'semantic' | 'privacy';
|
|
101
|
+
sourcePrivacy?: PrivacyClassification;
|
|
102
|
+
retentionPolicy?: string;
|
|
103
|
+
}
|
|
104
|
+
export interface ProjectionLossReport {
|
|
105
|
+
profile: string;
|
|
106
|
+
lossless: boolean;
|
|
107
|
+
items: ProjectionLossItem[];
|
|
108
|
+
}
|
|
109
|
+
export interface ProjectionResult<T> {
|
|
110
|
+
value: T;
|
|
111
|
+
loss: ProjectionLossReport;
|
|
112
|
+
}
|
|
113
|
+
export interface W3cProvProjection {
|
|
114
|
+
entity: Record<string, Record<string, unknown>>;
|
|
115
|
+
activity: Record<string, Record<string, unknown>>;
|
|
116
|
+
agent: Record<string, Record<string, unknown>>;
|
|
117
|
+
wasDerivedFrom: Array<{
|
|
118
|
+
generatedEntity: string;
|
|
119
|
+
usedEntity: string;
|
|
120
|
+
evidence?: string[];
|
|
121
|
+
}>;
|
|
122
|
+
wasGeneratedBy: Array<{
|
|
123
|
+
entity: string;
|
|
124
|
+
activity: string;
|
|
125
|
+
}>;
|
|
126
|
+
used: Array<{
|
|
127
|
+
activity: string;
|
|
128
|
+
entity: string;
|
|
129
|
+
evidence?: string[];
|
|
130
|
+
}>;
|
|
131
|
+
wasAssociatedWith: Array<{
|
|
132
|
+
activity: string;
|
|
133
|
+
agent: string;
|
|
134
|
+
}>;
|
|
135
|
+
wasAttributedTo: Array<{
|
|
136
|
+
entity: string;
|
|
137
|
+
agent: string;
|
|
138
|
+
}>;
|
|
139
|
+
}
|
|
140
|
+
export type LedgerProcessingRun = ProcessingRun;
|
|
141
|
+
//# sourceMappingURL=ledger-types.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type LedgerEvent, type LedgerRecord, type RunLedgerSnapshot } from './ledger-types.js';
|
|
2
|
+
export declare class RunLedgerError extends Error {
|
|
3
|
+
readonly code: string;
|
|
4
|
+
constructor(code: string, message: string);
|
|
5
|
+
}
|
|
6
|
+
export declare function computeLedgerEventDigest(event: Omit<LedgerEvent, 'eventDigest'>): LedgerEvent['eventDigest'];
|
|
7
|
+
export declare function createLedgerEvent(input: Omit<LedgerEvent, 'schemaVersion' | 'eventDigest'>): LedgerEvent;
|
|
8
|
+
export declare function verifyLedgerEventDigest(event: LedgerEvent): boolean;
|
|
9
|
+
export declare class RunLedger {
|
|
10
|
+
private readonly events;
|
|
11
|
+
private readonly eventIds;
|
|
12
|
+
private readonly recordIds;
|
|
13
|
+
append(event: LedgerEvent): {
|
|
14
|
+
appended: boolean;
|
|
15
|
+
event: LedgerEvent;
|
|
16
|
+
};
|
|
17
|
+
get(eventId: string): LedgerEvent | undefined;
|
|
18
|
+
snapshot(): RunLedgerSnapshot;
|
|
19
|
+
query(options?: {
|
|
20
|
+
runId?: string;
|
|
21
|
+
recordType?: LedgerRecord['recordType'];
|
|
22
|
+
afterSequence?: number;
|
|
23
|
+
limit?: number;
|
|
24
|
+
}): LedgerEvent[];
|
|
25
|
+
static replay(events: readonly LedgerEvent[]): RunLedger;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=ledger.d.ts.map
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { datasetDigest } from './contracts.js';
|
|
2
|
+
import { RUN_LEDGER_VERSION } from './ledger-types.js';
|
|
3
|
+
export class RunLedgerError extends Error {
|
|
4
|
+
code;
|
|
5
|
+
constructor(code, message) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.code = code;
|
|
8
|
+
this.name = 'RunLedgerError';
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export function computeLedgerEventDigest(event) { return datasetDigest(event); }
|
|
12
|
+
export function createLedgerEvent(input) { const event = { schemaVersion: RUN_LEDGER_VERSION, ...input }; return { ...event, eventDigest: computeLedgerEventDigest(event) }; }
|
|
13
|
+
export function verifyLedgerEventDigest(event) { const { eventDigest, ...content } = event; return eventDigest?.algorithm === 'sha256' && eventDigest.value === computeLedgerEventDigest(content).value; }
|
|
14
|
+
function references(record) {
|
|
15
|
+
switch (record.recordType) {
|
|
16
|
+
case 'evidence': return [record.responsibleAgentId];
|
|
17
|
+
case 'assertion': return [record.subjectId, record.objectId, ...record.evidenceIds, ...(record.activityId ? [record.activityId] : [])];
|
|
18
|
+
case 'correction': return [record.correctsEventId, ...(record.replacementEventId ? [record.replacementEventId] : []), record.responsibleAgentId];
|
|
19
|
+
case 'supersession': return [record.supersedesEventId, record.successorEventId];
|
|
20
|
+
default: return [];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function validateRecord(record) {
|
|
24
|
+
const supported = new Set(['entity', 'activity', 'agent', 'evidence', 'assertion', 'correction', 'supersession']);
|
|
25
|
+
if (!record || typeof record !== 'object' || !supported.has(record.recordType))
|
|
26
|
+
throw new RunLedgerError('RUN_LEDGER_RECORD_TYPE_UNSUPPORTED', 'record type is not part of the governed run-ledger vocabulary');
|
|
27
|
+
if (record.recordType === 'assertion' && record.basis === 'observed') {
|
|
28
|
+
if (!record.runId)
|
|
29
|
+
throw new RunLedgerError('RUN_LEDGER_OBSERVED_RUN_REQUIRED', 'observed assertions require run identity');
|
|
30
|
+
if (record.evidenceIds.length === 0)
|
|
31
|
+
throw new RunLedgerError('RUN_LEDGER_OBSERVED_EVIDENCE_REQUIRED', 'observed assertions require evidence');
|
|
32
|
+
}
|
|
33
|
+
if (record.recordType === 'evidence') {
|
|
34
|
+
if (record.confidence < 0 || record.confidence > 1)
|
|
35
|
+
throw new RunLedgerError('RUN_LEDGER_CONFIDENCE_INVALID', 'evidence confidence must be from 0 through 1');
|
|
36
|
+
for (const locator of [record.source, record.target].filter((value) => value !== undefined)) {
|
|
37
|
+
if (locator.value.includes('\0') || locator.value.includes('\n') || locator.value.includes('\r'))
|
|
38
|
+
throw new RunLedgerError('RUN_LEDGER_LOCATOR_INVALID', 'evidence locator contains control characters');
|
|
39
|
+
if (locator.scheme === 'file' && (locator.value.startsWith('/') || locator.value.split(/[\\/]/u).includes('..')))
|
|
40
|
+
throw new RunLedgerError('RUN_LEDGER_LOCATOR_INVALID', 'file evidence locator must be repository-relative without traversal');
|
|
41
|
+
if (locator.scheme === 'uri') {
|
|
42
|
+
try {
|
|
43
|
+
new URL(locator.value);
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
throw new RunLedgerError('RUN_LEDGER_LOCATOR_INVALID', 'URI evidence locator is malformed');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export class RunLedger {
|
|
53
|
+
events = [];
|
|
54
|
+
eventIds = new Map();
|
|
55
|
+
recordIds = new Map();
|
|
56
|
+
append(event) {
|
|
57
|
+
if (event.schemaVersion !== RUN_LEDGER_VERSION)
|
|
58
|
+
throw new RunLedgerError('RUN_LEDGER_VERSION_UNSUPPORTED', `unsupported ledger version ${event.schemaVersion}`);
|
|
59
|
+
validateRecord(event.record);
|
|
60
|
+
const globallyScoped = /^[A-Za-z][A-Za-z0-9+.-]*:.+$/u;
|
|
61
|
+
if (!globallyScoped.test(event.eventId))
|
|
62
|
+
throw new RunLedgerError('RUN_LEDGER_EVENT_ID_INVALID', `event ID ${event.eventId} must be globally scoped`);
|
|
63
|
+
const runIds = [event.runId, 'runId' in event.record ? event.record.runId : undefined].filter((value) => value !== undefined);
|
|
64
|
+
if (runIds.some((runId) => !globallyScoped.test(runId)))
|
|
65
|
+
throw new RunLedgerError('RUN_LEDGER_RUN_ID_INVALID', 'run IDs must be globally scoped');
|
|
66
|
+
if (!verifyLedgerEventDigest(event))
|
|
67
|
+
throw new RunLedgerError('RUN_LEDGER_DIGEST_MISMATCH', `event ${event.eventId} digest does not match immutable content`);
|
|
68
|
+
const existing = this.eventIds.get(event.eventId);
|
|
69
|
+
if (existing) {
|
|
70
|
+
if (existing.eventDigest.value === event.eventDigest.value)
|
|
71
|
+
return { appended: false, event: existing };
|
|
72
|
+
throw new RunLedgerError('RUN_LEDGER_EVENT_ID_CONFLICT', `event ID ${event.eventId} was reused with different content`);
|
|
73
|
+
}
|
|
74
|
+
if (event.sequence !== this.events.length + 1)
|
|
75
|
+
throw new RunLedgerError('RUN_LEDGER_SEQUENCE_INVALID', `expected sequence ${this.events.length + 1}; received ${event.sequence}`);
|
|
76
|
+
if (this.recordIds.has(event.record.id))
|
|
77
|
+
throw new RunLedgerError('RUN_LEDGER_RECORD_ID_CONFLICT', `record ID ${event.record.id} is immutable and already exists`);
|
|
78
|
+
const known = new Set([...this.eventIds.keys(), ...this.recordIds.keys()]);
|
|
79
|
+
const missing = references(event.record).filter((id) => !known.has(id));
|
|
80
|
+
if (missing.length)
|
|
81
|
+
throw new RunLedgerError('RUN_LEDGER_REFERENCE_DANGLING', `event ${event.eventId} has dangling references: ${missing.sort().join(', ')}`);
|
|
82
|
+
this.events.push(event);
|
|
83
|
+
this.eventIds.set(event.eventId, event);
|
|
84
|
+
this.recordIds.set(event.record.id, event);
|
|
85
|
+
return { appended: true, event };
|
|
86
|
+
}
|
|
87
|
+
get(eventId) { return this.eventIds.get(eventId); }
|
|
88
|
+
snapshot() { return { schemaVersion: RUN_LEDGER_VERSION, events: [...this.events] }; }
|
|
89
|
+
query(options = {}) {
|
|
90
|
+
const limit = options.limit ?? 100;
|
|
91
|
+
if (!Number.isInteger(limit) || limit < 1 || limit > 1000)
|
|
92
|
+
throw new RunLedgerError('RUN_LEDGER_QUERY_LIMIT_INVALID', 'limit must be from 1 through 1000');
|
|
93
|
+
if (options.afterSequence !== undefined && (!Number.isInteger(options.afterSequence) || options.afterSequence < 0))
|
|
94
|
+
throw new RunLedgerError('RUN_LEDGER_QUERY_CURSOR_INVALID', 'afterSequence must be a non-negative integer');
|
|
95
|
+
return this.events.filter((event) => (options.runId === undefined || event.runId === options.runId) && (options.recordType === undefined || event.record.recordType === options.recordType) && (options.afterSequence === undefined || event.sequence > options.afterSequence)).slice(0, limit);
|
|
96
|
+
}
|
|
97
|
+
static replay(events) { const ledger = new RunLedger(); for (const event of events)
|
|
98
|
+
ledger.append(event); return ledger; }
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=ledger.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DatasetExecutionBackend, ExecutionRequest, ExecutionResult } from "./orchestration-types.js";
|
|
2
|
+
export declare class LocalDatasetExecutionBackend implements DatasetExecutionBackend {
|
|
3
|
+
readonly id = "local";
|
|
4
|
+
capabilities(): {
|
|
5
|
+
name: string;
|
|
6
|
+
version: string;
|
|
7
|
+
}[];
|
|
8
|
+
execute(r: ExecutionRequest): Promise<ExecutionResult>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=local-execution-backend.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export class LocalDatasetExecutionBackend {
|
|
2
|
+
id = "local";
|
|
3
|
+
capabilities() {
|
|
4
|
+
return [
|
|
5
|
+
{ name: "incremental-read", version: "1" },
|
|
6
|
+
{ name: "materialize-records", version: "1" },
|
|
7
|
+
];
|
|
8
|
+
}
|
|
9
|
+
async execute(r) {
|
|
10
|
+
if (r.signal?.aborted)
|
|
11
|
+
return {
|
|
12
|
+
outcome: "cancelled",
|
|
13
|
+
attemptedRecords: 0,
|
|
14
|
+
committedRecords: 0,
|
|
15
|
+
rejectedRecords: 0,
|
|
16
|
+
diagnostics: [],
|
|
17
|
+
};
|
|
18
|
+
return {
|
|
19
|
+
outcome: "committed",
|
|
20
|
+
attemptedRecords: r.records.length,
|
|
21
|
+
committedRecords: r.records.length,
|
|
22
|
+
rejectedRecords: 0,
|
|
23
|
+
diagnostics: [],
|
|
24
|
+
artifact: {
|
|
25
|
+
id: `artifact:${r.plan.id}`,
|
|
26
|
+
revisionId: r.plan.planDigest.value,
|
|
27
|
+
records: r.records,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=local-execution-backend.js.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ProcessingPlan } from "./types.js";
|
|
2
|
+
import type { DatasetRunState, RegisteredSource } from "./orchestration-types.js";
|
|
3
|
+
export interface DatasetOrchestrationRepository {
|
|
4
|
+
getSource(id: string): Promise<RegisteredSource | undefined>;
|
|
5
|
+
putSource(source: RegisteredSource): Promise<void>;
|
|
6
|
+
getPlan(id: string): Promise<ProcessingPlan | undefined>;
|
|
7
|
+
putPlan(plan: ProcessingPlan): Promise<void>;
|
|
8
|
+
getRun(id: string): Promise<DatasetRunState | undefined>;
|
|
9
|
+
getRunByIdempotency(key: string): Promise<DatasetRunState | undefined>;
|
|
10
|
+
putRun(run: DatasetRunState): Promise<void>;
|
|
11
|
+
listArtifactRecords(id: string): Promise<readonly unknown[]>;
|
|
12
|
+
putArtifactRecords(id: string, records: readonly unknown[]): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export declare class MemoryDatasetOrchestrationRepository implements DatasetOrchestrationRepository {
|
|
15
|
+
sources: Map<string, RegisteredSource>;
|
|
16
|
+
plans: Map<string, ProcessingPlan>;
|
|
17
|
+
runs: Map<string, DatasetRunState>;
|
|
18
|
+
artifacts: Map<string, readonly unknown[]>;
|
|
19
|
+
getSource(id: string): Promise<RegisteredSource | undefined>;
|
|
20
|
+
putSource(v: RegisteredSource): Promise<void>;
|
|
21
|
+
getPlan(id: string): Promise<ProcessingPlan | undefined>;
|
|
22
|
+
putPlan(v: ProcessingPlan): Promise<void>;
|
|
23
|
+
getRun(id: string): Promise<DatasetRunState | undefined>;
|
|
24
|
+
getRunByIdempotency(key: string): Promise<DatasetRunState | undefined>;
|
|
25
|
+
putRun(v: DatasetRunState): Promise<void>;
|
|
26
|
+
listArtifactRecords(id: string): Promise<readonly unknown[]>;
|
|
27
|
+
putArtifactRecords(id: string, v: readonly unknown[]): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=orchestration-repository.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export class MemoryDatasetOrchestrationRepository {
|
|
2
|
+
sources = new Map();
|
|
3
|
+
plans = new Map();
|
|
4
|
+
runs = new Map();
|
|
5
|
+
artifacts = new Map();
|
|
6
|
+
async getSource(id) {
|
|
7
|
+
return this.sources.get(id);
|
|
8
|
+
}
|
|
9
|
+
async putSource(v) {
|
|
10
|
+
this.sources.set(v.id, structuredClone(v));
|
|
11
|
+
}
|
|
12
|
+
async getPlan(id) {
|
|
13
|
+
return this.plans.get(id);
|
|
14
|
+
}
|
|
15
|
+
async putPlan(v) {
|
|
16
|
+
this.plans.set(v.id, structuredClone(v));
|
|
17
|
+
}
|
|
18
|
+
async getRun(id) {
|
|
19
|
+
return this.runs.get(id);
|
|
20
|
+
}
|
|
21
|
+
async getRunByIdempotency(key) {
|
|
22
|
+
return [...this.runs.values()].find((v) => v.idempotencyKey === key);
|
|
23
|
+
}
|
|
24
|
+
async putRun(v) {
|
|
25
|
+
this.runs.set(v.runId, structuredClone(v));
|
|
26
|
+
}
|
|
27
|
+
async listArtifactRecords(id) {
|
|
28
|
+
return this.artifacts.get(id) ?? [];
|
|
29
|
+
}
|
|
30
|
+
async putArtifactRecords(id, v) {
|
|
31
|
+
this.artifacts.set(id, structuredClone(v));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=orchestration-repository.js.map
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { DatasetOrchestrationRepository } from "./orchestration-repository.js";
|
|
2
|
+
import { type CapabilityProfile, type ProcessingPlan } from "./types.js";
|
|
3
|
+
import { type DatasetOrchestrationDependencies, type DatasetResult, type RegisteredSource } from "./orchestration-types.js";
|
|
4
|
+
export declare class DatasetOrchestrationError extends Error {
|
|
5
|
+
readonly code: string;
|
|
6
|
+
readonly boundary: DatasetResult["diagnostics"][number]["boundary"];
|
|
7
|
+
readonly retryable: boolean;
|
|
8
|
+
constructor(code: string, message: string, boundary?: DatasetResult["diagnostics"][number]["boundary"], retryable?: boolean);
|
|
9
|
+
}
|
|
10
|
+
export declare class DatasetOrchestrationService {
|
|
11
|
+
private readonly repo;
|
|
12
|
+
private readonly deps;
|
|
13
|
+
constructor(repo: DatasetOrchestrationRepository, deps: DatasetOrchestrationDependencies);
|
|
14
|
+
private now;
|
|
15
|
+
private offlineRemote;
|
|
16
|
+
source(source: RegisteredSource): Promise<DatasetResult<unknown>>;
|
|
17
|
+
private context;
|
|
18
|
+
check(id: string, offline?: boolean): Promise<DatasetResult<unknown>>;
|
|
19
|
+
preview(id: string, count?: number, offline?: boolean, signal?: AbortSignal): Promise<DatasetResult<unknown>>;
|
|
20
|
+
plan(input: {
|
|
21
|
+
id: string;
|
|
22
|
+
sourceId: string;
|
|
23
|
+
profile: CapabilityProfile;
|
|
24
|
+
schemas: ProcessingPlan["schemas"];
|
|
25
|
+
policy: ProcessingPlan["policy"];
|
|
26
|
+
backend?: "local" | "fortemi-core";
|
|
27
|
+
fallback?: "local";
|
|
28
|
+
estimates?: ProcessingPlan["estimates"];
|
|
29
|
+
approvals?: ProcessingPlan["approvals"];
|
|
30
|
+
reconciliation?: ProcessingPlan["reconciliation"];
|
|
31
|
+
steps: ProcessingPlan["steps"];
|
|
32
|
+
artifactClasses: ProcessingPlan["artifactClasses"];
|
|
33
|
+
createdBy: string;
|
|
34
|
+
offline?: boolean;
|
|
35
|
+
}): Promise<DatasetResult<unknown>>;
|
|
36
|
+
ingest(input: {
|
|
37
|
+
planId: string;
|
|
38
|
+
planDigest: string;
|
|
39
|
+
idempotencyKey: string;
|
|
40
|
+
approvalIds?: string[];
|
|
41
|
+
reconciliationApproval?: {
|
|
42
|
+
previewDigest: string;
|
|
43
|
+
threshold: number;
|
|
44
|
+
};
|
|
45
|
+
signal?: AbortSignal;
|
|
46
|
+
}): Promise<DatasetResult<unknown>>;
|
|
47
|
+
status(runId: string): Promise<DatasetResult<unknown>>;
|
|
48
|
+
show(id: string): Promise<DatasetResult<unknown>>;
|
|
49
|
+
verify(runId: string): Promise<DatasetResult<unknown>>;
|
|
50
|
+
query(artifactId: string): Promise<DatasetResult<unknown>>;
|
|
51
|
+
lineage(runId: string): Promise<DatasetResult<unknown>>;
|
|
52
|
+
export(artifactId: string): Promise<DatasetResult<unknown>>;
|
|
53
|
+
cancel(runId: string): Promise<DatasetResult<unknown>>;
|
|
54
|
+
retry(runId: string, signal?: AbortSignal): Promise<DatasetResult<unknown>>;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=orchestration-service.d.ts.map
|