@pentatonic-ai/ai-agent-sdk 0.8.4 → 0.8.6

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.
package/build.js CHANGED
@@ -1,4 +1,17 @@
1
1
  import { build } from "esbuild";
2
+ import { readFileSync } from "node:fs";
3
+
4
+ // Read the package version once and inject it into the bundle so
5
+ // src/telemetry.js can report the real SDK version instead of the
6
+ // stale "0.4.0" literal that lived in source for six releases. Bundled
7
+ // output (dist/*) gets the substituted string; raw-source consumers
8
+ // (e.g. anyone importing src/ directly during dev) fall back to a
9
+ // runtime read — see src/telemetry.js.
10
+ const PKG_VERSION = JSON.parse(readFileSync("./package.json", "utf8")).version;
11
+
12
+ const sharedDefine = {
13
+ __SDK_VERSION__: JSON.stringify(PKG_VERSION),
14
+ };
2
15
 
3
16
  // ESM
4
17
  await build({
@@ -8,6 +21,7 @@ await build({
8
21
  bundle: true,
9
22
  platform: "neutral",
10
23
  target: "es2020",
24
+ define: sharedDefine,
11
25
  });
12
26
 
13
27
  // CJS
@@ -18,6 +32,7 @@ await build({
18
32
  bundle: true,
19
33
  platform: "neutral",
20
34
  target: "es2020",
35
+ define: sharedDefine,
21
36
  });
22
37
 
23
- console.log("Built dist/index.js (ESM) and dist/index.cjs (CJS)");
38
+ console.log(`Built dist/index.js (ESM) and dist/index.cjs (CJS) — SDK_VERSION=${PKG_VERSION}`);
package/dist/index.cjs CHANGED
@@ -906,7 +906,7 @@ function fireAndForgetEmit(clientConfig, sessionOpts, messages, result, model) {
906
906
  }
907
907
 
908
908
  // src/telemetry.js
909
- var VERSION = "0.4.0";
909
+ var VERSION = "0.8.6";
910
910
  var TELEMETRY_URL = "https://sdk-telemetry.philip-134.workers.dev";
911
911
  function machineId() {
912
912
  const raw = typeof process !== "undefined" ? `${process.env?.USER || process.env?.USERNAME || "u"}:${process.platform || "x"}:${process.arch || "x"}` : "browser";
package/dist/index.js CHANGED
@@ -875,7 +875,7 @@ function fireAndForgetEmit(clientConfig, sessionOpts, messages, result, model) {
875
875
  }
876
876
 
877
877
  // src/telemetry.js
878
- var VERSION = "0.4.0";
878
+ var VERSION = "0.8.6";
879
879
  var TELEMETRY_URL = "https://sdk-telemetry.philip-134.workers.dev";
880
880
  function machineId() {
881
881
  const raw = typeof process !== "undefined" ? `${process.env?.USER || process.env?.USERNAME || "u"}:${process.platform || "x"}:${process.arch || "x"}` : "browser";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pentatonic-ai/ai-agent-sdk",
3
- "version": "0.8.4",
3
+ "version": "0.8.6",
4
4
  "description": "TES SDK — LLM observability and lifecycle tracking via Pentatonic Thing Event System. Track token usage, tool calls, and conversations. Manage things through event-sourced lifecycle stages with AI enrichment and vector search.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -20,6 +20,10 @@
20
20
  * PORT — HTTP port for SSE transport (default: 3333)
21
21
  */
22
22
 
23
+ import { readFileSync } from "node:fs";
24
+ import { fileURLToPath } from "node:url";
25
+ import { dirname, resolve } from "node:path";
26
+
23
27
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
24
28
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
25
29
  import { z } from "zod";
@@ -61,6 +65,23 @@ function createMemory() {
61
65
  });
62
66
  }
63
67
 
68
+ // Resolved at module load. This file is loaded directly via Node (not
69
+ // bundled), so reading the root package.json synchronously is safe —
70
+ // packages/memory/src/server.js only ever runs in a Node process.
71
+ // Falls back to "0.0.0-dev" if the root SDK package.json can't be
72
+ // located (e.g. unusual install layout where the memory subpackage
73
+ // was vendored standalone).
74
+ const _SDK_VERSION = (() => {
75
+ try {
76
+ const here = dirname(fileURLToPath(import.meta.url));
77
+ return JSON.parse(
78
+ readFileSync(resolve(here, "../../../package.json"), "utf8")
79
+ ).version;
80
+ } catch {
81
+ return "0.0.0-dev";
82
+ }
83
+ })();
84
+
64
85
  async function main() {
65
86
  // Telemetry ping — fire and forget
66
87
  if (process.env.PENTATONIC_TELEMETRY !== "0") {
@@ -75,7 +96,7 @@ async function main() {
75
96
  headers: { "Content-Type": "application/json" },
76
97
  body: JSON.stringify({
77
98
  machine_id: mid,
78
- sdk_version: "0.4.0",
99
+ sdk_version: _SDK_VERSION,
79
100
  node_version: process.version,
80
101
  platform: process.platform,
81
102
  arch: process.arch,
@@ -884,7 +884,14 @@ def serve(port: int = DEFAULT_PORT):
884
884
  arena="__healthcheck__", enable_rerank=False,
885
885
  )
886
886
  out["search_ms"] = round((_time.time() - t2) * 1000.0, 1)
887
- hit = any(r.get("id", "").startswith(sentinel_id) for r in (results or []))
887
+ # L6 search hits don't expose a stable `id` field — match by
888
+ # text content (verbatim — the sentinel was just written and
889
+ # the chunking layer doesn't split it) against the arena that
890
+ # the search was already filtered to.
891
+ hit = any(
892
+ sentinel_text in (r.get("text") or "")
893
+ for r in (results or [])
894
+ )
888
895
  out["hit"] = hit
889
896
  if not hit:
890
897
  out["status"] = "sentinel_missing"
package/src/telemetry.js CHANGED
@@ -1,4 +1,19 @@
1
- const VERSION = "0.4.0";
1
+ // SDK version is injected at build time by build.js via esbuild's
2
+ // `define` substitution on the bare identifier `__SDK_VERSION__`.
3
+ //
4
+ // Bundled output (dist/*): `typeof __SDK_VERSION__` resolves to
5
+ // `typeof "0.8.5"` -> "string" -> VERSION = "0.8.5"
6
+ // Raw source (rare — dev imports of src/ directly, or `./memory/server`
7
+ // loaded standalone): `__SDK_VERSION__` is an undeclared identifier;
8
+ // `typeof` is safe on those (returns "undefined") so we fall back to
9
+ // "0.0.0-dev" without a ReferenceError.
10
+ //
11
+ // Pre-v0.8.6 this was hardcoded "0.4.0" — six releases of telemetry
12
+ // reported one fixed version regardless of what was actually running.
13
+ // eslint-disable-next-line no-undef
14
+ const VERSION =
15
+ // eslint-disable-next-line no-undef
16
+ (typeof __SDK_VERSION__ === "string" && __SDK_VERSION__) || "0.0.0-dev";
2
17
  const TELEMETRY_URL = "https://sdk-telemetry.philip-134.workers.dev";
3
18
 
4
19
  /**