@sema-agent/core 7.73.0 → 7.74.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 +246 -0
- package/dist/agents/list-agents-tool.js +1 -1
- package/dist/agents/retain-ledger.js +3 -3
- package/dist/agents/send-message-tool.js +4 -4
- package/dist/brain/anthropic.d.ts +42 -1
- package/dist/brain/anthropic.js +54 -4
- package/dist/brain/failover.d.ts +5 -0
- package/dist/brain/failover.js +51 -22
- package/dist/brain/model-lane.d.ts +12 -3
- package/dist/brain/model-lane.js +5 -5
- package/dist/brain/open-responses.js +3 -3
- package/dist/brain/openai.js +1 -1
- package/dist/brain/route-adjudicator.d.ts +33 -4
- package/dist/brain/route-adjudicator.js +49 -12
- package/dist/brain/stream-engine.js +9 -7
- package/dist/brain/stream-shared.d.ts +4 -3
- package/dist/brain/stream-shared.js +2 -2
- package/dist/core/allow-entry.js +1 -1
- package/dist/core/ask-class.d.ts +2 -2
- package/dist/core/ask-headline.d.ts +1 -1
- package/dist/core/ask-origin.d.ts +44 -4
- package/dist/core/ask-origin.js +29 -10
- package/dist/core/background-agent-store.d.ts +1 -0
- package/dist/core/background-agent-store.js +49 -8
- package/dist/core/checkpoint-row-verdict.d.ts +1 -1
- package/dist/core/checkpoint-row-verdict.js +2 -2
- package/dist/core/checkpoint-store.d.ts +2 -0
- package/dist/core/checkpoint-store.js +8 -2
- package/dist/core/config-refusal-codes.d.ts +1 -1
- package/dist/core/config-refusal-codes.js +1 -0
- package/dist/core/cron.js +9 -1
- package/dist/core/deployment-shape.d.ts +7 -0
- package/dist/core/deployment-shape.js +19 -0
- package/dist/core/engine-capabilities.d.ts +9 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +14 -9
- package/dist/core/engine-version.js +1 -1
- package/dist/core/gate-fold.js +5 -4
- package/dist/core/gate-lanes.js +8 -12
- package/dist/core/gate-outcome.d.ts +8 -2
- package/dist/core/gate-outcome.js +10 -3
- package/dist/core/governance-codes.d.ts +8 -2
- package/dist/core/governance-codes.js +9 -1
- package/dist/core/hook-condition.d.ts +37 -0
- package/dist/core/hook-condition.js +567 -0
- package/dist/core/hooks.d.ts +2 -0
- package/dist/core/mode-policy.d.ts +4 -0
- package/dist/core/mode-policy.js +18 -2
- package/dist/core/model-seat.d.ts +8 -5
- package/dist/core/model-shell.d.ts +129 -0
- package/dist/core/model-shell.js +249 -0
- package/dist/core/mods/kernel/digest.d.ts +4 -0
- package/dist/core/mods/kernel/digest.js +5 -0
- package/dist/core/mods/kernel/dispatch.d.ts +3 -0
- package/dist/core/mods/kernel/dispatch.js +15 -6
- package/dist/core/mods/kernel/events.d.ts +21 -5
- package/dist/core/mods/kernel/events.js +19 -10
- package/dist/core/mods/kernel/hash-mirror.d.ts +1 -0
- package/dist/core/mods/kernel/hash-mirror.js +55 -0
- package/dist/core/mods/kernel/index.d.ts +1 -0
- package/dist/core/mods/kernel/index.js +1 -0
- package/dist/core/mods/kernel/package-reader.d.ts +48 -0
- package/dist/core/mods/kernel/package-reader.js +149 -0
- package/dist/core/mods/kernel/site-rules.d.ts +4 -0
- package/dist/core/mods/kernel/site-rules.js +13 -0
- package/dist/core/mods/package.d.ts +7 -3
- package/dist/core/mods/package.js +47 -80
- package/dist/core/permission-rule-org.js +13 -3
- package/dist/core/permission-rules.js +4 -1
- package/dist/core/retain-seat.d.ts +42 -0
- package/dist/core/retain-seat.js +76 -0
- package/dist/core/rewind-refusal-codes.d.ts +8 -0
- package/dist/core/rewind-refusal-codes.js +12 -0
- package/dist/core/roles.d.ts +2 -2
- package/dist/core/roles.js +15 -1
- package/dist/core/rule-store-fault.d.ts +9 -7
- package/dist/core/rule-store-fault.js +8 -3
- package/dist/core/runner/checkpoint-scope.d.ts +1 -0
- package/dist/core/runner/checkpoint-scope.js +4 -2
- package/dist/core/runner/compact-session.js +1 -1
- package/dist/core/runner/construction-doors.js +2 -0
- package/dist/core/runner/cross-boundary-lane.d.ts +8 -1
- package/dist/core/runner/cross-boundary-lane.js +4 -0
- package/dist/core/runner/gate-exit.d.ts +7 -0
- package/dist/core/runner/gate-exit.js +2 -1
- package/dist/core/runner/model-lane-seat.d.ts +3 -0
- package/dist/core/runner/model-lane-seat.js +4 -0
- package/dist/core/runner/person-path-rows.d.ts +6 -0
- package/dist/core/runner/person-path-rows.js +13 -0
- package/dist/core/runner/prepare-config-doors.js +9 -5
- package/dist/core/runner/prepare-gate-stations.d.ts +6 -0
- package/dist/core/runner/prepare-gate-stations.js +3 -1
- package/dist/core/runner/prepare-hands-readface.js +3 -2
- package/dist/core/runner/prepare-offload-wrappers.js +1 -1
- package/dist/core/runner/prepare-task.js +6 -3
- package/dist/core/runner/prepare-wiring-manifest.js +3 -4
- package/dist/core/runner/resume-policy-outcome.js +5 -2
- package/dist/core/runner/role-seat-defaulted.d.ts +3 -3
- package/dist/core/runner/role-seat-defaulted.js +1 -1
- package/dist/core/runner/rule-store-unreadable-notice.d.ts +1 -1
- package/dist/core/runner/rule-store-unreadable-notice.js +3 -3
- package/dist/core/runner/run-harness-handlers.js +1 -1
- package/dist/core/runner/run-leg.js +2 -2
- package/dist/core/runner/shell-env-withheld.d.ts +3 -2
- package/dist/core/runner/shell-env-withheld.js +24 -1
- package/dist/core/runner/sub-agent-deny-lists.js +9 -5
- package/dist/core/runner/tool-end-body.d.ts +1 -1
- package/dist/core/runner/tool-not-executed.d.ts +27 -8
- package/dist/core/runner/tool-not-executed.js +22 -11
- package/dist/core/runner/write-protection-station.d.ts +1 -1
- package/dist/core/runner/write-protection-station.js +1 -1
- package/dist/core/runner-deps.d.ts +4 -0
- package/dist/core/secret-env.d.ts +8 -0
- package/dist/core/secret-env.js +5 -2
- package/dist/core/shell-read-silence.d.ts +40 -2
- package/dist/core/shell-read-silence.js +23 -4
- package/dist/core/task-event.d.ts +4 -4
- package/dist/core/task-notification.js +6 -1
- package/dist/core/task-registry-agent.d.ts +1 -0
- package/dist/core/task-registry-agent.js +1 -1
- package/dist/core/task-registry.d.ts +1 -0
- package/dist/core/task-registry.js +4 -3
- package/dist/core/task-result.d.ts +5 -3
- package/dist/core/task-spec-members.js +8 -0
- package/dist/core/tool-gate-phase.d.ts +6 -3
- package/dist/core/tool-gate-phase.js +1 -0
- package/dist/core/tool-mount-facts.d.ts +7 -3
- package/dist/core/tool-mount-facts.js +6 -2
- package/dist/core/tool-mount-plan.d.ts +1 -1
- package/dist/core/tool-mount-plan.js +4 -3
- package/dist/core/tool-result-store.d.ts +37 -1
- package/dist/core/tool-result-store.js +168 -23
- package/dist/core/trace.d.ts +3 -3
- package/dist/engine/execution-env/node-execution-env.d.ts +75 -1
- package/dist/engine/execution-env/node-execution-env.js +225 -13
- package/dist/engine/harness/types.d.ts +25 -0
- package/dist/engine/llm/types.d.ts +8 -0
- package/dist/engine/llm/validation.d.ts +8 -1
- package/dist/engine/llm/validation.js +31 -2
- package/dist/host-env.d.ts +10 -0
- package/dist/host-env.js +1 -0
- package/dist/index.d.ts +10 -2
- package/dist/index.js +9 -2
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/orchestration/goal.js +1 -1
- package/dist/orchestration/workflow-primitives.js +10 -1
- package/dist/orchestration/workflow-script-runner.d.ts +2 -2
- package/dist/orchestration/workflow.d.ts +1 -1
- package/dist/orchestration/workflow.js +2 -2
- package/dist/shell/lex.d.ts +2 -2
- package/dist/shell/lex.js +1 -1
- package/dist/tools/fs/bash-model-shell.d.ts +23 -0
- package/dist/tools/fs/bash-model-shell.js +25 -0
- package/dist/tools/fs/bash-readonly-classifier.d.ts +6 -0
- package/dist/tools/fs/bash-readonly-classifier.js +3 -0
- package/dist/tools/fs/fs-bash.js +13 -11
- package/dist/tools/fs/shell-read-argv.js +1 -0
- package/dist/tools/fs/shell-read-check.js +39 -9
- package/dist/tools/fs/shell-read-plan.d.ts +2 -3
- package/dist/tools/fs/shell-read-plan.js +8 -5
- package/dist/tools/fs/shell-read-word.d.ts +8 -0
- package/dist/tools/fs/shell-read-word.js +13 -4
- package/dist/tools/monitor.js +12 -8
- package/dist/tools/scheduler-tools.d.ts +1 -0
- package/dist/tools/scheduler-tools.js +5 -2
- package/package.json +3 -2
- package/test/export-surface.snapshot.json +62 -3
- package/wire-changes/answers/core-stores-sql@7.74.0.json +7 -0
- package/wire-changes/answers/core@7.74.0.json +68 -0
- package/wire-changes/answers/mods-kernel@7.74.0.json +21 -0
- package/wire-changes/answers/primitives@7.74.0.json +7 -0
- package/wire-changes/answers/wiki-gate@7.74.0.json +8 -0
- package/wire-changes/core-stores-sql@7.74.0.json +143 -0
- package/wire-changes/core@7.74.0.json +2210 -0
- package/wire-changes/mods-kernel@7.74.0.json +421 -0
- package/wire-changes/primitives@7.74.0.json +174 -0
- package/wire-changes/wiki-gate@7.74.0.json +145 -0
|
@@ -120,7 +120,7 @@ export interface WorkflowFanOutOptions {
|
|
|
120
120
|
errors?: WorkflowFanOutSlotError[];
|
|
121
121
|
}
|
|
122
122
|
/** design/98 §D.6 hard cap: thrown when the script's returned result exceeds `maxResultChars` (a runaway
|
|
123
|
-
* script must not return an unbounded payload to the originator). */
|
|
123
|
+
* script must not return an unbounded payload to the originator). `size` is the serialized length, `Infinity` when the result cannot be serialized. */
|
|
124
124
|
export declare class WorkflowResultTooLargeError extends Error {
|
|
125
125
|
readonly size: number;
|
|
126
126
|
readonly max: number;
|
|
@@ -3968,12 +3968,12 @@ export function startWorkflow(runner, fn, opts = {}, internals) {
|
|
|
3968
3968
|
if (resumeRefusal !== undefined)
|
|
3969
3969
|
throw refusalTerminal(resumeRefusal);
|
|
3970
3970
|
if (maxResultChars !== undefined) {
|
|
3971
|
-
let size
|
|
3971
|
+
let size;
|
|
3972
3972
|
try {
|
|
3973
3973
|
size = JSON.stringify(result)?.length ?? 0;
|
|
3974
3974
|
}
|
|
3975
3975
|
catch {
|
|
3976
|
-
size =
|
|
3976
|
+
size = Number.POSITIVE_INFINITY;
|
|
3977
3977
|
}
|
|
3978
3978
|
if (size > maxResultChars)
|
|
3979
3979
|
throw new WorkflowResultTooLargeError(size, maxResultChars);
|
package/dist/shell/lex.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/** The dialect this lexer reads
|
|
2
|
-
*
|
|
1
|
+
/** The dialect this lexer reads — the one model text runs in: an environment starts it only on a bash it declared and asked
|
|
2
|
+
* (`ExecutionEnv.modelShell`), never on `sh`. The engine's own commands (`ExecutionEnv.exec`) are not read by it. */
|
|
3
3
|
export declare const SHELL_LEX_DIALECT = "bash";
|
|
4
4
|
/** What holds a character quoted: the four quote forms and the backslash escape, one reason each. */
|
|
5
5
|
export declare const QUOTE_KINDS: readonly ["'", "\"", "$'", "$\"", "\\"];
|
package/dist/shell/lex.js
CHANGED
|
@@ -1557,7 +1557,7 @@ function scanText(source, connectorsAreText, segments, level, list, resumed) {
|
|
|
1557
1557
|
return undefined;
|
|
1558
1558
|
if (w.inSubscript())
|
|
1559
1559
|
return fail("unterminated_subscript", w.srcOfRaw[w.subscript.rawStart]);
|
|
1560
|
-
const word = w.finish(acceptable, pendingHeredoc === undefined);
|
|
1560
|
+
const word = w.finish(acceptable && pendingRedirect === undefined, pendingHeredoc === undefined);
|
|
1561
1561
|
const at = w.at;
|
|
1562
1562
|
w = new WordBuilder();
|
|
1563
1563
|
if (pendingHeredoc !== undefined) {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type ExecutionEnv } from "../../internal/harness.js";
|
|
2
|
+
import type { ExecutionEnvExecOptions, ReadFloor } from "../../internal/harness-types.js";
|
|
3
|
+
import { modelShellOf, startsInBackground } from "../../core/model-shell.js";
|
|
4
|
+
export { modelShellOf, startsInBackground };
|
|
5
|
+
/** The one result a background command gets where none can run here (`BASH_BACKGROUND_UNAVAILABLE`, a module constant). */
|
|
6
|
+
export declare function bashBackgroundUnavailable(): {
|
|
7
|
+
content: string;
|
|
8
|
+
isError: true;
|
|
9
|
+
};
|
|
10
|
+
/** What both Bash faces answer, first of all, on an environment that declares no start for model text — before any admission, probe
|
|
11
|
+
* or start: a background command the background-unavailable result; a foreground one the never-started failure, thrown. `undefined`
|
|
12
|
+
* when the environment declares a start. */
|
|
13
|
+
export declare function refuseWithoutModelShell(env: ExecutionEnv, background: boolean): {
|
|
14
|
+
content: string;
|
|
15
|
+
isError: true;
|
|
16
|
+
} | undefined;
|
|
17
|
+
/** The foreground start for model text, with the call's byte floor (`readFloor`, a parameter every caller gives — `undefined` when the
|
|
18
|
+
* call carries none — written into the start's options here, where the start is made): the start's `exec`, called on the start — or,
|
|
19
|
+
* on an environment that declares none, the never-started failure (`shell_unavailable`), nothing started. */
|
|
20
|
+
export declare function modelShellExec(env: ExecutionEnv, command: string, readFloor: ReadFloor | undefined, options: ExecutionEnvExecOptions): ReturnType<ExecutionEnv["exec"]>;
|
|
21
|
+
/** Whether a background command can run here: the environment runs background processes and its start for model text has a
|
|
22
|
+
* background face (a background command is model text too). */
|
|
23
|
+
export declare function startsModelTextInBackground(env: ExecutionEnv): boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { errorResult } from "../../core/tools.js";
|
|
2
|
+
import { ExecutionError } from "../../internal/harness.js";
|
|
3
|
+
import { MODEL_SHELL_UNDECLARED_REFUSAL, modelShellOf, startsInBackground } from "../../core/model-shell.js";
|
|
4
|
+
import { hasBackgroundShell } from "../../core/background-shell.js";
|
|
5
|
+
import { BASH_BACKGROUND_UNAVAILABLE } from "./fs-bash-background-text.js";
|
|
6
|
+
export { modelShellOf, startsInBackground };
|
|
7
|
+
export function bashBackgroundUnavailable() {
|
|
8
|
+
return errorResult(BASH_BACKGROUND_UNAVAILABLE);
|
|
9
|
+
}
|
|
10
|
+
export function refuseWithoutModelShell(env, background) {
|
|
11
|
+
if (modelShellOf(env) !== undefined)
|
|
12
|
+
return undefined;
|
|
13
|
+
if (background)
|
|
14
|
+
return bashBackgroundUnavailable();
|
|
15
|
+
throw new Error(`Error (Bash): command did not run: ${MODEL_SHELL_UNDECLARED_REFUSAL}`);
|
|
16
|
+
}
|
|
17
|
+
export function modelShellExec(env, command, readFloor, options) {
|
|
18
|
+
const start = modelShellOf(env);
|
|
19
|
+
if (start === undefined)
|
|
20
|
+
return Promise.resolve({ ok: false, error: new ExecutionError("shell_unavailable", MODEL_SHELL_UNDECLARED_REFUSAL) });
|
|
21
|
+
return start.exec(command, { ...options, ...(readFloor !== undefined ? { readFloor } : {}) });
|
|
22
|
+
}
|
|
23
|
+
export function startsModelTextInBackground(env) {
|
|
24
|
+
return hasBackgroundShell(env) && startsInBackground(modelShellOf(env));
|
|
25
|
+
}
|
|
@@ -468,6 +468,12 @@ export declare function expansionInWord(w: {
|
|
|
468
468
|
export declare function globInWord(w: {
|
|
469
469
|
readonly pieces: readonly WordPiece[];
|
|
470
470
|
}): boolean;
|
|
471
|
+
/** Does this word carry a BRACKET expression the shell forms — a pathname-expansion piece the lexer carved from an unquoted `[`
|
|
472
|
+
* with an unquoted `]` after it (the one such piece with a `body`; `*` and `?` have none)? Where the class closes is the
|
|
473
|
+
* lexer's business, not this answer's: a collating symbol by name (`[[.period.]]`) is one too. */
|
|
474
|
+
export declare function bracketInWord(w: {
|
|
475
|
+
readonly pieces: readonly WordPiece[];
|
|
476
|
+
}): boolean;
|
|
471
477
|
/**
|
|
472
478
|
* Read ONE sed script and answer whether it can name a file or run a command.
|
|
473
479
|
*
|
|
@@ -287,6 +287,9 @@ export function globInWord(w) {
|
|
|
287
287
|
}
|
|
288
288
|
return false;
|
|
289
289
|
}
|
|
290
|
+
export function bracketInWord(w) {
|
|
291
|
+
return w.pieces.some((p) => isGlobPiece(p) && p.expansion?.body !== undefined);
|
|
292
|
+
}
|
|
290
293
|
const SED_READONLY_SCRIPT_PIECE = /^(?:\d+|\d+,\d+)?p$/;
|
|
291
294
|
const SED_FILE_OR_EXEC_COMMANDS = new Set(["r", "R", "w", "W", "e"]);
|
|
292
295
|
const SED_PLAIN_COMMANDS = new Set(["=", "d", "D", "F", "g", "G", "h", "H", "n", "N", "p", "P", "x", "z"]);
|
package/dist/tools/fs/fs-bash.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { randomBytes } from "node:crypto";
|
|
2
2
|
import { Type } from "typebox";
|
|
3
3
|
import { defineTool, errorResult } from "../../core/tools.js";
|
|
4
|
+
import { bashBackgroundUnavailable, modelShellExec, modelShellOf, refuseWithoutModelShell, startsInBackground, startsModelTextInBackground } from "./bash-model-shell.js";
|
|
4
5
|
import { callOccupant } from "../../core/task-registry-shared.js";
|
|
5
6
|
import { markTruncated, RollingTailBuffer } from "../../core/exec-output-tail.js";
|
|
6
7
|
import { BACKGROUND_START_FAILURE_KINDS, createBackgroundOutputFile, envDeclaresRetain, hasBackgroundShell, retainsBackgroundProcesses } from "../../core/background-shell.js";
|
|
@@ -11,7 +12,7 @@ import { admitImageBytes, sniffImageMime } from "../../core/image-admission.js";
|
|
|
11
12
|
import { isDeadCwd, diagnoseDeadCwd } from "./dead-cwd.js";
|
|
12
13
|
import { boundaryIsTheSandbox, hasDestroy, isIsolated } from "../../core/remote-env.js";
|
|
13
14
|
import { ghRateLimitHint } from "./gh-rate-limit.js";
|
|
14
|
-
import { backgroundLifetimeNote, backgroundOutputFileNote,
|
|
15
|
+
import { backgroundLifetimeNote, backgroundOutputFileNote, ONE_SHOT_BACKGROUND_COMMAND_NOTE } from "./fs-bash-background-text.js";
|
|
15
16
|
import { admitsBackgroundLaunch, resolveCompletionSink } from "../../core/task-notification.js";
|
|
16
17
|
import { resolveBashTimeoutCaps, bashTimeoutCapsSec, bashTimeoutArgRefusal, bashTimeoutParamDescription, bashMaxOutputChars, clipShellOutput, writeShellOverflowFile, shellRecoveryHint, zeroOutputSentence, targetUnavailableCard, targetUnavailableSentence, bashFailureCard, CWD_SENTINEL, stripCwdSentinel, } from "./fs-shared.js";
|
|
17
18
|
import { envErrorDetail, failureMessageOnce } from "./env-error-detail.js";
|
|
@@ -323,13 +324,12 @@ async function runShell(env, cwd, toolName, command, timeoutSec, caps, signal, c
|
|
|
323
324
|
const live = onTick === undefined ? undefined : startLivenessTicks(onTick, cwdRef ? createEpilogueFilter(cwdMarker) : undefined);
|
|
324
325
|
let res;
|
|
325
326
|
try {
|
|
326
|
-
res = await env
|
|
327
|
+
res = await modelShellExec(env, toRun, readFloor, {
|
|
327
328
|
cwd: effectiveCwd,
|
|
328
329
|
timeout,
|
|
329
330
|
abortSignal: signal,
|
|
330
331
|
...execEnv,
|
|
331
332
|
...(live !== undefined ? { onStdout: live.onStdout, onStderr: live.onStderr } : {}),
|
|
332
|
-
...(readFloor !== undefined ? { readFloor } : {}),
|
|
333
333
|
...(sandboxStart?.ok === true && sandboxStart.sandbox !== undefined ? { sandbox: sandboxStart.sandbox } : {}),
|
|
334
334
|
...(detach
|
|
335
335
|
? {
|
|
@@ -557,8 +557,9 @@ export function createBashTool(env, rootCanonical, coAuthor = false, cwdRef = {
|
|
|
557
557
|
const timeoutCapsSecView = bashTimeoutCapsSec(timeoutCaps);
|
|
558
558
|
const refusalTold = new Set();
|
|
559
559
|
const breachLedger = execFailureBreachLedger();
|
|
560
|
-
const
|
|
561
|
-
const
|
|
560
|
+
const bgStarts = startsModelTextInBackground(env);
|
|
561
|
+
const bgOffered = bgStarts && taskOpts.taskRegistry !== undefined;
|
|
562
|
+
const bgRetained = bgStarts && retainsBackgroundProcesses({ env: envDeclaresRetain(env), task: taskOpts.retainBackgroundProcesses === true });
|
|
562
563
|
const bgSessionScoped = taskOpts.sessionId !== undefined && taskOpts.taskRegistry !== undefined;
|
|
563
564
|
const bgEnvIsolatedOwned = hasDestroy(env) && isIsolated(env);
|
|
564
565
|
const cardOf = (shellFirst) => bashDescription(coAuthor, timeoutCaps, bgOffered, bgRetained, bgSessionScoped, bgEnvIsolatedOwned, taskOpts.commandSandbox !== undefined ? "command" : isIsolated(env) ? "env" : "none", shellFirst);
|
|
@@ -605,14 +606,15 @@ export function createBashTool(env, rootCanonical, coAuthor = false, cwdRef = {
|
|
|
605
606
|
const timeoutRefusal = bashTimeoutArgRefusal(timeout, timeoutCaps);
|
|
606
607
|
if (timeoutRefusal !== undefined)
|
|
607
608
|
return errorResult(timeoutRefusal, { type: "bash_invalid_timeout", code: "bash_invalid_timeout" });
|
|
608
|
-
const refused = (await taskOpts.shellReadAdmission?.("Bash", ctx.toolCallId, command, ctx.signal)) ?? (await patternKillRefusal(command, env, cwdRef.current, ctx.signal));
|
|
609
|
+
const refused = refuseWithoutModelShell(env, run_in_background === true) ?? (await taskOpts.shellReadAdmission?.("Bash", ctx.toolCallId, command, ctx.signal)) ?? (await patternKillRefusal(command, env, cwdRef.current, ctx.signal));
|
|
609
610
|
if (refused !== undefined)
|
|
610
611
|
return refused;
|
|
611
612
|
if (run_in_background) {
|
|
612
613
|
const registry = taskOpts.taskRegistry;
|
|
613
614
|
const onNotify = resolveCompletionSink(ctx.onTaskNotification, taskOpts.onTaskNotification);
|
|
614
|
-
|
|
615
|
-
|
|
615
|
+
const start = modelShellOf(env);
|
|
616
|
+
if (!hasBackgroundShell(env) || !startsInBackground(start) || registry === undefined || !admitsBackgroundLaunch(onNotify))
|
|
617
|
+
return bashBackgroundUnavailable();
|
|
616
618
|
if (cwdRef && (await isDeadCwd(env, cwdRef.current, ctx.signal))) {
|
|
617
619
|
const diagnosis = await diagnoseDeadCwd(env, "Bash", cwdRef.current, rootCanonical, cwdRef, ctx.signal);
|
|
618
620
|
if (diagnosis !== undefined)
|
|
@@ -625,7 +627,7 @@ export function createBashTool(env, rootCanonical, coAuthor = false, cwdRef = {
|
|
|
625
627
|
const sandbox = taskOpts.commandSandbox?.start();
|
|
626
628
|
if (sandbox !== undefined && !sandbox.ok)
|
|
627
629
|
return errorResult(sandboxRefusalText("Bash", { by: "plan", reason: sandbox.reason }), { type: "bash", sandboxUnavailable: true });
|
|
628
|
-
const r = await
|
|
630
|
+
const r = await start.spawnBackground(command, {
|
|
629
631
|
cwd: cwdRef.current,
|
|
630
632
|
...(requestedTimeoutSec !== undefined ? { timeout: requestedTimeoutSec } : {}),
|
|
631
633
|
...(readFloor !== undefined ? { readFloor } : {}),
|
|
@@ -706,7 +708,7 @@ export function createBashTool(env, rootCanonical, coAuthor = false, cwdRef = {
|
|
|
706
708
|
backgroundedForQueuedMessage = true;
|
|
707
709
|
detachHub.request(ctx.toolCallId);
|
|
708
710
|
};
|
|
709
|
-
const detachEnv = hasBackgroundShell(env) ? env : undefined;
|
|
711
|
+
const detachEnv = bgStarts && hasBackgroundShell(env) ? env : undefined;
|
|
710
712
|
const detachSink = resolveCompletionSink(ctx.onTaskNotification, taskOpts.onTaskNotification);
|
|
711
713
|
const detachChain = detachHub !== undefined && detachRegistry !== undefined && detachEnv !== undefined && admitsBackgroundLaunch(detachSink) && detachEnv.backgroundCapabilities.supportsDetach === true
|
|
712
714
|
? {
|
|
@@ -844,7 +846,7 @@ export function createBashReadonlyTool(env, rootCanonical, allow, opts) {
|
|
|
844
846
|
const reason = readOnlyFaceRefusal(command, allow);
|
|
845
847
|
if (reason)
|
|
846
848
|
return errorResult(`Error (Bash): ${reason}`);
|
|
847
|
-
const refused = await opts?.shellReadAdmission?.("Bash", ctx.toolCallId, command, ctx.signal);
|
|
849
|
+
const refused = refuseWithoutModelShell(env, false) ?? (await opts?.shellReadAdmission?.("Bash", ctx.toolCallId, command, ctx.signal));
|
|
848
850
|
if (refused !== undefined)
|
|
849
851
|
return refused;
|
|
850
852
|
const readOnlyTick = opts?.onToolProgress === undefined ? undefined : (t) => describeSafely(opts.onToolProgress, { toolCallId: ctx.toolCallId, toolName: "Bash", ...t });
|
|
@@ -139,6 +139,7 @@ export function bare(r, provenance, spelled = r.folded) {
|
|
|
139
139
|
raw: r.raw,
|
|
140
140
|
provenance,
|
|
141
141
|
expands: r.expands,
|
|
142
|
+
...(r.bracket === true ? { bracket: true } : {}),
|
|
142
143
|
...(pattern !== undefined ? { pattern } : {}),
|
|
143
144
|
...(whole && r.homeFloor !== undefined ? { floorSpelled: r.homeFloor } : {}),
|
|
144
145
|
...(whole && r.floorValues !== undefined ? { floors: r.floorValues } : {}),
|
|
@@ -8,6 +8,7 @@ import { INLINE_TRUNCATION_MARK_CODEPOINTS, inlineUntrusted, PROBE_REASON_MAX }
|
|
|
8
8
|
import { NOT_AUTO_ALLOWED, declinedProgramReason } from "./bash-program-position.js";
|
|
9
9
|
import { bashClassifyDefaultAllow } from "./bash-readonly-classifier.js";
|
|
10
10
|
import { planShellReads } from "./shell-read-plan.js";
|
|
11
|
+
import { readStationAnswer } from "../../core/shell-read-silence.js";
|
|
11
12
|
import { createShellReadEstablisher, establishShellReadsLexically, writtenOnLineBefore } from "./shell-read-establish.js";
|
|
12
13
|
import { readLandingsOf } from "./shell-read-identity.js";
|
|
13
14
|
import { declaredReadDenyHomes, homeViewsAt } from "./read-deny-home.js";
|
|
@@ -554,6 +555,29 @@ async function applyRemovalSearch(judged, boundary, env, signal) {
|
|
|
554
555
|
const rewrite = (j) => ({ ...j, segments: j.segments.map((s) => ({ ...s, findings: s.findings.map((f) => answered.get(f) ?? f), nested: s.nested.map(rewrite) })) });
|
|
555
556
|
return rewrite(judged);
|
|
556
557
|
}
|
|
558
|
+
const holdsBracket = (c) => c.bracket === true;
|
|
559
|
+
const bracketCause = (spelled) => `"${spelled}" holds a bracket expression, which the shell matches by its own collation and options, so it may reach names this station does not list`;
|
|
560
|
+
function bracketWordsUnvouched(tool, seat, run, verdict) {
|
|
561
|
+
if (readStationAnswer(verdict, { toolName: tool }).kind !== "vouch")
|
|
562
|
+
return verdict;
|
|
563
|
+
const unread = new Map();
|
|
564
|
+
for (const f of allFindings(run.judged)) {
|
|
565
|
+
if (f.kind === "none" && holdsBracket(f.read.candidate))
|
|
566
|
+
unread.set(f, { ...f, kind: "unestablishable", read: { ...f.read, cause: bracketCause(f.read.candidate.spelled) } });
|
|
567
|
+
}
|
|
568
|
+
if (unread.size === 0)
|
|
569
|
+
return verdict;
|
|
570
|
+
const rewrite = (j) => ({ ...j, segments: j.segments.map((s) => ({ ...s, findings: s.findings.map((f) => unread.get(f) ?? f), nested: s.nested.map(rewrite) })) });
|
|
571
|
+
const judged = rewrite(run.judged);
|
|
572
|
+
const fold = foldShellReadFindings(judged);
|
|
573
|
+
if (fold.finding === "none")
|
|
574
|
+
return verdict;
|
|
575
|
+
const question = withReadAsk(verdictOf(tool, seat, fold, judged, run.boundary), judged);
|
|
576
|
+
if (question.disposition === "refuse")
|
|
577
|
+
return question;
|
|
578
|
+
const { disposition: _vouch, finding: _none, ...facts } = verdict;
|
|
579
|
+
return { ...facts, ...question };
|
|
580
|
+
}
|
|
557
581
|
async function runShellReadStation(tool, plan, declared, seat, establisher, env, signal) {
|
|
558
582
|
const door = observeEnvironment(env);
|
|
559
583
|
const established = await establisher.establish(plan, declared, signal, door);
|
|
@@ -584,12 +608,15 @@ export async function judgeShellRead(input) {
|
|
|
584
608
|
assertNoRetiredShellReadBoundaryKeys(input.boundary);
|
|
585
609
|
const readers = input.readers ?? new Set(bashClassifyDefaultAllow());
|
|
586
610
|
const plan = planShellReads(input.command, declarationsOf(input.boundary, readers, input.env.cdPath, input.env.receivedEnvNames));
|
|
587
|
-
const
|
|
588
|
-
const
|
|
611
|
+
const tool = input.tool ?? "Bash";
|
|
612
|
+
const seat = commandSeatOf(input.seat);
|
|
613
|
+
const run = await runShellReadStation(tool, plan, input.boundary, seat, createShellReadEstablisher(input.env, input.boundary.roots, { homeViews: homeViewsAt(input.env, input.readDenyHomes === undefined ? declaredReadDenyHomes(input.env) : checkedReadDenyHomes(input.readDenyHomes)) }), input.env, input.signal);
|
|
614
|
+
const verdict = bracketWordsUnvouched(tool, seat, run, run.verdict);
|
|
615
|
+
const offer = normalizeReadRootCandidate(verdict.readRootCandidate);
|
|
589
616
|
return {
|
|
590
617
|
plan: run.plan,
|
|
591
618
|
establishment: allFindings(run.judged).map((f) => f.read),
|
|
592
|
-
verdict
|
|
619
|
+
verdict,
|
|
593
620
|
...(offer !== undefined ? { offer } : {}),
|
|
594
621
|
};
|
|
595
622
|
}
|
|
@@ -653,12 +680,15 @@ export function createShellReadStation(opts) {
|
|
|
653
680
|
if (run.verdict.disposition !== "refuse" && callOpts.toolCallId !== undefined)
|
|
654
681
|
remember(callOpts.toolCallId, { toolName: member, boundary: run.boundary, established: run.established, command });
|
|
655
682
|
const verdict = opts.offersReadRootGrant === false ? withoutGrantOffer(run.verdict) : run.verdict;
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
683
|
+
const answered = (() => {
|
|
684
|
+
if (boundary.unreadPartitions !== true)
|
|
685
|
+
return verdict;
|
|
686
|
+
if (verdict.disposition !== "vouch")
|
|
687
|
+
return { ...verdict, rowsUnread: true };
|
|
688
|
+
const unread = unansweredOver(call.toolName, seat, "the rules this check stands on could not all be read", boundary, { rowsUnread: true });
|
|
689
|
+
return unread.disposition === "refuse" || verdict.askRule === undefined ? unread : { ...unread, askRule: verdict.askRule, ...(verdict.askRuleOfPolicy === true ? { askRuleOfPolicy: true } : {}) };
|
|
690
|
+
})();
|
|
691
|
+
return bracketWordsUnvouched(call.toolName, seat, run, answered);
|
|
662
692
|
})();
|
|
663
693
|
},
|
|
664
694
|
unanswered(call, cause) {
|
|
@@ -63,9 +63,8 @@ export interface ReadCandidate {
|
|
|
63
63
|
/** The raw spelling, quotes retained — where "is this metacharacter quoted" is still answerable. */
|
|
64
64
|
readonly raw: string;
|
|
65
65
|
readonly provenance: ReadCandidateProvenance;
|
|
66
|
-
/** `"glob"` = an unquoted pathname-expansion character; `"unresolvable"` = the shell rewrites the word
|
|
67
|
-
|
|
68
|
-
readonly expands: false | "glob" | "unresolvable";
|
|
66
|
+
/** `"glob"` = an unquoted pathname-expansion character; `"unresolvable"` = the shell rewrites the word (brace/variable/command substitution) so its text is not the path. */ readonly expands: false | "glob" | "unresolvable";
|
|
67
|
+
/** The shell matches this word as a pathname pattern holding a BRACKET expression — an unquoted `[` with an unquoted `]` after it, written in the word itself or in the pattern a value hands over (an unquoted expansion's value; a name a `for` list, `set --` or an array bound to a pattern's matches); never beside `expands: false`, and only on a word of the shell's own text (a name inside a program's script, an assignment's value and a field a split value hands over carry none). Absent ⇒ no such bracket. */ readonly bracket?: true;
|
|
69
68
|
/** The working directories this word may be relative to (a candidate SET where a `cd` could not be proven);
|
|
70
69
|
* EMPTY for an absolute or home-rooted spelling; `"unmodelled"` for a relative word in a segment whose base the
|
|
71
70
|
* text does not settle (an unfollowable move before it, a loop this parser cannot count) — it cannot be placed. */
|
|
@@ -889,14 +889,17 @@ function segmentFactsRead(segment, p, decl, table, nestedPlan, fed, toks, inheri
|
|
|
889
889
|
});
|
|
890
890
|
}
|
|
891
891
|
function dedupe(reads) {
|
|
892
|
-
const
|
|
892
|
+
const at = new Map();
|
|
893
893
|
const out = [];
|
|
894
894
|
for (const c of reads) {
|
|
895
895
|
const key = `${c.provenance}\u0000${c.spelled}\u0000${c.expands}\u0000${c.raw}\u0000${c.denyOnly === true}`;
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
896
|
+
const i = at.get(key);
|
|
897
|
+
if (i === undefined) {
|
|
898
|
+
at.set(key, out.length);
|
|
899
|
+
out.push(c);
|
|
900
|
+
}
|
|
901
|
+
else if (c.bracket === true && out[i].bracket !== true)
|
|
902
|
+
out[i] = { ...out[i], bracket: true };
|
|
900
903
|
}
|
|
901
904
|
return out;
|
|
902
905
|
}
|
|
@@ -21,6 +21,10 @@ export interface Read {
|
|
|
21
21
|
* any one character — {@link LexedWord.judged}, {@link judgedSpellingOf}); `folded` stays the name opened where none match. */
|
|
22
22
|
readonly pattern?: string;
|
|
23
23
|
readonly expands: WordExpands;
|
|
24
|
+
/** The shell matches the word as a pattern holding a bracket expression ({@link import("./shell-read-plan.js").ReadCandidate.bracket}):
|
|
25
|
+
* read off the word's own pieces ({@link bracketInWord}) and off the pattern runs of the values its names hand over
|
|
26
|
+
* ({@link bracketInValue}). Absent ⇒ none, or not a word of the shell's own text ({@link readOfText}). */
|
|
27
|
+
readonly bracket?: true;
|
|
24
28
|
/** The names the word refers to were read through the table: its expansion IS the spelling above (and, where the
|
|
25
29
|
* names may hold several values, {@link values}). */
|
|
26
30
|
readonly settled?: true;
|
|
@@ -123,6 +127,10 @@ export declare function spelledWithHome(spelled: string, raw: string, home: stri
|
|
|
123
127
|
* arithmetic expression (`$((2*(3+4)))`), which bash evaluates and never globs. An assignment word is read as the words it
|
|
124
128
|
* stores ({@link assignedWords}): a compound value's elements each as the scalar assignment of the same text. */
|
|
125
129
|
export declare function unreadableSentenceOf(lexed: LexedCommand, text: string, globs?: boolean): string | undefined;
|
|
130
|
+
/** Does a value hand the shell a pattern holding a bracket expression — a run the shell matches as a pattern (a part marked
|
|
131
|
+
* `pattern`: an unquoted expansion's text, a pattern piece as written, a `for` list's or an array's pattern) with a `[` and a
|
|
132
|
+
* `]` after it? A quoted run is literal text and holds none. */
|
|
133
|
+
export declare function bracketInValue(v: BoundValue): boolean;
|
|
126
134
|
/** The mark a settled value carries: `"glob"` when an unquoted pathname-expansion character survives in it. */
|
|
127
135
|
export declare function globMark(glob: boolean): WordExpands;
|
|
128
136
|
/** What the shell does to a word (or an assignment's value) before the program sees it, read off its pieces: the
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
import { argvOf, assignedWords, lexShell, literalTildeSpelling, UNRESOLVED_SENTENCE } from "../../shell/lex.js";
|
|
2
|
-
import { expansionInWord, extglobOpenerIn, globInWord, homeExpansionOf } from "./bash-readonly-classifier.js";
|
|
2
|
+
import { bracketInWord, expansionInWord, extglobOpenerIn, globInWord, homeExpansionOf } from "./bash-readonly-classifier.js";
|
|
3
3
|
import { floorOf, isEmptyFloor, joinFloors, judgedSpellingOf, NO_FLOOR, namesIn, wordFloorValues, wordValues } from "./shell-read-bindings.js";
|
|
4
4
|
import { READINGS_MAX } from "./shell-read-brace.js";
|
|
5
5
|
export function readsOf(words, table, homeDir, split = false) {
|
|
6
6
|
return words.map((word) => {
|
|
7
7
|
const refersToName = word.pieces.some((p) => p.expansion?.kind === "parameter") || namesIn(word).length > 0;
|
|
8
8
|
const asWritten = { word, raw: word.raw, folded: word.folded, ...(word.judged !== undefined ? { pattern: word.judged } : {}) };
|
|
9
|
+
const written = () => {
|
|
10
|
+
const expands = expandsOf(word);
|
|
11
|
+
return { expands, ...(expands !== "unresolvable" && bracketInWord(word) ? { bracket: true } : {}) };
|
|
12
|
+
};
|
|
9
13
|
if (!refersToName && table?.homeTouched !== true)
|
|
10
|
-
return { ...asWritten,
|
|
14
|
+
return { ...asWritten, ...written() };
|
|
11
15
|
const values = wordValues(word, table, false, undefined, split);
|
|
12
16
|
if (values === undefined)
|
|
13
|
-
return { ...asWritten,
|
|
17
|
+
return { ...asWritten, ...written() };
|
|
14
18
|
if (values === "unknown") {
|
|
15
19
|
const floor = refersToName ? wordFloorValues(word, table) : NO_FLOOR;
|
|
16
|
-
return { ...asWritten,
|
|
20
|
+
return { ...asWritten, ...(refersToName ? { expands: "unresolvable" } : written()), ...(floor.values.length > 0 ? { floorValues: floor.values } : {}), ...(floor.pastBound ? { floorPastBound: true } : {}) };
|
|
17
21
|
}
|
|
18
22
|
const glob = values.some((v) => v.glob === true) || globInWord(word);
|
|
23
|
+
const bracket = glob && (bracketInWord(word) || values.some(bracketInValue));
|
|
19
24
|
const refersToHome = word.pieces.some((p) => p.expansion?.kind === "tilde" || (p.expansion?.kind === "parameter" && p.expansion.name === "HOME"));
|
|
20
25
|
const declared = refersToHome && homeDir !== undefined && table?.homeTouched === true ? wordValues(word, table, false, new Map([["HOME", [{ spelled: homeDir }]]])) : undefined;
|
|
21
26
|
const floor = declared !== undefined && declared !== "unknown" && declared[0] !== undefined ? spellingOf(declared[0]) : undefined;
|
|
@@ -26,6 +31,7 @@ export function readsOf(words, table, homeDir, split = false) {
|
|
|
26
31
|
folded: spellingOf(values[0]),
|
|
27
32
|
...(pattern !== undefined ? { pattern } : {}),
|
|
28
33
|
expands: globMark(glob),
|
|
34
|
+
...(bracket ? { bracket: true } : {}),
|
|
29
35
|
settled: true,
|
|
30
36
|
values,
|
|
31
37
|
...(floor !== undefined && !values.every((v) => spellingOf(v) === floor) ? { homeFloor: floor } : {}),
|
|
@@ -160,6 +166,9 @@ export function unreadableSentenceOf(lexed, text, globs = true) {
|
|
|
160
166
|
}
|
|
161
167
|
return globs && extglobOpenerIn(lexed, text) ? "an extended pattern (`?(…)` `*(…)` `+(…)` `@(…)` `!(…)`) is one this reader does not expand" : undefined;
|
|
162
168
|
}
|
|
169
|
+
export function bracketInValue(v) {
|
|
170
|
+
return v.glob === true && v.parts.some((p) => p.pattern && /\[[\s\S]*\]/.test(p.text));
|
|
171
|
+
}
|
|
163
172
|
export function globMark(glob) {
|
|
164
173
|
return glob ? "glob" : false;
|
|
165
174
|
}
|
package/dist/tools/monitor.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
2
|
import { defineTool, errorResult } from "../core/tools.js";
|
|
3
|
-
import { createBackgroundOutputFile, envDeclaresRetain, hasBackgroundShell, retainsBackgroundProcesses } from "../core/background-shell.js";
|
|
3
|
+
import { BackgroundShellError, createBackgroundOutputFile, envDeclaresRetain, hasBackgroundShell, retainsBackgroundProcesses } from "../core/background-shell.js";
|
|
4
|
+
import { MODEL_SHELL_UNDECLARED_REFUSAL, modelShellOf, startsInBackground } from "../core/model-shell.js";
|
|
4
5
|
import { MONITOR_DEFAULT_TIMEOUT_MS, MONITOR_MAX_TIMEOUT_MS, } from "../core/task-registry.js";
|
|
5
6
|
import { admitsBackgroundLaunch, resolveCompletionSink } from "../core/task-notification.js";
|
|
6
7
|
import { toolFace } from "../core/tool-catalog-entries.js";
|
|
@@ -70,7 +71,8 @@ export function createMonitorTool(env, opts) {
|
|
|
70
71
|
}),
|
|
71
72
|
execute: async (args, ctx) => {
|
|
72
73
|
const { command, description, timeout_ms, persistent } = args;
|
|
73
|
-
|
|
74
|
+
const start = modelShellOf(env);
|
|
75
|
+
if (!hasBackgroundShell(env) || (start !== undefined && !startsInBackground(start))) {
|
|
74
76
|
return errorResult("Error (Monitor): this environment does not support background processes.");
|
|
75
77
|
}
|
|
76
78
|
const onNotify = resolveCompletionSink(ctx.onTaskNotification, opts.onTaskNotification);
|
|
@@ -93,12 +95,14 @@ export function createMonitorTool(env, opts) {
|
|
|
93
95
|
const sandbox = opts.commandSandbox?.start();
|
|
94
96
|
if (sandbox !== undefined && !sandbox.ok)
|
|
95
97
|
return errorResult(sandboxRefusalText("Monitor", { by: "plan", reason: sandbox.reason }), { type: "monitor-start", sandboxUnavailable: true });
|
|
96
|
-
const spawn =
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
const spawn = startsInBackground(start)
|
|
99
|
+
? await start.spawnBackground(command, {
|
|
100
|
+
...(opts.cwdRef !== undefined ? { cwd: opts.cwdRef.current } : {}),
|
|
101
|
+
...(spawnTimeoutSec !== undefined ? { timeout: spawnTimeoutSec } : {}),
|
|
102
|
+
...(readFloor !== undefined ? { readFloor } : {}),
|
|
103
|
+
...(sandbox?.sandbox !== undefined ? { sandbox: sandbox.sandbox } : {}),
|
|
104
|
+
})
|
|
105
|
+
: { ok: false, error: new BackgroundShellError("spawn_failed", MODEL_SHELL_UNDECLARED_REFUSAL) };
|
|
102
106
|
if (!spawn.ok) {
|
|
103
107
|
if (spawn.error.code === "sandbox_unavailable") {
|
|
104
108
|
const detail = envErrorDetail(spawn.error.message);
|
|
@@ -96,6 +96,7 @@ export declare function cutToUnits(text: string, limit: number): string;
|
|
|
96
96
|
* cron → 人话(CC utils/cron.ts cronToHuman:218-308 类比,收窄到常见形态):"star/N * * * *"→"every N minutes"、
|
|
97
97
|
* "M star/N * * *"→"every N hours"、`M H * * *`→"daily at H:MM"、`M H * * D`→"weekly on <day> at H:MM"、
|
|
98
98
|
* `M H * * 1-5`→"weekdays at H:MM";其余原样返回(调用方以 `human !== expr` 判断是否可译);收 backend 的 `cron <expr>` 显示串(见 {@link cronExprFromSummary})。
|
|
99
|
+
* 只译引擎文法收的表达式({@link isValidCronExpr}):文法拒的串(分钟 61、小时 25、星期 8)原样返回,不给假人话。
|
|
99
100
|
*/
|
|
100
101
|
export declare function cronToHuman(expr: string): string;
|
|
101
102
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
2
|
import { defineTool, errorResult } from "../core/tools.js";
|
|
3
|
-
import { CRON_FIELD_SEPARATOR, cronIntakeRefusal } from "../core/cron.js";
|
|
3
|
+
import { CRON_FIELD_SEPARATOR, cronIntakeRefusal, isValidCronExpr } from "../core/cron.js";
|
|
4
4
|
import { declaresLaneKeys, describeScopeKeys, readSchedulerDeclaration, SchedulerError, } from "../core/scheduler.js";
|
|
5
5
|
import { mountRuleFace, toolFace } from "../core/tool-catalog-entries.js";
|
|
6
6
|
import { legIdentityOf, scopeKeyOf } from "../core/isolation-scope.js";
|
|
@@ -206,7 +206,10 @@ function promptGlimpse(text) {
|
|
|
206
206
|
return end === -1 ? cutToUnits(text, PROMPT_GLIMPSE_UNITS) : cutToUnits(`${text.slice(0, end)}…`, PROMPT_GLIMPSE_UNITS);
|
|
207
207
|
}
|
|
208
208
|
export function cronToHuman(expr) {
|
|
209
|
-
const
|
|
209
|
+
const bare = cronExprFromSummary(expr);
|
|
210
|
+
if (!isValidCronExpr(bare))
|
|
211
|
+
return expr;
|
|
212
|
+
const std = bare.split(CRON_FIELD_SEPARATOR);
|
|
210
213
|
if (std.length !== 5)
|
|
211
214
|
return expr;
|
|
212
215
|
const [minute = "", hour = "", dom = "", month = "", dow = ""] = std;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/core",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.74.0",
|
|
4
4
|
"description": "Stateless, task-oriented AI agent core",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BUSL-1.1",
|
|
@@ -110,6 +110,7 @@
|
|
|
110
110
|
"gate:tool-names": "node scripts/verify-tool-name-tables.mjs",
|
|
111
111
|
"gate:name-readings": "node scripts/verify-name-readings.mjs",
|
|
112
112
|
"gate:tool-docs": "node scripts/gen-tool-spec-fields.mjs --check",
|
|
113
|
+
"gate:kernel-digest": "node scripts/gen-kernel-digest.mjs --check",
|
|
113
114
|
"gate:prompt-docs": "node scripts/gen-prompt-docs.mjs --check",
|
|
114
115
|
"gen:prompt-docs": "node scripts/gen-prompt-docs.mjs",
|
|
115
116
|
"gate:backlog-ledger": "node scripts/verify-backlog-ledger.mjs",
|
|
@@ -141,7 +142,7 @@
|
|
|
141
142
|
"dependencies": {
|
|
142
143
|
"@modelcontextprotocol/client": "2.4.0",
|
|
143
144
|
"@modelcontextprotocol/core": "2.4.0",
|
|
144
|
-
"@sema-agent/primitives": "7.
|
|
145
|
+
"@sema-agent/primitives": "7.74.0",
|
|
145
146
|
"typebox": "1.1.39",
|
|
146
147
|
"undici": "7.30.2"
|
|
147
148
|
},
|