源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
Dependency audit / audit (push) Canceled after 0s
CI / plan (push) Canceled after 0s
Gitoxide helper admission / macos-latest (push) Canceled after 0s
Gitoxide helper admission / ubuntu-latest (push) Canceled after 0s
Gitoxide helper admission / windows-latest (push) Canceled after 0s
Runtime Host peer admission / quality (push) Canceled after 0s
Windows recovery / windows_recovery (push) Canceled after 0s
CI / heavy (push) Canceled after 0s
CI / test (push) Canceled after 0s

This commit is contained in:
agent-radar committed 2026-09-01 19:05:14 +08:00
commit 7be535059e
3358 files changed
+1306357

No files matched your search

+173
View File
@@ -0,0 +1,173 @@
diff --git a/node_modules/@ai-sdk/provider-utils/dist/index.js b/node_modules/@ai-sdk/provider-utils/dist/index.js
index 7de9a2a..c3c87d8 100644
--- a/node_modules/@ai-sdk/provider-utils/dist/index.js
+++ b/node_modules/@ai-sdk/provider-utils/dist/index.js
@@ -3745,11 +3745,12 @@ function resolveSync(value) {
import {
InvalidResponseDataError
} from "@ai-sdk/provider";
+function absentIfBlank(value) {
+ return value != null && value.trim() !== "" ? value : void 0;
+}
var StreamingToolCallTracker = class {
constructor(controller, options = {}) {
- this.toolCalls = /* @__PURE__ */ new Set();
- this.toolCallsById = /* @__PURE__ */ new Map();
- this.toolCallsByIndex = /* @__PURE__ */ new Map();
+ this.toolCalls = [];
var _a3, _b3;
this.controller = controller;
this._generateId = (_a3 = options.generateId) != null ? _a3 : generateId;
@@ -3763,31 +3764,90 @@ var StreamingToolCallTracker = class {
* events as appropriate.
*/
processDelta(toolCallDelta) {
- const { id, index } = toolCallDelta;
- let toolCall = id != null && id.length > 0 ? this.toolCallsById.get(id) : index != null ? this.toolCallsByIndex.get(index) : this.latestToolCall;
+ var _a3;
+ const wireId = absentIfBlank(toolCallDelta.id);
+ const wireIndex = toolCallDelta.index != null ? toolCallDelta.index : void 0;
+ const wireName = absentIfBlank((_a3 = toolCallDelta.function) == null ? void 0 : _a3.name);
+ let toolCall = this.findByAlias(wireId, wireIndex, wireName);
+ if (toolCall == null && this.toolCalls.length === 1) {
+ const only = this.toolCalls[0];
+ if ((wireName === void 0 || only.function.name === wireName) && (wireId === void 0 || only.wireId === void 0) && (wireIndex === void 0 || only.index === void 0)) {
+ toolCall = only;
+ }
+ }
if (toolCall == null) {
- toolCall = this.processNewToolCall(toolCallDelta);
- } else {
- this.processExistingToolCall(toolCall, toolCallDelta);
+ this.processNewToolCall(toolCallDelta, wireId, wireIndex, wireName);
+ return;
}
- if (index != null) {
- this.toolCallsByIndex.set(index, toolCall);
+ if (wireId !== void 0) {
+ toolCall.wireId = wireId;
}
- this.latestToolCall = toolCall;
+ if (wireIndex !== void 0) {
+ toolCall.index = wireIndex;
+ }
+ this.processExistingToolCall(toolCall, toolCallDelta);
+ }
+ /**
+ * The most recent tool call this delta's aliases claim. An alias the candidate has not
+ * seen yet cannot disagree, so it neither matches nor rejects; at least one alias must
+ * actually match, which is why a delta carrying only arguments never resolves here.
+ *
+ * Scanning stops at the first call an alias claims, and a `function.name` that disagrees
+ * with that call rejects the delta rather than letting the scan continue. Continuing past
+ * it reaches a call whose claim on the alias a later call has already superseded, which
+ * files a whole new call as a continuation of one two positions back.
+ */
+ /**
+ * Whether an alias the delta carries, but the matched call has not claimed, belongs to some
+ * other call. The delta then addresses two calls at once, which resolves to neither — the
+ * other claimant cannot be it either, because the alias it did match rejected that call
+ * already. Agreement has to be read across the record set: a candidate missing the alias is
+ * not contradicted by it on its own, and reading only the candidate let exactly this
+ * contradiction resolve, silently, onto a call the gateway never addressed.
+ */
+ claimedByAnother(candidate, alias, value) {
+ return value !== void 0 && candidate[alias] === void 0 && this.toolCalls.some((other) => other !== candidate && other[alias] === value);
+ }
+ findByAlias(wireId, wireIndex, wireName) {
+ for (let position = this.toolCalls.length - 1; position >= 0; position--) {
+ const candidate = this.toolCalls[position];
+ let matched = false;
+ if (wireIndex !== void 0 && candidate.index !== void 0) {
+ if (candidate.index !== wireIndex) {
+ continue;
+ }
+ matched = true;
+ }
+ if (wireId !== void 0 && candidate.wireId !== void 0) {
+ if (candidate.wireId !== wireId) {
+ continue;
+ }
+ matched = true;
+ }
+ if (matched) {
+ if (this.claimedByAnother(candidate, "wireId", wireId) || this.claimedByAnother(candidate, "index", wireIndex)) {
+ return void 0;
+ }
+ return wireName !== void 0 && candidate.function.name !== wireName ? void 0 : candidate;
+ }
+ }
+ return void 0;
}
/**
* Finalize any unfinished tool calls. Should be called during the stream's
* flush handler to ensure all tool calls are properly completed.
*/
flush() {
- for (const toolCall of this.toolCalls) {
+ const indices = this.toolCalls.map((toolCall) => toolCall.index);
+ const ordered = indices.every((index) => index !== void 0) && new Set(indices).size === indices.length ? [...this.toolCalls].sort((a, b) => a.index - b.index) : this.toolCalls;
+ for (const toolCall of ordered) {
if (!toolCall.hasFinished) {
this.finishToolCall(toolCall);
}
}
}
- processNewToolCall(toolCallDelta) {
- var _a3, _b3, _c;
+ processNewToolCall(toolCallDelta, wireId, wireIndex, wireName) {
+ var _a3, _b3;
if (this.typeValidation === "required") {
if (toolCallDelta.type !== "function") {
throw new InvalidResponseDataError({
@@ -3803,38 +3863,32 @@ var StreamingToolCallTracker = class {
});
}
}
- if (toolCallDelta.id == null) {
- throw new InvalidResponseDataError({
- data: toolCallDelta,
- message: `Expected 'id' to be a string.`
- });
- }
- if (((_a3 = toolCallDelta.function) == null ? void 0 : _a3.name) == null) {
+ if (wireName === void 0) {
throw new InvalidResponseDataError({
data: toolCallDelta,
message: `Expected 'function.name' to be a string.`
});
}
+ const mintedId = wireId === void 0 || this.toolCalls.some((candidate) => candidate.id === wireId) ? this._generateId() : wireId;
this.controller.enqueue({
type: "tool-input-start",
- id: toolCallDelta.id,
- toolName: toolCallDelta.function.name
+ id: mintedId,
+ toolName: wireName
});
- const metadata = (_b3 = this.extractMetadata) == null ? void 0 : _b3.call(this, toolCallDelta);
+ const metadata = (_a3 = this.extractMetadata) == null ? void 0 : _a3.call(this, toolCallDelta);
const toolCall = {
- id: toolCallDelta.id,
+ id: mintedId,
type: "function",
function: {
- name: toolCallDelta.function.name,
- arguments: (_c = toolCallDelta.function.arguments) != null ? _c : ""
+ name: wireName,
+ arguments: (_b3 = toolCallDelta.function.arguments) != null ? _b3 : ""
},
hasFinished: false,
- metadata
+ metadata,
+ wireId,
+ index: wireIndex
};
- this.toolCalls.add(toolCall);
- if (toolCall.id.length > 0) {
- this.toolCallsById.set(toolCall.id, toolCall);
- }
+ this.toolCalls.push(toolCall);
if (toolCall.function.arguments.length > 0) {
this.controller.enqueue({
type: "tool-input-delta",
File diff suppressed because it is too large. Load diff
+16
View File
@@ -0,0 +1,16 @@
diff --git a/node_modules/@sigstore/core/dist/crypto.js b/node_modules/@sigstore/core/dist/crypto.js
--- a/node_modules/@sigstore/core/dist/crypto.js
+++ b/node_modules/@sigstore/core/dist/crypto.js
@@ -51,4 +51,12 @@ function verify(data, key, signature, algorithm) {
// The try/catch is to work around an issue in Node 14.x where verify throws
// an error in some scenarios if the signature is invalid.
try {
+ if (algorithm === undefined) {
+ const keyObject = key instanceof crypto_1.default.KeyObject
+ ? key
+ : key?.key instanceof crypto_1.default.KeyObject
+ ? key.key
+ : crypto_1.default.createPublicKey(key);
+ algorithm = keyObject.asymmetricKeyType === 'ed25519' || keyObject.asymmetricKeyType === 'ed448' ? null : 'sha256';
+ }
return crypto_1.default.verify(algorithm, data, key, signature);
+11
View File
@@ -0,0 +1,11 @@
diff --git a/node_modules/@tufjs/models/dist/utils/verify.js b/node_modules/@tufjs/models/dist/utils/verify.js
--- a/node_modules/@tufjs/models/dist/utils/verify.js
+++ b/node_modules/@tufjs/models/dist/utils/verify.js
@@ -9,5 +9,6 @@ const crypto_1 = __importDefault(require("crypto"));
const verifySignature = (metaDataSignedData, key, signature) => {
const canonicalData = Buffer.from((0, canonical_json_1.canonicalize)(metaDataSignedData));
- return crypto_1.default.verify(undefined, canonicalData, key, Buffer.from(signature, 'hex'));
+ const algorithm = key.key.asymmetricKeyType === 'ed25519' ? null : 'sha256';
+ return crypto_1.default.verify(algorithm, canonicalData, key, Buffer.from(signature, 'hex'));
};
exports.verifySignature = verifySignature;
+95
View File
@@ -0,0 +1,95 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
# patches
Applied on root `postinstall` via `scripts/apply-dependency-patches.mjs`
(`patch-package --error-on-fail`). After bumping a patched dependency, re-run
`npx patch-package <name>` so the filename tracks the installed version.
Keep this directory small. Prefer product code that uses the dependency's
published API; only patch for bugs that block shipping and cannot be worked
around at the call site.
## `@tufjs/models@5.0.0` and `@sigstore/core@4.0.1`
The published ECDSA verification paths rely on Node choosing a digest when
`crypto.verify` receives `undefined`. Electron 43's crypto runtime rejects that
call with `ERR_OSSL_EVP_NO_DEFAULT_DIGEST`, so packaged Desktop cannot load the
Sigstore TUF root or verify Rekor and DSSE signatures for an update. The patches
select SHA-256 for RSA/ECDSA and preserve digest-free EdDSA verification at the
two shared crypto seams.
Delete each patch when the corresponding package ships explicit SHA-256
verification and the Electron regression tests pass without it.
## `node-pty@1.2.0-beta.15`
On Unix, `CustomWriteStream` submits raw file-descriptor writes through libuv.
Those writes can survive PTY exit and target an unrelated file after descriptor
reuse. The patch keeps writes synchronous on node-pty's non-blocking PTY master,
checks an `fstat` fingerprint before retries, yields between attempts, and cancels
the queue at the native exit fence. See #2978.
Delete when node-pty ships an equivalent Unix write-lifecycle fix.
## `@ai-sdk/provider-utils@5.0.28`
Streaming tool-call association for gateways that reuse or omit `index` / `id`
(Ollama-style, Anthropic→OpenAI translators). See #1967 / #1976 and
`packages/runtime/src/__tests__/model-factory-tool-call-index.test.ts`.
Delete when that guard passes against an unpatched package.
## `@astryxdesign/core@0.5.0`
Five published component seams drop host-owned state or semantics:
- `ChatLayout` needs a conversation identity that resets scroll/unread state
without remounting its composer slot and discarding the live draft.
- `ChatLayout` owns auto-follow and publishes no way to say "this scroll is
deliberate navigation, release it". Its scroll-direction unlock cannot infer
that: it discards any scroll event carrying a changed `scrollHeight` as a
resize artefact, and a host that mounts a turn before scrolling to it
produces exactly that. Without the seam the prompt rail's jump into an
unmounted turn is dragged straight back to the bottom (#2923), and no call
site can fix it — re-aiming frame by frame wins the mount and then loses to
the follow spring that outlives it. `unlockAutoFollow` on
`ChatLayoutContextValue` publishes the hook's existing `unlock`.
- `ChatToolCalls` needs a stable row slot for product styling and E2E geometry.
- `List` must forward its published `aria-label` to the rendered list element.
- `SideNavItem` needs an interactive `trailingAction` sibling between its
navigation control and nested items. `endContent` renders inside the primary
control, while a sibling outside `SideNavItem` can only come before the
project control or after all of its tasks; neither produces the visual Tab
order used by the task rail.
- `DropdownMenuItem` must forward `aria-busy` to its row. The composer's
Skills entry holds its look steady while the Skill catalog refreshes and
defers activation meanwhile; without the attribute the row announces
"available" to assistive technology and silently ignores the action.
Streaming text and Markdown expose an explicit `settledText` seam so the
renderer can verify and advance the exact prefix already presented without
replaying it. The default remains progressive for a genuinely new stream, and
rewritten or later text still reveals and fades from a parsed-visible boundary.
Markdown can also transform the displayed prefix immediately before its
existing incremental parser, so host syntax such as math stays behind the
streaming cursor without adding another parser or scheduler.
Delete each hunk when the corresponding behavior ships in Astryx.
+132
View File
@@ -0,0 +1,132 @@
diff --git a/node_modules/node-pty/lib/unixTerminal.js b/node_modules/node-pty/lib/unixTerminal.js
index af2d24c..a16ab59 100644
--- a/node_modules/node-pty/lib/unixTerminal.js
+++ b/node_modules/node-pty/lib/unixTerminal.js
@@ -65,6 +65,10 @@ var UnixTerminal = /** @class */ (function (_super) {
var parsedEnv = _this._parseEnv(env);
var encoding = (opt.encoding === undefined ? 'utf8' : opt.encoding);
var onexit = function (code, signal) {
+ // Stop queued writes while the PTY fd is still owned by this terminal.
+ // An async write that outlives the fd can target an unrelated file if
+ // the operating system reuses the descriptor before libuv runs it.
+ _this._writeStream.dispose();
// XXX Sometimes a data event is emitted after exit. Wait til socket is
// destroyed.
if (!_this._emittedClose) {
@@ -105,6 +109,7 @@ var UnixTerminal = /** @class */ (function (_super) {
return;
}
}
+ _this._writeStream.dispose();
// close
_this._close();
// EIO on exit from fs.ReadStream:
@@ -134,6 +139,7 @@ var UnixTerminal = /** @class */ (function (_super) {
_this._readable = true;
_this._writable = true;
_this._socket.on('close', function () {
+ _this._writeStream.dispose();
if (_this._emittedClose) {
return;
}
@@ -288,12 +294,19 @@ var CustomWriteStream = /** @class */ (function () {
this._fd = _fd;
this._encoding = _encoding;
this._writeQueue = [];
+ this._disposed = false;
+ this._fdIdentity = fs.fstatSync(_fd);
}
CustomWriteStream.prototype.dispose = function () {
+ this._disposed = true;
clearImmediate(this._writeImmediate);
this._writeImmediate = undefined;
+ this._writeQueue.length = 0;
};
CustomWriteStream.prototype.write = function (data) {
+ if (this._disposed) {
+ return;
+ }
// Writes are put in a queue and processed asynchronously in order to handle
// backpressure from the kernel buffer.
var buffer = typeof data === 'string'
@@ -309,42 +322,53 @@ var CustomWriteStream = /** @class */ (function () {
CustomWriteStream.prototype._processWriteQueue = function () {
var _this = this;
this._writeImmediate = undefined;
- if (this._writeQueue.length === 0) {
+ if (this._disposed || this._writeQueue.length === 0) {
return;
}
var task = this._writeQueue[0];
+ if (!this._ownsFileDescriptor()) {
+ this.dispose();
+ return;
+ }
// Write to the underlying file descriptor and handle it directly, rather
// than using the `net.Socket`/`tty.WriteStream` wrappers which swallow and
// mask errors like EAGAIN and can cause the thread to block indefinitely.
- fs.write(this._fd, task.buffer, task.offset, function (err, written) {
- if (err) {
- if ('code' in err && err.code === 'EAGAIN') {
- // `setImmediate` is used to yield to the event loop and re-attempt
- // the write later.
- _this._writeImmediate = setImmediate(function () { return _this._processWriteQueue(); });
- }
- else {
- // Stop processing immediately on unexpected error and log
- _this._writeQueue.length = 0;
- console.error('Unhandled pty write error', err);
- }
- return;
- }
+ // The native layer marks the PTY master fd as non-blocking. Keep each raw-fd
+ // write synchronous so no libuv request can outlive the descriptor, then
+ // yield between writes to retain asynchronous queue and backpressure behavior.
+ try {
+ var written = fs.writeSync(this._fd, task.buffer, task.offset);
task.offset += written;
if (task.offset >= task.buffer.byteLength) {
- _this._writeQueue.shift();
+ this._writeQueue.shift();
}
- // Since there is more room in the kernel buffer, we can continue to write
- // until we hit EAGAIN or exhaust the queue.
- //
- // Note that old versions of bash, like v3.2 which ships in macOS, appears
- // to have a bug in its readline implementation that causes data
- // corruption when writes to the pty happens too quickly. Instead of
- // trying to workaround that we just accept it so that large pastes are as
- // fast as possible.
- // Context: https://github.com/microsoft/node-pty/issues/833
- _this._processWriteQueue();
- });
+ }
+ catch (err) {
+ if (typeof err !== 'object' || err === null || !('code' in err) || err.code !== 'EAGAIN') {
+ // Stop processing immediately on unexpected error and log
+ this._writeQueue.length = 0;
+ console.error('Unhandled pty write error', err);
+ return;
+ }
+ }
+ if (!this._disposed && this._writeQueue.length > 0) {
+ this._writeImmediate = setImmediate(function () { return _this._processWriteQueue(); });
+ }
+ };
+ CustomWriteStream.prototype._ownsFileDescriptor = function () {
+ try {
+ var current = fs.fstatSync(this._fd);
+ return current.dev === this._fdIdentity.dev
+ && current.ino === this._fdIdentity.ino
+ && current.mode === this._fdIdentity.mode
+ && current.rdev === this._fdIdentity.rdev;
+ }
+ catch (err) {
+ if (typeof err === 'object' && err !== null && 'code' in err && err.code === 'EBADF') {
+ return false;
+ }
+ throw err;
+ }
};
return CustomWriteStream;
}());