@sema-agent/core 7.41.2 → 7.42.1
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/CHANGELOG.md +82 -0
- package/dist/agents/subagent.js +2 -0
- package/dist/core/agent-definition.d.ts +1 -1
- package/dist/core/allow-entry.d.ts +241 -0
- package/dist/core/allow-entry.js +340 -0
- package/dist/core/allow-rule-shadow.d.ts +18 -0
- package/dist/core/allow-rule-shadow.js +1 -0
- package/dist/core/ask-origin.d.ts +5 -5
- package/dist/core/ask-origin.js +1 -1
- package/dist/core/auto-mode.d.ts +3 -2
- package/dist/core/checkpoint-store.d.ts +11 -19
- package/dist/core/checkpoint-store.js +1 -1
- package/dist/core/decision-receipt.d.ts +4 -2
- package/dist/core/decision-receipt.js +1 -1
- package/dist/core/engine-notice.d.ts +8 -5
- package/dist/core/gate-fold.js +1 -1
- package/dist/core/gate-lanes.d.ts +1 -49
- package/dist/core/gate-lanes.js +85 -223
- package/dist/core/governance-codes.d.ts +3 -3
- package/dist/core/governance-codes.js +3 -3
- package/dist/core/hooks.d.ts +13 -10
- package/dist/core/hooks.js +5 -3
- package/dist/core/mode-policy.d.ts +3 -3
- package/dist/core/mode-policy.js +2 -2
- package/dist/core/permission-rules.d.ts +24 -23
- package/dist/core/permission-rules.js +37 -33
- package/dist/core/reminder-disclosure.d.ts +53 -2
- package/dist/core/reminder-disclosure.js +49 -36
- package/dist/core/rule-lane-reads.d.ts +84 -0
- package/dist/core/rule-lane-reads.js +164 -0
- package/dist/core/runner/contracts.d.ts +4 -2
- package/dist/core/runner/gate-exit.d.ts +3 -3
- package/dist/core/runner/image.js +4 -3
- package/dist/core/runner/inline-image.d.ts +14 -0
- package/dist/core/runner/inline-image.js +26 -0
- package/dist/core/runner/permission-rule-lanes.d.ts +3 -1
- package/dist/core/runner/permission-rule-lanes.js +1 -1
- package/dist/core/runner/prepare-ask-lane.d.ts +0 -19
- package/dist/core/runner/prepare-ask-lane.js +2 -2
- package/dist/core/runner/prepare-inherited-gate.d.ts +2 -0
- package/dist/core/runner/prepare-inherited-gate.js +1 -0
- package/dist/core/runner/prepare-park-ask.js +3 -3
- package/dist/core/runner/prepare-policy-chain.d.ts +12 -0
- package/dist/core/runner/prepare-policy-chain.js +10 -9
- package/dist/core/runner/prepare-project-context.d.ts +13 -3
- package/dist/core/runner/prepare-project-context.js +5 -4
- package/dist/core/runner/prepare-task.js +8 -5
- package/dist/core/runner/prepare-turn-wiring.d.ts +16 -3
- package/dist/core/runner/prepare-turn-wiring.js +19 -18
- package/dist/core/runner/run-leg.js +1 -1
- package/dist/core/runner/runtask.js +2 -1
- package/dist/core/runner-deps.d.ts +11 -0
- package/dist/core/skill-grant.d.ts +8 -47
- package/dist/core/skill-grant.js +15 -136
- package/dist/core/synthetic-read-verdict.d.ts +108 -0
- package/dist/core/synthetic-read-verdict.js +111 -0
- package/dist/core/task-spec.d.ts +18 -0
- package/dist/core/tool-name-readings.d.ts +1 -1
- package/dist/core/tool-name-readings.js +1 -1
- package/dist/core/tool-policy.d.ts +25 -24
- package/dist/core/tool-policy.js +26 -17
- package/dist/core/tool-spec.d.ts +7 -0
- package/dist/core/trace.d.ts +16 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +3 -1
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/tools/fs/dir-entries.d.ts +69 -0
- package/dist/tools/fs/dir-entries.js +60 -0
- package/dist/tools/fs/fs-pdf.d.ts +7 -11
- package/dist/tools/fs/fs-pdf.js +5 -14
- package/dist/tools/fs/fs-read.d.ts +173 -2
- package/dist/tools/fs/fs-read.js +399 -286
- package/dist/tools/fs/image-admission.d.ts +51 -0
- package/dist/tools/fs/image-admission.js +36 -0
- package/dist/tools/fs/search.js +3 -7
- package/package.json +1 -1
- package/test/export-surface.snapshot.json +23 -5
- package/wire-changes/core@7.42.0.json +1107 -0
- package/wire-changes/{core@7.41.2.json → core@7.42.1.json} +7 -5
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ONE admission an image's bytes pass before they reach the model as an `ImageContent` block —
|
|
3
|
+
* whether a file supplied them (the Read tool's image lane) or a caller did (`TaskSpec.images`' inline
|
|
4
|
+
* arm). Four steps, in this order:
|
|
5
|
+
*
|
|
6
|
+
* ① the claimed type is one the content API accepts (png / jpeg / gif / webp — the four
|
|
7
|
+
* {@link imageMagicMatches} can verify);
|
|
8
|
+
* ② the raw bytes are within the read cap (5 MiB without a downsampler, 64 MiB with one);
|
|
9
|
+
* ③ the bytes carry the claimed type's signature — an empty / text / mis-named "png" would
|
|
10
|
+
* otherwise become a malformed block that 400s the NEXT whole provider request;
|
|
11
|
+
* ④ optional downsample (when a downsampler is supplied; a processing failure keeps the original
|
|
12
|
+
* bytes, CC's catch → createImageResponse(original)), then the provider's hard limit, which is on the
|
|
13
|
+
* BASE64 length, not raw bytes.
|
|
14
|
+
*
|
|
15
|
+
* The answer is structured; each carrier words its own refusal (the Read tool speaks to the model, the
|
|
16
|
+
* task door to the caller). The block it admits is built from the bytes it checked — never from a
|
|
17
|
+
* caller's string it did not decode.
|
|
18
|
+
*/
|
|
19
|
+
import type { ImageContent } from "../../internal/llm.js";
|
|
20
|
+
import { type ImageDimensions, type ImageDownsampler } from "../../core/mcp.js";
|
|
21
|
+
/** The image types the content API accepts — the only ones a signature check can verify. */
|
|
22
|
+
export declare const ADMITTED_IMAGE_MIME_TYPES: readonly ["image/png", "image/jpeg", "image/gif", "image/webp"];
|
|
23
|
+
/** The raw-byte read cap for an image, with or without a downsampler. */
|
|
24
|
+
export declare function imageReadCap(downsampler: ImageDownsampler | undefined): number;
|
|
25
|
+
export type ImageAdmission = {
|
|
26
|
+
ok: true;
|
|
27
|
+
block: ImageContent;
|
|
28
|
+
/** The raw byte count of the bytes checked (before any downsample). */
|
|
29
|
+
originalSize: number;
|
|
30
|
+
/** Measured by the downsampler; absent without one (never fabricated). */
|
|
31
|
+
dimensions?: ImageDimensions;
|
|
32
|
+
/** True when the downsampler actually changed the pixel size. */
|
|
33
|
+
resized: boolean;
|
|
34
|
+
} | {
|
|
35
|
+
ok: false;
|
|
36
|
+
reason: "mime_unsupported" | "magic_mismatch";
|
|
37
|
+
rawBytes: number;
|
|
38
|
+
} | {
|
|
39
|
+
ok: false;
|
|
40
|
+
reason: "raw_too_large";
|
|
41
|
+
rawBytes: number;
|
|
42
|
+
cap: number;
|
|
43
|
+
}
|
|
44
|
+
/** `base64` is the encoding that failed the limit (the caller words the refusal from its length). */
|
|
45
|
+
| {
|
|
46
|
+
ok: false;
|
|
47
|
+
reason: "base64_too_large";
|
|
48
|
+
rawBytes: number;
|
|
49
|
+
base64: string;
|
|
50
|
+
};
|
|
51
|
+
export declare function admitImageBytes(bytes: Uint8Array, claimedMime: string, downsampler: ImageDownsampler | undefined): Promise<ImageAdmission>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { MCP_IMAGE_MAX_BASE64 } from "../../core/mcp.js";
|
|
2
|
+
import { imageMagicMatches } from "./safety.js";
|
|
3
|
+
import { MAX_IMAGE_READ_BYTES, MAX_IMAGE_DOWNSAMPLE_INPUT_BYTES } from "./fs-shared.js";
|
|
4
|
+
export const ADMITTED_IMAGE_MIME_TYPES = Object.freeze(["image/png", "image/jpeg", "image/gif", "image/webp"]);
|
|
5
|
+
export function imageReadCap(downsampler) {
|
|
6
|
+
return downsampler ? MAX_IMAGE_DOWNSAMPLE_INPUT_BYTES : MAX_IMAGE_READ_BYTES;
|
|
7
|
+
}
|
|
8
|
+
export async function admitImageBytes(bytes, claimedMime, downsampler) {
|
|
9
|
+
const rawBytes = bytes.byteLength;
|
|
10
|
+
if (!ADMITTED_IMAGE_MIME_TYPES.includes(claimedMime))
|
|
11
|
+
return { ok: false, reason: "mime_unsupported", rawBytes };
|
|
12
|
+
const cap = imageReadCap(downsampler);
|
|
13
|
+
if (rawBytes > cap)
|
|
14
|
+
return { ok: false, reason: "raw_too_large", rawBytes, cap };
|
|
15
|
+
if (!imageMagicMatches(bytes, claimedMime))
|
|
16
|
+
return { ok: false, reason: "magic_mismatch", rawBytes };
|
|
17
|
+
let base64;
|
|
18
|
+
let mimeType = claimedMime;
|
|
19
|
+
let dimensions;
|
|
20
|
+
if (downsampler) {
|
|
21
|
+
const out = await downsampler(Buffer.from(bytes), claimedMime).catch(() => undefined);
|
|
22
|
+
if (out) {
|
|
23
|
+
base64 = out.base64;
|
|
24
|
+
mimeType = out.mimeType;
|
|
25
|
+
dimensions = out.dimensions;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
base64 ??= Buffer.from(bytes).toString("base64");
|
|
29
|
+
if (base64.length > MCP_IMAGE_MAX_BASE64)
|
|
30
|
+
return { ok: false, reason: "base64_too_large", rawBytes, base64 };
|
|
31
|
+
const resized = dimensions !== undefined &&
|
|
32
|
+
dimensions.displayWidth > 0 &&
|
|
33
|
+
dimensions.displayHeight > 0 &&
|
|
34
|
+
(dimensions.originalWidth !== dimensions.displayWidth || dimensions.originalHeight !== dimensions.displayHeight);
|
|
35
|
+
return { ok: true, block: { type: "image", data: base64, mimeType }, originalSize: rawBytes, ...(dimensions !== undefined ? { dimensions } : {}), resized };
|
|
36
|
+
}
|
package/dist/tools/fs/search.js
CHANGED
|
@@ -2,6 +2,7 @@ import { delimitUntrusted } from "../../core/untrusted-text.js";
|
|
|
2
2
|
import { MAX_EXEC_OUTPUT_BYTES } from "../../core/exec-output-tail.js";
|
|
3
3
|
import { hasBinaryExtension, isAbsoluteForFamily, isWinFormPath, joinForFamily, pathFamilyOf } from "./safety.js";
|
|
4
4
|
import { homeViewsOf } from "./read-deny-home.js";
|
|
5
|
+
import { createEntryDenyJudge } from "./dir-entries.js";
|
|
5
6
|
import { thrownText } from "../../core/thrown-value.js";
|
|
6
7
|
const WALK_MAX_FILES = 5000;
|
|
7
8
|
const WALK_MAX_DEPTH = 32;
|
|
@@ -228,14 +229,9 @@ export async function walk(env, root, start, ignore, signal, deny) {
|
|
|
228
229
|
let aborted = false;
|
|
229
230
|
let denyPruned = 0;
|
|
230
231
|
const denyPatterns = [];
|
|
231
|
-
const
|
|
232
|
+
const judge = deny !== undefined ? createEntryDenyJudge(env, deny, signal) : undefined;
|
|
232
233
|
const denyHit = async (path, leaf) => {
|
|
233
|
-
|
|
234
|
-
if (!hit && views !== undefined) {
|
|
235
|
-
const view = await views.of(path, leaf !== undefined ? { leaf } : undefined);
|
|
236
|
-
if (view !== undefined)
|
|
237
|
-
hit = deny.matchPath(view);
|
|
238
|
-
}
|
|
234
|
+
const hit = judge === undefined ? null : await judge(path, leaf);
|
|
239
235
|
if (!hit)
|
|
240
236
|
return false;
|
|
241
237
|
denyPruned++;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_comment": "design/87 L3 — frozen public export surface of src/index.ts (name -> kind). DO NOT edit by hand to silence a red test. A removed/changed entry = a SemVer-BREAKING change; bump MAJOR and update this fixture in the SAME commit (design/87 §4.2 / §5.2). Regenerate via REGEN in test/export-surface.test.ts.",
|
|
3
3
|
"_tierComment": "#435 v1 — machine-readable layering of the public surface: stable = demonstrated by README.md / src/examples; internal = an `Internal`-marked name or a runner/engine deep-subtree declaration (the model seam src/engine/llm is excluded — it is the BYOM contract, not an engine internal); advanced = a supported export the front door does not walk you through. THIS IS AN INITIAL HEURISTIC, derived mechanically and expected to be refined ticket by ticket: no human reviewed these 1700+ entries one by one, and nothing here claims otherwise. Known bias: a short or English-word export name (ok, err, Result, Usage) can match ordinary prose in README.md and land `stable` on a coincidence. Every export MUST carry a tier — a new export with no row fails the gate in export-surface.test.ts.",
|
|
4
|
-
"count":
|
|
4
|
+
"count": 2593,
|
|
5
5
|
"exports": {
|
|
6
6
|
"A2ATaskState": "type",
|
|
7
7
|
"A2ATaskStateReversal": "type",
|
|
@@ -20,6 +20,8 @@
|
|
|
20
20
|
"AGENT_TRANSCRIPT_TOOL_NAME": "variable",
|
|
21
21
|
"AGGREGATE_MEDIA_BUDGET_BYTES": "variable",
|
|
22
22
|
"AGGREGATE_TOOL_RESULT_BUDGET_CHARS": "variable",
|
|
23
|
+
"ALLOW_ENTRY_INERT_REASONS": "variable",
|
|
24
|
+
"ALLOW_RULE_MEMBERS": "variable",
|
|
23
25
|
"ANNOUNCEMENTS_FILE": "variable",
|
|
24
26
|
"APPROVAL_CARD_REQUIRED_KEYS": "variable",
|
|
25
27
|
"APPROVER_ATTRIBUTION_MAX_CHARS": "variable",
|
|
@@ -90,6 +92,12 @@
|
|
|
90
92
|
"AgentStateSource": "interface",
|
|
91
93
|
"AgentTranscriptToolOptions": "interface",
|
|
92
94
|
"AggregateBudgetOptions": "interface",
|
|
95
|
+
"AllowEntryGateSeats": "interface",
|
|
96
|
+
"AllowEntryHit": "interface",
|
|
97
|
+
"AllowEntryInertReason": "type",
|
|
98
|
+
"AllowEntryLane": "interface",
|
|
99
|
+
"AllowRuleMember": "type",
|
|
100
|
+
"AllowRuleShadow": "interface",
|
|
93
101
|
"AnthropicBrainConfig": "interface",
|
|
94
102
|
"AppendLog": "class",
|
|
95
103
|
"ApprovalSeatOutcome": "type",
|
|
@@ -306,6 +314,7 @@
|
|
|
306
314
|
"CompactionEffect": "interface",
|
|
307
315
|
"CompactionKind": "type",
|
|
308
316
|
"CompactionWindowSafetyInfo": "interface",
|
|
317
|
+
"CompiledAllowEntry": "type",
|
|
309
318
|
"CompiledEventPrompt": "interface",
|
|
310
319
|
"CompiledSection": "interface",
|
|
311
320
|
"CompleteSimpleFn": "type",
|
|
@@ -1337,7 +1346,6 @@
|
|
|
1337
1346
|
"SHELL_READ_FINDING_RANK": "variable",
|
|
1338
1347
|
"SHELL_READ_SEATS": "variable",
|
|
1339
1348
|
"SHELL_WRAPPER_TABLE": "variable",
|
|
1340
|
-
"SKILL_ENTRY_INERT_REASONS": "variable",
|
|
1341
1349
|
"SKILL_GRANT_ORIGINS": "variable",
|
|
1342
1350
|
"SKILL_TOOL_NAME": "variable",
|
|
1343
1351
|
"STALE_RUNNING_REAP_ATTRIBUTION": "variable",
|
|
@@ -1450,7 +1458,6 @@
|
|
|
1450
1458
|
"SideQueryResult": "interface",
|
|
1451
1459
|
"SideQuerySpec": "interface",
|
|
1452
1460
|
"SideQueryToolDef": "interface",
|
|
1453
|
-
"SkillEntryInertReason": "type",
|
|
1454
1461
|
"SkillGateSeats": "interface",
|
|
1455
1462
|
"SkillGrantHit": "interface",
|
|
1456
1463
|
"SkillGrantLane": "interface",
|
|
@@ -1881,6 +1888,8 @@
|
|
|
1881
1888
|
"committedDistilledOf": "function",
|
|
1882
1889
|
"committedOriginOf": "function",
|
|
1883
1890
|
"compactableToolNames": "function",
|
|
1891
|
+
"compileAllowEntry": "function",
|
|
1892
|
+
"compileAllowList": "function",
|
|
1884
1893
|
"compileReadDeny": "function",
|
|
1885
1894
|
"compileWriteDeny": "function",
|
|
1886
1895
|
"compileWriteProtection": "function",
|
|
@@ -2606,6 +2615,8 @@
|
|
|
2606
2615
|
"AGENT_TRANSCRIPT_TOOL_NAME": "advanced",
|
|
2607
2616
|
"AGGREGATE_MEDIA_BUDGET_BYTES": "advanced",
|
|
2608
2617
|
"AGGREGATE_TOOL_RESULT_BUDGET_CHARS": "advanced",
|
|
2618
|
+
"ALLOW_ENTRY_INERT_REASONS": "advanced",
|
|
2619
|
+
"ALLOW_RULE_MEMBERS": "advanced",
|
|
2609
2620
|
"ANNOUNCEMENTS_FILE": "advanced",
|
|
2610
2621
|
"APPROVAL_CARD_REQUIRED_KEYS": "internal",
|
|
2611
2622
|
"APPROVER_ATTRIBUTION_MAX_CHARS": "advanced",
|
|
@@ -2676,6 +2687,12 @@
|
|
|
2676
2687
|
"AgentStateSource": "advanced",
|
|
2677
2688
|
"AgentTranscriptToolOptions": "advanced",
|
|
2678
2689
|
"AggregateBudgetOptions": "advanced",
|
|
2690
|
+
"AllowEntryGateSeats": "advanced",
|
|
2691
|
+
"AllowEntryHit": "advanced",
|
|
2692
|
+
"AllowEntryInertReason": "advanced",
|
|
2693
|
+
"AllowEntryLane": "advanced",
|
|
2694
|
+
"AllowRuleMember": "advanced",
|
|
2695
|
+
"AllowRuleShadow": "advanced",
|
|
2679
2696
|
"AnthropicBrainConfig": "advanced",
|
|
2680
2697
|
"AppendLog": "advanced",
|
|
2681
2698
|
"ApprovalSeatOutcome": "advanced",
|
|
@@ -2892,6 +2909,7 @@
|
|
|
2892
2909
|
"CompactionEffect": "advanced",
|
|
2893
2910
|
"CompactionKind": "advanced",
|
|
2894
2911
|
"CompactionWindowSafetyInfo": "advanced",
|
|
2912
|
+
"CompiledAllowEntry": "advanced",
|
|
2895
2913
|
"CompiledEventPrompt": "advanced",
|
|
2896
2914
|
"CompiledSection": "advanced",
|
|
2897
2915
|
"CompleteSimpleFn": "advanced",
|
|
@@ -3923,7 +3941,6 @@
|
|
|
3923
3941
|
"SHELL_READ_FINDING_RANK": "advanced",
|
|
3924
3942
|
"SHELL_READ_SEATS": "advanced",
|
|
3925
3943
|
"SHELL_WRAPPER_TABLE": "advanced",
|
|
3926
|
-
"SKILL_ENTRY_INERT_REASONS": "advanced",
|
|
3927
3944
|
"SKILL_GRANT_ORIGINS": "advanced",
|
|
3928
3945
|
"SKILL_TOOL_NAME": "internal",
|
|
3929
3946
|
"STALE_RUNNING_REAP_ATTRIBUTION": "advanced",
|
|
@@ -4036,7 +4053,6 @@
|
|
|
4036
4053
|
"SideQueryResult": "advanced",
|
|
4037
4054
|
"SideQuerySpec": "advanced",
|
|
4038
4055
|
"SideQueryToolDef": "advanced",
|
|
4039
|
-
"SkillEntryInertReason": "advanced",
|
|
4040
4056
|
"SkillGateSeats": "advanced",
|
|
4041
4057
|
"SkillGrantHit": "advanced",
|
|
4042
4058
|
"SkillGrantLane": "advanced",
|
|
@@ -4467,6 +4483,8 @@
|
|
|
4467
4483
|
"committedDistilledOf": "stable",
|
|
4468
4484
|
"committedOriginOf": "stable",
|
|
4469
4485
|
"compactableToolNames": "advanced",
|
|
4486
|
+
"compileAllowEntry": "advanced",
|
|
4487
|
+
"compileAllowList": "advanced",
|
|
4470
4488
|
"compileReadDeny": "advanced",
|
|
4471
4489
|
"compileWriteDeny": "advanced",
|
|
4472
4490
|
"compileWriteProtection": "advanced",
|