loopengine 0.1.70 → 0.1.71

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.
@@ -34,9 +34,16 @@
34
34
  // package.json).
35
35
  import { readFileSync, writeFileSync } from 'node:fs';
36
36
  import { join } from 'node:path';
37
- import ts from 'typescript';
37
+ import { createRequire } from 'node:module';
38
38
  import { agentDir } from '../core/gateway-tools.js';
39
39
  import { AgentModelError } from '../bin/cli.js';
40
+ // Loaded on the first edit, not at import: typescript is ~9 MB of JS and
41
+ // index.ts re-exports this module, so importing it eagerly added more
42
+ // than a second to every server's startup on a small machine.
43
+ let ts;
44
+ function loadTypeScript() {
45
+ return (ts ??= createRequire(import.meta.url)('typescript'));
46
+ }
40
47
  export class AgentEditNotSupportedError extends Error {
41
48
  }
42
49
  export class AgentFileNotFoundError extends Error {
@@ -129,6 +136,7 @@ function upsertNumericProperty(configObj, sourceFile, edits, toInsert, name, val
129
136
  * needing to re-derive them. A field omitted from `fields` entirely is
130
137
  * left completely untouched, both on disk and in the return value. */
131
138
  export function editAgentFile(agentName, fields) {
139
+ loadTypeScript();
132
140
  const indexPath = join(agentDir(agentName), 'index.ts');
133
141
  let source;
134
142
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loopengine",
3
- "version": "0.1.70",
3
+ "version": "0.1.71",
4
4
  "type": "module",
5
5
  "description": "Runtime for tool-using AI agents with a transparent ReAct loop.",
6
6
  "license": "MIT",