@sema-agent/server 7.130.0 → 7.132.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 +396 -0
- package/README.md +13 -6
- package/README.zh-CN.md +9 -5
- package/USAGE.md +187 -50
- package/dist/approval-card.d.ts +3 -1
- package/dist/approval-card.js +2 -3
- package/dist/audit.d.ts +7 -10
- package/dist/audit.js +4 -1
- package/dist/auth-bridge.d.ts +4 -0
- package/dist/auth-bridge.js +10 -11
- package/dist/bench/s1/live-deps.js +2 -0
- package/dist/boot/deployment-mods.d.ts +31 -0
- package/dist/boot/deployment-mods.js +26 -0
- package/dist/boot/execution-env.d.ts +1 -1
- package/dist/boot/execution-env.js +19 -6
- package/dist/boot/memory-boundary.d.ts +2 -2
- package/dist/boot/read-deny-anchor-audit.d.ts +17 -0
- package/dist/boot/read-deny-anchor-audit.js +36 -0
- package/dist/boot/resolve-spec.d.ts +1 -5
- package/dist/boot/resolve-spec.js +56 -61
- package/dist/boot/runner-deps.d.ts +19 -8
- package/dist/boot/runner-deps.js +14 -2
- package/dist/boot/session-faces.d.ts +1 -7
- package/dist/boot/stage-02-web-admin-pull.js +9 -1
- package/dist/boot/stage-03-store-backend.d.ts +1 -1
- package/dist/boot/stage-03-store-backend.js +2 -2
- package/dist/boot/stage-04-stores.d.ts +1 -1
- package/dist/boot/stage-05-execution-env.d.ts +4 -4
- package/dist/boot/stage-05-execution-env.js +7 -10
- package/dist/boot/stage-06-runners.d.ts +2 -2
- package/dist/boot/stage-06-runners.js +5 -4
- package/dist/boot/stage-07-capability-layer.d.ts +2 -2
- package/dist/boot/stage-07-capability-layer.js +3 -3
- package/dist/boot/stage-08-reapers.d.ts +2 -2
- package/dist/boot/stage-09-leader.d.ts +3 -9
- package/dist/boot/stage-10-http-server.d.ts +3 -9
- package/dist/boot/stage-10-http-server.js +12 -10
- package/dist/boot/stores.d.ts +1 -1
- package/dist/boot/stores.js +5 -6
- package/dist/boot/web-admin.d.ts +0 -3
- package/dist/boot/web-admin.js +35 -35
- package/dist/brain.js +17 -22
- package/dist/budget.js +5 -4
- package/dist/caller-text-echo.d.ts +20 -0
- package/dist/caller-text-echo.js +24 -0
- package/dist/capabilities/brand-identity.d.ts +26 -0
- package/dist/capabilities/brand-identity.js +27 -0
- package/dist/capabilities/builtin-tools.js +2 -1
- package/dist/capabilities/center-plugins.js +1 -1
- package/dist/capabilities/center-prompts.d.ts +32 -59
- package/dist/capabilities/center-prompts.js +18 -32
- package/dist/capabilities/composite-members.d.ts +1 -0
- package/dist/capabilities/composite-members.js +1 -0
- package/dist/capabilities/engine-capabilities.js +2 -1
- package/dist/capabilities/hands-lane.d.ts +9 -6
- package/dist/capabilities/hands-lane.js +3 -3
- package/dist/capabilities/host-tool-names.d.ts +17 -0
- package/dist/capabilities/host-tool-names.js +15 -0
- package/dist/capabilities/mcp-probe.d.ts +14 -1
- package/dist/capabilities/mcp-probe.js +22 -133
- package/dist/capabilities/repo-tools.js +4 -3
- package/dist/capabilities/scenarios.d.ts +42 -47
- package/dist/capabilities/scenarios.js +19 -35
- package/dist/capabilities/select-environment-tool.js +2 -1
- package/dist/capabilities/send-user-file-tool.d.ts +0 -1
- package/dist/capabilities/send-user-file-tool.js +2 -2
- package/dist/capabilities/skills.d.ts +19 -4
- package/dist/capabilities/skills.js +30 -10
- package/dist/capabilities/tool-defer.js +2 -1
- package/dist/config-catalog.js +22 -11
- package/dist/config-invariants.js +2 -2
- package/dist/config-lkg.d.ts +9 -9
- package/dist/config-lkg.js +20 -4
- package/dist/config-provider.d.ts +3 -1
- package/dist/config-provider.js +14 -6
- package/dist/config-types.d.ts +13 -9
- package/dist/config.d.ts +2 -2
- package/dist/config.js +34 -20
- package/dist/device-ws-protocol.d.ts +1 -1
- package/dist/device-ws-protocol.js +1 -0
- package/dist/elicitation.d.ts +7 -0
- package/dist/elicitation.js +20 -5
- package/dist/env-name-allowlist-knobs.d.ts +12 -2
- package/dist/env-name-allowlist-knobs.js +5 -4
- package/dist/exec-bounds.d.ts +15 -3
- package/dist/exec-bounds.js +4 -0
- package/dist/execution-lane-caps.d.ts +9 -2
- package/dist/execution-lane-caps.js +11 -0
- package/dist/hooks/classic-stations.d.ts +86 -0
- package/dist/hooks/classic-stations.js +27 -0
- package/dist/hooks/hook-llm.d.ts +8 -5
- package/dist/hooks/hook-llm.js +80 -37
- package/dist/hooks/hook-runner.d.ts +273 -75
- package/dist/hooks/hook-runner.js +293 -317
- package/dist/http/admission.d.ts +8 -2
- package/dist/http/admission.js +103 -59
- package/dist/http/approval-sweeps.js +59 -18
- package/dist/http/checkpoint-ctx.d.ts +36 -18
- package/dist/http/checkpoint-ctx.js +14 -10
- package/dist/http/claimed-run.d.ts +13 -0
- package/dist/http/claimed-run.js +15 -0
- package/dist/http/device-placement.js +5 -10
- package/dist/http/dispatch.d.ts +0 -4
- package/dist/http/dispatch.js +6 -10
- package/dist/http/durable-run-leg.d.ts +2 -1
- package/dist/http/durable-run-leg.js +5 -3
- package/dist/http/health-self-report.d.ts +7 -5
- package/dist/http/health-self-report.js +4 -18
- package/dist/http/principal-gate.d.ts +23 -6
- package/dist/http/principal-gate.js +24 -5
- package/dist/http/refusal-body.d.ts +21 -0
- package/dist/http/refusal-body.js +4 -0
- package/dist/http/request-guards.d.ts +27 -0
- package/dist/http/request-guards.js +24 -3
- package/dist/http/resume-legs.d.ts +25 -0
- package/dist/http/resume-legs.js +48 -26
- package/dist/http/routes/approvals-assistant.js +1 -1
- package/dist/http/routes/capabilities.js +7 -17
- package/dist/http/routes/diagnostics.js +1 -1
- package/dist/http/routes/rules.js +2 -2
- package/dist/http/routes/runs.js +13 -17
- package/dist/http/routes/session-sync.js +4 -2
- package/dist/http/routes/sessions.js +23 -11
- package/dist/http/routes/shared-memory.js +2 -13
- package/dist/http/routes/side-query.js +2 -3
- package/dist/http/routes/tasks.js +34 -19
- package/dist/http/scenario-read-face.d.ts +14 -0
- package/dist/http/scenario-read-face.js +5 -0
- package/dist/http/send.d.ts +13 -1
- package/dist/http/send.js +12 -1
- package/dist/http/server.d.ts +37 -23
- package/dist/http/server.js +30 -4
- package/dist/http/stored-body-replay.d.ts +10 -3
- package/dist/http/stored-body-replay.js +27 -6
- package/dist/http/submit-ctx.d.ts +25 -0
- package/dist/http/submit-ctx.js +39 -0
- package/dist/http/wire-types.d.ts +18 -5
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/lane-home-probe.d.ts +43 -0
- package/dist/lane-home-probe.js +35 -0
- package/dist/limit-refusal.d.ts +47 -0
- package/dist/limit-refusal.js +12 -0
- package/dist/main.js +1 -1
- package/dist/mcp-assertion-header.d.ts +3 -11
- package/dist/mcp-assertion-header.js +3 -9
- package/dist/mcp-tool-faces.d.ts +5 -0
- package/dist/mcp-tool-faces.js +5 -1
- package/dist/memory-scope.d.ts +1 -1
- package/dist/model-entry-refusal.d.ts +1 -7
- package/dist/model-provider.d.ts +39 -12
- package/dist/model-provider.js +19 -2
- package/dist/model-route-endpoint.d.ts +52 -12
- package/dist/model-route-endpoint.js +48 -26
- package/dist/model-route-gap.d.ts +5 -4
- package/dist/model-route-gap.js +1 -1
- package/dist/model-select.d.ts +58 -0
- package/dist/model-select.js +31 -0
- package/dist/namespaced-rule-name.d.ts +7 -4
- package/dist/namespaced-rule-name.js +4 -3
- package/dist/observability/cost-taxonomy.d.ts +7 -7
- package/dist/observability/fail-open.d.ts +53 -12
- package/dist/observability/fail-open.js +47 -7
- package/dist/observability/metrics.js +3 -1
- package/dist/observability/prompt-manifest.d.ts +47 -82
- package/dist/observability/prompt-manifest.js +119 -17
- package/dist/observability/run-terminal.js +14 -6
- package/dist/observability/secret-env-scrub.d.ts +13 -1
- package/dist/observability/secret-env-scrub.js +13 -1
- package/dist/observability/tool-trace.d.ts +16 -21
- package/dist/observability/tool-trace.js +51 -42
- package/dist/per-task-image.d.ts +7 -1
- package/dist/per-task-image.js +3 -3
- package/dist/plain-string-record.d.ts +25 -0
- package/dist/plain-string-record.js +32 -0
- package/dist/plugins/blob-backend.d.ts +68 -13
- package/dist/plugins/blob-backend.js +53 -10
- package/dist/plugins/checkpoint-store-sql.d.ts +14 -4
- package/dist/plugins/checkpoint-store-sql.js +39 -26
- package/dist/plugins/k8s-bg-scripts.d.ts +11 -0
- package/dist/plugins/k8s-bg-scripts.js +22 -0
- package/dist/plugins/local-checkpoint-store.js +5 -2
- package/dist/plugins/local-session-store.js +3 -3
- package/dist/plugins/one-time-migrations.d.ts +147 -91
- package/dist/plugins/one-time-migrations.js +372 -208
- package/dist/plugins/permission-rule-store-sql.d.ts +13 -7
- package/dist/plugins/permission-rule-store-sql.js +4 -18
- package/dist/plugins/pg-session-storage.d.ts +4 -5
- package/dist/plugins/pg-session-storage.js +7 -17
- package/dist/plugins/remote-env-adb.d.ts +6 -0
- package/dist/plugins/remote-env-adb.js +9 -4
- package/dist/plugins/remote-env-device.js +3 -0
- package/dist/plugins/remote-env-e2b.d.ts +1 -1
- package/dist/plugins/remote-env-e2b.js +21 -9
- package/dist/plugins/remote-env-host.d.ts +9 -9
- package/dist/plugins/remote-env-host.js +10 -32
- package/dist/plugins/remote-env-k8s.d.ts +95 -26
- package/dist/plugins/remote-env-k8s.js +265 -90
- package/dist/plugins/remote-env-local-docker.d.ts +20 -1
- package/dist/plugins/remote-env-local-docker.js +77 -9
- package/dist/plugins/remote-env-ssh.d.ts +15 -0
- package/dist/plugins/remote-env-ssh.js +109 -3
- package/dist/plugins/remote-shell.d.ts +0 -1
- package/dist/plugins/remote-shell.js +1 -2
- package/dist/plugins/retention-store-sql.js +6 -2
- package/dist/plugins/schema-consistency.d.ts +54 -0
- package/dist/plugins/schema-consistency.js +52 -0
- package/dist/plugins/session-epoch-anchor.d.ts +13 -0
- package/dist/plugins/session-epoch-anchor.js +23 -0
- package/dist/plugins/shared-memory-store-sql.d.ts +9 -3
- package/dist/plugins/shared-memory-store-sql.js +5 -16
- package/dist/plugins/sql-driver.d.ts +141 -0
- package/dist/plugins/sql-driver.js +115 -1
- package/dist/plugins/sql-errors.d.ts +41 -0
- package/dist/plugins/sql-errors.js +36 -0
- package/dist/plugins/store-backend.js +2 -1
- package/dist/plugins/tidb-session-storage.d.ts +7 -11
- package/dist/plugins/tidb-session-storage.js +6 -16
- package/dist/plugins/tidb-session-store.js +1 -1
- package/dist/prompts-domain-validate.d.ts +17 -61
- package/dist/prompts-domain-validate.js +9 -119
- package/dist/question.d.ts +18 -9
- package/dist/question.js +21 -13
- package/dist/request-key-closure.d.ts +4 -4
- package/dist/request-key-closure.js +18 -13
- package/dist/rule-entry-list.d.ts +134 -24
- package/dist/rule-entry-list.js +162 -30
- package/dist/run-local.d.ts +3 -3
- package/dist/run-local.js +26 -25
- package/dist/runs.d.ts +48 -2
- package/dist/runs.js +61 -2
- package/dist/server-secret-env.d.ts +44 -18
- package/dist/server-secret-env.js +49 -8
- package/dist/session-incarnation.d.ts +15 -5
- package/dist/session-incarnation.js +16 -9
- package/dist/session-titler.js +12 -2
- package/dist/spec-fields.d.ts +34 -18
- package/dist/spec-fields.js +46 -53
- package/dist/sql-engine-posture.d.ts +29 -4
- package/dist/sql-engine-posture.js +36 -1
- package/dist/stored-request-hooks-m20.d.ts +23 -0
- package/dist/stored-request-hooks-m20.js +124 -0
- package/dist/stored-request-tool-axes-m19.d.ts +20 -5
- package/dist/stored-request-tool-axes-m19.js +30 -2
- package/dist/task-a2a.d.ts +9 -1
- package/dist/task-a2a.js +73 -47
- package/dist/task-mcp.d.ts +54 -102
- package/dist/task-mcp.js +194 -92
- package/dist/task-settings.d.ts +47 -25
- package/dist/task-settings.js +46 -61
- package/dist/text-bidi.d.ts +3 -46
- package/dist/text-bidi.js +3 -3
- package/dist/tool-approval.d.ts +1 -1
- package/dist/trace/core-keyset-guard.d.ts +24 -4
- package/dist/trace/engine-notice-wire.d.ts +11 -3
- package/dist/trace/engine-notice-wire.js +8 -1
- package/dist/trace/ledger-events.d.ts +3 -1
- package/dist/trace/ledger-sink.d.ts +29 -0
- package/dist/trace/ledger-sink.js +15 -1
- package/dist/trace/model-segment.js +1 -1
- package/dist/trace/project.d.ts +25 -6
- package/dist/trace/project.js +68 -22
- package/dist/trace/wire-projection-faces.d.ts +80 -2
- package/dist/trace/wire-projection-faces.js +23 -1
- package/dist/user-authored-text.d.ts +7 -0
- package/dist/user-authored-text.js +3 -0
- package/dist/web-admin-client/apply-effective.js +10 -5
- package/dist/web-admin-client/candidate-gate.d.ts +6 -6
- package/dist/web-admin-client/candidate-gate.js +3 -3
- package/dist/web-admin-client/http-client.js +0 -6
- package/dist/web-admin-client/read-warnings.d.ts +13 -0
- package/dist/web-admin-client/read-warnings.js +10 -0
- package/dist/web-admin-client/skills-mcp.d.ts +3 -0
- package/dist/web-admin-client/skills-mcp.js +9 -6
- package/dist/web-admin-client/types.d.ts +3 -4
- package/dist/workspace-cache.d.ts +35 -0
- package/dist/workspace-cache.js +36 -0
- package/dist/workspace-space.d.ts +3 -2
- package/dist/workspace-space.js +2 -0
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +8 -1
- package/package.json +4 -4
- package/scripts/drain-check-local.mjs +37 -3
- package/scripts/drain-check.mysql.sql +30 -2
- package/scripts/drain-check.pg.sql +29 -2
- package/dist/capabilities/memory-notice.d.ts +0 -138
- package/dist/capabilities/memory-notice.js +0 -64
- package/dist/capabilities/prompt.d.ts +0 -17
- package/dist/capabilities/prompt.js +0 -6
- package/dist/mcp-content-origin.d.ts +0 -34
- package/dist/mcp-content-origin.js +0 -10
- package/dist/tool-axis-words.d.ts +0 -27
- package/dist/tool-axis-words.js +0 -9
- package/dist/wire-name-bound.d.ts +0 -14
- package/dist/wire-name-bound.js +0 -13
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { TOOL_WIRE_NAME_MAX_CHARS } from "@sema-agent/settings-schema";
|
|
2
|
+
import { CONTROL_AND_BIDI_STRIP_RE } from "./text-bidi.js";
|
|
3
|
+
export const CALLER_TEXT_ECHO_MAX_CHARS = 64;
|
|
4
|
+
export function echoCallerText(text, opts) {
|
|
5
|
+
const max = opts?.maxChars ?? CALLER_TEXT_ECHO_MAX_CHARS;
|
|
6
|
+
if (!Number.isInteger(max) || max < 1)
|
|
7
|
+
throw new RangeError(`echoCallerText: maxChars must be a positive integer, got ${String(max)}`);
|
|
8
|
+
const clean = text.replace(CONTROL_AND_BIDI_STRIP_RE, "");
|
|
9
|
+
return clean.length > max ? `${clean.slice(0, max)}…` : clean;
|
|
10
|
+
}
|
|
11
|
+
export function quotedCallerText(text) {
|
|
12
|
+
return `"${echoCallerText(text)}"`;
|
|
13
|
+
}
|
|
14
|
+
export function describeBadWireName(v) {
|
|
15
|
+
if (typeof v !== "string")
|
|
16
|
+
return v === null ? "null" : Array.isArray(v) ? "array" : typeof v;
|
|
17
|
+
if (v.length === 0)
|
|
18
|
+
return "empty";
|
|
19
|
+
return `${quotedCallerText(v)} (${v.length} chars > ${TOOL_WIRE_NAME_MAX_CHARS})`;
|
|
20
|
+
}
|
|
21
|
+
export function describeBadContentOrigin(v) {
|
|
22
|
+
return typeof v === "string" ? quotedCallerText(v) : v === null ? "null" : Array.isArray(v) ? "array" : typeof v;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=caller-text-echo.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 品牌行(`SEMA_IDENTITY`)—— 品牌部署(local / TOC:`CONFIG_PROVIDER=local`、`run-local`)的 `default` / `code` 两场景,模型的 role 层以它开头。
|
|
3
|
+
*
|
|
4
|
+
* 律:品牌行是**部署类的一条 overlay**,不是每请求的分叉。部署座(`RunnerDeps.mods`)上一张 `prompt.compose` 注册,恒答同一条 overlay ——
|
|
5
|
+
* `add` 到 `role` 档(部署类的 add rank 99,排在目录的角色基底 `core/role.base` rank 100 之前),带 `when`:
|
|
6
|
+
* · `binding.anyOf: ["default", "code"]` —— 场景名由 `buildPromptSeats` 写进 `TaskSpec.promptBinding`(恒写);`code-review` / `scan` 与中心声明的场景
|
|
7
|
+
* 不在表里 ⇒ 不挂(它们与 `default` 同为 `general` 角色,`host.role` 分不开,只有 binding 分得开);
|
|
8
|
+
* · `facts.isSubagent: false` —— 委派子代(Agent 工具 / workflow 腿)经父 spec 座继承 binding,但它拿的是子代角色(引擎 sub-agent persona 或定义的
|
|
9
|
+
* systemPrompt),品牌行只属于与用户对话的那一腿(与 7.131.0 同:场景的提示从来不进子代)。
|
|
10
|
+
* 判它挂不挂的只有引擎一处(`whenHolds`,每一类 overlay 同一只);本服务不读 `e.selectors`,不写任何每请求的分支。
|
|
11
|
+
* 文本只在 `prompts/identity.ts` 一处(本模块不复述);「这台部署是不是品牌部署」只有一只判官 {@link isBrandedDeployment} —— HTTP 服务的三个读者
|
|
12
|
+
* (部署座的品牌行 `createDeploymentMods`、commit 尾注署名、场景详情读面的 `promptSummary`)同调它;本地 CLI(`run-local`)恒是品牌形,直接表态 `true`。
|
|
13
|
+
*/
|
|
14
|
+
import type { EngineDollar, ModRegistration, PromptOverlay } from "@sema-agent/core";
|
|
15
|
+
import type { ServiceConfig } from "../config-types.js";
|
|
16
|
+
/** 🔴 **品牌部署的唯一判官**:local 配置源(`CONFIG_PROVIDER=local`,TOC / Sema 产品线)⇒ 品牌部署。读者见本模块头注;再多一个读者也调它,不各写一遍。 */
|
|
17
|
+
export declare function isBrandedDeployment(config: Pick<ServiceConfig, "configProvider">): boolean;
|
|
18
|
+
/** 注册名(admission / 清单 / `superseded` 归因里的那个名字)。 */
|
|
19
|
+
export declare const BRAND_IDENTITY_REGISTRATION = "server.brand-identity";
|
|
20
|
+
/** 品牌行挂的场景(binding 表)。 */
|
|
21
|
+
export declare const BRAND_IDENTITY_SCENARIOS: readonly ["default", "code"];
|
|
22
|
+
/** 那一条 overlay(数据;注册恒答它)。 */
|
|
23
|
+
export declare const BRAND_IDENTITY_OVERLAY: PromptOverlay;
|
|
24
|
+
/** 品牌行的部署注册:`prompt.compose` 是收集型站点 —— 先 `await next(e)`,原样保留它交回的 overlays,再接上自己的一条。 */
|
|
25
|
+
export declare function createBrandIdentityRegistration(): ModRegistration<EngineDollar>;
|
|
26
|
+
//# sourceMappingURL=brand-identity.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SEMA_IDENTITY } from "./prompts/identity.js";
|
|
2
|
+
export function isBrandedDeployment(config) {
|
|
3
|
+
return config.configProvider === "local";
|
|
4
|
+
}
|
|
5
|
+
export const BRAND_IDENTITY_REGISTRATION = "server.brand-identity";
|
|
6
|
+
export const BRAND_IDENTITY_SCENARIOS = ["default", "code"];
|
|
7
|
+
export const BRAND_IDENTITY_OVERLAY = {
|
|
8
|
+
id: "sema/identity",
|
|
9
|
+
op: "add",
|
|
10
|
+
target: "role",
|
|
11
|
+
text: SEMA_IDENTITY,
|
|
12
|
+
when: { binding: { anyOf: [...BRAND_IDENTITY_SCENARIOS] }, facts: { isSubagent: false } },
|
|
13
|
+
};
|
|
14
|
+
export function createBrandIdentityRegistration() {
|
|
15
|
+
return {
|
|
16
|
+
name: BRAND_IDENTITY_REGISTRATION,
|
|
17
|
+
tier: "prepend",
|
|
18
|
+
uses: { events: ["prompt.compose"], calls: [] },
|
|
19
|
+
register(on) {
|
|
20
|
+
on("prompt.compose", async (_$, e, next) => {
|
|
21
|
+
const lower = (await next(e))?.overlays;
|
|
22
|
+
return { overlays: [...(Array.isArray(lower) ? lower : []), BRAND_IDENTITY_OVERLAY] };
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=brand-identity.js.map
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
|
+
import { NOW_TOOL_NAME } from "./host-tool-names.js";
|
|
2
3
|
export function nowTool() {
|
|
3
4
|
return {
|
|
4
|
-
name:
|
|
5
|
+
name: NOW_TOOL_NAME,
|
|
5
6
|
description: "Return the current date-time as an ISO-8601 UTC string. Use when the task involves dates/deadlines/'today'.",
|
|
6
7
|
effect: "read",
|
|
7
8
|
parameters: Type.Object({}),
|
|
@@ -196,7 +196,7 @@ export async function applyCenterPlugins(baseline, eff, opts) {
|
|
|
196
196
|
}
|
|
197
197
|
if (!rootCheck.dir)
|
|
198
198
|
continue;
|
|
199
|
-
const loaded = loadSkills(rootCheck.dir, { confineTo: liveDir });
|
|
199
|
+
const loaded = loadSkills(rootCheck.dir, { confineTo: liveDir, ...(opts.logger !== undefined ? { logger: opts.logger } : {}) });
|
|
200
200
|
for (const skill of loaded) {
|
|
201
201
|
if (taken.has(skill.spec.name)) {
|
|
202
202
|
out.letGo.push({ plugin: v.name, skill: skill.spec.name });
|
|
@@ -1,48 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* 中心提示层的采纳腿:判官(`prompts-domain-validate.ts` 的 `judgePromptsWire`,经候选判官)收下的那份 artifact → 引擎的中心源
|
|
3
|
+
* (`CenterPromptSource`,经 `RunnerDeps.promptSource` 由引擎采用)。
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* 仅有的一层「形校验」不是语义复检,是**防炸底线**(详见其现居所 `src/prompts-domain-validate.ts`——
|
|
12
|
-
* 判形半场已下沉到该中立叶子,本文件 re-export 保兼容;[ref] S6,lens2 §G):core 对坏形声明的
|
|
13
|
-
* 守卫是 THROW(assemble 期),server 在采用前做结构判形,坏形=拒绝采用该候选的 prompts 面。
|
|
14
|
-
*
|
|
15
|
-
* 生效语义(两段史):1.222 时 core 1.315 的 epoch 是 bundled-only(声明不进 descriptor),热换=resume
|
|
16
|
-
* 三失真,故临时 restart-to-apply;core 1.316([ref] 裁 a/[ref]d)把声明以 (id,slot,chars,contentHash?)
|
|
17
|
-
* 纳入 artifactDigest——声明变=digest 变=**下任务边界自动重 pin**(既有 legacy_migration 机制接手),
|
|
18
|
-
* 进行中会话 epoch pin 保稳。自此恢复**热采用**(main.ts boot+refresh 双点 adopt),与 center
|
|
19
|
-
* 「发布=新任务生效」产品语义对齐([ref]②b)。字节级检测只认 opt-in contentHash(文本不进 digest,
|
|
20
|
-
* 防会话可导出面字典预映)——center 链路恒逐 section 铸([ref]),本投影逐字透传即全强度。
|
|
5
|
+
* 律:中心层只有一种形(引擎当期 schema 的发布形 artifact),只有一个座(`RunnerDeps.promptSource`)。本服务不展开、不选包、不按场景挑段:
|
|
6
|
+
* 「哪个场景用哪段」在 artifact 的 `when.binding` 里,由引擎按每个请求的 `TaskSpec.promptBinding`(场景名,`buildPromptSeats` 一处写)判。
|
|
7
|
+
* 本模块只管三件事:① 把判官交出的值推进中心源的两态过渡({@link applyCenterArtifact});② 按 digest 补拉一份本副本没有的 artifact
|
|
8
|
+
* ({@link withPromptArtifactBackfill},钉着它的会话续跑时用);③ 中心源自己的运维句(启动恢复读到一份引擎拒的 / 读不出的副本)
|
|
9
|
+
* 落进本服务的日志({@link centerSourceOnError})。
|
|
21
10
|
*/
|
|
22
|
-
import { type
|
|
23
|
-
|
|
24
|
-
/** 判形半场(validateCenterPrompts/validatePromptsDomain/CORE_ENGINE_VERSION 及两 interface)已下沉到
|
|
25
|
-
* 中立叶子 `src/prompts-domain-validate.ts`([ref] S6);消费者直引真源([ref] 兼容面全清,
|
|
26
|
-
* 此处兼容 re-export 已删)。 */
|
|
27
|
-
/** [ref]b / [ref] — §9.4 by-digest 补拉组合店:local miss ⇒ fetchRaw(digest) 从 center 拉 envelope ⇒
|
|
28
|
-
* core verifyPromptArtifact 全管线 + **回验「拿到的=要的」digest 逐位**(center 答非所问=丢弃)⇒
|
|
29
|
-
* best-effort 回写 inner(下次直命中)。任何失败=undefined(诚实缺席,fail-loud 归 core 的
|
|
30
|
-
* prompt_snapshot_unavailable——绝不拼杂交)。 */
|
|
31
|
-
export declare function withPromptArtifactBackfill(inner: {
|
|
32
|
-
get(d: string, o: {
|
|
33
|
-
engineVersion: string;
|
|
34
|
-
}): Promise<PublishedPromptArtifactEnvelope | undefined>;
|
|
35
|
-
put(e: PublishedPromptArtifactEnvelope): Promise<void>;
|
|
36
|
-
}, fetchRaw: (artifactDigest: string) => Promise<unknown>, log: {
|
|
11
|
+
import { type PromptArtifactStore, type PublishedPromptArtifact, type RunnerDeps } from "@sema-agent/core";
|
|
12
|
+
type Log = {
|
|
37
13
|
info: (msg: string, meta?: Record<string, unknown>) => void;
|
|
38
14
|
warn: (msg: string, meta?: Record<string, unknown>) => void;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
export
|
|
15
|
+
};
|
|
16
|
+
/** §9.4 按 digest 补拉的组合店:本地 miss ⇒ `fetchRaw(digest)` 从中心拉 ⇒ 引擎 `verifyPromptArtifact` 全管线 + **回验「拿到的 = 要的」digest 逐位**
|
|
17
|
+
* (中心答非所问 = 丢弃)⇒ best-effort 回写本地店(下次直命中)。任何失败 = undefined(诚实缺席;响亮归引擎的 `prompt.snapshot_unavailable` —— 绝不拼杂交)。
|
|
18
|
+
* 本地店的 `onRefused`(一份副本在、却用不了:引擎拒 / 读不出)原样交给本地店报,不吞:那是「为什么缺」的那一句。 */
|
|
19
|
+
export declare function withPromptArtifactBackfill(inner: PromptArtifactStore, fetchRaw: (artifactDigest: string) => Promise<unknown>, log: Log): PromptArtifactStore;
|
|
20
|
+
/** 中心源的推进面(引擎 `CenterPromptSource` 的两只写口 + 两只「欠不欠撤下」的读口)。 */
|
|
21
|
+
export interface CenterSourceTransitions {
|
|
46
22
|
applySnapshot(raw: unknown): Promise<{
|
|
47
23
|
ok: true;
|
|
48
24
|
artifactDigest: string;
|
|
@@ -52,27 +28,24 @@ export declare function applyCatalogToSource(source: {
|
|
|
52
28
|
reason: string;
|
|
53
29
|
}>;
|
|
54
30
|
applyDisabled(sourceRevision: string): Promise<void>;
|
|
55
|
-
/** codex-2 F2(restart-owed disable):撤下写盘失败后重启,内存 prev 丢了但持久态还 active——
|
|
56
|
-
* 以 source 自身的 live candidate 为准判「欠 disable」,不是只看内存 prev。 */
|
|
31
|
+
/** codex-2 F2(restart-owed disable):撤下写盘失败后重启,内存 prev 丢了但持久态还 active —— 以中心源自身的活候选为准判「欠撤下」,不是只看内存 prev。 */
|
|
57
32
|
current?(): unknown;
|
|
58
|
-
/** S-651(codex 修复验证轮 V1):本箱**持久记录**是 active —— 即使那份 artifact 此刻加载不出(活候选为空)
|
|
59
|
-
*
|
|
33
|
+
/** S-651(codex 修复验证轮 V1):本箱**持久记录**是 active —— 即使那份 artifact 此刻加载不出(活候选为空)。「欠撤下」的真源是持久记录;
|
|
34
|
+
* 活候选只是它能加载时的影子。缺席 = 调用方不掌握持久记录(沿用前两条判据)。 */
|
|
60
35
|
persistedActive?(): boolean;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* 判官交出的值推进中心源的两态过渡:`next` 在场(且 digest 变)⇒ `applySnapshot`(引擎重验 + 落盘 + 原子换候选);`next` 缺席
|
|
39
|
+
* (候选不带 prompts 键 = 闸关 / 没发布)而中心层此前在(内存 prev / 活候选 / 持久 active 任一)⇒ `applyDisabled`(显式撤下,离线重启不复活)。
|
|
40
|
+
* 去重键是 artifact 的内容身份(digest;发布出处 `sourceRevision` 不进身份)。返回过渡是否落地 —— false ⇒ 调用方**不推进**已采纳的值,
|
|
41
|
+
* 下一拍同一过渡自动重试(codex-2 F2:吞错推进曾让失败的采纳 / 撤下永久静默)。
|
|
42
|
+
*/
|
|
43
|
+
export declare function applyCenterArtifact(source: CenterSourceTransitions, next: PublishedPromptArtifact | undefined, prev: PublishedPromptArtifact | undefined, log: Log, phase: string): Promise<boolean>;
|
|
65
44
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* (
|
|
45
|
+
* 中心源自己的运维句(`CenterPromptSource` 的 `onError` 选项,引擎的 `RunnerDeps.onError` 形)落进本服务的日志:启动恢复读到持久记录指着的那份 artifact
|
|
46
|
+
* 被引擎拒(退役 schema 的拒句点名重发写法)/ 读不出 / 根本没有副本 —— 中心源无状态起服并说一句。行名与 Runner 的 `prompt-constitution` 阶段同一个
|
|
47
|
+
* (`prompt_composition_warning`):那一阶段的句子都在说「交给组装的东西没有照写的那样生效」。不传 = 这几句静默(引擎的缺省),所以每个起中心源的入口都传它。
|
|
69
48
|
*/
|
|
70
|
-
export declare function
|
|
71
|
-
|
|
72
|
-
* M9 迁移卫在 provider.stableBlocks 的 identity 声明上探同三锚,命中即走 pass-through 臂(其保留集无
|
|
73
|
-
* `core/role.append`,任何 append rider/outputStyle 会被静默丢)。选包与 {@link centerPromptProvider}
|
|
74
|
-
* 同式(`overrides[s] ?? sections`);锚谓词由调用方注入(task-settings `hasConstitutionAnchors` 单真源)。
|
|
75
|
-
* [ref]①f 的「server 不做语义复检」不动:这不是复检语义,是为 capabilities.appendSystemPrompt 的诚实面
|
|
76
|
-
* 探 core 会走哪条臂。 */
|
|
77
|
-
export declare function centerIdentityAssembled(prompts: EffectiveCenterPrompts, scenarioName: string, isAssembled: (text: unknown) => boolean): boolean;
|
|
49
|
+
export declare function centerSourceOnError(log: Pick<Log, "warn">): NonNullable<RunnerDeps["onError"]>;
|
|
50
|
+
export {};
|
|
78
51
|
//# sourceMappingURL=center-prompts.d.ts.map
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { verifyPromptArtifact } from "@sema-agent/core";
|
|
2
|
-
import { CORE_ENGINE_VERSION } from "../prompts-domain-validate.js";
|
|
3
2
|
import { SHA256_HEX_RE } from "../digest-form.js";
|
|
4
3
|
import { recordFailOpen } from "../observability/fail-open.js";
|
|
5
4
|
export function withPromptArtifactBackfill(inner, fetchRaw, log) {
|
|
6
5
|
const inFlight = new Map();
|
|
7
6
|
return {
|
|
8
|
-
put: (
|
|
9
|
-
get: async (digest,
|
|
7
|
+
put: (artifact) => inner.put(artifact),
|
|
8
|
+
get: async (digest, onRefused) => {
|
|
10
9
|
const hex = digest.replace(/^sha256:/i, "").toLowerCase();
|
|
11
10
|
if (!SHA256_HEX_RE.test(hex))
|
|
12
11
|
return undefined;
|
|
13
12
|
const canonical = `sha256:${hex}`;
|
|
14
|
-
const local = await inner.get(canonical,
|
|
13
|
+
const local = await inner.get(canonical, onRefused);
|
|
15
14
|
if (local)
|
|
16
15
|
return local;
|
|
17
16
|
const pending = inFlight.get(canonical);
|
|
@@ -20,14 +19,14 @@ export function withPromptArtifactBackfill(inner, fetchRaw, log) {
|
|
|
20
19
|
const run = (async () => {
|
|
21
20
|
try {
|
|
22
21
|
const raw = await fetchRaw(canonical);
|
|
23
|
-
const v = verifyPromptArtifact(raw
|
|
22
|
+
const v = verifyPromptArtifact(raw);
|
|
24
23
|
if (!v.ok || v.artifact.artifactDigest.replace(/^sha256:/, "").toLowerCase() !== hex) {
|
|
25
24
|
log.warn("center_prompts_backfill_rejected", { digest: canonical, ...(v.ok ? { got: v.artifact.artifactDigest, code: "digest_mismatch" } : { code: v.code, reason: v.reason }) });
|
|
26
25
|
return undefined;
|
|
27
26
|
}
|
|
28
|
-
await inner.put(
|
|
27
|
+
await inner.put(v.artifact).catch(() => recordFailOpen("server.prompts.artifact-cache-write-failed", `digest=${canonical}`));
|
|
29
28
|
log.info("center_prompts_backfilled", { digest: canonical });
|
|
30
|
-
return
|
|
29
|
+
return v.artifact;
|
|
31
30
|
}
|
|
32
31
|
catch (e) {
|
|
33
32
|
log.warn("center_prompts_backfill_failed", { digest: canonical, err: String(e) });
|
|
@@ -42,22 +41,22 @@ export function withPromptArtifactBackfill(inner, fetchRaw, log) {
|
|
|
42
41
|
},
|
|
43
42
|
};
|
|
44
43
|
}
|
|
45
|
-
export async function
|
|
44
|
+
export async function applyCenterArtifact(source, next, prev, log, phase) {
|
|
46
45
|
try {
|
|
47
|
-
if (next
|
|
48
|
-
if (prev?.
|
|
46
|
+
if (next !== undefined) {
|
|
47
|
+
if (prev?.artifactDigest === next.artifactDigest)
|
|
49
48
|
return true;
|
|
50
|
-
const r = await source.applySnapshot(next
|
|
49
|
+
const r = await source.applySnapshot(next);
|
|
51
50
|
if (r.ok) {
|
|
52
51
|
log.info("center_prompts_catalog_applied", { phase, artifactDigest: r.artifactDigest });
|
|
53
52
|
return true;
|
|
54
53
|
}
|
|
55
|
-
log.warn("center_prompts_catalog_apply_failed", { phase, code: r.code, reason: r.reason, note: "
|
|
54
|
+
log.warn("center_prompts_catalog_apply_failed", { phase, code: r.code, reason: r.reason, note: "the candidate passed the judge but the source apply failed (disk/state) — built-ins unaffected; candidate unchanged; the transition retries on the next refresh tick" });
|
|
56
55
|
return false;
|
|
57
56
|
}
|
|
58
|
-
if (prev
|
|
59
|
-
await source.applyDisabled(`${phase}:
|
|
60
|
-
log.info("center_prompts_catalog_disabled", { phase, note: "
|
|
57
|
+
if (prev !== undefined || source.current?.() !== undefined || source.persistedActive?.() === true) {
|
|
58
|
+
await source.applyDisabled(`${phase}:prompts-absent`);
|
|
59
|
+
log.info("center_prompts_catalog_disabled", { phase, note: "center layer withdrawn — the engine's candidate is cleared (does not revive offline)" });
|
|
61
60
|
}
|
|
62
61
|
return true;
|
|
63
62
|
}
|
|
@@ -66,22 +65,9 @@ export async function applyCatalogToSource(source, next, prev, log, phase) {
|
|
|
66
65
|
return false;
|
|
67
66
|
}
|
|
68
67
|
}
|
|
69
|
-
export function
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
export function centerIdentityAssembled(prompts, scenarioName, isAssembled) {
|
|
74
|
-
return scenarioDecls(prompts, scenarioName).some((d) => d.slot === "identity" && isAssembled(d.text));
|
|
75
|
-
}
|
|
76
|
-
function scenarioDecls(prompts, scenarioName) {
|
|
77
|
-
const overrides = prompts.scenarioOverrides;
|
|
78
|
-
if (overrides) {
|
|
79
|
-
if (Object.hasOwn(overrides, scenarioName)) {
|
|
80
|
-
const hit = overrides[scenarioName];
|
|
81
|
-
if (hit)
|
|
82
|
-
return hit;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return prompts.sections;
|
|
68
|
+
export function centerSourceOnError(log) {
|
|
69
|
+
return (err, ctx) => {
|
|
70
|
+
log.warn("prompt_composition_warning", { sessionId: ctx.sessionId, ...(ctx.classification !== undefined ? { classification: ctx.classification } : {}), info: err instanceof Error ? err.message : String(err) });
|
|
71
|
+
};
|
|
86
72
|
}
|
|
87
73
|
//# sourceMappingURL=center-prompts.js.map
|
|
@@ -54,6 +54,7 @@ export declare const COMPOSITE_CAPABILITY_MEMBERS: {
|
|
|
54
54
|
readonly workflowsGate: readonly ["engineCan", "denial"];
|
|
55
55
|
readonly sealedKey: readonly ["alg", "publicKeyId", "publicKey"];
|
|
56
56
|
readonly workspaceSync: readonly ["persist", "keep", "timeoutMs", "cache"];
|
|
57
|
+
readonly userAttachments: readonly ["entries", "kinds", "supplies", "limits"];
|
|
57
58
|
};
|
|
58
59
|
type CompositeTable = typeof COMPOSITE_CAPABILITY_MEMBERS;
|
|
59
60
|
/** 值的**具名成员对象臂**(标量 / 字面词 / `false` / `null` / `undefined` / 数组 / 函数臂剥掉)。 */
|
|
@@ -15,6 +15,7 @@ export const COMPOSITE_CAPABILITY_MEMBERS = {
|
|
|
15
15
|
workflowsGate: ["engineCan", "denial"],
|
|
16
16
|
sealedKey: ["alg", "publicKeyId", "publicKey"],
|
|
17
17
|
workspaceSync: ["persist", "keep", "timeoutMs", "cache"],
|
|
18
|
+
userAttachments: ["entries", "kinds", "supplies", "limits"],
|
|
18
19
|
};
|
|
19
20
|
export function gateCompositeMembers(body) {
|
|
20
21
|
return body;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ENGINE_CAPABILITIES } from "@sema-agent/core";
|
|
2
|
-
import { ownCredentialsWithheld } from "../server-secret-env.js";
|
|
2
|
+
import { ownCredentialsWithheld, ownCredentialValuesWithheld } from "../server-secret-env.js";
|
|
3
3
|
const ENGINE_CAPABILITY_FACTS = {
|
|
4
4
|
"inherit_env.own_credentials_withheld": ownCredentialsWithheld,
|
|
5
|
+
"inherit_env.own_credential_values_withheld": ownCredentialValuesWithheld,
|
|
5
6
|
};
|
|
6
7
|
export function engineCapabilityBits() {
|
|
7
8
|
const out = {};
|
|
@@ -19,17 +19,20 @@ import { type Runner, type TaskSpec, type ToolPolicy } from "@sema-agent/core";
|
|
|
19
19
|
/** 场景对手带工具面的表态(闭集)。`full` = core 手带 band 照常 mount;`none` = 不挂 executionEnvFactory 的 Runner。 */
|
|
20
20
|
export type ScenarioHands = "full" | "none";
|
|
21
21
|
/**
|
|
22
|
-
* 无手孪生 Runner 的 deps 构造:把 `executionEnvFactory`
|
|
22
|
+
* 无手孪生 Runner 的 deps 构造:把 `executionEnvFactory` **摘键**(不是置 undefined)。
|
|
23
23
|
* 摘键让「这只 Runner 没有手」在 deps 字面量上自证;置 undefined 留下一个值为 undefined 的键,
|
|
24
24
|
* 与 core 现在的 `deps.executionEnvFactory ||` 判读结果相同,但把正确性寄托在真值判断上。
|
|
25
|
-
*
|
|
26
|
-
*
|
|
25
|
+
*
|
|
26
|
+
* **LSP 的 manager 座照传,不摘**:挂不挂 LSP 由引擎一处决定 —— core 7.49.2 起 LSP 只在「有手腿 ∧ 接了 manager 座」的腿上挂,无手腿
|
|
27
|
+
* (`hands=none` 的场景、委派子代、后台代理)天然没有。本仓此前在这里再摘一次 `lspManager`(宿主车道的 `NodeLspManager` 经
|
|
28
|
+
* `defaultLspReadText` 直读本地盘、没有读面围栏,当年引擎还会在 StubExecutionEnv 上挂它),是同一件事的第二只写者:引擎一旦决定
|
|
29
|
+
* 它自己的读法,两处只会各改各的。引擎的读数钉在 `test/scenario-hands-lane.test.ts` 的 S-1502 段(同一份含 manager 座的 deps,有手腿 roster 有
|
|
30
|
+
* `LSP`、无手孪生没有)。
|
|
27
31
|
*/
|
|
28
32
|
export declare function withoutHands<T extends {
|
|
29
33
|
executionEnvFactory?: unknown;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
/** 一对 Runner:同 deps,唯一差别是 `handsless` 不挂 `executionEnvFactory` 与 `lspManager`。 */
|
|
34
|
+
}>(deps: T): Omit<T, "executionEnvFactory">;
|
|
35
|
+
/** 一对 Runner:同 deps,唯一差别是 `handsless` 不挂 `executionEnvFactory`。 */
|
|
33
36
|
export interface HandsRunnerPair {
|
|
34
37
|
full: Runner;
|
|
35
38
|
handsless: Runner;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { handBandEffects, judgeRuleToolName, combinePolicies, createAllowDenyPolicy } from "@sema-agent/core";
|
|
2
|
-
import {
|
|
2
|
+
import { TOOL_NAME_ROSTER } from "../namespaced-rule-name.js";
|
|
3
3
|
export function withoutHands(deps) {
|
|
4
|
-
const { executionEnvFactory: _handsDropped,
|
|
4
|
+
const { executionEnvFactory: _handsDropped, ...rest } = deps;
|
|
5
5
|
return rest;
|
|
6
6
|
}
|
|
7
7
|
export function pickHandsRunner(hands, pair) {
|
|
@@ -20,7 +20,7 @@ export const HANDS_BAND_TOOL_NAMES = Object.freeze([
|
|
|
20
20
|
"EnterWorktree",
|
|
21
21
|
"ExitWorktree",
|
|
22
22
|
"ListAgents",
|
|
23
|
-
].filter((n, i, all) => judgeRuleToolName(n,
|
|
23
|
+
].filter((n, i, all) => judgeRuleToolName(n, TOOL_NAME_ROSTER).kind === "current" && all.indexOf(n) === i));
|
|
24
24
|
export const HANDS_DUAL_USE_TOOL_NAMES = Object.freeze(["TaskOutput", "TaskStop", "SendMessage", "AgentTranscript", "ListAgents"]);
|
|
25
25
|
export const HANDS_EXCLUSIVE_TOOL_NAMES = Object.freeze(HANDS_BAND_TOOL_NAMES.filter((n) => !HANDS_DUAL_USE_TOOL_NAMES.includes(n)));
|
|
26
26
|
export function handsDenyPolicy() {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **本仓自己铸给模型的工具的名字** —— 唯一的名字源(叶模块,零依赖)。铸它们的地方(`builtin-tools.ts` / `send-user-file-tool.ts` / `select-environment-tool.ts` / `repo-tools.ts`)
|
|
3
|
+
* 与读它们的地方(工具名清单的受理判:`rule-entry-list.ts` 的名册;场景详情的工具名单;长尾延迟披露集)都从这里取,不手抄。
|
|
4
|
+
*
|
|
5
|
+
* 为什么受理口要知道它们:请求的 `allowTools` / `excludeTools` / 子代的 `allowTools` / `denyTools` 里把 `SendUserFile` 写成 `SENDUSERFILE`,引擎只在开跑时按这一 run 真挂着的名册告运维;
|
|
6
|
+
* 受理口读不到那份名册,读得到的是「引擎目录 ∪ 本仓自铸的这几只」—— 不把这几只放进名册,它们的孪生就是受理口漏掉的同一类静默失效。
|
|
7
|
+
* 宿主之外的调用方工具、MCP / A2A 对端的工具不在其中(前者本仓不挂,后者是协议名,由协议段判)。
|
|
8
|
+
*/
|
|
9
|
+
export declare const NOW_TOOL_NAME = "Now";
|
|
10
|
+
export declare const SEND_USER_FILE_TOOL_NAME = "SendUserFile";
|
|
11
|
+
export declare const SELECT_ENVIRONMENT_TOOL_NAME = "SelectEnvironment";
|
|
12
|
+
export declare const REPO_TREE_TOOL_NAME = "repo_tree";
|
|
13
|
+
export declare const REPO_READ_FILE_TOOL_NAME = "repo_read_file";
|
|
14
|
+
export declare const REPO_PULL_DIFF_TOOL_NAME = "repo_pull_diff";
|
|
15
|
+
/** 本仓自铸的全部工具名(受理口工具名清单的名册成员;加一只自铸工具 ⇒ 这里加一行)。 */
|
|
16
|
+
export declare const HOST_TOOL_NAMES: ReadonlySet<string>;
|
|
17
|
+
//# sourceMappingURL=host-tool-names.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const NOW_TOOL_NAME = "Now";
|
|
2
|
+
export const SEND_USER_FILE_TOOL_NAME = "SendUserFile";
|
|
3
|
+
export const SELECT_ENVIRONMENT_TOOL_NAME = "SelectEnvironment";
|
|
4
|
+
export const REPO_TREE_TOOL_NAME = "repo_tree";
|
|
5
|
+
export const REPO_READ_FILE_TOOL_NAME = "repo_read_file";
|
|
6
|
+
export const REPO_PULL_DIFF_TOOL_NAME = "repo_pull_diff";
|
|
7
|
+
export const HOST_TOOL_NAMES = new Set([
|
|
8
|
+
NOW_TOOL_NAME,
|
|
9
|
+
SEND_USER_FILE_TOOL_NAME,
|
|
10
|
+
SELECT_ENVIRONMENT_TOOL_NAME,
|
|
11
|
+
REPO_TREE_TOOL_NAME,
|
|
12
|
+
REPO_READ_FILE_TOOL_NAME,
|
|
13
|
+
REPO_PULL_DIFF_TOOL_NAME,
|
|
14
|
+
]);
|
|
15
|
+
//# sourceMappingURL=host-tool-names.js.map
|
|
@@ -108,7 +108,7 @@ export declare function buildMcpProbeWalkTimeoutMs(declarations: number): number
|
|
|
108
108
|
* 一次走查里**同时追裁决**的台数,喂 core 的 `opts.concurrency`。
|
|
109
109
|
*
|
|
110
110
|
* 为什么不用缺省的 1:core 的 d.ts 明写整次调用的时长 = 每台时长在 `ceil(n / concurrency)` 轮上的和。
|
|
111
|
-
* 缺省 1 下一个 32 台(=
|
|
111
|
+
* 缺省 1 下一个 32 台(= `task-mcp.ts` 的 `MAX_REQUEST_MCP_SERVERS`)的申报最坏是 32 × {@link MCP_PROBE_VERDICT_TIMEOUT_MS}
|
|
112
112
|
* —— 一条 HTTP 请求挂五分钟。8 把最坏收进 4 轮。代价 core 也写明了:并发只影响 `connectMs` 这个读数的
|
|
113
113
|
* 争用度,**行与下标对齐不受影响**(而本面根本不发 `connectMs`)。
|
|
114
114
|
* ⚠️ 它**不是**「同时开几条传输」的帽:被时钟放弃的拨号仍在飞,最坏可达一条/台申报(core 原话)。
|
|
@@ -159,6 +159,19 @@ export interface McpProbeRefusal {
|
|
|
159
159
|
/**
|
|
160
160
|
* `POST …/probe` 的体读器:闭形、逐条点名、零静默丢。成功 ⇒ 交给 core 的 `specs`(**原样**转发被读出来的
|
|
161
161
|
* 条目,`McpServerSpec` 的可选键一个都不重写 —— 重写就是在 core 的型上做第二次投影)。
|
|
162
|
+
*
|
|
163
|
+
* ## 申报「能不能原样用」:问提交腿 fresh 门**同一只**回答者,不另判
|
|
164
|
+
* 本面只判自己那一层(体是对象、顶层只受理 `mcpServers`、这个键必填);`mcpServers` 本身 —— 列表的形、上限、每条的键名与键值 —— 全部交给
|
|
165
|
+
* `task-mcp.ts` 的 `requestMcpDeclarationRefusal`,拒(码 + 句 + `unknownKeys`)原样转述:同一份申报在两扇门上只有一个答案,零拨号之前就给。
|
|
166
|
+
* 回答者受理的申报由**同一只**读器(`validateRequestMcp`)交回,读器的产物就是申报本身(只差判官自己的合法归一),经 `toCoreMcpServerSpec`
|
|
167
|
+
* 得到的就是一条任务提交会交给引擎的那一份 —— 本面拨的正是它。读器只在回答者受理之后才跑,所以它对重放存量 body 才有的降级留痕
|
|
168
|
+
* (`source` 写坏的 F 类丢弃)不会在一次被拒的探测上虚记。
|
|
169
|
+
*
|
|
170
|
+
* ## 唯一一处按门分的后果:声明了 `assertionHeader`(引擎尚无断言头座)
|
|
171
|
+
* 事实只有一个、读它的谓词只有一只(`declaresMcpAssertionHeader`):这台 server 声明的断言头本版**承载、不发送**,交给引擎的规格里没有它。
|
|
172
|
+
* 新提交照挂并给运维一行 info(`mcp_assertion_header_not_sent`;settings 面同读法);本面**整条拒** —— 拨出去的不是申报的那一份,一台握手放行、
|
|
173
|
+
* 调用才要断言的对端会被答成 connected,而它的调用会被拒。判据同一只、后果按门分(与重放腿对同一组身份头「降级到升级前读法」同一个姿势);
|
|
174
|
+
* 引擎长出同名座的那天,`toCoreMcpServerSpec` 的剥键与这一拒一起退役(`mcp-assertion-header.ts` 的退役门编译红)。
|
|
162
175
|
*/
|
|
163
176
|
export declare function readMcpProbeBody(raw: unknown): {
|
|
164
177
|
ok: true;
|