@mindees/ai 0.2.0 → 0.3.0

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/index.d.ts CHANGED
@@ -12,7 +12,7 @@ import { Maturity, NotImplementedError, PackageInfo, notImplemented } from "@min
12
12
  /** The npm package name. */
13
13
  declare const name = "@mindees/ai";
14
14
  /** The package version. All `@mindees/*` packages share one locked version line. */
15
- declare const VERSION = "0.2.0";
15
+ declare const VERSION = "0.3.0";
16
16
  /** Current maturity of this package. See the repository `STATUS.md`. */
17
17
  declare const maturity: Maturity;
18
18
  /**
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ import { NotImplementedError, notImplemented } from "@mindees/core";
10
10
  /** The npm package name. */
11
11
  const name = "@mindees/ai";
12
12
  /** The package version. All `@mindees/*` packages share one locked version line. */
13
- const VERSION = "0.2.0";
13
+ const VERSION = "0.3.0";
14
14
  /** Current maturity of this package. See the repository `STATUS.md`. */
15
15
  const maturity = "experimental";
16
16
  /**
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * `@mindees/ai` (Synapse) — provider-agnostic AI + dev-time intelligence.\n *\n * Phase 11 ships the **contract** ({@link createAi}, {@link AiBackend}, messages,\n * {@link GenerateRequest}/{@link AiResult}/{@link AiChunk}, {@link AiError}) with\n * streaming as `AsyncIterable` only (Node/browser/Hermes-safe), a deterministic\n * {@link createMockBackend mock backend} (the working, offline, no-keys fallback),\n * Standard-Schema structured output, bounded tool calling, an inject-`fetch` server\n * backend on the `@mindees/ai/server` subpath, and a dev-time error explainer on the\n * `@mindees/ai/devtools` subpath. The {@link createOnDeviceBackend on-device seam}\n * throws because on-device LLM inference is inherently native and stays a 🔬 research\n * track.\n *\n * @module\n */\n\nimport type { Maturity, PackageInfo } from '@mindees/core'\nimport { NotImplementedError, notImplemented } from '@mindees/core'\n\n/** The npm package name. */\nexport const name = '@mindees/ai'\n\n/** The package version. All `@mindees/*` packages share one locked version line. */\nexport const VERSION = '0.2.0'\n\n/** Current maturity of this package. See the repository `STATUS.md`. */\nexport const maturity: Maturity = 'experimental'\n\n/**\n * Static identity + maturity metadata for this package. Frozen so the\n * self-reported identity tooling introspects cannot be mutated at runtime,\n * matching the `readonly` fields of {@link PackageInfo}.\n */\nexport const info: PackageInfo = Object.freeze({ name, version: VERSION, maturity })\n\nexport {\n type AbortLike,\n type Ai,\n type AiBackend,\n type AiChunk,\n type AiResult,\n createAi,\n type FinishReason,\n type GenerateRequest,\n type Message,\n messageText,\n type Part,\n type Role,\n type TextPart,\n type ToolCallPart,\n type ToolDefinition,\n type ToolResultPart,\n type Usage,\n} from './contract'\nexport { AiError, type AiErrorCode, type AiErrorOptions } from './errors'\nexport {\n containsForbiddenKey,\n DEFAULT_MAX_INPUT_CHARS,\n type ExtractResult,\n extractJson,\n formatIssues,\n lenientParseJson,\n type SanitizeLimits,\n sanitizeJson,\n type ValidationOutcome,\n validateStandard,\n} from './json'\nexport {\n createMockBackend,\n type MockBackendOptions,\n type MockReply,\n type MockResponse,\n} from './mock'\nexport {\n type GenerateObjectOptions,\n type GenerateObjectResult,\n type GeneratingBackend,\n generateObject,\n type StreamingBackend,\n type StreamObjectChunk,\n type StreamObjectOptions,\n streamObject,\n} from './object'\nexport { createOnDeviceBackend } from './on-device'\nexport type { StandardSchemaV1 } from './standard-schema'\nexport {\n type RunToolsOptions,\n type RunToolsResult,\n runTools,\n type Tool,\n type ToolContext,\n} from './tools'\n\nexport type { Maturity, PackageInfo }\nexport { NotImplementedError, notImplemented }\n"],"mappings":";;;;;;;;;;AAoBA,MAAa,OAAO;;AAGpB,MAAa,UAAU;;AAGvB,MAAa,WAAqB;;;;;;AAOlC,MAAa,OAAoB,OAAO,OAAO;CAAE;CAAM,SAAS;CAAS;AAAS,CAAC"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * `@mindees/ai` (Synapse) — provider-agnostic AI + dev-time intelligence.\n *\n * Phase 11 ships the **contract** ({@link createAi}, {@link AiBackend}, messages,\n * {@link GenerateRequest}/{@link AiResult}/{@link AiChunk}, {@link AiError}) with\n * streaming as `AsyncIterable` only (Node/browser/Hermes-safe), a deterministic\n * {@link createMockBackend mock backend} (the working, offline, no-keys fallback),\n * Standard-Schema structured output, bounded tool calling, an inject-`fetch` server\n * backend on the `@mindees/ai/server` subpath, and a dev-time error explainer on the\n * `@mindees/ai/devtools` subpath. The {@link createOnDeviceBackend on-device seam}\n * throws because on-device LLM inference is inherently native and stays a 🔬 research\n * track.\n *\n * @module\n */\n\nimport type { Maturity, PackageInfo } from '@mindees/core'\nimport { NotImplementedError, notImplemented } from '@mindees/core'\n\n/** The npm package name. */\nexport const name = '@mindees/ai'\n\n/** The package version. All `@mindees/*` packages share one locked version line. */\nexport const VERSION = '0.3.0'\n\n/** Current maturity of this package. See the repository `STATUS.md`. */\nexport const maturity: Maturity = 'experimental'\n\n/**\n * Static identity + maturity metadata for this package. Frozen so the\n * self-reported identity tooling introspects cannot be mutated at runtime,\n * matching the `readonly` fields of {@link PackageInfo}.\n */\nexport const info: PackageInfo = Object.freeze({ name, version: VERSION, maturity })\n\nexport {\n type AbortLike,\n type Ai,\n type AiBackend,\n type AiChunk,\n type AiResult,\n createAi,\n type FinishReason,\n type GenerateRequest,\n type Message,\n messageText,\n type Part,\n type Role,\n type TextPart,\n type ToolCallPart,\n type ToolDefinition,\n type ToolResultPart,\n type Usage,\n} from './contract'\nexport { AiError, type AiErrorCode, type AiErrorOptions } from './errors'\nexport {\n containsForbiddenKey,\n DEFAULT_MAX_INPUT_CHARS,\n type ExtractResult,\n extractJson,\n formatIssues,\n lenientParseJson,\n type SanitizeLimits,\n sanitizeJson,\n type ValidationOutcome,\n validateStandard,\n} from './json'\nexport {\n createMockBackend,\n type MockBackendOptions,\n type MockReply,\n type MockResponse,\n} from './mock'\nexport {\n type GenerateObjectOptions,\n type GenerateObjectResult,\n type GeneratingBackend,\n generateObject,\n type StreamingBackend,\n type StreamObjectChunk,\n type StreamObjectOptions,\n streamObject,\n} from './object'\nexport { createOnDeviceBackend } from './on-device'\nexport type { StandardSchemaV1 } from './standard-schema'\nexport {\n type RunToolsOptions,\n type RunToolsResult,\n runTools,\n type Tool,\n type ToolContext,\n} from './tools'\n\nexport type { Maturity, PackageInfo }\nexport { NotImplementedError, notImplemented }\n"],"mappings":";;;;;;;;;;AAoBA,MAAa,OAAO;;AAGpB,MAAa,UAAU;;AAGvB,MAAa,WAAqB;;;;;;AAOlC,MAAa,OAAoB,OAAO,OAAO;CAAE;CAAM,SAAS;CAAS;AAAS,CAAC"}
@@ -3,7 +3,12 @@ import { AiBackend } from "./contract.js";
3
3
  //#region src/on-device.d.ts
