vessels 0.10.0 → 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 +79 -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);
@@ -5062,6 +5135,10 @@ Commands:
5062
5135
  vessels push --vessel <id> --message <text> --key <api_key>
5063
5136
  (--key can be omitted if VESSELS_API_KEY is set)
5064
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
+
5065
5142
  vessels message --vessel <id> --message <text>
5066
5143
  Send a message as the logged-in user and print webhook delivery logs.
5067
5144
  Accepts vessel UUID or external_id (e.g. booking-123).
@@ -5152,6 +5229,7 @@ Run: vessels help`);
5152
5229
  if (cmd === "conversation" || cmd === "trace") return cmdConversation([sub, ...rest].filter(Boolean));
5153
5230
  if (cmd === "feedback") return cmdFeedback([sub, ...rest].filter(Boolean));
5154
5231
  if (cmd === "push") return cmdPush([sub, ...rest].filter(Boolean));
5232
+ if (cmd === "event") return cmdEvent([sub, ...rest].filter(Boolean));
5155
5233
  if (cmd === "message") return cmdMessage([sub, ...rest].filter(Boolean));
5156
5234
  if (cmd === "validate") return cmdValidate([sub, ...rest].filter(Boolean));
5157
5235
  console.error(`Unknown command: ${cmd}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vessels",
3
- "version": "0.10.0",
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": {