@asterism-app/sdk 1.11.0 → 1.12.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asterism-app/sdk",
3
- "version": "1.11.0",
3
+ "version": "1.12.0",
4
4
  "description": "Public contracts and host capabilities for Asterism plugins",
5
5
  "license": "MIT",
6
6
  "author": "Chien Zhang",
@@ -1,7 +1,7 @@
1
1
  import type { ContentRef, ContentRange } from "./content.ts";
2
2
  import type { Json } from "./json.ts";
3
3
 
4
- /** Individual reads have a size limit; large content uses bounded byte chunks through open. */
4
+ /** Read complete content or a byte range; open streams the selected bytes in chunks. */
5
5
  export interface ContentReader {
6
6
  read(ref: ContentRef, range?: ContentRange): Promise<Uint8Array>;
7
7
  open(ref: ContentRef, range?: ContentRange): AsyncIterable<Uint8Array>;
@@ -7,5 +7,3 @@ export function fileMediaType(file: { type: string; name: string }): string {
7
7
  }
8
8
  /** A derived classification for UI display, not a model capability. */
9
9
  export const previewsAsImage = (mediaType: string) => mediaType.startsWith("image/");
10
- /** Client resource limits: per-file size, count, and total size leave room for protocol envelopes and base64. */
11
- export const modelInputLimits = { file: 5 * 1024 * 1024, files: 20, total: 20 * 1024 * 1024 } as const;
@@ -1,6 +1,9 @@
1
+ import { parseModelExpression, type ModelExpression } from "./model-selection.ts";
2
+
1
3
  /**
2
4
  * Reference URLs are plain strings that name something the model or the user can look up: `resource:` addresses a
3
- * location inside a session resource, `skill:` addresses a skill package through the skill catalog. A reference may
5
+ * location inside a session resource, `skill:` addresses a skill package through the skill catalog, and `model:`
6
+ * addresses a configured model by its provider/model expression. A reference may
4
7
  * name something that does not exist; parsing checks only the format.
5
8
  */
6
9
 
@@ -39,6 +42,17 @@ export function parseSkillUrl(value: string): SkillUrl | null {
39
42
  } catch { return null; }
40
43
  }
41
44
 
45
+ /** `model:<provider>/<model>`: model IDs may contain additional slash-separated segments. */
46
+ export function modelUrl(expression: string): string {
47
+ return `model:${encodePath(expression)}`;
48
+ }
49
+
50
+ export function parseModelUrl(value: string): ModelExpression | null {
51
+ const match = /^model:([^?#\s]+)$/u.exec(value);
52
+ if (!match) return null;
53
+ try { return parseModelExpression(decodePath(match[1]!)); } catch { return null; }
54
+ }
55
+
42
56
  /** The text form of a reference: a Markdown link whose label is display text and whose destination is the URL. */
43
57
  export function referenceMarkdown(label: string, url: string): string {
44
58
  return `[${label}](${url})`;