@poe-platform/safe-js 0.1.604 → 0.1.606

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.
Files changed (27) hide show
  1. package/dist/safe-js/chunks/{chunk-HMJGGU6F.js → chunk-3XEB5VOF.js} +1 -1
  2. package/dist/safe-js/chunks/{chunk-HMJGGU6F.js.map → chunk-3XEB5VOF.js.map} +2 -2
  3. package/dist/safe-js/chunks/{chunk-CQHN2MZQ.js → chunk-KX5Y2HHX.js} +2 -2
  4. package/dist/safe-js/chunks/chunk-KX5Y2HHX.js.map +7 -0
  5. package/dist/safe-js/chunks/{cli-runtime-TURGGYT5.js → cli-runtime-EEHCUG52.js} +3 -3
  6. package/dist/safe-js/chunks/{mcp-KV554TH7.js → mcp-TNQ6HZC7.js} +3 -3
  7. package/dist/safe-js/cli.js +2 -2
  8. package/dist/safe-js/index.js +2 -2
  9. package/dist/safe-js/modules/mcp-transport.d.ts +5 -4
  10. package/dist/safe-js/modules/mcp.d.ts +5 -2
  11. package/package.json +2 -2
  12. package/dist/safe-js/chunks/chunk-CQHN2MZQ.js.map +0 -7
  13. package/dist/tiny-mcp-client/index.d.ts +0 -662
  14. package/dist/tiny-stdio-mcp-server/content/audio.d.ts +0 -15
  15. package/dist/tiny-stdio-mcp-server/content/convert.d.ts +0 -16
  16. package/dist/tiny-stdio-mcp-server/content/file-type.d.ts +0 -11
  17. package/dist/tiny-stdio-mcp-server/content/file.d.ts +0 -28
  18. package/dist/tiny-stdio-mcp-server/content/image.d.ts +0 -15
  19. package/dist/tiny-stdio-mcp-server/content/index.d.ts +0 -7
  20. package/dist/tiny-stdio-mcp-server/content/mime.d.ts +0 -7
  21. package/dist/tiny-stdio-mcp-server/content/remote.d.ts +0 -5
  22. package/dist/tiny-stdio-mcp-server/index.d.ts +0 -9
  23. package/dist/tiny-stdio-mcp-server/schema.d.ts +0 -20
  24. package/dist/tiny-stdio-mcp-server/server.d.ts +0 -35
  25. package/dist/tiny-stdio-mcp-server/types.d.ts +0 -256
  26. /package/dist/safe-js/chunks/{cli-runtime-TURGGYT5.js.map → cli-runtime-EEHCUG52.js.map} +0 -0
  27. /package/dist/safe-js/chunks/{mcp-KV554TH7.js.map → mcp-TNQ6HZC7.js.map} +0 -0
