omnius 1.0.885 → 1.0.887

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnius",
3
- "version": "1.0.885",
3
+ "version": "1.0.887",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/library.js",
@@ -146,13 +146,14 @@
146
146
  "viem": "2.47.4"
147
147
  },
148
148
  "optionalDependencies": {
149
- "moondream": "^0.2.0",
149
+ "moondream": "file:vendor/moondream",
150
150
  "neovim": "^5.4.0",
151
- "node-pty": "^1.1.0",
151
+ "node-pty": "npm:@lydell/node-pty@1.2.0-beta.15",
152
152
  "systray2": "2.1.4",
153
153
  "transcribe-cli": "^2.0.1",
154
154
  "viem": "2.47.4",
155
- "cli-highlight": "^2.1.11"
155
+ "cli-highlight": "^2.1.11",
156
+ "sharp": "0.35.5"
156
157
  },
157
158
  "readme": "# Omnius\n\nOmnius is a local-first runtime for AI-assisted software development and generative work. It brings a terminal interface, browser dashboard, automation API, agent execution, memory, and media tools into one workspace-oriented system.\n\nOmnius connects to local and remote model providers. Projects retain their own sessions and generated artifacts, while model weights and runtime dependencies are shared across workspaces.\n\n[![npm](https://img.shields.io/npm/v/omnius.svg)](https://www.npmjs.com/package/omnius)\n[![Node](https://img.shields.io/badge/node-%3E%3D22-brightgreen.svg)](https://nodejs.org/)\n[![License](https://img.shields.io/badge/license-CC--BY--NC--4.0-blue.svg)](https://creativecommons.org/licenses/by-nc/4.0/)\n\n## Get started\n\nRequires Node.js 22 or newer and npm 10 or newer.\n\n```bash\nnpm install -g omnius\nomnius\n```\n\nUse `/setup` to configure inference and `/help` to explore terminal commands. See [installation](docs/getting-started/install.md), [first run](docs/getting-started/first-run.md), and [model providers](docs/getting-started/model-providers.md) for setup details.\n\nTo open the browser dashboard and API:\n\n```bash\nomnius serve\n```\n\nThe default dashboard address is `http://127.0.0.1:11435/`, with interactive API documentation at `/docs`.\n\n## System overview\n\n| Layer | Responsibility |\n| --- | --- |\n| Interfaces | Terminal sessions, browser workspaces, command-line automation, and system tray integration |\n| Agent runtime | Task execution, tool use, delegated agents, verification, and resumable work |\n| Inference | Model selection and routing across local servers, configured providers, and peers |\n| Tools | Files, code, shell commands, web access, browser automation, and extensible capabilities |\n| Memory and retrieval | Project context, indexed material, persistent memory, and targeted retrieval |\n| Media and voice | Image, video, audio, music, speech recognition, and speech synthesis |\n| Integration | REST APIs, events, MCP, Telegram, and shared inference services |\n\nThe [architecture overview](docs/architecture/overview.md) and [agent system map](docs/architecture/agent-system-map.md) describe the runtime boundaries and state ownership.\n\n## Workspaces and sessions\n\nA project provides the working directory for files, tools, conversations, and generated media. Terminal and browser interfaces expose saved sessions and project artifacts. Operational details remain available alongside the conversation without replacing its authored content.\n\nProject state lives under `.omnius/`. Shared model weights and runtime dependencies are managed separately from project-generated media. See [terminal workflows](docs/guides/tui-workflows.md), the [dashboard guide](docs/guides/dashboard.md), and [media generation](docs/guides/media-generation.md).\n\n## Automation and discovery\n\nOmnius can run a task directly from the command line:\n\n```bash\nomnius \"inspect this repository and explain its main entrypoints\"\n```\n\nAgents and integrations can discover capabilities through the CLI or daemon:\n\n```bash\nomnius discover \"bring your own inference\"\nomnius show layer.orchestration\nomnius capabilities --json\n```\n\nThe daemon provides stateful chat, agent execution, tools, memory, media, and OpenAI/Ollama-compatible inference interfaces. Begin with [agent integration](docs/guides/agent-integration.md) and the [discovery guide](docs/DISCOVERY.md).\n\n<!-- BEGIN GENERATED REST INVENTORY -->\nThe complete API inventory is maintained in the [REST reference](docs/reference/rest-api.md). The running daemon serves its machine-readable contract at `/openapi.json`.\n<!-- END GENERATED REST INVENTORY -->\n\n## Documentation\n\n| Topic | Guide |\n| --- | --- |\n| Inference configuration | [Provider protocols and keys](docs/guides/bring-your-own-inference.md) |\n| Commands and tools | [Slash commands](docs/reference/slash-commands.md), [tool discovery](docs/guides/tools-and-web-search.md) |\n| Agent coordination | [Adjudication](docs/ADJUDICATION.md), [agent system map](docs/architecture/agent-system-map.md) |\n| Browser interface | [Dashboard](docs/guides/dashboard.md) |\n| Voice and media | [Realtime voice](docs/guides/realtime.md), [media generation](docs/guides/media-generation.md), [Omni analysis](docs/reference/omni-analysis.md) |\n| Connected services | [Telegram](docs/guides/telegram.md), [system tray](docs/guides/system-tray.md), [sponsor and peer inference](docs/guides/sponsor-and-cohere.md) |\n| Runtime administration | [Runtime hygiene](docs/operations/runtime-hygiene.md), [access control](docs/operations/security-and-remote-access.md) |\n| Agent-readable documentation | [Documentation index](docs/agent-memory/INDEX.md) |\n\n## Development\n\nThe repository is a pnpm workspace. `packages/cli` contains the interfaces and daemon; `packages/orchestrator` coordinates agent execution; `packages/execution` provides tools. Supporting packages cover memory, indexing, retrieval, schemas, prompts, and backend integration.\n\nRequires pnpm 9 or newer.\n\n```bash\npnpm install\npnpm -r build\npnpm docs:check\n```\n\nPublishing uses the generated `publish/` package. The build, verification, and release procedure is documented in [AGENTS.md](AGENTS.md).\n\n## License\n\nOmnius is released under [CC-BY-NC-4.0](https://creativecommons.org/licenses/by-nc/4.0/) for non-commercial use. Commercial use, redistribution, hosted services, and enterprise deployment require a commercial license.\n"
