or3-provider-sqlite 0.0.24 → 0.0.26
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/README.md +27 -3
- package/dist/module.json +1 -1
- package/dist/runtime/server/background-jobs/sqlite-provider.d.ts +37 -2
- package/dist/runtime/server/background-jobs/sqlite-provider.js +848 -30
- package/dist/runtime/server/db/kysely.d.ts +1 -0
- package/dist/runtime/server/db/kysely.js +3 -0
- package/dist/runtime/server/db/migrate.js +12 -2
- package/dist/runtime/server/db/migration-schema.d.ts +3 -0
- package/dist/runtime/server/db/migration-schema.js +21 -0
- package/dist/runtime/server/db/migrations/029_delegation_wait.d.ts +4 -0
- package/dist/runtime/server/db/migrations/029_delegation_wait.js +89 -0
- package/dist/runtime/server/db/migrations/030_storage_generations.d.ts +4 -0
- package/dist/runtime/server/db/migrations/030_storage_generations.js +42 -0
- package/dist/runtime/server/db/migrations/031_storage_generation_uploads.d.ts +4 -0
- package/dist/runtime/server/db/migrations/031_storage_generation_uploads.js +56 -0
- package/dist/runtime/server/db/schema.d.ts +8 -0
- package/dist/runtime/server/db/storage-generation-guards.d.ts +17 -0
- package/dist/runtime/server/db/storage-generation-guards.js +169 -0
- package/dist/runtime/server/db/storage-generation-upload-guards.d.ts +7 -0
- package/dist/runtime/server/db/storage-generation-upload-guards.js +182 -0
- package/dist/runtime/server/storage/sqlite-generation-coordinator.d.ts +62 -0
- package/dist/runtime/server/storage/sqlite-generation-coordinator.js +223 -0
- package/dist/runtime/server/storage/sqlite-generation-upload-coordinator.d.ts +60 -0
- package/dist/runtime/server/storage/sqlite-generation-upload-coordinator.js +435 -0
- package/dist/runtime/server/sync/background-history-fingerprint.d.ts +6 -0
- package/dist/runtime/server/sync/background-history-fingerprint.js +14 -0
- package/dist/runtime/server/sync/canonical-project-ownership.d.ts +6 -0
- package/dist/runtime/server/sync/canonical-project-ownership.js +20 -0
- package/dist/runtime/server/sync/sqlite-sync-gateway-adapter.d.ts +17 -0
- package/dist/runtime/server/sync/sqlite-sync-gateway-adapter.js +145 -34
- package/package.json +13 -7
package/README.md
CHANGED
|
@@ -283,12 +283,18 @@ bun run type-check # TypeScript validation
|
|
|
283
283
|
bun run build # build for distribution
|
|
284
284
|
```
|
|
285
285
|
|
|
286
|
-
The normal test suite
|
|
287
|
-
|
|
286
|
+
The normal test suite uses a hash-verified snapshot of a reviewed, committed
|
|
287
|
+
host revision; see [its provenance](test/fixtures/host-next.README.md).
|
|
288
|
+
`bun run test:host-integration` reruns the
|
|
288
289
|
same background-job, canonical-history and registration cases against a prepared
|
|
289
290
|
sibling `../or3-chat` at the exact reviewed source tree. It fails on missing or
|
|
290
291
|
mismatched source rather than falling back to fixtures. See the
|
|
291
|
-
[fixture provenance and prerequisites](test/fixtures/host
|
|
292
|
+
[fixture provenance and prerequisites](test/fixtures/host-next.README.md).
|
|
293
|
+
|
|
294
|
+
`OR3_PROJECT_HOST_ROOT=/path/to/or3-chat bun run type-check:host-contract`
|
|
295
|
+
checks provider server code against that prepared host's actual contracts and
|
|
296
|
+
generated Nuxt server declarations. This is stronger than the standalone release
|
|
297
|
+
shim check; it does not establish that either checkout is a released artifact.
|
|
292
298
|
|
|
293
299
|
## Compatibility
|
|
294
300
|
|
|
@@ -399,5 +405,23 @@ history delivery prevent replacement. Database failures propagate so the host
|
|
|
399
405
|
cancels preparation and restores admission rather than treating failure as idle.
|
|
400
406
|
An additive covering index migration keeps counts off stored response bodies.
|
|
401
407
|
|
|
408
|
+
A host that tracks in-flight workers and reconciliation can opt into
|
|
409
|
+
`getShutdownBlockerCount({ allowPersistedDelegation: true })`. Native SQLite then
|
|
410
|
+
allows saved delegation waits and terminal delegation delivery to remain pending
|
|
411
|
+
across restart when there is no live or indeterminate worker lease. Active model
|
|
412
|
+
jobs still block. This read-only count changes no retention, authorization,
|
|
413
|
+
recovery or replay rules: inaccessible or damaged evidence stays preserved.
|
|
414
|
+
D1 and callers that omit the option retain the conservative count. This support
|
|
415
|
+
ships in 0.0.26 and requires a matching host update.
|
|
416
|
+
|
|
402
417
|
Admin workspace summaries, workspace details, and deployment-admin lists expose `createdAt` in Unix milliseconds for the host UI. SQLite continues to store the underlying creation timestamps in Unix seconds; no data migration is needed.
|
|
418
|
+
|
|
419
|
+
## Dormant immutable-generation foundation (unreleased)
|
|
420
|
+
|
|
421
|
+
Migration 030 adds inert generation records, current-hash heads, and canonical write barriers after the released migrations. No runtime route creates these records, no adapter advertises `externalStorageGenerations`, and physical cleanup remains disabled. See [protocol invariants and activation blockers](docs/storage-generations.md).
|
|
422
|
+
|
|
423
|
+
Migrations 030–031 resume safely after interrupted startup and reject incompatible preexisting schema objects. Released migration 029 remains unchanged.
|
|
424
|
+
|
|
425
|
+
Migration 031 adds the dormant upload ledger and restore tickets. The optional coordinator remains unregistered. See [upload, restore, and recovery invariants](docs/storage-generation-uploads.md).
|
|
426
|
+
|
|
403
427
|
Background history admission and finalization failures expose structured codes for validation, authorization, conflicts, and supersession. Transient SQLite failures retain their original errors for retry.
|
package/dist/module.json
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import type { BackgroundJob, BackgroundJobExecution, BackgroundJobProvider, CreateJobParams, JobUpdate, AdmissionCancellationResult, GenerationHistoryPhase, TerminalGenerationSnapshot } from '~~/server/utils/background-jobs/types';
|
|
1
|
+
import type { BackgroundJob, BackgroundJobExecution, BackgroundJobProvider, CreateJobParams, DelegationChildAdmission, DelegationChildAdmissionResult, DelegationWaitCommit, DelegationResume, DelegationResumeResult, JobUpdate, AdmissionCancellationResult, GenerationHistoryPhase, TerminalGenerationSnapshot } from '~~/server/utils/background-jobs/types';
|
|
2
|
+
import { type DelegationDispatch } from '~~/shared/chat/delegation-checkpoint';
|
|
2
3
|
export declare class SqliteBackgroundJobProvider implements BackgroundJobProvider {
|
|
3
4
|
readonly name = "sqlite";
|
|
5
|
+
get delegationCoordinatorVersion(): 1 | undefined;
|
|
6
|
+
private lastDelegationDiagnosticCheckAt?;
|
|
4
7
|
createJob(params: CreateJobParams): Promise<string>;
|
|
5
8
|
getJob(jobId: string, userId: string): Promise<BackgroundJob | null>;
|
|
6
9
|
findJobByIdempotencyKey(idempotencyKey: string, userId: string): Promise<BackgroundJob | null>;
|
|
@@ -14,6 +17,30 @@ export declare class SqliteBackgroundJobProvider implements BackgroundJobProvide
|
|
|
14
17
|
checkJobAborted(jobId: string): Promise<boolean>;
|
|
15
18
|
claimJob(jobId: string, leaseOwner: string, now: number, leaseExpiresAt: number): Promise<BackgroundJob | null>;
|
|
16
19
|
claimNextJob(leaseOwner: string, now: number, leaseExpiresAt: number): Promise<BackgroundJob | null>;
|
|
20
|
+
beginDelegationDispatch(jobId: string, leaseOwner: string): Promise<DelegationDispatch | null>;
|
|
21
|
+
commitDelegationDispatch(jobId: string, leaseOwner: string, sequence: number, execution: BackgroundJobExecution, toolCalls: BackgroundJob['tool_calls']): Promise<boolean>;
|
|
22
|
+
parkDelegationWait(jobId: string, leaseOwner: string, execution: BackgroundJobExecution, toolCalls: BackgroundJob['tool_calls']): Promise<boolean>;
|
|
23
|
+
claimNextDelegationWait(leaseOwner: string, now: number, leaseExpiresAt: number): Promise<BackgroundJob | null>;
|
|
24
|
+
admitDelegationChild(input: DelegationChildAdmission): Promise<DelegationChildAdmissionResult>;
|
|
25
|
+
commitDelegationWait(input: DelegationWaitCommit): Promise<boolean>;
|
|
26
|
+
stopInvalidDelegationWait(input: {
|
|
27
|
+
parentJobId: string;
|
|
28
|
+
leaseOwner: string;
|
|
29
|
+
expectedRevision: number;
|
|
30
|
+
authorizationDenied?: boolean;
|
|
31
|
+
}): Promise<'valid' | 'stopped' | 'not-owned' | 'unavailable'>;
|
|
32
|
+
cleanupDelegationWait(input: {
|
|
33
|
+
parentJobId: string;
|
|
34
|
+
leaseOwner: string;
|
|
35
|
+
expectedRevision: number;
|
|
36
|
+
}): Promise<'not-owned' | 'pending' | 'settled'>;
|
|
37
|
+
expireDelegationWait(input: {
|
|
38
|
+
parentJobId: string;
|
|
39
|
+
leaseOwner: string;
|
|
40
|
+
expectedRevision: number;
|
|
41
|
+
}): Promise<'not-owned' | 'pending'>;
|
|
42
|
+
private stopDelegationChildren;
|
|
43
|
+
resumeDelegationWait(input: DelegationResume): Promise<DelegationResumeResult>;
|
|
17
44
|
renewJobLease(jobId: string, leaseOwner: string, _now: number, leaseExpiresAt: number): Promise<boolean>;
|
|
18
45
|
updateJobExecution(jobId: string, execution: BackgroundJobExecution, leaseOwner: string): Promise<boolean>;
|
|
19
46
|
claimClientToolCall(jobId: string, userId: string, callId: string, claimToken: string, claimExpiresAt: number): Promise<BackgroundJob | null>;
|
|
@@ -22,9 +49,17 @@ export declare class SqliteBackgroundJobProvider implements BackgroundJobProvide
|
|
|
22
49
|
setHistoryPhase(jobId: string, phase: GenerationHistoryPhase, options?: {
|
|
23
50
|
from?: GenerationHistoryPhase[];
|
|
24
51
|
}): Promise<boolean>;
|
|
52
|
+
deferDelegationHistory(input: {
|
|
53
|
+
jobId: string;
|
|
54
|
+
userId: string;
|
|
55
|
+
generationId: string;
|
|
56
|
+
phase: 'admission_pending' | 'finalization_pending';
|
|
57
|
+
}): Promise<boolean>;
|
|
25
58
|
getPendingHistoryJobs(limit: number): Promise<BackgroundJob[]>;
|
|
26
59
|
cleanupExpired(): Promise<number>;
|
|
27
60
|
getActiveJobCount(): Promise<number>;
|
|
28
|
-
getShutdownBlockerCount(
|
|
61
|
+
getShutdownBlockerCount(options?: {
|
|
62
|
+
allowPersistedDelegation?: boolean;
|
|
63
|
+
}): Promise<number>;
|
|
29
64
|
}
|
|
30
65
|
export declare const sqliteBackgroundJobProvider: SqliteBackgroundJobProvider;
|