@genesislcap/foundation-ai 15.14.2 → 15.15.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.
@@ -382,6 +382,15 @@ export declare class AnthropicTransport implements AITransport, ChatTransport, C
382
382
  * the same silence would hide a real difference.)
383
383
  */
384
384
  private warnIfThinkingUnclampable;
385
+ /**
386
+ * The warning for a policy this model cannot honour, or `undefined` when it can.
387
+ *
388
+ * An exhaustive `switch` with a `never` check rather than a condition chain: a new
389
+ * {@link ChatThinkingPolicy} member must be considered HERE or the build fails. The condition
390
+ * chain this replaced would have let every graded level clamp in silence, which is the one
391
+ * outcome the type's own docs promise callers never happens.
392
+ */
393
+ private clampWarning;
385
394
  constructor(config?: AnthropicTransportConfig);
386
395
  getConfig(): {
387
396
  provider: 'anthropic';
@@ -794,11 +803,7 @@ export declare interface ChatAnimationsConfig {
794
803
  *
795
804
  * @beta
796
805
  */
797
- export declare interface ChatAttachment {
798
- name: string;
799
- content: string;
800
- mimeType: string;
801
- }
806
+ export declare type ChatAttachment = ChatTextAttachment | ChatImageAttachment;
802
807
 
803
808
  /**
804
809
  * Display and engine configuration for the chat assistant.
@@ -991,6 +996,38 @@ export declare interface ChatFallback {
991
996
  maxTokens?: number;
992
997
  }
993
998
 
999
+ /**
1000
+ * An image attachment included with a user message or a tool result. Sent as a real image
1001
+ * content block — an Anthropic `type: 'image'` block or a Gemini `inlineData` part — not
1002
+ * flattened to text.
1003
+ *
1004
+ * @beta
1005
+ */
1006
+ export declare interface ChatImageAttachment {
1007
+ /**
1008
+ * REQUIRED, and the only thing either transport branches on. Deliberately not inferred from
1009
+ * `mimeType`: the composer's `readAsText` path can produce `mimeType: 'image/png'` with text
1010
+ * content, so a mime-based branch would send mojibake as base64 image data.
1011
+ */
1012
+ kind: 'image';
1013
+ name: string;
1014
+ /** One of the four both vendors accept: `image/png`, `image/jpeg`, `image/gif`, `image/webp`. */
1015
+ mimeType: string;
1016
+ /**
1017
+ * Base64 payload — the bare bytes both APIs expect, ideally with NO `data:` URL prefix. A
1018
+ * leading `data:<mime>;base64,` preamble (what `FileReader.readAsDataURL` produces, the easy
1019
+ * mistake) is tolerated: the transports strip it before sending via `stripImageDataUrl`.
1020
+ */
1021
+ data: string;
1022
+ /**
1023
+ * Advisory resolution hint. Honoured on Gemini (`mediaResolution`); a documented no-op on
1024
+ * Anthropic, where the only lever is the pixels you send — resize before attaching. Named
1025
+ * as advisory rather than mapped to a fake Anthropic equivalent, following the precedent of
1026
+ * {@link CachePolicy}'s `ttl` being Anthropic-only and ignored on Gemini.
1027
+ */
1028
+ detail?: 'low' | 'medium' | 'high';
1029
+ }
1030
+
994
1031
  /**
995
1032
  * Controls how the main chat input area behaves while an agent (or sub-agent)
996
1033
  * is executing.
@@ -1281,6 +1318,21 @@ export declare interface ChatRequestOptions {
1281
1318
  * @beta
1282
1319
  */
1283
1320
  thinkingPolicy?: ChatThinkingPolicy;
1321
+ /**
1322
+ * Output-token ceiling for THIS turn, overriding the transport's configured `maxTokens`.
1323
+ *
1324
+ * Needed because the configured value is per-transport-INSTANCE, so a caller that wants two
1325
+ * ceilings has to register two providers — which is why ai-service carries separate
1326
+ * `anthropic` and `anthropicFast` slots. That does not scale to a pipeline whose stages
1327
+ * legitimately want very different budgets (a full mockup versus a one-line critique).
1328
+ *
1329
+ * Reaches `max_tokens` on Anthropic and `generationConfig.maxOutputTokens` on Gemini, and is
1330
+ * also what a `ResponseTruncatedError` reports as the cap it hit — otherwise the truncation
1331
+ * message names the instance default and sends you looking at the wrong number.
1332
+ *
1333
+ * @beta
1334
+ */
1335
+ maxTokens?: number;
1284
1336
  }
1285
1337
 
1286
1338
  /**
@@ -1402,6 +1454,36 @@ export declare const ChatTemperature: {
1402
1454
  readonly Maximum: 1;
1403
1455
  };
1404
1456
 
1457
+ /**
1458
+ * A text file attachment included with a user message. Serialised to the model as
1459
+ * `[File: <name>]\n<content>` — a plain text block on both vendors.
1460
+ *
1461
+ * @beta
1462
+ */
1463
+ export declare interface ChatTextAttachment {
1464
+ /**
1465
+ * Optional on this arm so an attachment authored before images existed — `{ name, content,
1466
+ * mimeType }` — is still a valid `ChatAttachment` with no edit. The image arm requires it.
1467
+ */
1468
+ kind?: 'text';
1469
+ name: string;
1470
+ content: string;
1471
+ /**
1472
+ * Advisory only on this arm. Note the composer reads files with `readAsText`, so a binary
1473
+ * file dropped there arrives with a truthy image mime and mojibake `content` — which is why
1474
+ * the transports branch on `kind`, never on `mimeType`. See {@link ChatImageAttachment}.
1475
+ */
1476
+ mimeType: string;
1477
+ }
1478
+
1479
+ /**
1480
+ * The graded members of {@link ChatThinkingPolicy} — the ones that carry a depth rather than
1481
+ * merely switching reasoning on or off. Split out so each transport's clamp table can be an
1482
+ * exhaustive `Record` and adding a level to the union becomes a compile error at every mapping
1483
+ * site, rather than a value that silently falls through to "model default".
1484
+ */
1485
+ export declare type ChatThinkingLevel = Extract<ChatThinkingPolicy, 'minimal' | 'low' | 'medium' | 'high' | 'max'>;
1486
+
1405
1487
  /**
1406
1488
  * Whether the model should reason before answering, resolved per turn.
1407
1489
  * **Provider-neutral intent, provider-specific effect**, and — like `tool_choice` — a
@@ -1424,8 +1506,23 @@ export declare const ChatTemperature: {
1424
1506
  * Deliberately has **no token-budget member**. Gemini accepts a numeric `thinkingBudget`, but
1425
1507
  * Anthropic *removed* `budget_tokens` and returns a 400 for it on Sonnet 5 and every Opus 5-era
1426
1508
  * model — so a budget field would be unimplementable on half the supported fleet and would exist
1427
- * only to be ignored. `'low' | 'high'` can be added later if wanted: Anthropic `effort` and
1428
- * Gemini `thinkingLevel` do line up.
1509
+ * only to be ignored. The graded levels below are that idea done vendor-neutrally: Anthropic
1510
+ * `output_config.effort` and Gemini `thinkingConfig.thinkingLevel` line up, as anticipated here.
1511
+ *
1512
+ * **The graded levels** (`'minimal'` … `'max'`) ask for a DEPTH of reasoning rather than merely
1513
+ * on/off. On Anthropic they set `output_config.effort` alongside adaptive thinking; on Gemini
1514
+ * they set `thinkingLevel`. Two honest edges:
1515
+ *
1516
+ * - Anthropic has no `'minimal'`, so it clamps to `low`; Gemini has no `'max'`, so it clamps to
1517
+ * `high`. Each clamp is toward the nearer neighbour, never toward a value that would 400.
1518
+ * - Anthropic's `xhigh` (between `high` and `max`, and its recommended setting for agentic
1519
+ * coding) is **not exposed**, because Gemini has no equivalent and a value only one vendor can
1520
+ * express is how a "vendor-neutral" option quietly stops being one. Ask for `'max'` if you want
1521
+ * the ceiling.
1522
+ *
1523
+ * Models that predate the effort parameter (Sonnet 4.5, Haiku 4.5) reject it, so a graded level
1524
+ * there falls back to that model's adaptive-or-default posture with a one-time warning — the same
1525
+ * clamp discipline the on/off values already follow.
1429
1526
  *
1430
1527
  * **Omitting this is a distinct third state** — each model keeps its own default posture
1431
1528
  * (see `anthropicThinking`), which is *not* uniformly `'auto'` or `'off'`. So a resolver
@@ -1440,7 +1537,7 @@ export declare const ChatTemperature: {
1440
1537
  *
1441
1538
  * @beta
1442
1539
  */
1443
- export declare type ChatThinkingPolicy = 'auto' | 'off';
1540
+ export declare type ChatThinkingPolicy = 'auto' | 'off' | 'minimal' | 'low' | 'medium' | 'high' | 'max';
1444
1541
 
1445
1542
  /**
1446
1543
  * A tool call requested by the assistant.
@@ -1691,6 +1788,19 @@ export declare type ChatToolHandlers<TSubAgent extends {
1691
1788
  export declare interface ChatToolResult {
1692
1789
  toolCallId: string;
1693
1790
  content: string;
1791
+ /**
1792
+ * Images the tool produced, sent alongside `content` as real image blocks.
1793
+ *
1794
+ * This is the half that makes a vision AGENT possible rather than a one-shot vision call:
1795
+ * a tool that renders something can hand the render back for the model to LOOK at, instead
1796
+ * of describing it in prose. Only `kind: 'image'` attachments are carried — a text
1797
+ * attachment here would be indistinguishable from `content` and is dropped by the
1798
+ * transports rather than double-sent.
1799
+ *
1800
+ * Absent on every existing tool result, and the transports emit the historical
1801
+ * string-content shape whenever it is absent, so nothing already on the wire moves.
1802
+ */
1803
+ attachments?: ChatImageAttachment[];
1694
1804
  }
