@codemem/server 0.47.5 → 0.48.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/dist/index.d.ts +22 -27
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +956 -141
- package/dist/index.js.map +1 -1
- package/dist/relay-reachability-test-fixtures.d.ts +19 -0
- package/dist/relay-reachability-test-fixtures.d.ts.map +1 -0
- package/dist/relay-reachability.d.ts +37 -0
- package/dist/relay-reachability.d.ts.map +1 -0
- package/dist/relay-sync-test-fixtures.d.ts +109 -0
- package/dist/relay-sync-test-fixtures.d.ts.map +1 -0
- package/dist/routes/memory-tool-call.d.ts +47 -0
- package/dist/routes/memory-tool-call.d.ts.map +1 -0
- package/dist/routes/pack.d.ts +3 -1
- package/dist/routes/pack.d.ts.map +1 -1
- package/dist/routes/sync.d.ts +1 -0
- package/dist/routes/sync.d.ts.map +1 -1
- package/dist/shared-store.d.ts +8 -0
- package/dist/shared-store.d.ts.map +1 -0
- package/dist/sync-app.d.ts +17 -0
- package/dist/sync-app.d.ts.map +1 -0
- package/dist/sync-channel-dispatch-test-fixtures.d.ts +43 -0
- package/dist/sync-channel-dispatch-test-fixtures.d.ts.map +1 -0
- package/dist/sync-channel-dispatch.d.ts +19 -0
- package/dist/sync-channel-dispatch.d.ts.map +1 -0
- package/dist/sync-channel-pass-test-fixtures.d.ts +81 -0
- package/dist/sync-channel-pass-test-fixtures.d.ts.map +1 -0
- package/dist/viewer-authority.d.ts +17 -0
- package/dist/viewer-authority.d.ts.map +1 -0
- package/package.json +2 -2
- package/static/app.js +31 -31
- package/static/app.js.br +0 -0
- package/static/app.js.gz +0 -0
- package/static/index.html +75 -13
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Database } from "@codemem/core";
|
|
2
|
+
import { type RelayGroupClientConfig, type RelayGroupResolution } from "@codemem/core/internal/relay-runtime";
|
|
3
|
+
import { type relayClientFixture } from "../../core/src/relay-peer-client-test-fixtures.js";
|
|
4
|
+
export declare const COORDINATOR = "https://coord.example";
|
|
5
|
+
type FixtureRelay = Awaited<ReturnType<typeof relayClientFixture>>;
|
|
6
|
+
export declare function identity(keysDir: string, expectedPin: string): {
|
|
7
|
+
key: import("crypto").KeyObject;
|
|
8
|
+
expectedPin: string;
|
|
9
|
+
};
|
|
10
|
+
/** Ready client options that point at a loopback relay fixture. */
|
|
11
|
+
export declare function relayConfig(relay: FixtureRelay, groupId: string, servicePublicKey: string): RelayGroupClientConfig;
|
|
12
|
+
/**
|
|
13
|
+
* Stands in for the coordinator fetch. It reconciles the advertised key with
|
|
14
|
+
* the real pin store, so pausing and approval behave as in production.
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolver(relays: Record<string, FixtureRelay>, advertised?: Record<string, string>): (db: Database, groupId: string) => Promise<RelayGroupResolution>;
|
|
17
|
+
export declare function closedLoopbackUrl(): Promise<string>;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=relay-reachability-test-fixtures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relay-reachability-test-fixtures.d.ts","sourceRoot":"","sources":["../src/relay-reachability-test-fixtures.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAEN,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EAEzB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAEN,KAAK,kBAAkB,EACvB,MAAM,mDAAmD,CAAC;AAG3D,eAAO,MAAM,WAAW,0BAA0B,CAAC;AAEnD,KAAK,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC;AAEnE,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;;;EAI5D;AAED,mEAAmE;AACnE,wBAAgB,WAAW,CAC1B,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,MAAM,EACf,gBAAgB,EAAE,MAAM,GACtB,sBAAsB,CAWxB;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CACvB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,EACpC,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,QAErB,QAAQ,WAAW,MAAM,KAAG,OAAO,CAAC,oBAAoB,CAAC,CAW3E;AAED,wBAAsB,iBAAiB,oBAOtC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type Database, type MemoryStore, type RequestJsonExecutor } from "@codemem/core";
|
|
2
|
+
import { type RelayGroupResolution, type SyncPeerReachabilityResolver } from "@codemem/core/internal/relay-runtime";
|
|
3
|
+
export type RelayLogLevel = "info" | "warn";
|
|
4
|
+
export interface ViewerRelayReachabilityOptions {
|
|
5
|
+
readonly store: MemoryStore;
|
|
6
|
+
/** Device key directory. Defaults to `CODEMEM_KEYS_DIR`, then the standard key directory. */
|
|
7
|
+
readonly keysDir?: string;
|
|
8
|
+
/** Config record to read; defaults to the codemem config file plus environment overrides. */
|
|
9
|
+
readonly config?: Record<string, unknown>;
|
|
10
|
+
/** Cancels relay passes and registration maintenance that the daemon starts. */
|
|
11
|
+
readonly signal?: AbortSignal;
|
|
12
|
+
readonly log?: (message: string, level: RelayLogLevel) => void;
|
|
13
|
+
/** Test seam that replaces the coordinator fetch and pin check for one group. */
|
|
14
|
+
readonly resolveGroup?: (db: Database, groupId: string) => Promise<RelayGroupResolution>;
|
|
15
|
+
/** Test seam for the `/v1/relay/info` request. */
|
|
16
|
+
readonly request?: RequestJsonExecutor;
|
|
17
|
+
/** Disposable loopback fixtures only: allows `ws://` relay and `http://` admission on loopback. */
|
|
18
|
+
readonly allowLoopback?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface ViewerRelayReachability {
|
|
21
|
+
/** Per-peer resolver for `runSyncDaemon({ reachability })`. */
|
|
22
|
+
readonly reachability: SyncPeerReachabilityResolver;
|
|
23
|
+
/** Re-resolves every group. Builds, closes, or revalidates clients. Never rejects. */
|
|
24
|
+
refresh(): Promise<void>;
|
|
25
|
+
/** Closes every client. Later refreshes do nothing. Never rejects. */
|
|
26
|
+
close(): Promise<void>;
|
|
27
|
+
/** The latest resolution status for each configured group. */
|
|
28
|
+
status(): ReadonlyMap<string, RelayGroupResolution["status"]>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Device relay clients for `codemem serve`, one per configured coordinator
|
|
32
|
+
* group that the coordinator advertises and whose service key is pinned.
|
|
33
|
+
* Returns null when relay is off or coordinator sync is not configured, so
|
|
34
|
+
* callers keep plain direct sync. Failures leave only that group direct-only.
|
|
35
|
+
*/
|
|
36
|
+
export declare function createViewerRelayReachability(options: ViewerRelayReachabilityOptions): ViewerRelayReachability | null;
|
|
37
|
+
//# sourceMappingURL=relay-reachability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relay-reachability.d.ts","sourceRoot":"","sources":["../src/relay-reachability.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,QAAQ,EAGb,KAAK,WAAW,EAChB,KAAK,mBAAmB,EAGxB,MAAM,eAAe,CAAC;AACvB,OAAO,EAMN,KAAK,oBAAoB,EAMzB,KAAK,4BAA4B,EACjC,MAAM,sCAAsC,CAAC;AAG9C,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,CAAC;AAE5C,MAAM,WAAW,8BAA8B;IAC9C,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,6FAA6F;IAC7F,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,6FAA6F;IAC7F,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,gFAAgF;IAChF,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC/D,iFAAiF;IACjF,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACzF,kDAAkD;IAClD,QAAQ,CAAC,OAAO,CAAC,EAAE,mBAAmB,CAAC;IACvC,mGAAmG;IACnG,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,uBAAuB;IACvC,+DAA+D;IAC/D,QAAQ,CAAC,YAAY,EAAE,4BAA4B,CAAC;IACpD,sFAAsF;IACtF,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,sEAAsE;IACtE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,8DAA8D;IAC9D,MAAM,IAAI,WAAW,CAAC,MAAM,EAAE,oBAAoB,CAAC,QAAQ,CAAC,CAAC,CAAC;CAC9D;AAgUD;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAC5C,OAAO,EAAE,8BAA8B,GACrC,uBAAuB,GAAG,IAAI,CA4BhC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type BetterSqlite3 from "better-sqlite3";
|
|
2
|
+
import type { OwnedPeerHttpConnection } from "../../core/src/peer-http-client.js";
|
|
3
|
+
import type { RelayCheckPacket } from "../../core/src/relay-admission-codec.js";
|
|
4
|
+
import type { RelayFaultAction, RelayFaultFrame, RelayFaultRule } from "../../core/src/relay-fault-proxy-test-fixtures.js";
|
|
5
|
+
import { type RelayClientTestOptions } from "../../core/src/relay-peer-client-test-fixtures.js";
|
|
6
|
+
import type { SecretScanner } from "../../core/src/secret-scanner.js";
|
|
7
|
+
/** Disposers for fixtures built in the current test. Callers drain it in afterEach. */
|
|
8
|
+
export declare const relaySyncCleanups: (() => Promise<unknown>)[];
|
|
9
|
+
export declare function runRelaySyncCleanups(): Promise<void>;
|
|
10
|
+
export declare function relaySyncFixture(relayOptions?: RelayClientTestOptions): Promise<{
|
|
11
|
+
requests: import("./sync-channel-dispatch.js").SyncChannelRequest[];
|
|
12
|
+
connections: OwnedPeerHttpConnection[];
|
|
13
|
+
remote: {
|
|
14
|
+
store: import("@codemem/core").MemoryStore;
|
|
15
|
+
localDeviceId: string;
|
|
16
|
+
peerDeviceId: string;
|
|
17
|
+
peerKeysDir: string;
|
|
18
|
+
localPublicKey: string;
|
|
19
|
+
peerPublicKey: string;
|
|
20
|
+
peerPin: string;
|
|
21
|
+
storeFactory: import("vitest").Mock<() => import("@codemem/core").MemoryStore>;
|
|
22
|
+
cleanup(): void;
|
|
23
|
+
};
|
|
24
|
+
client: import("@codemem/core").MemoryStore;
|
|
25
|
+
seed(side: "remote" | "client", id: string, body?: string): {
|
|
26
|
+
op_id: string;
|
|
27
|
+
entity_type: string;
|
|
28
|
+
entity_id: string;
|
|
29
|
+
op_type: string;
|
|
30
|
+
payload_json: string;
|
|
31
|
+
clock_rev: number;
|
|
32
|
+
clock_updated_at: string;
|
|
33
|
+
clock_device_id: string;
|
|
34
|
+
device_id: string;
|
|
35
|
+
created_at: string;
|
|
36
|
+
scope_id: string;
|
|
37
|
+
};
|
|
38
|
+
cleanup(): Promise<void>;
|
|
39
|
+
relay: {
|
|
40
|
+
client: (deviceId: "source" | "target", overrides?: Partial<import("@codemem/core/internal/relay-runtime").RelayPeerClientOptions>) => import("@codemem/core/internal/relay-runtime").RelayPeerClient;
|
|
41
|
+
identities: {
|
|
42
|
+
source: {
|
|
43
|
+
key: import("crypto").KeyObject;
|
|
44
|
+
expectedPin: string;
|
|
45
|
+
};
|
|
46
|
+
target: {
|
|
47
|
+
key: import("crypto").KeyObject;
|
|
48
|
+
expectedPin: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
db: BetterSqlite3.Database;
|
|
52
|
+
quotaDb: BetterSqlite3.Database;
|
|
53
|
+
runtime: import("@codemem/core/internal/relay-runtime").RelayWebSocketRuntimeHandle;
|
|
54
|
+
checks: {
|
|
55
|
+
readonly packet: import("../../core/src/relay-admission-codec.js").RelayCheckPacket;
|
|
56
|
+
readonly deviceHeader: string;
|
|
57
|
+
readonly signal: AbortSignal;
|
|
58
|
+
}[];
|
|
59
|
+
checkTimes: number[];
|
|
60
|
+
namespace: {
|
|
61
|
+
authorityId: string;
|
|
62
|
+
groupId: string;
|
|
63
|
+
relayAudienceId: string;
|
|
64
|
+
};
|
|
65
|
+
proxy: import("../../core/src/relay-fault-proxy-test-fixtures.js").RelayFaultProxy | undefined;
|
|
66
|
+
url: string;
|
|
67
|
+
admissionUrl: string;
|
|
68
|
+
servicePublicKey: string;
|
|
69
|
+
dispose(): Promise<void>;
|
|
70
|
+
};
|
|
71
|
+
source: import("@codemem/core/internal/relay-runtime").RelayPeerClient;
|
|
72
|
+
target: import("@codemem/core/internal/relay-runtime").RelayPeerClient;
|
|
73
|
+
options: {
|
|
74
|
+
db: BetterSqlite3.Database;
|
|
75
|
+
peerDeviceId: string;
|
|
76
|
+
scopeId: string;
|
|
77
|
+
logicalOrigin: string;
|
|
78
|
+
keysDir?: string;
|
|
79
|
+
dbPath?: string;
|
|
80
|
+
scanner?: SecretScanner;
|
|
81
|
+
limit?: number;
|
|
82
|
+
signal?: AbortSignal;
|
|
83
|
+
deadlineMs?: number;
|
|
84
|
+
factory: {
|
|
85
|
+
open: import("vitest").Mock<(options: {
|
|
86
|
+
signal: AbortSignal;
|
|
87
|
+
deadlineMs: number;
|
|
88
|
+
}) => Promise<OwnedPeerHttpConnection>>;
|
|
89
|
+
failureReason: () => ("relay_aborted" | "relay_admission_failed" | "relay_disabled" | "relay_expired" | "relay_frame_invalid" | "relay_handshake_failed" | "relay_peer_revoked" | "relay_record_invalid" | "relay_rejected" | "relay_unavailable") | undefined;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
factory: {
|
|
93
|
+
open: import("vitest").Mock<(options: {
|
|
94
|
+
signal: AbortSignal;
|
|
95
|
+
deadlineMs: number;
|
|
96
|
+
}) => Promise<OwnedPeerHttpConnection>>;
|
|
97
|
+
failureReason: () => ("relay_aborted" | "relay_admission_failed" | "relay_disabled" | "relay_expired" | "relay_frame_invalid" | "relay_handshake_failed" | "relay_peer_revoked" | "relay_record_invalid" | "relay_rejected" | "relay_unavailable") | undefined;
|
|
98
|
+
};
|
|
99
|
+
control: {
|
|
100
|
+
interruptPost: boolean;
|
|
101
|
+
};
|
|
102
|
+
}>;
|
|
103
|
+
export type RelaySyncFixture = Awaited<ReturnType<typeof relaySyncFixture>>;
|
|
104
|
+
export type { BetterSqlite3, OwnedPeerHttpConnection, RelayCheckPacket, SecretScanner };
|
|
105
|
+
export declare function titles(f: RelaySyncFixture, side: "client" | "remote"): unknown[];
|
|
106
|
+
export declare function seedOtherSpace(f: RelaySyncFixture, authored: ReturnType<typeof f.seed>): void;
|
|
107
|
+
/** Applies `action` to the nth frame toward the source socket that `matches` selects. */
|
|
108
|
+
export declare function onSourceFrame(matches: (frame: RelayFaultFrame) => boolean, nth: number, action: RelayFaultAction): RelayFaultRule;
|
|
109
|
+
//# sourceMappingURL=relay-sync-test-fixtures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relay-sync-test-fixtures.d.ts","sourceRoot":"","sources":["../src/relay-sync-test-fixtures.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,aAAa,MAAM,gBAAgB,CAAC;AAEhD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,KAAK,EACX,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,MAAM,mDAAmD,CAAC;AAE3D,OAAO,EACN,KAAK,sBAAsB,EAE3B,MAAM,mDAAmD,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAMtE,uFAAuF;AACvF,eAAO,MAAM,iBAAiB,EAAE,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC,EAAO,CAAC;AAEhE,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC,CAE1D;AAOD,wBAAsB,gBAAgB,CAAC,YAAY,GAAE,sBAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoC/E;AAED,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC,CAAC;AAE5E,YAAY,EAAE,aAAa,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,aAAa,EAAE,CAAC;AAExF,wBAAgB,MAAM,CAAC,CAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE,QAAQ,GAAG,QAAQ,aAMpE;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,gBAAgB,EAAE,QAAQ,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,QAuBtF;AAED,yFAAyF;AACzF,wBAAgB,aAAa,CAC5B,OAAO,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,OAAO,EAC5C,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,gBAAgB,GACtB,cAAc,CAOhB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* POST /api/memory-tools/:name — run one codemem memory tool on behalf of a
|
|
3
|
+
* thin host (the OpenCode plugin) in another directory.
|
|
4
|
+
*
|
|
5
|
+
* The viewer serves every OpenCode project on the machine from one process,
|
|
6
|
+
* so the caller sends its own directory and CODEMEM_PROJECT and the tool runs
|
|
7
|
+
* with those instead of the viewer's working directory and environment. The
|
|
8
|
+
* tool itself is executed by an injected function: `codemem serve` supplies
|
|
9
|
+
* `callCodememToolLocally` from @codemem/mcp, which this package must not
|
|
10
|
+
* import. Results, input validation, and retrieval-ledger capture are
|
|
11
|
+
* therefore identical to stdio MCP and to the `codemem memory-tool` fallback.
|
|
12
|
+
*
|
|
13
|
+
* Request body:
|
|
14
|
+
* { arguments: {...},
|
|
15
|
+
* caller: { directory: "/abs/path", env_project: string|null,
|
|
16
|
+
* session_id?: string, request_id?: string },
|
|
17
|
+
* db_path, identity_target }
|
|
18
|
+
*
|
|
19
|
+
* The target pair is required (not optional as on read routes) because this
|
|
20
|
+
* route can write. Responses: 200 `{ok:true,result}` or `{ok:false,error,result?}`
|
|
21
|
+
* when the tool ran; 400/409 when the request or target is invalid.
|
|
22
|
+
*/
|
|
23
|
+
import type { MemoryStore } from "@codemem/core";
|
|
24
|
+
import { Hono } from "hono";
|
|
25
|
+
export declare const MEMORY_TOOL_CALL_CAPABILITY = "memory_tool_call";
|
|
26
|
+
export interface MemoryToolCaller {
|
|
27
|
+
cwd: string;
|
|
28
|
+
envProject: string | null;
|
|
29
|
+
sessionId?: string;
|
|
30
|
+
/** Host tool-call ID; a retried delivery of the same call records one ledger attempt. */
|
|
31
|
+
requestId?: string;
|
|
32
|
+
statelessLedger: true;
|
|
33
|
+
}
|
|
34
|
+
export type MemoryToolCallFn = (store: MemoryStore, name: string, args: Record<string, unknown>, caller: MemoryToolCaller) => Promise<unknown>;
|
|
35
|
+
type ParsedCall = {
|
|
36
|
+
ok: true;
|
|
37
|
+
args: Record<string, unknown>;
|
|
38
|
+
caller: MemoryToolCaller;
|
|
39
|
+
} | {
|
|
40
|
+
ok: false;
|
|
41
|
+
message: string;
|
|
42
|
+
};
|
|
43
|
+
/** Validate the body shape; caller context is mandatory so nothing defaults to the viewer's cwd. */
|
|
44
|
+
export declare function parseMemoryToolCall(body: Record<string, unknown>): ParsedCall;
|
|
45
|
+
export declare function memoryToolCallRoutes(getStore: () => MemoryStore, call: MemoryToolCallFn): Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
|
|
46
|
+
export {};
|
|
47
|
+
//# sourceMappingURL=memory-tool-call.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-tool-call.d.ts","sourceRoot":"","sources":["../../src/routes/memory-tool-call.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAI5B,eAAO,MAAM,2BAA2B,qBAAqB,CAAC;AAM9D,MAAM,WAAW,gBAAgB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yFAAyF;IACzF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,IAAI,CAAC;CACtB;AAED,MAAM,MAAM,gBAAgB,GAAG,CAC9B,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,MAAM,EAAE,gBAAgB,KACpB,OAAO,CAAC,OAAO,CAAC,CAAC;AAEtB,KAAK,UAAU,GACZ;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,MAAM,EAAE,gBAAgB,CAAA;CAAE,GACrE;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAuBlC,oGAAoG;AACpG,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,UAAU,CA+B7E;AAyBD,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,WAAW,EAAE,IAAI,EAAE,gBAAgB,8EAuBvF"}
|
package/dist/routes/pack.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { MemoryStore } from "@codemem/core";
|
|
2
2
|
import { Hono } from "hono";
|
|
3
3
|
type StoreFactory = () => MemoryStore;
|
|
4
|
-
export declare function packTransportRoutes(getStore: StoreFactory
|
|
4
|
+
export declare function packTransportRoutes(getStore: StoreFactory, options?: {
|
|
5
|
+
capabilities?: readonly string[];
|
|
6
|
+
}): Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
|
|
5
7
|
export {};
|
|
6
8
|
//# sourceMappingURL=pack.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack.d.ts","sourceRoot":"","sources":["../../src/routes/pack.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIX,WAAW,EAMX,MAAM,eAAe,CAAC;AAYvB,OAAO,EAAgB,IAAI,EAAE,MAAM,MAAM,CAAC;AAI1C,KAAK,YAAY,GAAG,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"pack.d.ts","sourceRoot":"","sources":["../../src/routes/pack.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIX,WAAW,EAMX,MAAM,eAAe,CAAC;AAYvB,OAAO,EAAgB,IAAI,EAAE,MAAM,MAAM,CAAC;AAI1C,KAAK,YAAY,GAAG,MAAM,WAAW,CAAC;AAsgBtC,wBAAgB,mBAAmB,CAClC,QAAQ,EAAE,YAAY,EACtB,OAAO,GAAE;IAAE,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAO,8EAoElD"}
|
package/dist/routes/sync.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export interface SyncRoutesOptions {
|
|
|
17
17
|
renameCoordinatorGroup?: typeof coordinatorRenameGroupAction;
|
|
18
18
|
}
|
|
19
19
|
interface SyncProtocolRouteOptions {
|
|
20
|
+
syncChannelPeerPin?: (request: Request) => string | null;
|
|
20
21
|
routeRateLimit?: {
|
|
21
22
|
limiter: InMemoryRequestRateLimiter;
|
|
22
23
|
readLimit: number;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;QAC/B,iBAAiB,EAAE,MAAM,CAAC;KAC1B,CAAC,CAAC;CACH;AAqED,wBAAgB,uCAAuC,CACtD,KAAK,EAAE,WAAW,GAChB,sCAAsC,CAoCxC;AA8xDD,MAAM,WAAW,yBAAyB;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC;AAED,wBAAgB,gCAAgC,CAC/C,KAAK,EAAE,WAAW,EAClB,iBAAiB,EAAE,MAAM,GACvB,yBAAyB,EAAE,CAoC7B;AA2rBD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,GAAE,wBAA6B,8EAmW7F;AA6gBD,wBAAgB,UAAU,CACzB,QAAQ,EAAE,YAAY,EACtB,oBAAoB,CAAC,EAAE,MAAM,iBAAiB,GAAG,IAAI,EACrD,OAAO,GAAE,iBAAsB,8EAijG/B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MemoryStore } from "@codemem/core";
|
|
2
|
+
/** Share the default connection across viewer and sync listeners. */
|
|
3
|
+
export declare function getStore(): MemoryStore;
|
|
4
|
+
/** Close a synchronous-only shared store. Async pack owners use closeStoreAsync(). */
|
|
5
|
+
export declare function closeStore(): void;
|
|
6
|
+
/** Drain semantic work before closing SQLite and releasing the shared store. */
|
|
7
|
+
export declare function closeStoreAsync(): Promise<void>;
|
|
8
|
+
//# sourceMappingURL=shared-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-store.d.ts","sourceRoot":"","sources":["../src/shared-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAiB,MAAM,eAAe,CAAC;AAK3D,qEAAqE;AACrE,wBAAgB,QAAQ,IAAI,WAAW,CAKtC;AAED,sFAAsF;AACtF,wBAAgB,UAAU,IAAI,IAAI,CAGjC;AAED,gFAAgF;AAChF,wBAAgB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAS/C"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { MemoryStore } from "@codemem/core";
|
|
2
|
+
import { Hono } from "hono";
|
|
3
|
+
import { type InMemoryRequestRateLimiter } from "./request-rate-limit.js";
|
|
4
|
+
export interface SyncAppOptions {
|
|
5
|
+
storeFactory?: () => MemoryStore;
|
|
6
|
+
syncChannelPeerPin?: (request: Request) => string | null;
|
|
7
|
+
syncRequestRateLimit?: {
|
|
8
|
+
limiter?: InMemoryRequestRateLimiter;
|
|
9
|
+
readLimit?: number;
|
|
10
|
+
mutationLimit?: number;
|
|
11
|
+
unauthenticatedReadLimit?: number;
|
|
12
|
+
unauthenticatedMutationLimit?: number;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/** Keep the network listener limited to signature-authenticated peer protocol routes. */
|
|
16
|
+
export declare function createSyncApp(opts?: SyncAppOptions): Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
|
|
17
|
+
//# sourceMappingURL=sync-app.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync-app.d.ts","sourceRoot":"","sources":["../src/sync-app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAEN,KAAK,0BAA0B,EAC/B,MAAM,yBAAyB,CAAC;AAIjC,MAAM,WAAW,cAAc;IAC9B,YAAY,CAAC,EAAE,MAAM,WAAW,CAAC;IACjC,kBAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,MAAM,GAAG,IAAI,CAAC;IACzD,oBAAoB,CAAC,EAAE;QACtB,OAAO,CAAC,EAAE,0BAA0B,CAAC;QACrC,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,wBAAwB,CAAC,EAAE,MAAM,CAAC;QAClC,4BAA4B,CAAC,EAAE,MAAM,CAAC;KACtC,CAAC;CACF;AAED,yFAAyF;AACzF,wBAAgB,aAAa,CAAC,IAAI,CAAC,EAAE,cAAc,8EA8BlD"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { MemoryStore } from "@codemem/core";
|
|
2
|
+
import type { SyncChannelRequest } from "./sync-channel-dispatch.js";
|
|
3
|
+
export declare const ORIGIN = "https://peer.invalid";
|
|
4
|
+
export declare const SCOPE = "channel-scope";
|
|
5
|
+
export declare const TARGET = "/v1/ops?scope_id=channel-scope&z=2&x=%2f&z=1";
|
|
6
|
+
export declare const bytes: (value: unknown) => Buffer;
|
|
7
|
+
export declare const json: (response: {
|
|
8
|
+
bodyBytes: Uint8Array;
|
|
9
|
+
}) => unknown;
|
|
10
|
+
export declare function channelStore(options?: {
|
|
11
|
+
passiveOnly?: boolean;
|
|
12
|
+
}): Promise<{
|
|
13
|
+
store: MemoryStore;
|
|
14
|
+
localDeviceId: string;
|
|
15
|
+
peerDeviceId: string;
|
|
16
|
+
peerKeysDir: string;
|
|
17
|
+
localPublicKey: string;
|
|
18
|
+
peerPublicKey: string;
|
|
19
|
+
peerPin: string;
|
|
20
|
+
storeFactory: import("vitest").Mock<() => MemoryStore>;
|
|
21
|
+
cleanup(): void;
|
|
22
|
+
}>;
|
|
23
|
+
export declare function signedRequest(f: Awaited<ReturnType<typeof channelStore>>, options?: {
|
|
24
|
+
method?: "GET" | "POST";
|
|
25
|
+
target?: string;
|
|
26
|
+
bodyBytes?: Buffer;
|
|
27
|
+
recipientId?: string;
|
|
28
|
+
}): SyncChannelRequest;
|
|
29
|
+
export declare function nonceCount(f: Awaited<ReturnType<typeof channelStore>>): unknown;
|
|
30
|
+
export declare function memoryOp(f: Awaited<ReturnType<typeof channelStore>>): {
|
|
31
|
+
op_id: string;
|
|
32
|
+
entity_type: string;
|
|
33
|
+
entity_id: string;
|
|
34
|
+
op_type: string;
|
|
35
|
+
payload_json: string;
|
|
36
|
+
clock_rev: number;
|
|
37
|
+
clock_updated_at: string;
|
|
38
|
+
clock_device_id: string;
|
|
39
|
+
device_id: string;
|
|
40
|
+
created_at: string;
|
|
41
|
+
scope_id: string;
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=sync-channel-dispatch-test-fixtures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync-channel-dispatch-test-fixtures.d.ts","sourceRoot":"","sources":["../src/sync-channel-dispatch-test-fixtures.ts"],"names":[],"mappings":"AAGA,OAAO,EASN,WAAW,EAEX,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE,eAAO,MAAM,MAAM,yBAAyB,CAAC;AAC7C,eAAO,MAAM,KAAK,kBAAkB,CAAC;AACrC,eAAO,MAAM,MAAM,iDAA4C,CAAC;AAChE,eAAO,MAAM,KAAK,UAAW,OAAO,KAAG,MAA4C,CAAC;AACpF,eAAO,MAAM,IAAI,aAAc;IAAE,SAAS,EAAE,UAAU,CAAA;CAAE,KAAG,OACF,CAAC;AAE1D,wBAAsB,YAAY,CAAC,OAAO,GAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAO;;;;;;;;;;GAgDzE;AAiBD,wBAAgB,aAAa,CAC5B,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,EAC3C,OAAO,GAAE;IACR,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CAChB,GACJ,kBAAkB,CAkCpB;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,GAAG,OAAO,CAK/E;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;;;;;;;;;;;;EAwBnE"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { MemoryStore } from "@codemem/core";
|
|
2
|
+
export interface SyncChannelRequest {
|
|
3
|
+
readonly method: "GET" | "POST";
|
|
4
|
+
readonly target: string;
|
|
5
|
+
readonly url: string;
|
|
6
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
7
|
+
readonly bodyBytes: Uint8Array;
|
|
8
|
+
readonly peerPin: string;
|
|
9
|
+
readonly signal: AbortSignal;
|
|
10
|
+
}
|
|
11
|
+
export interface SyncChannelResponse {
|
|
12
|
+
readonly status: number;
|
|
13
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
14
|
+
readonly bodyBytes: Uint8Array;
|
|
15
|
+
}
|
|
16
|
+
export declare function createSyncChannelDispatcher(options: {
|
|
17
|
+
readonly storeFactory: () => MemoryStore;
|
|
18
|
+
}): (request: SyncChannelRequest) => Promise<SyncChannelResponse>;
|
|
19
|
+
//# sourceMappingURL=sync-channel-dispatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync-channel-dispatch.d.ts","sourceRoot":"","sources":["../src/sync-channel-dispatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,MAAM,EAAE,KAAK,GAAG,MAAM,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACnD,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;CAC7B;AAED,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACpD,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;CAC/B;AA+GD,wBAAgB,2BAA2B,CAAC,OAAO,EAAE;IACpD,QAAQ,CAAC,YAAY,EAAE,MAAM,WAAW,CAAC;CACzC,GAAG,CAAC,OAAO,EAAE,kBAAkB,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAsBhE"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { MemoryStore } from "@codemem/core";
|
|
2
|
+
import type { OwnedPeerHttpConnection } from "../../core/src/peer-http-client.js";
|
|
3
|
+
import type { ScopedChannelSyncOptions } from "../../core/src/sync-channel-pass.js";
|
|
4
|
+
import { type SyncChannelRequest, type SyncChannelResponse } from "./sync-channel-dispatch.js";
|
|
5
|
+
import { channelStore } from "./sync-channel-dispatch-test-fixtures.js";
|
|
6
|
+
type Remote = Awaited<ReturnType<typeof channelStore>> & {
|
|
7
|
+
serverKeysDir?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function passFixture(): Promise<{
|
|
10
|
+
factory: {
|
|
11
|
+
open: import("vitest").Mock<(_options: {
|
|
12
|
+
signal: AbortSignal;
|
|
13
|
+
deadlineMs: number;
|
|
14
|
+
}) => Promise<OwnedPeerHttpConnection>>;
|
|
15
|
+
};
|
|
16
|
+
control: {
|
|
17
|
+
beforeOpen?: () => void;
|
|
18
|
+
beforeDispatch?: (request: SyncChannelRequest) => void;
|
|
19
|
+
wrapOwner?: (connection: OwnedPeerHttpConnection) => OwnedPeerHttpConnection;
|
|
20
|
+
afterDispatch?: (request: SyncChannelRequest, response: SyncChannelResponse) => Promise<SyncChannelResponse> | SyncChannelResponse;
|
|
21
|
+
wrongPin?: boolean;
|
|
22
|
+
};
|
|
23
|
+
requests: SyncChannelRequest[];
|
|
24
|
+
connections: OwnedPeerHttpConnection[];
|
|
25
|
+
remote: {
|
|
26
|
+
store: MemoryStore;
|
|
27
|
+
localDeviceId: string;
|
|
28
|
+
peerDeviceId: string;
|
|
29
|
+
peerKeysDir: string;
|
|
30
|
+
localPublicKey: string;
|
|
31
|
+
peerPublicKey: string;
|
|
32
|
+
peerPin: string;
|
|
33
|
+
storeFactory: import("vitest").Mock<() => MemoryStore>;
|
|
34
|
+
cleanup(): void;
|
|
35
|
+
};
|
|
36
|
+
client: MemoryStore;
|
|
37
|
+
options: ScopedChannelSyncOptions;
|
|
38
|
+
seed(side: "remote" | "client", id: string, body?: string): {
|
|
39
|
+
op_id: string;
|
|
40
|
+
entity_type: string;
|
|
41
|
+
entity_id: string;
|
|
42
|
+
op_type: string;
|
|
43
|
+
payload_json: string;
|
|
44
|
+
clock_rev: number;
|
|
45
|
+
clock_updated_at: string;
|
|
46
|
+
clock_device_id: string;
|
|
47
|
+
device_id: string;
|
|
48
|
+
created_at: string;
|
|
49
|
+
scope_id: string;
|
|
50
|
+
};
|
|
51
|
+
cleanup(): Promise<void>;
|
|
52
|
+
}>;
|
|
53
|
+
/** A second real server shares the first fixture's client identity and Space. */
|
|
54
|
+
export declare function addPassPeer(first: Awaited<ReturnType<typeof passFixture>>): Promise<{
|
|
55
|
+
factory: {
|
|
56
|
+
open: import("vitest").Mock<(_options: {
|
|
57
|
+
signal: AbortSignal;
|
|
58
|
+
deadlineMs: number;
|
|
59
|
+
}) => Promise<OwnedPeerHttpConnection>>;
|
|
60
|
+
};
|
|
61
|
+
control: {
|
|
62
|
+
beforeOpen?: () => void;
|
|
63
|
+
beforeDispatch?: (request: SyncChannelRequest) => void;
|
|
64
|
+
wrapOwner?: (connection: OwnedPeerHttpConnection) => OwnedPeerHttpConnection;
|
|
65
|
+
afterDispatch?: (request: SyncChannelRequest, response: SyncChannelResponse) => Promise<SyncChannelResponse> | SyncChannelResponse;
|
|
66
|
+
wrongPin?: boolean;
|
|
67
|
+
};
|
|
68
|
+
requests: SyncChannelRequest[];
|
|
69
|
+
connections: OwnedPeerHttpConnection[];
|
|
70
|
+
remote: Remote;
|
|
71
|
+
options: ScopedChannelSyncOptions;
|
|
72
|
+
cleanup(): Promise<void>;
|
|
73
|
+
}>;
|
|
74
|
+
/** Real retention advances only the floor, leaving a completed null-baseline boundary unchanged. */
|
|
75
|
+
export declare function prepareStaleChannelPull(f: Awaited<ReturnType<typeof passFixture>>): Promise<{
|
|
76
|
+
boundary: import("../../core/src/sync-replication.js").SyncResetBoundary;
|
|
77
|
+
previousCursor: string;
|
|
78
|
+
entityId: string;
|
|
79
|
+
}>;
|
|
80
|
+
export {};
|
|
81
|
+
//# sourceMappingURL=sync-channel-pass-test-fixtures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync-channel-pass-test-fixtures.d.ts","sourceRoot":"","sources":["../src/sync-channel-pass-test-fixtures.ts"],"names":[],"mappings":"AAKA,OAAO,EAA6C,WAAW,EAAE,MAAM,eAAe,CAAC;AAEvF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AASlF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAQpF,OAAO,EAEN,KAAK,kBAAkB,EACvB,KAAK,mBA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AuthorityOptions {
|
|
2
|
+
/** Trusted configured host, actual port and optional bound IP, or null before listening. */
|
|
3
|
+
getListenerAddress: () => {
|
|
4
|
+
host: string;
|
|
5
|
+
port: number;
|
|
6
|
+
address?: string;
|
|
7
|
+
} | null;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Protect every loopback viewer request before preflight and route dispatch.
|
|
11
|
+
* Explicit external listeners retain their existing external-auth requirements.
|
|
12
|
+
* Proxy forwarding headers never supply trusted listener or request authority.
|
|
13
|
+
*/
|
|
14
|
+
export declare function viewerAuthorityGuard(options?: ViewerAuthorityOptions): import("hono").MiddlewareHandler<any, string, {}, Response & import("hono").TypedResponse<{
|
|
15
|
+
error: string;
|
|
16
|
+
}, 403, "json">>;
|
|
17
|
+
//# sourceMappingURL=viewer-authority.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewer-authority.d.ts","sourceRoot":"","sources":["../src/viewer-authority.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,sBAAsB;IACtC,4FAA4F;IAC5F,kBAAkB,EAAE,MAAM;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CAClF;AA2GD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,CAAC,EAAE,sBAAsB;;iBAiBpE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codemem/server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.48.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"static/"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codemem/core": "^0.
|
|
18
|
+
"@codemem/core": "^0.48.0",
|
|
19
19
|
"@hono/node-server": "^2.1.1",
|
|
20
20
|
"drizzle-orm": "^0.45.2",
|
|
21
21
|
"hono": "^4.13.5",
|