@sema-agent/server 1.315.0 → 1.316.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/http/idempotency.d.ts +1 -0
- package/dist/http/idempotency.js +3 -0
- package/dist/http/principal-gate.d.ts +12 -0
- package/dist/http/principal-gate.js +52 -0
- package/dist/http/route-ctx.d.ts +67 -0
- package/dist/http/route-ctx.js +2 -0
- package/dist/http/routes/attachments.d.ts +4 -0
- package/dist/http/routes/attachments.js +106 -0
- package/dist/http/routes/capabilities.d.ts +4 -0
- package/dist/http/routes/capabilities.js +111 -0
- package/dist/http/routes/images.d.ts +20 -0
- package/dist/http/routes/images.js +572 -0
- package/dist/http/routes/memory-policy.d.ts +4 -0
- package/dist/http/routes/memory-policy.js +105 -0
- package/dist/http/routes/observability.d.ts +4 -0
- package/dist/http/routes/observability.js +63 -0
- package/dist/http/routes/session-sync.d.ts +36 -0
- package/dist/http/routes/session-sync.js +513 -0
- package/dist/http/routes/sessions-list.d.ts +4 -0
- package/dist/http/routes/sessions-list.js +117 -0
- package/dist/http/routes/sessions.d.ts +17 -0
- package/dist/http/routes/sessions.js +746 -0
- package/dist/http/send.d.ts +6 -0
- package/dist/http/send.js +19 -0
- package/dist/http/server.d.ts +6 -7
- package/dist/http/server.js +125 -2413
- package/dist/http/sse-log.d.ts +25 -0
- package/dist/http/sse-log.js +59 -0
- package/dist/http/workspace-content.d.ts +3 -0
- package/dist/http/workspace-content.js +20 -0
- package/dist/plugins/approval-store-sql.d.ts +52 -0
- package/dist/plugins/approval-store-sql.js +119 -0
- package/dist/plugins/breaker-state-sql.d.ts +29 -0
- package/dist/plugins/breaker-state-sql.js +104 -0
- package/dist/plugins/file-snapshot-store-sql.d.ts +38 -0
- package/dist/plugins/file-snapshot-store-sql.js +210 -0
- package/dist/plugins/image-index-sql.d.ts +33 -0
- package/dist/plugins/image-index-sql.js +328 -0
- package/dist/plugins/outcome-ledger-sql.d.ts +70 -0
- package/dist/plugins/outcome-ledger-sql.js +158 -0
- package/dist/plugins/pg-approval-store.d.ts +1 -27
- package/dist/plugins/pg-approval-store.js +1 -83
- package/dist/plugins/pg-breaker-state.d.ts +1 -19
- package/dist/plugins/pg-breaker-state.js +1 -88
- package/dist/plugins/pg-file-snapshot-store.d.ts +1 -27
- package/dist/plugins/pg-file-snapshot-store.js +1 -190
- package/dist/plugins/pg-image-index.d.ts +1 -21
- package/dist/plugins/pg-image-index.js +1 -217
- package/dist/plugins/pg-outcome-ledger.d.ts +2 -22
- package/dist/plugins/pg-outcome-ledger.js +1 -104
- package/dist/plugins/pg-resume-anchor-store.d.ts +1 -13
- package/dist/plugins/pg-resume-anchor-store.js +1 -22
- package/dist/plugins/pg-run-store.d.ts +1 -75
- package/dist/plugins/pg-run-store.js +1 -287
- package/dist/plugins/pg-session-policy-store.d.ts +1 -11
- package/dist/plugins/pg-session-policy-store.js +1 -90
- package/dist/plugins/pg-tool-result-store.d.ts +1 -15
- package/dist/plugins/pg-tool-result-store.js +1 -52
- package/dist/plugins/pg-workflow-journal-store.d.ts +1 -20
- package/dist/plugins/pg-workflow-journal-store.js +1 -34
- package/dist/plugins/pg-workflow-run-store.d.ts +1 -55
- package/dist/plugins/pg-workflow-run-store.js +1 -220
- package/dist/plugins/resume-anchor-store-sql.d.ts +23 -0
- package/dist/plugins/resume-anchor-store-sql.js +38 -0
- package/dist/plugins/run-store-sql.d.ts +89 -0
- package/dist/plugins/run-store-sql.js +397 -0
- package/dist/plugins/session-policy-store-sql.d.ts +22 -0
- package/dist/plugins/session-policy-store-sql.js +109 -0
- package/dist/plugins/tidb-approval-store.d.ts +1 -39
- package/dist/plugins/tidb-approval-store.js +1 -71
- package/dist/plugins/tidb-breaker-state.d.ts +1 -17
- package/dist/plugins/tidb-breaker-state.js +1 -74
- package/dist/plugins/tidb-file-snapshot-store.d.ts +1 -27
- package/dist/plugins/tidb-file-snapshot-store.js +1 -192
- package/dist/plugins/tidb-image-index.d.ts +1 -19
- package/dist/plugins/tidb-image-index.js +1 -149
- package/dist/plugins/tidb-outcome-ledger.d.ts +1 -57
- package/dist/plugins/tidb-outcome-ledger.js +1 -97
- package/dist/plugins/tidb-resume-anchor-store.d.ts +1 -13
- package/dist/plugins/tidb-resume-anchor-store.js +1 -22
- package/dist/plugins/tidb-run-store.d.ts +1 -75
- package/dist/plugins/tidb-run-store.js +1 -306
- package/dist/plugins/tidb-session-policy-store.d.ts +1 -11
- package/dist/plugins/tidb-session-policy-store.js +1 -86
- package/dist/plugins/tidb-tool-result-store.d.ts +1 -13
- package/dist/plugins/tidb-tool-result-store.js +1 -38
- package/dist/plugins/tidb-workflow-journal-store.d.ts +1 -20
- package/dist/plugins/tidb-workflow-journal-store.js +1 -34
- package/dist/plugins/tidb-workflow-run-store.d.ts +1 -61
- package/dist/plugins/tidb-workflow-run-store.js +1 -231
- package/dist/plugins/tool-result-store-sql.d.ts +25 -0
- package/dist/plugins/tool-result-store-sql.js +69 -0
- package/dist/plugins/workflow-journal-store-sql.d.ts +30 -0
- package/dist/plugins/workflow-journal-store-sql.js +53 -0
- package/dist/plugins/workflow-run-store-sql.d.ts +85 -0
- package/dist/plugins/workflow-run-store-sql.js +299 -0
- package/package.json +1 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ServerResponse } from "node:http";
|
|
2
|
+
export declare function sseHeaders(res: ServerResponse, extra?: Record<string, string>): void;
|
|
3
|
+
export declare function sendJson(res: ServerResponse, status: number, body: unknown): void;
|
|
4
|
+
export declare function sendError(res: ServerResponse, status: number, errorCode: string, message: string, extra?: Record<string, unknown>): void;
|
|
5
|
+
export declare function msg(e: unknown): string;
|
|
6
|
+
//# sourceMappingURL=send.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function sseHeaders(res, extra) {
|
|
2
|
+
res.writeHead(200, {
|
|
3
|
+
"content-type": "text/event-stream",
|
|
4
|
+
"cache-control": "no-cache",
|
|
5
|
+
connection: "keep-alive",
|
|
6
|
+
...extra,
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
export function sendJson(res, status, body) {
|
|
10
|
+
res.writeHead(status, { "content-type": "application/json" });
|
|
11
|
+
res.end(JSON.stringify(body));
|
|
12
|
+
}
|
|
13
|
+
export function sendError(res, status, errorCode, message, extra) {
|
|
14
|
+
sendJson(res, status, { error: message, errorCode, ...extra });
|
|
15
|
+
}
|
|
16
|
+
export function msg(e) {
|
|
17
|
+
return e instanceof Error ? e.message : String(e);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=send.js.map
|
package/dist/http/server.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import type { TaskRequestBody } from "./wire-types.js";
|
|
|
5
5
|
import type { ServiceConfig } from "../config-types.js";
|
|
6
6
|
import { type RestartSignal, type SessionMirrorRuling } from "../sema-registry.js";
|
|
7
7
|
import { type OwnerAwareSessionStore } from "../security.js";
|
|
8
|
-
import type { BakeState, BakeErrorCode } from "../plugins/store-contracts.js";
|
|
9
8
|
import type { RunStore, ApprovalStore, ImageIndex, ImageBake, CheckpointStoreFull, ResumeAnchorStore, ApprovalExemptionStore, ServiceSessionPolicyStore, ServiceFileSnapshotStore, StoreBackend } from "../plugins/store-backend.js";
|
|
10
9
|
import { type MemorySyncRequest, type MemorySyncResponse } from "../memory-sync.js";
|
|
11
10
|
import type { TaskAttachmentStore } from "../plugins/task-attachment-store.js";
|
|
@@ -24,6 +23,12 @@ import type { Metrics } from "../observability/metrics.js";
|
|
|
24
23
|
import { type RateGate } from "../observability/rate-limit.js";
|
|
25
24
|
import type { QuotaTracker } from "../observability/cost-quota.js";
|
|
26
25
|
import type { ModelUsageTracker, PromptManifestTracker } from "../budget.js";
|
|
26
|
+
import { scopedIdempotencyKey } from "./idempotency.js";
|
|
27
|
+
export { scopedIdempotencyKey };
|
|
28
|
+
import { coarseStatusForState, errorCodeForExit } from "./routes/images.js";
|
|
29
|
+
export { coarseStatusForState, errorCodeForExit };
|
|
30
|
+
import { explicitOperatorOk, isOperator, explicitOperator } from "./principal-gate.js";
|
|
31
|
+
export { explicitOperatorOk, isOperator, explicitOperator };
|
|
27
32
|
export interface RequestAuth {
|
|
28
33
|
principal?: string;
|
|
29
34
|
sessionId: string;
|
|
@@ -192,14 +197,8 @@ export declare const MAX_SKILL_CONTENT_CHARS = 1048576;
|
|
|
192
197
|
export declare const MAX_SYSTEM_PROMPT_CHARS = 16384;
|
|
193
198
|
export declare const MAX_OUTPUT_SCHEMA_CHARS = 32768;
|
|
194
199
|
export declare function validateUserSkills(skills: unknown): string | null;
|
|
195
|
-
export declare function explicitOperatorOk(principal: string | undefined, operatorPrincipals: readonly string[]): boolean;
|
|
196
|
-
export declare function coarseStatusForState(state: BakeState): "running" | "done" | "failed";
|
|
197
|
-
export declare function errorCodeForExit(exitCode: number | null | undefined, cancelled: boolean): BakeErrorCode;
|
|
198
|
-
export declare function isOperator(principal: string | undefined, operatorPrincipals: readonly string[]): boolean;
|
|
199
|
-
export declare function explicitOperator(principal: string | undefined, operatorPrincipals: readonly string[]): boolean;
|
|
200
200
|
export declare function cascadeConfig(ladder: readonly string[], maxCostUsd?: number): CascadeConfig;
|
|
201
201
|
export declare function clampVerifyRounds(v: unknown): number;
|
|
202
|
-
export declare function scopedIdempotencyKey(raw: string | undefined, source: string | null, principal: string | undefined): string | undefined;
|
|
203
202
|
export declare function isQuestionAnswer(v: unknown): v is QuestionAnswer;
|
|
204
203
|
export declare function createHttpServer(rawDeps: ServiceDeps): http.Server & {
|
|
205
204
|
denyExpiredApprovals: (now: number) => Promise<void>;
|