@acme-engine/core 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.
Files changed (137) hide show
  1. package/dist/common.d.ts +40 -0
  2. package/dist/common.d.ts.map +1 -0
  3. package/dist/common.js +2 -0
  4. package/dist/common.js.map +1 -0
  5. package/dist/contracts.d.ts +65 -0
  6. package/dist/contracts.d.ts.map +1 -0
  7. package/dist/contracts.js +2 -0
  8. package/dist/contracts.js.map +1 -0
  9. package/dist/errors.d.ts +24 -0
  10. package/dist/errors.d.ts.map +1 -0
  11. package/dist/errors.js +20 -0
  12. package/dist/errors.js.map +1 -0
  13. package/dist/evaluation.d.ts +14 -0
  14. package/dist/evaluation.d.ts.map +1 -0
  15. package/dist/evaluation.js +2 -0
  16. package/dist/evaluation.js.map +1 -0
  17. package/dist/execution-engine.d.ts +30 -0
  18. package/dist/execution-engine.d.ts.map +1 -0
  19. package/dist/execution-engine.js +885 -0
  20. package/dist/execution-engine.js.map +1 -0
  21. package/dist/execution-identity.d.ts +35 -0
  22. package/dist/execution-identity.d.ts.map +1 -0
  23. package/dist/execution-identity.js +177 -0
  24. package/dist/execution-identity.js.map +1 -0
  25. package/dist/execution-status.d.ts +2 -0
  26. package/dist/execution-status.d.ts.map +1 -0
  27. package/dist/execution-status.js +2 -0
  28. package/dist/execution-status.js.map +1 -0
  29. package/dist/execution-types.d.ts +58 -0
  30. package/dist/execution-types.d.ts.map +1 -0
  31. package/dist/execution-types.js +2 -0
  32. package/dist/execution-types.js.map +1 -0
  33. package/dist/hashing.d.ts +6 -0
  34. package/dist/hashing.d.ts.map +1 -0
  35. package/dist/hashing.js +73 -0
  36. package/dist/hashing.js.map +1 -0
  37. package/dist/index.d.ts +34 -0
  38. package/dist/index.d.ts.map +1 -0
  39. package/dist/index.js +33 -0
  40. package/dist/index.js.map +1 -0
  41. package/dist/memory-engine.d.ts +13 -0
  42. package/dist/memory-engine.d.ts.map +1 -0
  43. package/dist/memory-engine.js +591 -0
  44. package/dist/memory-engine.js.map +1 -0
  45. package/dist/memory.d.ts +151 -0
  46. package/dist/memory.d.ts.map +1 -0
  47. package/dist/memory.js +2 -0
  48. package/dist/memory.js.map +1 -0
  49. package/dist/model-call-usage.d.ts +40 -0
  50. package/dist/model-call-usage.d.ts.map +1 -0
  51. package/dist/model-call-usage.js +0 -0
  52. package/dist/model-call-usage.js.map +1 -0
  53. package/dist/model-execution-engine.d.ts +16 -0
  54. package/dist/model-execution-engine.d.ts.map +1 -0
  55. package/dist/model-execution-engine.js +598 -0
  56. package/dist/model-execution-engine.js.map +1 -0
  57. package/dist/model-execution-identity.d.ts +16 -0
  58. package/dist/model-execution-identity.d.ts.map +1 -0
  59. package/dist/model-execution-identity.js +84 -0
  60. package/dist/model-execution-identity.js.map +1 -0
  61. package/dist/model-execution-types.d.ts +66 -0
  62. package/dist/model-execution-types.d.ts.map +1 -0
  63. package/dist/model-execution-types.js +8 -0
  64. package/dist/model-execution-types.js.map +1 -0
  65. package/dist/model-gateway-router.d.ts +11 -0
  66. package/dist/model-gateway-router.d.ts.map +1 -0
  67. package/dist/model-gateway-router.js +69 -0
  68. package/dist/model-gateway-router.js.map +1 -0
  69. package/dist/model-request-hash.d.ts +5 -0
  70. package/dist/model-request-hash.d.ts.map +1 -0
  71. package/dist/model-request-hash.js +11 -0
  72. package/dist/model-request-hash.js.map +1 -0
  73. package/dist/model-response-hash.d.ts +5 -0
  74. package/dist/model-response-hash.d.ts.map +1 -0
  75. package/dist/model-response-hash.js +11 -0
  76. package/dist/model-response-hash.js.map +1 -0
  77. package/dist/model-validation.d.ts +11 -0
  78. package/dist/model-validation.d.ts.map +1 -0
  79. package/dist/model-validation.js +580 -0
  80. package/dist/model-validation.js.map +1 -0
  81. package/dist/model.d.ts +125 -0
  82. package/dist/model.d.ts.map +1 -0
  83. package/dist/model.js +4 -0
  84. package/dist/model.js.map +1 -0
  85. package/dist/modules.d.ts +83 -0
  86. package/dist/modules.d.ts.map +1 -0
  87. package/dist/modules.js +7 -0
  88. package/dist/modules.js.map +1 -0
  89. package/dist/outbox.d.ts +88 -0
  90. package/dist/outbox.d.ts.map +1 -0
  91. package/dist/outbox.js +180 -0
  92. package/dist/outbox.js.map +1 -0
  93. package/dist/payload-encryptor.d.ts +92 -0
  94. package/dist/payload-encryptor.d.ts.map +1 -0
  95. package/dist/payload-encryptor.js +173 -0
  96. package/dist/payload-encryptor.js.map +1 -0
  97. package/dist/registries.d.ts +5 -0
  98. package/dist/registries.d.ts.map +1 -0
  99. package/dist/registries.js +159 -0
  100. package/dist/registries.js.map +1 -0
  101. package/dist/repository-digest.d.ts +5 -0
  102. package/dist/repository-digest.d.ts.map +1 -0
  103. package/dist/repository-digest.js +25 -0
  104. package/dist/repository-digest.js.map +1 -0
  105. package/dist/repository-model-call.d.ts +43 -0
  106. package/dist/repository-model-call.d.ts.map +1 -0
  107. package/dist/repository-model-call.js +2 -0
  108. package/dist/repository-model-call.js.map +1 -0
  109. package/dist/repository-model-execution.d.ts +49 -0
  110. package/dist/repository-model-execution.d.ts.map +1 -0
  111. package/dist/repository-model-execution.js +2 -0
  112. package/dist/repository-model-execution.js.map +1 -0
  113. package/dist/repository.d.ts +260 -0
  114. package/dist/repository.d.ts.map +1 -0
  115. package/dist/repository.js +2 -0
  116. package/dist/repository.js.map +1 -0
  117. package/dist/response-pipeline.d.ts +3 -0
  118. package/dist/response-pipeline.d.ts.map +1 -0
  119. package/dist/response-pipeline.js +132 -0
  120. package/dist/response-pipeline.js.map +1 -0
  121. package/dist/state-engine.d.ts +19 -0
  122. package/dist/state-engine.d.ts.map +1 -0
  123. package/dist/state-engine.js +272 -0
  124. package/dist/state-engine.js.map +1 -0
  125. package/dist/state-projection.d.ts +5 -0
  126. package/dist/state-projection.d.ts.map +1 -0
  127. package/dist/state-projection.js +145 -0
  128. package/dist/state-projection.js.map +1 -0
  129. package/dist/state.d.ts +41 -0
  130. package/dist/state.d.ts.map +1 -0
  131. package/dist/state.js +2 -0
  132. package/dist/state.js.map +1 -0
  133. package/dist/stranded-execution.d.ts +59 -0
  134. package/dist/stranded-execution.d.ts.map +1 -0
  135. package/dist/stranded-execution.js +235 -0
  136. package/dist/stranded-execution.js.map +1 -0
  137. package/package.json +36 -0
