@rasputin-ai/node 0.5.0-alpha.2 → 0.5.0-alpha.3

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":"transform-source.d.ts","sourceRoot":"","sources":["../../src/auto-instrumentation/transform-source.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EACX,4BAA4B,EAE5B,MAAM,kCAAkC,CAAC;AAI1C,MAAM,MAAM,sBAAsB,GAAG;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,oBAAoB,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,4BAA4B,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,QAAQ,EAAE,cAAc,KAAK,cAAc,GAAG,SAAS,CAAC;AA+H5F,6FAA6F;AAC7F,eAAO,MAAM,eAAe,GAC3B,QAAQ,MAAM,EACd,SAAS,sBAAsB,KAC7B,iBAAiB,GAAG,SAsFtB,CAAC"}
1
+ {"version":3,"file":"transform-source.d.ts","sourceRoot":"","sources":["../../src/auto-instrumentation/transform-source.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EACX,4BAA4B,EAE5B,MAAM,kCAAkC,CAAC;AAI1C,MAAM,MAAM,sBAAsB,GAAG;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,oBAAoB,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,4BAA4B,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,QAAQ,EAAE,cAAc,KAAK,cAAc,GAAG,SAAS,CAAC;AAkJ5F,6FAA6F;AAC7F,eAAO,MAAM,eAAe,GAC3B,QAAQ,MAAM,EACd,SAAS,sBAAsB,KAC7B,iBAAiB,GAAG,SA0FtB,CAAC"}
package/dist/index.js CHANGED
@@ -1644,7 +1644,7 @@ import {
1644
1644
 
1645
1645
  // src/sdk-meta.ts
1646
1646
  var SDK_NAME = "@rasputin-ai/node";
1647
- var SDK_VERSION = "0.5.0-alpha.2";
1647
+ var SDK_VERSION = "0.5.0-alpha.3";
1648
1648
 
1649
1649
  // src/rasputin-init.ts
1650
1650
  var withExecution = (client, execution, installRuntime, manifest) => {
@@ -496,6 +496,21 @@ var uniqueName = (source, base) => {
496
496
  while (source.includes(name)) name += "_";
497
497
  return name;
498
498
  };
499
+ var isDirectivePrologue = (statement) => ts2.isExpressionStatement(statement) && ts2.isStringLiteral(statement.expression);
500
+ var insertPositionAfterPrologue = (source, sourceFile) => {
501
+ const shebangEnd = source.startsWith("#!") ? source.indexOf("\n") + 1 : 0;
502
+ let end = shebangEnd;
503
+ for (const statement of sourceFile.statements) {
504
+ if (!isDirectivePrologue(statement)) break;
505
+ end = statement.end;
506
+ }
507
+ return end;
508
+ };
509
+ var preambleInsert = (source, position, preamble) => {
510
+ if (position <= 0) return preamble;
511
+ const previous = source[position - 1];
512
+ return previous === ";" || previous === "\n" || previous === "\r" ? preamble : `;${preamble}`;
513
+ };
499
514
  var modulePreamble = (runName, plansName, plansJson) => `const ${plansName}=${plansJson};const ${runName}=((g,k)=>{const r=g[k]??(g[k]={runtimes:[],modules:[],register(p){const d={run:(i,a,c)=>c()};const m={plans:p,cell:d};this.modules.push(m);const n=this.runtimes.at(-1);if(n)n.bind(m);return(i,a,c)=>d.run(i,a,c)}});return r.register(${plansName})})(globalThis,Symbol.for(${JSON.stringify(AUTOMATIC_RUNTIME_SYMBOL)}));`;
500
515
  var collectWrappedFunction = (node, sourceFile, absolutePath, mapLocation) => {
501
516
  const start = mappedLocation(
@@ -594,10 +609,14 @@ var transformSource = (source, options) => {
594
609
  };
595
610
  visit(sourceFile);
596
611
  if (edits.length === 0) return void 0;
597
- const shebangEnd = source.startsWith("#!") ? source.indexOf("\n") + 1 : 0;
612
+ const insertAt = insertPositionAfterPrologue(source, sourceFile);
598
613
  edits.push({
599
- position: shebangEnd,
600
- text: modulePreamble(runName, plansName, JSON.stringify(delta.functions.map((fn) => fn.plan))),
614
+ position: insertAt,
615
+ text: preambleInsert(
616
+ source,
617
+ insertAt,
618
+ modulePreamble(runName, plansName, JSON.stringify(delta.functions.map((fn) => fn.plan)))
619
+ ),
601
620
  order: -1
602
621
  });
603
622
  edits.sort((left, right) => right.position - left.position || right.order - left.order);
@@ -333,6 +333,21 @@ var uniqueName = (source, base) => {
333
333
  while (source.includes(name)) name += "_";
334
334
  return name;
335
335
  };
336
+ var isDirectivePrologue = (statement) => ts2.isExpressionStatement(statement) && ts2.isStringLiteral(statement.expression);
337
+ var insertPositionAfterPrologue = (source, sourceFile) => {
338
+ const shebangEnd = source.startsWith("#!") ? source.indexOf("\n") + 1 : 0;
339
+ let end = shebangEnd;
340
+ for (const statement of sourceFile.statements) {
341
+ if (!isDirectivePrologue(statement)) break;
342
+ end = statement.end;
343
+ }
344
+ return end;
345
+ };
346
+ var preambleInsert = (source, position, preamble) => {
347
+ if (position <= 0) return preamble;
348
+ const previous = source[position - 1];
349
+ return previous === ";" || previous === "\n" || previous === "\r" ? preamble : `;${preamble}`;
350
+ };
336
351
  var modulePreamble = (runName, plansName, plansJson) => `const ${plansName}=${plansJson};const ${runName}=((g,k)=>{const r=g[k]??(g[k]={runtimes:[],modules:[],register(p){const d={run:(i,a,c)=>c()};const m={plans:p,cell:d};this.modules.push(m);const n=this.runtimes.at(-1);if(n)n.bind(m);return(i,a,c)=>d.run(i,a,c)}});return r.register(${plansName})})(globalThis,Symbol.for(${JSON.stringify(AUTOMATIC_RUNTIME_SYMBOL)}));`;
337
352
  var collectWrappedFunction = (node, sourceFile, absolutePath, mapLocation) => {
338
353
  const start = mappedLocation(
@@ -431,10 +446,14 @@ var transformSource = (source, options) => {
431
446
  };
432
447
  visit(sourceFile);
433
448
  if (edits.length === 0) return void 0;
434
- const shebangEnd = source.startsWith("#!") ? source.indexOf("\n") + 1 : 0;
449
+ const insertAt = insertPositionAfterPrologue(source, sourceFile);
435
450
  edits.push({
436
- position: shebangEnd,
437
- text: modulePreamble(runName, plansName, JSON.stringify(delta.functions.map((fn) => fn.plan))),
451
+ position: insertAt,
452
+ text: preambleInsert(
453
+ source,
454
+ insertAt,
455
+ modulePreamble(runName, plansName, JSON.stringify(delta.functions.map((fn) => fn.plan)))
456
+ ),
438
457
  order: -1
439
458
  });
440
459
  edits.sort((left, right) => right.position - left.position || right.order - left.order);
@@ -388,6 +388,21 @@ var uniqueName = (source, base) => {
388
388
  while (source.includes(name)) name += "_";
389
389
  return name;
390
390
  };
391
+ var isDirectivePrologue = (statement) => ts2.isExpressionStatement(statement) && ts2.isStringLiteral(statement.expression);
392
+ var insertPositionAfterPrologue = (source, sourceFile) => {
393
+ const shebangEnd = source.startsWith("#!") ? source.indexOf("\n") + 1 : 0;
394
+ let end = shebangEnd;
395
+ for (const statement of sourceFile.statements) {
396
+ if (!isDirectivePrologue(statement)) break;
397
+ end = statement.end;
398
+ }
399
+ return end;
400
+ };
401
+ var preambleInsert = (source, position, preamble) => {
402
+ if (position <= 0) return preamble;
403
+ const previous = source[position - 1];
404
+ return previous === ";" || previous === "\n" || previous === "\r" ? preamble : `;${preamble}`;
405
+ };
391
406
  var modulePreamble = (runName, plansName, plansJson) => `const ${plansName}=${plansJson};const ${runName}=((g,k)=>{const r=g[k]??(g[k]={runtimes:[],modules:[],register(p){const d={run:(i,a,c)=>c()};const m={plans:p,cell:d};this.modules.push(m);const n=this.runtimes.at(-1);if(n)n.bind(m);return(i,a,c)=>d.run(i,a,c)}});return r.register(${plansName})})(globalThis,Symbol.for(${JSON.stringify(AUTOMATIC_RUNTIME_SYMBOL)}));`;
392
407
  var collectWrappedFunction = (node, sourceFile, absolutePath, mapLocation) => {
393
408
  const start = mappedLocation(
@@ -486,10 +501,14 @@ var transformSource = (source, options) => {
486
501
  };
487
502
  visit(sourceFile);
488
503
  if (edits.length === 0) return void 0;
489
- const shebangEnd = source.startsWith("#!") ? source.indexOf("\n") + 1 : 0;
504
+ const insertAt = insertPositionAfterPrologue(source, sourceFile);
490
505
  edits.push({
491
- position: shebangEnd,
492
- text: modulePreamble(runName, plansName, JSON.stringify(delta.functions.map((fn) => fn.plan))),
506
+ position: insertAt,
507
+ text: preambleInsert(
508
+ source,
509
+ insertAt,
510
+ modulePreamble(runName, plansName, JSON.stringify(delta.functions.map((fn) => fn.plan)))
511
+ ),
493
512
  order: -1
494
513
  });
495
514
  edits.sort((left, right) => right.position - left.position || right.order - left.order);
@@ -1,4 +1,4 @@
1
1
  /** Generated by scripts/generate-sdk-meta.ts — do not edit. */
2
2
  export declare const SDK_NAME = "@rasputin-ai/node";
3
- export declare const SDK_VERSION = "0.5.0-alpha.2";
3
+ export declare const SDK_VERSION = "0.5.0-alpha.3";
4
4
  //# sourceMappingURL=sdk-meta.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rasputin-ai/node",
3
- "version": "0.5.0-alpha.2",
3
+ "version": "0.5.0-alpha.3",
4
4
  "description": "Official Rasputin AI SDK for Node and Bun.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@jridgewell/trace-mapping": "0.3.31",
47
- "@rasputin-ai/core": "0.5.0-alpha.2",
47
+ "@rasputin-ai/core": "0.5.0-alpha.3",
48
48
  "typescript": "5"
49
49
  },
50
50
  "devDependencies": {