@crvouga/mockingbird-service-bedrock 3.1.0 → 3.2.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.
- package/CHANGELOG.md +8 -2
- package/dist/{chunk-AWLKTLE4.js → chunk-B7FB27RN.js} +258 -170
- package/dist/chunk-B7FB27RN.js.map +7 -0
- package/dist/{chunk-LTTTTWN5.js → chunk-DZ24BLVS.js} +2 -2
- package/dist/cli.js +5 -3
- package/dist/cli.js.map +2 -2
- package/dist/index.d.ts +96 -81
- package/dist/index.js +1 -1
- package/dist/server.d.ts +141 -108
- package/dist/server.js +2 -2
- package/package.json +2 -2
- package/dist/chunk-AWLKTLE4.js.map +0 -7
- /package/dist/{chunk-LTTTTWN5.js.map → chunk-DZ24BLVS.js.map} +0 -0
package/dist/server.d.ts
CHANGED
|
@@ -1,34 +1,16 @@
|
|
|
1
1
|
import { Server } from 'node:http';
|
|
2
2
|
import { Hono } from 'hono';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
type MountedAPI$1 = FetchAPI$2 & {
|
|
5
|
+
readonly prefix: string;
|
|
6
|
+
GET: FetchHandler$1;
|
|
7
|
+
POST: FetchHandler$1;
|
|
8
|
+
PUT: FetchHandler$1;
|
|
9
|
+
PATCH: FetchHandler$1;
|
|
10
|
+
DELETE: FetchHandler$1;
|
|
11
|
+
HEAD: FetchHandler$1;
|
|
12
|
+
OPTIONS: FetchHandler$1;
|
|
10
13
|
};
|
|
11
|
-
/**
|
|
12
|
-
* Prepared statement bound to a {@link SqliteClient}.
|
|
13
|
-
*
|
|
14
|
-
* Pass bind values as rest arguments on each call (no sticky `bind()`).
|
|
15
|
-
*/
|
|
16
|
-
interface SqliteStatement$2 {
|
|
17
|
-
run(...params: SqliteValue$2[]): SqliteRunResult$2;
|
|
18
|
-
all<T = Record<string, unknown>>(...params: SqliteValue$2[]): T[];
|
|
19
|
-
get<T = Record<string, unknown>>(...params: SqliteValue$2[]): T | undefined;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Sync SQLite client port owned by Mockingbird.
|
|
23
|
-
*
|
|
24
|
-
* Duck-typed so `@crvouga/mockingbird-service-sqlite` `Database`, better-sqlite3, and wrapped
|
|
25
|
-
* `bun:sqlite` instances all work when they expose this surface.
|
|
26
|
-
*/
|
|
27
|
-
interface SqliteClient$2 {
|
|
28
|
-
exec(sql: string): void;
|
|
29
|
-
prepare(sql: string): SqliteStatement$2;
|
|
30
|
-
transaction<T>(fn: () => T): T;
|
|
31
|
-
}
|
|
32
14
|
|
|
33
15
|
/** A stable identifier for a point in a {@link Timeline}. */
|
|
34
16
|
type CheckpointId$1 = string;
|
|
@@ -119,6 +101,37 @@ declare class Timeline$1<T> {
|
|
|
119
101
|
interface FetchAPI$2 {
|
|
120
102
|
fetch(request: Request): Promise<Response>;
|
|
121
103
|
}
|
|
104
|
+
/** A bare function form of {@link FetchAPI}, compatible with `Bun.serve`, workerd, and Deno. */
|
|
105
|
+
type FetchHandler$1 = (request: Request) => Promise<Response>;
|
|
106
|
+
|
|
107
|
+
/** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
|
|
108
|
+
type SqliteValue$2 = null | number | bigint | string | Uint8Array | boolean;
|
|
109
|
+
/** Mutation counters returned by {@link SqliteStatement.run}. */
|
|
110
|
+
type SqliteRunResult$2 = {
|
|
111
|
+
changes: number;
|
|
112
|
+
lastInsertRowid: number | bigint;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Prepared statement bound to a {@link SqliteClient}.
|
|
116
|
+
*
|
|
117
|
+
* Pass bind values as rest arguments on each call (no sticky `bind()`).
|
|
118
|
+
*/
|
|
119
|
+
interface SqliteStatement$2 {
|
|
120
|
+
run(...params: SqliteValue$2[]): SqliteRunResult$2;
|
|
121
|
+
all<T = Record<string, unknown>>(...params: SqliteValue$2[]): T[];
|
|
122
|
+
get<T = Record<string, unknown>>(...params: SqliteValue$2[]): T | undefined;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Sync SQLite client port owned by Mockingbird.
|
|
126
|
+
*
|
|
127
|
+
* Duck-typed so `@crvouga/mockingbird-service-sqlite` `Database`, better-sqlite3, and wrapped
|
|
128
|
+
* `bun:sqlite` instances all work when they expose this surface.
|
|
129
|
+
*/
|
|
130
|
+
interface SqliteClient$2 {
|
|
131
|
+
exec(sql: string): void;
|
|
132
|
+
prepare(sql: string): SqliteStatement$2;
|
|
133
|
+
transaction<T>(fn: () => T): T;
|
|
134
|
+
}
|
|
122
135
|
|
|
123
136
|
/**
|
|
124
137
|
* The single source of time for a service.
|
|
@@ -535,6 +548,8 @@ type ServiceRuntime$1<T extends ServiceInstance$1> = FetchAPI$2 & {
|
|
|
535
548
|
/** Stop package-owned lifecycle timers when a supervisor closes the runtime. */
|
|
536
549
|
stop?(): void;
|
|
537
550
|
readonly name: string;
|
|
551
|
+
/** Same-origin Fetch handler and App Router method exports, sharing this runtime. */
|
|
552
|
+
mount(prefix: string): MountedAPI$1;
|
|
538
553
|
readonly sqlite: SqliteClient$2;
|
|
539
554
|
readonly clock: Clock$1;
|
|
540
555
|
readonly faults: FaultRegistry$1;
|
|
@@ -601,6 +616,9 @@ type CommonServeOptions = {
|
|
|
601
616
|
adminKey: string | undefined;
|
|
602
617
|
seed: string | undefined;
|
|
603
618
|
onLog: ((entry: RequestLog$1) => void) | undefined;
|
|
619
|
+
/** Synthetic provider fixture objects supplied by a fleet entry. */
|
|
620
|
+
fixtures?: Record<string, unknown>;
|
|
621
|
+
baseUrl?: string;
|
|
604
622
|
};
|
|
605
623
|
/**
|
|
606
624
|
* What a service contributes to `serve`: how to build its runtime from CLI flags,
|
|
@@ -648,88 +666,16 @@ type H2cListening = {
|
|
|
648
666
|
*/
|
|
649
667
|
declare const listenH2c: (api: FetchAPI$1, options?: H2cListenOptions) => Promise<H2cListening>;
|
|
650
668
|
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
669
|
+
type MountedAPI = FetchAPI & {
|
|
670
|
+
readonly prefix: string;
|
|
671
|
+
GET: FetchHandler;
|
|
672
|
+
POST: FetchHandler;
|
|
673
|
+
PUT: FetchHandler;
|
|
674
|
+
PATCH: FetchHandler;
|
|
675
|
+
DELETE: FetchHandler;
|
|
676
|
+
HEAD: FetchHandler;
|
|
677
|
+
OPTIONS: FetchHandler;
|
|
657
678
|
};
|
|
658
|
-
/**
|
|
659
|
-
* Prepared statement bound to a {@link SqliteClient}.
|
|
660
|
-
*
|
|
661
|
-
* Pass bind values as rest arguments on each call (no sticky `bind()`).
|
|
662
|
-
*/
|
|
663
|
-
interface SqliteStatement$1 {
|
|
664
|
-
run(...params: SqliteValue$1[]): SqliteRunResult$1;
|
|
665
|
-
all<T = Record<string, unknown>>(...params: SqliteValue$1[]): T[];
|
|
666
|
-
get<T = Record<string, unknown>>(...params: SqliteValue$1[]): T | undefined;
|
|
667
|
-
}
|
|
668
|
-
/**
|
|
669
|
-
* Sync SQLite client port owned by Mockingbird.
|
|
670
|
-
*
|
|
671
|
-
* Duck-typed so `@crvouga/mockingbird-service-sqlite` `Database`, better-sqlite3, and wrapped
|
|
672
|
-
* `bun:sqlite` instances all work when they expose this surface.
|
|
673
|
-
*/
|
|
674
|
-
interface SqliteClient$1 {
|
|
675
|
-
exec(sql: string): void;
|
|
676
|
-
prepare(sql: string): SqliteStatement$1;
|
|
677
|
-
transaction<T>(fn: () => T): T;
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
/** Every stored record carries a monotonically increasing sequence for stable ordering. */
|
|
681
|
-
type Stored<T> = {
|
|
682
|
-
seq: number;
|
|
683
|
-
value: T;
|
|
684
|
-
};
|
|
685
|
-
type ListRecordsOptions<T> = {
|
|
686
|
-
/** Keep only records passing the predicate. */
|
|
687
|
-
where?: (value: T, seq: number) => boolean;
|
|
688
|
-
/** Sort order; default newest first. */
|
|
689
|
-
order?: "newest" | "oldest";
|
|
690
|
-
};
|
|
691
|
-
/**
|
|
692
|
-
* A SQLite-backed table of JSON records addressed by id. Ordering is by insertion
|
|
693
|
-
* sequence, never by id lexicographic order, so list semantics stay stable.
|
|
694
|
-
*/
|
|
695
|
-
declare class Collection<T> {
|
|
696
|
-
private readonly sqlite;
|
|
697
|
-
/** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
|
|
698
|
-
readonly namespace: string;
|
|
699
|
-
/** Table name inside the namespace. Stable across resets of the rows themselves. */
|
|
700
|
-
readonly collectionName: string;
|
|
701
|
-
constructor(sqlite: SqliteClient$1,
|
|
702
|
-
/** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
|
|
703
|
-
namespace: string,
|
|
704
|
-
/** Table name inside the namespace. Stable across resets of the rows themselves. */
|
|
705
|
-
collectionName: string);
|
|
706
|
-
private bumpCollectionSeq;
|
|
707
|
-
nextSequence(): number;
|
|
708
|
-
get(id: string): T | undefined;
|
|
709
|
-
has(id: string): boolean;
|
|
710
|
-
/** Insert a new record, assigning it the next sequence number. */
|
|
711
|
-
insert(id: string, value: T): Stored<T>;
|
|
712
|
-
/** Replace an existing record's value, keeping its position. */
|
|
713
|
-
update(id: string, value: T): Stored<T> | undefined;
|
|
714
|
-
delete(id: string): boolean;
|
|
715
|
-
/** How many records the collection holds, without reading them. */
|
|
716
|
-
count(): number;
|
|
717
|
-
list(options?: ListRecordsOptions<T>): Array<Stored<T> & {
|
|
718
|
-
id: string;
|
|
719
|
-
}>;
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
/**
|
|
723
|
-
* Sequential id source persisted in SQLite. Ids are deterministic for a given
|
|
724
|
-
* sequence history (`cus_` + 14 opaque chars), so reproductions stay stable.
|
|
725
|
-
*/
|
|
726
|
-
declare class IdSequence {
|
|
727
|
-
private readonly sqlite;
|
|
728
|
-
private readonly namespace;
|
|
729
|
-
private readonly salt;
|
|
730
|
-
constructor(sqlite: SqliteClient$1, namespace: string, salt?: string);
|
|
731
|
-
next(prefix: string, length?: number): string;
|
|
732
|
-
}
|
|
733
679
|
|
|
734
680
|
/** A stable identifier for a point in a {@link Timeline}. */
|
|
735
681
|
type CheckpointId = string;
|
|
@@ -820,6 +766,91 @@ declare class Timeline<T> {
|
|
|
820
766
|
interface FetchAPI {
|
|
821
767
|
fetch(request: Request): Promise<Response>;
|
|
822
768
|
}
|
|
769
|
+
/** A bare function form of {@link FetchAPI}, compatible with `Bun.serve`, workerd, and Deno. */
|
|
770
|
+
type FetchHandler = (request: Request) => Promise<Response>;
|
|
771
|
+
|
|
772
|
+
/** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
|
|
773
|
+
type SqliteValue$1 = null | number | bigint | string | Uint8Array | boolean;
|
|
774
|
+
/** Mutation counters returned by {@link SqliteStatement.run}. */
|
|
775
|
+
type SqliteRunResult$1 = {
|
|
776
|
+
changes: number;
|
|
777
|
+
lastInsertRowid: number | bigint;
|
|
778
|
+
};
|
|
779
|
+
/**
|
|
780
|
+
* Prepared statement bound to a {@link SqliteClient}.
|
|
781
|
+
*
|
|
782
|
+
* Pass bind values as rest arguments on each call (no sticky `bind()`).
|
|
783
|
+
*/
|
|
784
|
+
interface SqliteStatement$1 {
|
|
785
|
+
run(...params: SqliteValue$1[]): SqliteRunResult$1;
|
|
786
|
+
all<T = Record<string, unknown>>(...params: SqliteValue$1[]): T[];
|
|
787
|
+
get<T = Record<string, unknown>>(...params: SqliteValue$1[]): T | undefined;
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* Sync SQLite client port owned by Mockingbird.
|
|
791
|
+
*
|
|
792
|
+
* Duck-typed so `@crvouga/mockingbird-service-sqlite` `Database`, better-sqlite3, and wrapped
|
|
793
|
+
* `bun:sqlite` instances all work when they expose this surface.
|
|
794
|
+
*/
|
|
795
|
+
interface SqliteClient$1 {
|
|
796
|
+
exec(sql: string): void;
|
|
797
|
+
prepare(sql: string): SqliteStatement$1;
|
|
798
|
+
transaction<T>(fn: () => T): T;
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
/** Every stored record carries a monotonically increasing sequence for stable ordering. */
|
|
802
|
+
type Stored<T> = {
|
|
803
|
+
seq: number;
|
|
804
|
+
value: T;
|
|
805
|
+
};
|
|
806
|
+
type ListRecordsOptions<T> = {
|
|
807
|
+
/** Keep only records passing the predicate. */
|
|
808
|
+
where?: (value: T, seq: number) => boolean;
|
|
809
|
+
/** Sort order; default newest first. */
|
|
810
|
+
order?: "newest" | "oldest";
|
|
811
|
+
};
|
|
812
|
+
/**
|
|
813
|
+
* A SQLite-backed table of JSON records addressed by id. Ordering is by insertion
|
|
814
|
+
* sequence, never by id lexicographic order, so list semantics stay stable.
|
|
815
|
+
*/
|
|
816
|
+
declare class Collection<T> {
|
|
817
|
+
private readonly sqlite;
|
|
818
|
+
/** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
|
|
819
|
+
readonly namespace: string;
|
|
820
|
+
/** Table name inside the namespace. Stable across resets of the rows themselves. */
|
|
821
|
+
readonly collectionName: string;
|
|
822
|
+
constructor(sqlite: SqliteClient$1,
|
|
823
|
+
/** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
|
|
824
|
+
namespace: string,
|
|
825
|
+
/** Table name inside the namespace. Stable across resets of the rows themselves. */
|
|
826
|
+
collectionName: string);
|
|
827
|
+
private bumpCollectionSeq;
|
|
828
|
+
nextSequence(): number;
|
|
829
|
+
get(id: string): T | undefined;
|
|
830
|
+
has(id: string): boolean;
|
|
831
|
+
/** Insert a new record, assigning it the next sequence number. */
|
|
832
|
+
insert(id: string, value: T): Stored<T>;
|
|
833
|
+
/** Replace an existing record's value, keeping its position. */
|
|
834
|
+
update(id: string, value: T): Stored<T> | undefined;
|
|
835
|
+
delete(id: string): boolean;
|
|
836
|
+
/** How many records the collection holds, without reading them. */
|
|
837
|
+
count(): number;
|
|
838
|
+
list(options?: ListRecordsOptions<T>): Array<Stored<T> & {
|
|
839
|
+
id: string;
|
|
840
|
+
}>;
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
/**
|
|
844
|
+
* Sequential id source persisted in SQLite. Ids are deterministic for a given
|
|
845
|
+
* sequence history (`cus_` + 14 opaque chars), so reproductions stay stable.
|
|
846
|
+
*/
|
|
847
|
+
declare class IdSequence {
|
|
848
|
+
private readonly sqlite;
|
|
849
|
+
private readonly namespace;
|
|
850
|
+
private readonly salt;
|
|
851
|
+
constructor(sqlite: SqliteClient$1, namespace: string, salt?: string);
|
|
852
|
+
next(prefix: string, length?: number): string;
|
|
853
|
+
}
|
|
823
854
|
|
|
824
855
|
/** Options every provider constructor accepts. */
|
|
825
856
|
type APIOptions = {
|
|
@@ -1249,6 +1280,8 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI & {
|
|
|
1249
1280
|
/** Stop package-owned lifecycle timers when a supervisor closes the runtime. */
|
|
1250
1281
|
stop?(): void;
|
|
1251
1282
|
readonly name: string;
|
|
1283
|
+
/** Same-origin Fetch handler and App Router method exports, sharing this runtime. */
|
|
1284
|
+
mount(prefix: string): MountedAPI;
|
|
1252
1285
|
readonly sqlite: SqliteClient$1;
|
|
1253
1286
|
readonly clock: Clock;
|
|
1254
1287
|
readonly faults: FaultRegistry;
|
package/dist/server.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crvouga/mockingbird-service-bedrock",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Stateful, scriptable emulator of AWS Bedrock Runtime (Converse, ConverseStream, InvokeModel incl. Titan embeddings, Nova Sonic bidirectional streams over h2c) and AgentCore InvokeHarness, with exact event-stream framing.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"pack:check": "bun ../../../scripts/pack-check.ts"
|
|
102
102
|
},
|
|
103
103
|
"dependencies": {
|
|
104
|
-
"@crvouga/mockingbird-service-sqlite": "3.
|
|
104
|
+
"@crvouga/mockingbird-service-sqlite": "3.2.0",
|
|
105
105
|
"hono": "4.11.9"
|
|
106
106
|
},
|
|
107
107
|
"devDependencies": {
|