@@ -0,0 +1,40 @@
1
+ import type { z } from 'zod';
2
+ export type JsonPrimitive = string | number | boolean | null;
3
+ export type JsonValue = JsonPrimitive | readonly JsonValue[] | {
4
+ readonly [key: string]: JsonValue;
5
+ };
6
+ export type Schema<T> = z.ZodType<T>;
7
+ export type ExecutionId = string;
8
+ export type ModelCallId = string;
9
+ export type EntityId = string;
10
+ export type Namespace = string;
11
+ export type RequestKey = string;
12
+ export type IsoTimestamp = string;
13
+ export interface Clock {
14
+ now(): IsoTimestamp;
15
+ }
16
+ export interface IdGenerator {
17
+ next(kind: 'execution' | 'call' | 'document' | 'memory' | 'event'): string;
18
+ }
19
+ export interface Hashing {
20
+ canonicalJson(value: JsonValue): string;
21
+ sha256(value: string | Uint8Array): string;
22
+ }
23
+ export interface DiagnosticFact {
24
+ readonly code: string;
25
+ readonly severity: 'debug' | 'info' | 'warning' | 'error';
26
+ readonly value?: JsonValue;
27
+ }
28
+ export interface StoredDocument {
29
+ readonly documentId: string;
30
+ readonly executionId: ExecutionId;
31
+ readonly namespace: Namespace;
32
+ readonly entityId: EntityId;
33
+ readonly key: string;
34
+ readonly kind: string;
35
+ readonly schemaVersion: string;
36
+ readonly value: JsonValue;
37
+ readonly contentHash: string;
38
+ readonly createdAt: IsoTimestamp;
39
+ }
40
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAE7D,MAAM,MAAM,SAAS,GACnB,aAAa,G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AC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;CAClC"}
package/dist/common.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":""}
@@ -0,0 +1,65 @@
1
+ import type { ExecutionId, Hashing, IsoTimestamp, Schema } from './common.js';
2
+ import type { ModelCapabilities, ModelRequest, NormalizedModelResponse } from './model.js';
3
+ export interface ContractRef {
4
+ readonly id: string;
5
+ readonly version: string;
6
+ }
7
+ export interface SemanticIssue {
8
+ readonly code: string;
9
+ readonly path: readonly (string | number)[];
10
+ readonly message: string;
11
+ readonly severity: 'error' | 'warning';
12
+ }
13
+ export interface ContractBuildContext {
14
+ readonly executionId: ExecutionId;
15
+ readonly now: IsoTimestamp;
16
+ }
17
+ export interface PromptContract<TInput, TOutput> {
18
+ readonly ref: ContractRef;
19
+ readonly inputSchema: Schema<TInput>;
20
+ readonly outputSchema: Schema<TOutput>;
21
+ readonly requiredCapabilities: Partial<ModelCapabilities>;
22
+ readonly retention: 'none' | 'hash-only' | 'encrypted-payload';
23
+ buildRequest(input: TInput, context: ContractBuildContext): ModelRequest;
24
+ /**
25
+ * Optional bounded repair request for a recoverably invalid response.
26
+ *
27
+ * ADR-0045 §5. Prompt authorship stays with the contract: core decides
28
+ * whether a repair is permitted and budgeted, never what it says. A contract
29
+ * without this method is never repaired and its repair budget goes unused.
30
+ *
31
+ * The issues are the pipeline's own, and the returned request must target the
32
+ * same schema as `buildRequest`.
33
+ */
34
+ buildRepairRequest?(input: TInput, context: ContractRepairContext): ModelRequest;
35
+ validateSemantics(output: TOutput, input: TInput): readonly SemanticIssue[];
36
+ }
37
+ export interface ContractRepairContext extends ContractBuildContext {
38
+ readonly attempt: number;
39
+ readonly issues: readonly SemanticIssue[];
40
+ }
41
+ export interface ContractRegistry {
42
+ get<TInput, TOutput>(ref: ContractRef): PromptContract<TInput, TOutput>;
43
+ has(ref: ContractRef): boolean;
44
+ fingerprint(ref: ContractRef): string;
45
+ list(): readonly ContractRef[];
46
+ }
47
+ export type PipelineResult<T> = {
48
+ readonly ok: true;
49
+ readonly value: T;
50
+ readonly warnings: readonly SemanticIssue[];
51
+ readonly parsedHash: string;
52
+ } | {
53
+ readonly ok: false;
54
+ readonly stage: 'input' | 'empty' | 'parse' | 'schema' | 'semantic';
55
+ readonly issues: readonly SemanticIssue[];
56
+ readonly repairable: boolean;
57
+ };
58
+ export interface ResponsePipeline {
59
+ process<TInput, TOutput>(response: NormalizedModelResponse, contract: PromptContract<TInput, TOutput>, input: TInput): PipelineResult<TOutput>;
60
+ }
61
+ export interface ResponsePipelineOptions {
62
+ readonly hashing?: Hashing;
63
+ }
64
+ export type AnyPromptContract = PromptContract<any, any>;
65
+ //# sourceMappingURL=contracts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EACZ,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,MAAM,GAAG,M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B,WAAW,CAAC,GAAG,EAAE,WAAW,GAAG,MAAM,CAAC;IACtC,IAAI,IAAI,SAAS,WAAW,EAAE,CAAC;CAChC;AAED,MAAM,MAAM,cAAc,CAAC,CAAC,IACxB;IACE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAClB,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAClB,QAAQ,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,CAAC;IAC5C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B,GACD;IACE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,UAAU,CAAC;IACpE,QAAQ,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;IAC1C,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;CAC9B,CAAC;AAEN,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,MAAM,EAAE,OAAO,EACrB,QAAQ,EAAE,uBAAuB,EACjC,QAAQ,EAAE,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,EACzC,KAAK,EAAE,MAAM,GACZ,cAAc,CAAC,OAAO,CAAC,CAAC;CAC5B;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAID,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=contracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":""}
@@ -0,0 +1,24 @@
1
+ import type { JsonValue } from './common.js';
2
+ import type { ExecutionStatus } from './execution-status.js';
3
+ export type AcmeErrorCode = 'INVALID_REQUEST' | 'NOT_FOUND_MODULE' | 'NOT_FOUND_TASK' | 'NOT_FOUND_CONTRACT' | 'UNSUPPORTED_CAPABILITY' | 'CONFLICT_IDEMPOTENCY_KEY' | 'CONFLICT_STATE_REVISION' | 'CONFLICT_MEMORY_VERSION' | 'BUDGET_EXCEEDED' | 'CANCELLED' | 'TIMEOUT' | 'MODEL_RATE_LIMIT' | 'MODEL_AUTH' | 'MODEL_UNAVAILABLE' | 'MODEL_CONTENT_FILTER' | 'MODEL_INVALID_RESPONSE' | 'DOMAIN_INVALID_RESULT' | 'EVALUATION_BLOCKED' | 'RESUME_EVIDENCE_UNAVAILABLE' | 'PERSISTENCE_TRANSIENT' | 'PERSISTENCE_CORRUPTION' | 'INTERNAL';
4
+ export interface AcmeErrorData {
5
+ readonly code: AcmeErrorCode;
6
+ readonly message: string;
7
+ readonly stage: ExecutionStatus;
8
+ readonly retryable: boolean;
9
+ readonly details?: JsonValue;
10
+ readonly causeRef?: string;
11
+ }
12
+ export declare class AcmeError extends Error {
13
+ readonly data: AcmeErrorData;
14
+ constructor(data: AcmeErrorData, options?: ErrorOptions);
15
+ }
16
+ /**
17
+ * Raised when a model call may have executed at the provider. ADR-0014 makes
18
+ * this terminal for its execution and never automatically retried.
19
+ */
20
+ export declare class AmbiguousModelCallError extends AcmeError {
21
+ readonly ambiguous: true;
22
+ constructor(data: AcmeErrorData, options?: ErrorOptions);
23
+ }
24
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,MAAM,MAAM,aAAa,GACrB,iBAAiB,GACjB,kBAAkB,GAClB,gBAAgB,GAChB,oBAAoB,GACpB,wBAAwB,GACxB,0BAA0B,GAC1B,yBAAyB,GACzB,yBAAyB,GACzB,iBAAiB,GACjB,WAAW,GACX,SAAS,GACT,kBAAkB,GAClB,YAAY,GACZ,mBAAmB,GACnB,sBAAsB,GACtB,wBAAwB,GACxB,uBAAuB,GACvB,oBAAoB,GACpB,6BAA6B,GAC7B,uBAAuB,GACvB,wBAAwB,GACxB,UAAU,CAAC;AAEf,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,qBAAa,SAAU,SAAQ,KAAK;IAClC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;gBAEjB,IAAI,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,YAAY;CAKxD;AAED;;;GAGG;AACH,qBAAa,uBAAwB,SAAQ,SAAS;IACpD,QAAQ,CAAC,SAAS,EAAG,IAAI,CAAU;gBAEvB,IAAI,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,YAAY;CAIxD"}
package/dist/errors.js ADDED
@@ -0,0 +1,20 @@
1
+ export class AcmeError extends Error {
2
+ data;
3
+ constructor(data, options) {
4
+ super(data.message, options);
5
+ this.name = 'AcmeError';
6
+ this.data = Object.freeze({ ...data });
7
+ }
8
+ }
9
+ /**
10
+ * Raised when a model call may have executed at the provider. ADR-0014 makes
11
+ * this terminal for its execution and never automatically retried.
12
+ */
13
+ export class AmbiguousModelCallError extends AcmeError {
14
+ ambiguous = true;
15
+ constructor(data, options) {
16
+ super(data, options);
17
+ this.name = 'AmbiguousModelCallError';
18
+ }
19
+ }
20
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAoCA,MAAM,OAAO,SAAU,SAAQ,KAAK;IACzB,IAAI,CAAgB;IAE7B,YAAY,IAAmB,EAAE,OAAsB;QACrD,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;IACzC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,uBAAwB,SAAQ,SAAS;IAC3C,SAAS,GAAG,IAAa,CAAC;IAEnC,YAAY,IAAmB,EAAE,OAAsB;QACrD,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;IACxC,CAAC;CACF"}
@@ -0,0 +1,14 @@
1
+ import type { JsonValue } from './common.js';
2
+ import type { DomainIssue } from './state.js';
3
+ export type EvaluationDecision = {
4
+ readonly outcome: 'allow';
5
+ readonly scores: Readonly<Record<string, number>>;
6
+ } | {
7
+ readonly outcome: 'block';
8
+ readonly reasons: readonly DomainIssue[];
9
+ } | {
10
+ readonly outcome: 'revise';
11
+ readonly reasons: readonly DomainIssue[];
12
+ readonly instruction: JsonValue;
13
+ };
14
+ //# sourceMappingURL=evaluation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluation.d.ts","sourceRoot":"","sources":["../src/evaluation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,MAAM,kBAAkB,GAC1B;IACE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACnD,GACD;IACE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;CAC1C,GACD;IACE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;IACzC,QAAQ,CAAC,WAAW,EAAE,SAAS,CAAC;CACjC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=evaluation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluation.js","sourceRoot":"","sources":["../src/evaluation.ts"],"names":[],"mappings":""}
@@ -0,0 +1,30 @@
1
+ import type { Clock, Hashing, IdGenerator } from './common.js';
2
+ import type { ContractRegistry, ResponsePipeline } from './contracts.js';
3
+ import type { ExecutionRequest, ExecutionResult, ReplayReport } from './execution-types.js';
4
+ import { type MemoryEngine } from './memory-engine.js';
5
+ import type { ModelGateway } from './model.js';
6
+ import type { ModuleRegistry } from './modules.js';
7
+ import type { ExecutionRepository } from './repository.js';
8
+ import type { StateEngine } from './state-engine.js';
9
+ export interface ExecutionEngineOptions {
10
+ readonly clock: Clock;
11
+ readonly ids: IdGenerator;
12
+ readonly modules: ModuleRegistry;
13
+ readonly contracts: ContractRegistry;
14
+ readonly pipeline: ResponsePipeline;
15
+ readonly gateway: ModelGateway;
16
+ readonly memory: MemoryEngine;
17
+ readonly state: StateEngine;
18
+ readonly repository: ExecutionRepository;
19
+ readonly hashing?: Hashing;
20
+ }
21
+ /** Optional per-call controls (ADR-0027 cooperative cancellation). */
22
+ export interface ExecuteOptions {
23
+ readonly signal?: AbortSignal;
24
+ }
25
+ export interface ExecutionEngine {
26
+ execute<TInput>(request: ExecutionRequest<TInput>, options?: ExecuteOptions): Promise<ExecutionResult>;
27
+ replayVerify(executionId: string): Promise<ReplayReport>;
28
+ }
29
+ export declare function createExecutionEngine(options: ExecutionEngineOptions): ExecutionEngine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