@sema-agent/server 1.306.0 → 1.307.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/README.md +1 -0
- package/README.zh-CN.md +1 -0
- package/dist/main.js +4 -17
- package/dist/plugins/store-backend.d.ts +6 -0
- package/dist/plugins/store-backend.js +20 -0
- package/dist/tool-approval.d.ts +1 -0
- package/dist/tool-approval.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -130,6 +130,7 @@ The server is configured entirely through environment variables. The most import
|
|
|
130
130
|
| Variable | Default | What it does |
|
|
131
131
|
|----------|---------|--------------|
|
|
132
132
|
| `PORT` | `8090` | HTTP listen port |
|
|
133
|
+
| `BIND_HOST` (alias `HOST`) | see note | Listen address. An explicit value **always wins**. Default: `127.0.0.1` when the write face is unauthenticated (`ALLOW_UNAUTHED_WRITES=true` **and** no service token configured), otherwise all interfaces — deployments with a token are unaffected. |
|
|
133
134
|
| `MODEL_GATEWAY_BASEURL` | `http://127.0.0.1:8000/v1` | OpenAI-compatible gateway base URL (without `/chat/completions`) |
|
|
134
135
|
| `MODEL_ID` | `Qwen3.5-35B` | Default model id |
|
|
135
136
|
| `MODEL_API_KEY` | — | Gateway API key (optional) |
|
package/README.zh-CN.md
CHANGED
|
@@ -123,6 +123,7 @@ curl -s localhost:8090/v1/tasks -H "Authorization: Bearer <SERVICE_AUTH_TOKEN>"
|
|
|
123
123
|
| 变量 | 默认 | 说明 |
|
|
124
124
|
|------|------|------|
|
|
125
125
|
| `PORT` | `8090` | HTTP 监听端口 |
|
|
126
|
+
| `BIND_HOST`(兼容 `HOST`) | 见说明 | 监听地址。显式值**恒生效**。缺省:写面无鉴权时(`ALLOW_UNAUTHED_WRITES=true` **且**未配任何 service token)= `127.0.0.1`,否则全接口——配了 token 的部署不受影响。 |
|
|
126
127
|
| `MODEL_GATEWAY_BASEURL` | `http://127.0.0.1:8000/v1` | OpenAI 兼容网关地址(不带 `/chat/completions`) |
|
|
127
128
|
| `MODEL_ID` | `Qwen3.5-35B` | 缺省模型 id |
|
|
128
129
|
| `MODEL_API_KEY` | — | 网关 key(可选) |
|
package/dist/main.js
CHANGED
|
@@ -28,7 +28,7 @@ import { loadConfig, logConfigDiagnostics, resolveBindHost } from "./config.js";
|
|
|
28
28
|
import { resourceSuspendOptIn } from "./resource-suspend.js";
|
|
29
29
|
import { createSessionStore, ensureChildSessionDurableWithPromotion } from "./plugins/session-store.js";
|
|
30
30
|
import { ForkRoutingSessionStore } from "./plugins/fork-routing-session-store.js";
|
|
31
|
-
import { createStoreBackend, assertCloudSnapshotBlobPosture } from "./plugins/store-backend.js";
|
|
31
|
+
import { createStoreBackend, openStoreBackendWithFallback, assertCloudSnapshotBlobPosture } from "./plugins/store-backend.js";
|
|
32
32
|
import { e2bExecutionEnvFactory } from "./plugins/remote-env-e2b.js";
|
|
33
33
|
import { k8sExecutionEnvFactory } from "./plugins/remote-env-k8s.js";
|
|
34
34
|
import { sshExecutionEnvFactory } from "./plugins/remote-env-ssh.js";
|
|
@@ -428,22 +428,9 @@ async function main() {
|
|
|
428
428
|
config.dbBackend === "local" ||
|
|
429
429
|
(config.sessionBackend === "auto" && !!(config.tidb || config.pg));
|
|
430
430
|
if (wantDb) {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
await backend.ensureSchema();
|
|
435
|
-
}
|
|
436
|
-
catch (err) {
|
|
437
|
-
if (config.sessionBackend === "auto" || (config.dbBackend === "local" && !config.dbBackendExplicit)) {
|
|
438
|
-
logger.warn("store_db_unreachable_fallback_memory", { backend: backend.kind, error: err instanceof Error ? err.message : String(err) });
|
|
439
|
-
storeBackendDegraded = true;
|
|
440
|
-
await backend.close().catch(() => undefined);
|
|
441
|
-
backend = undefined;
|
|
442
|
-
}
|
|
443
|
-
else
|
|
444
|
-
throw err;
|
|
445
|
-
}
|
|
446
|
-
}
|
|
431
|
+
const opened = await openStoreBackendWithFallback(config, logger);
|
|
432
|
+
backend = opened.backend;
|
|
433
|
+
storeBackendDegraded = opened.degraded;
|
|
447
434
|
}
|
|
448
435
|
metrics.setGauge("store_backend_degraded", storeBackendDegraded ? 1 : 0);
|
|
449
436
|
{
|
|
@@ -96,4 +96,10 @@ export interface StoreBackend {
|
|
|
96
96
|
export declare function assertCloudSnapshotBlobPosture(kind: "mysql" | "pg" | "local", config: Pick<ServiceConfig, "snapshotBlobStore" | "snapshotBlobAllowSql">): void;
|
|
97
97
|
export declare function snapshotBoundsFromConfig(config: ServiceConfig): FileSnapshotBounds;
|
|
98
98
|
export declare function createStoreBackend(config: ServiceConfig): StoreBackend | undefined;
|
|
99
|
+
export declare function openStoreBackendWithFallback(config: ServiceConfig, logger: {
|
|
100
|
+
warn: (msg: string, meta?: Record<string, unknown>) => void;
|
|
101
|
+
}): Promise<{
|
|
102
|
+
backend: StoreBackend | undefined;
|
|
103
|
+
degraded: boolean;
|
|
104
|
+
}>;
|
|
99
105
|
//# sourceMappingURL=store-backend.d.ts.map
|
|
@@ -217,4 +217,24 @@ export function createStoreBackend(config) {
|
|
|
217
217
|
return undefined;
|
|
218
218
|
return new TiDBBackend(createTidbPool(config), config);
|
|
219
219
|
}
|
|
220
|
+
export async function openStoreBackendWithFallback(config, logger) {
|
|
221
|
+
const mayFallback = config.dbBackend === "local" ? !config.dbBackendExplicit : config.sessionBackend === "auto";
|
|
222
|
+
let backend;
|
|
223
|
+
try {
|
|
224
|
+
backend = createStoreBackend(config);
|
|
225
|
+
if (backend)
|
|
226
|
+
await backend.ensureSchema();
|
|
227
|
+
}
|
|
228
|
+
catch (err) {
|
|
229
|
+
if (!mayFallback)
|
|
230
|
+
throw err;
|
|
231
|
+
logger.warn("store_db_unreachable_fallback_memory", {
|
|
232
|
+
backend: backend?.kind ?? config.dbBackend,
|
|
233
|
+
error: err instanceof Error ? err.message : String(err),
|
|
234
|
+
});
|
|
235
|
+
await backend?.close().catch(() => undefined);
|
|
236
|
+
return { backend: undefined, degraded: true };
|
|
237
|
+
}
|
|
238
|
+
return { backend, degraded: false };
|
|
239
|
+
}
|
|
220
240
|
//# sourceMappingURL=store-backend.js.map
|
package/dist/tool-approval.d.ts
CHANGED
package/dist/tool-approval.js
CHANGED
|
@@ -160,6 +160,7 @@ export class ToolApprovalCoordinator {
|
|
|
160
160
|
type: "tool_approval",
|
|
161
161
|
approvalId: id,
|
|
162
162
|
toolName: req.toolName,
|
|
163
|
+
...(typeof req.toolCallId === "string" && req.toolCallId !== "" ? { toolCallId: req.toolCallId } : {}),
|
|
163
164
|
...(child
|
|
164
165
|
? {
|
|
165
166
|
sourceTaskId: req.sourceTaskId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.307.0",
|
|
4
4
|
"description": "Sema Server — the server/API implementation layer for Sema, wiring core, registry, model providers, and cloud agent execution. Built on @sema-agent/core.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BUSL-1.1",
|