a2a-exposed 0.8.31 → 0.8.32

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/lib/hosted.mjs CHANGED
@@ -136,6 +136,14 @@ function previewUrl(value) {
136
136
  catch { return ""; }
137
137
  }
138
138
 
139
+ export async function status(o = {}) {
140
+ if (!/^[a-z0-9][a-z0-9-]{2,30}[a-z0-9]$/.test(o.agent || "")) fail("agent", "Pass --agent NAME selected from hosted list --json.");
141
+ const preview = await wake("preview", o);
142
+ return { ...preview, code: "status", agent: o.agent, next: preview.configured
143
+ ? "Wake settings are configured. Run wake test --agent NAME with explicit draft inputs to check delivery."
144
+ : "No webhook is configured. Select a preset from hosted capabilities --json, then prepare a wake draft, or use polling." };
145
+ }
146
+
139
147
  export async function wake(sub, o = {}) {
140
148
  if (!["preview", "test", "set", "prepare", "remove", "unset"].includes(sub)) fail("usage", "Use wake preview|test|set|prepare|remove. List presets with hosted capabilities --json.");
141
149
  if (sub === "remove" || sub === "unset") fail("unsupported", "This hosted API does not support wake removal yet. Remove it in the agent's Wake settings; saved settings were not changed.");
@@ -144,14 +152,22 @@ export async function wake(sub, o = {}) {
144
152
  try { fs.lstatSync(o["reference-file"]); fail("reference_file", "Choose a new --reference-file path; existing files are never replaced."); }
145
153
  catch (error) { if (error.result) throw error; if (error.code !== "ENOENT") fail("reference_file", "Cannot inspect --reference-file; check its path and permissions."); }
146
154
  }
155
+ let reference;
156
+ if (sub === "set" && (o["reference-file"] || o["reference-env"])) {
157
+ if (o.url || o.preset || o["key-file"] || o["key-env"] || o["key-stdin"] || o["hmac-secret-file"] || o["hmac-secret-env"]) fail("reference_inputs", "Use a reference without draft overrides; it saves exactly the uploaded settings.");
158
+ const next = "Run wake prepare --agent NAME with the draft inputs and a new --reference-file FILE, then use that protected reference with wake set. Existing files are never replaced.";
159
+ try { reference = secret(o, "reference", ""); }
160
+ catch (error) {
161
+ if (error.result?.code === "secret_input") fail("invalid_reference", next);
162
+ throw error;
163
+ }
164
+ if (!/^a2awr_[a-f0-9]{64}$/.test(reference)) fail("invalid_reference", next);
165
+ }
147
166
  const { origin, token, name } = wakeCredential(o, sub !== "prepare" && !o["reference-file"] && !o["reference-env"]), path = `/api/v1/agents/${encodeURIComponent(name)}/wake`;
148
167
  const current = await request(origin, path, { token });
149
168
  if (!Number.isSafeInteger(current.version)) fail("invalid_response", "The service did not return a valid wake version. Saved settings were not changed.");
150
169
  if (sub === "preview") return { ok: true, code: "preview", next: "Test an explicit draft before saving.", version: current.version, preset: current.preset, configured: Boolean(current.url), key_header: ["hermes", "openbot"].includes(current.preset) ? "" : ["grok-bot", "claude-code", "openclaw-wake", "openclaw-agent"].includes(current.preset) ? "Authorization" : current.keyHeader || "Authorization", url: previewUrl(current.url) };
151
- if (sub === "set" && (o["reference-file"] || o["reference-env"])) {
152
- if (o.url || o.preset || o["key-file"] || o["key-env"] || o["key-stdin"] || o["hmac-secret-file"] || o["hmac-secret-env"]) fail("reference_inputs", "Use a reference without draft overrides; it saves exactly the uploaded settings.");
153
- const reference = secret(o, "reference", "");
154
- if (!/^a2awr_[a-f0-9]{64}$/.test(reference)) fail("invalid_reference", "Read a valid reference from a protected --reference-file or --reference-env.");
170
+ if (reference) {
155
171
  const result = await request(origin, path, { token, method: "PUT", body: { version: current.version, secretReference: reference } });
156
172
  return { ok: result.ok === true && result.saved === true, code: result.saved === true ? "saved" : "failed", saved: result.saved === true, next: result.saved === true ? "Check the receiver for the test wake." : "The reference is spent. Check saved settings before preparing another draft." };
157
173
  }
package/lib/main.mjs CHANGED
@@ -178,6 +178,9 @@ Remove
178
178
  --dir and --worker-dir are the Worker project directory (default <config dir>/worker)
179
179
 
180
180
  Status
181
+ status --agent NAME [--control-url URL] [--json]
182
+ read selected hosted agent wake configuration; select NAME with hosted list --json.
183
+ Uses setup approval or that agent's matching owner credential; no delivery test.
181
184
  Hosted-only configs report deployment: hosted and hosted recovery guidance.
182
185
  status [--json] deployment, Worker version, base URL, agent card check (fetched by the CLI), wake
183
186
  mode (webhook / tunnel / none = polling), tunnel state, proxy mode (--upstream):
@@ -385,7 +388,7 @@ const SPEC = {
385
388
  peer: { to: S, all: B, reissue: B, hours: S, off: B, json: B },
386
389
  send: { to: S, text: S, context: S, task: S, push: B, proto: S },
387
390
  poll: { to: S, proto: S },
388
- status: { json: B },
391
+ status: { json: B, agent: S, "control-url": S },
389
392
  export: { sql: B },
390
393
  upstream: { json: B },
391
394
  connect: { alias: S, name: S, json: B, "no-wait": B, replace: B, force: B, "card-url": S },
@@ -462,7 +465,7 @@ export async function main(argv) {
462
465
  if (p.length) throw new CliError(`uninstall takes no arguments (${p.join(" ")}). Run \`${CLI} uninstall --help\`.`);
463
466
  return un.uninstall(o);
464
467
  case "deploy": return dep.deploy(o);
465
- case "status": return st.status(o);
468
+ case "status": return o.agent !== undefined || o["control-url"] !== undefined ? hosted.output(() => hosted.status(o), o) : st.status(o);
466
469
  case "upstream": {
467
470
  const sub = need(p[0], "upstream verify [--json]");
468
471
  if (sub === "verify" || sub === "check") return st.upstreamVerify(o);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "a2a-exposed",
3
- "version": "0.8.31",
3
+ "version": "0.8.32",
4
4
  "description": "Give any AI agent a public A2A (Agent2Agent) endpoint: a Cloudflare Worker, a wake webhook, or scheduled checks",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,2 +1,2 @@
1
1
  /** Inbox build. Keep this equal to `version` in cli/package.json. */
2
- export const VERSION = "0.8.31";
2
+ export const VERSION = "0.8.32";