@orcalang/orca-lang 0.1.12 → 0.1.16

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.
@@ -1 +1 @@
1
- {"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../src/llm/openai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAExF,qBAAa,cAAe,YAAW,WAAW;IAChD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,WAAW,CAAS;gBAEhB,MAAM,EAAE,iBAAiB;IAYrC,IAAI,IAAI,MAAM;IAKd,OAAO,CAAC,gBAAgB;IAIlB,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC;IA2CnD,kBAAkB,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;CAWpF"}
1
+ {"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../src/llm/openai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAExF,qBAAa,cAAe,YAAW,WAAW;IAChD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,WAAW,CAAS;gBAEhB,MAAM,EAAE,iBAAiB;IAYrC,IAAI,IAAI,MAAM;IAKd,OAAO,CAAC,gBAAgB;IAIlB,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC;IAyCnD,kBAAkB,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;CAWpF"}
@@ -17,21 +17,19 @@ export class OpenAIProvider {
17
17
  name() {
18
18
  return 'openai';
19
19
  }
20
- // o-series reasoning models (o1, o3, o4-mini, etc.) use max_completion_tokens
20
+ // o-series reasoning models (o1, o3, o4-mini, etc.) do not support temperature
21
21
  isReasoningModel(model) {
22
22
  return /^o\d/.test(model);
23
23
  }
24
24
  async complete(request) {
25
25
  const model = request.model || this.model;
26
- const reasoning = this.isReasoningModel(model);
27
- const tokenParam = reasoning ? 'max_completion_tokens' : 'max_tokens';
28
26
  const body = {
29
27
  model,
30
28
  messages: request.messages,
31
- [tokenParam]: request.max_tokens || this.maxTokens,
29
+ max_completion_tokens: request.max_tokens || this.maxTokens,
32
30
  stop: request.stop_sequences,
33
31
  };
34
- if (!reasoning) {
32
+ if (!this.isReasoningModel(model)) {
35
33
  body.temperature = request.temperature ?? this.temperature;
36
34
  }
37
35
  const response = await fetch(`${this.baseUrl}/chat/completions`, {
@@ -1 +1 @@
1
- {"version":3,"file":"openai.js","sourceRoot":"","sources":["../../src/llm/openai.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,cAAc;IACjB,MAAM,CAAS;IACf,OAAO,CAAS;IAChB,KAAK,CAAS;IACd,SAAS,CAAS;IAClB,WAAW,CAAS;IAE5B,YAAY,MAAyB;QACnC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,EAAE,CAAC;QACjE,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,QAAQ,IAAI,2BAA2B,CAAC;QAC9D,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,QAAQ,CAAC;QACtC,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,UAAU,IAAI,IAAI,CAAC;QAC3C,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW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QAAQ,CAAC,IAAI,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CAAC,qBAAqB,QAAQ,CAAC,MAAM,IAAI,KAAK,EAAE,CAAC,CAAC;QACnE,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAI/B,CAAC;QAEF,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,IAAI,EAAE;YAChD,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,KAAK,EAAE;gBACL,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,aAAa;gBACtC,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,iBAAiB;aAC5C;SACF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,OAAmB,EAAE,MAAc;QAC1D,wDAAwD;QACxD,MAAM,eAAe,GAAe;YAClC,GAAG,OAAO;YACV,QAAQ,EAAE;gBACR,GAAG,OAAO,CAAC,QAAQ;gBACnB,EAAE,IAAI,EAAE,WAAoB,EAAE,OAAO,EAAE,MAAM,EAAE;aAChD;SACF,CAAC;QACF,OAAO,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;IACxC,CAAC;CACF"}
package/dist/tools.js CHANGED
@@ -2,7 +2,7 @@
2
2
  export const ORCA_TOOLS = [
3
3
  {
4
4
  name: 'parse_machine',
5
- description: 'Parse an Orca machine definition and return its structure as JSON (states, events, transitions, guards, actions, context). Supports single and multi-machine files. Source must use "# machine Name" heading, "## state Name [initial]" for states, and a "## transitions" section with a | Source | Event | Guard | Target | Action | table.',
5
+ description: 'Parse .orca.md source JSON (states, events, transitions, guards, actions, context). Syntax: # machine Name, ## state Name [initial|final], ## transitions table (| Source | Event | Guard | Target | Action |).',
6
6
  inputSchema: {
7
7
  type: 'object',
8
8
  properties: {
@@ -13,7 +13,7 @@ export const ORCA_TOOLS = [
13
13
  },
14
14
  {
15
15
  name: 'verify_machine',
16
- description: 'Verify an Orca machine definition for structural correctness, completeness, and determinism. Checks that exactly one [initial] state exists, all states are reachable, no deadlocks exist (every non-final state handles all events or has timeouts), and guards on competing transitions are mutually exclusive. Returns structured errors and warnings.',
16
+ description: 'Verify machine structure: checks [initial] presence (exactly one), reachability, no deadlocks, guard determinism. Returns structured errors with codes and suggestions. Run before compile_machine.',
17
17
  inputSchema: {
18
18
  type: 'object',
19
19
  properties: {
@@ -24,7 +24,7 @@ export const ORCA_TOOLS = [
24
24
  },
25
25
  {
26
26
  name: 'compile_machine',
27
- description: 'Compile a verified Orca machine to XState v5 config (TypeScript) or Mermaid stateDiagram-v2. Run verify_machine first to catch errors before compiling.',
27
+ description: 'Compile verified machine to XState v5 TypeScript or Mermaid stateDiagram-v2. Run verify_machine first. target: "xstate" (default) or "mermaid".',
28
28
  inputSchema: {
29
29
  type: 'object',
30
30
  properties: {
@@ -40,7 +40,7 @@ export const ORCA_TOOLS = [
40
40
  },
41
41
  {
42
42
  name: 'generate_machine',
43
- description: 'Generate a draft Orca machine definition from a natural language specification. Automatically chooses between a single-machine or multi-machine design based on the spec: specs that mention a coordinator, orchestrator, or multiple independently-lifecycled sub-processes route to multi-machine; everything else produces a single machine. Returns raw .orca.md source and an is_multi flag. Always call verify_machine on the result next then refine_machine if there are errors. Requires LLM configuration via environment variables (ANTHROPIC_API_KEY, etc.).',
43
+ description: 'Generate draft .orca.md from natural language spec. Returns source + is_multi flag. Always verify_machine next, then refine_machine if errors. Requires LLM API key (ANTHROPIC_API_KEY, etc.).',
44
44
  inputSchema: {
45
45
  type: 'object',
46
46
  properties: {
@@ -54,7 +54,7 @@ export const ORCA_TOOLS = [
54
54
  },
55
55
  {
56
56
  name: 'generate_actions',
57
- description: 'Generate action scaffold code for an Orca machine in TypeScript, Python, or Go. Includes registration comments and optional test scaffolds. Requires a successfully parsed machine pass verified .orca.md source.',
57
+ description: 'Generate action scaffold code from verified machine. lang: typescript (default), python, or go. Pass verified .orca.md source. use_llm: true for implementations vs templates. generate_tests: true for test scaffolds.',
58
58
  inputSchema: {
59
59
  type: 'object',
60
60
  properties: {
@@ -78,7 +78,7 @@ export const ORCA_TOOLS = [
78
78
  },
79
79
  {
80
80
  name: 'generate_multi_machine',
81
- description: 'Generate a draft set of coordinated Orca machines from a natural language specification. Returns multiple machine definitions in one .orca.md file (separated by ---). Always call verify_machine on the result next then refine_machine if there are errors. Requires LLM configuration via environment variables.',
81
+ description: 'Generate coordinated multi-machine .orca.md from spec (machines separated by ---). Use invoke: ChildMachine in states. Always verify_machine next, then refine_machine if errors. Requires LLM API key.',
82
82
  inputSchema: {
83
83
  type: 'object',
84
84
  properties: {
@@ -92,7 +92,7 @@ export const ORCA_TOOLS = [
92
92
  },
93
93
  {
94
94
  name: 'refine_machine',
95
- description: 'Fix verification errors in an Orca machine using an LLM. Loops until the machine is valid or max_iterations is reached. If errors are not provided, verification runs automatically first. Use this after verify_machine returns errors.',
95
+ description: 'Fix verify_machine errors using LLM. Loops until valid or max_iterations (default: 3). Pass errors array from verify_machine output, or omit to auto-verify first.',
96
96
  inputSchema: {
97
97
  type: 'object',
98
98
  properties: {
@@ -114,7 +114,7 @@ export const ORCA_TOOLS = [
114
114
  },
115
115
  {
116
116
  name: 'server_status',
117
- description: 'Return the MCP server version and active configuration. API keys are never included in the response — only whether a key is configured. Use this to confirm the server is running and check which LLM provider and model are active.',
117
+ description: 'Return MCP server version, active LLM provider/model, and configuration. API keys are never exposed — only whether a key is configured.',
118
118
  inputSchema: {
119
119
  type: 'object',
120
120
  properties: {},
package/dist/tools.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAc1F,MAAM,CAAC,MAAM,UAAU,GAAc;IACnC;QACE,IAAI,EAAE,eAAe;QACrB,WAAW,EACT,+UAA+U;QACjV,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,MAAM,EA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Q;YACd,UAAU,EAAE,EAAE;YACd,QAAQ,EAAE,EAAE;SACb;KACF;CACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orcalang/orca-lang",
3
- "version": "0.1.12",
3
+ "version": "0.1.16",
4
4
  "description": "Orca (Orchestrated State Machine Language) - an LLM-native code generation target",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/src/llm/openai.ts CHANGED
@@ -23,22 +23,20 @@ export class OpenAIProvider implements LLMProvider {
23
23
  return 'openai';
24
24
  }
25
25
 
26
- // o-series reasoning models (o1, o3, o4-mini, etc.) use max_completion_tokens
26
+ // o-series reasoning models (o1, o3, o4-mini, etc.) do not support temperature
27
27
  private isReasoningModel(model: string): boolean {
28
28
  return /^o\d/.test(model);
29
29
  }
30
30
 
31
31
  async complete(request: LLMRequest): Promise<LLMResponse> {
32
32
  const model = request.model || this.model;
33
- const reasoning = this.isReasoningModel(model);
34
- const tokenParam = reasoning ? 'max_completion_tokens' : 'max_tokens';
35
33
  const body: Record<string, unknown> = {
36
34
  model,
37
35
  messages: request.messages,
38
- [tokenParam]: request.max_tokens || this.maxTokens,
36
+ max_completion_tokens: request.max_tokens || this.maxTokens,
39
37
  stop: request.stop_sequences,
40
38
  };
41
- if (!reasoning) {
39
+ if (!this.isReasoningModel(model)) {
42
40
  body.temperature = request.temperature ?? this.temperature;
43
41
  }
44
42
  const response = await fetch(`${this.baseUrl}/chat/completions`, {
package/src/tools.ts CHANGED
@@ -16,7 +16,7 @@ export const ORCA_TOOLS: ToolDef[] = [
16
16
  {
17
17
  name: 'parse_machine',
18
18
  description:
19
- 'Parse an Orca machine definition and return its structure as JSON (states, events, transitions, guards, actions, context). Supports single and multi-machine files. Source must use "# machine Name" heading, "## state Name [initial]" for states, and a "## transitions" section with a | Source | Event | Guard | Target | Action | table.',
19
+ 'Parse .orca.md source JSON (states, events, transitions, guards, actions, context). Syntax: # machine Name, ## state Name [initial|final], ## transitions table (| Source | Event | Guard | Target | Action |).',
20
20
  inputSchema: {
21
21
  type: 'object',
22
22
  properties: {
@@ -28,7 +28,7 @@ export const ORCA_TOOLS: ToolDef[] = [
28
28
  {
29
29
  name: 'verify_machine',
30
30
  description:
31
- 'Verify an Orca machine definition for structural correctness, completeness, and determinism. Checks that exactly one [initial] state exists, all states are reachable, no deadlocks exist (every non-final state handles all events or has timeouts), and guards on competing transitions are mutually exclusive. Returns structured errors and warnings.',
31
+ 'Verify machine structure: checks [initial] presence (exactly one), reachability, no deadlocks, guard determinism. Returns structured errors with codes and suggestions. Run before compile_machine.',
32
32
  inputSchema: {
33
33
  type: 'object',
34
34
  properties: {
@@ -40,7 +40,7 @@ export const ORCA_TOOLS: ToolDef[] = [
40
40
  {
41
41
  name: 'compile_machine',
42
42
  description:
43
- 'Compile a verified Orca machine to XState v5 config (TypeScript) or Mermaid stateDiagram-v2. Run verify_machine first to catch errors before compiling.',
43
+ 'Compile verified machine to XState v5 TypeScript or Mermaid stateDiagram-v2. Run verify_machine first. target: "xstate" (default) or "mermaid".',
44
44
  inputSchema: {
45
45
  type: 'object',
46
46
  properties: {
@@ -57,7 +57,7 @@ export const ORCA_TOOLS: ToolDef[] = [
57
57
  {
58
58
  name: 'generate_machine',
59
59
  description:
60
- 'Generate a draft Orca machine definition from a natural language specification. Automatically chooses between a single-machine or multi-machine design based on the spec: specs that mention a coordinator, orchestrator, or multiple independently-lifecycled sub-processes route to multi-machine; everything else produces a single machine. Returns raw .orca.md source and an is_multi flag. Always call verify_machine on the result next then refine_machine if there are errors. Requires LLM configuration via environment variables (ANTHROPIC_API_KEY, etc.).',
60
+ 'Generate draft .orca.md from natural language spec. Returns source + is_multi flag. Always verify_machine next, then refine_machine if errors. Requires LLM API key (ANTHROPIC_API_KEY, etc.).',
61
61
  inputSchema: {
62
62
  type: 'object',
63
63
  properties: {
@@ -72,7 +72,7 @@ export const ORCA_TOOLS: ToolDef[] = [
72
72
  {
73
73
  name: 'generate_actions',
74
74
  description:
75
- 'Generate action scaffold code for an Orca machine in TypeScript, Python, or Go. Includes registration comments and optional test scaffolds. Requires a successfully parsed machine pass verified .orca.md source.',
75
+ 'Generate action scaffold code from verified machine. lang: typescript (default), python, or go. Pass verified .orca.md source. use_llm: true for implementations vs templates. generate_tests: true for test scaffolds.',
76
76
  inputSchema: {
77
77
  type: 'object',
78
78
  properties: {
@@ -97,7 +97,7 @@ export const ORCA_TOOLS: ToolDef[] = [
97
97
  {
98
98
  name: 'generate_multi_machine',
99
99
  description:
100
- 'Generate a draft set of coordinated Orca machines from a natural language specification. Returns multiple machine definitions in one .orca.md file (separated by ---). Always call verify_machine on the result next then refine_machine if there are errors. Requires LLM configuration via environment variables.',
100
+ 'Generate coordinated multi-machine .orca.md from spec (machines separated by ---). Use invoke: ChildMachine in states. Always verify_machine next, then refine_machine if errors. Requires LLM API key.',
101
101
  inputSchema: {
102
102
  type: 'object',
103
103
  properties: {
@@ -112,7 +112,7 @@ export const ORCA_TOOLS: ToolDef[] = [
112
112
  {
113
113
  name: 'refine_machine',
114
114
  description:
115
- 'Fix verification errors in an Orca machine using an LLM. Loops until the machine is valid or max_iterations is reached. If errors are not provided, verification runs automatically first. Use this after verify_machine returns errors.',
115
+ 'Fix verify_machine errors using LLM. Loops until valid or max_iterations (default: 3). Pass errors array from verify_machine output, or omit to auto-verify first.',
116
116
  inputSchema: {
117
117
  type: 'object',
118
118
  properties: {
@@ -136,7 +136,7 @@ export const ORCA_TOOLS: ToolDef[] = [
136
136
  {
137
137
  name: 'server_status',
138
138
  description:
139
- 'Return the MCP server version and active configuration. API keys are never included in the response — only whether a key is configured. Use this to confirm the server is running and check which LLM provider and model are active.',
139
+ 'Return MCP server version, active LLM provider/model, and configuration. API keys are never exposed — only whether a key is configured.',
140
140
  inputSchema: {
141
141
  type: 'object',
142
142
  properties: {},