@slatesvideo/shared 0.7.23 → 0.7.25

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.
@@ -21,7 +21,7 @@ export declare class SlatesDesktopClient {
21
21
  });
22
22
  private get baseUrl();
23
23
  healthz(): Promise<DesktopHealth>;
24
- requireCapability(cap: string, friendlyFeature: string): Promise<void>;
24
+ requireCapability(cap: string, friendlyFeature: string, minimumVersion?: string): Promise<void>;
25
25
  /** Whether this desktop advertises `cap`: for an op that has an older route to fall back to. */
26
26
  hasCapability(cap: string): Promise<boolean>;
27
27
  private cachedHealth;
@@ -1,5 +1,6 @@
1
1
  import { randomUUID } from 'node:crypto';
2
2
  import { DesktopUnreachableError, requireDesktop } from '../auth.js';
3
+ import { compareVersions } from '../update-check.js';
3
4
  // One agent session per process (an MCP server's connection, or one CLI run): the desktop counts
4
5
  // what it spends against the person's per-session spend limit (`slates_get_spend_limits`).
5
6
  const AGENT_SESSION = randomUUID();
@@ -92,13 +93,17 @@ export class SlatesDesktopClient {
92
93
  // Calling a missing route on an old desktop would 404 with an opaque
93
94
  // error — this check turns that into an actionable "update Slates"
94
95
  // message BEFORE the op's first real request.
95
- async requireCapability(cap, friendlyFeature) {
96
+ async requireCapability(cap, friendlyFeature, minimumVersion) {
96
97
  const health = await this.cachedHealth();
97
98
  if (health.agentApiVersion === undefined || !health.capabilities?.includes(cap)) {
98
99
  throw new Error(`Your Slates desktop app doesn't support ${friendlyFeature} yet ` +
99
100
  `(agent API v${health.agentApiVersion ?? 1}, need v2 with '${cap}'). ` +
100
101
  `Update Slates (Settings → Check for Updates) and retry.`);
101
102
  }
103
+ if (minimumVersion && (!health.version || compareVersions(health.version, minimumVersion) < 0)) {
104
+ throw new Error(`${friendlyFeature} requires Slates ${minimumVersion} or later. ` +
105
+ `Update Slates (Settings → Check for Updates) and retry.`);
106
+ }
102
107
  }
103
108
  /** Whether this desktop advertises `cap`: for an op that has an older route to fall back to. */
104
109
  async hasCapability(cap) {
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ export { MY_BRAIN_RULES, myBrainLearning, myBrainLessons, remember, setMyBrainLe
9
9
  export { ARCHIVE_AFTER_DAYS, archiveUnused, archiveUnusedDaily, brainSkills, loadMyBrain, myBrainDir, myBrainPreload, noteUsed, MY_BRAIN_PRELOAD_CHARS, type Brain } from './skills/my-brain.js';
10
10
  export * as operations from './operations/index.js';
11
11
  export { flattenZodError, parseOperationInput, prepareOperation, runOperation, type ParsedInput, type PreparedOperation } from './operations/parse-input.js';
12
- export { ALL_OPERATIONS, VIDEO_MODELS, AUDIO_MODELS, IMAGE_MODELS, defaultContext, OperationCancelledError, type Operation, type OperationContext, type OperationResult, type OperationAnnotations, type OperationTier, type OperationGroup } from './operations/index.js';
12
+ export { ALL_OPERATIONS, VIDEO_MODELS, AUDIO_MODELS, IMAGE_MODELS, defaultContext, GuideNotReadError, OperationCancelledError, type Operation, type OperationContext, type OperationResult, type OperationAnnotations, type OperationTier, type OperationGroup } from './operations/index.js';
13
13
  export { CONFIRM_CREDITS, DEVIATION_FACTOR, WORKING_METHOD_TOPIC } from './operations/index.js';
14
14
  export { toolDefinitions, toolDefinition, groupFor, tierFor, OPERATION_GROUPS, GROUP_SUMMARY, STARTUP_TOOL_IDS, type ToolDefinition, } from './operations/index.js';
15
15
  export { MODEL_FACTS, getModelFact, multimodalRefSummary, multimodalRefModels, describeRouting, SEEDANCE_TASK_INTENT_WORDS, seedanceTaskIntentWords, type ModelFact, } from './prompts/model-facts.js';
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ export { ARCHIVE_AFTER_DAYS, archiveUnused, archiveUnusedDaily, brainSkills, loa
10
10
  export * as operations from './operations/index.js';
11
11
  // Every host turns raw tool arguments into an op call through these, so the schema applies everywhere.
12
12
  export { flattenZodError, parseOperationInput, prepareOperation, runOperation } from './operations/parse-input.js';
13
- export { ALL_OPERATIONS, VIDEO_MODELS, AUDIO_MODELS, IMAGE_MODELS, defaultContext, OperationCancelledError } from './operations/index.js';
13
+ export { ALL_OPERATIONS, VIDEO_MODELS, AUDIO_MODELS, IMAGE_MODELS, defaultContext, GuideNotReadError, OperationCancelledError } from './operations/index.js';
14
14
  // The spend thresholds the DESKTOP and the SKILLS both quote. `CONFIRM_CREDITS`
15
15
  // is the op-level confirm gate; `DEVIATION_FACTOR` is the Studio Agent's
16
16
  // re-ask multiplier, which lived only in `loop.ts` while `slates-cost-discipline`