1695
1805
 
1696
1806
  /**
@@ -2207,14 +2317,18 @@ export declare class GeminiTransport implements AITransport, ChatTransport, Cost
2207
2317
  */
2208
2318
  private warnedThinkingClamped;
2209
2319
  /**
2210
- * Warn once when a requested policy is silently clamped. Turning thinking off is a *cost*
2211
- * decision, so a caller who asked for it and kept paying for reasoning tokens needs to hear
2212
- * about it but only once, not per turn.
2320
+ * Warn once when a requested policy cannot be honoured on this model a *cost* decision the
2321
+ * caller made that the wire silently reversed, so they hear about it, but only once, not per
2322
+ * turn. Two shapes reach here (the Anthropic twin warns on the same two):
2213
2323
  *
2214
- * Only `'off'` can actually be denied. `'auto'` is already what an omitted budget produces on
2215
- * every model here dynamic thinking is the documented default so warning that it was
2216
- * "ignored" would be false, and latching on it would spend the one warning the genuinely
2217
- * unhonourable `'off'` needs.
2324
+ * - `'off'` on a tier that can't disable thinking only the flash tiers accept a zero thinking
2325
+ * budget; everything else keeps paying for reasoning it was told to stop. (`'auto'` is NOT this
2326
+ * case: it is already what an omitted budget produces on every model here, so warning it was
2327
+ * "ignored" would be false and would spend the one warning the genuine cases need.)
2328
+ * - A graded depth (`minimal`…`max`) on a 2.5 tier — those speak the numeric-budget dialect,
2329
+ * not the Gemini 3 `thinkingLevel` enum, so the level is dropped and the turn runs at the
2330
+ * default posture. Without this, a caller asking for `high` on `gemini-2.5-pro` and quietly
2331
+ * getting the default is left to wonder why.
2218
2332
  */
