@harness-engineering/intelligence 0.4.3 → 0.5.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.mts CHANGED
@@ -406,6 +406,14 @@ interface OpenAICompatibleProviderOptions {
406
406
  baseUrl: string;
407
407
  /** Default model name (e.g., 'deepseek-coder-v2'). */
408
408
  defaultModel?: string;
409
+ /**
410
+ * Consumption Phase 1 (T3): live model resolver, read at request time. When
411
+ * provided and it returns a non-empty name, that name is used in preference to
412
+ * `defaultModel` so a pool install/swap is consumed by analysis without a
413
+ * restart. `request.model` (an explicit per-call override) still wins; a
414
+ * null/undefined/empty return falls through to `defaultModel`.
415
+ */
416
+ getModel?: () => string | null | undefined;
409
417
  /** Request timeout in ms (default: 90000). */
410
418
  timeoutMs?: number;
411
419
  /**
@@ -430,6 +438,7 @@ interface OpenAICompatibleProviderOptions {
430
438
  declare class OpenAICompatibleAnalysisProvider implements AnalysisProvider {
431
439
  private readonly client;
432
440
  private readonly defaultModel;
441
+ private readonly getModel?;
433
442
  private readonly promptSuffix;
434
443
  private readonly jsonMode;
435
444
  constructor(options: OpenAICompatibleProviderOptions);
package/dist/index.d.ts CHANGED
@@ -406,6 +406,14 @@ interface OpenAICompatibleProviderOptions {
406
406
  baseUrl: string;
407
407
  /** Default model name (e.g., 'deepseek-coder-v2'). */
408
408
  defaultModel?: string;
409
+ /**
410
+ * Consumption Phase 1 (T3): live model resolver, read at request time. When
411
+ * provided and it returns a non-empty name, that name is used in preference to
412
+ * `defaultModel` so a pool install/swap is consumed by analysis without a
413
+ * restart. `request.model` (an explicit per-call override) still wins; a
414
+ * null/undefined/empty return falls through to `defaultModel`.
415
+ */
416
+ getModel?: () => string | null | undefined;
409
417
  /** Request timeout in ms (default: 90000). */
410
418
  timeoutMs?: number;
411
419
  /**
@@ -430,6 +438,7 @@ interface OpenAICompatibleProviderOptions {
430
438
  declare class OpenAICompatibleAnalysisProvider implements AnalysisProvider {
431
439
  private readonly client;
432
440
  private readonly defaultModel;
441
+ private readonly getModel?;
433
442
  private readonly promptSuffix;
434
443
  private readonly jsonMode;
435
444
  constructor(options: OpenAICompatibleProviderOptions);
package/dist/index.js CHANGED
@@ -415,6 +415,7 @@ var DEFAULT_TIMEOUT_MS = 9e4;
415
415
  var OpenAICompatibleAnalysisProvider = class {
416
416
  client;
417
417
  defaultModel;
418
+ getModel;
418
419
  promptSuffix;
419
420
  jsonMode;
420
421
  constructor(options) {
@@ -424,11 +425,15 @@ var OpenAICompatibleAnalysisProvider = class {
424
425
  timeout: options.timeoutMs ?? DEFAULT_TIMEOUT_MS
425
426
  });
426
427
  this.defaultModel = options.defaultModel ?? DEFAULT_MODEL2;
428
+ if (options.getModel !== void 0) {
429
+ this.getModel = options.getModel;
430
+ }
427
431
  this.promptSuffix = options.promptSuffix ?? null;
428
432
  this.jsonMode = options.jsonMode ?? true;
429
433
  }
430
434
  async analyze(request) {
431
- const model = request.model ?? this.defaultModel;
435
+ const resolved = this.getModel?.();
436
+ const model = request.model ?? (resolved != null && resolved !== "" ? resolved : this.defaultModel);
432
437
  const maxTokens = request.maxTokens ?? DEFAULT_MAX_TOKENS2;
433
438
  const jsonSchema = zodToJsonSchema(request.responseSchema);
434
439
  const systemParts = [];
package/dist/index.mjs CHANGED
@@ -335,6 +335,7 @@ var DEFAULT_TIMEOUT_MS = 9e4;
335
335
  var OpenAICompatibleAnalysisProvider = class {
336
336
  client;
337
337
  defaultModel;
338
+ getModel;
338
339
  promptSuffix;
339
340
  jsonMode;
340
341
  constructor(options) {
@@ -344,11 +345,15 @@ var OpenAICompatibleAnalysisProvider = class {
344
345
  timeout: options.timeoutMs ?? DEFAULT_TIMEOUT_MS
345
346
  });
346
347
  this.defaultModel = options.defaultModel ?? DEFAULT_MODEL2;
348
+ if (options.getModel !== void 0) {
349
+ this.getModel = options.getModel;
350
+ }
347
351
  this.promptSuffix = options.promptSuffix ?? null;
348
352
  this.jsonMode = options.jsonMode ?? true;
349
353
  }
350
354
  async analyze(request) {
351
- const model = request.model ?? this.defaultModel;
355
+ const resolved = this.getModel?.();
356
+ const model = request.model ?? (resolved != null && resolved !== "" ? resolved : this.defaultModel);
352
357
  const maxTokens = request.maxTokens ?? DEFAULT_MAX_TOKENS2;
353
358
  const jsonSchema = zodToJsonSchema(request.responseSchema);
354
359
  const systemParts = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harness-engineering/intelligence",
3
- "version": "0.4.3",
3
+ "version": "0.5.0",
4
4
  "description": "Intelligence pipeline for spec enrichment, complexity modeling, and pre-execution simulation",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -40,8 +40,8 @@
40
40
  "@anthropic-ai/sdk": "^0.95.1",
41
41
  "openai": "^6.0.0",
42
42
  "zod": "^3.25.76",
43
- "@harness-engineering/graph": "0.11.5",
44
- "@harness-engineering/types": "0.19.0"
43
+ "@harness-engineering/types": "0.20.0",
44
+ "@harness-engineering/graph": "0.11.6"
45
45
  },
46
46
  "optionalDependencies": {
47
47
  "canary-test-cli": "^5.4.0"