@@ -1,28 +0,0 @@
1
- import { type FromUrlOptions } from "./remote.js";
2
- export interface TextResourceContents {
3
- uri: string;
4
- mimeType: string;
5
- text: string;
6
- }
7
- export interface BlobResourceContents {
8
- uri: string;
9
- mimeType: string;
10
- blob: string;
11
- }
12
- export interface EmbeddedResource {
13
- type: "resource";
14
- resource: TextResourceContents | BlobResourceContents;
15
- }
16
- export declare class File {
17
- private readonly data;
18
- private readonly mimeType;
19
- private readonly isText;
20
- private readonly name?;
21
- private readonly charset;
22
- private constructor();
23
- static fromUrl(url: string, options?: FromUrlOptions): Promise<File>;
24
- static fromBytes(data: Uint8Array, mimeType: string): File;
25
- static fromText(text: string, mimeType?: string): File;
26
- static fromBase64(base64: string, mimeType: string): File;
27
- toContentBlock(): EmbeddedResource;
28
- }
@@ -1,15 +0,0 @@
1
- import { type FromUrlOptions } from "./remote.js";
2
- export interface ImageContent {
3
- type: "image";
4
- data: string;
5
- mimeType: string;
6
- }
7
- export declare class Image {
8
- private readonly base64Data;
9
- private readonly mimeType;
10
- private constructor();
11
- static fromUrl(url: string, options?: FromUrlOptions): Promise<Image>;
12
- static fromBytes(data: Uint8Array, format?: string): Image;
13
- static fromBase64(base64: string, mimeType: string): Image;
14
- toContentBlock(): ImageContent;
15
- }
@@ -1,7 +0,0 @@
1
- export { fileTypeFromBuffer, type FileTypeResult } from "./mime.js";
2
- export { DEFAULT_FROM_URL_MAX_BYTES } from "./remote.js";
3
- export type { FromUrlOptions } from "./remote.js";
4
- export { Image, type ImageContent } from "./image.js";
5
- export { Audio, type AudioContent } from "./audio.js";
6
- export { File, type EmbeddedResource, type TextResourceContents, type BlobResourceContents, } from "./file.js";
7
- export { toContentBlocks, type ContentBlock, type TextContent, type ToolReturn, } from "./convert.js";
@@ -1,7 +0,0 @@
1
- export { fileTypeFromBuffer, type FileTypeResult } from "./file-type.js";
2
- export declare function parseContentType(value: string | null): {
3
- mimeType?: string;
4
- charset?: string;
5
- };
6
- export declare function assertBase64(value: string): void;
7
- export declare function safeRemoteLabel(url: string): string;
@@ -1,5 +0,0 @@
1
- export declare const DEFAULT_FROM_URL_MAX_BYTES: number;
2
- export interface FromUrlOptions {
3
- maxBytes?: number;
4
- }
5
- export declare function readRemoteBytes(response: Response, kind: string, url: string, options?: FromUrlOptions): Promise<Uint8Array>;
@@ -1,9 +0,0 @@
1
- export { createServer } from "./server.js";
2
- export type { CustomMethodHandler, MessageHandler, MessageSession, MessageSessionContext, Server } from "./server.js";
3
- export { defineSchema } from "./schema.js";
4
- export type { TypedSchema } from "./schema.js";
5
- export { Image, Audio, File, toContentBlocks, fileTypeFromBuffer, DEFAULT_FROM_URL_MAX_BYTES, } from "./content/index.js";
6
- export type { ImageContent, AudioContent, EmbeddedResource, TextResourceContents, BlobResourceContents, ContentBlock, TextContent, FileTypeResult, FromUrlOptions, } from "./content/index.js";
7
- export type { ToolReturn } from "./content/index.js";
8
- export type { ServerOptions, ToolHandler, ToolDefinition, Tool, ToolAnnotations, ToolExecution, Icon, ContentAnnotations, ResourceLink, CallToolResult, PromptContentItem, PromptArgument, Prompt, PromptMessage, GetPromptResult, PromptHandler, PromptDefinition, Resource, ResourceTemplate, ResourceContents, ReadResourceResult, ResourceHandler, ResourceDefinition, ResourceTemplateDefinition, HandleResult, ContentItem, JSONSchema, JSONSchemaProperty, Transport, SDKTransport, JSONRPCRequest, JSONRPCResponse, JSONRPCError, JSONRPCMessage, JSONRPCNotification, InitializeResult, } from "./types.js";
9
- export { JSON_RPC_ERROR_CODES, ToolError } from "./types.js";
@@ -1,20 +0,0 @@
1
- import type { JSONSchema } from "./types.js";
2
- type SchemaPropertyType = "string" | "number" | "integer" | "boolean" | "object" | "array";
3
- interface SchemaPropertyDef {
4
- type: SchemaPropertyType;
5
- description?: string;
6
- optional?: boolean;
7
- [keyword: string]: unknown;
8
- }
9
- type SchemaDefinition = Record<string, SchemaPropertyDef>;
10
- type InferType<T extends SchemaPropertyType> = T extends "string" ? string : T extends "number" | "integer" ? number : T extends "boolean" ? boolean : T extends "object" ? Record<string, unknown> : T extends "array" ? unknown[] : never;
11
- type InferSchema<T extends SchemaDefinition> = {
12
- [K in keyof T as T[K]["optional"] extends true ? never : K]: InferType<T[K]["type"]>;
13
- } & {
14
- [K in keyof T as T[K]["optional"] extends true ? K : never]?: InferType<T[K]["type"]>;
15
- };
16
- export interface TypedSchema<T> extends JSONSchema {
17
- __type?: T;
18
- }
19
- export declare function defineSchema<T extends SchemaDefinition>(definition: T): TypedSchema<InferSchema<T>>;
20
- export {};
@@ -1,35 +0,0 @@
1
- import type { ServerOptions, ToolDefinition, ToolHandler, HandleResult, Prompt, PromptHandler, Resource, ResourceHandler, ResourceTemplate, Transport, SDKTransport, JSONRPCNotification } from "./types.js";
2
- import type { TypedSchema } from "./schema.js";
3
- export interface Server {
4
- tool<TIn, TOut = never>(name: string, description: string, inputSchema: TypedSchema<TIn>, handler: ToolHandler<TIn, TOut>, outputSchema?: TypedSchema<TOut>): Server;
5
- registerTool<TIn, TOut = never>(definition: Omit<ToolDefinition<TIn, TOut>, "handler">, handler: ToolHandler<TIn, TOut>): Server;
6
- prompt(definition: Prompt, handler: PromptHandler): Server;
7
- resource(definition: Resource, handler: ResourceHandler): Server;
8
- resourceTemplate(definition: ResourceTemplate, handler: ResourceHandler): Server;
9
- method(name: string, handler: CustomMethodHandler): Server;
10
- onNotification(listener: (notification: JSONRPCNotification) => void): () => void;
11
- removeTool(name: string): boolean;
12
- removePrompt(name: string): boolean;
13
- removeResource(uri: string): boolean;
14
- removeResourceTemplate(uriTemplate: string): boolean;
15
- notifyToolsChanged(): Promise<void>;
16
- notifyPromptsChanged(): Promise<void>;
17
- notifyResourcesChanged(): Promise<void>;
18
- notifyResourceUpdated(uri: string): Promise<void>;
19
- createMessageSession(listener?: (notification: JSONRPCNotification) => void | Promise<void>): MessageSession;
20
- handleMessage(method: string, params?: Record<string, unknown>): Promise<HandleResult>;
21
- listen(): Promise<void>;
22
- connect(transport: Transport): Promise<void>;
23
- connectSDK(transport: SDKTransport): Promise<void>;
24
- }
25
- export interface MessageSessionContext {
26
- readonly signal: AbortSignal;
27
- notify(method: string, params?: Record<string, unknown>): Promise<void>;
28
- }
29
- export type CustomMethodHandler = (params: Record<string, unknown> | undefined, session: MessageSessionContext) => unknown | Promise<unknown>;
30
- export type MessageHandler = (method: string, params?: Record<string, unknown>) => Promise<HandleResult>;
31
- export interface MessageSession {
32
- handleMessage: MessageHandler;
33
- close(): void;
34
- }
35
- export declare function createServer(options: ServerOptions): Server;
@@ -1,256 +0,0 @@
1
- export interface JSONRPCRequest {
2
- jsonrpc: "2.0";
3
- id: string | number | null;
4
- method: string;
5
- params?: Record<string, unknown>;
6
- }
7
- export interface JSONRPCResponse {
8
- jsonrpc: "2.0";
9
- id: string | number | null;
10
- result?: unknown;
11
- error?: JSONRPCError;
12
- }
13
- export interface JSONRPCError {
14
- code: number;
15
- message: string;
16
- data?: unknown;
17
- }
18
- export declare const JSON_RPC_ERROR_CODES: Readonly<{
19
- readonly PARSE_ERROR: -32700;
20
- readonly INVALID_REQUEST: -32600;
21
- readonly METHOD_NOT_FOUND: -32601;
22
- readonly INVALID_PARAMS: -32602;
23
- readonly INTERNAL_ERROR: -32603;
24
- readonly RESOURCE_NOT_FOUND: -32002;
25
- }>;
26
- export declare class ToolError extends Error {
27
- readonly code: number;
28
- readonly data?: unknown | undefined;
29
- constructor(code: number, message: string, data?: unknown | undefined);
30
- }
31
- export interface ToolsCapability {
32
- listChanged?: boolean;
33
- }
34
- export interface PromptsCapability {
35
- listChanged?: boolean;
36
- }
37
- export interface ResourcesCapability {
38
- subscribe?: boolean;
39
- listChanged?: boolean;
40
- }
41
- export interface InitializeResult {
42
- protocolVersion: string;
43
- capabilities: {
44
- tools?: ToolsCapability;
45
- prompts?: PromptsCapability;
46
- resources?: ResourcesCapability;
47
- };
48
- serverInfo: {
49
- name: string;
50
- version: string;
51
- };
52
- }
53
- export interface Tool {
54
- name: string;
55
- title?: string;
56
- description?: string;
57
- inputSchema: JSONSchema;
58
- outputSchema?: JSONSchema;
59
- annotations?: ToolAnnotations;
60
- execution?: ToolExecution;
61
- icons?: Icon[];
62
- _meta?: Record<string, unknown>;
63
- }
64
- export interface CallToolResult {
65
- content: ContentItem[];
66
- structuredContent?: Record<string, unknown>;
67
- isError?: boolean;
68
- }
69
- export interface ToolAnnotations {
70
- title?: string;
71
- readOnlyHint?: boolean;
72
- destructiveHint?: boolean;
73
- idempotentHint?: boolean;
74
- openWorldHint?: boolean;
75
- }
76
- export interface ToolExecution {
77
- taskSupport?: "optional" | "required" | "forbidden";
78
- }
79
- export interface Icon {
80
- src: string;
81
- mimeType?: string;
82
- sizes?: string[];
83
- theme?: "light" | "dark";
84
- }
85
- export interface ContentAnnotations {
86
- audience?: Array<"user" | "assistant">;
87
- priority?: number;
88
- lastModified?: string;
89
- }
90
- export interface ResourceLink {
91
- type: "resource_link";
92
- uri: string;
93
- name: string;
94
- title?: string;
95
- description?: string;
96
- mimeType?: string;
97
- size?: number;
98
- annotations?: ContentAnnotations;
99
- }
100
- export interface PromptArgument {
101
- name: string;
102
- description?: string;
103
- required?: boolean;
104
- }
105
- export interface Prompt {
106
- name: string;
107
- title?: string;
108
- description?: string;
109
- arguments?: PromptArgument[];
110
- icons?: Icon[];
111
- _meta?: Record<string, unknown>;
112
- }
113
- export interface PromptMessage {
114
- role: "user" | "assistant";
115
- content: PromptContentItem;
116
- }
117
- export interface GetPromptResult {
118
- description?: string;
119
- messages: PromptMessage[];
120
- }
121
- export type PromptHandler = (args: Record<string, string>) => Promise<GetPromptResult> | GetPromptResult;
122
- export interface PromptDefinition extends Prompt {
123
- handler: PromptHandler;
124
- }
125
- export interface Resource {
126
- uri: string;
127
- name: string;
128
- title?: string;
129
- description?: string;
130
- mimeType?: string;
131
- size?: number;
132
- annotations?: ContentAnnotations;
133
- icons?: Icon[];
134
- _meta?: Record<string, unknown>;
135
- }
136
- export interface ResourceTemplate {
137
- uriTemplate: string;
138
- name: string;
139
- title?: string;
140
- description?: string;
141
- mimeType?: string;
142
- annotations?: ContentAnnotations;
143
- icons?: Icon[];
144
- _meta?: Record<string, unknown>;
145
- }
146
- export type ResourceContents = {
147
- uri: string;
148
- mimeType?: string;
149
- text: string;
150
- } | {
151
- uri: string;
152
- mimeType?: string;
153
- blob: string;
154
- };
155
- export interface ReadResourceResult {
156
- contents: ResourceContents[];
157
- }
158
- export type ResourceHandler = (uri: string) => Promise<ReadResourceResult> | ReadResourceResult;
159
- export interface ResourceDefinition extends Resource {
160
- handler: ResourceHandler;
161
- }
162
- export interface ResourceTemplateDefinition extends ResourceTemplate {
163
- handler: ResourceHandler;
164
- }
165
- export interface HandleResult {
166
- result?: unknown;
167
- error?: JSONRPCError;
168
- }
169
- export type PromptContentItem = {
170
- type: "text";
171
- text: string;
172
- annotations?: ContentAnnotations;
173
- } | {
174
- type: "image";
175
- data: string;
176
- mimeType: string;
177
- annotations?: ContentAnnotations;
178
- } | {
179
- type: "audio";
180
- data: string;
181
- mimeType: string;
182
- annotations?: ContentAnnotations;
183
- } | {
184
- type: "resource";
185
- annotations?: ContentAnnotations;
186
- resource: {
187
- uri: string;
188
- mimeType?: string;
189
- text: string;
190
- } | {
191
- uri: string;
192
- mimeType?: string;
193
- blob: string;
194
- };
195
- };
196
- export type ContentItem = PromptContentItem | ResourceLink;
197
- export interface JSONSchema {
198
- type: "object";
199
- properties?: Record<string, JSONSchemaProperty>;
200
- required?: string[];
201
- [keyword: string]: unknown;
202
- }
203
- export interface JSONSchemaProperty extends Record<string, unknown> {
204
- type?: string | string[];
205
- description?: string;
206
- [keyword: string]: unknown;
207
- }
208
- export interface ServerOptions {
209
- name: string;
210
- version: string;
211
- toolCallTimeoutMs?: number;
212
- /** Shared active tool-handler capacity across sessions; defaults to four. */
213
- maxConcurrentToolCalls?: number;
214
- /** Maximum tool calls waiting for capacity; defaults to 64. Zero disables waiting. */
215
- maxQueuedToolCalls?: number;
216
- /** Per-stdio-connection UTF-8 bytes queued or submitted but unsettled; defaults to 1 MiB. */
217
- maxStdioOutputBytes?: number;
218
- /** Per-stdio-connection messages awaiting handler/output settlement; defaults to 128. */
219
- maxPendingStdioMessages?: number;
220
- maxStdioLineBytes?: number;
221
- validateToolArguments?: boolean;
222
- supportNotifications?: boolean;
223
- supportResourceSubscriptions?: boolean;
224
- }
225
- import type { ToolReturn } from "./content/index.js";
226
- export type ToolHandler<T = Record<string, unknown>, TOut = ToolReturn> = (args: T) => Promise<TOut | CallToolResult> | TOut | CallToolResult;
227
- export interface ToolDefinition<T = Record<string, unknown>, TOut = ToolReturn> {
228
- name: string;
229
- title?: string;
230
- description?: string;
231
- inputSchema: JSONSchema;
232
- outputSchema?: JSONSchema;
233
- annotations?: ToolAnnotations;
234
- execution?: ToolExecution;
235
- icons?: Icon[];
236
- _meta?: Record<string, unknown>;
237
- handler: ToolHandler<T, TOut>;
238
- }
239
- export interface Transport {
240
- readable: NodeJS.ReadableStream;
241
- writable: NodeJS.WritableStream;
242
- }
243
- export interface SDKTransport {
244
- onmessage?: (message: JSONRPCMessage) => void;
245
- onclose?: () => void;
246
- onerror?: (error: Error) => void;
247
- start: () => Promise<void>;
248
- close: () => Promise<void>;
249
- send: (message: JSONRPCMessage) => Promise<void>;
250
- }
251
- export type JSONRPCMessage = JSONRPCRequest | JSONRPCResponse | JSONRPCNotification;
252
- export interface JSONRPCNotification {
253
- jsonrpc: "2.0";
254
- method: string;
255
- params?: Record<string, unknown>;
256
- }