@cydm/pie 1.0.29 → 1.0.30
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/README.md +4 -5
- package/dist/builtin/extensions/ask-user/index.js +1 -1
- package/dist/builtin/extensions/changelog/index.js +65 -65
- package/dist/builtin/extensions/init/index.js +61 -54
- package/dist/builtin/extensions/plan-mode/index.js +1 -1
- package/dist/builtin/extensions/subagent/index.js +2 -2
- package/dist/builtin/extensions/todo/index.js +1 -1
- package/dist/chunks/{chunk-L63BJMTT.js → chunk-BOFCKEV5.js} +478 -34
- package/dist/chunks/{chunk-BDDSZSHX.js → chunk-PLJQYVFC.js} +45 -16
- package/dist/chunks/{test-stream-ZNGAUUVH.js → test-stream-A7JSM2UM.js} +39 -5
- package/dist/cli.js +222 -128
- package/package.json +2 -2
|
@@ -2,12 +2,13 @@ import { createRequire as __createRequire } from "node:module"; const require =
|
|
|
2
2
|
import {
|
|
3
3
|
classifyShellCommand,
|
|
4
4
|
createCodeIntelTool,
|
|
5
|
+
createLightweightCodeIntelProvider,
|
|
5
6
|
createSharedWebFetchTool,
|
|
6
7
|
createSharedWebResearchTool,
|
|
7
8
|
createSharedWebSearchTool,
|
|
8
9
|
interpretShellExit,
|
|
9
10
|
requestInteraction
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-BOFCKEV5.js";
|
|
11
12
|
import {
|
|
12
13
|
Type
|
|
13
14
|
} from "./chunk-64XJIKVK.js";
|
|
@@ -811,7 +812,7 @@ function releaseWorkerSlot() {
|
|
|
811
812
|
}
|
|
812
813
|
function acquireWorkerSlot(deadline, signal) {
|
|
813
814
|
if (signal?.aborted) return Promise.reject(new Error("Operation aborted"));
|
|
814
|
-
if (Date.now() >= deadline) return Promise.reject(new Error(`TypeScript code intelligence exceeded ${WORKER_TIMEOUT_MS}ms
|
|
815
|
+
if (Date.now() >= deadline) return Promise.reject(new Error(`TypeScript code intelligence queue wait exceeded ${WORKER_TIMEOUT_MS}ms`));
|
|
815
816
|
if (activeCodeIntelWorkers < MAX_ACTIVE_CODE_INTEL_WORKERS) {
|
|
816
817
|
activeCodeIntelWorkers++;
|
|
817
818
|
return Promise.resolve(releaseWorkerSlot);
|
|
@@ -831,7 +832,7 @@ function acquireWorkerSlot(deadline, signal) {
|
|
|
831
832
|
const index = codeIntelWorkerWaiters.indexOf(waiter);
|
|
832
833
|
if (index >= 0) codeIntelWorkerWaiters.splice(index, 1);
|
|
833
834
|
signal?.removeEventListener("abort", waiter.onAbort);
|
|
834
|
-
reject(new Error(`TypeScript code intelligence exceeded ${WORKER_TIMEOUT_MS}ms
|
|
835
|
+
reject(new Error(`TypeScript code intelligence queue wait exceeded ${WORKER_TIMEOUT_MS}ms`));
|
|
835
836
|
}, Math.max(1, deadline - Date.now()));
|
|
836
837
|
waiter.timeout.unref?.();
|
|
837
838
|
signal?.addEventListener("abort", waiter.onAbort, { once: true });
|
|
@@ -879,7 +880,7 @@ function runWorker(request, timeoutMs, signal) {
|
|
|
879
880
|
})();
|
|
880
881
|
};
|
|
881
882
|
const onAbort = () => finish(new Error("Operation aborted"));
|
|
882
|
-
const timeout = setTimeout(() => finish(new Error(`TypeScript code intelligence
|
|
883
|
+
const timeout = setTimeout(() => finish(new Error(`TypeScript code intelligence worker timed out after ${WORKER_TIMEOUT_MS}ms`)), Math.max(1, timeoutMs));
|
|
883
884
|
timeout.unref?.();
|
|
884
885
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
885
886
|
worker.once("message", (message) => {
|
|
@@ -917,10 +918,46 @@ function createTypeScriptCodeIntelProvider() {
|
|
|
917
918
|
}
|
|
918
919
|
};
|
|
919
920
|
}
|
|
921
|
+
function codeIntelErrorMessage(error) {
|
|
922
|
+
return error instanceof Error ? error.message : String(error);
|
|
923
|
+
}
|
|
924
|
+
function shouldFallbackFromTypeScriptProvider(error) {
|
|
925
|
+
const message = codeIntelErrorMessage(error);
|
|
926
|
+
if (/aborted/i.test(message)) return false;
|
|
927
|
+
if (/outside project root|escapes the project root|path escapes/i.test(message)) return false;
|
|
928
|
+
if (/\bEACCES\b|\bEPERM\b|permission denied/i.test(message)) return false;
|
|
929
|
+
if (/queue is full|queue wait exceeded/i.test(message)) return false;
|
|
930
|
+
return /worker|memory limit|compiled code-intel worker/i.test(message);
|
|
931
|
+
}
|
|
932
|
+
function createFallbackCodeIntelProvider(primary, fallback = createLightweightCodeIntelProvider()) {
|
|
933
|
+
return {
|
|
934
|
+
async run(input, context) {
|
|
935
|
+
try {
|
|
936
|
+
return await primary.run(input, context);
|
|
937
|
+
} catch (error) {
|
|
938
|
+
const fallbackReason = codeIntelErrorMessage(error);
|
|
939
|
+
if (!shouldFallbackFromTypeScriptProvider(error)) throw error;
|
|
940
|
+
const result = await fallback.run(input, context);
|
|
941
|
+
return {
|
|
942
|
+
...result,
|
|
943
|
+
text: `${result.text}
|
|
944
|
+
|
|
945
|
+
[code_intel used lightweight fallback: ${fallbackReason}]`,
|
|
946
|
+
details: {
|
|
947
|
+
...result.details,
|
|
948
|
+
provider: "lightweight_fallback",
|
|
949
|
+
fallbackReason
|
|
950
|
+
},
|
|
951
|
+
isError: result.isError
|
|
952
|
+
};
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
};
|
|
956
|
+
}
|
|
920
957
|
function createCodeIntelTool2(options) {
|
|
921
958
|
return createCodeIntelTool({
|
|
922
959
|
...options,
|
|
923
|
-
provider: options.provider ?? createTypeScriptCodeIntelProvider()
|
|
960
|
+
provider: options.provider ?? createFallbackCodeIntelProvider(createTypeScriptCodeIntelProvider())
|
|
924
961
|
});
|
|
925
962
|
}
|
|
926
963
|
|
|
@@ -1107,19 +1144,9 @@ function createCliHostCapabilities(cwd, options = {}) {
|
|
|
1107
1144
|
},
|
|
1108
1145
|
{
|
|
1109
1146
|
id: "web_research",
|
|
1110
|
-
description: "
|
|
1147
|
+
description: "Canonical web tool for research, direct URL fetch, and low-level search modes.",
|
|
1111
1148
|
tools: [webResearchTool]
|
|
1112
1149
|
},
|
|
1113
|
-
{
|
|
1114
|
-
id: "web_search",
|
|
1115
|
-
description: "Provider-native web search for current information outside the local workspace.",
|
|
1116
|
-
tools: [webSearchTool]
|
|
1117
|
-
},
|
|
1118
|
-
{
|
|
1119
|
-
id: "web_fetch",
|
|
1120
|
-
description: "Fetch and read a specific public web URL after a source has been found.",
|
|
1121
|
-
tools: [webFetchTool]
|
|
1122
|
-
},
|
|
1123
1150
|
{
|
|
1124
1151
|
id: "code_intel",
|
|
1125
1152
|
description: "Read-only JS/TS code intelligence for diagnostics, definitions, references, symbols, and hover.",
|
|
@@ -1147,6 +1174,8 @@ export {
|
|
|
1147
1174
|
getRuntimeLogPath,
|
|
1148
1175
|
migrateConfigFromAgentDir,
|
|
1149
1176
|
createCliWebResearchHealthStore,
|
|
1177
|
+
truncateHeadTail,
|
|
1178
|
+
formatSize,
|
|
1150
1179
|
cleanupBashOutputArtifacts,
|
|
1151
1180
|
createCliHostCapabilities
|
|
1152
1181
|
};
|
|
@@ -39,13 +39,27 @@ function parseMockStreamSequence(value) {
|
|
|
39
39
|
return {
|
|
40
40
|
type: "error",
|
|
41
41
|
error: record.error,
|
|
42
|
-
partialText: typeof record.partialText === "string" ? record.partialText : void 0
|
|
42
|
+
partialText: typeof record.partialText === "string" ? record.partialText : void 0,
|
|
43
|
+
delayMs: typeof record.delayMs === "number" ? Math.max(0, Math.min(record.delayMs, 3e4)) : void 0
|
|
43
44
|
};
|
|
44
45
|
}
|
|
45
46
|
if (record.type === "text" && typeof record.text === "string") {
|
|
46
|
-
return {
|
|
47
|
+
return {
|
|
48
|
+
type: "text",
|
|
49
|
+
text: record.text,
|
|
50
|
+
delayMs: typeof record.delayMs === "number" ? Math.max(0, Math.min(record.delayMs, 3e4)) : void 0
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
if (record.type === "toolCall" && typeof record.name === "string") {
|
|
54
|
+
return {
|
|
55
|
+
type: "toolCall",
|
|
56
|
+
id: typeof record.id === "string" ? record.id : void 0,
|
|
57
|
+
name: record.name,
|
|
58
|
+
arguments: record.arguments && typeof record.arguments === "object" && !Array.isArray(record.arguments) ? record.arguments : {},
|
|
59
|
+
delayMs: typeof record.delayMs === "number" ? Math.max(0, Math.min(record.delayMs, 3e4)) : void 0
|
|
60
|
+
};
|
|
47
61
|
}
|
|
48
|
-
throw new Error("PIE_TEST_MOCK_STREAM_SEQUENCE entries must be text or error steps");
|
|
62
|
+
throw new Error("PIE_TEST_MOCK_STREAM_SEQUENCE entries must be text, toolCall, or error steps");
|
|
49
63
|
});
|
|
50
64
|
}
|
|
51
65
|
function createTestStreamFnFromSequenceEnv(value = process.env.PIE_TEST_MOCK_STREAM_SEQUENCE) {
|
|
@@ -65,7 +79,7 @@ function createTestStreamFnFromSequenceEnv(value = process.env.PIE_TEST_MOCK_STR
|
|
|
65
79
|
throw new Error("mock stream terminated without a terminal event");
|
|
66
80
|
}
|
|
67
81
|
);
|
|
68
|
-
|
|
82
|
+
const emit = () => {
|
|
69
83
|
if (!step) {
|
|
70
84
|
const message2 = createAssistantMessage(model, "");
|
|
71
85
|
stream.push({ type: "done", reason: "stop", message: message2 });
|
|
@@ -83,13 +97,33 @@ function createTestStreamFnFromSequenceEnv(value = process.env.PIE_TEST_MOCK_STR
|
|
|
83
97
|
stream.push({ type: "error", reason: "error", error });
|
|
84
98
|
return;
|
|
85
99
|
}
|
|
100
|
+
if (step.type === "toolCall") {
|
|
101
|
+
const message2 = createAssistantMessage(model, "", "toolUse");
|
|
102
|
+
const toolCall = {
|
|
103
|
+
type: "toolCall",
|
|
104
|
+
id: step.id || `mock-tool-${callIndex}`,
|
|
105
|
+
name: step.name,
|
|
106
|
+
arguments: step.arguments ?? {}
|
|
107
|
+
};
|
|
108
|
+
message2.content = [toolCall];
|
|
109
|
+
stream.push({ type: "start", partial: message2 });
|
|
110
|
+
stream.push({ type: "toolcall_start", contentIndex: 0, partial: message2 });
|
|
111
|
+
stream.push({ type: "toolcall_end", contentIndex: 0, toolCall, partial: message2 });
|
|
112
|
+
stream.push({ type: "done", reason: "toolUse", message: message2 });
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
86
115
|
const message = createAssistantMessage(model, step.text);
|
|
87
116
|
stream.push({ type: "start", partial: message });
|
|
88
117
|
stream.push({ type: "text_start", contentIndex: 0, partial: message });
|
|
89
118
|
stream.push({ type: "text_delta", contentIndex: 0, delta: step.text, partial: message });
|
|
90
119
|
stream.push({ type: "text_end", contentIndex: 0, content: step.text, partial: message });
|
|
91
120
|
stream.push({ type: "done", reason: "stop", message });
|
|
92
|
-
}
|
|
121
|
+
};
|
|
122
|
+
if (step?.delayMs) {
|
|
123
|
+
setTimeout(emit, step.delayMs);
|
|
124
|
+
} else {
|
|
125
|
+
queueMicrotask(emit);
|
|
126
|
+
}
|
|
93
127
|
return stream;
|
|
94
128
|
};
|
|
95
129
|
}
|