158
159
  }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) M87 Labs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,11 @@
1
+ # Omnius Moondream client distribution
2
+
3
+ This package preserves the runtime and public types of [moondream 0.2.0](https://github.com/m87-labs/moondream-node), published by M87 Labs <contact@moondream.ai> under the MIT license.
4
+
5
+ Upstream npm tarball: `moondream@0.2.0`
6
+
7
+ Integrity: `sha512-8w/4uyHqHnkNhnQ0xo1eS+TZfRygPXKNVK09Gw+7Zk6zAkQaGX77y+JMXjbtgst9g+3Bwa8sLBEdVIzwTvhkHw==`
8
+
9
+ The runtime and declarations come from the upstream tarball's `dist/src/`. The sole runtime change adjusts its package-version import for this directory layout. The manifest pins Sharp 0.35.5, which supplies prebuilt native binaries through npm without an install lifecycle or GitHub libvips download. Development tooling and upstream integration tests are excluded.
10
+
11
+ The publish builder copies this directory to `publish/vendor/moondream` and declares its Sharp dependency directly as well: npm global tarball installations can skip dependencies of local directory links. No inference protocol or SDK methods are changed.
@@ -0,0 +1,292 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.vl = void 0;
7
+ const buffer_1 = require("buffer");
8
+ const sharp_1 = __importDefault(require("sharp"));
9
+ const http_1 = __importDefault(require("http"));
10
+ const https_1 = __importDefault(require("https"));
11
+ const package_json_1 = require("./package.json");
12
+ const DEFAULT_ENDPOINT = 'https://api.moondream.ai/v1';
13
+ class vl {
14
+ constructor(config) {
15
+ this.apiKey = config.apiKey || '';
16
+ this.endpoint = config.endpoint || DEFAULT_ENDPOINT;
17
+ if (this.apiKey === '' && this.endpoint === DEFAULT_ENDPOINT) {
18
+ throw new Error('An apiKey is required for cloud inference. ');
19
+ }
20
+ }
21
+ async encodeImage(image) {
22
+ if ('imageUrl' in image) {
23
+ return image;
24
+ }
25
+ try {
26
+ // Process image with Sharp
27
+ const metadata = await (0, sharp_1.default)(image).metadata();
28
+ if (!metadata.width || !metadata.height) {
29
+ throw new Error('Unable to get image dimensions');
30
+ }
31
+ let processedImage = (0, sharp_1.default)(image);
32
+ const buffer = await processedImage
33
+ .toFormat('jpeg', { quality: 95 })
34
+ .toBuffer();
35
+ const base64Image = buffer.toString('base64');
36
+ return {
37
+ imageUrl: `data:image/jpeg;base64,${base64Image}`,
38
+ };
39
+ }
40
+ catch (error) {
41
+ throw new Error(`Failed to convert image to JPEG: ${error.message}`);
42
+ }
43
+ }
44
+ makeRequest(path, body, stream = false) {
45
+ return new Promise((resolve, reject) => {
46
+ const url = new URL(this.endpoint + path);
47
+ const requestBody = JSON.stringify(body);
48
+ const options = {
49
+ method: 'POST',
50
+ headers: {
51
+ 'X-Moondream-Auth': this.apiKey,
52
+ 'Content-Type': 'application/json',
53
+ 'User-Agent': `moondream-node/${package_json_1.version}`,
54
+ 'Content-Length': buffer_1.Buffer.byteLength(requestBody)
55
+ }
56
+ };
57
+ const client = url.protocol === 'https:' ? https_1.default : http_1.default;
58
+ const req = client.request(url, options, (res) => {
59
+ if (stream) {
60
+ resolve(res);
61
+ return;
62
+ }
63
+ let data = '';
64
+ res.on('data', chunk => data += chunk);
65
+ res.on('end', () => {
66
+ if (res.statusCode !== 200) {
67
+ reject(new Error(`HTTP error! status: ${res.statusCode}`));
68
+ return;
69
+ }
70
+ try {
71
+ resolve(JSON.parse(data));
72
+ }
73
+ catch (error) {
74
+ reject(new Error(`Failed to parse JSON response: ${error.message}`));
75
+ }
76
+ });
77
+ });
78
+ req.on('error', (error) => {
79
+ reject(error);
80
+ });
81
+ req.write(requestBody);
82
+ req.end();
83
+ });
84
+ }
85
+ async *streamResponse(response) {
86
+ let buffer = '';
87
+ try {
88
+ for await (const chunk of response) {
89
+ buffer += chunk.toString();
90
+ const lines = buffer.split('\n');
91
+ buffer = lines.pop() || '';
92
+ for (const line of lines) {
93
+ if (line.startsWith('data: ')) {
94
+ try {
95
+ const data = JSON.parse(line.slice(6));
96
+ if ('chunk' in data) {
97
+ yield data.chunk;
98
+ }
99
+ if (data.completed) {
100
+ return;
101
+ }
102
+ }
103
+ catch (error) {
104
+ throw new Error(`Failed to parse JSON response from server: ${error.message}`);
105
+ }
106
+ }
107
+ }
108
+ }
109
+ // Handle any remaining data in the buffer
110
+ if (buffer) {
111
+ const lines = buffer.split('\n');
112
+ for (const line of lines) {
113
+ if (line.startsWith('data: ')) {
114
+ try {
115
+ const data = JSON.parse(line.slice(6));
116
+ if ('chunk' in data) {
117
+ yield data.chunk;
118
+ }
119
+ }
120
+ catch (error) {
121
+ throw new Error(`Failed to parse JSON response from server: ${error.message}`);
122
+ }
123
+ }
124
+ }
125
+ }
126
+ }
127
+ catch (error) {
128
+ throw new Error(`Failed to stream response: ${error.message}`);
129
+ }
130
+ }
131
+ async caption(request) {
132
+ const encodedImage = await this.encodeImage(request.image);
133
+ const requestBody = {
134
+ image_url: encodedImage.imageUrl,
135
+ length: request.length,
136
+ stream: request.stream,
137
+ };
138
+ if (request.variant) {
139
+ requestBody.variant = request.variant;
140
+ }
141
+ const response = await this.makeRequest('/caption', requestBody, request.stream);
142
+ if (request.stream) {
143
+ return { caption: this.streamResponse(response) };
144
+ }
145
+ return { caption: response.caption };
146
+ }
147
+ async query(request) {
148
+ let requestBody = {
149
+ question: request.question,
150
+ stream: request.stream,
151
+ };
152
+ if (request.image) {
153
+ const encodedImage = await this.encodeImage(request.image);
154
+ requestBody.image_url = encodedImage.imageUrl;
155
+ }
156
+ if (request.reasoning !== undefined) {
157
+ requestBody.reasoning = request.reasoning;
158
+ }
159
+ if (request.variant) {
160
+ requestBody.variant = request.variant;
161
+ }
162
+ const response = await this.makeRequest('/query', requestBody, request.stream);
163
+ if (request.stream) {
164
+ return { answer: this.streamResponse(response) };
165
+ }
166
+ const result = { answer: response.answer };
167
+ if (response.reasoning) {
168
+ result.reasoning = response.reasoning;
169
+ }
170
+ return result;
171
+ }
172
+ async detect(request) {
173
+ const encodedImage = await this.encodeImage(request.image);
174
+ const requestBody = {
175
+ image_url: encodedImage.imageUrl,
176
+ object: request.object,
177
+ };
178
+ if (request.variant) {
179
+ requestBody.variant = request.variant;
180
+ }
181
+ const response = await this.makeRequest('/detect', requestBody);
182
+ return { objects: response.objects };
183
+ }
184
+ async point(request) {
185
+ const encodedImage = await this.encodeImage(request.image);
186
+ const requestBody = {
187
+ image_url: encodedImage.imageUrl,
188
+ object: request.object,
189
+ };
190
+ if (request.variant) {
191
+ requestBody.variant = request.variant;
192
+ }
193
+ const response = await this.makeRequest('/point', requestBody);
194
+ return { points: response.points };
195
+ }
196
+ async *streamSegmentResponse(response) {
197
+ let buffer = '';
198
+ try {
199
+ for await (const chunk of response) {
200
+ buffer += chunk.toString();
201
+ const lines = buffer.split('\n');
202
+ buffer = lines.pop() || '';
203
+ for (const line of lines) {
204
+ if (line.startsWith('data: ')) {
205
+ try {
206
+ const data = JSON.parse(line.slice(6));
207
+ const msgType = data.type || '';
208
+ if (msgType === 'bbox') {
209
+ yield { bbox: data.bbox };
210
+ }
211
+ else if (msgType === 'path_delta') {
212
+ if (data.chunk) {
213
+ yield { chunk: data.chunk };
214
+ }
215
+ }
216
+ else if (msgType === 'final') {
217
+ yield {
218
+ path: data.path || '',
219
+ bbox: data.bbox,
220
+ completed: true,
221
+ };
222
+ return;
223
+ }
224
+ }
225
+ catch (error) {
226
+ throw new Error(`Failed to parse JSON response from server: ${error.message}`);
227
+ }
228
+ }
229
+ }
230
+ }
231
+ // Handle any remaining data in the buffer
232
+ if (buffer) {
233
+ const lines = buffer.split('\n');
234
+ for (const line of lines) {
235
+ if (line.startsWith('data: ')) {
236
+ try {
237
+ const data = JSON.parse(line.slice(6));
238
+ const msgType = data.type || '';
239
+ if (msgType === 'bbox') {
240
+ yield { bbox: data.bbox };
241
+ }
242
+ else if (msgType === 'path_delta') {
243
+ if (data.chunk) {
244
+ yield { chunk: data.chunk };
245
+ }
246
+ }
247
+ else if (msgType === 'final') {
248
+ yield {
249
+ path: data.path || '',
250
+ bbox: data.bbox,
251
+ completed: true,
252
+ };
253
+ }
254
+ }
255
+ catch (error) {
256
+ throw new Error(`Failed to parse JSON response from server: ${error.message}`);
257
+ }
258
+ }
259
+ }
260
+ }
261
+ }
262
+ catch (error) {
263
+ throw new Error(`Failed to stream response: ${error.message}`);
264
+ }
265
+ }
266
+ async segment(request) {
267
+ const encodedImage = await this.encodeImage(request.image);
268
+ const requestBody = {
269
+ image_url: encodedImage.imageUrl,
270
+ object: request.object,
271
+ stream: request.stream || false,
272
+ };
273
+ if (request.spatialRefs) {
274
+ requestBody.spatial_refs = request.spatialRefs;
275
+ }
276
+ if (request.settings) {
277
+ requestBody.settings = request.settings;
278
+ }
279
+ if (request.variant) {
280
+ requestBody.variant = request.variant;
281
+ }
282
+ const response = await this.makeRequest('/segment', requestBody, request.stream);
283
+ if (request.stream) {
284
+ return { stream: this.streamSegmentResponse(response) };
285
+ }
286
+ return {
287
+ path: response.path,
288
+ bbox: response.bbox,
289
+ };
290
+ }
291
+ }
292
+ exports.vl = vl;
@@ -0,0 +1,19 @@
1
+ import { CaptionOutput, QueryOutput, DetectOutput, PointOutput, SegmentOutput, SegmentStreamOutput, CaptionRequest, QueryRequest, DetectRequest, PointRequest, SegmentRequest } from './types';
2
+ export interface MoondreamVLConfig {
3
+ apiKey?: string;
4
+ endpoint?: string;
5
+ }
6
+ export declare class vl {
7
+ private apiKey;
8
+ private endpoint;
9
+ constructor(config: MoondreamVLConfig);
10
+ private encodeImage;
11
+ private makeRequest;
12
+ private streamResponse;
13
+ caption(request: CaptionRequest): Promise<CaptionOutput>;
14
+ query(request: QueryRequest): Promise<QueryOutput>;
15
+ detect(request: DetectRequest): Promise<DetectOutput>;
16
+ point(request: PointRequest): Promise<PointOutput>;
17
+ private streamSegmentResponse;
18
+ segment(request: SegmentRequest): Promise<SegmentOutput | SegmentStreamOutput>;
19
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "moondream",
3
+ "version": "0.2.0-omnius.1",
4
+ "description": "Moondream 0.2.0 client with Omnius' compiler-free Sharp dependency.",
5
+ "main": "index.cjs",
6
+ "types": "index.d.ts",
7
+ "files": [
8
+ "index.cjs",
9
+ "index.d.ts",
10
+ "types.d.ts",
11
+ "README.md",
12
+ "LICENSE"
13
+ ],
14
+ "author": "M87 Labs <contact@moondream.ai>",
15
+ "license": "MIT",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/m87-labs/moondream-node"
19
+ },
20
+ "engines": {
21
+ "node": ">=22.0.0"
22
+ },
23
+ "dependencies": {
24
+ "sharp": "0.35.5"
25
+ }
26
+ }
@@ -0,0 +1,208 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ /**
4
+ * Base interface for encoded images
5
+ */
6
+ export interface Base64EncodedImage {
7
+ imageUrl: string;
8
+ }
9
+ /**
10
+ * Length options for caption generation
11
+ */
12
+ export type Length = "normal" | "short" | "long";
13
+ /**
14
+ * Settings for controlling the model's generation behavior
15
+ */
16
+ export interface SamplingSettings {
17
+ maxTokens?: number;
18
+ }
19
+ /**
20
+ * Base request interface with common properties
21
+ */
22
+ export interface BaseRequest {
23
+ variant?: string;
24
+ settings?: SamplingSettings;
25
+ }
26
+ /**
27
+ * Request structure for image caption requests
28
+ */
29
+ export interface CaptionRequest extends BaseRequest {
30
+ image: Buffer | Base64EncodedImage;
31
+ length?: Length;
32
+ stream?: boolean;
33
+ }
34
+ /**
35
+ * Response structure for image caption requests
36
+ */
37
+ export interface CaptionOutput {
38
+ caption: string | AsyncGenerator<string, void, unknown>;
39
+ }
40
+ /**
41
+ * Request structure for image query requests
42
+ */
43
+ export interface QueryRequest extends BaseRequest {
44
+ image?: Buffer | Base64EncodedImage;
45
+ question: string;
46
+ reasoning?: boolean;
47
+ stream?: boolean;
48
+ }
49
+ /**
50
+ * Reasoning grounding structure
51
+ */
52
+ export interface ReasoningGrounding {
53
+ start_idx: number;
54
+ end_idx: number;
55
+ points: [number, number][];
56
+ }
57
+ /**
58
+ * Reasoning structure
59
+ */
60
+ export interface Reasoning {
61
+ text: string;
62
+ grounding: ReasoningGrounding[];
63
+ }
64
+ /**
65
+ * Response structure for image query requests
66
+ */
67
+ export interface QueryOutput {
68
+ answer: string | AsyncGenerator<string, void, unknown>;
69
+ reasoning?: Reasoning;
70
+ }
71
+ /**
72
+ * Request structure for object detection requests
73
+ */
74
+ export interface DetectRequest extends BaseRequest {
75
+ image: Buffer | Base64EncodedImage;
76
+ object: string;
77
+ }
78
+ /**
79
+ * Response structure for object detection requests
80
+ */
81
+ export interface DetectOutput {
82
+ objects: DetectedObject[];
83
+ }
84
+ /**
85
+ * Object detection result
86
+ */
87
+ export interface DetectedObject {
88
+ x_min: number;
89
+ y_min: number;
90
+ x_max: number;
91
+ y_max: number;
92
+ }
93
+ /**
94
+ * Response structure for object detection requests
95
+ */
96
+ export interface DetectOutput {
97
+ objects: DetectedObject[];
98
+ }
99
+ /**
100
+ * Error response from the API
101
+ */
102
+ export interface ApiError {
103
+ error: {
104
+ message: string;
105
+ code?: string;
106
+ details?: unknown;
107
+ };
108
+ }
109
+ /**
110
+ * Configuration options for the client
111
+ */
112
+ export interface ClientConfig {
113
+ apiKey: string;
114
+ endpoint?: string;
115
+ timeout?: number;
116
+ retries?: number;
117
+ }
118
+ /**
119
+ * API response for streaming requests
120
+ */
121
+ export interface StreamResponse {
122
+ chunk?: string;
123
+ completed?: boolean;
124
+ error?: string;
125
+ }
126
+ /**
127
+ * Options for image processing
128
+ */
129
+ export interface ImageProcessingOptions {
130
+ maxSize?: number;
131
+ quality?: number;
132
+ format?: "jpeg" | "png" | "gif";
133
+ }
134
+ /**
135
+ * Common response type for all API endpoints
136
+ */
137
+ export type ApiResponse<T> = {
138
+ success: boolean;
139
+ data?: T;
140
+ error?: ApiError;
141
+ timestamp?: string;
142
+ requestId?: string;
143
+ };
144
+ /**
145
+ * Pointing request structure
146
+ */
147
+ export interface PointRequest extends BaseRequest {
148
+ image: Buffer | Base64EncodedImage;
149
+ object: string;
150
+ }
151
+ /**
152
+ * Point coordinates for object location
153
+ */
154
+ export interface Point {
155
+ x: number;
156
+ y: number;
157
+ }
158
+ /**
159
+ * Response structure for point requests
160
+ */
161
+ export interface PointOutput {
162
+ points: Point[];
163
+ }
164
+ /**
165
+ * Spatial reference for segmentation - either a point [x, y] or bbox [x1, y1, x2, y2]
166
+ * Values are normalized to [0, 1]
167
+ */
168
+ export type SpatialRef = [number, number] | [number, number, number, number];
169
+ /**
170
+ * Request structure for segmentation requests
171
+ */
172
+ export interface SegmentRequest extends BaseRequest {
173
+ image: Buffer | Base64EncodedImage;
174
+ object: string;
175
+ spatialRefs?: SpatialRef[];
176
+ stream?: boolean;
177
+ }
178
+ /**
179
+ * Bounding box for segmentation result
180
+ */
181
+ export interface SegmentBbox {
182
+ x_min: number;
183
+ y_min: number;
184
+ x_max: number;
185
+ y_max: number;
186
+ }
187
+ /**
188
+ * Response structure for non-streaming segmentation requests
189
+ */
190
+ export interface SegmentOutput {
191
+ path: string;
192
+ bbox?: SegmentBbox;
193
+ }
194
+ /**
195
+ * Streaming update for segmentation
196
+ */
197
+ export interface SegmentStreamChunk {
198
+ bbox?: SegmentBbox;
199
+ chunk?: string;
200
+ path?: string;
201
+ completed?: boolean;
202
+ }
203
+ /**
204
+ * Response structure for streaming segmentation requests
205
+ */
206
+ export interface SegmentStreamOutput {
207
+ stream: AsyncGenerator<SegmentStreamChunk, void, unknown>;
208
+ }