2219
2333
  private warnIfThinkingUnclampable;
2220
2334
  constructor(config?: GeminiTransportConfig);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/foundation-ai",
3
3
  "description": "Genesis Foundation AI - Provider-agnostic AI configuration and shared utilities",
4
- "version": "15.14.2",
4
+ "version": "15.15.0",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -52,17 +52,17 @@
52
52
  }
53
53
  },
54
54
  "devDependencies": {
55
- "@genesislcap/foundation-testing": "15.14.2",
56
- "@genesislcap/genx": "15.14.2",
57
- "@genesislcap/rollup-builder": "15.14.2",
58
- "@genesislcap/ts-builder": "15.14.2",
59
- "@genesislcap/uvu-playwright-builder": "15.14.2",
60
- "@genesislcap/vite-builder": "15.14.2",
61
- "@genesislcap/webpack-builder": "15.14.2"
55
+ "@genesislcap/foundation-testing": "15.15.0",
56
+ "@genesislcap/genx": "15.15.0",
57
+ "@genesislcap/rollup-builder": "15.15.0",
58
+ "@genesislcap/ts-builder": "15.15.0",
59
+ "@genesislcap/uvu-playwright-builder": "15.15.0",
60
+ "@genesislcap/vite-builder": "15.15.0",
61
+ "@genesislcap/webpack-builder": "15.15.0"
62
62
  },
63
63
  "dependencies": {
64
- "@genesislcap/foundation-logger": "15.14.2",
65
- "@genesislcap/foundation-utils": "15.14.2",
64
+ "@genesislcap/foundation-logger": "15.15.0",
65
+ "@genesislcap/foundation-utils": "15.15.0",
66
66
  "@microsoft/fast-foundation": "2.50.0"
67
67
  },
68
68
  "repository": {
@@ -73,5 +73,5 @@
73
73
  "publishConfig": {
74
74
  "access": "public"
75
75
  },
76
- "gitHead": "bd1cb4a789548d9c7c6777f8adb7bce3f43c3317"
76
+ "gitHead": "6cb5a251c9b3e1bf509fece8db32acdc1d4c747b"
77
77
  }