@treeseed/sdk 0.3.1 → 0.3.2

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.
@@ -18,8 +18,28 @@ function isPathLikePluginReference(packageName) {
18
18
  }
19
19
  function resolveLocalDefaultPluginPath() {
20
20
  const candidates = [
21
- path.resolve(runtimeDir, "../../../../core/dist/plugin-default.js")
21
+ path.resolve(runtimeDir, "../../../../core/dist/plugin-default.js"),
22
+ path.resolve(runtimeDir, "../../../../dist/plugin-default.js")
22
23
  ];
24
+ let current = runtimeDir;
25
+ while (true) {
26
+ const packageJsonPath = path.resolve(current, "package.json");
27
+ if (existsSync(packageJsonPath)) {
28
+ try {
29
+ const packageJson = require2(packageJsonPath);
30
+ if (packageJson?.name === "@treeseed/core") {
31
+ candidates.push(path.resolve(current, "dist/plugin-default.js"));
32
+ break;
33
+ }
34
+ } catch {
35
+ }
36
+ }
37
+ const parent = path.resolve(current, "..");
38
+ if (parent === current) {
39
+ break;
40
+ }
41
+ current = parent;
42
+ }
23
43
  for (const candidate of candidates) {
24
44
  if (existsSync(candidate)) {
25
45
  return candidate;
@@ -569,7 +569,7 @@ export interface SdkGraphRefreshPayload {
569
569
  }
570
570
  export interface SdkCreateMessageRequest {
571
571
  type: string;
572
- payload: Record<string, unknown>;
572
+ payload: Record<string, unknown> | string;
573
573
  relatedModel?: string | null;
574
574
  relatedId?: string | null;
575
575
  priority?: number;
@@ -40,7 +40,8 @@ function ensureNumber(value, label) {
40
40
  return value;
41
41
  }
42
42
  function parseAgentMessagePayload(type, payloadJson) {
43
- const parsed = JSON.parse(payloadJson);
43
+ const decoded = JSON.parse(payloadJson);
44
+ const parsed = typeof decoded === "string" ? JSON.parse(decoded) : decoded;
44
45
  switch (type) {
45
46
  case "question_priority_updated":
46
47
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@treeseed/sdk",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Shared Treeseed SDK for content-backed and D1-backed object models.",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {