totemlayer 0.1.16 → 0.1.18

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/bin/totem.mjs CHANGED
@@ -4,7 +4,7 @@ import { createHash, randomUUID } from "node:crypto";
4
4
  import { createReadStream } from "node:fs";
5
5
  import { stripVTControlCharacters } from "node:util";
6
6
 
7
- const CLI_VERSION = "0.1.15";
7
+ const CLI_VERSION = "0.1.13";
8
8
  const DEFAULT_BASE_URL = "https://totemlayer.com";
9
9
  const API_KEY_PATTERN = /^at_(?:live|test)_[A-Za-z0-9_-]{20,}$/;
10
10
  const ACTION_PATTERN = /^[a-z0-9][a-z0-9._:-]*$/;
@@ -154,7 +154,9 @@ export function createCommandAdapter(config) {
154
154
  if (code !== 0) {
155
155
  try {
156
156
  return reject(
157
- new WorkerError(config.classifyFailure?.(diagnosticOutput) ?? "AGENT_EXIT_FAILED"),
157
+ new WorkerError(
158
+ config.classifyFailure?.(`${diagnosticOutput}\n${output}`) ?? "AGENT_EXIT_FAILED",
159
+ ),
158
160
  );
159
161
  } catch {
160
162
  return reject(new WorkerError("AGENT_EXIT_FAILED"));
@@ -26,7 +26,11 @@ const SAFE_CODES = new Set([
26
26
  "INVALID_PROMPT",
27
27
  "AGENT_START_FAILED",
28
28
  "AGENT_EXIT_FAILED",
29
- "AGENT_CLI_INCOMPATIBLE", "AGENT_AUTH_REQUIRED", "AGENT_QUOTA_EXCEEDED", "AGENT_SANDBOX_UNAVAILABLE", "AGENT_MODEL_UNAVAILABLE",
29
+ "AGENT_CLI_INCOMPATIBLE",
30
+ "AGENT_AUTH_REQUIRED",
31
+ "AGENT_QUOTA_EXCEEDED",
32
+ "AGENT_SANDBOX_UNAVAILABLE",
33
+ "AGENT_MODEL_UNAVAILABLE",
30
34
  "AGENT_REPORTED_FAILURE",
31
35
  "UNKNOWN_HTTP_OUTCOME",
32
36
  "HTTP_AGENT_FAILED",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "totemlayer",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
4
4
  "description": "Cross-platform CLI for TotemLayer agent identity and authorization",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,20 @@
1
+ import { execFileSync } from "node:child_process";
2
+ import { mkdir, readdir, copyFile } from "node:fs/promises";
3
+ import { fileURLToPath } from "node:url";
4
+
5
+ // Build from the sibling source every time a distributable is packed.
6
+ const sdk = fileURLToPath(new URL("../../sdk/", import.meta.url));
7
+ const destination = new URL("../bin/sdk/", import.meta.url);
8
+ execFileSync(process.platform === "win32" ? "npm.cmd" : "npm", ["run", "build", "--prefix", sdk], {
9
+ stdio: "inherit",
10
+ });
11
+ await mkdir(destination, { recursive: true });
12
+ for (const name of await readdir(new URL("../../sdk/dist/", import.meta.url))) {
13
+ if (name.endsWith(".js"))
14
+ await copyFile(new URL(`../../sdk/dist/${name}`, import.meta.url), new URL(name, destination));
15
+ }
16
+
17
+ const workerCore = new URL("../bin/worker-core/", import.meta.url);
18
+ await mkdir(workerCore, { recursive: true });
19
+ for (const name of ["adapters.mjs", "errors.mjs"])
20
+ await copyFile(new URL(`../../agent-worker/${name}`, import.meta.url), new URL(name, workerCore));