4
4
  /**
5
5
  * 🔬 Research track — not implemented. Returns an {@link AiBackend} whose `generate`
6
- * and `stream` throw {@link NotImplementedError}. Use a mock or server backend instead.
6
+ * **rejects** and whose `stream` **throws on iteration** with a {@link NotImplementedError}.
7
+ *
8
+ * It does NOT throw synchronously from the method call: the contract is `generate(): Promise`
9
+ * and `stream(): AsyncIterable`, so a caller's `await backend.generate(...)` / `for await` is
10
+ * what surfaces the error — the same shape a future native runtime will have. Use a mock or
11
+ * server backend for the working path.
7
12
  *
8
13
  * @experimental
9
14
  */
@@ -1 +1 @@
1
- {"version":3,"file":"on-device.d.ts","names":[],"sources":["../src/on-device.ts"],"mappings":";;;;;;;;;iBAqBgB,qBAAA,IAAyB,SAAS"}
1
+ {"version":3,"file":"on-device.d.ts","names":[],"sources":["../src/on-device.ts"],"mappings":";;;;;;;;;;;;;;iBA0BgB,qBAAA,IAAyB,SAAS"}
package/dist/on-device.js CHANGED
@@ -1,4 +1,4 @@
1
- import { notImplemented } from "@mindees/core";
1
+ import { NotImplementedError } from "@mindees/core";
2
2
  //#region src/on-device.ts
3
3
  /**
4
4
  * 🔬 Research track — the on-device AI backend seam. Every on-device LLM runtime is
@@ -13,17 +13,24 @@ import { notImplemented } from "@mindees/core";
13
13
  */
14
14
  /**
15
15
  * 🔬 Research track — not implemented. Returns an {@link AiBackend} whose `generate`
16
- * and `stream` throw {@link NotImplementedError}. Use a mock or server backend instead.
16
+ * **rejects** and whose `stream` **throws on iteration** with a {@link NotImplementedError}.
17
+ *
18
+ * It does NOT throw synchronously from the method call: the contract is `generate(): Promise`
19
+ * and `stream(): AsyncIterable`, so a caller's `await backend.generate(...)` / `for await` is
20
+ * what surfaces the error — the same shape a future native runtime will have. Use a mock or
21
+ * server backend for the working path.
17
22
  *
18
23
  * @experimental
19
24
  */
20
25
  function createOnDeviceBackend() {
21
26
  return {
22
27
  generate() {
23
- return notImplemented("ai.onDevice.generate (native on-device LLM runtime)");
28
+ return Promise.reject(new NotImplementedError("ai.onDevice.generate (native on-device LLM runtime)"));
24
29
  },
25
30
  stream() {
26
- return notImplemented("ai.onDevice.stream (native on-device LLM runtime)");
31
+ return { async *[Symbol.asyncIterator]() {
32
+ throw new NotImplementedError("ai.onDevice.stream (native on-device LLM runtime)");
33
+ } };
27
34
  }
28
35
  };
29
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"on-device.js","names":[],"sources":["../src/on-device.ts"],"sourcesContent":["/**\n * 🔬 Research track — the on-device AI backend seam. Every on-device LLM runtime is\n * inherently native (Apple Foundation Models, Android AICore/Gemini Nano, ExecuTorch,\n * llama.rn) or web-only (WebGPU/WASM), so none runs on the pure-TS Hermes/RN device\n * path. This backend implements the **same** {@link AiBackend} interface but throws\n * {@link NotImplementedError}, so a native runtime drops in later non-breakingly. The\n * working path today is the mock / server backends. See\n * `docs/adr/0017-synapse-ai-contract.md`.\n *\n * @module\n */\n\nimport { notImplemented } from '@mindees/core'\nimport type { AiBackend } from './contract'\n\n/**\n * 🔬 Research track — not implemented. Returns an {@link AiBackend} whose `generate`\n * and `stream` throw {@link NotImplementedError}. Use a mock or server backend instead.\n *\n * @experimental\n */\nexport function createOnDeviceBackend(): AiBackend {\n return {\n generate() {\n return notImplemented('ai.onDevice.generate (native on-device LLM runtime)')\n },\n stream() {\n return notImplemented('ai.onDevice.stream (native on-device LLM runtime)')\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqBA,SAAgB,wBAAmC;CACjD,OAAO;EACL,WAAW;GACT,OAAO,eAAe,qDAAqD;EAC7E;EACA,SAAS;GACP,OAAO,eAAe,mDAAmD;EAC3E;CACF;AACF"}
1
+ {"version":3,"file":"on-device.js","names":[],"sources":["../src/on-device.ts"],"sourcesContent":["/**\n * 🔬 Research track — the on-device AI backend seam. Every on-device LLM runtime is\n * inherently native (Apple Foundation Models, Android AICore/Gemini Nano, ExecuTorch,\n * llama.rn) or web-only (WebGPU/WASM), so none runs on the pure-TS Hermes/RN device\n * path. This backend implements the **same** {@link AiBackend} interface but throws\n * {@link NotImplementedError}, so a native runtime drops in later non-breakingly. The\n * working path today is the mock / server backends. See\n * `docs/adr/0017-synapse-ai-contract.md`.\n *\n * @module\n */\n\nimport { NotImplementedError } from '@mindees/core'\nimport type { AiBackend, AiChunk } from './contract'\n\n/**\n * 🔬 Research track — not implemented. Returns an {@link AiBackend} whose `generate`\n * **rejects** and whose `stream` **throws on iteration** with a {@link NotImplementedError}.\n *\n * It does NOT throw synchronously from the method call: the contract is `generate(): Promise`\n * and `stream(): AsyncIterable`, so a caller's `await backend.generate(...)` / `for await` is\n * what surfaces the error — the same shape a future native runtime will have. Use a mock or\n * server backend for the working path.\n *\n * @experimental\n */\nexport function createOnDeviceBackend(): AiBackend {\n return {\n generate() {\n return Promise.reject(\n new NotImplementedError('ai.onDevice.generate (native on-device LLM runtime)'),\n )\n },\n stream(): AsyncIterable<AiChunk> {\n return {\n // biome-ignore lint/correctness/useYield: the iterator throws before it can yield.\n async *[Symbol.asyncIterator](): AsyncIterator<AiChunk> {\n throw new NotImplementedError('ai.onDevice.stream (native on-device LLM runtime)')\n },\n }\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0BA,SAAgB,wBAAmC;CACjD,OAAO;EACL,WAAW;GACT,OAAO,QAAQ,OACb,IAAI,oBAAoB,qDAAqD,CAC/E;EACF;EACA,SAAiC;GAC/B,OAAO,EAEL,QAAQ,OAAO,iBAAyC;IACtD,MAAM,IAAI,oBAAoB,mDAAmD;GACnF,EACF;EACF;CACF;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindees/ai",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "MindeesNative Synapse - provider-agnostic AI: a pure-TS contract with mock + server backends, streaming via async iterables, structured output, and tool calling (on-device runtime is a research track).",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "type": "module",
@@ -31,7 +31,7 @@
31
31
  "directory": "packages/ai"
32
32
  },
33
33
  "dependencies": {
34
- "@mindees/core": "0.2.0"
34
+ "@mindees/core": "0.3.0"
35
35
  },
36
36
  "scripts": {
37
37
  "build": "tsdown",