@openllmsh/sdk 2.10.15-alpha.3 → 2.10.15-alpha.5
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/protocol/agent.d.ts +14 -0
- package/dist/protocol/agent.js +28 -0
- package/package.json +1 -1
package/dist/protocol/agent.d.ts
CHANGED
|
@@ -126,6 +126,13 @@ export declare const agentAttachmentHasPath: (attachment: TAgentAttachment) => a
|
|
|
126
126
|
readonly path: string;
|
|
127
127
|
readonly data?: undefined;
|
|
128
128
|
};
|
|
129
|
+
/**
|
|
130
|
+
* Whether a path string can ride Claude's quoted `@"…"` mention: non-empty,
|
|
131
|
+
* within {@link AGENT_MAX_ATTACHMENT_PATH_LENGTH}, and free of `"`, C0/C1
|
|
132
|
+
* control characters and DEL. Syntax only: the daemon still requires an
|
|
133
|
+
* absolute path to a regular file, and checks the resolved path again.
|
|
134
|
+
*/
|
|
135
|
+
export declare const isAgentAttachmentMentionPath: (path: string) => boolean;
|
|
129
136
|
/**
|
|
130
137
|
* Metadata for an attachment that was saved on the device for a turn. The
|
|
131
138
|
* `name` is the on-disk basename under the session's attachments dir (what
|
|
@@ -141,6 +148,13 @@ export declare const AgentAttachmentMeta: S.Struct<{
|
|
|
141
148
|
export type TAgentAttachmentMeta = S.Schema.Type<typeof AgentAttachmentMeta>;
|
|
142
149
|
/** Decoded-byte cap mirroring {@link AGENT_MAX_ATTACHMENT_BASE64_LENGTH}. */
|
|
143
150
|
export declare const AGENT_MAX_ATTACHMENT_BYTES: number;
|
|
151
|
+
/**
|
|
152
|
+
* Cap for a `path` attachment on this Mac (loopback only). The send carries
|
|
153
|
+
* no bytes, so {@link AGENT_MAX_ATTACHMENT_BYTES} doesn't apply; this bounds
|
|
154
|
+
* the daemon's read when the transcript previews it (`attachment_get`,
|
|
155
|
+
* chunked), so anything that can be sent can also be shown.
|
|
156
|
+
*/
|
|
157
|
+
export declare const AGENT_MAX_LOCAL_ATTACHMENT_BYTES: number;
|
|
144
158
|
/** Decision on an approval request (`request.opened`). */
|
|
145
159
|
export declare const AgentRequestDecision: S.Literals<readonly ["accept", "accept_for_session", "decline", "cancel"]>;
|
|
146
160
|
export type TAgentRequestDecision = S.Schema.Type<typeof AgentRequestDecision>;
|
package/dist/protocol/agent.js
CHANGED
|
@@ -144,6 +144,27 @@ export const AgentAttachment = S.Struct({
|
|
|
144
144
|
}));
|
|
145
145
|
/** True when the attachment carries an absolute local path instead of bytes. */
|
|
146
146
|
export const agentAttachmentHasPath = (attachment) => typeof attachment.path === "string";
|
|
147
|
+
/**
|
|
148
|
+
* Whether a path string can ride Claude's quoted `@"…"` mention: non-empty,
|
|
149
|
+
* within {@link AGENT_MAX_ATTACHMENT_PATH_LENGTH}, and free of `"`, C0/C1
|
|
150
|
+
* control characters and DEL. Syntax only: the daemon still requires an
|
|
151
|
+
* absolute path to a regular file, and checks the resolved path again.
|
|
152
|
+
*/
|
|
153
|
+
export const isAgentAttachmentMentionPath = (path) => {
|
|
154
|
+
if (path.length === 0 || path.length > AGENT_MAX_ATTACHMENT_PATH_LENGTH) {
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
for (let i = 0; i < path.length; i += 1) {
|
|
158
|
+
const code = path.charCodeAt(i);
|
|
159
|
+
if (code === 0x22 ||
|
|
160
|
+
code < 0x20 ||
|
|
161
|
+
code === 0x7f ||
|
|
162
|
+
(code >= 0x80 && code <= 0x9f)) {
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return true;
|
|
167
|
+
};
|
|
147
168
|
/**
|
|
148
169
|
* Metadata for an attachment that was saved on the device for a turn. The
|
|
149
170
|
* `name` is the on-disk basename under the session's attachments dir (what
|
|
@@ -158,6 +179,13 @@ export const AgentAttachmentMeta = S.Struct({
|
|
|
158
179
|
});
|
|
159
180
|
/** Decoded-byte cap mirroring {@link AGENT_MAX_ATTACHMENT_BASE64_LENGTH}. */
|
|
160
181
|
export const AGENT_MAX_ATTACHMENT_BYTES = Math.floor((AGENT_MAX_ATTACHMENT_BASE64_LENGTH * 3) / 4);
|
|
182
|
+
/**
|
|
183
|
+
* Cap for a `path` attachment on this Mac (loopback only). The send carries
|
|
184
|
+
* no bytes, so {@link AGENT_MAX_ATTACHMENT_BYTES} doesn't apply; this bounds
|
|
185
|
+
* the daemon's read when the transcript previews it (`attachment_get`,
|
|
186
|
+
* chunked), so anything that can be sent can also be shown.
|
|
187
|
+
*/
|
|
188
|
+
export const AGENT_MAX_LOCAL_ATTACHMENT_BYTES = 64 * 1024 * 1024;
|
|
161
189
|
/** Decision on an approval request (`request.opened`). */
|
|
162
190
|
export const AgentRequestDecision = S.Literals([
|
|
163
191
|
"accept",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openllmsh/sdk",
|
|
3
|
-
"version": "2.10.15-alpha.
|
|
3
|
+
"version": "2.10.15-alpha.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The OpenLLM SDK: typed API contracts, wire-format adapters, the device tunnel, client-side vault crypto, the OpenAPI spec and MCP tools.",
|
|
6
6
|
"keywords": [
|