fix(types): Add EventStoreConfig type + fix NATS enum imports
Some checks are pending
CI / install-check (push) Waiting to run
CI / checks (bunx tsc -p tsconfig.json --noEmit false, bun, build) (push) Waiting to run
CI / checks (pnpm build && pnpm lint, node, lint) (push) Waiting to run
CI / checks (pnpm canvas:a2ui:bundle && bunx vitest run, bun, test) (push) Waiting to run
CI / checks (pnpm canvas:a2ui:bundle && pnpm test, node, test) (push) Waiting to run
CI / checks (pnpm format, node, format) (push) Waiting to run
CI / checks (pnpm protocol:check, node, protocol) (push) Waiting to run
CI / checks (pnpm tsgo, node, tsgo) (push) Waiting to run
CI / secrets (push) Waiting to run
CI / checks-windows (pnpm build && pnpm lint, node, build & lint) (push) Waiting to run
CI / checks-windows (pnpm canvas:a2ui:bundle && pnpm test, node, test) (push) Waiting to run
CI / checks-windows (pnpm protocol:check, node, protocol) (push) Waiting to run
CI / checks-macos (pnpm test, test) (push) Waiting to run
CI / macos-app (set -euo pipefail
for attempt in 1 2 3; do
if swift build --package-path apps/macos --configuration release; then
exit 0
fi
echo "swift build failed (attempt $attempt/3). Retrying…"
sleep $((attempt * 20))
done
exit 1
, build) (push) Waiting to run
CI / macos-app (set -euo pipefail
for attempt in 1 2 3; do
if swift test --package-path apps/macos --parallel --enable-code-coverage --show-codecov-path; then
exit 0
fi
echo "swift test failed (attempt $attempt/3). Retrying…"
sleep $((attempt … (push) Waiting to run
CI / macos-app (swiftlint --config .swiftlint.yml
swiftformat --lint apps/macos/Sources --config .swiftformat
, lint) (push) Waiting to run
CI / ios (push) Waiting to run
CI / android (./gradlew --no-daemon :app:assembleDebug, build) (push) Waiting to run
CI / android (./gradlew --no-daemon :app:testDebugUnitTest, test) (push) Waiting to run
Workflow Sanity / no-tabs (push) Waiting to run
Some checks are pending
CI / install-check (push) Waiting to run
CI / checks (bunx tsc -p tsconfig.json --noEmit false, bun, build) (push) Waiting to run
CI / checks (pnpm build && pnpm lint, node, lint) (push) Waiting to run
CI / checks (pnpm canvas:a2ui:bundle && bunx vitest run, bun, test) (push) Waiting to run
CI / checks (pnpm canvas:a2ui:bundle && pnpm test, node, test) (push) Waiting to run
CI / checks (pnpm format, node, format) (push) Waiting to run
CI / checks (pnpm protocol:check, node, protocol) (push) Waiting to run
CI / checks (pnpm tsgo, node, tsgo) (push) Waiting to run
CI / secrets (push) Waiting to run
CI / checks-windows (pnpm build && pnpm lint, node, build & lint) (push) Waiting to run
CI / checks-windows (pnpm canvas:a2ui:bundle && pnpm test, node, test) (push) Waiting to run
CI / checks-windows (pnpm protocol:check, node, protocol) (push) Waiting to run
CI / checks-macos (pnpm test, test) (push) Waiting to run
CI / macos-app (set -euo pipefail
for attempt in 1 2 3; do
if swift build --package-path apps/macos --configuration release; then
exit 0
fi
echo "swift build failed (attempt $attempt/3). Retrying…"
sleep $((attempt * 20))
done
exit 1
, build) (push) Waiting to run
CI / macos-app (set -euo pipefail
for attempt in 1 2 3; do
if swift test --package-path apps/macos --parallel --enable-code-coverage --show-codecov-path; then
exit 0
fi
echo "swift test failed (attempt $attempt/3). Retrying…"
sleep $((attempt … (push) Waiting to run
CI / macos-app (swiftlint --config .swiftlint.yml
swiftformat --lint apps/macos/Sources --config .swiftformat
, lint) (push) Waiting to run
CI / ios (push) Waiting to run
CI / android (./gradlew --no-daemon :app:assembleDebug, build) (push) Waiting to run
CI / android (./gradlew --no-daemon :app:testDebugUnitTest, test) (push) Waiting to run
Workflow Sanity / no-tabs (push) Waiting to run
This commit is contained in:
parent
f1881a5094
commit
43ef154c53
3 changed files with 12702 additions and 14 deletions
12668
package-lock.json
generated
Normal file
12668
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -207,6 +207,17 @@ export type GatewayNodesConfig = {
|
|||
denyCommands?: string[];
|
||||
};
|
||||
|
||||
export type EventStoreConfig = {
|
||||
/** Enable Event Store (NATS JetStream) integration. */
|
||||
enabled?: boolean;
|
||||
/** NATS server URL (default: nats://localhost:4222). */
|
||||
natsUrl?: string;
|
||||
/** JetStream stream name (default: openclaw-events). */
|
||||
streamName?: string;
|
||||
/** Subject prefix for events (default: openclaw.events). */
|
||||
subjectPrefix?: string;
|
||||
};
|
||||
|
||||
export type GatewayConfig = {
|
||||
/** Single multiplexed port for Gateway WS + HTTP (default: 18789). */
|
||||
port?: number;
|
||||
|
|
@ -235,6 +246,8 @@ export type GatewayConfig = {
|
|||
tls?: GatewayTlsConfig;
|
||||
http?: GatewayHttpConfig;
|
||||
nodes?: GatewayNodesConfig;
|
||||
/** Event Store (NATS JetStream) configuration for persistent event logging. */
|
||||
eventStore?: EventStoreConfig;
|
||||
/**
|
||||
* IPs of trusted reverse proxies (e.g. Traefik, nginx). When a connection
|
||||
* arrives from one of these IPs, the Gateway trusts `x-forwarded-for` (or
|
||||
|
|
|
|||
|
|
@ -9,7 +9,14 @@
|
|||
* - Time-travel debugging
|
||||
*/
|
||||
|
||||
import { connect, type NatsConnection, type JetStreamClient, StringCodec } from "nats";
|
||||
import {
|
||||
connect,
|
||||
type NatsConnection,
|
||||
type JetStreamClient,
|
||||
StringCodec,
|
||||
RetentionPolicy,
|
||||
StorageType,
|
||||
} from "nats";
|
||||
import type { AgentEventPayload } from "./agent-events.js";
|
||||
import { onAgentEvent } from "./agent-events.js";
|
||||
|
||||
|
|
@ -150,11 +157,11 @@ async function ensureStream(js: JetStreamClient, config: EventStoreConfig): Prom
|
|||
await jsm.streams.add({
|
||||
name: config.streamName,
|
||||
subjects: [`${config.subjectPrefix}.>`],
|
||||
retention: "limits" as const,
|
||||
retention: RetentionPolicy.Limits,
|
||||
max_msgs: -1,
|
||||
max_bytes: -1,
|
||||
max_age: 0, // Never expire
|
||||
storage: "file" as const,
|
||||
storage: StorageType.File,
|
||||
num_replicas: 1,
|
||||
duplicate_window: 120_000_000_000, // 2 minutes in nanoseconds
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue