@sema-agent/core 7.24.4 → 7.25.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/CHANGELOG.md +78 -0
- package/dist/agents/peer-session-drain.d.ts +16 -1
- package/dist/agents/peer-session-drain.js +16 -1
- package/dist/agents/send-message-tool.d.ts +10 -2
- package/dist/agents/send-message-tool.js +18 -7
- package/dist/agents/subagent.js +13 -10
- package/dist/core/background-agent-store.d.ts +3 -3
- package/dist/core/checkpoint-store.d.ts +1 -0
- package/dist/core/delegation-frames.d.ts +5 -0
- package/dist/core/gate-fold.js +85 -0
- package/dist/core/gate-lanes.js +23 -1
- package/dist/core/gate-outcome.d.ts +8 -2
- package/dist/core/gate-outcome.js +3 -1
- package/dist/core/hooks.d.ts +29 -0
- package/dist/core/hooks.js +2 -0
- package/dist/core/mailbox-store.d.ts +5 -0
- package/dist/core/mailbox-store.js +1 -1
- package/dist/core/parent-spec-seat.d.ts +7 -1
- package/dist/core/parent-spec-seat.js +2 -0
- package/dist/core/permission-rule-consent.js +29 -47
- package/dist/core/permission-rule-provider.js +4 -3
- package/dist/core/permission-rule-store.d.ts +143 -7
- package/dist/core/permission-rule-store.js +165 -15
- package/dist/core/runner/contracts.d.ts +36 -2
- package/dist/core/runner/gate-exit.d.ts +14 -0
- package/dist/core/runner/gate-exit.js +4 -0
- package/dist/core/runner/prepare-delegation-surface.d.ts +4 -4
- package/dist/core/runner/prepare-delegation-surface.js +2 -1
- package/dist/core/runner/prepare-gate-stations.d.ts +4 -0
- package/dist/core/runner/prepare-gate-stations.js +7 -4
- package/dist/core/runner/prepare-hands-readface.d.ts +8 -4
- package/dist/core/runner/prepare-hands-readface.js +25 -10
- package/dist/core/runner/prepare-inherited-gate.d.ts +23 -0
- package/dist/core/runner/prepare-inherited-gate.js +11 -6
- package/dist/core/runner/prepare-policy-chain.d.ts +15 -1
- package/dist/core/runner/prepare-policy-chain.js +14 -4
- package/dist/core/runner/prepare-suspend-saga.d.ts +5 -2
- package/dist/core/runner/prepare-suspend-saga.js +4 -3
- package/dist/core/runner/prepare-task.js +10 -9
- package/dist/core/runner/prepare-wiring-manifest.d.ts +11 -4
- package/dist/core/runner/prepare-wiring-manifest.js +8 -4
- package/dist/core/runner/resume-apply.js +2 -0
- package/dist/core/runner/run-harness-handlers.js +1 -0
- package/dist/core/runner/run-identity-wiring.d.ts +2 -2
- package/dist/core/runner/run-leg.js +26 -0
- package/dist/core/runner/run-notification-lane.d.ts +2 -2
- package/dist/core/runner/run-notification-lane.js +2 -1
- package/dist/core/runner/run-settle-and-teardown.js +1 -0
- package/dist/core/runner/session-rule-policy.d.ts +3 -4
- package/dist/core/runner/session-rule-policy.js +11 -3
- package/dist/core/session-policy-store.d.ts +27 -3
- package/dist/core/session-policy-store.js +12 -4
- package/dist/core/store-contracts/background-agent-store-contract.js +10 -0
- package/dist/core/store-contracts/peer-directory-contract.d.ts +23 -0
- package/dist/core/store-contracts/peer-directory-contract.js +82 -0
- package/dist/core/task-event.d.ts +6 -0
- package/dist/core/task-notification.d.ts +79 -4
- package/dist/core/task-notification.js +90 -1
- package/dist/core/task-registry-agent.js +1 -2
- package/dist/core/task-registry-monitor.js +2 -1
- package/dist/core/task-registry-shared.d.ts +53 -5
- package/dist/core/task-registry-shared.js +13 -2
- package/dist/core/task-registry.js +8 -5
- package/dist/core/task-spec.d.ts +12 -5
- package/dist/core/tool-catalog-entries.js +1 -0
- package/dist/core/tool-spec.d.ts +1 -1
- package/dist/core/wiring-manifest.d.ts +2 -2
- package/dist/engine/loop/agent-loop.js +1 -1
- package/dist/engine/loop/types.d.ts +4 -0
- package/dist/index.d.ts +6 -3
- package/dist/index.js +4 -3
- package/dist/prompts/coordinator.d.ts +2 -1
- package/dist/stores/file/adoption/adopt.js +23 -1
- package/dist/stores/file/permission-rule-store.js +3 -1
- package/dist/stores/file/session-policy-store.d.ts +31 -0
- package/dist/stores/file/session-policy-store.js +87 -7
- package/dist/tools/fs/bash-program-position.d.ts +4 -26
- package/dist/tools/fs/bash-program-position.js +0 -11
- package/dist/tools/fs/bash-readonly-classifier.d.ts +20 -309
- package/dist/tools/fs/bash-readonly-classifier.js +28 -766
- package/dist/tools/fs/fs-bash.d.ts +43 -207
- package/dist/tools/fs/fs-bash.js +20 -341
- package/dist/tools/fs/index.d.ts +12 -13
- package/dist/tools/fs/index.js +3 -4
- package/dist/tools/fs/read-deny.d.ts +25 -0
- package/dist/tools/fs/read-deny.js +19 -0
- package/dist/tools/fs/safety.js +2 -6
- package/dist/tools/fs/shell-read-check.d.ts +99 -0
- package/dist/tools/fs/shell-read-check.js +229 -0
- package/dist/tools/fs/shell-read-establish.d.ts +70 -115
- package/dist/tools/fs/shell-read-establish.js +216 -102
- package/dist/tools/fs/shell-read-judge.d.ts +231 -0
- package/dist/tools/fs/shell-read-judge.js +170 -0
- package/dist/tools/fs/shell-read-plan.d.ts +3 -0
- package/dist/tools/fs/shell-read-plan.js +82 -19
- package/dist/tools/monitor.d.ts +5 -5
- package/dist/tools/monitor.js +3 -5
- package/dist/tools/task-list.d.ts +4 -0
- package/package.json +1 -1
- package/test/export-surface.snapshot.json +19 -3
- package/wire-changes/core@7.25.0.json +671 -0
package/dist/tools/monitor.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ import type { AgentTool, ExecutionEnv } from "../internal/harness-types.js";
|
|
|
42
42
|
import { type MonitorTimers, type TaskRegistry } from "../core/task-registry.js";
|
|
43
43
|
import type { TaskNotificationPayload } from "../core/task-notification.js";
|
|
44
44
|
import type { ToolResultStore } from "../core/tool-result-store.js";
|
|
45
|
-
import type {
|
|
45
|
+
import type { ShellReadAdmission } from "./fs/shell-read-check.js";
|
|
46
46
|
export interface MonitorToolOptions {
|
|
47
47
|
registry: TaskRegistry;
|
|
48
48
|
/** Fallbacks when the runtime ctx carries no identity (direct mounts) — same posture as createBashTool. */
|
|
@@ -69,10 +69,10 @@ export interface MonitorToolOptions {
|
|
|
69
69
|
* task-registry-monitor.ts's spill helper). Absent ⇒ legal degrade, byte-identical rolling (no spill,
|
|
70
70
|
* same loss shape as before this design). */
|
|
71
71
|
toolResultStore?: ToolResultStore;
|
|
72
|
-
/** The
|
|
73
|
-
* shell command too, so
|
|
74
|
-
*
|
|
75
|
-
|
|
72
|
+
/** The gate's shell read station's pre-spawn ADMISSION — the SAME option `createBashTool` takes: this face
|
|
73
|
+
* spawns a shell command too, so what it runs is what the station judged, re-established before the watch
|
|
74
|
+
* spawns. Absent ⇒ no station judged this mount; nothing is re-established. */
|
|
75
|
+
shellReadAdmission?: ShellReadAdmission;
|
|
76
76
|
/** RB-465-b (HRD-PTL-3 残件): spec-level retain (`TaskSpec.retainBackgroundProcesses`) — the SECOND
|
|
77
77
|
* retain lane, OR-composed with the env capability at the teardown sweep. Without this bit the mount
|
|
78
78
|
* could only see the env lane, so a deployment retaining per spec still got the "session ends it"
|
package/dist/tools/monitor.js
CHANGED
|
@@ -3,7 +3,6 @@ import { defineTool, errorResult } from "../core/tools.js";
|
|
|
3
3
|
import { hasBackgroundShell } from "../core/background-shell.js";
|
|
4
4
|
import { MONITOR_DEFAULT_TIMEOUT_MS, MONITOR_MAX_TIMEOUT_MS, } from "../core/task-registry.js";
|
|
5
5
|
import { toolFace } from "../core/tool-catalog-entries.js";
|
|
6
|
-
import { createShellCanonicalRecheck, MONITOR_ESCAPE_PROSE } from "./fs/fs-bash.js";
|
|
7
6
|
import { thrownText } from "../core/thrown-value.js";
|
|
8
7
|
const MONITOR_DESCRIPTION = "Run a shell command in the background and watch its stdout as a stream of events.\n" +
|
|
9
8
|
"\n" +
|
|
@@ -43,7 +42,6 @@ function envBackgroundWallSec(caps, requestedSec) {
|
|
|
43
42
|
return Math.min(base, cap);
|
|
44
43
|
}
|
|
45
44
|
export function createMonitorTool(env, opts) {
|
|
46
|
-
const canonicalRecheck = opts.readBoundary === undefined ? undefined : createShellCanonicalRecheck(env, opts.readBoundary, MONITOR_ESCAPE_PROSE);
|
|
47
45
|
return defineTool({
|
|
48
46
|
name: "Monitor",
|
|
49
47
|
...toolFace("monitor"),
|
|
@@ -70,9 +68,9 @@ export function createMonitorTool(env, opts) {
|
|
|
70
68
|
const isPersistent = persistent === true;
|
|
71
69
|
const timeoutMs = Math.min(MONITOR_MAX_TIMEOUT_MS, Math.max(1, Math.floor(timeout_ms ?? MONITOR_DEFAULT_TIMEOUT_MS)));
|
|
72
70
|
const spawnTimeoutSec = isPersistent ? undefined : Math.ceil(timeoutMs / 1000) + 5;
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
75
|
-
return
|
|
71
|
+
const refused = await opts.shellReadAdmission?.("Monitor", ctx.toolCallId, command, ctx.signal);
|
|
72
|
+
if (refused !== undefined)
|
|
73
|
+
return refused;
|
|
76
74
|
if (ctx.signal?.aborted === true)
|
|
77
75
|
return errorResult("Error (Monitor): the call was cancelled before the watch started.");
|
|
78
76
|
const spawn = await env.spawnBackground(command, {
|
|
@@ -55,6 +55,10 @@ export interface TaskListItem {
|
|
|
55
55
|
* (a real CC instance on the same directory) can set an id out of order, and then the backends
|
|
56
56
|
* disagreed: memory replayed its Map's insertion order while file/cc read the id order back off
|
|
57
57
|
* disk. Ordering is part of the contract, not each backend's incidental iteration order.
|
|
58
|
+
*
|
|
59
|
+
* @contract task_list.partition_is_root_session — a deployment that mounts a TaskListStore per session keys it by the
|
|
60
|
+
* delegation tree's ROOT session: every child of the tree (spawned live, or revived by a host verb after a durable park)
|
|
61
|
+
* reads the one list the leader reads; in-engine children share by construction, a per-call or per-reviver store is the divergence.
|
|
58
62
|
*/
|
|
59
63
|
export interface TaskListStore {
|
|
60
64
|
get(id: string): TaskListItem | undefined | Promise<TaskListItem | undefined>;
|
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": 2410,
|
|
5
5
|
"exports": {
|
|
6
6
|
"A2ATaskState": "type",
|
|
7
7
|
"A2ATaskStateReversal": "type",
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"AcquiredSession": "interface",
|
|
61
61
|
"ActiveWorktreeSession": "interface",
|
|
62
62
|
"ActorAssertion": "interface",
|
|
63
|
+
"AddResult": "type",
|
|
63
64
|
"AddWorktreeOptions": "interface",
|
|
64
65
|
"AdoptFileRuleStoreResult": "type",
|
|
65
66
|
"AdoptLocalDataRootOptions": "interface",
|
|
@@ -793,6 +794,7 @@
|
|
|
793
794
|
"MonitorTimers": "interface",
|
|
794
795
|
"MonitorToolOptions": "interface",
|
|
795
796
|
"NOTICE_AUDIENCE": "variable",
|
|
797
|
+
"NOTIFICATION_INJECTION_OUTCOMES": "variable",
|
|
796
798
|
"NO_PERSISTENT_MEMORY_NOTICE": "variable",
|
|
797
799
|
"NamedToolPolicy": "type",
|
|
798
800
|
"NamedWorkflowListing": "interface",
|
|
@@ -804,6 +806,7 @@
|
|
|
804
806
|
"NormalizedReadDenyEntry": "interface",
|
|
805
807
|
"NotePatch": "interface",
|
|
806
808
|
"NoticeAudience": "type",
|
|
809
|
+
"NotificationInjectionOutcome": "type",
|
|
807
810
|
"OFFLOAD_TOOL_NAME": "variable",
|
|
808
811
|
"ORCHESTRATION_AWARENESS": "variable",
|
|
809
812
|
"ORCHESTRATION_GUIDANCE": "variable",
|
|
@@ -853,6 +856,7 @@
|
|
|
853
856
|
"PEER_ADDRESS_PREFIXES": "variable",
|
|
854
857
|
"PEER_ADMISSION_DEFAULTS": "variable",
|
|
855
858
|
"PEER_DELIVERY_RECEIPT_STATES": "variable",
|
|
859
|
+
"PEER_DIRECTORY_CONTRACT_SCOPE": "variable",
|
|
856
860
|
"PEER_DROP_REASONS": "variable",
|
|
857
861
|
"PEER_HELD_QUEUE_CAP": "variable",
|
|
858
862
|
"PEER_HELD_REVIEW_CAUSES": "variable",
|
|
@@ -922,6 +926,7 @@
|
|
|
922
926
|
"PeerDeliveryReceiptState": "type",
|
|
923
927
|
"PeerDirectory": "interface",
|
|
924
928
|
"PeerDirectoryAccess": "interface",
|
|
929
|
+
"PeerDirectoryContractHooks": "interface",
|
|
925
930
|
"PeerDropReason": "type",
|
|
926
931
|
"PeerHeldEntry": "interface",
|
|
927
932
|
"PeerHeldQueue": "interface",
|
|
@@ -1204,6 +1209,7 @@
|
|
|
1204
1209
|
"RuleSyncResponseBody": "interface",
|
|
1205
1210
|
"RuleSyncState": "interface",
|
|
1206
1211
|
"RuleTicket": "type",
|
|
1212
|
+
"RuleTightenAddDelta": "interface",
|
|
1207
1213
|
"RuleTombstone": "interface",
|
|
1208
1214
|
"RuleWriteDelta": "type",
|
|
1209
1215
|
"RuleWriteOutcome": "type",
|
|
@@ -1625,6 +1631,7 @@
|
|
|
1625
1631
|
"ackAdoptionConfig": "function",
|
|
1626
1632
|
"acquireCcLock": "function",
|
|
1627
1633
|
"addDotsOf": "function",
|
|
1634
|
+
"addPersistedRule": "function",
|
|
1628
1635
|
"addWorktree": "function",
|
|
1629
1636
|
"adjudicateModelRoute": "function",
|
|
1630
1637
|
"adjudicatePersistedPathRules": "function",
|
|
@@ -1670,7 +1677,6 @@
|
|
|
1670
1677
|
"autoRunOnRecommendationEffective": "function",
|
|
1671
1678
|
"backgroundAgentStoreContract": "function",
|
|
1672
1679
|
"backgroundAgentStoreScopesContract": "function",
|
|
1673
|
-
"bashReadBoundaryProbe": "function",
|
|
1674
1680
|
"bashReversibilityProbe": "function",
|
|
1675
1681
|
"boundaryPublishVerdict": "function",
|
|
1676
1682
|
"boundedRedactedSummary": "function",
|
|
@@ -1984,6 +1990,7 @@
|
|
|
1984
1990
|
"isModelGatedForClass": "function",
|
|
1985
1991
|
"isModelPriced": "function",
|
|
1986
1992
|
"isNamespacedCoveringRuleName": "function",
|
|
1993
|
+
"isNotificationInjectionOutcome": "function",
|
|
1987
1994
|
"isPeerDeliveryReceiptState": "function",
|
|
1988
1995
|
"isPeerIdleNoticeKind": "function",
|
|
1989
1996
|
"isPeerSessionId": "function",
|
|
@@ -2132,6 +2139,7 @@
|
|
|
2132
2139
|
"peekMemoryAnnouncements": "function",
|
|
2133
2140
|
"peerAdmissionFor": "function",
|
|
2134
2141
|
"peerAxisToken": "function",
|
|
2142
|
+
"peerDirectoryContract": "function",
|
|
2135
2143
|
"peerHeldQueueFor": "function",
|
|
2136
2144
|
"peerHeldQueueIfAny": "function",
|
|
2137
2145
|
"peerHeldQueueKey": "function",
|
|
@@ -2464,6 +2472,7 @@
|
|
|
2464
2472
|
"AcquiredSession": "advanced",
|
|
2465
2473
|
"ActiveWorktreeSession": "internal",
|
|
2466
2474
|
"ActorAssertion": "advanced",
|
|
2475
|
+
"AddResult": "advanced",
|
|
2467
2476
|
"AddWorktreeOptions": "advanced",
|
|
2468
2477
|
"AdoptFileRuleStoreResult": "advanced",
|
|
2469
2478
|
"AdoptLocalDataRootOptions": "advanced",
|
|
@@ -3197,6 +3206,7 @@
|
|
|
3197
3206
|
"MonitorTimers": "advanced",
|
|
3198
3207
|
"MonitorToolOptions": "advanced",
|
|
3199
3208
|
"NOTICE_AUDIENCE": "advanced",
|
|
3209
|
+
"NOTIFICATION_INJECTION_OUTCOMES": "advanced",
|
|
3200
3210
|
"NO_PERSISTENT_MEMORY_NOTICE": "advanced",
|
|
3201
3211
|
"NamedToolPolicy": "advanced",
|
|
3202
3212
|
"NamedWorkflowListing": "advanced",
|
|
@@ -3208,6 +3218,7 @@
|
|
|
3208
3218
|
"NormalizedReadDenyEntry": "stable",
|
|
3209
3219
|
"NotePatch": "stable",
|
|
3210
3220
|
"NoticeAudience": "advanced",
|
|
3221
|
+
"NotificationInjectionOutcome": "advanced",
|
|
3211
3222
|
"OFFLOAD_TOOL_NAME": "advanced",
|
|
3212
3223
|
"ORCHESTRATION_AWARENESS": "advanced",
|
|
3213
3224
|
"ORCHESTRATION_GUIDANCE": "advanced",
|
|
@@ -3257,6 +3268,7 @@
|
|
|
3257
3268
|
"PEER_ADDRESS_PREFIXES": "advanced",
|
|
3258
3269
|
"PEER_ADMISSION_DEFAULTS": "advanced",
|
|
3259
3270
|
"PEER_DELIVERY_RECEIPT_STATES": "advanced",
|
|
3271
|
+
"PEER_DIRECTORY_CONTRACT_SCOPE": "advanced",
|
|
3260
3272
|
"PEER_DROP_REASONS": "advanced",
|
|
3261
3273
|
"PEER_HELD_QUEUE_CAP": "advanced",
|
|
3262
3274
|
"PEER_HELD_REVIEW_CAUSES": "advanced",
|
|
@@ -3326,6 +3338,7 @@
|
|
|
3326
3338
|
"PeerDeliveryReceiptState": "advanced",
|
|
3327
3339
|
"PeerDirectory": "advanced",
|
|
3328
3340
|
"PeerDirectoryAccess": "advanced",
|
|
3341
|
+
"PeerDirectoryContractHooks": "advanced",
|
|
3329
3342
|
"PeerDropReason": "advanced",
|
|
3330
3343
|
"PeerHeldEntry": "advanced",
|
|
3331
3344
|
"PeerHeldQueue": "advanced",
|
|
@@ -3608,6 +3621,7 @@
|
|
|
3608
3621
|
"RuleSyncResponseBody": "advanced",
|
|
3609
3622
|
"RuleSyncState": "advanced",
|
|
3610
3623
|
"RuleTicket": "advanced",
|
|
3624
|
+
"RuleTightenAddDelta": "advanced",
|
|
3611
3625
|
"RuleTombstone": "advanced",
|
|
3612
3626
|
"RuleWriteDelta": "advanced",
|
|
3613
3627
|
"RuleWriteOutcome": "advanced",
|
|
@@ -4029,6 +4043,7 @@
|
|
|
4029
4043
|
"ackAdoptionConfig": "advanced",
|
|
4030
4044
|
"acquireCcLock": "advanced",
|
|
4031
4045
|
"addDotsOf": "advanced",
|
|
4046
|
+
"addPersistedRule": "advanced",
|
|
4032
4047
|
"addWorktree": "advanced",
|
|
4033
4048
|
"adjudicateModelRoute": "advanced",
|
|
4034
4049
|
"adjudicatePersistedPathRules": "advanced",
|
|
@@ -4074,7 +4089,6 @@
|
|
|
4074
4089
|
"autoRunOnRecommendationEffective": "internal",
|
|
4075
4090
|
"backgroundAgentStoreContract": "advanced",
|
|
4076
4091
|
"backgroundAgentStoreScopesContract": "advanced",
|
|
4077
|
-
"bashReadBoundaryProbe": "advanced",
|
|
4078
4092
|
"bashReversibilityProbe": "advanced",
|
|
4079
4093
|
"boundaryPublishVerdict": "advanced",
|
|
4080
4094
|
"boundedRedactedSummary": "advanced",
|
|
@@ -4388,6 +4402,7 @@
|
|
|
4388
4402
|
"isModelGatedForClass": "advanced",
|
|
4389
4403
|
"isModelPriced": "advanced",
|
|
4390
4404
|
"isNamespacedCoveringRuleName": "advanced",
|
|
4405
|
+
"isNotificationInjectionOutcome": "advanced",
|
|
4391
4406
|
"isPeerDeliveryReceiptState": "advanced",
|
|
4392
4407
|
"isPeerIdleNoticeKind": "advanced",
|
|
4393
4408
|
"isPeerSessionId": "advanced",
|
|
@@ -4536,6 +4551,7 @@
|
|
|
4536
4551
|
"peekMemoryAnnouncements": "advanced",
|
|
4537
4552
|
"peerAdmissionFor": "advanced",
|
|
4538
4553
|
"peerAxisToken": "advanced",
|
|
4554
|
+
"peerDirectoryContract": "advanced",
|
|
4539
4555
|
"peerHeldQueueFor": "advanced",
|
|
4540
4556
|
"peerHeldQueueIfAny": "advanced",
|
|
4541
4557
|
"peerHeldQueueKey": "advanced",
|