@cello-protocol/gateway 0.0.12 → 0.0.14
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/bin/cello-gateway.js +74 -17
- package/dist/bin/cello-gateway.js.map +1 -1
- package/dist/client.d.ts +12 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +30 -0
- package/dist/client.js.map +1 -1
- package/dist/config/config-store.d.ts +24 -1
- package/dist/config/config-store.d.ts.map +1 -1
- package/dist/config/config-store.js +9 -2
- package/dist/config/config-store.js.map +1 -1
- package/dist/detect/index.d.ts +9 -5
- package/dist/detect/index.d.ts.map +1 -1
- package/dist/detect/index.js +9 -5
- package/dist/detect/index.js.map +1 -1
- package/dist/detect/pii.d.ts.map +1 -1
- package/dist/detect/pii.js +43 -1
- package/dist/detect/pii.js.map +1 -1
- package/dist/detect/rate-limit.d.ts +0 -12
- package/dist/detect/rate-limit.d.ts.map +1 -1
- package/dist/detect/rate-limit.js +16 -1
- package/dist/detect/rate-limit.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/passthrough.d.ts +11 -6
- package/dist/passthrough.d.ts.map +1 -1
- package/dist/passthrough.js +10 -5
- package/dist/passthrough.js.map +1 -1
- package/dist/records/record-store.d.ts +26 -1
- package/dist/records/record-store.d.ts.map +1 -1
- package/dist/records/record-store.js +9 -2
- package/dist/records/record-store.js.map +1 -1
- package/dist/screen/affordance.d.ts +32 -0
- package/dist/screen/affordance.d.ts.map +1 -0
- package/dist/screen/affordance.js +37 -0
- package/dist/screen/affordance.js.map +1 -0
- package/dist/screen/inbound.d.ts.map +1 -1
- package/dist/screen/inbound.js +6 -2
- package/dist/screen/inbound.js.map +1 -1
- package/dist/screen/outbound.d.ts.map +1 -1
- package/dist/screen/outbound.js +15 -4
- package/dist/screen/outbound.js.map +1 -1
- package/dist/spawn.d.ts.map +1 -1
- package/dist/spawn.js +33 -5
- package/dist/spawn.js.map +1 -1
- package/dist/store/encrypted-db.d.ts +12 -2
- package/dist/store/encrypted-db.d.ts.map +1 -1
- package/dist/store/encrypted-db.js +73 -10
- package/dist/store/encrypted-db.js.map +1 -1
- package/dist/testing.d.ts +14 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +14 -0
- package/dist/testing.js.map +1 -0
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +6 -2
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* M9-OUT-004 — per-agent-identity outbound rate limiting.
|
|
3
|
+
*
|
|
4
|
+
* A sliding-window counter keyed on the AGENT IDENTITY (peer-id / agent name), never a source IP —
|
|
5
|
+
* so a compromised or runaway agent cannot flood a peer or use volume as an exfiltration channel,
|
|
6
|
+
* while a normal agent's traffic is never throttled or delayed. Pure in-memory, deterministic with
|
|
7
|
+
* an injectable clock.
|
|
8
|
+
*
|
|
9
|
+
* The cap is a configured value (M9-CFG-001 owns the config; this is the enforcement). A throttled
|
|
10
|
+
* verdict carries a distinct `rate_limited` reason and a retry-after, surfaced to the agent through
|
|
11
|
+
* the outbound seam's never-hang feedback (M9-CORE-001 / M9-FEED-001).
|
|
12
|
+
*/
|
|
13
|
+
import { operatorCanRun } from "../screen/affordance.js";
|
|
1
14
|
export class OutboundRateLimiter {
|
|
2
15
|
#config;
|
|
3
16
|
#now;
|
|
@@ -29,7 +42,9 @@ export class OutboundRateLimiter {
|
|
|
29
42
|
reason: "rate_limited",
|
|
30
43
|
guidance: `Outbound rate limit reached for this agent (${this.#config.maxPerWindow} messages per ` +
|
|
31
44
|
`${Math.round(this.#config.windowMs / 1000)}s). This message was not sent. ` +
|
|
32
|
-
`
|
|
45
|
+
`WHAT YOU CAN DO NOW: wait about ${Math.ceil(retryAfterMs / 1000)}s and retry — the window ` +
|
|
46
|
+
`slides as older messages age out, so this clears itself.\n` +
|
|
47
|
+
operatorCanRun("rate_max_per_window", "<higher number>"),
|
|
33
48
|
retryAfterMs,
|
|
34
49
|
};
|
|
35
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rate-limit.js","sourceRoot":"","sources":["../../src/detect/rate-limit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rate-limit.js","sourceRoot":"","sources":["../../src/detect/rate-limit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAgBzD,MAAM,OAAO,mBAAmB;IACrB,OAAO,CAAkB;IACzB,IAAI,CAAe;IAC5B,kFAAkF;IACzE,MAAM,GAAG,IAAI,GAAG,EAAoB,CAAC;IAE9C,YAAY,MAAuB,EAAE,MAAoB,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;QACvE,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IAClB,CAAC;IAED,0FAA0F;IAC1F,KAAK,CAAC,aAAqB,EAAE,GAAW;QACtC,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAC3C,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACvE,CAAC;IAED;;;;;OAKG;IACH,IAAI,CAAC,aAAqB;QACxB,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QACxB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;QAC5C,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,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
|
5
5
|
* (`SecurityGatewayClient` + verdict types) and a client implementation; all detection lives
|
|
6
6
|
* here. M9-CORE-001 ships the seam with a pass-through; later stories add the pipeline.
|
|
7
7
|
*/
|
|
8
|
+
export type { GatewayMode } from "./types.js";
|
|
8
9
|
export type { ScreenDirection, ScreenDisposition, GovernanceDisposition, GovernanceEvent, ScreenContext, ScreenVerdict, SecurityGatewayClient, } from "./types.js";
|
|
9
10
|
export { OutboundScreener } from "./screen/outbound.js";
|
|
10
11
|
export type { OutboundVerdict, OutboundScreenerOptions, OutboundScreenContext } from "./screen/outbound.js";
|
|
@@ -23,12 +24,11 @@ export type { InstallResult, InstallOptions } from "./detect/model-installer.js"
|
|
|
23
24
|
export { DEBERTA_MODEL } from "./detect/deberta-model-manifest.js";
|
|
24
25
|
export { GatewayConfigStore } from "./config/config-store.js";
|
|
25
26
|
export type { ConfigDirection, SetResult, ConfigVersionRow } from "./config/config-store.js";
|
|
26
|
-
export { GatewayStoreError } from "./store/encrypted-db.js";
|
|
27
|
-
export type { GatewayStoreErrorCode } from "./store/encrypted-db.js";
|
|
27
|
+
export { GatewayStoreError, stderrStoreEventSink, openEncryptedStoreDb } from "./store/encrypted-db.js";
|
|
28
|
+
export type { GatewayStoreErrorCode, StoreEventSink } from "./store/encrypted-db.js";
|
|
28
29
|
export { GatewayRecordStore } from "./records/record-store.js";
|
|
29
30
|
export type { RecordDisposition, RecordDirection, RecordInput, SecurityRecord } from "./records/record-store.js";
|
|
30
31
|
export { GATEWAY_UNAVAILABLE, GOVERNANCE_TIMEOUT, failClosedVerdict } from "./types.js";
|
|
31
|
-
export { PassthroughGatewayClient } from "./passthrough.js";
|
|
32
32
|
export { SCREEN_OUTBOUND, SCREEN_INBOUND, encodeFrame, FrameDecoder, } from "./protocol.js";
|
|
33
33
|
export type { ScreenMethod, WireScreenRequest, WireScreenResponse } from "./protocol.js";
|
|
34
34
|
export { createGatewayServer } from "./server.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1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mBAAmB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtE,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -11,10 +11,12 @@ export { InjectionScanner, scoreToVerdict, BLOCK_THRESHOLD, FLAG_THRESHOLD } fro
|
|
|
11
11
|
export { isModelInstalled, installModel, verifyModel, sha256File } from "./detect/model-installer.js";
|
|
12
12
|
export { DEBERTA_MODEL } from "./detect/deberta-model-manifest.js";
|
|
13
13
|
export { GatewayConfigStore } from "./config/config-store.js";
|
|
14
|
-
export { GatewayStoreError } from "./store/encrypted-db.js";
|
|
14
|
+
export { GatewayStoreError, stderrStoreEventSink, openEncryptedStoreDb } from "./store/encrypted-db.js";
|
|
15
15
|
export { GatewayRecordStore } from "./records/record-store.js";
|
|
16
16
|
export { GATEWAY_UNAVAILABLE, GOVERNANCE_TIMEOUT, failClosedVerdict } from "./types.js";
|
|
17
|
-
|
|
17
|
+
// PassthroughGatewayClient is NOT exported here — it lives at `@cello-protocol/gateway/testing`
|
|
18
|
+
// (DOD-M9C-WIRE-1). An always-allow client on the production barrel is how the security layer
|
|
19
|
+
// shipped inert; reaching for it should be a deliberate act, visible in a diff.
|
|
18
20
|
// Wire protocol (shared by the local sidecar; Phase 2's mTLS gateway reuses these shapes).
|
|
19
21
|
export { SCREEN_OUTBOUND, SCREEN_INBOUND, encodeFrame, FrameDecoder, } from "./protocol.js";
|
|
20
22
|
// The gateway server (the separate program) + the screen-function and logger seams.
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAkBA,mGAAmG;AACnG,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,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@ -1,17 +1,22 @@
|
|
|
1
|
-
import type { ScreenContext, ScreenVerdict, SecurityGatewayClient } from "./types.js";
|
|
1
|
+
import type { GatewayMode, ScreenContext, ScreenVerdict, SecurityGatewayClient } from "./types.js";
|
|
2
2
|
/**
|
|
3
3
|
* The null-object gateway client: screens nothing, always allows.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
5
|
+
* ⚠️ TEST-ONLY (INV-9). No shipped code path may construct this. It was once the daemon's DEFAULT
|
|
6
|
+
* when no gateway was configured, and because nothing in the product ever configured one, the
|
|
7
|
+
* entire security layer was inert in every released build for weeks while the daemon cheerfully
|
|
8
|
+
* announced it was connected. `DaemonConfig.securityGateway` is now REQUIRED, so a test that
|
|
9
|
+
* wants no screening must say so by passing this explicitly — an honest declaration instead of a
|
|
10
|
+
* silent inheritance.
|
|
11
|
+
*
|
|
12
|
+
* It still RETURNS a verdict (`allow`), so SI-001 ("never act on content without a verdict") holds
|
|
13
|
+
* on this path too: "not screening" means "always-allow verdict", never "no verdict".
|
|
10
14
|
*
|
|
11
15
|
* It contains no detection logic. Real screening lives in the gateway PROGRAM (the server +
|
|
12
16
|
* the local sidecar / remote client), never in the daemon.
|
|
13
17
|
*/
|
|
14
18
|
export declare class PassthroughGatewayClient implements SecurityGatewayClient {
|
|
19
|
+
readonly mode: GatewayMode;
|
|
15
20
|
screenOutbound(content: Uint8Array, _ctx: ScreenContext): Promise<ScreenVerdict>;
|
|
16
21
|
screenInbound(content: Uint8Array, _ctx: ScreenContext): Promise<ScreenVerdict>;
|
|
17
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"passthrough.d.ts","sourceRoot":"","sources":["../src/passthrough.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"passthrough.d.ts","sourceRoot":"","sources":["../src/passthrough.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnG;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,wBAAyB,YAAW,qBAAqB;IACpE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAiB;IAErC,cAAc,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IAIhF,aAAa,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;CAGtF"}
|
package/dist/passthrough.js
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The null-object gateway client: screens nothing, always allows.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* ⚠️ TEST-ONLY (INV-9). No shipped code path may construct this. It was once the daemon's DEFAULT
|
|
5
|
+
* when no gateway was configured, and because nothing in the product ever configured one, the
|
|
6
|
+
* entire security layer was inert in every released build for weeks while the daemon cheerfully
|
|
7
|
+
* announced it was connected. `DaemonConfig.securityGateway` is now REQUIRED, so a test that
|
|
8
|
+
* wants no screening must say so by passing this explicitly — an honest declaration instead of a
|
|
9
|
+
* silent inheritance.
|
|
10
|
+
*
|
|
11
|
+
* It still RETURNS a verdict (`allow`), so SI-001 ("never act on content without a verdict") holds
|
|
12
|
+
* on this path too: "not screening" means "always-allow verdict", never "no verdict".
|
|
9
13
|
*
|
|
10
14
|
* It contains no detection logic. Real screening lives in the gateway PROGRAM (the server +
|
|
11
15
|
* the local sidecar / remote client), never in the daemon.
|
|
12
16
|
*/
|
|
13
17
|
export class PassthroughGatewayClient {
|
|
18
|
+
mode = "passthrough";
|
|
14
19
|
async screenOutbound(content, _ctx) {
|
|
15
20
|
return { disposition: "allow", content };
|
|
16
21
|
}
|
package/dist/passthrough.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"passthrough.js","sourceRoot":"","sources":["../src/passthrough.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"passthrough.js","sourceRoot":"","sources":["../src/passthrough.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,wBAAwB;IAC1B,IAAI,GAAgB,aAAa,CAAC;IAE3C,KAAK,CAAC,cAAc,CAAC,OAAmB,EAAE,IAAmB;QAC3D,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,OAAmB,EAAE,IAAmB;QAC1D,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;IAC3C,CAAC;CACF"}
|
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* M9-REC-001 — local security-pass records.
|
|
3
|
+
*
|
|
4
|
+
* The gateway records what it did to EVERY message it screens — clean / redacted / blocked / warned —
|
|
5
|
+
* in the gateway's SQLCipher store, opened with the daemon's key (DOD-M9C-STORE-1; INV-4 as amended).
|
|
6
|
+
* Each record is hash-chained to the
|
|
7
|
+
* prior one (a per-record fingerprint over the record fields + the previous fingerprint), so a NAIVELY
|
|
8
|
+
* edited, deleted (mid-chain), or reordered record breaks the chain and `verifyChain()` returns false.
|
|
9
|
+
* A CLEAN pass is recorded too: an ABSENT record for a delivered message is itself evidence of suppression.
|
|
10
|
+
*
|
|
11
|
+
* Local limit (the chain is an UNKEYED sha256): an actor with DB write access can still TAIL-TRUNCATE the
|
|
12
|
+
* most recent records or rewrite the WHOLE chain consistently and pass `verifyChain()`. Detecting that
|
|
13
|
+
* needs the Phase-2 attested head anchored on the directory (M9-ATTEST-001) — this store is the local
|
|
14
|
+
* half; the fingerprint computed here is exactly what that head attests.
|
|
15
|
+
*
|
|
16
|
+
* This is the cheap, local half of #5 (tamper-proof records). Sending each fingerprint to the directory
|
|
17
|
+
* for cross-node tamper detection is Phase-2 (M9-ATTEST-001); the fingerprint computed here is exactly
|
|
18
|
+
* what gets attested, so Phase 2 is an add, not a rework.
|
|
19
|
+
*/
|
|
20
|
+
import { type StoreEventSink } from "../store/encrypted-db.js";
|
|
1
21
|
export type RecordDisposition = "clean" | "redact" | "block" | "warn";
|
|
2
22
|
export type RecordDirection = "inbound" | "outbound";
|
|
3
23
|
export interface RecordInput {
|
|
@@ -17,7 +37,7 @@ export declare class GatewayRecordStore {
|
|
|
17
37
|
#private;
|
|
18
38
|
/** Opens (creating if absent) the encrypted store at `dbPath`, keyed by the raw 32-byte key in
|
|
19
39
|
* `keyFilePath` — the daemon's own key file (M9C-D8/D9). Throws GatewayStoreError fail-closed. */
|
|
20
|
-
constructor(dbPath: string, keyFilePath: string);
|
|
40
|
+
constructor(dbPath: string, keyFilePath: string, onEvent?: StoreEventSink);
|
|
21
41
|
/** Append a security-pass record for one screened message, hash-chained to the prior record. */
|
|
22
42
|
record(input: RecordInput): SecurityRecord;
|
|
23
43
|
/** Every record, oldest first. */
|
|
@@ -25,6 +45,11 @@ export declare class GatewayRecordStore {
|
|
|
25
45
|
count(): number;
|
|
26
46
|
/** Recompute the whole chain and confirm every stored fingerprint + prev-link matches (tamper check). */
|
|
27
47
|
verifyChain(): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Fold the WAL back into the main file WITHOUT closing (review F1/F2). Closing unlinks
|
|
50
|
+
* `-wal`/`-shm` for every process sharing the file, including the daemon's long-lived handles.
|
|
51
|
+
*/
|
|
52
|
+
checkpoint(): void;
|
|
28
53
|
close(): void;
|
|
29
54
|
}
|
|
30
55
|
//# sourceMappingURL=record-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record-store.d.ts","sourceRoot":"","sources":["../../src/records/record-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"record-store.d.ts","sourceRoot":"","sources":["../../src/records/record-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAsC,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAGnG,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AACtE,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,UAAU,CAAC;AAErD,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,eAAe,CAAC;IAC3B,WAAW,EAAE,iBAAiB,CAAC;IAC/B,6FAA6F;IAC7F,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,cAAe,SAAQ,WAAW;IACjD,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AA+BD,qBAAa,kBAAkB;;IAI7B;uGACmG;gBACvF,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc;IAKzE,gGAAgG;IAChG,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,cAAc;IAwC1C,kCAAkC;IAClC,GAAG,IAAI,cAAc,EAAE;IAgBvB,KAAK,IAAI,MAAM;IAKf,yGAAyG;IACzG,WAAW,IAAI,OAAO;IActB;;;OAGG;IACH,UAAU,IAAI,IAAI;IAIlB,KAAK,IAAI,IAAI;CAWd"}
|
|
@@ -43,8 +43,8 @@ export class GatewayRecordStore {
|
|
|
43
43
|
#closed = false;
|
|
44
44
|
/** Opens (creating if absent) the encrypted store at `dbPath`, keyed by the raw 32-byte key in
|
|
45
45
|
* `keyFilePath` — the daemon's own key file (M9C-D8/D9). Throws GatewayStoreError fail-closed. */
|
|
46
|
-
constructor(dbPath, keyFilePath) {
|
|
47
|
-
this.#db = openEncryptedStoreDb(dbPath, keyFilePath);
|
|
46
|
+
constructor(dbPath, keyFilePath, onEvent) {
|
|
47
|
+
this.#db = openEncryptedStoreDb(dbPath, keyFilePath, onEvent);
|
|
48
48
|
this.#db.exec(DDL);
|
|
49
49
|
}
|
|
50
50
|
/** Append a security-pass record for one screened message, hash-chained to the prior record. */
|
|
@@ -121,6 +121,13 @@ export class GatewayRecordStore {
|
|
|
121
121
|
}
|
|
122
122
|
return true;
|
|
123
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Fold the WAL back into the main file WITHOUT closing (review F1/F2). Closing unlinks
|
|
126
|
+
* `-wal`/`-shm` for every process sharing the file, including the daemon's long-lived handles.
|
|
127
|
+
*/
|
|
128
|
+
checkpoint() {
|
|
129
|
+
this.#db.exec("PRAGMA wal_checkpoint(TRUNCATE)");
|
|
130
|
+
}
|
|
124
131
|
close() {
|
|
125
132
|
if (this.#closed)
|
|
126
133
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record-store.js","sourceRoot":"","sources":["../../src/records/record-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"record-store.js","sourceRoot":"","sources":["../../src/records/record-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,oBAAoB,EAAqC,MAAM,0BAA0B,CAAC;AACnG,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAoBzC,MAAM,GAAG,GAAG;;;;;;;;;;;;CAYX,CAAC;AAEF,0FAA0F;AAC1F,SAAS,aAAa,CACpB,GAAW,EACX,SAAiB,EACjB,WAAmB,EACnB,WAAmB,EACnB,MAAc,EACd,aAAqB,EACrB,eAAuB;IAEvB,OAAO,UAAU,CAAC,QAAQ,CAAC;SACxB,MAAM,CA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CAAC,CAAC;IACnD,CAAC;IAED,KAAK;QACH,IAAI,IAAI,CAAC,OAAO;YAAE,OAAO;QACzB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;IACnB,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,GAAG;aACZ,OAAO,CAAC,yEAAyE,CAAC;aAClF,GAAG,EAAsD,CAAC;IAC/D,CAAC;CACF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WHAT CAN BE DONE ABOUT IT — the half of a refusal that was missing.
|
|
3
|
+
*
|
|
4
|
+
* Every guard in this layer could say what it did. None could say what was AVAILABLE. An agent that
|
|
5
|
+
* is told only "not sent" retries the same thing, gives up, or invents a workaround, and the
|
|
6
|
+
* operator never learns a guard misfired. That gap put a coworker's agent in a loop within hours of
|
|
7
|
+
* enforcing going live (journal C16): it was refused twice over a date flagged as a phone number,
|
|
8
|
+
* and nothing it was told named the one command that would have cleared it.
|
|
9
|
+
*
|
|
10
|
+
* The rules these strings follow:
|
|
11
|
+
* - Name what the AGENT can do unaided first, when there is anything.
|
|
12
|
+
* - Name the OPERATOR's exact command second, as an INSTRUCTION not to run it — never as a claim
|
|
13
|
+
* that it is impossible. Review F5: the first version said "you cannot", and that is false. The
|
|
14
|
+
* TTY check is `process.stdin.isTTY`, and `script -q /dev/null cello config set …` flips it, so
|
|
15
|
+
* an agent with a shell could confirm its own loosening. `INV-10` says this honestly ("a
|
|
16
|
+
* friction gate, not a lock"); the one place that honesty was dropped was the string an LLM
|
|
17
|
+
* actually reads, while handing it the exact command. Tell it not to. Do not tell it it can't.
|
|
18
|
+
* - When a guard is deliberately NOT adjustable, SAY SO. Inventing a knob that does not exist is
|
|
19
|
+
* worse than the silence this replaces — the agent burns turns hunting for it.
|
|
20
|
+
* - Never echo the flagged VALUE back. The guidance is rendered into an LLM's context; repeating
|
|
21
|
+
* a secret to explain that it was redacted would undo the redaction.
|
|
22
|
+
*/
|
|
23
|
+
/** The five keys `cello config` exposes. Anything not here has no operator knob — say so instead. */
|
|
24
|
+
export type AdjustableGuard = "pii_whitelist" | "autonomous_override" | "language_allow" | "rate_max_per_window" | "rate_window_ms";
|
|
25
|
+
/**
|
|
26
|
+
* The operator's line for a guard that CAN be adjusted. `argHint` is a shape, never a real flagged
|
|
27
|
+
* value — see the no-echo rule above.
|
|
28
|
+
*/
|
|
29
|
+
export declare function operatorCanRun(guard: AdjustableGuard, argHint: string): string;
|
|
30
|
+
/** For a guard with no knob. Better a plain "no" than an invented command. */
|
|
31
|
+
export declare function noOperatorOverride(what: string): string;
|
|
32
|
+
//# sourceMappingURL=affordance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"affordance.d.ts","sourceRoot":"","sources":["../../src/screen/affordance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,qGAAqG;AACrG,MAAM,MAAM,eAAe,GACvB,eAAe,GACf,qBAAqB,GACrB,gBAAgB,GAChB,qBAAqB,GACrB,gBAAgB,CAAC;AAErB;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAM9E;AAED,8EAA8E;AAC9E,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKvD"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WHAT CAN BE DONE ABOUT IT — the half of a refusal that was missing.
|
|
3
|
+
*
|
|
4
|
+
* Every guard in this layer could say what it did. None could say what was AVAILABLE. An agent that
|
|
5
|
+
* is told only "not sent" retries the same thing, gives up, or invents a workaround, and the
|
|
6
|
+
* operator never learns a guard misfired. That gap put a coworker's agent in a loop within hours of
|
|
7
|
+
* enforcing going live (journal C16): it was refused twice over a date flagged as a phone number,
|
|
8
|
+
* and nothing it was told named the one command that would have cleared it.
|
|
9
|
+
*
|
|
10
|
+
* The rules these strings follow:
|
|
11
|
+
* - Name what the AGENT can do unaided first, when there is anything.
|
|
12
|
+
* - Name the OPERATOR's exact command second, as an INSTRUCTION not to run it — never as a claim
|
|
13
|
+
* that it is impossible. Review F5: the first version said "you cannot", and that is false. The
|
|
14
|
+
* TTY check is `process.stdin.isTTY`, and `script -q /dev/null cello config set …` flips it, so
|
|
15
|
+
* an agent with a shell could confirm its own loosening. `INV-10` says this honestly ("a
|
|
16
|
+
* friction gate, not a lock"); the one place that honesty was dropped was the string an LLM
|
|
17
|
+
* actually reads, while handing it the exact command. Tell it not to. Do not tell it it can't.
|
|
18
|
+
* - When a guard is deliberately NOT adjustable, SAY SO. Inventing a knob that does not exist is
|
|
19
|
+
* worse than the silence this replaces — the agent burns turns hunting for it.
|
|
20
|
+
* - Never echo the flagged VALUE back. The guidance is rendered into an LLM's context; repeating
|
|
21
|
+
* a secret to explain that it was redacted would undo the redaction.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* The operator's line for a guard that CAN be adjusted. `argHint` is a shape, never a real flagged
|
|
25
|
+
* value — see the no-echo rule above.
|
|
26
|
+
*/
|
|
27
|
+
export function operatorCanRun(guard, argHint) {
|
|
28
|
+
return (`IF THIS IS WRONG, relay this to your operator to run in their terminal. DO NOT run it ` +
|
|
29
|
+
`yourself and do not try to work around the guard:\n cello config set ${guard} ${argHint}\n` +
|
|
30
|
+
`It asks them to confirm once. To see exactly what fired: cello policy log`);
|
|
31
|
+
}
|
|
32
|
+
/** For a guard with no knob. Better a plain "no" than an invented command. */
|
|
33
|
+
export function noOperatorOverride(what) {
|
|
34
|
+
return (`This guard is not adjustable — there is no setting that turns it off, deliberately. ${what} ` +
|
|
35
|
+
`To see exactly what fired: cello policy log`);
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=affordance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"affordance.js","sourceRoot":"","sources":["../../src/screen/affordance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAUH;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,KAAsB,EAAE,OAAe;IACpE,OAAO,CACL,wFAAwF;QACxF,yEAAyE,KAAK,IAAI,OAAO,IAAI;QAC7F,2EAA2E,CAC5E,CAAC;AACJ,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,OAAO,CACL,uFAAuF,IAAI,GAAG;QAC9F,6CAA6C,CAC9C,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inbound.d.ts","sourceRoot":"","sources":["../../src/screen/inbound.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"inbound.d.ts","sourceRoot":"","sources":["../../src/screen/inbound.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC1C,+FAA+F;IAC/F,OAAO,EAAE,UAAU,CAAC;IACpB,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B;sFACkF;IAClF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sFAAsF;IACtF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,mGAAmG;IACnG,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC;AAID,qBAAa,eAAe;;gBAKd,IAAI,GAAE,sBAA2B;IAOvC,MAAM,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC;CA0G3D"}
|
package/dist/screen/inbound.js
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* un-acked for redelivery. Language and injection run on the SANITIZED text (what the agent would
|
|
17
17
|
* see), so confusable lookalikes normalized to Latin are judged as Latin, not held.
|
|
18
18
|
*/
|
|
19
|
+
import { operatorCanRun, noOperatorOverride } from "./affordance.js";
|
|
19
20
|
import { sanitizeInbound } from "../detect/sanitize.js";
|
|
20
21
|
import { scanInjectionPatterns } from "../detect/injection-patterns.js";
|
|
21
22
|
import { screenInboundLanguage } from "../detect/language.js";
|
|
@@ -72,7 +73,8 @@ export class InboundScreener {
|
|
|
72
73
|
}],
|
|
73
74
|
terminal: true,
|
|
74
75
|
reason: "inbound_language_blocked",
|
|
75
|
-
guidance: lang.reason ?? "This message is in a language outside the
|
|
76
|
+
guidance: (lang.reason ?? "This message is in a language outside the allowlist; it was not delivered.") +
|
|
77
|
+
"\n" + operatorCanRun("language_allow", "<comma-separated languages>"),
|
|
76
78
|
};
|
|
77
79
|
}
|
|
78
80
|
// IN-002: semantic injection scanner (Layer-2). Off when no model is loaded — available()===false,
|
|
@@ -91,7 +93,9 @@ export class InboundScreener {
|
|
|
91
93
|
}],
|
|
92
94
|
terminal: true,
|
|
93
95
|
reason: "inbound_injection_blocked",
|
|
94
|
-
guidance: "This message was classified as a prompt-injection attempt and was not delivered
|
|
96
|
+
guidance: "This message was classified as a prompt-injection attempt and was not delivered.\n" +
|
|
97
|
+
noOperatorOverride("If you believe it is legitimate, ask the sender to rephrase it without instruction-like " +
|
|
98
|
+
"framing, or have the operator inspect it directly."),
|
|
95
99
|
};
|
|
96
100
|
}
|
|
97
101
|
if (scan.verdict === "flag") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inbound.js","sourceRoot":"","sources":["../../src/screen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,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,+EAA+E;IAC/E,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,uFAAuF;IACvF,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;CAC1D;AAKD,qBAAa,gBAAgB;;gBAKf,IAAI,GAAE,uBAA4B;IAU9C,MAAM,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,qBAAqB,GAAG,eAAe;CAuKzE;AAED,uEAAuE;AACvE,wBAAgB,WAAW,CAAC,CAAC,EAAE,eAAe,GAAG,MAAM,CAEtD"}
|
package/dist/screen/outbound.js
CHANGED
|
@@ -166,10 +166,21 @@ export class OutboundScreener {
|
|
|
166
166
|
return {
|
|
167
167
|
reWarn: true,
|
|
168
168
|
warnEvents: rejected.map(warnEvent),
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
169
|
+
// TELL THE AGENT WHAT IT CAN DO. The recurring failure this closes: an agent hits a guard,
|
|
170
|
+
// is told what happened, and is never told what is available — so it retries the same thing,
|
|
171
|
+
// or gives up, or invents a workaround. It cannot run the loosening commands itself (that is
|
|
172
|
+
// the point of the gate), but it CAN relay them, and relaying an exact command is the
|
|
173
|
+
// difference between a stuck operator and a two-second fix.
|
|
174
|
+
guidance: `NOT SENT. ${rejected.length} item(s) cannot be allowed autonomously because ` +
|
|
175
|
+
`autonomous_override is OFF.\n` +
|
|
176
|
+
`WHAT YOU CAN DO NOW: re-send with those flag(s) set to "redact" — the value is replaced ` +
|
|
177
|
+
`by a typed placeholder and the message goes.\n` +
|
|
178
|
+
`IF THE FLAG IS WRONG (a date, an id, your own address), relay these to your operator to ` +
|
|
179
|
+
`run in their terminal. DO NOT run them yourself and do not work around the guard:\n` +
|
|
180
|
+
` cello config list # FIRST — 'set' REPLACES the whitelist\n` +
|
|
181
|
+
` cello config set pii_whitelist <existing,values,plus,new>\n` +
|
|
182
|
+
` cello config set autonomous_override true # or: let agents clear their own flags\n` +
|
|
183
|
+
`Either prompts them to confirm once. To see exactly what fired: cello policy log`,
|
|
173
184
|
redact: [], allowOnce: [], whitelistAddRequested: [],
|
|
174
185
|
};
|
|
175
186
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outbound.js","sourceRoot":"","sources":["../../src/screen/outbound.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,mBAAmB,EAAwB,MAAM,yBAAyB,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAiB,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAyCrD,MAAM,YAAY,GAAG,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;AAChE,MAAM,YAAY,GAAG,IAAI,WAAW,EAAE,CAAC;AAEvC,MAAM,OAAO,gBAAgB;IAClB,YAAY,CAAuB;IACnC,IAAI,CAAsB;IAC1B,mBAAmB,CAAU;IAEtC,YAAY,OAAgC,EAAE;QAC5C,IAAI,IAAI,CAAC,SAAS;YAAE,IAAI,CAAC,YAAY,GAAG,IAAI,mBAAmB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;QAC1F,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,kBAAkB,IAAI,KAAK,CAAC;QAC5D,IAAI,CAAC,IAAI,GAAG,IAAI,mBAAmB,CAAC;YAClC,SAAS,EAAE,IAAI,CAAC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AC;IAC/B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AASD,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,cAAc,CAAC,CA6F5F"}
|
package/dist/spawn.js
CHANGED
|
@@ -17,7 +17,13 @@ function defaultEntryPath() {
|
|
|
17
17
|
export async function spawnGatewaySidecar(opts) {
|
|
18
18
|
const entry = opts.entryPath ?? defaultEntryPath();
|
|
19
19
|
const child = spawn(process.execPath, [entry], {
|
|
20
|
-
|
|
20
|
+
// stdin is a PIPE, not "ignore", and it is the child's death switch (review F5). A daemon that
|
|
21
|
+
// dies without running its shutdown path — SIGKILL, a crash, the OOM killer — leaves the
|
|
22
|
+
// gateway alive holding the encrypted store's write lock. The NEXT daemon's gateway then hits
|
|
23
|
+
// `store_locked`, exits before ready, and with no auto-restart (M9C-D14) that daemon spends its
|
|
24
|
+
// whole life fail-closed on one boot log line. When the parent dies the kernel closes this
|
|
25
|
+
// pipe, and the child exits on the `end` event.
|
|
26
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
21
27
|
env: {
|
|
22
28
|
...process.env,
|
|
23
29
|
...opts.env,
|
|
@@ -26,6 +32,24 @@ export async function spawnGatewaySidecar(opts) {
|
|
|
26
32
|
},
|
|
27
33
|
});
|
|
28
34
|
const readyTimeoutMs = opts.readyTimeoutMs ?? DEFAULT_READY_TIMEOUT_MS;
|
|
35
|
+
// DRAIN the child's stderr and keep the tail. Two reasons, and the first one is the whole point:
|
|
36
|
+
// every refusal the gateway can produce — a missing key file, a locked store, a leftover
|
|
37
|
+
// plaintext store, each with its own code and its own guidance — is written HERE. Without a
|
|
38
|
+
// listener it went into a pipe nobody read, and the only thing the caller ever saw was
|
|
39
|
+
// "gateway sidecar exited before ready (code 1)" — a message naming where the failure surfaced
|
|
40
|
+
// and nothing about what went wrong. Second: an unread pipe fills, and the gateway writes a
|
|
41
|
+
// stderr line per screen error, so a long-running gateway would eventually block on it.
|
|
42
|
+
// A ChildProcess with no `error` listener turns a spawn-level failure (EMFILE, ENOMEM, EACCES)
|
|
43
|
+
// into an UNCAUGHT exception on a later tick — outside the caller's try — which would kill the
|
|
44
|
+
// daemon at boot rather than letting it degrade to the announced fail-closed mode (review F11).
|
|
45
|
+
// The promise below rejects on `exit`; this makes sure `error` cannot escape in the meantime.
|
|
46
|
+
let stderrTail = "";
|
|
47
|
+
const MAX_STDERR_TAIL = 8_192;
|
|
48
|
+
child.stderr?.on("data", (chunk) => {
|
|
49
|
+
stderrTail = (stderrTail + chunk.toString("utf8")).slice(-MAX_STDERR_TAIL);
|
|
50
|
+
});
|
|
51
|
+
/** The child's own words, appended to a failure so the CAUSE travels with the symptom. */
|
|
52
|
+
const withChildStderr = (message) => stderrTail.trim() ? `${message}\n--- gateway stderr ---\n${stderrTail.trim()}` : message;
|
|
29
53
|
await new Promise((resolve, reject) => {
|
|
30
54
|
let settled = false;
|
|
31
55
|
const timer = setTimeout(() => {
|
|
@@ -33,7 +57,7 @@ export async function spawnGatewaySidecar(opts) {
|
|
|
33
57
|
return;
|
|
34
58
|
settled = true;
|
|
35
59
|
child.kill("SIGKILL");
|
|
36
|
-
reject(new Error(`gateway sidecar did not become ready within ${readyTimeoutMs}ms`));
|
|
60
|
+
reject(new Error(withChildStderr(`gateway sidecar did not become ready within ${readyTimeoutMs}ms`)));
|
|
37
61
|
}, readyTimeoutMs);
|
|
38
62
|
const onStdout = (chunk) => {
|
|
39
63
|
if (chunk.toString("utf8").includes(GATEWAY_READY_TOKEN)) {
|
|
@@ -46,13 +70,17 @@ export async function spawnGatewaySidecar(opts) {
|
|
|
46
70
|
}
|
|
47
71
|
};
|
|
48
72
|
child.stdout?.on("data", onStdout);
|
|
49
|
-
|
|
73
|
+
const fail = (message) => {
|
|
50
74
|
if (settled)
|
|
51
75
|
return;
|
|
52
76
|
settled = true;
|
|
53
77
|
clearTimeout(timer);
|
|
54
|
-
reject(new Error(
|
|
55
|
-
}
|
|
78
|
+
reject(new Error(withChildStderr(message)));
|
|
79
|
+
};
|
|
80
|
+
child.once("exit", (code) => fail(`gateway sidecar exited before ready (code ${code})`));
|
|
81
|
+
// The spawn itself failing is a different cause from the child exiting, and the operator needs
|
|
82
|
+
// to be able to tell them apart.
|
|
83
|
+
child.once("error", (err) => fail(`gateway sidecar could not be spawned: ${err.message}`));
|
|
56
84
|
});
|
|
57
85
|
return {
|
|
58
86
|
socketPath: opts.socketPath,
|
package/dist/spawn.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spawn.js","sourceRoot":"","sources":["../src/spawn.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,KAAK,EAAqB,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,iEAAiE;AACjE,MAAM,CAAC,MAAM,mBAAmB,GAAG,eAAe,CAAC;AAwBnD,MAAM,wBAAwB,GAAG,MAAM,CAAC;AAExC,SAAS,gBAAgB;IACvB,4CAA4C;IAC5C,OAAO,IAAI,GAAG,CAAC,wBAAwB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC;AACrE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,IAAyB;IACjE,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,IAAI,gBAAgB,EAAE,CAAC;IACnD,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE;QAC7C,KAAK,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"spawn.js","sourceRoot":"","sources":["../src/spawn.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,KAAK,EAAqB,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,iEAAiE;AACjE,MAAM,CAAC,MAAM,mBA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