@wrongstack/core 0.283.0 → 0.284.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/dist/{compactor-BxddyCFu.d.ts → compactor-DQLL4HTo.d.ts} +1 -1
- package/dist/{config-DkCbA3Bw.d.ts → config-MRqn1V-u.d.ts} +130 -22
- package/dist/coordination/index.d.ts +43 -20
- package/dist/coordination/index.js +1744 -912
- package/dist/coordination/index.js.map +1 -1
- package/dist/{default-config-Buho8yge.d.ts → default-config-B79_gJYv.d.ts} +7 -0
- package/dist/defaults/index.d.ts +25 -29
- package/dist/defaults/index.js +2546 -7396
- package/dist/defaults/index.js.map +1 -1
- package/dist/{director-state-B_GPa78Q.d.ts → director-state-CMS_bMs4.d.ts} +2 -0
- package/dist/{events-KmxSmvho.d.ts → events-Bgnh43r9.d.ts} +27 -10
- package/dist/execution/index.d.ts +15 -16
- package/dist/execution/index.js +534 -140
- package/dist/execution/index.js.map +1 -1
- package/dist/execution/prompt-enhancer.d.ts +1 -1
- package/dist/extension/index.d.ts +6 -6
- package/dist/{global-mailbox-rWVt8YlO.d.ts → global-mailbox-sZwyI6CS.d.ts} +13 -2
- package/dist/{goal-store-8owBXJT2.d.ts → goal-store-Datpp-ar.d.ts} +1 -1
- package/dist/hq/index.d.ts +35 -9
- package/dist/hq/index.js +80 -7
- package/dist/hq/index.js.map +1 -1
- package/dist/{index-BhCteHAF.d.ts → index--Gm41aBJ.d.ts} +26 -11
- package/dist/{index-BEFWNZYs.d.ts → index-CbyuOE5y.d.ts} +5 -1
- package/dist/index.d.ts +52 -1017
- package/dist/index.js +21053 -27778
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/index.d.ts +9 -7
- package/dist/infrastructure/index.js +7 -2
- package/dist/infrastructure/index.js.map +1 -1
- package/dist/kernel/index.d.ts +11 -11
- package/dist/kernel/index.js.map +1 -1
- package/dist/{mcp-servers-BUx9A_AQ.d.ts → mcp-servers-DEV4s6Ks.d.ts} +3 -3
- package/dist/models/index.d.ts +4 -4
- package/dist/models/index.js +18 -3
- package/dist/models/index.js.map +1 -1
- package/dist/{agent-subagent-runner-BsuWhB28.d.ts → multi-agent-coordinator-4RCRZKjN.d.ts} +417 -9
- package/dist/{null-fleet-bus-D4e9R7Qc.d.ts → null-fleet-bus-CFoNVQEK.d.ts} +53 -12
- package/dist/observability/index.d.ts +3 -3
- package/dist/{parallel-eternal-engine-iY2uxocj.d.ts → parallel-eternal-engine-HUrtePLd.d.ts} +4 -5
- package/dist/{permission-B6YAtNFz.d.ts → permission-ByDKXEcG.d.ts} +1 -1
- package/dist/{pipeline-ixSFe5jg.d.ts → pipeline-DGDyIohT.d.ts} +28 -7
- package/dist/{provider-model-resolve-DIxKL_T-.d.ts → provider-model-resolve-o2hHLs79.d.ts} +3 -3
- package/dist/{provider-runner-oQhDaZmH.d.ts → provider-runner-ChL-kVg6.d.ts} +3 -3
- package/dist/{retry-policy-V67lBOJz.d.ts → retry-policy-CQ7KwXJa.d.ts} +2 -2
- package/dist/{secret-vault-D7jeyXUQ.d.ts → secret-vault-DxohkUBc.d.ts} +3 -2
- package/dist/security/index.d.ts +4 -4
- package/dist/security/index.js +232 -2
- package/dist/security/index.js.map +1 -1
- package/dist/{selector-Bx2HgUkU.d.ts → selector-D8O6B_Rm.d.ts} +1 -1
- package/dist/{session-event-bridge-Bkp7ORfc.d.ts → session-event-bridge-D_z_mBwk.d.ts} +3 -3
- package/dist/{session-reader-B-Fi9L6I.d.ts → session-reader-7Esxrkpw.d.ts} +1 -1
- package/dist/storage/index.d.ts +77 -39
- package/dist/storage/index.js +1223 -288
- package/dist/storage/index.js.map +1 -1
- package/dist/tasking/index.d.ts +124 -0
- package/dist/tasking/index.js +492 -0
- package/dist/tasking/index.js.map +1 -0
- package/dist/{todos-checkpoint-BwCrj4Cb.d.ts → todos-checkpoint-FY7PjmMx.d.ts} +13 -4
- package/dist/{tool-LVSLiE1s.d.ts → tool-BNlnIJvo.d.ts} +216 -17
- package/dist/{tool-executor-kElSEgO0.d.ts → tool-executor-CckSCM5E.d.ts} +12 -15
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/index.js.map +1 -1
- package/dist/types/index.d.ts +94 -19
- package/dist/types/index.js +76 -12
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.d.ts +44 -10
- package/dist/utils/index.js +106 -17
- package/dist/utils/index.js.map +1 -1
- package/dist/{worktree-manager-BjyAW30D.d.ts → worktree-manager-DzwxKE35.d.ts} +1 -1
- package/instructions/coordination/subagent-baseline.md +5 -0
- package/instructions/llm/autonomy-brain.md +3 -2
- package/instructions/system.md +4 -0
- package/package.json +10 -3
- package/skills/mailbox-bridge/SKILL.md +33 -0
- package/dist/multi-agent-coordinator-CrjeTB9i.d.ts +0 -357
- package/dist/sdd/index.d.ts +0 -1993
- package/dist/sdd/index.js +0 -9500
- package/dist/sdd/index.js.map +0 -1
- package/dist/spec-TBi3Jr6T.d.ts +0 -78
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { M as Message,
|
|
1
|
+
import { M as Message, H as CompletedWorkSource, d as Context, s as TextBlock, K as ContextEvidenceState, G as CompletedWorkEvidence, o as ToolOutputMetadata, J as JSONSchema, A as TodoItem, g as Tool } from '../tool-BNlnIJvo.js';
|
|
2
2
|
export { H as HttpDispatcher, a as HttpsAgentAsDispatcher } from '../dispatcher-types.d-BBeXBQgS.js';
|
|
3
3
|
export { toErrorMessage } from './error.js';
|
|
4
4
|
export { expectDefined } from './expect-defined.js';
|
|
5
|
-
import {
|
|
5
|
+
import { E as CustomModelDefinition, c as ModelsDevPayload, ac as ToolDescriptionMode, ad as ToolDescriptionModeConfig, T as ToolResultRenderMode, ae as ToolResultRenderModeConfig } from '../config-MRqn1V-u.js';
|
|
6
6
|
export { T as TaskItem, c as computeTaskItemProgress, f as formatTaskList, a as formatTaskProgress } from '../task-format-GX0B1mMC.js';
|
|
7
7
|
export { a as WstackPathOptions, W as WstackPaths, p as projectHash, b as projectSlug, r as resolveWstackPaths, w as wstackGlobalRoot } from '../wstack-paths-C3K40Qst.js';
|
|
8
8
|
export { a as TaskPriority, b as TaskStatus, T as TaskType } from '../task-graph-CH3acNQ7.js';
|
|
@@ -254,19 +254,20 @@ interface RecordCompletedWorkInput {
|
|
|
254
254
|
completedAt?: number | undefined;
|
|
255
255
|
}
|
|
256
256
|
/**
|
|
257
|
-
* Append one finished unit of work to the session ledger
|
|
258
|
-
*
|
|
259
|
-
*
|
|
257
|
+
* Append one finished unit of work to the session ledger. The provider request
|
|
258
|
+
* composer renders this state as a volatile tail block; the stable system-prompt
|
|
259
|
+
* prefix is never mutated here.
|
|
260
260
|
*/
|
|
261
261
|
declare function recordCompletedWorkEvidence(ctx: Context, input: RecordCompletedWorkInput): CompletedWorkEvidence;
|
|
262
262
|
/** Render the ledger's system-prompt block text (marker + newest entries). */
|
|
263
263
|
declare function formatCompletedWorkLedger(items: readonly CompletedWorkEvidence[]): string;
|
|
264
|
+
/** Build the current volatile completed-work block without mutating the prompt. */
|
|
265
|
+
declare function buildCompletedWorkLedgerBlock(ctx: Context): TextBlock | undefined;
|
|
264
266
|
/**
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
* ledger mutation.
|
|
267
|
+
* @deprecated Volatile state must be composed at request time. Kept as a
|
|
268
|
+
* compatibility no-op for embedders importing the old helper.
|
|
268
269
|
*/
|
|
269
|
-
declare function syncCompletedWorkLedgerBlock(
|
|
270
|
+
declare function syncCompletedWorkLedgerBlock(_ctx: Context): void;
|
|
270
271
|
|
|
271
272
|
/**
|
|
272
273
|
* Deep merge utility — safely merges nested objects with configurable
|
|
@@ -434,6 +435,27 @@ interface ValidationResult {
|
|
|
434
435
|
errors: ValidationError[];
|
|
435
436
|
}
|
|
436
437
|
declare function validateAgainstSchema(value: unknown, schema: JSONSchema): ValidationResult;
|
|
438
|
+
interface CoercionResult {
|
|
439
|
+
value: unknown;
|
|
440
|
+
/** True when at least one leaf was rewritten. */
|
|
441
|
+
changed: boolean;
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Best-effort, lossless coercion of a value toward a JSON Schema. Models —
|
|
445
|
+
* especially through OpenAI-compatible proxies — frequently deliver
|
|
446
|
+
* arguments with the right *content* in the wrong *type*: numbers and
|
|
447
|
+
* booleans encoded as strings ("5", "true"), scalars where a string is
|
|
448
|
+
* expected, or a whole nested object serialized into a JSON string.
|
|
449
|
+
*
|
|
450
|
+
* Only conversions that cannot lose information are applied:
|
|
451
|
+
* - string → number/integer when the whole trimmed string parses cleanly
|
|
452
|
+
* - string "true"/"false" → boolean
|
|
453
|
+
* - number/boolean → string when a string is expected
|
|
454
|
+
* - JSON-serialized string → object/array when the parse yields that shape
|
|
455
|
+
* Recurses into `properties`/`items`. Returns the (possibly new) value and
|
|
456
|
+
* whether anything changed — callers should re-validate before trusting it.
|
|
457
|
+
*/
|
|
458
|
+
declare function coerceAgainstSchema(value: unknown, schema: JSONSchema): CoercionResult;
|
|
437
459
|
|
|
438
460
|
/**
|
|
439
461
|
* Merge per-provider `customModels` into top-level `configModels`.
|
|
@@ -530,6 +552,18 @@ declare function safeStringify(value: unknown, pretty?: boolean): string;
|
|
|
530
552
|
* raw handling.
|
|
531
553
|
*/
|
|
532
554
|
declare function sanitizeJsonString(s: string): string | null;
|
|
555
|
+
/**
|
|
556
|
+
* Strip a Markdown code-fence wrapper from a payload.
|
|
557
|
+
*
|
|
558
|
+
* Models occasionally return tool-call arguments wrapped in ```json fences
|
|
559
|
+
* (or embedded in prose around one) instead of bare JSON. Returns the inner
|
|
560
|
+
* content when the input starts with a fence (closing fence optional, so a
|
|
561
|
+
* truncated stream still unwraps) or contains one complete fenced block;
|
|
562
|
+
* returns null when no fence is present. Callers should only invoke this
|
|
563
|
+
* after a direct parse failed, so fences inside legitimate string values are
|
|
564
|
+
* never touched.
|
|
565
|
+
*/
|
|
566
|
+
declare function stripCodeFences(s: string): string | null;
|
|
533
567
|
|
|
534
568
|
/**
|
|
535
569
|
* Resolve `<dir>/<sessionId><suffix>` for per-session sidecar files
|
|
@@ -884,4 +918,4 @@ interface CompactWireToolDefinition {
|
|
|
884
918
|
declare function compactToolDefinitionForWire(tool: ToolWireDefinitionLike, opts?: CompactToolDefinitionForWireOptions): CompactWireToolDefinition;
|
|
885
919
|
declare function compactSchemaDescriptions(schema: unknown, maxDescriptionChars?: number): Record<string, unknown>;
|
|
886
920
|
|
|
887
|
-
export { type AtomicWriteOptions, type BuildChildEnvOptions, COMPLETED_WORK_LEDGER_MARKER, type CompactToolDefinitionForWireOptions, type CompactWireToolDefinition, type CompileFail, type CompileResult, DEFAULT_TOOL_DESCRIPTION_MODE, DEFAULT_TOOL_RESULT_RENDER_MODE, type DeepMergeOptions, FORBIDDEN_PROTO_KEYS, type FileLockOptions, type JsonObject, type JsonPath, type JsonPathSegment, type MessageRepairReport, type MessageRepairResult, type NewlineStyle, type OutputLineGuard, type RecordCompletedWorkInput, type RecordToolOutputEvidenceInput, type RequestTokenBreakdown, type SafeParseResult, type ToolDescriptionRegistryLike, type ToolOutputSerializerOptions, type ToolResultRenderModeRegistryLike, type ToolWireDefinitionLike, type UnifiedDiffOptions, type ValidationError, type ValidationResult, applyToolDescriptionModeToTool, applyToolDescriptionModes, applyToolResultRenderModes, assertNever, assertNotPrivateHost, atomicWrite, buildChildEnv, buildContextEvidenceDigest, color, compactSchemaDescriptions, compactToolDefinitionForWire, compileGlob, compileUserRegex, completePartialObject, computeMessageTokens, createContextEvidenceState, createToolOutputSerializer, deepMerge, detectNewlineStyle, ensureDir, escapeGlobSubject, estimateMessageTokens, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob, expandIPv6, formatCompletedWorkLedger, formatTodosList, getCalibrationState, getJsonPath, getTermSize, getToolDescriptionMode, getToolResultRenderMode, hasOpenTodos, isInteractive, isJsonObject, isPathSubjectKey, isPrimitiveArray, isPrivateIPv4, isPrivateIPv6, isStdinTTY, isStdoutTTY, isUlid, jsonObjectFileExists, markAssistantReferencedEvidence, matchAny, matchGlob, mergeCustomModelDefs, mergeModelsPayload, normalizePathSubject, normalizeToLf, normalizeToolDescriptionMode, normalizeToolResultRenderMode, onResize, readJsonObjectFile, recordActualUsage, recordCompletedWorkEvidence, recordToolOutputEvidence, recordUserIntentEvidence, removeJsonPath, removeJsonPathInFile, repairToolUseAdjacency, repeatedReadPressure, resetCalibration, resolveToolDescriptionMode, resolveToolResultRenderMode, safeParse, safeStringify, sanitizeJsonString, sanitizeNodeOptions, sessionScopedPath, setJsonPath, setJsonPathInFile, setOutputLineGuard, setRawMode, setToolDescriptionMode, setToolResultRenderMode, simplifyToolDescription, sleep, slugify, stripAnsi, subjectForToolInput, syncCompletedWorkLedgerBlock, toStyle, truncate, ulid, unifiedDiff, updateJsonObjectFile, validateAgainstSchema, withFileLock, writeErr, writeJsonObjectFile, writeOut };
|
|
921
|
+
export { type AtomicWriteOptions, type BuildChildEnvOptions, COMPLETED_WORK_LEDGER_MARKER, type CoercionResult, type CompactToolDefinitionForWireOptions, type CompactWireToolDefinition, type CompileFail, type CompileResult, DEFAULT_TOOL_DESCRIPTION_MODE, DEFAULT_TOOL_RESULT_RENDER_MODE, type DeepMergeOptions, FORBIDDEN_PROTO_KEYS, type FileLockOptions, type JsonObject, type JsonPath, type JsonPathSegment, type MessageRepairReport, type MessageRepairResult, type NewlineStyle, type OutputLineGuard, type RecordCompletedWorkInput, type RecordToolOutputEvidenceInput, type RequestTokenBreakdown, type SafeParseResult, type ToolDescriptionRegistryLike, type ToolOutputSerializerOptions, type ToolResultRenderModeRegistryLike, type ToolWireDefinitionLike, type UnifiedDiffOptions, type ValidationError, type ValidationResult, applyToolDescriptionModeToTool, applyToolDescriptionModes, applyToolResultRenderModes, assertNever, assertNotPrivateHost, atomicWrite, buildChildEnv, buildCompletedWorkLedgerBlock, buildContextEvidenceDigest, coerceAgainstSchema, color, compactSchemaDescriptions, compactToolDefinitionForWire, compileGlob, compileUserRegex, completePartialObject, computeMessageTokens, createContextEvidenceState, createToolOutputSerializer, deepMerge, detectNewlineStyle, ensureDir, escapeGlobSubject, estimateMessageTokens, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob, expandIPv6, formatCompletedWorkLedger, formatTodosList, getCalibrationState, getJsonPath, getTermSize, getToolDescriptionMode, getToolResultRenderMode, hasOpenTodos, isInteractive, isJsonObject, isPathSubjectKey, isPrimitiveArray, isPrivateIPv4, isPrivateIPv6, isStdinTTY, isStdoutTTY, isUlid, jsonObjectFileExists, markAssistantReferencedEvidence, matchAny, matchGlob, mergeCustomModelDefs, mergeModelsPayload, normalizePathSubject, normalizeToLf, normalizeToolDescriptionMode, normalizeToolResultRenderMode, onResize, readJsonObjectFile, recordActualUsage, recordCompletedWorkEvidence, recordToolOutputEvidence, recordUserIntentEvidence, removeJsonPath, removeJsonPathInFile, repairToolUseAdjacency, repeatedReadPressure, resetCalibration, resolveToolDescriptionMode, resolveToolResultRenderMode, safeParse, safeStringify, sanitizeJsonString, sanitizeNodeOptions, sessionScopedPath, setJsonPath, setJsonPathInFile, setOutputLineGuard, setRawMode, setToolDescriptionMode, setToolResultRenderMode, simplifyToolDescription, sleep, slugify, stripAnsi, stripCodeFences, subjectForToolInput, syncCompletedWorkLedgerBlock, toStyle, truncate, ulid, unifiedDiff, updateJsonObjectFile, validateAgainstSchema, withFileLock, writeErr, writeJsonObjectFile, writeOut };
|
package/dist/utils/index.js
CHANGED
|
@@ -680,7 +680,6 @@ function recordCompletedWorkEvidence(ctx, input) {
|
|
|
680
680
|
state.completedWork.splice(0, state.completedWork.length - MAX_COMPLETED_WORK);
|
|
681
681
|
}
|
|
682
682
|
state.updatedAt = Date.now();
|
|
683
|
-
syncCompletedWorkLedgerBlock(ctx);
|
|
684
683
|
return entry;
|
|
685
684
|
}
|
|
686
685
|
function formatCompletedWorkLedger(items) {
|
|
@@ -691,18 +690,16 @@ function formatCompletedWorkLedger(items) {
|
|
|
691
690
|
Work already completed this session \u2014 do not redo it; build on it:
|
|
692
691
|
` + lines.join("\n");
|
|
693
692
|
}
|
|
694
|
-
function
|
|
695
|
-
const
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
if (idx >= 0) ctx.systemPrompt[idx] = block;
|
|
705
|
-
else ctx.systemPrompt.push(block);
|
|
693
|
+
function buildCompletedWorkLedgerBlock(ctx) {
|
|
694
|
+
const items = ensureEvidence(ctx).completedWork;
|
|
695
|
+
if (items.length === 0) return void 0;
|
|
696
|
+
return {
|
|
697
|
+
type: "text",
|
|
698
|
+
text: formatCompletedWorkLedger(items),
|
|
699
|
+
cache_control: { type: "ephemeral" }
|
|
700
|
+
};
|
|
701
|
+
}
|
|
702
|
+
function syncCompletedWorkLedgerBlock(_ctx) {
|
|
706
703
|
}
|
|
707
704
|
function isGoalish(text) {
|
|
708
705
|
return /\b(goal|objective|task|need|want|implement|fix|improve|refactor|add|remove|hedef|amac|istiyorum|gerekiyor|iyilestir|duzelt|ekle|kaldir)\b/i.test(text);
|
|
@@ -1516,7 +1513,7 @@ function walk(value, schema, path5, errors, depth) {
|
|
|
1516
1513
|
if (!checkType(value, schema.type)) {
|
|
1517
1514
|
errors.push({
|
|
1518
1515
|
path: path5 || "<root>",
|
|
1519
|
-
message: `expected ${schema.type}, got ${describeType(value)}`
|
|
1516
|
+
message: `expected ${schema.type}, got ${describeType(value)} (${previewValue(value)})`
|
|
1520
1517
|
});
|
|
1521
1518
|
return;
|
|
1522
1519
|
}
|
|
@@ -1525,7 +1522,11 @@ function walk(value, schema, path5, errors, depth) {
|
|
|
1525
1522
|
const obj = value;
|
|
1526
1523
|
for (const req of schema.required ?? []) {
|
|
1527
1524
|
if (!(req in obj)) {
|
|
1528
|
-
|
|
1525
|
+
const expected = schema.properties?.[req]?.type;
|
|
1526
|
+
errors.push({
|
|
1527
|
+
path: joinPath(path5, req),
|
|
1528
|
+
message: `required property missing${typeof expected === "string" ? ` (expected ${expected})` : ""}`
|
|
1529
|
+
});
|
|
1529
1530
|
}
|
|
1530
1531
|
}
|
|
1531
1532
|
if (schema.properties) {
|
|
@@ -1542,6 +1543,69 @@ function walk(value, schema, path5, errors, depth) {
|
|
|
1542
1543
|
}
|
|
1543
1544
|
}
|
|
1544
1545
|
}
|
|
1546
|
+
function coerceAgainstSchema(value, schema) {
|
|
1547
|
+
return coerceWalk(value, schema, 0);
|
|
1548
|
+
}
|
|
1549
|
+
function coerceWalk(value, schema, depth) {
|
|
1550
|
+
if (depth > MAX_SCHEMA_DEPTH) return { value, changed: false };
|
|
1551
|
+
const type = typeof schema.type === "string" ? schema.type : void 0;
|
|
1552
|
+
if (type && !checkType(value, type)) {
|
|
1553
|
+
if (type === "string" && (typeof value === "number" || typeof value === "boolean")) {
|
|
1554
|
+
return { value: String(value), changed: true };
|
|
1555
|
+
}
|
|
1556
|
+
if ((type === "number" || type === "integer") && typeof value === "string") {
|
|
1557
|
+
const trimmed = value.trim();
|
|
1558
|
+
if (trimmed !== "" && /^-?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(trimmed)) {
|
|
1559
|
+
const num = Number(trimmed);
|
|
1560
|
+
if (!Number.isNaN(num) && (type === "number" || Number.isInteger(num))) {
|
|
1561
|
+
return { value: num, changed: true };
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
return { value, changed: false };
|
|
1565
|
+
}
|
|
1566
|
+
if (type === "boolean" && typeof value === "string") {
|
|
1567
|
+
const lowered = value.trim().toLowerCase();
|
|
1568
|
+
if (lowered === "true") return { value: true, changed: true };
|
|
1569
|
+
if (lowered === "false") return { value: false, changed: true };
|
|
1570
|
+
return { value, changed: false };
|
|
1571
|
+
}
|
|
1572
|
+
if ((type === "object" || type === "array") && typeof value === "string") {
|
|
1573
|
+
try {
|
|
1574
|
+
const parsed = JSON.parse(value);
|
|
1575
|
+
if (checkType(parsed, type)) {
|
|
1576
|
+
return { value: coerceWalk(parsed, schema, depth + 1).value, changed: true };
|
|
1577
|
+
}
|
|
1578
|
+
} catch {
|
|
1579
|
+
}
|
|
1580
|
+
return { value, changed: false };
|
|
1581
|
+
}
|
|
1582
|
+
return { value, changed: false };
|
|
1583
|
+
}
|
|
1584
|
+
if (type === "object" && isPlainObject(value) && schema.properties) {
|
|
1585
|
+
const obj = value;
|
|
1586
|
+
let changed = false;
|
|
1587
|
+
const out = { ...obj };
|
|
1588
|
+
for (const [key, subSchema] of Object.entries(schema.properties)) {
|
|
1589
|
+
if (!(key in obj)) continue;
|
|
1590
|
+
const r = coerceWalk(obj[key], subSchema, depth + 1);
|
|
1591
|
+
if (r.changed) {
|
|
1592
|
+
out[key] = r.value;
|
|
1593
|
+
changed = true;
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
return changed ? { value: out, changed } : { value, changed: false };
|
|
1597
|
+
}
|
|
1598
|
+
if (type === "array" && Array.isArray(value) && schema.items) {
|
|
1599
|
+
let changed = false;
|
|
1600
|
+
const out = value.map((item) => {
|
|
1601
|
+
const r = coerceWalk(item, schema.items, depth + 1);
|
|
1602
|
+
if (r.changed) changed = true;
|
|
1603
|
+
return r.value;
|
|
1604
|
+
});
|
|
1605
|
+
return changed ? { value: out, changed } : { value, changed: false };
|
|
1606
|
+
}
|
|
1607
|
+
return { value, changed: false };
|
|
1608
|
+
}
|
|
1545
1609
|
function checkType(value, type) {
|
|
1546
1610
|
switch (type) {
|
|
1547
1611
|
case "string":
|
|
@@ -1570,6 +1634,15 @@ function describeType(v) {
|
|
|
1570
1634
|
if (Array.isArray(v)) return "array";
|
|
1571
1635
|
return typeof v;
|
|
1572
1636
|
}
|
|
1637
|
+
function previewValue(v) {
|
|
1638
|
+
try {
|
|
1639
|
+
const s = JSON.stringify(v);
|
|
1640
|
+
if (s === void 0) return String(v);
|
|
1641
|
+
return s.length > 80 ? `${s.slice(0, 80)}\u2026` : s;
|
|
1642
|
+
} catch {
|
|
1643
|
+
return String(v);
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1573
1646
|
function joinPath(parent, key) {
|
|
1574
1647
|
if (!parent) return key;
|
|
1575
1648
|
return `${parent}.${key}`;
|
|
@@ -1883,6 +1956,17 @@ function sanitizeJsonString(s) {
|
|
|
1883
1956
|
return null;
|
|
1884
1957
|
}
|
|
1885
1958
|
}
|
|
1959
|
+
function stripCodeFences(s) {
|
|
1960
|
+
const trimmed = s.trim();
|
|
1961
|
+
const opener = /^```[\w+-]*[ \t]*\r?\n?/.exec(trimmed);
|
|
1962
|
+
if (opener) {
|
|
1963
|
+
const inner = trimmed.slice(opener[0].length).replace(/(\r?\n)?[ \t]*```[ \t]*$/, "");
|
|
1964
|
+
return inner.trim();
|
|
1965
|
+
}
|
|
1966
|
+
const embedded = /```[\w+-]*[ \t]*\r?\n([\s\S]*?)\r?\n[ \t]*```/.exec(trimmed);
|
|
1967
|
+
if (embedded) return (embedded[1] ?? "").trim();
|
|
1968
|
+
return null;
|
|
1969
|
+
}
|
|
1886
1970
|
function escapeControlCharsInStrings(s) {
|
|
1887
1971
|
let inString = false;
|
|
1888
1972
|
let out = "";
|
|
@@ -2610,18 +2694,23 @@ ${renderStringList(files)}` : void 0
|
|
|
2610
2694
|
}
|
|
2611
2695
|
if (typeof obj["diff"] === "string") {
|
|
2612
2696
|
const diff = obj["diff"];
|
|
2697
|
+
const matchedBy = typeof obj["matched_by"] === "string" && obj["matched_by"] !== "exact" ? obj["matched_by"] : void 0;
|
|
2698
|
+
const syntaxErrors = Array.isArray(obj["syntax_errors"]) ? obj["syntax_errors"].filter((e) => typeof e === "string") : [];
|
|
2613
2699
|
return joinSections([
|
|
2614
2700
|
renderHeader(toolName, {
|
|
2615
2701
|
path: obj["path"],
|
|
2616
2702
|
replacements: obj["replacements"],
|
|
2617
2703
|
bytes_written: obj["bytes_written"],
|
|
2618
2704
|
created: obj["created"],
|
|
2705
|
+
matched_by: matchedBy,
|
|
2619
2706
|
note: obj["note"],
|
|
2620
2707
|
files: Array.isArray(obj["files"]) ? obj["files"].length : void 0,
|
|
2621
2708
|
truncated: obj["truncated"],
|
|
2622
2709
|
mode: obj["mode"]
|
|
2623
2710
|
}),
|
|
2624
|
-
compactDiff(diff)
|
|
2711
|
+
compactDiff(diff),
|
|
2712
|
+
syntaxErrors.length > 0 ? `syntax_errors:
|
|
2713
|
+
${renderStringList(syntaxErrors)}` : void 0
|
|
2625
2714
|
]);
|
|
2626
2715
|
}
|
|
2627
2716
|
if (toolName === "test" && typeof obj["output"] === "string") {
|
|
@@ -3307,6 +3396,6 @@ function resolveWstackPaths(opts) {
|
|
|
3307
3396
|
};
|
|
3308
3397
|
}
|
|
3309
3398
|
|
|
3310
|
-
export { COMPLETED_WORK_LEDGER_MARKER, DEFAULT_TOOL_DESCRIPTION_MODE, DEFAULT_TOOL_RESULT_RENDER_MODE, FORBIDDEN_PROTO_KEYS, applyToolDescriptionModeToTool, applyToolDescriptionModes, applyToolResultRenderModes, assertNever, assertNotPrivateHost, atomicWrite, buildChildEnv, buildContextEvidenceDigest, color, compactSchemaDescriptions, compactToolDefinitionForWire, compileGlob, compileUserRegex, completePartialObject, computeMessageTokens, computeTaskItemProgress, createContextEvidenceState, createToolOutputSerializer, deepMerge, detectNewlineStyle, ensureDir, escapeGlobSubject, estimateMessageTokens, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob, expandIPv6, expectDefined, formatCompletedWorkLedger, formatTaskList, formatTaskProgress, formatTodosList, getCalibrationState, getJsonPath, getTermSize, getToolDescriptionMode, getToolResultRenderMode, hasOpenTodos, isInteractive, isJsonObject, isPathSubjectKey, isPrimitiveArray, isPrivateIPv4, isPrivateIPv6, isStdinTTY, isStdoutTTY, isUlid, jsonObjectFileExists, markAssistantReferencedEvidence, matchAny, matchGlob, mergeCustomModelDefs, mergeModelsPayload, normalizePathSubject, normalizeToLf, normalizeToolDescriptionMode, normalizeToolResultRenderMode, onResize, projectHash, projectSlug, readJsonObjectFile, recordActualUsage, recordCompletedWorkEvidence, recordToolOutputEvidence, recordUserIntentEvidence, removeJsonPath, removeJsonPathInFile, repairToolUseAdjacency, repeatedReadPressure, resetCalibration, resolveToolDescriptionMode, resolveToolResultRenderMode, resolveWstackPaths, safeParse, safeStringify, sanitizeJsonString, sanitizeNodeOptions, sessionScopedPath, setJsonPath, setJsonPathInFile, setOutputLineGuard, setRawMode, setToolDescriptionMode, setToolResultRenderMode, simplifyToolDescription, sleep, slugify, stripAnsi, subjectForToolInput, syncCompletedWorkLedgerBlock, toErrorMessage, toStyle, truncate, ulid, unifiedDiff, updateJsonObjectFile, validateAgainstSchema, withFileLock, writeErr, writeJsonObjectFile, writeOut, wstackGlobalRoot };
|
|
3399
|
+
export { COMPLETED_WORK_LEDGER_MARKER, DEFAULT_TOOL_DESCRIPTION_MODE, DEFAULT_TOOL_RESULT_RENDER_MODE, FORBIDDEN_PROTO_KEYS, applyToolDescriptionModeToTool, applyToolDescriptionModes, applyToolResultRenderModes, assertNever, assertNotPrivateHost, atomicWrite, buildChildEnv, buildCompletedWorkLedgerBlock, buildContextEvidenceDigest, coerceAgainstSchema, color, compactSchemaDescriptions, compactToolDefinitionForWire, compileGlob, compileUserRegex, completePartialObject, computeMessageTokens, computeTaskItemProgress, createContextEvidenceState, createToolOutputSerializer, deepMerge, detectNewlineStyle, ensureDir, escapeGlobSubject, estimateMessageTokens, estimateRequestTokens, estimateRequestTokensCalibrated, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, expandGlob, expandIPv6, expectDefined, formatCompletedWorkLedger, formatTaskList, formatTaskProgress, formatTodosList, getCalibrationState, getJsonPath, getTermSize, getToolDescriptionMode, getToolResultRenderMode, hasOpenTodos, isInteractive, isJsonObject, isPathSubjectKey, isPrimitiveArray, isPrivateIPv4, isPrivateIPv6, isStdinTTY, isStdoutTTY, isUlid, jsonObjectFileExists, markAssistantReferencedEvidence, matchAny, matchGlob, mergeCustomModelDefs, mergeModelsPayload, normalizePathSubject, normalizeToLf, normalizeToolDescriptionMode, normalizeToolResultRenderMode, onResize, projectHash, projectSlug, readJsonObjectFile, recordActualUsage, recordCompletedWorkEvidence, recordToolOutputEvidence, recordUserIntentEvidence, removeJsonPath, removeJsonPathInFile, repairToolUseAdjacency, repeatedReadPressure, resetCalibration, resolveToolDescriptionMode, resolveToolResultRenderMode, resolveWstackPaths, safeParse, safeStringify, sanitizeJsonString, sanitizeNodeOptions, sessionScopedPath, setJsonPath, setJsonPathInFile, setOutputLineGuard, setRawMode, setToolDescriptionMode, setToolResultRenderMode, simplifyToolDescription, sleep, slugify, stripAnsi, stripCodeFences, subjectForToolInput, syncCompletedWorkLedgerBlock, toErrorMessage, toStyle, truncate, ulid, unifiedDiff, updateJsonObjectFile, validateAgainstSchema, withFileLock, writeErr, writeJsonObjectFile, writeOut, wstackGlobalRoot };
|
|
3311
3400
|
//# sourceMappingURL=index.js.map
|
|
3312
3401
|
//# sourceMappingURL=index.js.map
|