@openllmsh/sdk 2.10.15-alpha.1 → 2.10.15-alpha.3

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.
@@ -64,6 +64,11 @@ export declare const AGENT_HOOK_EVENTS: readonly ["PermissionRequest", "PreToolU
64
64
  export declare const AGENT_MAX_ATTACHMENTS = 8;
65
65
  /** Max base64 characters of one inline attachment. */
66
66
  export declare const AGENT_MAX_ATTACHMENT_BASE64_LENGTH: number;
67
+ /**
68
+ * Max characters of one absolute local-path attachment (same bound as a
69
+ * session cwd). Path attachments are loopback-only and never cross the network.
70
+ */
71
+ export declare const AGENT_MAX_ATTACHMENT_PATH_LENGTH = 1024;
67
72
  /**
68
73
  * Engines an agent session can run. Each id is the `openllm <client>` the
69
74
  * daemon launches the engine through (same overlay, gateway URL, key, model
@@ -100,14 +105,27 @@ export declare const AgentStreamOpenPayload: S.Struct<{
100
105
  readonly kind: S.Literal<"agent">;
101
106
  }>;
102
107
  export type TAgentStreamOpenPayload = S.Schema.Type<typeof AgentStreamOpenPayload>;
108
+ /**
109
+ * One attachment on `send`. Exactly one of `data` (base64, any transport) or
110
+ * `path` (absolute local file, loopback agent socket only — the daemon rejects
111
+ * `path` on mux/RTC). Both together are refused (same XOR pattern as
112
+ * {@link AgentRespondCommand}).
113
+ */
103
114
  export declare const AgentAttachment: S.Struct<{
104
115
  readonly kind: S.Literals<readonly ["image", "file"]>;
105
116
  readonly name: S.optional<S.String>;
106
117
  readonly media_type: S.String;
107
- /** Base64 bytes. */
108
- readonly data: S.String;
118
+ /** Base64 bytes. Mutually exclusive with {@link path}. */
119
+ readonly data: S.optional<S.String>;
120
+ /** Absolute local path; admitted only on the desktop loopback agent socket. */
121
+ readonly path: S.optional<S.String>;
109
122
  }>;
110
123
  export type TAgentAttachment = S.Schema.Type<typeof AgentAttachment>;
124
+ /** True when the attachment carries an absolute local path instead of bytes. */
125
+ export declare const agentAttachmentHasPath: (attachment: TAgentAttachment) => attachment is TAgentAttachment & {
126
+ readonly path: string;
127
+ readonly data?: undefined;
128
+ };
111
129
  /**
112
130
  * Metadata for an attachment that was saved on the device for a turn. The
113
131
  * `name` is the on-disk basename under the session's attachments dir (what
@@ -175,8 +193,10 @@ export declare const AgentSendCommand: S.Struct<{
175
193
  readonly kind: S.Literals<readonly ["image", "file"]>;
176
194
  readonly name: S.optional<S.String>;
177
195
  readonly media_type: S.String;
178
- /** Base64 bytes. */
179
- readonly data: S.String;
196
+ /** Base64 bytes. Mutually exclusive with {@link path}. */
197
+ readonly data: S.optional<S.String>;
198
+ /** Absolute local path; admitted only on the desktop loopback agent socket. */
199
+ readonly path: S.optional<S.String>;
180
200
  }>>>;
181
201
  }>;
182
202
  export type TAgentSendCommand = S.Schema.Type<typeof AgentSendCommand>;
@@ -335,8 +355,10 @@ export declare const AgentCommand: S.Union<readonly [S.Struct<{
335
355
  readonly kind: S.Literals<readonly ["image", "file"]>;
336
356
  readonly name: S.optional<S.String>;
337
357
  readonly media_type: S.String;
338
- /** Base64 bytes. */
339
- readonly data: S.String;
358
+ /** Base64 bytes. Mutually exclusive with {@link path}. */
359
+ readonly data: S.optional<S.String>;
360
+ /** Absolute local path; admitted only on the desktop loopback agent socket. */
361
+ readonly path: S.optional<S.String>;
340
362
  }>>>;
341
363
  }>, S.Struct<{
342
364
  readonly type: S.Literal<"send_now">;
@@ -72,6 +72,11 @@ export const AGENT_HOOK_EVENTS = [
72
72
  export const AGENT_MAX_ATTACHMENTS = 8;
73
73
  /** Max base64 characters of one inline attachment. */
74
74
  export const AGENT_MAX_ATTACHMENT_BASE64_LENGTH = 6 * 1024 * 1024;
75
+ /**
76
+ * Max characters of one absolute local-path attachment (same bound as a
77
+ * session cwd). Path attachments are loopback-only and never cross the network.
78
+ */
79
+ export const AGENT_MAX_ATTACHMENT_PATH_LENGTH = 1024;
75
80
  /**
76
81
  * Engines an agent session can run. Each id is the `openllm <client>` the
77
82
  * daemon launches the engine through (same overlay, gateway URL, key, model
@@ -120,13 +125,25 @@ export const AgentStreamOpenPayload = S.Struct({
120
125
  // ---------------------------------------------------------------------------
121
126
  // Commands (consumer → daemon)
122
127
  // ---------------------------------------------------------------------------
128
+ /**
129
+ * One attachment on `send`. Exactly one of `data` (base64, any transport) or
130
+ * `path` (absolute local file, loopback agent socket only — the daemon rejects
131
+ * `path` on mux/RTC). Both together are refused (same XOR pattern as
132
+ * {@link AgentRespondCommand}).
133
+ */
123
134
  export const AgentAttachment = S.Struct({
124
135
  kind: S.Literals(["image", "file"]),
125
136
  name: S.optional(S.String.check(S.isMinLength(1), S.isMaxLength(256))),
126
137
  media_type: S.String.check(S.isMinLength(1), S.isMaxLength(128)),
127
- /** Base64 bytes. */
128
- data: S.String.check(S.isMaxLength(AGENT_MAX_ATTACHMENT_BASE64_LENGTH)),
129
- });
138
+ /** Base64 bytes. Mutually exclusive with {@link path}. */
139
+ data: S.optional(S.String.check(S.isMaxLength(AGENT_MAX_ATTACHMENT_BASE64_LENGTH))),
140
+ /** Absolute local path; admitted only on the desktop loopback agent socket. */
141
+ path: S.optional(S.String.check(S.isMinLength(1), S.isMaxLength(AGENT_MAX_ATTACHMENT_PATH_LENGTH))),
142
+ }).check(S.makeFilter((attachment) => (attachment.data === undefined) !== (attachment.path === undefined), {
143
+ message: "attachment carries exactly one of data / path",
144
+ }));
145
+ /** True when the attachment carries an absolute local path instead of bytes. */
146
+ export const agentAttachmentHasPath = (attachment) => typeof attachment.path === "string";
130
147
  /**
131
148
  * Metadata for an attachment that was saved on the device for a turn. The
132
149
  * `name` is the on-disk basename under the session's attachments dir (what
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openllmsh/sdk",
3
- "version": "2.10.15-alpha.1",
3
+ "version": "2.10.15-alpha.3",
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": [