@maxanstey-meridian/tandem 0.1.2 → 0.1.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.
Files changed (101) hide show
  1. package/README.md +16 -2
  2. package/dist/runtime/Humanizer.dll +0 -0
  3. package/dist/runtime/Json.More.dll +0 -0
  4. package/dist/runtime/JsonPointer.Net.dll +0 -0
  5. package/dist/runtime/JsonSchema.Net.Generation.dll +0 -0
  6. package/dist/runtime/JsonSchema.Net.dll +0 -0
  7. package/dist/runtime/Tandem.Advanced.dll +0 -0
  8. package/dist/runtime/Tandem.Ledger.dll +0 -0
  9. package/dist/runtime/Tandem.NodeApiSpike.Bridge.deps.json +170 -110
  10. package/dist/runtime/Tandem.NodeApiSpike.Bridge.dll +0 -0
  11. package/dist/runtime/Tandem.OpenAICompatible.dll +0 -0
  12. package/dist/runtime/Tandem.Terminal.dll +0 -0
  13. package/dist/runtime/Tandem.dll +0 -0
  14. package/dist/runtime/Tavily.dll +0 -0
  15. package/dist/runtime/cs/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
  16. package/dist/runtime/cs/Microsoft.CodeAnalysis.resources.dll +0 -0
  17. package/dist/runtime/de/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
  18. package/dist/runtime/de/Microsoft.CodeAnalysis.resources.dll +0 -0
  19. package/dist/runtime/es/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
  20. package/dist/runtime/es/Microsoft.CodeAnalysis.resources.dll +0 -0
  21. package/dist/runtime/fr/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
  22. package/dist/runtime/fr/Microsoft.CodeAnalysis.resources.dll +0 -0
  23. package/dist/runtime/import.cjs +3 -0
  24. package/dist/runtime/it/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
  25. package/dist/runtime/it/Microsoft.CodeAnalysis.resources.dll +0 -0
  26. package/dist/runtime/ja/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
  27. package/dist/runtime/ja/Microsoft.CodeAnalysis.resources.dll +0 -0
  28. package/dist/runtime/ko/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
  29. package/dist/runtime/ko/Microsoft.CodeAnalysis.resources.dll +0 -0
  30. package/dist/runtime/pl/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
  31. package/dist/runtime/pl/Microsoft.CodeAnalysis.resources.dll +0 -0
  32. package/dist/runtime/pt-BR/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
  33. package/dist/runtime/pt-BR/Microsoft.CodeAnalysis.resources.dll +0 -0
  34. package/dist/runtime/ru/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
  35. package/dist/runtime/ru/Microsoft.CodeAnalysis.resources.dll +0 -0
  36. package/dist/runtime/tr/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
  37. package/dist/runtime/tr/Microsoft.CodeAnalysis.resources.dll +0 -0
  38. package/dist/runtime/zh-Hans/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
  39. package/dist/runtime/zh-Hans/Microsoft.CodeAnalysis.resources.dll +0 -0
  40. package/dist/runtime/zh-Hant/Microsoft.CodeAnalysis.CSharp.resources.dll +0 -0
  41. package/dist/runtime/zh-Hant/Microsoft.CodeAnalysis.resources.dll +0 -0
  42. package/package.json +6 -12
  43. package/runtime/FluentValidation.dll +0 -0
  44. package/runtime/Google.Protobuf.dll +0 -0
  45. package/runtime/Microsoft.Agents.AI.Abstractions.dll +0 -0
  46. package/runtime/Microsoft.Agents.AI.Harness.dll +0 -0
  47. package/runtime/Microsoft.Agents.AI.Tools.Shell.dll +0 -0
  48. package/runtime/Microsoft.Agents.AI.Workflows.dll +0 -0
  49. package/runtime/Microsoft.Agents.AI.dll +0 -0
  50. package/runtime/Microsoft.CodeAnalysis.CSharp.dll +0 -0
  51. package/runtime/Microsoft.CodeAnalysis.dll +0 -0
  52. package/runtime/Microsoft.Data.Sqlite.dll +0 -0
  53. package/runtime/Microsoft.Extensions.AI.Abstractions.dll +0 -0
  54. package/runtime/Microsoft.Extensions.AI.Evaluation.dll +0 -0
  55. package/runtime/Microsoft.Extensions.AI.OpenAI.dll +0 -0
  56. package/runtime/Microsoft.Extensions.AI.dll +0 -0
  57. package/runtime/Microsoft.Extensions.Caching.Abstractions.dll +0 -0
  58. package/runtime/Microsoft.Extensions.Compliance.Abstractions.dll +0 -0
  59. package/runtime/Microsoft.Extensions.Configuration.Abstractions.dll +0 -0
  60. package/runtime/Microsoft.Extensions.DependencyInjection.Abstractions.dll +0 -0
  61. package/runtime/Microsoft.Extensions.Diagnostics.Abstractions.dll +0 -0
  62. package/runtime/Microsoft.Extensions.FileProviders.Abstractions.dll +0 -0
  63. package/runtime/Microsoft.Extensions.FileSystemGlobbing.dll +0 -0
  64. package/runtime/Microsoft.Extensions.Hosting.Abstractions.dll +0 -0
  65. package/runtime/Microsoft.Extensions.Logging.Abstractions.dll +0 -0
  66. package/runtime/Microsoft.Extensions.ObjectPool.dll +0 -0
  67. package/runtime/Microsoft.Extensions.Options.dll +0 -0
  68. package/runtime/Microsoft.Extensions.Primitives.dll +0 -0
  69. package/runtime/Microsoft.Extensions.VectorData.Abstractions.dll +0 -0
  70. package/runtime/Microsoft.JavaScript.NodeApi.dll +0 -0
  71. package/runtime/Microsoft.ML.Tokenizers.dll +0 -0
  72. package/runtime/OpenAI.dll +0 -0
  73. package/runtime/OpenTelemetry.Api.dll +0 -0
  74. package/runtime/SQLitePCLRaw.batteries_v2.dll +0 -0
  75. package/runtime/SQLitePCLRaw.core.dll +0 -0
  76. package/runtime/SQLitePCLRaw.provider.e_sqlite3.dll +0 -0
  77. package/runtime/Spectre.Console.Ansi.dll +0 -0
  78. package/runtime/Spectre.Console.dll +0 -0
  79. package/runtime/System.ClientModel.dll +0 -0
  80. package/runtime/System.Memory.Data.dll +0 -0
  81. package/runtime/System.Numerics.Tensors.dll +0 -0
  82. package/runtime/System.Reflection.MetadataLoadContext.dll +0 -0
  83. package/runtime/Tandem.Advanced.dll +0 -0
  84. package/runtime/Tandem.Ledger.dll +0 -0
  85. package/runtime/Tandem.NodeApiSpike.Bridge.cjs +0 -26
  86. package/runtime/Tandem.NodeApiSpike.Bridge.d.ts +0 -23
  87. package/runtime/Tandem.NodeApiSpike.Bridge.deps.json +0 -1097
  88. package/runtime/Tandem.NodeApiSpike.Bridge.dll +0 -0
  89. package/runtime/Tandem.NodeApiSpike.Bridge.mjs +0 -31
  90. package/runtime/Tandem.NodeApiSpike.Bridge.runtimeconfig.json +0 -13
  91. package/runtime/Tandem.OpenAICompatible.dll +0 -0
  92. package/runtime/Tandem.Terminal.dll +0 -0
  93. package/runtime/Tandem.dll +0 -0
  94. package/runtime/libe_sqlite3.dylib +0 -0
  95. package/runtime/loader.d.mts +0 -10
  96. package/runtime/loader.mjs +0 -35
  97. package/scripts/install-runtime.mjs +0 -75
  98. package/src/cli.ts +0 -72
  99. package/src/index.ts +0 -2096
  100. package/src/runtime/loader.d.mts +0 -10
  101. package/tsconfig.json +0 -14
