vessels 0.9.1 → 0.11.0

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.
Files changed (2) hide show
  1. package/dist/index.js +120 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -4056,7 +4056,7 @@ var coerce = {
4056
4056
  var NEVER = INVALID;
4057
4057
 
4058
4058
  // ../types/src/index.ts
4059
- var SourceSchema = external_exports.enum(["agent", "user", "system"]);
4059
+ var SourceSchema = external_exports.enum(["agent", "user", "system", "event"]);
4060
4060
  var InteractionTypeSchema = external_exports.enum([
4061
4061
  "approval",
4062
4062
  "choice",
@@ -4233,6 +4233,48 @@ var PushManyPayloadSchema = external_exports.object({
4233
4233
  /** @deprecated use `kind`. */
4234
4234
  display: DisplaySchema.optional()
4235
4235
  });
4236
+ var EventToneSchema = external_exports.enum(["info", "alert", "success"]);
4237
+ var ButtonSchema = external_exports.object({
4238
+ label: external_exports.string().min(1).max(100),
4239
+ url: external_exports.string().url().max(2048),
4240
+ tone: external_exports.enum(["default", "primary"]).optional()
4241
+ });
4242
+ var EventSectionSchema = external_exports.object({
4243
+ heading: external_exports.string().min(1).max(200),
4244
+ body: external_exports.string().min(1).max(1e4),
4245
+ collapsed: external_exports.boolean().optional()
4246
+ });
4247
+ var EventPayloadSchema = external_exports.object({
4248
+ /** The banner heading. */
4249
+ title: external_exports.string().min(1).max(200),
4250
+ /** Block-markdown body (tables, lists, headings, blockquotes, rules). */
4251
+ body: external_exports.string().min(1).max(1e4).optional(),
4252
+ /** Accent tone. Defaults to `info`. */
4253
+ tone: EventToneSchema.optional(),
4254
+ /** Which vessel — your own external id (created on first write, like push). */
4255
+ vessel: external_exports.string().optional(),
4256
+ /** Set the vessel title (only on explicit send, like push). */
4257
+ vesselTitle: external_exports.string().optional(),
4258
+ /** Glance-facts card (same shape as surfaces — supports per-field url/tone). */
4259
+ card: CardSchema.optional(),
4260
+ /** Deep-link buttons. */
4261
+ buttons: external_exports.array(ButtonSchema).max(6).optional(),
4262
+ /** Collapsible detail sections. */
4263
+ sections: external_exports.array(EventSectionSchema).max(20).optional(),
4264
+ labels: external_exports.array(external_exports.string().min(1).max(50)).max(10).optional(),
4265
+ attachments: external_exports.array(AttachmentSchema).max(10).optional(),
4266
+ metadata: external_exports.record(external_exports.unknown()).refine(
4267
+ (v) => JSON.stringify(v).length < 16e3,
4268
+ "metadata exceeds 16KB limit"
4269
+ ).optional()
4270
+ }).refine((d) => d.body || d.card || d.buttons && d.buttons.length || d.sections && d.sections.length, {
4271
+ message: "An event needs at least one of: body, card, buttons, or sections"
4272
+ });
4273
+ var EventDataSchema = external_exports.object({
4274
+ tone: EventToneSchema,
4275
+ buttons: external_exports.array(ButtonSchema).optional(),
4276
+ sections: external_exports.array(EventSectionSchema).optional()
4277
+ });
4236
4278
  var MessagePatchSchema = external_exports.object({
4237
4279
  content: external_exports.string().min(1).max(1e4).optional(),
4238
4280
  card: CardSchema.nullable().optional(),
@@ -4686,6 +4728,37 @@ async function cmdPush(args) {
4686
4728
  }
4687
4729
  console.log(`Message sent. vessel_id=${data.vessel_id} message_id=${data.message_id}`);
4688
4730
  }
4731
+ var EVENT_TONES = ["info", "alert", "success"];
4732
+ async function cmdEvent(args) {
4733
+ const flags = parseFlags(args);
4734
+ const apiKey = flags.key ?? process.env.VESSELS_API_KEY;
4735
+ if (!apiKey) {
4736
+ console.error("Provide an API key via --key or VESSELS_API_KEY env var");
4737
+ process.exit(1);
4738
+ }
4739
+ if (!flags.title) {
4740
+ console.error("Usage: vessels event --vessel <id> --title <text> [--body <markdown>] [--tone info|alert|success] --key <api_key>");
4741
+ process.exit(1);
4742
+ }
4743
+ if (flags.tone && !EVENT_TONES.includes(flags.tone)) {
4744
+ console.error(`--tone must be one of: ${EVENT_TONES.join(", ")}`);
4745
+ process.exit(1);
4746
+ }
4747
+ const payload = { title: flags.title, vessel: flags.vessel || void 0 };
4748
+ if (flags.body) payload.body = flags.body;
4749
+ if (flags.tone) payload.tone = flags.tone;
4750
+ const res = await fetch(`${BASE_URL}/api/v1/event`, {
4751
+ method: "POST",
4752
+ headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}` },
4753
+ body: JSON.stringify(payload)
4754
+ });
4755
+ const data = await res.json();
4756
+ if (!res.ok) {
4757
+ console.error("Event failed:", data.error);
4758
+ process.exit(1);
4759
+ }
4760
+ console.log(`Event sent. vessel_id=${data.vessel_id} message_id=${data.message_id}`);
4761
+ }
4689
4762
  var FEEDBACK_TYPES = ["bug", "feature", "other"];
4690
4763
  async function cmdFeedback(args) {
4691
4764
  const flags = parseFlags(args);
@@ -4972,6 +5045,39 @@ Install the SDK:
4972
5045
  }
4973
5046
  console.log(`Full reference: https://vessels.app/llms-full.txt`);
4974
5047
  }
5048
+ async function cmdConversation(args) {
5049
+ const flags = parseFlags(args);
5050
+ const vessel = flags.vessel ?? args.find((a) => !a.startsWith("--"));
5051
+ if (!vessel) {
5052
+ console.error("Usage: vessels conversation <vessel> [--out <file.json>] [--limit <n>]");
5053
+ process.exit(1);
5054
+ }
5055
+ const vesselId = await resolveVesselId(vessel);
5056
+ const qs = flags.limit ? `?limit=${encodeURIComponent(flags.limit)}` : "";
5057
+ const data = await api(`/api/v1/vessels/${vesselId}/trace${qs}`);
5058
+ const trace = data.trace;
5059
+ const outPath = resolve(flags.out ?? `vessels-trace-${vessel.replace(/[^a-zA-Z0-9_-]/g, "_")}.json`);
5060
+ writeFileSync(outPath, JSON.stringify(trace, null, 2));
5061
+ const s = trace.summary;
5062
+ console.log(`
5063
+ Wrote ${s.events} events \u2192 ${outPath}`);
5064
+ console.log(` ${s.requests} agent calls \xB7 ${s.degraded} degraded \xB7 ${s.rejected} rejected \xB7 ${s.webhookFailures} webhook failures`);
5065
+ if (!trace.verbose) {
5066
+ console.log(` note: workspace not in debug mode \u2014 request bodies weren't captured, so agent calls are absent.`);
5067
+ }
5068
+ if (s.issues.length) {
5069
+ console.log(`
5070
+ ${s.issues.length} issue(s) \u2014 read these first:
5071
+ `);
5072
+ for (const i of s.issues) {
5073
+ const where = i.endpoint ? ` ${i.endpoint}` : "";
5074
+ console.log(` [#${i.seq} ${i.severity}] ${i.code}${i.field ? ` (${i.field})` : ""}${where}`);
5075
+ console.log(` ${i.message}`);
5076
+ if (i.hint) console.log(` \u2192 ${i.hint}`);
5077
+ }
5078
+ }
5079
+ console.log("");
5080
+ }
4975
5081
  var [, , cmd, sub, ...rest] = process.argv;
4976
5082
  var HELP = `
4977
5083
  vessels \u2014 CLI for Vessels (vessels.app)
@@ -5029,10 +5135,21 @@ Commands:
5029
5135
  vessels push --vessel <id> --message <text> --key <api_key>
5030
5136
  (--key can be omitted if VESSELS_API_KEY is set)
5031
5137
 
5138
+ vessels event --vessel <id> --title <text> [--body <markdown>] [--tone info|alert|success] --key <api_key>
5139
+ Paint a human-facing event banner (a fact from your backend \u2014 booking, alert).
5140
+ Fires a notification, no webhook. Renders as a full-width tinted artifact.
5141
+
5032
5142
  vessels message --vessel <id> --message <text>
5033
5143
  Send a message as the logged-in user and print webhook delivery logs.
5034
5144
  Accepts vessel UUID or external_id (e.g. booking-123).
5035
5145
 
5146
+ vessels conversation <vessel> [--out <file.json>] [--limit <n>]
5147
+ Replay a vessel to a JSON trace file for debugging an agent run: a single
5148
+ timeline of your agent's calls (with the sent-vs-applied diff \u2014 which fields
5149
+ actually landed), the messages that rendered, agent-activity step timing,
5150
+ human responses and webhook deliveries. Prints a summary + issues; the full
5151
+ trace goes to the file. Accepts vessel UUID or external_id.
5152
+
5036
5153
  vessels validate <file.json>
5037
5154
  Check a push payload against the required syntax WITHOUT sending it.
5038
5155
  Also reads piped JSON (cat payload.json | vessels validate) or an inline
@@ -5109,8 +5226,10 @@ Run: vessels help`);
5109
5226
  Run: vessels help`);
5110
5227
  process.exit(1);
5111
5228
  }
5229
+ if (cmd === "conversation" || cmd === "trace") return cmdConversation([sub, ...rest].filter(Boolean));
5112
5230
  if (cmd === "feedback") return cmdFeedback([sub, ...rest].filter(Boolean));
5113
5231
  if (cmd === "push") return cmdPush([sub, ...rest].filter(Boolean));
5232
+ if (cmd === "event") return cmdEvent([sub, ...rest].filter(Boolean));
5114
5233
  if (cmd === "message") return cmdMessage([sub, ...rest].filter(Boolean));
5115
5234
  if (cmd === "validate") return cmdValidate([sub, ...rest].filter(Boolean));
5116
5235
  console.error(`Unknown command: ${cmd}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vessels",
3
- "version": "0.9.1",
3
+ "version": "0.11.0",
4
4
  "description": "Vessels CLI — manage your agent communication layer from the terminal",
5
5
  "type": "module",
6
6
  "bin": {