@devflow-tools/database 0.17.8 → 0.18.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 (51) hide show
  1. package/LICENSE +21 -0
  2. package/dist/data/LocalDataProvider.d.ts +63 -0
  3. package/dist/data/LocalDataProvider.js +332 -0
  4. package/dist/data/default-enforcer-rules.d.ts +3 -0
  5. package/dist/data/default-enforcer-rules.js +170 -0
  6. package/dist/data/devflow-schema.d.ts +2 -0
  7. package/dist/data/devflow-schema.js +80 -0
  8. package/dist/database.d.ts +45 -7
  9. package/dist/database.js +583 -125
  10. package/dist/index.d.ts +8 -4
  11. package/dist/index.js +11 -5
  12. package/dist/retrieval-ledger.d.ts +16 -1
  13. package/dist/retrieval-ledger.js +6 -0
  14. package/dist/retrieval-runtime.d.ts +39 -0
  15. package/dist/retrieval-runtime.js +2 -0
  16. package/dist/task-aggregate.d.ts +49 -0
  17. package/dist/task-aggregate.js +2 -0
  18. package/dist/task-semantic-control.d.ts +8 -1
  19. package/dist/task-semantic-control.js +2 -4
  20. package/package.json +15 -3
  21. package/CHANGELOG.md +0 -844
  22. package/__tests__/database.failure-category.test.ts +0 -44
  23. package/__tests__/database.host-actions.test.ts +0 -405
  24. package/__tests__/database.learning-candidates.test.ts +0 -93
  25. package/__tests__/database.memory-turn-receipts.test.ts +0 -98
  26. package/__tests__/database.retrieval-ledger.test.ts +0 -68
  27. package/__tests__/database.retrieval-sessions.test.ts +0 -79
  28. package/__tests__/database.semantic-resolution.test.ts +0 -87
  29. package/__tests__/database.skill-executions.test.ts +0 -456
  30. package/__tests__/database.task-runtime.test.ts +0 -73
  31. package/__tests__/database.test.ts +0 -177
  32. package/__tests__/database.work-queue.test.ts +0 -274
  33. package/__tests__/database.workflow-workers.test.ts +0 -60
  34. package/__tests__/node-sqlite.test.ts +0 -68
  35. package/src/database.ts +0 -5853
  36. package/src/host-actions.ts +0 -211
  37. package/src/index.ts +0 -153
  38. package/src/learning-candidates.ts +0 -181
  39. package/src/node-sqlite.ts +0 -60
  40. package/src/obligation-ledger.ts +0 -57
  41. package/src/retrieval-ledger.ts +0 -35
  42. package/src/retrieval-sessions.ts +0 -196
  43. package/src/semantic-resolution.ts +0 -181
  44. package/src/task-runtime.ts +0 -169
  45. package/src/task-semantic-control.ts +0 -270
  46. package/src/types.ts +0 -17
  47. package/src/work-queue.ts +0 -123
  48. package/src/workflow-workers.ts +0 -198
  49. package/tsconfig.json +0 -19
  50. package/tsconfig.tsbuildinfo +0 -1
  51. package/vitest.config.ts +0 -41
