@sema-agent/server 7.139.0 → 7.140.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/MIGRATION.md +181 -0
- package/USAGE.md +19 -13
- package/dist/adoption/runner.js +1 -1
- package/dist/adoption/sql.js +1 -1
- package/dist/approval-card.d.ts +6 -6
- package/dist/bench/s1/live-deps.js +3 -2
- package/dist/bench/s1/row.d.ts +5 -2
- package/dist/bench/s1/row.js +2 -22
- package/dist/boot/adoption.js +1 -1
- package/dist/boot/execution-env.js +12 -10
- package/dist/boot/execution-lane.d.ts +8 -0
- package/dist/boot/execution-lane.js +6 -1
- package/dist/boot/memory-boundary.d.ts +14 -51
- package/dist/boot/memory-boundary.js +10 -20
- package/dist/boot/memory-consolidation.d.ts +15 -11
- package/dist/boot/memory-consolidation.js +23 -12
- package/dist/boot/resolve-spec.d.ts +3 -5
- package/dist/boot/resolve-spec.js +2 -4
- package/dist/boot/runner-deps.d.ts +3 -3
- package/dist/boot/runner-deps.js +1 -0
- package/dist/boot/stage-03-store-backend.d.ts +2 -6
- package/dist/boot/stage-03-store-backend.js +2 -3
- package/dist/boot/stage-04-stores.d.ts +2 -6
- package/dist/boot/stage-04-stores.js +5 -5
- package/dist/boot/stage-05-execution-env.d.ts +2 -6
- package/dist/boot/stage-06-runners.d.ts +2 -6
- package/dist/boot/stage-06-runners.js +2 -2
- package/dist/boot/stage-07-capability-layer.d.ts +2 -6
- package/dist/boot/stage-08-reapers.d.ts +2 -6
- package/dist/boot/stage-09-leader.d.ts +2 -6
- package/dist/boot/stage-10-http-server.d.ts +2 -6
- package/dist/boot/stage-10-http-server.js +5 -4
- package/dist/boot/stores.d.ts +3 -6
- package/dist/boot/stores.js +27 -40
- package/dist/boot/task-list-lane.d.ts +1 -1
- package/dist/boot/task-list-lane.js +1 -1
- package/dist/boot/web-admin.js +35 -9
- package/dist/capabilities/execution-lane.d.ts +2 -2
- package/dist/config-catalog.js +2 -1
- package/dist/config-provider.d.ts +14 -13
- package/dist/config-provider.js +24 -18
- package/dist/config-types.d.ts +11 -2
- package/dist/config.js +2 -1
- package/dist/delegated-session-owner.d.ts +2 -1
- package/dist/delegated-session-owner.js +1 -1
- package/dist/deployment-shape.d.ts +9 -8
- package/dist/deployment-shape.js +4 -4
- package/dist/execution-lane-caps.d.ts +97 -106
- package/dist/execution-lane-caps.js +67 -83
- package/dist/http/memory-compliance-failure-reply.d.ts +3 -1
- package/dist/http/memory-compliance-failure-reply.js +5 -0
- package/dist/http/memory-layer-reply.d.ts +30 -0
- package/dist/http/memory-layer-reply.js +24 -0
- package/dist/http/resume-legs.js +13 -16
- package/dist/http/retired-service-deps.d.ts +1 -1
- package/dist/http/retired-service-deps.js +1 -1
- package/dist/http/routes/adoption.js +1 -1
- package/dist/http/routes/memory-bundle.js +3 -0
- package/dist/http/routes/memory-compliance.js +8 -1
- package/dist/http/routes/memory-consolidation.js +12 -1
- package/dist/http/routes/memory-origin.js +14 -2
- package/dist/http/routes/memory-policy.js +5 -0
- package/dist/http/routes/sessions.js +28 -11
- package/dist/http/routes/tasks.js +4 -2
- package/dist/http/server.d.ts +5 -25
- package/dist/http/server.js +2 -2
- package/dist/identity-source.d.ts +1 -1
- package/dist/identity-source.js +1 -1
- package/dist/lane-home-probe.d.ts +68 -42
- package/dist/lane-home-probe.js +53 -30
- package/dist/leader/wire.js +5 -4
- package/dist/memory-bundle-engine.d.ts +16 -9
- package/dist/memory-bundle-engine.js +29 -6
- package/dist/memory-operator-faces.d.ts +85 -30
- package/dist/memory-operator-faces.js +136 -30
- package/dist/memory-project-layer.d.ts +3 -21
- package/dist/memory-project-layer.js +11 -8
- package/dist/memory-scope-stores.d.ts +73 -0
- package/dist/memory-scope-stores.js +86 -0
- package/dist/memory-scope.d.ts +29 -5
- package/dist/memory-scope.js +16 -4
- package/dist/memory-sync-client.d.ts +20 -7
- package/dist/memory-sync-client.js +31 -13
- package/dist/plugins/adoption-log-sql.js +4 -4
- package/dist/plugins/approval-ask-store-sql.js +14 -14
- package/dist/plugins/approval-nonce-store.js +4 -4
- package/dist/plugins/blob-backend.d.ts +4 -4
- package/dist/plugins/blob-backend.js +7 -7
- package/dist/plugins/breaker-state-sql.js +2 -2
- package/dist/plugins/checkpoint-index-columns.js +2 -2
- package/dist/plugins/checkpoint-store-sql.js +16 -16
- package/dist/plugins/device-store-sql.js +19 -19
- package/dist/plugins/ensure-index.d.ts +1 -2
- package/dist/plugins/execution-placement-sql.d.ts +8 -8
- package/dist/plugins/execution-placement-sql.js +8 -8
- package/dist/plugins/file-history-store-sql.d.ts +2 -2
- package/dist/plugins/file-history-store-sql.js +4 -4
- package/dist/plugins/image-bake-store-sql.js +9 -9
- package/dist/plugins/image-index-sql.js +11 -11
- package/dist/plugins/leader-run-store-sql.js +4 -4
- package/dist/plugins/mailbox-store-sql.d.ts +2 -1
- package/dist/plugins/mailbox-store-sql.js +4 -4
- package/dist/plugins/memory-engine-tidb.js +5 -5
- package/dist/plugins/memory-optout-grant-store-sql.js +1 -1
- package/dist/plugins/memory-sync-store-tidb.js +3 -3
- package/dist/plugins/one-time-migrations.d.ts +10 -9
- package/dist/plugins/one-time-migrations.js +36 -36
- package/dist/plugins/org-delivery-quota-store.js +2 -2
- package/dist/plugins/outcome-ledger-sql.js +2 -2
- package/dist/plugins/permission-rule-store-sql.d.ts +4 -4
- package/dist/plugins/permission-rule-store-sql.js +16 -16
- package/dist/plugins/remote-env-adb.d.ts +7 -24
- package/dist/plugins/remote-env-adb.js +22 -5
- package/dist/plugins/remote-env-device.d.ts +2 -28
- package/dist/plugins/remote-env-device.js +2 -1
- package/dist/plugins/remote-env-e2b.d.ts +18 -26
- package/dist/plugins/remote-env-e2b.js +51 -4
- package/dist/plugins/remote-env-file-error.d.ts +1 -1
- package/dist/plugins/remote-env-file-error.js +8 -2
- package/dist/plugins/remote-env-host.d.ts +19 -35
- package/dist/plugins/remote-env-host.js +26 -3
- package/dist/plugins/remote-env-k8s.d.ts +3 -14
- package/dist/plugins/remote-env-k8s.js +3 -2
- package/dist/plugins/remote-env-local-docker.d.ts +4 -15
- package/dist/plugins/remote-env-local-docker.js +5 -4
- package/dist/plugins/remote-env-ssh.d.ts +4 -24
- package/dist/plugins/remote-env-ssh.js +4 -3
- package/dist/plugins/resume-anchor-store-sql.js +2 -2
- package/dist/plugins/retention-lane-store-sql.d.ts +1 -1
- package/dist/plugins/retention-lane-store-sql.js +2 -2
- package/dist/plugins/retention-store-sql.d.ts +1 -1
- package/dist/plugins/retention-store-sql.js +6 -6
- package/dist/plugins/run-store-sql.js +15 -15
- package/dist/plugins/schema-consistency.d.ts +6 -6
- package/dist/plugins/schema-consistency.js +1 -1
- package/dist/plugins/schema-ensure-legs.d.ts +2 -3
- package/dist/plugins/schema-ensure-legs.js +2 -2
- package/dist/plugins/schema-live-columns.d.ts +1 -1
- package/dist/plugins/session-capture-record-store-sql.js +1 -1
- package/dist/plugins/session-rules-column.d.ts +1 -1
- package/dist/plugins/session-rules-column.js +1 -1
- package/dist/plugins/session-workspace-cell.d.ts +1 -1
- package/dist/plugins/session-workspace-cell.js +1 -1
- package/dist/plugins/shared-memory-store-sql.js +2 -2
- package/dist/plugins/sql-driver.d.ts +10 -5
- package/dist/plugins/sql-driver.js +6 -6
- package/dist/plugins/sql-errors.js +1 -1
- package/dist/plugins/store-backend.d.ts +4 -6
- package/dist/plugins/store-backend.js +6 -6
- package/dist/plugins/task-list-store-sql.js +11 -11
- package/dist/plugins/tidb-pool.js +5 -5
- package/dist/plugins/tidb-session-storage.js +4 -4
- package/dist/plugins/tidb-session-store.js +13 -13
- package/dist/plugins/tool-result-store-sql.d.ts +2 -2
- package/dist/plugins/tool-result-store-sql.js +3 -3
- package/dist/plugins/user-input-ledger-sql.js +2 -2
- package/dist/plugins/workflow-journal-store-sql.js +5 -5
- package/dist/plugins/workflow-run-store-sql.js +19 -19
- package/dist/plugins/write-behind-counter.d.ts +2 -3
- package/dist/plugins/write-behind-counter.js +5 -5
- package/dist/resource-suspend.d.ts +14 -12
- package/dist/resource-suspend.js +1 -1
- package/dist/resource-window.d.ts +4 -3
- package/dist/run-local.js +14 -19
- package/dist/runs.d.ts +8 -4
- package/dist/runs.js +49 -65
- package/dist/session-incarnation.d.ts +1 -1
- package/dist/session-incarnation.js +1 -1
- package/dist/session-policy-wire.d.ts +1 -1
- package/dist/sql-engine-posture.d.ts +1 -1
- package/dist/sql-engine-posture.js +1 -1
- package/dist/{plugins → stores-sql}/background-agent-store-sql.d.ts +2 -2
- package/dist/{plugins → stores-sql}/background-agent-store-sql.js +8 -8
- package/dist/{plugins → stores-sql}/session-policy-store-sql.d.ts +7 -5
- package/dist/{plugins → stores-sql}/session-policy-store-sql.js +12 -12
- package/dist/{plugins → stores-sql}/usage-window-store-sql.d.ts +1 -1
- package/dist/{plugins → stores-sql}/usage-window-store-sql.js +3 -3
- package/dist/task-a2a.js +5 -6
- package/dist/task-mcp.d.ts +20 -7
- package/dist/task-mcp.js +17 -9
- package/dist/terminal.d.ts +27 -0
- package/dist/terminal.js +6 -0
- package/dist/trace/redact.d.ts +3 -1
- package/dist/trace/redact.js +80 -28
- package/dist/trace/self-minted-wire.d.ts +58 -0
- package/dist/trace/self-minted-wire.js +16 -0
- package/dist/web-admin-client/candidate-gate.d.ts +11 -7
- package/dist/web-admin-client/candidate-gate.js +1 -1
- package/dist/web-admin-client/http-client.d.ts +5 -4
- package/dist/web-admin-client/http-client.js +2 -2
- package/dist/web-admin-client/read-warnings.d.ts +7 -17
- package/dist/web-admin-client/read-warnings.js +5 -9
- package/package.json +2 -2
- package/wire-changes/server@7.140.0.json +184 -0
package/dist/config-provider.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readMcpSourceLabel } from "./mcp-source-label.js";
|
|
2
2
|
import { createHmac, randomBytes } from "node:crypto";
|
|
3
|
-
import {
|
|
4
|
-
import { FileConfigStore } from "@sema-agent/settings-schema/node";
|
|
3
|
+
import { splitFoldedReadWarnings, withDroppedCatalogEntries } from "./web-admin-client/read-warnings.js";
|
|
4
|
+
import { FileConfigStore, inspectBundle } from "@sema-agent/settings-schema/node";
|
|
5
5
|
import { assertLocalConfigDirTrusted } from "./config-dir-trust.js";
|
|
6
6
|
import { danglingRefs, emptyEffective, findSkillContent, promptArtifactFor, renderRefIssue, skillContentHash, } from "@sema-agent/settings-schema";
|
|
7
7
|
import { redactSecrets } from "./trace/redact.js";
|
|
@@ -25,7 +25,9 @@ export function redactConfigError(text) {
|
|
|
25
25
|
export function fingerprintConfigOperand(operand) {
|
|
26
26
|
return `#${createHmac("sha256", OPERAND_FINGERPRINT_KEY).update(operand).digest("hex").slice(0, 8)}`;
|
|
27
27
|
}
|
|
28
|
-
const
|
|
28
|
+
const redactContractSentence = (text) => redactSecrets(text);
|
|
29
|
+
const redactDroppedEntry = (d) => ({ ...d, error: redactContractSentence(d.error) });
|
|
30
|
+
const redactRefusedDocument = (d) => ({ ...d, error: redactContractSentence(d.error) });
|
|
29
31
|
export const BOOT_FETCH_DEFERRED = Symbol("boot-fetch-deferred");
|
|
30
32
|
export function raceBootFetch(fetch, budgetMs) {
|
|
31
33
|
if (budgetMs <= 0)
|
|
@@ -50,12 +52,13 @@ export class RemoteConfigProvider {
|
|
|
50
52
|
async fetchEffective(etag) {
|
|
51
53
|
const fn = this.deps.fetchEffective ?? remoteFetchEffective;
|
|
52
54
|
const r = await fn(this.cc, etag, undefined, this.cc.worker);
|
|
53
|
-
if (r === null || (r.domainErrors === undefined && r.droppedEntries === undefined))
|
|
55
|
+
if (r === null || (r.domainErrors === undefined && r.droppedEntries === undefined && r.refusedDocuments === undefined))
|
|
54
56
|
return r;
|
|
55
57
|
return {
|
|
56
58
|
...r,
|
|
57
59
|
...(r.domainErrors !== undefined ? { domainErrors: r.domainErrors.map((de) => ({ domain: de.domain, error: redactConfigError(de.error) })) } : {}),
|
|
58
60
|
...(r.droppedEntries !== undefined ? { droppedEntries: r.droppedEntries.map(redactDroppedEntry) } : {}),
|
|
61
|
+
...(r.refusedDocuments !== undefined ? { refusedDocuments: r.refusedDocuments.map(redactRefusedDocument) } : {}),
|
|
59
62
|
};
|
|
60
63
|
}
|
|
61
64
|
async fetchSkillContent(contentHash) {
|
|
@@ -74,14 +77,12 @@ export class LocalConfigProvider {
|
|
|
74
77
|
kind = "local";
|
|
75
78
|
skillBodyCacheDir = undefined;
|
|
76
79
|
#servedSkills = { skills: [] };
|
|
77
|
-
store;
|
|
78
80
|
root;
|
|
79
81
|
#injectedStore;
|
|
80
82
|
#declaredOwnerUid;
|
|
81
83
|
constructor(root, store, trust = { declaredOwnerUid: undefined }) {
|
|
82
84
|
this.root = root;
|
|
83
85
|
this.#injectedStore = store;
|
|
84
|
-
this.store = store ?? new FileConfigStore(root);
|
|
85
86
|
this.#declaredOwnerUid = trust.declaredOwnerUid;
|
|
86
87
|
}
|
|
87
88
|
async fetchEffective(etag) {
|
|
@@ -93,21 +94,16 @@ export class LocalConfigProvider {
|
|
|
93
94
|
readWarnings.push(w);
|
|
94
95
|
},
|
|
95
96
|
});
|
|
96
|
-
let
|
|
97
|
-
let retired;
|
|
97
|
+
let eff;
|
|
98
98
|
try {
|
|
99
|
-
|
|
99
|
+
eff = await store.getEffective();
|
|
100
100
|
}
|
|
101
101
|
catch (e) {
|
|
102
|
-
|
|
103
|
-
if (
|
|
102
|
+
const inspection = await inspectBundle(this.root);
|
|
103
|
+
if (inspection.refusals.length === 0)
|
|
104
104
|
throw e;
|
|
105
|
-
|
|
106
|
-
throw e;
|
|
107
|
-
});
|
|
108
|
-
read = { effective: { ...emptyEffective(), version }, domainErrors: [] };
|
|
105
|
+
return refusedRead(inspection.refusals.map(redactRefusedDocument), inspection.version, etag);
|
|
109
106
|
}
|
|
110
|
-
const { effective: eff, domainErrors } = read;
|
|
111
107
|
const tag = String(eff.version);
|
|
112
108
|
if (etag !== undefined && etag === tag)
|
|
113
109
|
return null;
|
|
@@ -123,7 +119,7 @@ export class LocalConfigProvider {
|
|
|
123
119
|
const folded = splitFoldedReadWarnings(readWarnings, "local");
|
|
124
120
|
const parseErrors = folded.domainErrors.map((w) => ({ domain: w.domain, error: redactConfigError(w.error) }));
|
|
125
121
|
const droppedEntries = folded.droppedEntries.map(redactDroppedEntry);
|
|
126
|
-
const errors = [...
|
|
122
|
+
const errors = [...parseErrors, ...refErrors];
|
|
127
123
|
this.#servedSkills = eff.skills;
|
|
128
124
|
const unreadKeys = localUnreadPromptKeys(eff.prompts);
|
|
129
125
|
return {
|
|
@@ -134,13 +130,23 @@ export class LocalConfigProvider {
|
|
|
134
130
|
...(droppedEntries.length > 0 ? { droppedEntries } : {}),
|
|
135
131
|
...(folded.unreadFiles.length > 0 ? { unreadFiles: folded.unreadFiles } : {}),
|
|
136
132
|
...(unreadKeys.length > 0 ? { unreadKeys } : {}),
|
|
137
|
-
...(retired !== undefined ? { retiredDomains: [retired] } : {}),
|
|
138
133
|
};
|
|
139
134
|
}
|
|
140
135
|
async fetchSkillContent(contentHash) {
|
|
141
136
|
return findSkillContent(this.#servedSkills, contentHash);
|
|
142
137
|
}
|
|
143
138
|
}
|
|
139
|
+
function refusedRead(refused, version, etag) {
|
|
140
|
+
const tag = String(version);
|
|
141
|
+
if (etag !== undefined && etag === tag)
|
|
142
|
+
return null;
|
|
143
|
+
return {
|
|
144
|
+
effective: mapToServiceEffective({ ...emptyEffective(), version }, version),
|
|
145
|
+
etag: tag,
|
|
146
|
+
readWarnings: [],
|
|
147
|
+
refusedDocuments: refused,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
144
150
|
function localUnreadPromptKeys(prompts) {
|
|
145
151
|
const names = prompts?.workers === undefined ? [] : Object.keys(prompts.workers);
|
|
146
152
|
return names.length === 0 ? [] : [{ file: "prompts.json", domain: "prompts", key: "workers", names }];
|
package/dist/config-types.d.ts
CHANGED
|
@@ -891,7 +891,9 @@ export interface ServiceConfigFlat {
|
|
|
891
891
|
* 跑在哪个用户的 home 下」)。显式声明**恒赢**;缺席时只有 home 属于车道本身的那几条车道有答案
|
|
892
892
|
* (host/in-process = `os.homedir()`、e2b = 平台固定用户),k8s/local-docker(镜像属性)、
|
|
893
893
|
* ssh(目标机登录用户)、adb/device 一律缺席 ⇒ `~/` 规则在下单时被 422 响亮拒。
|
|
894
|
-
*
|
|
894
|
+
* 声明与出厂答案都只是**主张**:读得出家目录的车道(device 之外的六条)在每只执行环境开起来时拿环境里命令看到的 `$HOME` 证它,
|
|
895
|
+
* 不一致 / 读不出 ⇒ 那只环境不开(拒句点名两值与改法);device 读不了 ⇒ 声明即座,起服披露「来自声明、未实测」。
|
|
896
|
+
* 派生与逐车道理由的**单一属主** = `execution-lane-caps.ts` 的 `executionLaneHomeDir` / `buildLaneHomeClaim`。
|
|
895
897
|
* 非绝对路径 ⇒ **拒启**([ref] A 档;core 侧同判为 `config.execution_env_home_dir_invalid`)。
|
|
896
898
|
*/
|
|
897
899
|
remoteExecHomeDir?: string;
|
|
@@ -2118,6 +2120,13 @@ export interface ServiceConfigFlat {
|
|
|
2118
2120
|
* `READ_DENY_BUILTIN_EXCLUDE`=逗号分隔;不在表里的行名 / 空串**启动期响亮拒**。
|
|
2119
2121
|
* 🔴 不变量(判据帖 G5b):删内建**绝不**削弱任务自己显式声明的 deny —— 那是另一层(additions)。 */
|
|
2120
2122
|
readDenyBuiltinExclude?: readonly string[];
|
|
2123
|
+
/** 部署**要不要求**读拒表的字节地板(`READ_DENY_FLOOR_REQUIRED`,布尔,缺省 false)—— 交引擎 `RunnerDeps.readDenyFloorRequired`
|
|
2124
|
+
* (部署姿态座席族的一席,唯一取值点 `buildDeploymentPostureSeats`)。判官是引擎:一个 run 的读拒表有行、而它的执行环境块
|
|
2125
|
+
* `keepsReadFloor` 不为真时 —— true ⇒ 准备期拒(`config.read_deny_floor_unkept`,一个命令都不起;同步腿 409);false ⇒ run 照跑,
|
|
2126
|
+
* 每 run 一条 operator 通告同码(递归读照读表里的文件,通告不是保护)。出厂读拒档(credentials / agent-config)在岗时每条带手 run 的表都有行;
|
|
2127
|
+
* 本仓七车道的块今天都不守地板 ⇒ 设 true 的部署上带手 run 一律拒起(起服 warn `read_deny_floor_required_unkept` 先说)。
|
|
2128
|
+
* **仅 deployment 席**:TaskSpec 上没有同名键,任务无法放宽自己的部署。 */
|
|
2129
|
+
readDenyFloorRequired: boolean;
|
|
2121
2130
|
/** core 7.46.0 [ref]:部署**声明**的配置根(`SEMA_CONFIG_DIR`,绝对路径;起服的供给动作建出目录,能不能用由引擎判)—— 交引擎 `RunnerDeps.agentConfigDir`
|
|
2122
2131
|
* 与守卫集 `createSensitivePathPolicy` 的同名入参:内建读拒表里以 `.sema` 开头的行在这个根下同样拒,写进根下要问一次。缺席 = 没声明
|
|
2123
2132
|
* ⇒ 引擎读字面 `~/.sema`(与 LKG / skill 缓存 / scheduler 店的缺省落点同一处)。读法单一属主 `sema-config-dir.ts`。 */
|
|
@@ -2301,7 +2310,7 @@ export type ServiceMemoryConfig = Pick<ServiceConfigFlat, "memoryEngineEnabled"
|
|
|
2301
2310
|
* config 这一层它只是一句声明。 */
|
|
2302
2311
|
export type ServiceAuthConfig = Pick<ServiceConfigFlat, "authToken" | "authTokens" | "allowUnauthedWrites" | "corsOrigins" | "principalHeader" | "requirePrincipal" | "autonomy" | "commandPolicy" | "compliancePosture" | "lockedConfigKeys" | "configCatalogEnabled" | "retentionPolicy" | "retentionSweep" | "operatorPrincipals" | "operatorSingleUser" | "principalJwtPubkeys" | "principalJwtIss" | "principalJwtAud" | "authBridgeIssuer" | "principalJwtMaxTtlSec" | "bindHost" | "bindHostSource">;
|
|
2303
2312
|
/** 组:orchestration(编排 + 执行车道 + 沙箱面 + workflow/后台 agent 存留)。 */
|
|
2304
|
-
export type ServiceOrchestrationConfig = Pick<ServiceConfigFlat, "remoteExec" | "remoteExecHomeDir" | "requireExecutionLane" | "worktreeIsolation" | "leaderEnabled" | "leaderFanoutEnabled" | "routerEnabled" | "selfOrchestrationEnabled" | "selfOrchestrationModels" | "selfOrchestrationWorkerIsolation" | "forkEnabled" | "experimentalObserverAgents" | "schedulerEnabled" | "schedulerSessionWakeup" | "schedulerSessionLifetime" | "schedulerStorePath" | "planModeEnabled" | "hooksTimeoutMs" | "workflowRunStoreBackend" | "workflowOrphanGraceMs" | "workflowJournalRetentionMs" | "workflowRunRetentionMs" | "usageWindows" | "workflowAgentsReadOnly" | "workflowSizeGuideline" | "backgroundAgentRetentionMs" | "backgroundAgentStaleRunningMs" | "backgroundAgentParkClaimStaleMs" | "delegationEntryCaps" | "rosterRetentionMs" | "leaderRunStaleMs" | "scratchpadSweepTtlMs" | "sandboxPkgSource" | "sandboxPkgSourceCustom" | "sessionAutoTitle" | "sessionAutoTitleSource" | "selectEnvironmentTool" | "envFactsEnabled" | "toolDeferLongtail" | "lspEnabled" | "lspHostEnabled" | "lspEnvAllow" | "imageBakes" | "readFace" | "readFaceSource" | "taskWriteFaceEscalation" | "readDenyPatterns" | "readDenyBuiltinTiers" | "readDenyBuiltinExclude" | "agentConfigDir" | "configLkgPath" | "configLkgEnabled">;
|
|
2313
|
+
export type ServiceOrchestrationConfig = Pick<ServiceConfigFlat, "remoteExec" | "remoteExecHomeDir" | "requireExecutionLane" | "worktreeIsolation" | "leaderEnabled" | "leaderFanoutEnabled" | "routerEnabled" | "selfOrchestrationEnabled" | "selfOrchestrationModels" | "selfOrchestrationWorkerIsolation" | "forkEnabled" | "experimentalObserverAgents" | "schedulerEnabled" | "schedulerSessionWakeup" | "schedulerSessionLifetime" | "schedulerStorePath" | "planModeEnabled" | "hooksTimeoutMs" | "workflowRunStoreBackend" | "workflowOrphanGraceMs" | "workflowJournalRetentionMs" | "workflowRunRetentionMs" | "usageWindows" | "workflowAgentsReadOnly" | "workflowSizeGuideline" | "backgroundAgentRetentionMs" | "backgroundAgentStaleRunningMs" | "backgroundAgentParkClaimStaleMs" | "delegationEntryCaps" | "rosterRetentionMs" | "leaderRunStaleMs" | "scratchpadSweepTtlMs" | "sandboxPkgSource" | "sandboxPkgSourceCustom" | "sessionAutoTitle" | "sessionAutoTitleSource" | "selectEnvironmentTool" | "envFactsEnabled" | "toolDeferLongtail" | "lspEnabled" | "lspHostEnabled" | "lspEnvAllow" | "imageBakes" | "readFace" | "readFaceSource" | "taskWriteFaceEscalation" | "readDenyPatterns" | "readDenyBuiltinTiers" | "readDenyBuiltinExclude" | "readDenyFloorRequired" | "agentConfigDir" | "configLkgPath" | "configLkgEnabled">;
|
|
2305
2314
|
/** 组:limitsHttp(HTTP 面 + 各类上限/配额/回收窗)。 */
|
|
2306
2315
|
export type ServiceLimitsHttpConfig = Pick<ServiceConfigFlat, "port" | "attachmentOrphanGraceMs" | "workspaceFileMaxBytes" | "attachmentMaxBytes" | "attachmentMimeAllowlist" | "attachmentUnboundTtlMs" | "infraCostRates" | "drainGraceMs" | "drainSecondSignalMinGapMs" | "sighupIdleGraceMs" | "parentPid" | "engineAutoExit" | "engineLingerMs" | "engineOrphanLingerMs" | "rateLimitPerMin" | "maxTaskCostUsd" | "maxTaskTokens" | "maxPrincipalCostUsd" | "costQuotaWindowSec" | "reapIntervalSec" | "runStaleSec" | "toolResultTtlSec">;
|
|
2307
2316
|
/** 组:observability(可观测)。 */
|
package/dist/config.js
CHANGED
|
@@ -1944,6 +1944,7 @@ function parseOrchestrationDomain(ctx) {
|
|
|
1944
1944
|
assertReadDenyBuiltinsResolvable(tiers, exclude);
|
|
1945
1945
|
return { ...(tiers !== undefined ? { readDenyBuiltinTiers: tiers } : {}), ...(exclude !== undefined ? { readDenyBuiltinExclude: exclude } : {}) };
|
|
1946
1946
|
})(),
|
|
1947
|
+
readDenyFloorRequired: boolEnv("READ_DENY_FLOOR_REQUIRED", false),
|
|
1947
1948
|
...((dir) => (dir !== undefined ? { agentConfigDir: dir } : {}))(declaredSemaConfigDir()),
|
|
1948
1949
|
...((p) => (p !== undefined ? { configLkgPath: p } : {}))(lkgPathOverrideOf(process.env.CONFIG_LKG_PATH)),
|
|
1949
1950
|
configLkgEnabled: boolEnv("CONFIG_LKG_ENABLED", true),
|
|
@@ -2471,7 +2472,7 @@ const ORCHESTRATION_GROUP_KEYS = [
|
|
|
2471
2472
|
"workflowSizeGuideline", "backgroundAgentRetentionMs", "backgroundAgentStaleRunningMs",
|
|
2472
2473
|
"backgroundAgentParkClaimStaleMs", "delegationEntryCaps", "rosterRetentionMs", "leaderRunStaleMs", "scratchpadSweepTtlMs", "sandboxPkgSource", "sandboxPkgSourceCustom",
|
|
2473
2474
|
"sessionAutoTitle", "sessionAutoTitleSource", "selectEnvironmentTool", "envFactsEnabled", "toolDeferLongtail", "lspEnabled", "lspHostEnabled", "lspEnvAllow",
|
|
2474
|
-
"imageBakes", "readFace", "readFaceSource", "taskWriteFaceEscalation", "readDenyPatterns", "readDenyBuiltinTiers", "readDenyBuiltinExclude",
|
|
2475
|
+
"imageBakes", "readFace", "readFaceSource", "taskWriteFaceEscalation", "readDenyPatterns", "readDenyBuiltinTiers", "readDenyBuiltinExclude", "readDenyFloorRequired",
|
|
2475
2476
|
"agentConfigDir", "configLkgPath", "configLkgEnabled",
|
|
2476
2477
|
];
|
|
2477
2478
|
const LIMITS_HTTP_GROUP_KEYS = [
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
*/
|
|
53
53
|
import type { SessionPlacement } from "@sema-agent/core";
|
|
54
54
|
import { type HeadRead, type SessionFace } from "./session-incarnation.js";
|
|
55
|
+
import type { SqlDialect } from "./plugins/sql-driver.js";
|
|
55
56
|
/** 孤行哨兵属主的前缀(保留主体前缀:`security.ts` 的 `RESERVED_PRINCIPAL_PREFIXES` 登记它,任何身份来源报出带它的主体都在鉴权边界被拒)。 */
|
|
56
57
|
export declare const ORPHAN_SESSION_OWNER_PREFIX = "_orphan:";
|
|
57
58
|
/** 一只推不出属主的子代会话的哨兵属主(每只会话一个值:即便哪天有谁误配出这个串,也只够得着这一只)。 */
|
|
@@ -112,7 +113,7 @@ export declare function reportWrittenOwner(log: OrphanOwnerLog, site: DelegatedO
|
|
|
112
113
|
* 不改变写进去的值(律:属主 = 判断时见证到的,本文件头注)。两方言只差占位符。
|
|
113
114
|
* MySQL 协议下 mysql2 缺省带 FOUND_ROWS,但条件里有 `owner IS NULL` ⇒ 匹配行数 = 改写行数。
|
|
114
115
|
*/
|
|
115
|
-
export declare const CLAIM_OWNERLESS_PLACED_SQL: Readonly<Record<
|
|
116
|
+
export declare const CLAIM_OWNERLESS_PLACED_SQL: Readonly<Record<SqlDialect, string>>;
|
|
116
117
|
/** 认领句的绑参(两方言同序;店与 M23 都经它,不各排一份):`incarnation` = 判断时读到的子行化身。 */
|
|
117
118
|
export declare function claimOwnerlessParams(sessionId: string, incarnation: string, owner: string): readonly [string, string, string];
|
|
118
119
|
/** 店的认领口(SQL 两店 + 缓存包装层同一个签名):这只会话的那一位住客(`incarnation`)仍是无主的 placed 行 ⇒ 写 `owner`,返回是否写成。 */
|
|
@@ -47,7 +47,7 @@ export function reportWrittenOwner(log, site, childId, judged) {
|
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
export const CLAIM_OWNERLESS_PLACED_SQL = {
|
|
50
|
-
|
|
50
|
+
mysql: "UPDATE session_meta SET owner = ? WHERE session_id = ? AND incarnation = ? AND owner IS NULL AND placement_kind IS NOT NULL",
|
|
51
51
|
pg: "UPDATE session_meta SET owner = $1 WHERE session_id = $2 AND incarnation = $3 AND owner IS NULL AND placement_kind IS NOT NULL",
|
|
52
52
|
};
|
|
53
53
|
export function claimOwnerlessParams(sessionId, incarnation, owner) {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* ## 两根轴,每根轴一个读口(原始配置键只在这两个函数里被读)
|
|
10
10
|
* · `principal` —— 运维的 `REQUIRE_PRINCIPAL` 声明({@link readPrincipalAxis})。
|
|
11
11
|
* · `lane` —— `REMOTE_EXEC` 的归一车道词(`executionLaneOf`,认不出 ⇒ `undefined`,行必须 fail-closed)+ 那条车道的能力表行 +
|
|
12
|
-
*
|
|
12
|
+
* 这份部署上执行环境的能力块(唯一作者 `capabilitiesFor`;k8s 的快照店是它的输入)+ 车道子旋钮(k8s 运行时类、隐式 host 尾臂记号)({@link readLaneAxis})。
|
|
13
13
|
*
|
|
14
14
|
* ## 轴列不是注释,是型
|
|
15
15
|
* 每行的判官只收到它**声明**的那几根轴的事实({@link DeploymentShapeFacts}),读不到配置本身 —— 判官碰一根没声明的轴 = 编译红;
|
|
@@ -21,8 +21,9 @@
|
|
|
21
21
|
* (`mcpInjectionHonored` = 锁 ∧ 合规 ∧ `!multiTenant`;`taskHooksHonored`;身份门 …),读行、不读原始键。
|
|
22
22
|
* 车道表(`execution-lane-caps.ts`)按车道词键控的布尔列(`laneIsolated` 等)是车道轴自己的事实表,不是「部署」的谓词;行读它们。
|
|
23
23
|
*
|
|
24
|
-
* 依赖纪律:叶模块 —— 值导入只有 `execution-lane-caps.ts`(它本身是叶)
|
|
24
|
+
* 依赖纪律:叶模块 —— 值导入只有 `execution-lane-caps.ts`(它本身是叶),零运行期环(引擎只 type-import)。
|
|
25
25
|
*/
|
|
26
|
+
import type { ExecutionEnvCapabilities } from "@sema-agent/core";
|
|
26
27
|
import { type ExecutionLane, type ExecutionLaneCaps } from "./execution-lane-caps.js";
|
|
27
28
|
/** `principal` 轴读的配置键(`ServiceConfig` 结构上满足)。 */
|
|
28
29
|
export interface PrincipalAxisInput {
|
|
@@ -48,10 +49,10 @@ export interface LaneAxisFacts {
|
|
|
48
49
|
readonly lane: ExecutionLane | undefined;
|
|
49
50
|
/** 那条车道的能力表行(认不出 ⇒ `undefined`)。 */
|
|
50
51
|
readonly caps: ExecutionLaneCaps | undefined;
|
|
52
|
+
/** 这份部署上执行环境的能力块(`capabilitiesFor`;认不出 ⇒ `undefined`)。 */
|
|
53
|
+
readonly block: ExecutionEnvCapabilities | undefined;
|
|
51
54
|
/** k8s 的 `runtimeClass`(别的车道 `undefined`)。 */
|
|
52
55
|
readonly k8sRuntimeClass: string | undefined;
|
|
53
|
-
/** k8s 配了 S3 工作区快照店(别的车道 `false`)。 */
|
|
54
|
-
readonly k8sSnapshotStore: boolean;
|
|
55
56
|
/** host 车道值上带「单机形缺省」记号(唯一写者 = `config.ts` 三元链的隐式 host 尾臂;显式 `REMOTE_EXEC=host` 与文件覆写都不带)。 */
|
|
56
57
|
readonly singleMachineDefault: boolean;
|
|
57
58
|
}
|
|
@@ -102,7 +103,7 @@ export declare const DEPLOYMENT_SHAPE_PREDICATES: Readonly<{
|
|
|
102
103
|
inProcessSingleUser: DeploymentShapePredicate<"lane" | "principal">;
|
|
103
104
|
/** 任务层替部署声明宿主姿态(bypassPermissions 开写面 / host shell 继承整份环境)的射程:device 车道上跨租户宿主穿越结构性不存在(clay 裁定③)。 */
|
|
104
105
|
taskHostPostureDeclarations: DeploymentShapePredicate<"lane" | "principal">;
|
|
105
|
-
/**
|
|
106
|
+
/** 写门走代理裁决(执行环境块 `hostLocalPaths` 为假:路径不是本 worker 盘上的文件);认不出的词 ⇒ 走代理(代理 slot 空 ⇒ 写门 fail-closed)。 */
|
|
106
107
|
sandboxPathAdjudication: DeploymentShapePredicate<"lane">;
|
|
107
108
|
/** 读能力表 `sandboxSendUserFile` 位(e2b / k8s 每任务一只沙箱 ⇒ 任何租户;ssh 共享一台真机 ⇒ 只单主)。 */
|
|
108
109
|
sandboxSendUserFile: DeploymentShapePredicate<"lane" | "principal">;
|
|
@@ -111,13 +112,13 @@ export declare const DEPLOYMENT_SHAPE_PREDICATES: Readonly<{
|
|
|
111
112
|
/** 读能力表 `tenantSeparation` 位(值来自 settings-schema 车道词表正本);唯一读者 = 跨域不变量 `multi-tenant-shared-lane`。 */
|
|
112
113
|
laneSeparatesTenants: DeploymentShapePredicate<"lane" | "principal">;
|
|
113
114
|
/**
|
|
114
|
-
* [ref] —— **VM 级**隔离强度(独立内核:e2b 的 Firecracker microVM;k8s 只在 Kata / gVisor 运行时类上)
|
|
115
|
+
* [ref] —— **VM 级**隔离强度(独立内核:e2b 的 Firecracker microVM;k8s 只在 Kata / gVisor 运行时类上)。与执行环境块 `isolation` 键
|
|
115
116
|
* (OS 级边界,容器即算;wire `executionLane.isolated` 的属主 `laneIsolated`)是两个问题,所以不叫「isolated」。读者:A 值路由。
|
|
116
117
|
*/
|
|
117
118
|
vmIsolatedHands: DeploymentShapePredicate<"lane">;
|
|
118
119
|
/**
|
|
119
|
-
*
|
|
120
|
-
*
|
|
120
|
+
* 执行环境可挂起 = 这份部署上执行环境块的 `suspendable`(唯一作者 `capabilitiesFor`,k8s 的快照店是它的输入;适配器的块是同一只函数铸的)。
|
|
121
|
+
* 读者:boot `remote_exec_enabled.suspendable`。
|
|
121
122
|
*/
|
|
122
123
|
suspendableHands: DeploymentShapePredicate<"lane">;
|
|
123
124
|
/** 读者两处:`config.ts` 车道落点一行的 `source`(覆写之前)与 `boot/execution-env.ts` 的 `remote_exec_real_system.note`(覆写之后)—— 同一个记号、两个时刻。 */
|
package/dist/deployment-shape.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { executionLaneCaps, executionLaneOf, handsOnWorkerFilePlane } from "./execution-lane-caps.js";
|
|
1
|
+
import { capabilitiesFor, executionLaneCaps, executionLaneOf, handsOnWorkerFilePlane } from "./execution-lane-caps.js";
|
|
2
2
|
function readPrincipalAxis(deployment) {
|
|
3
3
|
return { declared: deployment.requirePrincipal === true };
|
|
4
4
|
}
|
|
@@ -8,8 +8,8 @@ function readLaneAxis(deployment) {
|
|
|
8
8
|
return {
|
|
9
9
|
lane,
|
|
10
10
|
caps: lane === undefined ? undefined : executionLaneCaps(lane),
|
|
11
|
+
block: capabilitiesFor(deployment),
|
|
11
12
|
k8sRuntimeClass: lane === "k8s" ? declaration?.runtimeClass : undefined,
|
|
12
|
-
k8sSnapshotStore: lane === "k8s" && Boolean(declaration?.s3Snapshot),
|
|
13
13
|
singleMachineDefault: lane === "host" && declaration?.singleMachineDefault === true,
|
|
14
14
|
};
|
|
15
15
|
}
|
|
@@ -54,7 +54,7 @@ export const DEPLOYMENT_SHAPE_PREDICATES = Object.freeze({
|
|
|
54
54
|
toolsOnThisHost: createPredicate(["lane"], "车道:工具跑的那台机器就是本进程这台(手挂上了且文件平面在本 worker 盘上;车道列 handsOnWorkerFilePlane)。", ({ lane }) => lane.lane !== undefined && handsOnWorkerFilePlane(lane.lane)),
|
|
55
55
|
inProcessSingleUser: createPredicate(["lane", "principal"], "车道 × 租户:进程内车道(REMOTE_EXEC 未设)且部署只有一个主人。", ({ lane, principal }) => lane.lane === "in-process" && !principal.declared),
|
|
56
56
|
taskHostPostureDeclarations: createPredicate(["lane", "principal"], "车道 × 租户 / 设备归属:任务层可以替部署声明宿主姿态 —— device 车道(发起者自己的设备),或单主部署。", ({ lane, principal }) => lane.lane === "device" || !principal.declared),
|
|
57
|
-
sandboxPathAdjudication: createPredicate(["lane"], "车道:写门的路径事实要经代理到执行环境里取(文件平面不在本 worker 盘上;认不出的车道也走代理)。", ({ lane }) => lane.
|
|
57
|
+
sandboxPathAdjudication: createPredicate(["lane"], "车道:写门的路径事实要经代理到执行环境里取(文件平面不在本 worker 盘上;认不出的车道也走代理)。", ({ lane }) => lane.block === undefined || !lane.block.hostLocalPaths),
|
|
58
58
|
sandboxSendUserFile: createPredicate(["lane", "principal"], "车道 × 租户:SendUserFile 的沙箱直传腿可以挂(沙箱盘 = 租户自己的任务工作区,或共享真机上的单主部署)。", ({ lane, principal }) => lane.caps !== undefined && capabilityHolds(lane.caps.sandboxSendUserFile, principal)),
|
|
59
59
|
remoteScratchpad: createPredicate(["lane"], "车道:执行环境里按会话分的远端 scratchpad 约定适用。", ({ lane }) => lane.caps !== undefined && lane.caps.remoteScratchpad === "supported"),
|
|
60
60
|
laneSeparatesTenants: createPredicate(["lane", "principal"], "车道 × 租户:这条车道在这台部署上不让两个租户的命令落在同一个共享目标上(单主部署恒成立;认不出的车道不成立)。", ({ lane, principal }) => lane.caps !== undefined && capabilityHolds(lane.caps.tenantSeparation, principal)),
|
|
@@ -66,7 +66,7 @@ export const DEPLOYMENT_SHAPE_PREDICATES = Object.freeze({
|
|
|
66
66
|
const runtimeClass = (lane.k8sRuntimeClass ?? "").trim().toLowerCase();
|
|
67
67
|
return runtimeClass.startsWith("kata") || VM_ISOLATION_RUNTIME_CLASSES.has(runtimeClass);
|
|
68
68
|
}),
|
|
69
|
-
suspendableHands: createPredicate(["lane"], "车道:执行环境可挂起(e2b;k8s 以配了 S3 工作区快照店为前提)。", ({ lane }) => lane.
|
|
69
|
+
suspendableHands: createPredicate(["lane"], "车道:执行环境可挂起(e2b;k8s 以配了 S3 工作区快照店为前提)。", ({ lane }) => lane.block?.suspendable === true),
|
|
70
70
|
singleMachineDefaultLane: createPredicate(["lane"], "车道:host 车道是单机形缺省落点(REMOTE_EXEC 未设 ∧ CONFIG_PROVIDER=local,没人点名)。", ({ lane }) => lane.singleMachineDefault),
|
|
71
71
|
});
|
|
72
72
|
//# sourceMappingURL=deployment-shape.js.map
|