@@ -1,31 +0,0 @@
1
- // Generated for: Tandem.NodeApiSpike.Bridge 0.1.0.0
2
- // Generated by: Microsoft.JavaScript.NodeApi.Generator 0.9.0.0
3
- /* eslint-disable */
4
-
5
- import dotnet from 'node-api-dotnet/net10.0';
6
- import * as path from 'node:path';
7
- import { fileURLToPath } from 'node:url';
8
- // @ts-ignore - https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/65252
9
- import { dlopen, platform, arch } from 'node:process';
10
-
11
- const __filename = fileURLToPath(import.meta.url);
12
- const __dirname = path.dirname(__filename);
13
- const moduleName = path.basename(__filename, __filename.match(/(\.[cm]?js)?$/)[0]);
14
- const exports = dotnet ? importDotnetModule(moduleName) : importAotModule(moduleName);
15
-
16
- function importDotnetModule(moduleName) {
17
- const moduleFilePath = path.join(__dirname, moduleName + '.dll');
18
- return dotnet.require(moduleFilePath);
19
- }
20
-
21
- function importAotModule(moduleName) {
22
- const ridPlatform = platform === 'win32' ? 'win' : platform === 'darwin' ? 'osx' : platform;
23
- const ridArch = arch === 'ia32' ? 'x86' : arch;
24
- const rid = `${ridPlatform}-${ridArch}`;
25
- const moduleFilePath = path.join(__dirname, rid, moduleName + '.node');
26
- const module = { exports: {} };
27
- dlopen(module, moduleFilePath);
28
- return module.exports;
29
- }
30
-
31
- export const NodePipelineBridge = exports.NodePipelineBridge;
@@ -1,13 +0,0 @@
1
- {
2
- "runtimeOptions": {
3
- "tfm": "net10.0",
4
- "framework": {
5
- "name": "Microsoft.NETCore.App",
6
- "version": "10.0.0"
7
- },
8
- "configProperties": {
9
- "System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
10
- "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
11
- }
12
- }
13
- }
Binary file
Binary file
Binary file
Binary file
@@ -1,10 +0,0 @@
1
- declare const runRegisteredGraphAsync: (
2
- definition: string,
3
- syncCallback: (id: string, state: string, input: string) => string,
4
- asyncCallback: (id: string, state: string, input: string, signal: AbortSignal) => Promise<string>,
5
- signal?: AbortSignal,
6
- ) => Promise<string>;
7
-
8
- declare const inspectAcceptedAsync: (ledgerPath: string, runId: string) => Promise<string>;
9
-
10
- export { inspectAcceptedAsync, runRegisteredGraphAsync };
@@ -1,35 +0,0 @@
1
- import { existsSync } from "node:fs";
2
- import { fileURLToPath } from "node:url";
3
-
4
- const platforms = {
5
- "darwin-arm64": "./Tandem.NodeApiSpike.Bridge.mjs",
6
- };
7
-
8
- const platform = `${process.platform}-${process.arch}`;
9
- const entry = platforms[platform];
10
- if (!entry) {
11
- throw new Error(
12
- `Tandem does not ship a runtime for ${platform}. Supported platforms: ${Object.keys(platforms).join(", ")}.`,
13
- );
14
- }
15
-
16
- const bridgeUrl = new URL(entry, import.meta.url);
17
- const bridgePath = fileURLToPath(bridgeUrl);
18
- if (!existsSync(bridgePath)) {
19
- throw new Error(
20
- `Tandem bridge assets are missing at ${bridgePath}. Run \`pnpm install\` (postinstall fetches them) or \`node scripts/install-runtime.mjs\` directly.`,
21
- );
22
- }
23
-
24
- let runtime;
25
- try {
26
- runtime = await import(bridgeUrl.href);
27
- } catch (error) {
28
- throw new Error(
29
- `Tandem could not load the ${platform} bridge from ${bridgeUrl.pathname}.`,
30
- { cause: error },
31
- );
32
- }
33
-
34
- export const runRegisteredGraphAsync = runtime.NodePipelineBridge.runRegisteredGraphAsync;
35
- export const inspectAcceptedAsync = runtime.NodePipelineBridge.inspectAcceptedAsync;
@@ -1,75 +0,0 @@
1
- import assert from "node:assert/strict";
2
- import { createWriteStream, existsSync } from "node:fs";
3
- import { mkdir, readdir, rm } from "node:fs/promises";
4
- import { get } from "node:https";
5
- import { execFileSync } from "node:child_process";
6
- import { join } from "node:path";
7
- import { pipeline } from "node:stream/promises";
8
-
9
- const TANDEM_VERSION = "0.1.0";
10
- const RUNTIME_DIR = "runtime";
11
-
12
- const ASSET_ALLOWLIST = [
13
- "Tandem.NodeApiSpike.Bridge.mjs",
14
- "Tandem.NodeApiSpike.Bridge.dll",
15
- "Tandem.NodeApiSpike.Bridge.runtimeconfig.json",
16
- "Tandem.dll",
17
- "Tandem.Ledger.dll",
18
- "Tandem.Terminal.dll",
19
- "Spectre.Console.dll",
20
- "Spectre.Console.Ansi.dll",
21
- "Microsoft.Agents.AI.dll",
22
- "Microsoft.Extensions.AI.dll",
23
- "OpenAI.dll",
24
- ];
25
-
26
- function download(url, destination) {
27
- return new Promise((resolve, reject) => {
28
- get(url, (response) => {
29
- if (response.statusCode >= 300 && response.statusCode < 400 && response.headers.location) {
30
- download(new URL(response.headers.location, url).href, destination).then(resolve, reject);
31
- response.resume();
32
- return;
33
- }
34
- if (response.statusCode !== 200) {
35
- reject(new Error(`GET ${url} failed with status ${response.statusCode}.`));
36
- response.resume();
37
- return;
38
- }
39
- pipeline(response, createWriteStream(destination)).then(resolve, reject);
40
- }).on("error", reject);
41
- });
42
- }
43
-
44
- async function bridgeIsComplete() {
45
- for (const asset of ASSET_ALLOWLIST) {
46
- if (!existsSync(join(RUNTIME_DIR, asset))) {
47
- return false;
48
- }
49
- }
50
- return true;
51
- }
52
-
53
- async function main() {
54
- await mkdir(RUNTIME_DIR, { recursive: true });
55
- if (await bridgeIsComplete()) {
56
- console.log(`Tandem bridge ${TANDEM_VERSION} already present.`);
57
- return;
58
- }
59
- const version = TANDEM_VERSION;
60
- const url = `https://github.com/maxanstey-meridian/tandem/releases/download/${version}/tandem-bridge-${version}-darwin-arm64.tar.gz`;
61
- const tarball = join("node_modules", `.tandem-bridge-${version}.tar.gz`);
62
- await mkdir("node_modules", { recursive: true });
63
- console.log(`Fetching Tandem bridge ${version} from ${url}`);
64
- await download(url, tarball);
65
- execFileSync("tar", ["-xzf", tarball, "-C", RUNTIME_DIR], { stdio: "inherit" });
66
- await rm(tarball, { force: true });
67
- const staged = await readdir(RUNTIME_DIR);
68
- assert.ok(staged.includes("Tandem.NodeApiSpike.Bridge.mjs"), "bridge archive did not contain the Node bridge entrypoint");
69
- console.log(`Tandem bridge ${version} staged (${staged.length} assets).`);
70
- }
71
-
72
- main().catch((error) => {
73
- console.error(error instanceof Error ? error.message : error);
74
- process.exit(1);
75
- });
package/src/cli.ts DELETED
@@ -1,72 +0,0 @@
1
- import { run, type Pipeline, type RunOptions, type RunResult } from "./index.js";
2
-
3
- export interface RunCliOptions<TState> extends Omit<RunOptions, "presentation"> {
4
- readonly formatResult: (result: RunResult<TState>) => string | Promise<string>;
5
- }
6
-
7
- export async function runCli<TState>(
8
- graph: Pipeline<TState>,
9
- initial: unknown,
10
- options: RunCliOptions<TState>,
11
- ): Promise<void> {
12
- let exitCode = 2;
13
- let signalExitCode: number | null = null;
14
- let pipelineCompleted = false;
15
- const shutdown = new AbortController();
16
- const requestShutdown = (code: number, signal: NodeJS.Signals) => {
17
- signalExitCode ??= code;
18
- shutdown.abort(new Error(`Received ${signal}.`));
19
- };
20
- const onSigInt = () => requestShutdown(130, "SIGINT");
21
- const onSigTerm = () => requestShutdown(143, "SIGTERM");
22
- process.once("SIGINT", onSigInt);
23
- process.once("SIGTERM", onSigTerm);
24
- try {
25
- const { formatResult, signal, ...runOptions } = options;
26
- const runSignal = signal ? AbortSignal.any([signal, shutdown.signal]) : shutdown.signal;
27
- const result = await run(graph, initial, {
28
- ...runOptions,
29
- signal: runSignal,
30
- presentation: "terminal",
31
- });
32
- pipelineCompleted = true;
33
- const formatted = await formatResult(result);
34
- await write(process.stdout, `${formatted}\n`);
35
- exitCode = result.succeeded ? 0 : 1;
36
- } catch (error) {
37
- if (signalExitCode === null) {
38
- const prefix = pipelineCompleted ? "Pipeline completed, but result output failed: " : "";
39
- await write(process.stderr, `${prefix}${formatError(error)}\n`);
40
- }
41
- } finally {
42
- process.removeListener("SIGINT", onSigInt);
43
- process.removeListener("SIGTERM", onSigTerm);
44
- process.exitCode = signalExitCode ?? exitCode;
45
- }
46
- }
47
-
48
- function formatError(error: unknown, seen = new Set<unknown>()): string {
49
- if (!(error instanceof Error)) {
50
- return String(error);
51
- }
52
- if (seen.has(error)) {
53
- return error.stack ?? `${error.name}: ${error.message}`;
54
- }
55
- seen.add(error);
56
-
57
- const stack = error.stack;
58
- const detail = stack?.startsWith(`${error.name}: `)
59
- ? stack.slice(error.name.length + 2)
60
- : (stack ?? error.message);
61
- if (error.cause === undefined) {
62
- return detail;
63
- }
64
- const cause = formatError(error.cause, seen);
65
- return detail.includes(cause) ? detail : `${detail}\nCaused by: ${cause}`;
66
- }
67
-
68
- function write(stream: NodeJS.WritableStream, value: string): Promise<void> {
69
- return new Promise((resolve, reject) =>
70
- stream.write(value, (error) => (error ? reject(error) : resolve())),
71
- );
72
- }