@dsh-enhanced/assistant-recovery 0.1.12
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/LICENSE +21 -0
- package/README.md +178 -0
- package/cordis.patch.yml +14 -0
- package/lib/attestation.d.ts +18 -0
- package/lib/attestation.d.ts.map +1 -0
- package/lib/attestation.js +80 -0
- package/lib/attestation.js.map +1 -0
- package/lib/automation-executor.d.ts +21 -0
- package/lib/automation-executor.d.ts.map +1 -0
- package/lib/automation-executor.js +141 -0
- package/lib/automation-executor.js.map +1 -0
- package/lib/catalog.d.ts +16 -0
- package/lib/catalog.d.ts.map +1 -0
- package/lib/catalog.js +49 -0
- package/lib/catalog.js.map +1 -0
- package/lib/config.d.ts +34 -0
- package/lib/config.d.ts.map +1 -0
- package/lib/config.js +101 -0
- package/lib/config.js.map +1 -0
- package/lib/executor.d.ts +50 -0
- package/lib/executor.d.ts.map +1 -0
- package/lib/executor.js +413 -0
- package/lib/executor.js.map +1 -0
- package/lib/index.d.ts +21 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +26 -0
- package/lib/index.js.map +1 -0
- package/lib/port.d.ts +125 -0
- package/lib/port.d.ts.map +1 -0
- package/lib/port.js +706 -0
- package/lib/port.js.map +1 -0
- package/lib/service.d.ts +46 -0
- package/lib/service.d.ts.map +1 -0
- package/lib/service.js +549 -0
- package/lib/service.js.map +1 -0
- package/lib/sqlite.d.ts +9 -0
- package/lib/sqlite.d.ts.map +1 -0
- package/lib/sqlite.js +247 -0
- package/lib/sqlite.js.map +1 -0
- package/lib/store.d.ts +79 -0
- package/lib/store.d.ts.map +1 -0
- package/lib/store.js +806 -0
- package/lib/store.js.map +1 -0
- package/lib/types.d.ts +157 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +3 -0
- package/lib/types.js.map +1 -0
- package/lib/version.d.ts +2 -0
- package/lib/version.d.ts.map +1 -0
- package/lib/version.js +2 -0
- package/lib/version.js.map +1 -0
- package/package.json +96 -0
package/lib/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AssistantRecoveryService, Config } from './service.js';
|
|
2
|
+
import { version } from './version.js';
|
|
3
|
+
export const name = 'dsh-enhanced-assistant-recovery';
|
|
4
|
+
export const inject = [
|
|
5
|
+
'assistantAutomations',
|
|
6
|
+
'assistantDelivery',
|
|
7
|
+
'assistantEvaluation',
|
|
8
|
+
'assistantEvolution',
|
|
9
|
+
'assistantPreferenceLearning',
|
|
10
|
+
'assistantHealth',
|
|
11
|
+
];
|
|
12
|
+
export { AssistantRecoveryService, Config, version };
|
|
13
|
+
export * from './attestation.js';
|
|
14
|
+
export * from './automation-executor.js';
|
|
15
|
+
export * from './catalog.js';
|
|
16
|
+
export { ConfigSchema, normalizeRecoveryConfig, } from './config.js';
|
|
17
|
+
export * from './executor.js';
|
|
18
|
+
export * from './port.js';
|
|
19
|
+
export { AssistantRecoveryError, recoveryActivationPlanDigest, recoveryAutomationDefinition, recoveryAutomationId, } from './service.js';
|
|
20
|
+
export * from './store.js';
|
|
21
|
+
export * from './types.js';
|
|
22
|
+
export function apply(ctx, config) {
|
|
23
|
+
new AssistantRecoveryService(ctx, config);
|
|
24
|
+
}
|
|
25
|
+
export default AssistantRecoveryService;
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE/D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,CAAC,MAAM,IAAI,GAAG,iCAAiC,CAAA;AACrD,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,sBAAsB;IACtB,mBAAmB;IACnB,qBAAqB;IACrB,oBAAoB;IACpB,6BAA6B;IAC7B,iBAAiB;CAClB,CAAA;AACD,OAAO,EAAE,wBAAwB,EAAE,MAAM,EAAE,OAAO,EAAE,CAAA;AAEpD,cAAc,kBAAkB,CAAA;AAChC,cAAc,0BAA0B,CAAA;AACxC,cAAc,cAAc,CAAA;AAC5B,OAAO,EACL,YAAY,EACZ,uBAAuB,GACxB,MAAM,aAAa,CAAA;AAOpB,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,OAAO,EACL,sBAAsB,EACtB,4BAA4B,EAC5B,4BAA4B,EAC5B,oBAAoB,GACrB,MAAM,cAAc,CAAA;AACrB,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAE1B,MAAM,UAAU,KAAK,CAAC,GAAY,EAAE,MAAkB;IACpD,IAAI,wBAAwB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;AAC3C,CAAC;AAED,eAAe,wBAAwB,CAAA"}
|
package/lib/port.d.ts
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { AssistantAutomationsService } from '@dsh-enhanced/assistant-automations';
|
|
2
|
+
import { canonicalEvaluationHostScope, type AssistantEvaluationService } from '@dsh-enhanced/assistant-evaluation';
|
|
3
|
+
import { type AssistantEvolutionService } from '@dsh-enhanced/assistant-evolution';
|
|
4
|
+
import type { AssistantHealthService } from '@dsh-enhanced/assistant-health';
|
|
5
|
+
import { canonicalPreferenceHostScope, type PreferenceLearningService } from '@dsh-enhanced/preference-learning';
|
|
6
|
+
import type { RecoveryActionReceipt, RecoveryExecutionContext, RecoveryRunbookPort, RecoveryStepPlan } from './executor.js';
|
|
7
|
+
import type { NormalizedRecoveryJob } from './config.js';
|
|
8
|
+
import { type RecoveryStepAction, type RecoveryStepId } from './types.js';
|
|
9
|
+
export declare const RECOVERY_SYSTEM_OWNER: "dsh-enhanced-assistant-recovery";
|
|
10
|
+
/**
|
|
11
|
+
* Evaluation owns the cross-ledger claim/settle receipt. Keeping this
|
|
12
|
+
* structural lets Recovery remain compatible while the optional projection
|
|
13
|
+
* outbox is rolled out independently from the core Evaluation ledger.
|
|
14
|
+
*/
|
|
15
|
+
export interface RecoveryEvaluationProjectionPort {
|
|
16
|
+
peekPendingProjection?(input: {
|
|
17
|
+
scope: ReturnType<typeof canonicalEvaluationHostScope>;
|
|
18
|
+
}): {
|
|
19
|
+
evaluationId: string;
|
|
20
|
+
attemptCount: number;
|
|
21
|
+
} | undefined;
|
|
22
|
+
reconcileProjection?(input: {
|
|
23
|
+
scope: ReturnType<typeof canonicalEvaluationHostScope>;
|
|
24
|
+
evaluationId: string;
|
|
25
|
+
operationId: string;
|
|
26
|
+
}): Promise<{
|
|
27
|
+
evaluationId: string;
|
|
28
|
+
status: 'deferred' | 'recorded';
|
|
29
|
+
attemptCount: number;
|
|
30
|
+
}>;
|
|
31
|
+
}
|
|
32
|
+
export interface RecoveryRuntimePorts {
|
|
33
|
+
automations: Pick<AssistantAutomationsService, 'inspectSystemOwned'> & {
|
|
34
|
+
/** Atomic durable arm + production canary seam. Arm-only repair is unsafe. */
|
|
35
|
+
probeCircuitAndScheduleCanary?: (input: {
|
|
36
|
+
owner: string;
|
|
37
|
+
operationId: string;
|
|
38
|
+
automationId: string;
|
|
39
|
+
definitionHash: string;
|
|
40
|
+
expectedCircuitVersion: number;
|
|
41
|
+
leaseMs?: number;
|
|
42
|
+
}) => {
|
|
43
|
+
operationId: string;
|
|
44
|
+
circuit: {
|
|
45
|
+
automationId: string;
|
|
46
|
+
definitionHash: string;
|
|
47
|
+
state: string;
|
|
48
|
+
version: number;
|
|
49
|
+
};
|
|
50
|
+
occurrenceId: string;
|
|
51
|
+
taskId: string;
|
|
52
|
+
executionMode: 'production';
|
|
53
|
+
replayed: boolean;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
delivery: {
|
|
57
|
+
validateOwnerRoute(input: {
|
|
58
|
+
authorityId: string;
|
|
59
|
+
principalId: string;
|
|
60
|
+
workspace: string;
|
|
61
|
+
agentPreset: string;
|
|
62
|
+
}): Readonly<{
|
|
63
|
+
receiptVersion: 2;
|
|
64
|
+
authorityId: string;
|
|
65
|
+
authorityHash: string;
|
|
66
|
+
principalId: string;
|
|
67
|
+
principalRecordId: string;
|
|
68
|
+
principalVersion: number;
|
|
69
|
+
workspace: string;
|
|
70
|
+
agentPreset: string;
|
|
71
|
+
bindingVersion: number;
|
|
72
|
+
generation: number;
|
|
73
|
+
}>;
|
|
74
|
+
};
|
|
75
|
+
evaluation: Pick<AssistantEvaluationService, 'health'> & RecoveryEvaluationProjectionPort;
|
|
76
|
+
evolution: Pick<AssistantEvolutionService, 'hostCandidates' | 'hostListRules' | 'hostRollbackOne'>;
|
|
77
|
+
preference: Pick<PreferenceLearningService, 'health' | 'hostActivationCandidate' | 'hostActivateOne' | 'hostMaintainOne' | 'hostReview'> & {
|
|
78
|
+
hostOwnerFence(input: {
|
|
79
|
+
scope: ReturnType<typeof canonicalPreferenceHostScope>;
|
|
80
|
+
principal: string;
|
|
81
|
+
principalLineage: Readonly<{
|
|
82
|
+
principalRecordId: string;
|
|
83
|
+
principalVersion: number;
|
|
84
|
+
}>;
|
|
85
|
+
operationId: string;
|
|
86
|
+
}): Readonly<{
|
|
87
|
+
ownerGeneration: number;
|
|
88
|
+
principalLineage: Readonly<{
|
|
89
|
+
principalRecordId: string;
|
|
90
|
+
principalVersion: number;
|
|
91
|
+
}>;
|
|
92
|
+
}>;
|
|
93
|
+
};
|
|
94
|
+
health: Pick<AssistantHealthService, 'hostGlobalSnapshot'>;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Concrete, model-free adapter over the narrow Host seams of the learning
|
|
98
|
+
* services. Planning may inspect only the configured scope; mutations are
|
|
99
|
+
* exact CAS/idempotent operations selected before Recovery persists intent.
|
|
100
|
+
*/
|
|
101
|
+
export declare class HostRecoveryRunbookPort implements RecoveryRunbookPort {
|
|
102
|
+
private readonly runtime;
|
|
103
|
+
private readonly jobs;
|
|
104
|
+
private readonly activationPlanDigests;
|
|
105
|
+
private readonly authorityHashes;
|
|
106
|
+
constructor(jobs: ReadonlyMap<string, NormalizedRecoveryJob>, runtime: RecoveryRuntimePorts, activationPlanDigests: ReadonlyMap<string, string>, authorityHashes: ReadonlyMap<string, string>);
|
|
107
|
+
private validateOwnerRoute;
|
|
108
|
+
plan(context: RecoveryExecutionContext, stepId: RecoveryStepId, signal: AbortSignal): Promise<RecoveryStepPlan>;
|
|
109
|
+
execute(context: RecoveryExecutionContext, stepId: RecoveryStepId, action: RecoveryStepAction, idempotencyKey: string, signal: AbortSignal): Promise<RecoveryActionReceipt>;
|
|
110
|
+
private planAuthority;
|
|
111
|
+
private planLedger;
|
|
112
|
+
private planRetention;
|
|
113
|
+
private planPreferenceActivation;
|
|
114
|
+
private planEvolutionRollback;
|
|
115
|
+
private planCircuitProbe;
|
|
116
|
+
private planVerification;
|
|
117
|
+
private verifyAuthority;
|
|
118
|
+
private projectEvaluation;
|
|
119
|
+
private maintainPreferences;
|
|
120
|
+
private activatePreference;
|
|
121
|
+
private rollbackEvolution;
|
|
122
|
+
private probeCircuit;
|
|
123
|
+
private verifyHealth;
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=port.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"port.d.ts","sourceRoot":"","sources":["../src/port.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,2BAA2B,EAE5B,MAAM,qCAAqC,CAAA;AAC5C,OAAO,EACL,4BAA4B,EAC5B,KAAK,0BAA0B,EAChC,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EAEL,KAAK,yBAAyB,EAG/B,MAAM,mCAAmC,CAAA;AAC1C,OAAO,KAAK,EAEV,sBAAsB,EACvB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EACL,4BAA4B,EAC5B,KAAK,yBAAyB,EAC/B,MAAM,mCAAmC,CAAA;AAC1C,OAAO,KAAK,EACV,qBAAqB,EACrB,wBAAwB,EACxB,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,e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