@cydm/pie 1.0.41 → 1.0.42
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 +21 -2
- package/dist/builtin/extensions/ask-user/index.js +4 -4
- package/dist/builtin/extensions/changelog/index.js +1 -1
- package/dist/builtin/extensions/deploy/index.js +1 -1
- package/dist/builtin/extensions/document-attachments/index.js +1 -1
- package/dist/builtin/extensions/files/index.js +1 -1
- package/dist/builtin/extensions/init/index.js +1 -1
- package/dist/builtin/extensions/kimi-attachments/index.js +1 -1
- package/dist/builtin/extensions/plan-mode/index.js +4 -4
- package/dist/builtin/extensions/subagent/index.js +5 -5
- package/dist/builtin/extensions/todo/index.js +4 -4
- package/dist/chunks/{chunk-OBCFKF6H.js → chunk-2GVFMYIV.js} +583 -91
- package/dist/chunks/{chunk-E3ELBCCX.js → chunk-JVLAKTAS.js} +1 -1
- package/dist/chunks/{chunk-TG2EQLX2.js → chunk-LZQXQOPJ.js} +5 -1
- package/dist/chunks/{chunk-YCPKJCUB.js → chunk-NGQ3PUOC.js} +40 -10
- package/dist/chunks/{chunk-4WGEYDPO.js → chunk-VYAW6RAX.js} +2 -2
- package/dist/chunks/{src-NHRMBQAJ.js → src-TQNFXZGK.js} +3 -3
- package/dist/chunks/{test-stream-I6S23PTW.js → test-stream-IPBFEEWH.js} +2 -2
- package/dist/cli.js +1751 -612
- package/dist/code-intel-worker.cjs +5 -1
- package/models.schema.json +412 -93
- package/package.json +3 -3
|
@@ -12,7 +12,11 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
12
12
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
13
|
});
|
|
14
14
|
var __commonJS = (cb, mod) => function __require2() {
|
|
15
|
-
|
|
15
|
+
try {
|
|
16
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
17
|
+
} catch (e) {
|
|
18
|
+
throw mod = 0, e;
|
|
19
|
+
}
|
|
16
20
|
};
|
|
17
21
|
var __export = (target, all) => {
|
|
18
22
|
for (var name in all)
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
__export,
|
|
5
5
|
__require,
|
|
6
6
|
__toESM
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-LZQXQOPJ.js";
|
|
8
8
|
|
|
9
9
|
// ../../node_modules/partial-json/dist/options.js
|
|
10
10
|
var require_options = __commonJS({
|
|
@@ -3338,9 +3338,9 @@ var NodeFileSystem = class {
|
|
|
3338
3338
|
if (length === 0) return new Uint8Array();
|
|
3339
3339
|
const handle = await getNodeFs().promises.open(path, "r");
|
|
3340
3340
|
try {
|
|
3341
|
-
const
|
|
3342
|
-
const { bytesRead } = await handle.read(
|
|
3343
|
-
return
|
|
3341
|
+
const view = new Uint8Array(length);
|
|
3342
|
+
const { bytesRead } = await handle.read(view, 0, length, 0);
|
|
3343
|
+
return view.subarray(0, bytesRead);
|
|
3344
3344
|
} finally {
|
|
3345
3345
|
await handle.close();
|
|
3346
3346
|
}
|
|
@@ -3805,7 +3805,10 @@ var PuerTSFileSystem = class {
|
|
|
3805
3805
|
while (offset < length) {
|
|
3806
3806
|
const requested = Math.min(length - offset, 65536);
|
|
3807
3807
|
if (offset > 0 && typeof bridge.ReadRangeHex !== "function") {
|
|
3808
|
-
|
|
3808
|
+
console.warn(
|
|
3809
|
+
`[pie] readFilePrefix truncated at 64 KiB: the Unity file bridge is missing ReadRangeHex. Update the Pie package so PieFileBridge matches the runtime bundle. (requested ${length} bytes of '${path}')`
|
|
3810
|
+
);
|
|
3811
|
+
break;
|
|
3809
3812
|
}
|
|
3810
3813
|
const hex = String((offset === 0 ? bridge.ReadPrefixHex(normalizedPath, requested) : bridge.ReadRangeHex(normalizedPath, offset, requested)) ?? "");
|
|
3811
3814
|
if (hex.length % 2 !== 0) throw new Error("The Unity file bridge returned an invalid hex prefix.");
|
|
@@ -5216,6 +5219,8 @@ function detectCompat(_model) {
|
|
|
5216
5219
|
requiresAssistantAfterToolResult: false,
|
|
5217
5220
|
requiresThinkingAsText: true,
|
|
5218
5221
|
supportsStrictMode: true,
|
|
5222
|
+
streamRequiresDone: true,
|
|
5223
|
+
streamRequiresFinishReason: true,
|
|
5219
5224
|
cacheCapability: NO_CACHE_CAPABILITY
|
|
5220
5225
|
};
|
|
5221
5226
|
}
|
|
@@ -5233,6 +5238,8 @@ function getCompat(model) {
|
|
|
5233
5238
|
requiresAssistantAfterToolResult: model.compat.requiresAssistantAfterToolResult ?? detected.requiresAssistantAfterToolResult,
|
|
5234
5239
|
requiresThinkingAsText: model.compat.requiresThinkingAsText ?? detected.requiresThinkingAsText,
|
|
5235
5240
|
supportsStrictMode: model.compat.supportsStrictMode ?? detected.supportsStrictMode,
|
|
5241
|
+
streamRequiresDone: model.compat.streamRequiresDone ?? detected.streamRequiresDone,
|
|
5242
|
+
streamRequiresFinishReason: model.compat.streamRequiresFinishReason ?? detected.streamRequiresFinishReason,
|
|
5236
5243
|
cacheCapability: model.compat.cacheCapability ?? detected.cacheCapability
|
|
5237
5244
|
};
|
|
5238
5245
|
}
|
|
@@ -5666,6 +5673,16 @@ function parseFinalToolArguments(partialArgs, toolName) {
|
|
|
5666
5673
|
}
|
|
5667
5674
|
return parsed;
|
|
5668
5675
|
}
|
|
5676
|
+
function tryParseFinalToolArguments(partialArgs) {
|
|
5677
|
+
const text = partialArgs.trim();
|
|
5678
|
+
if (!text) return null;
|
|
5679
|
+
try {
|
|
5680
|
+
const parsed = JSON.parse(text);
|
|
5681
|
+
return isRecord(parsed) ? parsed : null;
|
|
5682
|
+
} catch {
|
|
5683
|
+
return null;
|
|
5684
|
+
}
|
|
5685
|
+
}
|
|
5669
5686
|
var streamOpenAICompletions = (model, context, options) => {
|
|
5670
5687
|
const stream = new AssistantMessageEventStream();
|
|
5671
5688
|
(async () => {
|
|
@@ -5783,6 +5800,14 @@ var streamOpenAICompletions = (model, context, options) => {
|
|
|
5783
5800
|
if (id) {
|
|
5784
5801
|
let entry = toolCallsById.get(id);
|
|
5785
5802
|
if (!entry) {
|
|
5803
|
+
const unpaired = toolCallEntries.filter((candidate) => !candidate.block.id);
|
|
5804
|
+
if (unpaired.length === 1) {
|
|
5805
|
+
rememberToolCallId(id, unpaired[0]);
|
|
5806
|
+
return unpaired[0];
|
|
5807
|
+
}
|
|
5808
|
+
if (unpaired.length > 1) {
|
|
5809
|
+
throw createProtocolError(`OpenAI-compatible stream returned tool call id "${id}" without an index while multiple unnamed calls are in flight; the call cannot be disambiguated.`);
|
|
5810
|
+
}
|
|
5786
5811
|
entry = createToolCallEntry(toolCall);
|
|
5787
5812
|
rememberToolCallId(id, entry);
|
|
5788
5813
|
}
|
|
@@ -5958,17 +5983,22 @@ var streamOpenAICompletions = (model, context, options) => {
|
|
|
5958
5983
|
}
|
|
5959
5984
|
}
|
|
5960
5985
|
finishCurrentBlock(currentBlock);
|
|
5961
|
-
if (!sawDone) {
|
|
5962
|
-
throw createProtocolError(`OpenAI-compatible stream ended without data: [DONE]${rawFinishReason ? ` (last finish_reason=${rawFinishReason})` : ""}.`);
|
|
5986
|
+
if (compat.streamRequiresDone && !sawDone) {
|
|
5987
|
+
throw createProtocolError(`OpenAI-compatible stream ended without data: [DONE]${rawFinishReason ? ` (last finish_reason=${rawFinishReason})` : ""}. Set compat.streamRequiresDone=false for gateways that legitimately omit the terminator.`);
|
|
5963
5988
|
}
|
|
5964
|
-
if (!sawFinishReason) {
|
|
5965
|
-
throw createProtocolError("OpenAI-compatible stream ended without finish_reason.");
|
|
5989
|
+
if (compat.streamRequiresFinishReason && !sawFinishReason) {
|
|
5990
|
+
throw createProtocolError("OpenAI-compatible stream ended without finish_reason. Set compat.streamRequiresFinishReason=false for endpoints that omit it.");
|
|
5966
5991
|
}
|
|
5967
5992
|
if (output.stopReason === "toolUse" && toolCallEntries.length === 0) {
|
|
5968
5993
|
throw createProtocolError(`OpenAI-compatible stream ended with finish_reason=${rawFinishReason} but did not include any tool calls.`);
|
|
5969
5994
|
}
|
|
5970
5995
|
if (output.stopReason === "length" && toolCallEntries.length > 0) {
|
|
5971
|
-
|
|
5996
|
+
const hasTruncatedArgs = toolCallEntries.some(
|
|
5997
|
+
({ partialArgs }) => tryParseFinalToolArguments(partialArgs) === null
|
|
5998
|
+
);
|
|
5999
|
+
if (hasTruncatedArgs) {
|
|
6000
|
+
throw new Error("OpenAI-compatible stream ended with finish_reason=length before tool call arguments were complete. Increase maxTokens or reduce prompt size.");
|
|
6001
|
+
}
|
|
5972
6002
|
}
|
|
5973
6003
|
for (const { block, partialArgs, contentIndex } of toolCallEntries) {
|
|
5974
6004
|
if (!block.name.trim()) {
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
createSharedWebSearchTool,
|
|
9
9
|
interpretShellExit,
|
|
10
10
|
requestInteraction
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-2GVFMYIV.js";
|
|
12
12
|
import {
|
|
13
13
|
Type
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-NGQ3PUOC.js";
|
|
15
15
|
|
|
16
16
|
// src/config.ts
|
|
17
17
|
import { existsSync, mkdirSync, readFileSync, renameSync } from "fs";
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
Agent,
|
|
4
4
|
agentLoop,
|
|
5
5
|
agentLoopContinue
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-JVLAKTAS.js";
|
|
7
|
+
import "./chunk-NGQ3PUOC.js";
|
|
8
|
+
import "./chunk-LZQXQOPJ.js";
|
|
9
9
|
export {
|
|
10
10
|
Agent,
|
|
11
11
|
agentLoop,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
EventStream
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-NGQ3PUOC.js";
|
|
5
|
+
import "./chunk-LZQXQOPJ.js";
|
|
6
6
|
|
|
7
7
|
// src/app/test-stream.ts
|
|
8
8
|
function parseSystemPromptExpectations(value) {
|