getagenthook 0.2.0 → 0.2.1

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/dist/cli.js CHANGED
@@ -12,6 +12,7 @@ const run_1 = require("./commands/run");
12
12
  const tools_1 = require("./commands/tools");
13
13
  const exit_1 = require("./exit");
14
14
  const http_1 = require("./http");
15
+ const version_1 = require("./version");
15
16
  const USAGE = `agenthook — hosted media generation for agents
16
17
 
17
18
  Usage: agenthook <command> [flags]
@@ -27,6 +28,7 @@ Commands:
27
28
  balance credit balance
28
29
  history credit ledger
29
30
  jobs local run ledger (~/.agenthook/jobs.jsonl)
31
+ version print the CLI version (also --version / -v)
30
32
 
31
33
  Run flags:
32
34
  --prompt <text> --ref <url> (repeatable) --owns-references --model <m>
@@ -64,6 +66,13 @@ async function runCli(argv) {
64
66
  return await (0, history_1.history)(rest);
65
67
  case "jobs":
66
68
  return await (0, jobs_1.jobs)(rest);
69
+ case "version":
70
+ case "--version":
71
+ case "-v":
72
+ // Agents probe this to detect a stale install — must exit 0 with the
73
+ // package version, never fall through to "Unknown command" (exit 1).
74
+ console.log(version_1.VERSION);
75
+ return 0;
67
76
  case undefined:
68
77
  case "help":
69
78
  case "--help":
@@ -124,7 +124,7 @@ async function run(argv) {
124
124
  if (e instanceof http_1.ApiError) {
125
125
  const code = (0, exit_1.exitCodeForApiError)(e);
126
126
  if (asJson)
127
- emitError(true, e.message, code, e.status === 402 ? topUpUrl(apiUrl) : undefined);
127
+ emitError(true, e.message, code, e.status === 402 ? topUpUrl(apiUrl) : undefined, e.details);
128
128
  else
129
129
  console.error((0, http_1.describeApiError)(e));
130
130
  return code;
@@ -148,7 +148,7 @@ async function run(argv) {
148
148
  if (e instanceof http_1.ApiError) {
149
149
  const code = (0, exit_1.exitCodeForApiError)(e);
150
150
  if (asJson)
151
- emitError(true, e.message, code, e.status === 402 ? topUpUrl(apiUrl) : undefined);
151
+ emitError(true, e.message, code, e.status === 402 ? topUpUrl(apiUrl) : undefined, e.details);
152
152
  else
153
153
  console.error((0, http_1.describeApiError)(e));
154
154
  return code;
@@ -236,10 +236,17 @@ const topUpUrl = (apiUrl) => `${apiUrl}/credits`;
236
236
  function emit(obj) {
237
237
  console.log(JSON.stringify(obj));
238
238
  }
239
- /** Human message to stderr, or a JSON error object to stdout under --json. */
240
- function emitError(asJson, message, code, top_up_url) {
239
+ /** Human message to stderr, or a JSON error object to stdout under --json.
240
+ * A server 400 carries a `details: [{path,message}]` array naming the offending
241
+ * params — surfaced in the JSON so an agent needn't re-run without --json. */
242
+ function emitError(asJson, message, code, top_up_url, details) {
241
243
  if (asJson)
242
- console.log(JSON.stringify({ error: message, exit_code: code, ...(top_up_url ? { top_up_url } : {}) }));
244
+ console.log(JSON.stringify({
245
+ error: message,
246
+ exit_code: code,
247
+ ...(details && details.length ? { details } : {}),
248
+ ...(top_up_url ? { top_up_url } : {}),
249
+ }));
243
250
  else
244
251
  console.error(message);
245
252
  }
@@ -14,7 +14,12 @@ exports.TOOLS_SNAPSHOT = [
14
14
  },
15
15
  model: { type: "string", enum: ["seedance-2", "kling-3"], default: "seedance-2" },
16
16
  quality: { type: "string", enum: ["standard", "pro"], default: "standard" },
17
- duration: { type: "number", default: 5, min: 1 },
17
+ duration: {
18
+ type: "number",
19
+ default: 5,
20
+ min: 1,
21
+ description: "Video length in seconds. Allowed values depend on model — seedance-2: 4, 5, 6, 8, 10, 12, 15; kling-3: 3, 5, 8, 10, 15.",
22
+ },
18
23
  aspect_ratio: {
19
24
  type: "string",
20
25
  enum: ["16:9", "9:16", "1:1", "4:3", "3:4", "21:9"],
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VERSION = void 0;
4
+ // Package version, read from package.json at runtime. dist/*.js sits one level
5
+ // under the package root (rootDir src → outDir dist), so ../package.json
6
+ // resolves both from the installed npm package and from the repo's built dist.
7
+ // require() (CommonJS build) reads it synchronously with no bundler step.
8
+ exports.VERSION = require("../package.json").version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "getagenthook",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "CLI for the AgentHook hosted media-generation API — generate video, images, and captions from your terminal or agent.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://getagenthook.com",