Capability first · transport second

ModelDefinition.js

Parses the deterministic packaged Modelfile subset and extracts the SYSTEM prompt.

SDK 0.5.18Runtime 0.8.12Protocol arcane/1
On this page

Overview

Parses the deterministic packaged Modelfile subset and extracts the SYSTEM prompt.

  • Artifact
    ModelDefinition.js · esm
  • Classification
    public first party
  • Availability
    Cross-host
  • Normalization
    Complete mutable definition data with coded syntax errors for malformed input.

Import and lifecycle

JavaScript
import * as module from '/arcane/modules/ModelDefinition.js';

parseModelDefinition() is pure. loadModelDefinitionSystemPrompt() makes one complete read-only GET using the fetch implementation's ordinary redirect, credentials, and cache behavior, and never contacts a model service itself.

Application-facing behavior: parseModelDefinition(), loadModelDefinitionSystemPrompt().

Protocol and host implementation

Optional ordinary read-only fetch This detail does not widen the application-facing API or grant authority.

Exports, signatures, parameters, and results

BindingFormDeclaration or signatureParameter syntax
parseModelDefinitionfunctionfunction parseModelDefinition(source)source
loadModelDefinitionSystemPromptfunctionasync function loadModelDefinitionSystemPrompt(url,{ fetchImpl=globalThis.fetch }={})url,{ fetchImpl=globalThis.fetch }={}
CallableKindExact public signatureParameter syntax
parseModelDefinitionexported-functionfunction parseModelDefinition(source)source
loadModelDefinitionSystemPromptexported-functionasync function loadModelDefinitionSystemPrompt(url,{ fetchImpl=globalThis.fetch }={})url,{ fetchImpl=globalThis.fetch }={}

Parameter meanings and results

parseModelDefinition(source) returns mutable {from,system,parameters} for the exact FROM + triple-quoted SYSTEM + unique PARAMETER subset, preserving complete SYSTEM and parameter content. loadModelDefinitionSystemPrompt(url,{fetchImpl?}) resolves the complete SYSTEM prompt string.

Events, side effects, and errors

Source-literal CustomEvent dispatches

No source-literal CustomEvent dispatch is part of this artifact.

Lifecycle and event flow

This artifact has no additional documented lifecycle event flow.

Direct coded failures

  • MODEL_DEFINITION_INVALID
  • MODEL_DEFINITION_UNAVAILABLE

Exported Error subclasses

This artifact exports no Error subclass.

Documented failure behavior

  • MODEL_DEFINITION_INVALID
  • MODEL_DEFINITION_UNAVAILABLE
  • Fetch rejection is preserved.

Availability and capabilities

Cross-host. Complete mutable definition data with coded syntax errors for malformed input.

None.

Contract example

JavaScript
import {parseModelDefinition} from '/arcane/modules/ModelDefinition.js';

const definition = parseModelDefinition(
    'FROM llama3.2\n\nSYSTEM """\nAnswer briefly.\n"""\n'
);
console.log(definition.system);

No direct Core call is claimed for this artifact. Any injected provider or consuming module retains its own documented authority.