@sema-agent/server 7.79.0 → 7.79.2
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/file-history-disclosure.d.ts +53 -0
- package/dist/file-history-disclosure.js +89 -0
- package/dist/http/admission.d.ts +56 -0
- package/dist/http/admission.js +560 -0
- package/dist/http/approval-sweeps.d.ts +21 -0
- package/dist/http/approval-sweeps.js +138 -0
- package/dist/http/dispatch.d.ts +32 -0
- package/dist/http/dispatch.js +230 -0
- package/dist/http/request-guards.d.ts +51 -0
- package/dist/http/request-guards.js +205 -0
- package/dist/http/resume-legs.d.ts +80 -0
- package/dist/http/resume-legs.js +1230 -0
- package/dist/http/route-table.d.ts +113 -0
- package/dist/http/route-table.js +235 -0
- package/dist/http/routes/admin-memory-optout.d.ts +1 -1
- package/dist/http/routes/memory-compliance.d.ts +1 -1
- package/dist/http/routes/memory-origin.d.ts +1 -1
- package/dist/http/routes/rules.js +4 -4
- package/dist/http/server.d.ts +20 -104
- package/dist/http/server.js +24 -2589
- package/dist/main.js +2 -0
- package/dist/observability/metrics.js +1 -1
- package/dist/plugins/file-history-store-sql.js +12 -11
- package/dist/trace/redact.d.ts +9 -0
- package/dist/trace/redact.js +210 -78
- package/package.json +1 -1
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 续跑腿家族 + 路由 ctx 的装配(S-147 切片:`http/server.ts` 2378–4804 与 1119–1128 逐字搬家,正文一字未改)。
|
|
3
|
+
*
|
|
4
|
+
* 🔴 为什么 `routeCtxBase` 住在这个文件里而不是组合根:`startFreshHostTurn` 把**整只** ctx 交给
|
|
5
|
+
* `mintAndDriveDurableRun`,而 `ctx.legs` 装的正是本文件这几条腿 —— 两者是一个结。拆开只有两条路:
|
|
6
|
+
* ①晚绑 `let routeCtxBase`(编译期钉不住「谁忘了 bind」,静默 undefined);②改写调用点正文(证不了
|
|
7
|
+
* 字节不变)。同居是第三条,也是唯一一条既保住静态序又保住 move-only 的。序由 `const` 的 TDZ 亲自执法:
|
|
8
|
+
* 腿是提升的函数声明、ctx 是文件尾的 `const`,谁也不会在工厂执行期读到对方。
|
|
9
|
+
*
|
|
10
|
+
* ctx 字段 28 只(registry 7 + helpers 14 + deps/runnerFor/prepareSpec/finalizeTaskResult + 三只配额/租约/用量窗
|
|
11
|
+
* 判据)—— 这是**如实披露**的耦合读数(设计稿 §9:把它变小是波 3 的事,本刀不承诺)。型一律从既有型派生
|
|
12
|
+
* (`RunRegistry` / `RouteHelpers` / `RouteLegs` / `ReturnType<typeof createRequestGuards>`),不手抄签名 ⇒ 不会漂。
|
|
13
|
+
*/
|
|
14
|
+
import type { IncomingMessage } from "node:http";
|
|
15
|
+
import { type QuestionAnswer, type CheckpointToken } from "@sema-agent/core";
|
|
16
|
+
import type { DecideBinding } from "./wire-types.js";
|
|
17
|
+
import type { CheckpointStoreFull } from "../plugins/store-backend.js";
|
|
18
|
+
import { type HostDecision } from "../host-decision.js";
|
|
19
|
+
import type { RouteCtxBase, DriveResumeArgs } from "./route-ctx.js";
|
|
20
|
+
import { type TrustedRunInternals } from "./durable-run-leg.js";
|
|
21
|
+
import type { RunRegistry, RouteHelpers, RouteLegs } from "./route-ctx.js";
|
|
22
|
+
import type { createRequestGuards } from "./request-guards.js";
|
|
23
|
+
import type { FlatServiceDeps } from "./server.js";
|
|
24
|
+
export declare function createResumeLegs(ctx: {
|
|
25
|
+
deps: FlatServiceDeps;
|
|
26
|
+
runnerFor: NonNullable<FlatServiceDeps["runnerFor"]>;
|
|
27
|
+
} & RunRegistry & RouteHelpers & Pick<RouteLegs, "prepareSpec" | "finalizeTaskResult"> & Pick<ReturnType<typeof createRequestGuards>, "ownerCostQuotaDenied" | "ownerFleetLeaseDenied" | "usageWindowDenialFor">): {
|
|
28
|
+
routeCtxBase: RouteCtxBase;
|
|
29
|
+
resumeCheckpoint: (sessionId: string, decision: "approve" | "deny", reason: string | undefined, hostDecision: HostDecision, req?: IncomingMessage, answer?: QuestionAnswer, binding?: DecideBinding, onResumeCommitted?: (grant: {
|
|
30
|
+
overrideSessionId?: string;
|
|
31
|
+
validatedToolName: string | null;
|
|
32
|
+
}) => Promise<void>, acceptEarly?: boolean, decider?: {
|
|
33
|
+
principal?: string;
|
|
34
|
+
explicitOperator: boolean;
|
|
35
|
+
}) => Promise<{
|
|
36
|
+
status: number;
|
|
37
|
+
body: object;
|
|
38
|
+
}>;
|
|
39
|
+
driveResumeIntoRunLog: (args: DriveResumeArgs) => Promise<{
|
|
40
|
+
status: number;
|
|
41
|
+
body: object;
|
|
42
|
+
}>;
|
|
43
|
+
driveResumeLeg: (args: DriveResumeArgs, onAccepted?: (receipt: {
|
|
44
|
+
status: number;
|
|
45
|
+
body: object;
|
|
46
|
+
}) => void) => Promise<{
|
|
47
|
+
status: number;
|
|
48
|
+
body: object;
|
|
49
|
+
}>;
|
|
50
|
+
mayDiscloseRowError: (cs: CheckpointStoreFull, token: CheckpointToken, decider: {
|
|
51
|
+
principal?: string;
|
|
52
|
+
explicitOperator: boolean;
|
|
53
|
+
} | undefined) => Promise<boolean>;
|
|
54
|
+
resumePreempted: (sessionId: string, req: IncomingMessage | undefined, acceptEarly?: boolean, decider?: {
|
|
55
|
+
principal?: string;
|
|
56
|
+
explicitOperator: boolean;
|
|
57
|
+
}) => Promise<{
|
|
58
|
+
status: number;
|
|
59
|
+
body: object;
|
|
60
|
+
}>;
|
|
61
|
+
startFreshHostTurn: (sessionId: string, objective: string, principal: string | undefined, req: IncomingMessage, trustedInternals: TrustedRunInternals, runId: string) => Promise<{
|
|
62
|
+
status: number;
|
|
63
|
+
body: object;
|
|
64
|
+
}>;
|
|
65
|
+
resumeWake: (sessionId: string, message: string | undefined, caller: string | undefined, req: IncomingMessage | undefined, acceptEarly?: boolean, workflowParkedResume?: DriveResumeArgs["workflowParkedResume"], ownerLeaseAdmittedFor?: string) => Promise<{
|
|
66
|
+
status: number;
|
|
67
|
+
body: object;
|
|
68
|
+
}>;
|
|
69
|
+
resumePlanReview: (sessionId: string, decision: "approve" | "edit" | "reject", editedPlan: string | undefined, reason: string | undefined, req: IncomingMessage | undefined, log?: {
|
|
70
|
+
taskId?: string;
|
|
71
|
+
principalPresent?: boolean;
|
|
72
|
+
}, acceptEarly?: boolean, decider?: {
|
|
73
|
+
principal?: string;
|
|
74
|
+
explicitOperator: boolean;
|
|
75
|
+
}) => Promise<{
|
|
76
|
+
status: number;
|
|
77
|
+
body: object;
|
|
78
|
+
}>;
|
|
79
|
+
};
|
|
80
|
+
//# sourceMappingURL=resume-legs.d.ts.map
|