@@ -4,10 +4,12 @@ import { type FailHostActionInput, type HostActionRecord, type ReportHostActionI
4
4
  import { type AppendRetrievalCycleInput, type CreateRetrievalSessionInput, type RetrievalCycleRecord, type RetrievalSessionRecord, type RetrievalSessionState } from './retrieval-sessions';
5
5
  import { type AddLearningCandidateEvidenceInput, type LearningCandidateEvidenceRecord, type LearningCandidateRecord, type LearningCandidateState, type LearningCandidateVersionRecord, type TransitionLearningCandidateInput, type UpsertLearningCandidateInput } from './learning-candidates';
6
6
  import { type CreateWorkflowWorkerInput, type EnqueueWorkflowMergeInput, type TransitionWorkflowWorkerInput, type WorkflowMergeRecord, type WorkflowMergeState, type WorkflowWorkerEventRecord, type WorkflowWorkerRecord } from './workflow-workers';
7
- import type { RetrievalLedgerEventRecord } from './retrieval-ledger';
8
- import { type ChannelQueryPlanRecord, type TaskIntentArtifactRecord, type TerminalTransitionRecord, type ToolNameResolutionRecord, type TranscriptCheckpointRecord } from './task-semantic-control';
7
+ import { type RetrievalLedgerEventRecord, type VerifyReceiptBoundRetrievalInput, type VerifyReceiptBoundRetrievalResult } from './retrieval-ledger';
8
+ import { type CanonicalSemanticTaskWrite, type ChannelQueryPlanRecord, type TaskIntentArtifactRecord, type TerminalTransitionRecord, type ToolNameResolutionRecord, type TranscriptCheckpointRecord } from './task-semantic-control';
9
9
  import { type TaskRuntimeEventRecord, type TaskRuntimeSnapshotRecord } from './task-runtime';
10
- import { type SemanticResolutionRecord } from './semantic-resolution';
10
+ import type { AppendTaskAggregateInput, AppendTaskAggregateResult, LeaseTaskOutboxInput, TaskOutboxRecord } from './task-aggregate';
11
+ import { type CanonicalTaskIdentity, type RetrievalCycleReceiptV1, type RuntimeActivationSnapshotV1, type SemanticExecutionContext, type TaskAggregateEventV1, type TaskDefinitionV1, type TaskRuntimeSnapshotV2 } from '@devflow-tools/sdk';
12
+ import type { AppendRetrievalCycleV2Input, CreateRetrievalSessionV2Input, RetrievalSessionV2Record } from './retrieval-runtime';
11
13
  export interface BenchmarkReportRecord {
12
14
  runId: string;
13
15
  suiteId: string;
@@ -435,6 +437,10 @@ export declare class DevFlowDatabase {
435
437
  updateHookReceipt(projectRoot: string, updater: (current: HookReceiptRecord | null) => Omit<HookReceiptRecord, 'projectRoot' | 'updatedAt'>): HookReceiptRecord;
436
438
  deleteHookReceipt(projectRoot: string): boolean;
437
439
  createRetrievalSession(input: CreateRetrievalSessionInput): RetrievalSessionRecord;
440
+ createRetrievalSessionV2(input: CreateRetrievalSessionV2Input): RetrievalSessionV2Record;
441
+ getRetrievalSessionV2(id: string): RetrievalSessionV2Record | null;
442
+ listRetrievalCyclesV2(sessionId: string): RetrievalCycleReceiptV1[];
443
+ appendRetrievalCycleV2(input: AppendRetrievalCycleV2Input): RetrievalSessionV2Record;
438
444
  getRetrievalSession(projectRoot: string, sessionId: string, id: string): RetrievalSessionRecord | null;
439
445
  getRetrievalSessionByRequest(requestId: string): RetrievalSessionRecord | null;
440
446
  listRetrievalCycles(retrievalSessionId: string): RetrievalCycleRecord[];
@@ -455,7 +461,9 @@ export declare class DevFlowDatabase {
455
461
  getContextReceiptForRequest(projectRoot: string, sessionId: string, requestId: string): ContextReceiptRecord | null;
456
462
  recordContextSelectionEvent(event: ContextSelectionEventRecord): boolean;
457
463
  appendRetrievalLedgerEvent(event: RetrievalLedgerEventRecord): boolean;
464
+ verifyReceiptBoundRetrieval(input: VerifyReceiptBoundRetrievalInput): VerifyReceiptBoundRetrievalResult;
458
465
  appendTaskIntentArtifact(record: TaskIntentArtifactRecord): TaskIntentArtifactRecord;
466
+ private appendTaskIntentArtifactInTransaction;
459
467
  getTaskIntentArtifact(artifactHash: string): TaskIntentArtifactRecord | null;
460
468
  getLatestTaskIntentArtifact(input: {
461
469
  projectRoot: string;
@@ -468,10 +476,6 @@ export declare class DevFlowDatabase {
468
476
  sessionId: string;
469
477
  sourceHash: string;
470
478
  }): TaskIntentArtifactRecord | null;
471
- appendSemanticResolution(record: SemanticResolutionRecord): boolean;
472
- getSemanticResolution(frameHash: string): SemanticResolutionRecord | null;
473
- getLatestSemanticResolution(projectRoot: string, sessionId: string, turnId: string): SemanticResolutionRecord | null;
474
- listSemanticResolutions(projectRoot: string, sessionId: string, turnId: string): SemanticResolutionRecord[];
475
479
  listLatestTaskIntentArtifacts(projectRoot: string, sessionId: string): TaskIntentArtifactRecord[];
476
480
  appendChannelQueryPlan(record: ChannelQueryPlanRecord): ChannelQueryPlanRecord;
477
481
  getChannelQueryPlan(planHash: string): ChannelQueryPlanRecord | null;
@@ -495,6 +499,40 @@ export declare class DevFlowDatabase {
495
499
  appendTaskRuntimeEventAndSnapshot(event: TaskRuntimeEventRecord, snapshot: TaskRuntimeSnapshotRecord): TaskRuntimeSnapshotRecord;
496
500
  getTaskRuntimeSnapshot(projectRoot: string, sessionId: string, turnId: string): TaskRuntimeSnapshotRecord | null;
497
501
  deleteTaskRuntimeSnapshot(projectRoot: string, sessionId: string, turnId: string): boolean;
502
+ appendTaskAggregate(input: AppendTaskAggregateInput): AppendTaskAggregateResult;
503
+ bindRuntimeActivation(input: {
504
+ identity: CanonicalTaskIdentity;
505
+ revision: number;
506
+ snapshot: RuntimeActivationSnapshotV1;
507
+ }): {
508
+ snapshot: RuntimeActivationSnapshotV1;
509
+ replayed: boolean;
510
+ };
511
+ private bindRuntimeActivationInTransaction;
512
+ getRuntimeActivation(projectRoot: string, sessionId: string, turnId: string, revision: number): RuntimeActivationSnapshotV1 | null;
513
+ putSemanticExecutionContext(input: {
514
+ context: SemanticExecutionContext;
515
+ revision: number;
516
+ }): SemanticExecutionContext;
517
+ putCanonicalSemanticTask(input: CanonicalSemanticTaskWrite): SemanticExecutionContext;
518
+ getSemanticExecutionContext(projectRoot: string, sessionId: string, turnId: string, revision: number): SemanticExecutionContext | null;
519
+ getSemanticExecutionContextByHash(contextHash: string): SemanticExecutionContext | null;
520
+ getLatestSemanticExecutionContext(input: {
521
+ projectRoot: string;
522
+ sessionId: string;
523
+ turnId: string;
524
+ }): {
525
+ context: SemanticExecutionContext;
526
+ revision: number;
527
+ } | null;
528
+ listTaskAggregateEvents(projectRoot: string, sessionId: string, turnId: string, revision: number): TaskAggregateEventV1[];
529
+ getTaskAggregateEventByIdempotencyKey(idempotencyKey: string): TaskAggregateEventV1 | null;
530
+ getTaskAggregateSnapshot(projectRoot: string, sessionId: string, turnId: string, revision: number): TaskRuntimeSnapshotV2 | null;
531
+ getTaskDefinitionV2(definitionHash: string): TaskDefinitionV1 | null;
532
+ leaseTaskOutbox(input: LeaseTaskOutboxInput): TaskOutboxRecord[];
533
+ completeTaskOutbox(operationId: string, owner: string, fencingToken: number, now?: number): boolean;
534
+ getTaskOutbox(operationId: string): TaskOutboxRecord | null;
535
+ private putTaskDefinitionV2;
498
536
  getTerminalTransition(receiptId: string): TerminalTransitionRecord | null;
499
537
  getLatestTerminalTransition(projectRoot: string, sessionId: string, turnId: string): TerminalTransitionRecord | null;
500
538
  appendTranscriptCheckpoint(record: TranscriptCheckpointRecord): boolean;