@usenaive-sdk/vetta-cli 0.5.0 → 0.6.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 +2006 -350
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -5358,10 +5358,10 @@ var require_cst_scalar = __commonJS({
5358
5358
  case "|":
5359
5359
  case ">": {
5360
5360
  const he = source.indexOf("\n");
5361
- const head = source.substring(0, he);
5361
+ const head4 = source.substring(0, he);
5362
5362
  const body2 = source.substring(he + 1) + "\n";
5363
5363
  const props = [
5364
- { type: "block-scalar-header", offset, indent, source: head }
5364
+ { type: "block-scalar-header", offset, indent, source: head4 }
5365
5365
  ];
5366
5366
  if (!addEndtoBlockProps(props, end))
5367
5367
  props.push({ type: "newline", offset: -1, indent, source: "\n" });
@@ -5421,19 +5421,19 @@ var require_cst_scalar = __commonJS({
5421
5421
  }
5422
5422
  function setBlockScalarValue(token, source) {
5423
5423
  const he = source.indexOf("\n");
5424
- const head = source.substring(0, he);
5424
+ const head4 = source.substring(0, he);
5425
5425
  const body2 = source.substring(he + 1) + "\n";
5426
5426
  if (token.type === "block-scalar") {
5427
5427
  const header = token.props[0];
5428
5428
  if (header.type !== "block-scalar-header")
5429
5429
  throw new Error("Invalid block scalar header");
5430
- header.source = head;
5430
+ header.source = head4;
5431
5431
  token.source = body2;
5432
5432
  } else {
5433
5433
  const { offset } = token;
5434
5434
  const indent = "indent" in token ? token.indent : -1;
5435
5435
  const props = [
5436
- { type: "block-scalar-header", offset, indent, source: head }
5436
+ { type: "block-scalar-header", offset, indent, source: head4 }
5437
5437
  ];
5438
5438
  if (!addEndtoBlockProps(props, "end" in token ? token.end : void 0))
5439
5439
  props.push({ type: "newline", offset: -1, indent, source: "\n" });
@@ -7485,19 +7485,19 @@ var SWITCHES = /* @__PURE__ */ new Set([
7485
7485
  ]);
7486
7486
  var SHORT = { f: "file" };
7487
7487
  function parseLine(argv) {
7488
- const { head, rest } = splitAtRest(argv);
7488
+ const { head: head4, rest } = splitAtRest(argv);
7489
7489
  const flags = {};
7490
- const words = [];
7491
- for (let index = 0; index < head.length; index += 1) {
7492
- const token = head[index] ?? "";
7490
+ const words4 = [];
7491
+ for (let index = 0; index < head4.length; index += 1) {
7492
+ const token = head4[index] ?? "";
7493
7493
  const short = token.startsWith("-") && !token.startsWith("--") ? SHORT[token.slice(1)] : void 0;
7494
7494
  if (!token.startsWith("--") && short === void 0) {
7495
- words.push(token);
7495
+ words4.push(token);
7496
7496
  continue;
7497
7497
  }
7498
7498
  const equals = short === void 0 ? token.indexOf("=") : -1;
7499
7499
  const name = short ?? (equals === -1 ? token.slice(2) : token.slice(2, equals));
7500
- const next = head[index + 1];
7500
+ const next = head4[index + 1];
7501
7501
  const values = flags[name] ??= [];
7502
7502
  if (equals !== -1) values.push(token.slice(equals + 1));
7503
7503
  else if (!SWITCHES.has(name) && next !== void 0 && !next.startsWith("--")) {
@@ -7505,7 +7505,7 @@ function parseLine(argv) {
7505
7505
  index += 1;
7506
7506
  } else values.push(true);
7507
7507
  }
7508
- return { words, args: (from) => new Args(words.slice(from), flags, rest) };
7508
+ return { words: words4, args: (from) => new Args(words4.slice(from), flags, rest) };
7509
7509
  }
7510
7510
 
7511
7511
  // src/config.ts
@@ -7556,9 +7556,9 @@ var ALPHABET = "0123456789abcdefghjkmnpqrstvwxyz";
7556
7556
  var SUFFIX_LENGTH = 26;
7557
7557
  var SUFFIX_PATTERN = new RegExp(`^[${ALPHABET}]{${SUFFIX_LENGTH},}$`);
7558
7558
  function isId(prefix, value) {
7559
- const head = `${prefix}_`;
7560
- if (!value.startsWith(head)) return false;
7561
- return SUFFIX_PATTERN.test(value.slice(head.length).toLowerCase());
7559
+ const head4 = `${prefix}_`;
7560
+ if (!value.startsWith(head4)) return false;
7561
+ return SUFFIX_PATTERN.test(value.slice(head4.length).toLowerCase());
7562
7562
  }
7563
7563
 
7564
7564
  // ../../packages/core/src/errors.ts
@@ -7568,6 +7568,8 @@ var CODES = {
7568
7568
  unauthorized: ["authentication", 401],
7569
7569
  forbidden: ["permission", 403],
7570
7570
  not_found: ["not_found", 404],
7571
+ /** The path exists; the method does not. The response carries `Allow` (§3). */
7572
+ method_not_allowed: ["invalid_request", 405],
7571
7573
  budget_exceeded: ["quota", 402],
7572
7574
  insufficient_credits: ["quota", 402],
7573
7575
  /**
@@ -7713,6 +7715,8 @@ var AUDIT_ACTIONS_P1 = [
7713
7715
  "computer.resumed",
7714
7716
  "computer.snapshot_created",
7715
7717
  "computer.updated",
7718
+ "computer.taken_over",
7719
+ "computer.handed_back",
7716
7720
  "browser.live_view_opened",
7717
7721
  "deployment.created",
7718
7722
  "deployment.updated",
@@ -18891,10 +18895,10 @@ function _slugify() {
18891
18895
  return /* @__PURE__ */ _overwrite((input) => slugify(input));
18892
18896
  }
18893
18897
  // @__NO_SIDE_EFFECTS__
18894
- function _array(Class2, element, params) {
18898
+ function _array(Class2, element4, params) {
18895
18899
  return new Class2({
18896
18900
  type: "array",
18897
- element,
18901
+ element: element4,
18898
18902
  // get element() {
18899
18903
  // return element;
18900
18904
  // },
@@ -20541,14 +20545,14 @@ function _installLazyMethods(inst, group, methods) {
20541
20545
  configurable: true,
20542
20546
  enumerable: false,
20543
20547
  get() {
20544
- const bound = fn.bind(this);
20548
+ const bound4 = fn.bind(this);
20545
20549
  Object.defineProperty(this, key2, {
20546
20550
  configurable: true,
20547
20551
  writable: true,
20548
20552
  enumerable: true,
20549
- value: bound
20553
+ value: bound4
20550
20554
  });
20551
- return bound;
20555
+ return bound4;
20552
20556
  },
20553
20557
  set(v) {
20554
20558
  Object.defineProperty(this, key2, {
@@ -21176,8 +21180,8 @@ var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
21176
21180
  }
21177
21181
  });
21178
21182
  });
21179
- function array(element, params) {
21180
- return _array(ZodArray, element, params);
21183
+ function array(element4, params) {
21184
+ return _array(ZodArray, element4, params);
21181
21185
  }
21182
21186
  function keyof(schema) {
21183
21187
  const shape = schema._zod.def.shape;
@@ -22214,8 +22218,8 @@ function convertBaseSchema(schema, ctx) {
22214
22218
  zodSchema = zodSchema.check(z.maxLength(schema.maxItems));
22215
22219
  }
22216
22220
  } else if (items !== void 0) {
22217
- const element = convertSchema(items, ctx);
22218
- let arraySchema = z.array(element);
22221
+ const element4 = convertSchema(items, ctx);
22222
+ let arraySchema = z.array(element4);
22219
22223
  if (typeof schema.minItems === "number") {
22220
22224
  arraySchema = arraySchema.min(schema.minItems);
22221
22225
  }
@@ -22361,7 +22365,7 @@ var JsonSchemaDocument = external_exports.record(external_exports.string(), exte
22361
22365
  var WindowSchema = external_exports.enum(["immediate", "priority", "loose"]);
22362
22366
  var TOKEN_TIERS = ["input", "cache_write", "cache_read", "output", "reasoning"];
22363
22367
  var TokenTierSchema = external_exports.enum(TOKEN_TIERS);
22364
- var TOOL_TIERS = ["search", "media", "social", "browser", "storage"];
22368
+ var TOOL_TIERS = ["search", "media", "social", "browser", "storage", "email"];
22365
22369
  var LINE_ITEM_TIERS = [...TOKEN_TIERS, "computer", ...TOOL_TIERS];
22366
22370
  var LineItemTierSchema = external_exports.enum(LINE_ITEM_TIERS);
22367
22371
  var TokenUsageSchema = external_exports.object({
@@ -22388,11 +22392,41 @@ function parseHarness(value) {
22388
22392
  }
22389
22393
 
22390
22394
  // ../../packages/core/src/schema/org.ts
22395
+ var DEFAULT_ORG_TIMEZONE = "America/New_York";
22396
+ function canonicalZone(name) {
22397
+ if (!name.includes("/") && name !== "UTC") return void 0;
22398
+ try {
22399
+ const zone = new Intl.DateTimeFormat("en-US", { timeZone: name }).resolvedOptions().timeZone;
22400
+ return zone === "UTC" || Intl.supportedValuesOf("timeZone").includes(zone) ? zone : void 0;
22401
+ } catch {
22402
+ return void 0;
22403
+ }
22404
+ }
22405
+ var TimezoneSchema = external_exports.string().transform((name, ctx) => {
22406
+ const zone = canonicalZone(name);
22407
+ if (zone === void 0) {
22408
+ ctx.addIssue({ code: "custom", message: "not a timezone; use an IANA name such as America/Los_Angeles" });
22409
+ return external_exports.NEVER;
22410
+ }
22411
+ return zone;
22412
+ });
22391
22413
  var OrganizationSchema = external_exports.object({
22392
22414
  id: idOf("org"),
22393
22415
  object: external_exports.literal("organization"),
22394
22416
  name: external_exports.string(),
22395
22417
  balance_micro_usd: MicroUsdField,
22418
+ /**
22419
+ * The company's timezone, an IANA name (`America/New_York`, §20.6). Times the company chooses or
22420
+ * reads are in it: a new routine's zone, when a post goes out. `America/New_York` until changed.
22421
+ * Defaulted so a reply from a control plane older than 0088 (or a rolled-back Worker) still parses
22422
+ * in a newer SDK/CLI rather than throwing on every `orgs.get/list/update`.
22423
+ */
22424
+ timezone: external_exports.string().min(1).default(DEFAULT_ORG_TIMEZONE),
22425
+ /**
22426
+ * The company's logo, an SVG a person or an agent drew (§20.7), passed by `checkLogoSvg`. `null`
22427
+ * until one is set. Defaulted so a reply from a control plane older than 0093 still parses.
22428
+ */
22429
+ logo_svg: external_exports.string().nullable().default(null),
22396
22430
  created_at: Timestamp
22397
22431
  });
22398
22432
  var RoleSchema = external_exports.enum(["owner", "admin", "member"]);
@@ -22725,7 +22759,14 @@ var BUILTIN_TOOLS = [
22725
22759
  // `publish_file`, and the first way anything the platform itself produced could be read back.
22726
22760
  "fetch_file",
22727
22761
  "find_stock_photo",
22728
- "session_spend"
22762
+ "session_spend",
22763
+ // A view the chat draws — spend, post views, the roadmap, the week ahead — read by code (§48).
22764
+ "show",
22765
+ // A card the model lays out, every number bound to a source code reads (§49).
22766
+ "compose",
22767
+ // Plan mode's two (§7.5): offered only to a session in plan mode or holding a plan.
22768
+ "write_plan",
22769
+ "propose_plan"
22729
22770
  ];
22730
22771
  var isToolName = (name) => BUILTIN_TOOLS.includes(name) || /^[a-z0-9_-]+(\.[a-z0-9_-]+)+$/i.test(name);
22731
22772
  var ToolConfigSchema = external_exports.object({
@@ -22826,6 +22867,22 @@ var SessionStatusSchema = external_exports.enum([
22826
22867
  "failed",
22827
22868
  "cancelled"
22828
22869
  ]);
22870
+ var SessionModeSchema = external_exports.enum(["plan", "build"]);
22871
+ var PLAN_MAX_CHARS = 2e4;
22872
+ var PlanSchema = external_exports.object({
22873
+ object: external_exports.literal("plan"),
22874
+ markdown: external_exports.string().max(PLAN_MAX_CHARS),
22875
+ version: external_exports.number().int().nonnegative(),
22876
+ by: external_exports.enum(["agent", "owner"]).nullable()
22877
+ });
22878
+ var PlanWriteSchema = external_exports.object({
22879
+ markdown: external_exports.string().max(PLAN_MAX_CHARS),
22880
+ base_version: external_exports.number().int().nonnegative()
22881
+ });
22882
+ var ProposePlanSchema = external_exports.object({
22883
+ version: external_exports.number().int().positive(),
22884
+ spends_or_publishes: external_exports.array(external_exports.string().min(1).max(200)).max(10).optional()
22885
+ });
22829
22886
  var StopReasonSchema = external_exports.enum([
22830
22887
  "end_turn",
22831
22888
  "awaiting_input",
@@ -22918,16 +22975,26 @@ var QuestionFieldSchema = external_exports.discriminatedUnion("type", [
22918
22975
  other: external_exports.boolean().default(true)
22919
22976
  })
22920
22977
  ]);
22978
+ var QUESTION_FIELDS_MAX = 3;
22921
22979
  var QuestionSchema = external_exports.object({
22922
22980
  prompt: external_exports.string().min(1).max(1e3),
22923
- fields: external_exports.array(QuestionFieldSchema).min(1).max(3)
22981
+ fields: external_exports.array(QuestionFieldSchema).min(1).max(QUESTION_FIELDS_MAX, {
22982
+ message: `a question has at most ${QUESTION_FIELDS_MAX} fields \u2014 ask the rest in a second question once these are answered`
22983
+ })
22924
22984
  });
22925
- var AnswersSchema = external_exports.record(
22985
+ var answersOf = (max, message4) => external_exports.record(
22926
22986
  external_exports.string().min(1).max(64),
22927
22987
  external_exports.union([external_exports.string().max(2e3), external_exports.array(external_exports.string().max(2e3)).min(1).max(12)])
22928
- ).refine((answers) => Object.keys(answers).length <= 3, {
22929
- message: "a question has at most 3 fields, so an answer has at most 3 keys"
22930
- });
22988
+ ).refine((answers) => Object.keys(answers).length <= max, { message: message4 });
22989
+ var AnswersSchema = answersOf(
22990
+ QUESTION_FIELDS_MAX,
22991
+ `a question has at most ${QUESTION_FIELDS_MAX} fields, so an answer has at most ${QUESTION_FIELDS_MAX} keys`
22992
+ );
22993
+ var TEMPLATE_QUESTIONS_MAX = 4;
22994
+ var InstallAnswersSchema = answersOf(
22995
+ TEMPLATE_QUESTIONS_MAX,
22996
+ `a template asks at most ${TEMPLATE_QUESTIONS_MAX} questions, so an install has at most ${TEMPLATE_QUESTIONS_MAX} answers`
22997
+ );
22931
22998
  var PendingActionSchema = external_exports.object({
22932
22999
  kind: external_exports.enum(["tool", "question"]).default("tool"),
22933
23000
  tool_call_id: external_exports.string(),
@@ -22968,6 +23035,13 @@ var SessionSchema = external_exports.object({
22968
23035
  parent_session_id: idOf("ses").nullable(),
22969
23036
  root_session_id: idOf("ses").nullable(),
22970
23037
  thread_role: ThreadRoleSchema.nullable(),
23038
+ /**
23039
+ * The model the latest send picked (§7 `model`), or `null` when none has and the session runs its
23040
+ * pinned version's model (§10, ADR-0832). Defaulted so a reply from an older control plane parses.
23041
+ */
23042
+ model: external_exports.string().nullable().default(null),
23043
+ /** Plan mode (§7.5, §10): defaulted so a reply from an older control plane parses as `build`. */
23044
+ mode: SessionModeSchema.default("build"),
22971
23045
  status: SessionStatusSchema,
22972
23046
  stop_reason: StopReasonSchema.nullable(),
22973
23047
  window: WindowSchema,
@@ -22987,6 +23061,10 @@ var SendMessageSchema = external_exports.object({
22987
23061
  message: external_exports.string(),
22988
23062
  interrupt: external_exports.boolean().optional(),
22989
23063
  queue: external_exports.boolean().optional(),
23064
+ /** A catalogue id: this session runs on it from this message's turn on (§7, ADR-0832). */
23065
+ model: external_exports.string().min(1).optional(),
23066
+ /** Plan mode from this message's turn on (§7.5, ADR-0905). */
23067
+ mode: SessionModeSchema.optional(),
22990
23068
  idempotency_key: external_exports.string().optional()
22991
23069
  }).refine((body2) => !(body2.interrupt === true && body2.queue === true), {
22992
23070
  message: "a send is either an interrupt or queued, not both",
@@ -23001,7 +23079,14 @@ var ToolConfirmationSchema = external_exports.object({
23001
23079
  tool_call_id: external_exports.string(),
23002
23080
  decision: external_exports.enum(["allow", "deny"]),
23003
23081
  reason: external_exports.string().optional(),
23004
- scope: external_exports.enum(["call", "session"]).default("call")
23082
+ scope: external_exports.enum(["call", "session"]).default("call"),
23083
+ /**
23084
+ * THE PERSON'S OWN ANSWERS for a template install they approve (ADR-1030): the call runs with
23085
+ * these in place of the `answers` the agent proposed, and with nothing else changed. A modifier on
23086
+ * `allow`, like `scope`: absent is the call as proposed. The route refuses it on a deny, on a session
23087
+ * grant, on any other tool, and on answers the template's questions refuse (`answerProblems`).
23088
+ */
23089
+ answers: InstallAnswersSchema.optional()
23005
23090
  });
23006
23091
  var SessionAnswerSchema = external_exports.object({
23007
23092
  tool_call_id: external_exports.string(),
@@ -23011,6 +23096,11 @@ var SessionAnswerSchema = external_exports.object({
23011
23096
  // ../../packages/core/src/schema/event.ts
23012
23097
  var EventTypeSchema = external_exports.enum([
23013
23098
  "message.delta",
23099
+ /**
23100
+ * The agent's answer (no `role`), or a user row `{ role: "user", content, client_message_id? }` (§8).
23101
+ * A user row the runtime wrote itself — a media job's result, a tool grant — carries
23102
+ * `from: "platform"` and is the platform's notice, not a caller's words (§8, ADR-0870).
23103
+ */
23014
23104
  "message.completed",
23015
23105
  /** A caller's message, durable in the inbox and not yet admitted to a turn (§7, §8): `{ client_message_id, content }`. */
23016
23106
  "message.accepted",
@@ -23021,19 +23111,26 @@ var EventTypeSchema = external_exports.enum([
23021
23111
  "tool.confirm",
23022
23112
  /** A person's decision on a parked call, stamped with the inbox write that delivers it (§8, ADR-0764). */
23023
23113
  "tool.confirm.resolved",
23114
+ /** A person's answer to a parked question, stamped the same way (§7.1, §8, ADR-1049). */
23115
+ "tool.confirm.answered",
23024
23116
  "session.running",
23025
23117
  "session.usage",
23026
23118
  "session.idle",
23027
23119
  /** A failed attempt the loop will retry (§8): `{ attempt, in_ms, code }`. */
23028
23120
  "session.retrying",
23121
+ /** The session's mode changed (§7.5): `{ mode: "plan" | "build" }`. */
23122
+ "session.mode",
23123
+ /** A write to the session's plan, by the agent or its owner (§7.5): the plan object. */
23124
+ "plan.updated",
23029
23125
  /**
23030
23126
  * The turn ran, but without something it needed (§8): `{ reason, detail? }`.
23031
23127
  *
23032
23128
  * Emitted for a turn whose sandbox could not be woken. That turn used to be indistinguishable
23033
23129
  * from a success — the model was handed the failure as a tool result, answered around it from the
23034
23130
  * transcript, and the session ended `idle`/`end_turn` with no field anywhere saying the
23035
- * filesystem had been unavailable. This is the field. `reason` is open on purpose; today the only
23036
- * value is `"sandbox_unavailable"`.
23131
+ * filesystem had been unavailable. This is the field. `reason` is open on purpose; today it is
23132
+ * `"sandbox_unavailable"`, `"vendor_resume_unavailable"`, or `"app_tools_unavailable"` — an app the
23133
+ * agent's toolset names gave no tools this turn (§29.5, `runtime-do app-mcp-tools.ts`).
23037
23134
  *
23038
23135
  * `detail` is the boot failure's own message, and it is here because `reason` alone reads the
23039
23136
  * same for a vendor outage and for a fault of ours. Staging round 3 spent its whole budget
@@ -23131,6 +23228,11 @@ var ToolConfirmResolvedDataSchema = external_exports.object({
23131
23228
  proposed_args: external_exports.record(external_exports.string(), external_exports.unknown()).nullable(),
23132
23229
  final_args: external_exports.record(external_exports.string(), external_exports.unknown()).nullable()
23133
23230
  });
23231
+ var ToolConfirmAnsweredDataSchema = external_exports.object({
23232
+ tool_call_id: external_exports.string(),
23233
+ answers: AnswersSchema,
23234
+ answered_at: Timestamp
23235
+ });
23134
23236
  var SessionUsageDataSchema = external_exports.object({
23135
23237
  token_usage: TokenUsageSchema,
23136
23238
  consumed_micro_usd: MicroUsdField.nonnegative(),
@@ -23229,7 +23331,10 @@ var FileSourceTypeSchema = external_exports.enum(FILE_SOURCE_TYPES);
23229
23331
  var FileSourceSchema = external_exports.object({
23230
23332
  type: FileSourceTypeSchema,
23231
23333
  job_id: external_exports.union([idOf("med"), idOf("clj")]).nullable(),
23232
- url: external_exports.string().url().nullable()
23334
+ url: external_exports.string().url().nullable(),
23335
+ /** What a generator was asked with (§36.1, ADR-0886); absent on every other writer's row. */
23336
+ model: external_exports.string().nullable().optional(),
23337
+ prompt: external_exports.string().nullable().optional()
23233
23338
  });
23234
23339
  var FileTagsSchema = external_exports.array(external_exports.string().min(1).max(64)).max(32);
23235
23340
  var FileLibraryFieldsSchema = external_exports.object({
@@ -23274,6 +23379,11 @@ var ComputerSchema = external_exports.object({
23274
23379
  browser: BrowserOptionsSchema.nullable(),
23275
23380
  volume: VolumeSchema.nullable(),
23276
23381
  snapshot_id: idOf("snp").nullable(),
23382
+ /**
23383
+ * The agent this computer belongs to (§41.8, ADR-0849); `null` for one made by `POST /v1/computers`.
23384
+ * Defaulted so a reply from an older control plane parses.
23385
+ */
23386
+ agent_id: idOf("agt").nullable().default(null),
23277
23387
  created_at: Timestamp
23278
23388
  });
23279
23389
  var SnapshotSchema = external_exports.object({
@@ -23382,7 +23492,9 @@ var FileSchema = external_exports.object({
23382
23492
  sha256: external_exports.string().regex(/^[0-9a-f]{64}$/),
23383
23493
  created_at: Timestamp,
23384
23494
  // The asset-library fields (`canonical-spec §36.1`), all nullable or defaulted.
23385
- ...FileLibraryFieldsSchema.shape
23495
+ ...FileLibraryFieldsSchema.shape,
23496
+ /** The agent of `session_id`, joined at read (§36.1, ADR-0887); a writer never sets it. */
23497
+ agent_id: idOf("agt").nullable().optional()
23386
23498
  });
23387
23499
  var ScheduleStatusSchema = external_exports.enum(["scheduled", "paused", "unscheduled"]);
23388
23500
  var DeploymentSchema = external_exports.object({
@@ -23503,7 +23615,27 @@ var InboundMessageSchema = external_exports.object({
23503
23615
  auth: external_exports.record(external_exports.string(), external_exports.string()),
23504
23616
  /** The session this message woke. Null until the wake seam lands (see ADR-0120). */
23505
23617
  session_id: idOf("ses").nullable(),
23506
- received_at: Timestamp
23618
+ received_at: Timestamp,
23619
+ /**
23620
+ * When a person marked it read (`POST …/messages/{mid}/read`); `null` is unread. Defaulted so a
23621
+ * reply from an older control plane parses (ADR-1076).
23622
+ */
23623
+ read_at: Timestamp.nullable().default(null)
23624
+ });
23625
+ var OutboundMessageSchema = external_exports.object({
23626
+ id: idOf("out"),
23627
+ object: external_exports.literal("outbound_message"),
23628
+ channel: InboundMessageSchema.shape.channel,
23629
+ identity_id: idOf("idn"),
23630
+ /** The `eml_` endpoint it was sent from. */
23631
+ endpoint_id: external_exports.string(),
23632
+ from: external_exports.string(),
23633
+ to: external_exports.array(external_exports.string()),
23634
+ subject: external_exports.string().nullable(),
23635
+ text: external_exports.string(),
23636
+ sent_by_agent_id: idOf("agt").nullable(),
23637
+ actor: PrincipalSchema.nullable(),
23638
+ sent_at: Timestamp
23507
23639
  });
23508
23640
 
23509
23641
  // ../../packages/core/src/schema/app.ts
@@ -23580,6 +23712,11 @@ var AppDomainSchema = external_exports.object({
23580
23712
  status: AppDomainStatusSchema,
23581
23713
  created_at: Timestamp
23582
23714
  });
23715
+ var AppPermissionsSchema = external_exports.object({
23716
+ object: external_exports.literal("app_permissions"),
23717
+ app_id: idOf("app"),
23718
+ scopes: external_exports.array(external_exports.string())
23719
+ });
23583
23720
 
23584
23721
  // ../../packages/core/src/schema/install.ts
23585
23722
  var BlueprintInstallSourceSchema = external_exports.enum(["studio", "cli"]);
@@ -23678,7 +23815,10 @@ var BlueprintInstallSchema = external_exports.object({
23678
23815
  */
23679
23816
  report: BlueprintReportSchema.nullable(),
23680
23817
  status: BlueprintInstallStatusSchema,
23681
- /** Why a `failed` run threw, in one sentence; `null` on every other row. Never a stack or a key. */
23818
+ /**
23819
+ * Why a `failed` run threw, in one sentence — or, on an `applied` row, which `required` agent or
23820
+ * app the apply refused and why (§29.6). `null` otherwise. Never a stack or a key.
23821
+ */
23682
23822
  failure: external_exports.string().nullable(),
23683
23823
  /**
23684
23824
  * The `selection` the apply carried, or `null` — every row written before §31.2 and every apply
@@ -23794,6 +23934,39 @@ var SocialCommentSchema = external_exports.object({
23794
23934
  posted_at: Timestamp.nullable(),
23795
23935
  data: external_exports.unknown()
23796
23936
  });
23937
+ var POST_STATUSES = ["pending", "scheduled", "posted", "failed"];
23938
+ var PostStatusSchema = external_exports.enum(POST_STATUSES);
23939
+ var PostSchema = external_exports.object({
23940
+ object: external_exports.literal("post"),
23941
+ id: external_exports.string().min(1),
23942
+ status: PostStatusSchema,
23943
+ identity_id: external_exports.string().nullable(),
23944
+ agent_id: external_exports.string().nullable(),
23945
+ session_id: external_exports.string().nullable(),
23946
+ tool_call_id: external_exports.string().nullable(),
23947
+ content: external_exports.string().nullable(),
23948
+ platforms: external_exports.array(external_exports.string()),
23949
+ file_ids: external_exports.array(external_exports.string()),
23950
+ media_urls: external_exports.array(external_exports.string()),
23951
+ visibility: SocialVisibilitySchema.nullable(),
23952
+ scheduled_at: Timestamp.nullable(),
23953
+ posted_at: Timestamp.nullable(),
23954
+ url: external_exports.string().nullable(),
23955
+ error: external_exports.string().nullable(),
23956
+ /** The latest stored reading, `{metric: value}`; `null` before `social.post_metrics` read any. */
23957
+ metrics: external_exports.record(external_exports.string(), external_exports.number()).nullable(),
23958
+ measured_at: Timestamp.nullable(),
23959
+ /** Pending only: the earlier post this call would repeat — same identity, network and file. */
23960
+ duplicate_of: external_exports.object({
23961
+ id: external_exports.string(),
23962
+ status: PostStatusSchema,
23963
+ platform: external_exports.string(),
23964
+ at: Timestamp.nullable(),
23965
+ agent_id: external_exports.string().nullable(),
23966
+ session_id: external_exports.string().nullable()
23967
+ }).nullable(),
23968
+ created_at: Timestamp
23969
+ });
23797
23970
 
23798
23971
  // ../../packages/core/src/schema/blueprint.ts
23799
23972
  var BlueprintScheduleSchema = external_exports.object({
@@ -23827,16 +24000,9 @@ var BlueprintAppSchema = external_exports.object({
23827
24000
  /** Whether an install may deselect it (§31.2). Optional: the rollout argument above. */
23828
24001
  required: external_exports.boolean().optional()
23829
24002
  });
23830
- var BlueprintIdentityConnectionsSchema = external_exports.object({
23831
- social: external_exports.object({
23832
- from: external_exports.string().min(1),
23833
- map: external_exports.record(external_exports.string().min(1), SocialPlatformSchema)
23834
- }).optional()
23835
- });
23836
24003
  var BlueprintIdentitySchema = external_exports.object({
23837
24004
  name: external_exports.string().min(1),
23838
- description: external_exports.string().nullable(),
23839
- connections: BlueprintIdentityConnectionsSchema.optional()
24005
+ description: external_exports.string().nullable()
23840
24006
  });
23841
24007
  var ContentHashSchema = external_exports.string().regex(/^[0-9a-f]{64}$/, "a lowercase sha-256 hex digest");
23842
24008
  var BlueprintTreeSchema = external_exports.object({
@@ -23854,11 +24020,18 @@ var BlueprintArtifactSchema = external_exports.object({
23854
24020
  /** The blueprint repository's own released version. Stored, never parsed (ADR-0401). */
23855
24021
  version: external_exports.string().min(1),
23856
24022
  /**
23857
- * The built trees, one per deployable app, ordered as the declaration orders its apps. Never
23858
- * empty: an artifact that built nothing is not an artifact, and the column behind it says so
23859
- * (migration 0040) exactly as the single `content_hash` it replaces was `not null`.
24023
+ * What a person calls the template, one line on what its crew does, and the networks it publishes
24024
+ * to — printed, never provisioned (§31.5, ADR-0921). `platforms` is decoration: where the crew
24025
+ * posts is the accounts connected to its persona. Optional for the §31.5 rollout reason.
24026
+ */
24027
+ title: external_exports.string().min(1).optional(),
24028
+ description: external_exports.string().min(1).optional(),
24029
+ platforms: external_exports.array(SocialPlatformSchema).optional(),
24030
+ /**
24031
+ * The built trees, one per deployable app, ordered as the declaration orders its apps. Empty for
24032
+ * a data-only blueprint: it declares no app, builds nothing, and still ships a crew (ADR-0900).
23860
24033
  */
23861
- trees: external_exports.array(BlueprintTreeSchema).min(1),
24034
+ trees: external_exports.array(BlueprintTreeSchema),
23862
24035
  /**
23863
24036
  * The setup questions, asked by the studio **before** provisioning. `QuestionField` (§7.1) is
23864
24037
  * reused rather than restated: a setup question and a question a parked agent asks are the same
@@ -23968,6 +24141,205 @@ var ChannelPostSchema = external_exports.object({
23968
24141
  queued: external_exports.boolean()
23969
24142
  });
23970
24143
 
24144
+ // ../../packages/core/src/schema/show.ts
24145
+ var SHOW_SOURCES = ["spend_by_day", "post_views", "roadmap", "schedule"];
24146
+ var ShowSourceSchema = external_exports.enum(SHOW_SOURCES);
24147
+ var ShowArgsSchema = external_exports.object({
24148
+ source: ShowSourceSchema.describe(
24149
+ "What to show: spend_by_day (company spend per day, a line), post_views (views per recent post, bars), roadmap (the board's work by status), schedule (routines and scheduled posts over the next 7 days)."
24150
+ ),
24151
+ days: external_exports.number().int().min(2).max(30).optional().describe("spend_by_day only: days back, today included. Default 14.")
24152
+ });
24153
+ var Day = external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/);
24154
+ var Count = external_exports.number().int().nonnegative();
24155
+ var head = { title: external_exports.string().min(1), as_of: Timestamp, timezone: external_exports.string().min(1) };
24156
+ var SpendByDayViewSchema = external_exports.object({
24157
+ source: external_exports.literal("spend_by_day"),
24158
+ ...head,
24159
+ days: external_exports.array(external_exports.object({ day: Day, micro_usd: Count })).min(2).max(30)
24160
+ });
24161
+ var PostViewsViewSchema = external_exports.object({
24162
+ source: external_exports.literal("post_views"),
24163
+ ...head,
24164
+ posts: external_exports.array(external_exports.object({ post_id: external_exports.string().min(1), label: external_exports.string(), networks: external_exports.array(external_exports.string()), posted_at: Timestamp, views: Count })).max(12)
24165
+ });
24166
+ var RoadmapViewSchema = external_exports.object({
24167
+ source: external_exports.literal("roadmap"),
24168
+ ...head,
24169
+ groups: external_exports.array(
24170
+ external_exports.object({
24171
+ status: BoardStatusSchema,
24172
+ count: Count,
24173
+ cards: external_exports.array(external_exports.object({ title: external_exports.string(), assignee: external_exports.string().nullable(), waits_on: external_exports.array(external_exports.string()) })).max(5)
24174
+ })
24175
+ )
24176
+ });
24177
+ var ScheduleViewSchema = external_exports.object({
24178
+ source: external_exports.literal("schedule"),
24179
+ ...head,
24180
+ days: external_exports.array(
24181
+ external_exports.object({
24182
+ day: Day,
24183
+ count: Count,
24184
+ items: external_exports.array(
24185
+ external_exports.discriminatedUnion("kind", [
24186
+ external_exports.object({ kind: external_exports.literal("routine"), at: Timestamp, agent: external_exports.string(), text: external_exports.string(), runs: external_exports.number().int().min(1).max(100) }),
24187
+ external_exports.object({ kind: external_exports.literal("post"), at: Timestamp, networks: external_exports.array(external_exports.string()), text: external_exports.string() })
24188
+ ])
24189
+ ).max(8)
24190
+ })
24191
+ ).max(7)
24192
+ });
24193
+ var ShowViewSchema = external_exports.discriminatedUnion("source", [
24194
+ SpendByDayViewSchema,
24195
+ PostViewsViewSchema,
24196
+ RoadmapViewSchema,
24197
+ ScheduleViewSchema
24198
+ ]);
24199
+
24200
+ // ../../packages/core/src/schema/catalog.ts
24201
+ var Key = external_exports.string().regex(/^[A-Za-z][A-Za-z0-9_-]{0,39}$/, "an element key is a short name: a letter, then letters, digits, - or _");
24202
+ var Count2 = external_exports.number().int().nonnegative();
24203
+ var DIGIT = "words only: a digit is refused, because every number on the card is read by code from a $source binding";
24204
+ var words = (max) => external_exports.string().trim().min(1).max(max).regex(/^[^0-9]*$/, DIGIT).refine((text2) => !new RegExp("\\p{N}", "u").test(text2), DIGIT);
24205
+ var Days = external_exports.number().int().min(1).max(30).default(7).describe("The window: today and the days before it, on the company's clock. Default 7.");
24206
+ function bound(sources2, shape) {
24207
+ const example = JSON.stringify({ $source: sources2[0] });
24208
+ return external_exports.strictObject(
24209
+ { $source: external_exports.enum(sources2), ...shape },
24210
+ { error: (issue2) => issue2.code === "invalid_type" ? `must be a binding such as ${example}: a literal value is refused, code reads every number` : void 0 }
24211
+ );
24212
+ }
24213
+ var Bound = {
24214
+ value: bound(["views_total", "spend_total"], { days: Days }).describe(
24215
+ "views_total: the latest views of the posts published in the window. spend_total: the company's spend in the window (the CEO only)."
24216
+ ),
24217
+ delta: bound(["views_change"], {}).describe(
24218
+ "views_change: the value's views_total against the same number of days before it, as a percentage. Its window is the value's."
24219
+ ),
24220
+ series: bound(["spend_by_day"], { days: external_exports.number().int().min(2).max(30).default(14) }).describe("spend_by_day: the company's spend per day (the CEO only)."),
24221
+ bars: bound(["post_views"], { limit: external_exports.number().int().min(1).max(12).default(5).describe("How many posts, newest first. Default 5.") }).describe(
24222
+ "post_views: each recent post's latest views, newest first."
24223
+ ),
24224
+ progress: bound(["posts_this_week"], {}).describe("posts_this_week: posts published since Monday against the weekly cadence from the company's setup."),
24225
+ board: bound(["roadmap"], {}).describe("roadmap: the board's work by status."),
24226
+ week: bound(["schedule"], {}).describe("schedule: routines and scheduled posts over the next 7 days."),
24227
+ media: external_exports.union([bound(["latest_media"], { count: external_exports.number().int().min(1).max(4).default(1) }), external_exports.array(idOf("fil")).min(1).max(4)]).describe('{"$source":"latest_media","count":1} for the newest posted pictures or clips, or up to 4 fil_ ids.')
24228
+ };
24229
+ var SpendDay = external_exports.strictObject({ day: external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/), micro_usd: Count2 });
24230
+ var Resolved = {
24231
+ value: external_exports.discriminatedUnion("$source", [
24232
+ external_exports.strictObject({ $source: external_exports.literal("views_total"), days: external_exports.number().int(), value: Count2, posts: Count2 }),
24233
+ external_exports.strictObject({ $source: external_exports.literal("spend_total"), days: external_exports.number().int(), value: Count2 })
24234
+ ]),
24235
+ delta: external_exports.strictObject({ $source: external_exports.literal("views_change"), days: external_exports.number().int(), current: Count2, previous: Count2 }),
24236
+ series: external_exports.strictObject({ $source: external_exports.literal("spend_by_day"), days: external_exports.number().int(), points: external_exports.array(SpendDay).min(2).max(30) }),
24237
+ bars: external_exports.strictObject({ $source: external_exports.literal("post_views"), limit: external_exports.number().int(), posts: PostViewsViewSchema.shape.posts }),
24238
+ progress: external_exports.strictObject({ $source: external_exports.literal("posts_this_week"), value: Count2, max: external_exports.number().int().positive(), cadence: external_exports.string() }),
24239
+ board: external_exports.strictObject({ $source: external_exports.literal("roadmap"), groups: RoadmapViewSchema.shape.groups }),
24240
+ week: external_exports.strictObject({ $source: external_exports.literal("schedule"), days: ScheduleViewSchema.shape.days }),
24241
+ media: external_exports.array(external_exports.strictObject({ id: idOf("fil"), kind: external_exports.enum(["image", "video"]) })).min(1).max(4)
24242
+ };
24243
+ var box = { children: external_exports.array(Key).min(1).max(12) };
24244
+ var leaf = { children: external_exports.array(Key).max(0).optional() };
24245
+ var label = words(40).optional();
24246
+ var element = (type, props, children, about) => external_exports.strictObject({ type: external_exports.literal(type), props: external_exports.strictObject(props), ...children }).describe(about);
24247
+ function catalog(slot) {
24248
+ return {
24249
+ Card: element("Card", { title: words(60) }, box, "The card, with a short title. It is the root, and only the root."),
24250
+ Stack: element("Stack", {}, box, "Children one under another."),
24251
+ Grid: element("Grid", { columns: external_exports.literal([1, 2, 3]) }, box, "Children side by side, 1 to 3 columns."),
24252
+ Metric: element("Metric", { label: words(40), value: slot.value, delta: slot.delta.optional() }, leaf, "One big number with a label, and optionally its change."),
24253
+ LineChart: element("LineChart", { label, series: slot.series }, leaf, "A line over days."),
24254
+ BarList: element("BarList", { label, bars: slot.bars }, leaf, "One bar per post."),
24255
+ Progress: element("Progress", { label: words(40), progress: slot.progress }, leaf, "A value against its goal, as a bar."),
24256
+ Roadmap: element("Roadmap", { label, board: slot.board }, leaf, "The board grouped by status."),
24257
+ Schedule: element("Schedule", { label, week: slot.week }, leaf, "The week ahead, day by day."),
24258
+ Media: element("Media", { label, files: slot.media }, leaf, "Pictures or clips the company holds."),
24259
+ Text: element("Text", { text: words(240) }, leaf, "A short note in words.")
24260
+ };
24261
+ }
24262
+ var unknownComponent = (names2) => ({
24263
+ error: (issue2) => issue2.code === "invalid_union" ? `unknown component: use one of ${names2.join(", ")}` : void 0
24264
+ });
24265
+ function tree(rootType, max, spec4, ctx) {
24266
+ const refuse2 = (message4, path = []) => ctx.addIssue({ code: "custom", message: message4, path });
24267
+ const keys3 = Object.keys(spec4.elements);
24268
+ const has = (key2) => Object.hasOwn(spec4.elements, key2);
24269
+ if (keys3.length > max) return refuse2(`at most ${max} elements`, ["elements"]);
24270
+ const root = has(spec4.root) ? spec4.elements[spec4.root] : void 0;
24271
+ if (!root) return refuse2(`root names "${spec4.root}", which is not in elements`, ["root"]);
24272
+ if (root.type !== rootType) return refuse2(`the root must be a ${rootType}`, ["root"]);
24273
+ const parent = /* @__PURE__ */ new Map();
24274
+ for (const key2 of keys3) {
24275
+ for (const child of spec4.elements[key2].children ?? []) {
24276
+ if (!has(child)) return refuse2(`"${child}" is not in elements`, ["elements", key2, "children"]);
24277
+ if (child === spec4.root || parent.has(child)) return refuse2(`"${child}" has more than one parent`, ["elements", key2, "children"]);
24278
+ if (spec4.elements[child].type === rootType) return refuse2(`a ${rootType} is the root only; group with Stack or Grid`, ["elements", child, "type"]);
24279
+ parent.set(child, key2);
24280
+ }
24281
+ }
24282
+ const reached = /* @__PURE__ */ new Set([spec4.root]);
24283
+ for (const key2 of reached) for (const child of spec4.elements[key2].children ?? []) reached.add(child);
24284
+ const lost = keys3.find((key2) => !reached.has(key2));
24285
+ if (lost) refuse2(`"${lost}" is not under the root`, ["elements", lost]);
24286
+ }
24287
+ var spec = (element4, rootType, max) => external_exports.strictObject({ root: Key, elements: external_exports.record(Key, element4) }).superRefine((value, ctx) => tree(rootType, max, value, ctx));
24288
+
24289
+ // ../../packages/core/src/schema/compose.ts
24290
+ var COMPOSE_COMPONENTS = ["Card", "Stack", "Grid", "Metric", "LineChart", "BarList", "Progress", "Roadmap", "Schedule", "Media", "Text"];
24291
+ var MAX_COMPOSE_ELEMENTS = 24;
24292
+ var BoundComponents = catalog(Bound);
24293
+ var ComposeSpecSchema = spec(
24294
+ external_exports.discriminatedUnion(
24295
+ "type",
24296
+ [
24297
+ BoundComponents.Card,
24298
+ BoundComponents.Stack,
24299
+ BoundComponents.Grid,
24300
+ BoundComponents.Metric,
24301
+ BoundComponents.LineChart,
24302
+ BoundComponents.BarList,
24303
+ BoundComponents.Progress,
24304
+ BoundComponents.Roadmap,
24305
+ BoundComponents.Schedule,
24306
+ BoundComponents.Media,
24307
+ BoundComponents.Text
24308
+ ],
24309
+ unknownComponent(COMPOSE_COMPONENTS)
24310
+ ),
24311
+ "Card",
24312
+ MAX_COMPOSE_ELEMENTS
24313
+ );
24314
+ var ComposeArgsSchema = external_exports.object({
24315
+ spec: ComposeSpecSchema.describe(
24316
+ 'A json-render spec: { "root": key, "elements": { key: { "type", "props", "children"? } } }. The root is one Card.'
24317
+ )
24318
+ });
24319
+ var ComposedComponents = catalog(Resolved);
24320
+ var ComposedSpecSchema = spec(
24321
+ external_exports.discriminatedUnion(
24322
+ "type",
24323
+ [
24324
+ ComposedComponents.Card,
24325
+ ComposedComponents.Stack,
24326
+ ComposedComponents.Grid,
24327
+ ComposedComponents.Metric,
24328
+ ComposedComponents.LineChart,
24329
+ ComposedComponents.BarList,
24330
+ ComposedComponents.Progress,
24331
+ ComposedComponents.Roadmap,
24332
+ ComposedComponents.Schedule,
24333
+ ComposedComponents.Media,
24334
+ ComposedComponents.Text
24335
+ ],
24336
+ unknownComponent(COMPOSE_COMPONENTS)
24337
+ ),
24338
+ "Card",
24339
+ MAX_COMPOSE_ELEMENTS
24340
+ );
24341
+ var ComposedSchema = external_exports.object({ as_of: Timestamp, timezone: external_exports.string().min(1), spec: ComposedSpecSchema });
24342
+
23971
24343
  // ../../packages/core/src/schema/media.ts
23972
24344
  var MEDIA_MODEL_KINDS = ["image", "video", "stt", "tts", "s2s"];
23973
24345
  var isMediaModelKind = (value) => MEDIA_MODEL_KINDS.some((kind) => kind === value);
@@ -24037,9 +24409,12 @@ var ImageRequestSchema = external_exports.object({
24037
24409
  n: external_exports.number().int().min(1).max(4).default(1)
24038
24410
  });
24039
24411
  var VideoRequestSchema = external_exports.object({
24040
- model: external_exports.string().min(1),
24412
+ /** Omitted: the platform's video default while the catalogue publishes it (`resolveModel`, §33.2). */
24413
+ model: external_exports.string().min(1).optional(),
24041
24414
  prompt: external_exports.string().min(1),
24042
24415
  image_urls: external_exports.array(PublicUrl).max(1).optional(),
24416
+ /** The source clip of a video-to-video edit (ADR-0814). */
24417
+ video_url: PublicUrl.optional(),
24043
24418
  aspect_ratio: external_exports.string().optional(),
24044
24419
  seed: external_exports.number().int().optional(),
24045
24420
  seconds: external_exports.number().int().min(1).max(60).optional()
@@ -24331,18 +24706,18 @@ var ReferralClickSchema = external_exports.object({
24331
24706
  creator: external_exports.object({ display_name: external_exports.string().min(1) }),
24332
24707
  expires_at: Timestamp
24333
24708
  });
24334
- var Day = external_exports.iso.date();
24709
+ var Day2 = external_exports.iso.date();
24335
24710
  var CreatorAnalyticsSchema = external_exports.object({
24336
24711
  object: external_exports.literal("creator_analytics"),
24337
24712
  days: external_exports.number().int().min(1).max(90),
24338
- from: Day,
24339
- to: Day,
24713
+ from: Day2,
24714
+ to: Day2,
24340
24715
  clicks: external_exports.number().int().nonnegative(),
24341
24716
  referrals: external_exports.number().int().nonnegative(),
24342
24717
  installs: external_exports.number().int().nonnegative(),
24343
24718
  active_installs: external_exports.number().int().nonnegative(),
24344
24719
  usage_by_day: external_exports.array(
24345
- external_exports.object({ day: Day, debit_micro_usd: MicroUsdField.nonnegative() })
24720
+ external_exports.object({ day: Day2, debit_micro_usd: MicroUsdField.nonnegative() })
24346
24721
  ),
24347
24722
  commission_micro_usd: external_exports.object({
24348
24723
  pending: MicroUsdField.nonnegative(),
@@ -24357,7 +24732,7 @@ var CreatorAnalyticsSchema = external_exports.object({
24357
24732
  })
24358
24733
  ),
24359
24734
  /** Every install covered, newest first: the day it was created and the day its twelve months end. */
24360
- install_windows: external_exports.array(external_exports.object({ install_id: idOf("bpi"), from: Day, until: Day }))
24735
+ install_windows: external_exports.array(external_exports.object({ install_id: idOf("bpi"), from: Day2, until: Day2 }))
24361
24736
  });
24362
24737
 
24363
24738
  // ../../packages/core/src/schema/legal.ts
@@ -24803,6 +25178,155 @@ var CreateReviewSchema = external_exports.object({
24803
25178
  after: Fields
24804
25179
  });
24805
25180
 
25181
+ // ../../packages/core/src/schema/mini-app.ts
25182
+ var PAGE_BLOCKS = [
25183
+ "Page",
25184
+ "Section",
25185
+ "Stack",
25186
+ "Grid",
25187
+ "Metric",
25188
+ "LineChart",
25189
+ "BarList",
25190
+ "Progress",
25191
+ "Roadmap",
25192
+ "Schedule",
25193
+ "Media",
25194
+ "Text",
25195
+ "Needs",
25196
+ "Activity",
25197
+ "Accounts",
25198
+ "Posts",
25199
+ "Answers",
25200
+ "MediaLibrary"
25201
+ ];
25202
+ var MAX_PAGE_ELEMENTS = 48;
25203
+ var MINI_APP_ICONS = ["grid", "list", "chart", "calendar", "play"];
25204
+ var MiniAppIconSchema = external_exports.enum(MINI_APP_ICONS);
25205
+ var SLUG = "[a-z][a-z0-9-]{0,39}";
25206
+ var MiniAppSlugSchema = external_exports.string().regex(new RegExp(`^${SLUG}$`), "a slug is lowercase letters, digits and -");
25207
+ var Place = external_exports.string().regex(new RegExp(`^/(board|connections|apps/${SLUG}(\\?page=${SLUG})?)$`), "a section links to /board, /connections or /apps/<slug>[?page=<slug>]");
25208
+ var POSTS = ["waiting", "scheduled", "posted"];
25209
+ var PostStatus = external_exports.enum(POSTS);
25210
+ var PostLayout = external_exports.enum(["list", "row", "grid"]);
25211
+ var PostStatuses = external_exports.union([PostStatus, external_exports.array(PostStatus).min(1).max(3).refine((all) => new Set(all).size === all.length, "each status once")]);
25212
+ var PageBound = {
25213
+ ...Bound,
25214
+ board: bound(["roadmap"], { per_group: external_exports.number().int().min(1).max(5).default(5) }),
25215
+ media: bound(["latest_media", "newest_media"], { count: external_exports.number().int().min(1).max(6).default(4) })
25216
+ };
25217
+ var PageResolved = {
25218
+ ...Resolved,
25219
+ board: external_exports.strictObject({ $source: external_exports.literal("roadmap"), per_group: external_exports.number().int(), groups: RoadmapViewSchema.shape.groups }),
25220
+ media: external_exports.array(external_exports.strictObject({ id: external_exports.string(), kind: external_exports.enum(["image", "video"]) })).max(6)
25221
+ };
25222
+ function pageBlocks(slot) {
25223
+ return {
25224
+ Page: element("Page", {}, box, "The page itself, the root and only the root."),
25225
+ Section: element("Section", { title: words(40), to: Place.optional(), hide_empty: external_exports.boolean().optional() }, box, "A titled part of the page; hidden when every block in it is empty, if asked."),
25226
+ Needs: element("Needs", { label, needs: slot.needs }, leaf, "What waits on a person: approvals, questions, spent caps."),
25227
+ Activity: element("Activity", { label, agents: slot.agents }, leaf, "The agents working or waiting, and on what."),
25228
+ Accounts: element("Accounts", { accounts: slot.accounts }, leaf, "The template's networks: connected with a handle, or not."),
25229
+ Posts: element(
25230
+ "Posts",
25231
+ { label, layout: PostLayout.optional(), posts: slot.posts },
25232
+ leaf,
25233
+ "Posts waiting on a person, scheduled, or posted; several statuses make one list. Drawn as rows (list, the default), one sideways row of cards (row), or a picture grid (grid)."
25234
+ ),
25235
+ Answers: element("Answers", { answers: slot.answers }, leaf, "The setup's answers in one line, linking to the setup."),
25236
+ // No binding: the studio's gallery reads and pages the company's files itself (ADR-0987).
25237
+ MediaLibrary: element("MediaLibrary", {}, leaf, "Every picture and clip the company's agents made, with filters, sort and a viewer.")
25238
+ };
25239
+ }
25240
+ var OwnBound = pageBlocks({
25241
+ needs: bound(["needs"], {}),
25242
+ agents: bound(["agents_activity"], {}),
25243
+ accounts: bound(["accounts"], {}),
25244
+ posts: bound(["posts"], { status: PostStatuses, limit: external_exports.number().int().min(1).max(50).default(10) }),
25245
+ answers: bound(["answers"], { keys: external_exports.array(Key).min(1).max(TEMPLATE_QUESTIONS_MAX) })
25246
+ });
25247
+ var Need = external_exports.object({
25248
+ session_id: external_exports.string(),
25249
+ agent_id: external_exports.string(),
25250
+ agent: external_exports.string(),
25251
+ since: Timestamp,
25252
+ /** The chat's stored title, or `null`: the studio names it by when it began. */
25253
+ title: external_exports.string().nullable(),
25254
+ kind: external_exports.enum(["tool", "question", "budget"]),
25255
+ /** The call or question it is held on; `null` for a spent cap. */
25256
+ action: PendingActionSchema.nullable()
25257
+ });
25258
+ var Working = external_exports.object({
25259
+ agent_id: external_exports.string(),
25260
+ agent: external_exports.string(),
25261
+ state: external_exports.enum(["working", "waiting"]),
25262
+ session_id: external_exports.string().nullable(),
25263
+ title: external_exports.string().nullable(),
25264
+ at: Timestamp
25265
+ });
25266
+ var OwnResolved = pageBlocks({
25267
+ needs: external_exports.strictObject({ $source: external_exports.literal("needs"), items: external_exports.array(Need) }),
25268
+ agents: external_exports.strictObject({ $source: external_exports.literal("agents_activity"), agents: external_exports.array(Working) }),
25269
+ accounts: external_exports.strictObject({
25270
+ $source: external_exports.literal("accounts"),
25271
+ accounts: external_exports.array(external_exports.object({ platform: SocialPlatformSchema, connected: external_exports.boolean(), handle: external_exports.string().nullable() }))
25272
+ }),
25273
+ posts: external_exports.strictObject({ $source: external_exports.literal("posts"), status: external_exports.union([PostStatus, external_exports.array(PostStatus)]), limit: external_exports.number().int(), posts: external_exports.array(PostSchema), more: external_exports.boolean() }),
25274
+ answers: external_exports.strictObject({
25275
+ $source: external_exports.literal("answers"),
25276
+ keys: external_exports.array(external_exports.string()),
25277
+ values: external_exports.array(external_exports.string()),
25278
+ template: external_exports.object({ blueprint: external_exports.string(), template: external_exports.string() }).nullable()
25279
+ })
25280
+ });
25281
+ var BoundBlocks = { ...catalog(PageBound), ...OwnBound };
25282
+ var ResolvedBlocks = { ...catalog(PageResolved), ...OwnResolved };
25283
+ var Unread = element("Unread", { of: external_exports.string(), label: external_exports.string().nullable(), reason: external_exports.string() }, leaf, "A block that could not be read.");
25284
+ var B = BoundBlocks;
25285
+ var PageSpecSchema = spec(
25286
+ external_exports.discriminatedUnion(
25287
+ "type",
25288
+ [B.Page, B.Section, B.Stack, B.Grid, B.Metric, B.LineChart, B.BarList, B.Progress, B.Roadmap, B.Schedule, B.Media, B.Text, B.Needs, B.Activity, B.Accounts, B.Posts, B.Answers, B.MediaLibrary],
25289
+ unknownComponent(PAGE_BLOCKS)
25290
+ ),
25291
+ "Page",
25292
+ MAX_PAGE_ELEMENTS
25293
+ );
25294
+ var R = ResolvedBlocks;
25295
+ var ResolvedPageElementSchema = external_exports.discriminatedUnion(
25296
+ "type",
25297
+ [R.Page, R.Section, R.Stack, R.Grid, R.Metric, R.LineChart, R.BarList, R.Progress, R.Roadmap, R.Schedule, R.Media, R.Text, R.Needs, R.Activity, R.Accounts, R.Posts, R.Answers, R.MediaLibrary, Unread],
25298
+ unknownComponent(PAGE_BLOCKS)
25299
+ );
25300
+ var ResolvedPageSpecSchema = spec(ResolvedPageElementSchema, "Page", MAX_PAGE_ELEMENTS);
25301
+ var unique = (items) => new Set(items.map((item) => item.slug)).size === items.length;
25302
+ var MiniAppPageSchema = external_exports.strictObject({ slug: MiniAppSlugSchema, title: words(24), spec: PageSpecSchema });
25303
+ var MiniAppDeclSchema = external_exports.strictObject({
25304
+ slug: MiniAppSlugSchema,
25305
+ name: words(40),
25306
+ icon: MiniAppIconSchema,
25307
+ pages: external_exports.array(MiniAppPageSchema).min(1).max(6).refine(unique, "each page's slug is its own")
25308
+ });
25309
+ var MiniAppDeclsSchema = external_exports.array(MiniAppDeclSchema).max(8).refine(unique, "each mini app's slug is its own");
25310
+ var MiniAppSummarySchema = external_exports.object({
25311
+ object: external_exports.literal("mini_app"),
25312
+ slug: MiniAppSlugSchema,
25313
+ name: external_exports.string(),
25314
+ icon: MiniAppIconSchema,
25315
+ pages: external_exports.array(external_exports.object({ slug: MiniAppSlugSchema, title: external_exports.string() })).min(1),
25316
+ /** What it reads (`miniAppReads`). Absent from an older API: the Studio then claims nothing it cannot see. */
25317
+ reads: external_exports.array(external_exports.string()).optional()
25318
+ });
25319
+ var MiniAppSchema = MiniAppSummarySchema.extend({
25320
+ networks: external_exports.array(external_exports.object({ platform: SocialPlatformSchema, connected: external_exports.boolean().nullable() })),
25321
+ page: MiniAppSlugSchema,
25322
+ as_of: Timestamp,
25323
+ timezone: external_exports.string().min(1),
25324
+ spec: ResolvedPageSpecSchema
25325
+ });
25326
+
25327
+ // ../../packages/core/src/logo-svg.ts
25328
+ var MAX_BYTES = 16 * 1024;
25329
+
24806
25330
  // ../../packages/core/src/file-url.ts
24807
25331
  var encoder2 = new TextEncoder();
24808
25332
  var SESSION_FILE_URL_TTL_MS = 15 * 6e4;
@@ -24812,9 +25336,9 @@ var ALPHABET2 = "0123456789abcdefghjkmnpqrstvwxyz";
24812
25336
  var SUFFIX_LENGTH2 = 26;
24813
25337
  var SUFFIX_PATTERN2 = new RegExp(`^[${ALPHABET2}]{${SUFFIX_LENGTH2},}$`);
24814
25338
  function isId2(prefix, value) {
24815
- const head = `${prefix}_`;
24816
- if (!value.startsWith(head)) return false;
24817
- return SUFFIX_PATTERN2.test(value.slice(head.length).toLowerCase());
25339
+ const head22 = `${prefix}_`;
25340
+ if (!value.startsWith(head22)) return false;
25341
+ return SUFFIX_PATTERN2.test(value.slice(head22.length).toLowerCase());
24818
25342
  }
24819
25343
  var SESSION_TTL_SECONDS2 = 30 * 24 * 60 * 60;
24820
25344
  var encoder3 = new TextEncoder();
@@ -24842,6 +25366,8 @@ var AUDIT_ACTIONS_P12 = [
24842
25366
  "computer.resumed",
24843
25367
  "computer.snapshot_created",
24844
25368
  "computer.updated",
25369
+ "computer.taken_over",
25370
+ "computer.handed_back",
24845
25371
  "browser.live_view_opened",
24846
25372
  "deployment.created",
24847
25373
  "deployment.updated",
@@ -24974,7 +25500,7 @@ var JsonSchemaDocument2 = external_exports.record(external_exports.string(), ext
24974
25500
  var WindowSchema2 = external_exports.enum(["immediate", "priority", "loose"]);
24975
25501
  var TOKEN_TIERS2 = ["input", "cache_write", "cache_read", "output", "reasoning"];
24976
25502
  var TokenTierSchema2 = external_exports.enum(TOKEN_TIERS2);
24977
- var TOOL_TIERS2 = ["search", "media", "social", "browser", "storage"];
25503
+ var TOOL_TIERS2 = ["search", "media", "social", "browser", "storage", "email"];
24978
25504
  var LINE_ITEM_TIERS2 = [...TOKEN_TIERS2, "computer", ...TOOL_TIERS2];
24979
25505
  var LineItemTierSchema2 = external_exports.enum(LINE_ITEM_TIERS2);
24980
25506
  var TokenUsageSchema2 = external_exports.object({
@@ -24994,11 +25520,41 @@ var page = (item) => external_exports.object({ data: external_exports.array(item
24994
25520
  var API_VERSION2 = "2026-09-01";
24995
25521
  var HARNESS_IDS2 = ["pi", "claude_code", "vetta", "hermes"];
24996
25522
  var HarnessIdSchema2 = external_exports.enum(HARNESS_IDS2);
25523
+ var DEFAULT_ORG_TIMEZONE2 = "America/New_York";
25524
+ function canonicalZone2(name) {
25525
+ if (!name.includes("/") && name !== "UTC") return void 0;
25526
+ try {
25527
+ const zone = new Intl.DateTimeFormat("en-US", { timeZone: name }).resolvedOptions().timeZone;
25528
+ return zone === "UTC" || Intl.supportedValuesOf("timeZone").includes(zone) ? zone : void 0;
25529
+ } catch {
25530
+ return void 0;
25531
+ }
25532
+ }
25533
+ var TimezoneSchema2 = external_exports.string().transform((name, ctx) => {
25534
+ const zone = canonicalZone2(name);
25535
+ if (zone === void 0) {
25536
+ ctx.addIssue({ code: "custom", message: "not a timezone; use an IANA name such as America/Los_Angeles" });
25537
+ return external_exports.NEVER;
25538
+ }
25539
+ return zone;
25540
+ });
24997
25541
  var OrganizationSchema2 = external_exports.object({
24998
25542
  id: idOf2("org"),
24999
25543
  object: external_exports.literal("organization"),
25000
25544
  name: external_exports.string(),
25001
25545
  balance_micro_usd: MicroUsdField2,
25546
+ /**
25547
+ * The company's timezone, an IANA name (`America/New_York`, §20.6). Times the company chooses or
25548
+ * reads are in it: a new routine's zone, when a post goes out. `America/New_York` until changed.
25549
+ * Defaulted so a reply from a control plane older than 0088 (or a rolled-back Worker) still parses
25550
+ * in a newer SDK/CLI rather than throwing on every `orgs.get/list/update`.
25551
+ */
25552
+ timezone: external_exports.string().min(1).default(DEFAULT_ORG_TIMEZONE2),
25553
+ /**
25554
+ * The company's logo, an SVG a person or an agent drew (§20.7), passed by `checkLogoSvg`. `null`
25555
+ * until one is set. Defaulted so a reply from a control plane older than 0093 still parses.
25556
+ */
25557
+ logo_svg: external_exports.string().nullable().default(null),
25002
25558
  created_at: Timestamp2
25003
25559
  });
25004
25560
  var RoleSchema2 = external_exports.enum(["owner", "admin", "member"]);
@@ -25325,7 +25881,14 @@ var BUILTIN_TOOLS2 = [
25325
25881
  // `publish_file`, and the first way anything the platform itself produced could be read back.
25326
25882
  "fetch_file",
25327
25883
  "find_stock_photo",
25328
- "session_spend"
25884
+ "session_spend",
25885
+ // A view the chat draws — spend, post views, the roadmap, the week ahead — read by code (§48).
25886
+ "show",
25887
+ // A card the model lays out, every number bound to a source code reads (§49).
25888
+ "compose",
25889
+ // Plan mode's two (§7.5): offered only to a session in plan mode or holding a plan.
25890
+ "write_plan",
25891
+ "propose_plan"
25329
25892
  ];
25330
25893
  var isToolName2 = (name) => BUILTIN_TOOLS2.includes(name) || /^[a-z0-9_-]+(\.[a-z0-9_-]+)+$/i.test(name);
25331
25894
  var ToolConfigSchema2 = external_exports.object({
@@ -25419,6 +25982,22 @@ var SessionStatusSchema2 = external_exports.enum([
25419
25982
  "failed",
25420
25983
  "cancelled"
25421
25984
  ]);
25985
+ var SessionModeSchema2 = external_exports.enum(["plan", "build"]);
25986
+ var PLAN_MAX_CHARS2 = 2e4;
25987
+ var PlanSchema2 = external_exports.object({
25988
+ object: external_exports.literal("plan"),
25989
+ markdown: external_exports.string().max(PLAN_MAX_CHARS2),
25990
+ version: external_exports.number().int().nonnegative(),
25991
+ by: external_exports.enum(["agent", "owner"]).nullable()
25992
+ });
25993
+ var PlanWriteSchema2 = external_exports.object({
25994
+ markdown: external_exports.string().max(PLAN_MAX_CHARS2),
25995
+ base_version: external_exports.number().int().nonnegative()
25996
+ });
25997
+ var ProposePlanSchema2 = external_exports.object({
25998
+ version: external_exports.number().int().positive(),
25999
+ spends_or_publishes: external_exports.array(external_exports.string().min(1).max(200)).max(10).optional()
26000
+ });
25422
26001
  var StopReasonSchema2 = external_exports.enum([
25423
26002
  "end_turn",
25424
26003
  "awaiting_input",
@@ -25511,16 +26090,26 @@ var QuestionFieldSchema2 = external_exports.discriminatedUnion("type", [
25511
26090
  other: external_exports.boolean().default(true)
25512
26091
  })
25513
26092
  ]);
26093
+ var QUESTION_FIELDS_MAX2 = 3;
25514
26094
  var QuestionSchema2 = external_exports.object({
25515
26095
  prompt: external_exports.string().min(1).max(1e3),
25516
- fields: external_exports.array(QuestionFieldSchema2).min(1).max(3)
26096
+ fields: external_exports.array(QuestionFieldSchema2).min(1).max(QUESTION_FIELDS_MAX2, {
26097
+ message: `a question has at most ${QUESTION_FIELDS_MAX2} fields \u2014 ask the rest in a second question once these are answered`
26098
+ })
25517
26099
  });
25518
- var AnswersSchema2 = external_exports.record(
26100
+ var answersOf2 = (max, message4) => external_exports.record(
25519
26101
  external_exports.string().min(1).max(64),
25520
26102
  external_exports.union([external_exports.string().max(2e3), external_exports.array(external_exports.string().max(2e3)).min(1).max(12)])
25521
- ).refine((answers) => Object.keys(answers).length <= 3, {
25522
- message: "a question has at most 3 fields, so an answer has at most 3 keys"
25523
- });
26103
+ ).refine((answers) => Object.keys(answers).length <= max, { message: message4 });
26104
+ var AnswersSchema2 = answersOf2(
26105
+ QUESTION_FIELDS_MAX2,
26106
+ `a question has at most ${QUESTION_FIELDS_MAX2} fields, so an answer has at most ${QUESTION_FIELDS_MAX2} keys`
26107
+ );
26108
+ var TEMPLATE_QUESTIONS_MAX2 = 4;
26109
+ var InstallAnswersSchema2 = answersOf2(
26110
+ TEMPLATE_QUESTIONS_MAX2,
26111
+ `a template asks at most ${TEMPLATE_QUESTIONS_MAX2} questions, so an install has at most ${TEMPLATE_QUESTIONS_MAX2} answers`
26112
+ );
25524
26113
  var PendingActionSchema2 = external_exports.object({
25525
26114
  kind: external_exports.enum(["tool", "question"]).default("tool"),
25526
26115
  tool_call_id: external_exports.string(),
@@ -25561,6 +26150,13 @@ var SessionSchema2 = external_exports.object({
25561
26150
  parent_session_id: idOf2("ses").nullable(),
25562
26151
  root_session_id: idOf2("ses").nullable(),
25563
26152
  thread_role: ThreadRoleSchema2.nullable(),
26153
+ /**
26154
+ * The model the latest send picked (§7 `model`), or `null` when none has and the session runs its
26155
+ * pinned version's model (§10, ADR-0832). Defaulted so a reply from an older control plane parses.
26156
+ */
26157
+ model: external_exports.string().nullable().default(null),
26158
+ /** Plan mode (§7.5, §10): defaulted so a reply from an older control plane parses as `build`. */
26159
+ mode: SessionModeSchema2.default("build"),
25564
26160
  status: SessionStatusSchema2,
25565
26161
  stop_reason: StopReasonSchema2.nullable(),
25566
26162
  window: WindowSchema2,
@@ -25580,6 +26176,10 @@ var SendMessageSchema2 = external_exports.object({
25580
26176
  message: external_exports.string(),
25581
26177
  interrupt: external_exports.boolean().optional(),
25582
26178
  queue: external_exports.boolean().optional(),
26179
+ /** A catalogue id: this session runs on it from this message's turn on (§7, ADR-0832). */
26180
+ model: external_exports.string().min(1).optional(),
26181
+ /** Plan mode from this message's turn on (§7.5, ADR-0905). */
26182
+ mode: SessionModeSchema2.optional(),
25583
26183
  idempotency_key: external_exports.string().optional()
25584
26184
  }).refine((body2) => !(body2.interrupt === true && body2.queue === true), {
25585
26185
  message: "a send is either an interrupt or queued, not both",
@@ -25594,7 +26194,14 @@ var ToolConfirmationSchema2 = external_exports.object({
25594
26194
  tool_call_id: external_exports.string(),
25595
26195
  decision: external_exports.enum(["allow", "deny"]),
25596
26196
  reason: external_exports.string().optional(),
25597
- scope: external_exports.enum(["call", "session"]).default("call")
26197
+ scope: external_exports.enum(["call", "session"]).default("call"),
26198
+ /**
26199
+ * THE PERSON'S OWN ANSWERS for a template install they approve (ADR-1030): the call runs with
26200
+ * these in place of the `answers` the agent proposed, and with nothing else changed. A modifier on
26201
+ * `allow`, like `scope`: absent is the call as proposed. The route refuses it on a deny, on a session
26202
+ * grant, on any other tool, and on answers the template's questions refuse (`answerProblems`).
26203
+ */
26204
+ answers: InstallAnswersSchema2.optional()
25598
26205
  });
25599
26206
  var SessionAnswerSchema2 = external_exports.object({
25600
26207
  tool_call_id: external_exports.string(),
@@ -25602,6 +26209,11 @@ var SessionAnswerSchema2 = external_exports.object({
25602
26209
  });
25603
26210
  var EventTypeSchema2 = external_exports.enum([
25604
26211
  "message.delta",
26212
+ /**
26213
+ * The agent's answer (no `role`), or a user row `{ role: "user", content, client_message_id? }` (§8).
26214
+ * A user row the runtime wrote itself — a media job's result, a tool grant — carries
26215
+ * `from: "platform"` and is the platform's notice, not a caller's words (§8, ADR-0870).
26216
+ */
25605
26217
  "message.completed",
25606
26218
  /** A caller's message, durable in the inbox and not yet admitted to a turn (§7, §8): `{ client_message_id, content }`. */
25607
26219
  "message.accepted",
@@ -25612,19 +26224,26 @@ var EventTypeSchema2 = external_exports.enum([
25612
26224
  "tool.confirm",
25613
26225
  /** A person's decision on a parked call, stamped with the inbox write that delivers it (§8, ADR-0764). */
25614
26226
  "tool.confirm.resolved",
26227
+ /** A person's answer to a parked question, stamped the same way (§7.1, §8, ADR-1049). */
26228
+ "tool.confirm.answered",
25615
26229
  "session.running",
25616
26230
  "session.usage",
25617
26231
  "session.idle",
25618
26232
  /** A failed attempt the loop will retry (§8): `{ attempt, in_ms, code }`. */
25619
26233
  "session.retrying",
26234
+ /** The session's mode changed (§7.5): `{ mode: "plan" | "build" }`. */
26235
+ "session.mode",
26236
+ /** A write to the session's plan, by the agent or its owner (§7.5): the plan object. */
26237
+ "plan.updated",
25620
26238
  /**
25621
26239
  * The turn ran, but without something it needed (§8): `{ reason, detail? }`.
25622
26240
  *
25623
26241
  * Emitted for a turn whose sandbox could not be woken. That turn used to be indistinguishable
25624
26242
  * from a success — the model was handed the failure as a tool result, answered around it from the
25625
26243
  * transcript, and the session ended `idle`/`end_turn` with no field anywhere saying the
25626
- * filesystem had been unavailable. This is the field. `reason` is open on purpose; today the only
25627
- * value is `"sandbox_unavailable"`.
26244
+ * filesystem had been unavailable. This is the field. `reason` is open on purpose; today it is
26245
+ * `"sandbox_unavailable"`, `"vendor_resume_unavailable"`, or `"app_tools_unavailable"` — an app the
26246
+ * agent's toolset names gave no tools this turn (§29.5, `runtime-do app-mcp-tools.ts`).
25628
26247
  *
25629
26248
  * `detail` is the boot failure's own message, and it is here because `reason` alone reads the
25630
26249
  * same for a vendor outage and for a fault of ours. Staging round 3 spent its whole budget
@@ -25722,6 +26341,11 @@ var ToolConfirmResolvedDataSchema2 = external_exports.object({
25722
26341
  proposed_args: external_exports.record(external_exports.string(), external_exports.unknown()).nullable(),
25723
26342
  final_args: external_exports.record(external_exports.string(), external_exports.unknown()).nullable()
25724
26343
  });
26344
+ var ToolConfirmAnsweredDataSchema2 = external_exports.object({
26345
+ tool_call_id: external_exports.string(),
26346
+ answers: AnswersSchema2,
26347
+ answered_at: Timestamp2
26348
+ });
25725
26349
  var SessionUsageDataSchema2 = external_exports.object({
25726
26350
  token_usage: TokenUsageSchema2,
25727
26351
  consumed_micro_usd: MicroUsdField2.nonnegative(),
@@ -25814,7 +26438,10 @@ var FileSourceTypeSchema2 = external_exports.enum(FILE_SOURCE_TYPES2);
25814
26438
  var FileSourceSchema2 = external_exports.object({
25815
26439
  type: FileSourceTypeSchema2,
25816
26440
  job_id: external_exports.union([idOf2("med"), idOf2("clj")]).nullable(),
25817
- url: external_exports.string().url().nullable()
26441
+ url: external_exports.string().url().nullable(),
26442
+ /** What a generator was asked with (§36.1, ADR-0886); absent on every other writer's row. */
26443
+ model: external_exports.string().nullable().optional(),
26444
+ prompt: external_exports.string().nullable().optional()
25818
26445
  });
25819
26446
  var FileTagsSchema2 = external_exports.array(external_exports.string().min(1).max(64)).max(32);
25820
26447
  var FileLibraryFieldsSchema2 = external_exports.object({
@@ -25857,6 +26484,11 @@ var ComputerSchema2 = external_exports.object({
25857
26484
  browser: BrowserOptionsSchema2.nullable(),
25858
26485
  volume: VolumeSchema2.nullable(),
25859
26486
  snapshot_id: idOf2("snp").nullable(),
26487
+ /**
26488
+ * The agent this computer belongs to (§41.8, ADR-0849); `null` for one made by `POST /v1/computers`.
26489
+ * Defaulted so a reply from an older control plane parses.
26490
+ */
26491
+ agent_id: idOf2("agt").nullable().default(null),
25860
26492
  created_at: Timestamp2
25861
26493
  });
25862
26494
  var SnapshotSchema2 = external_exports.object({
@@ -25965,7 +26597,9 @@ var FileSchema2 = external_exports.object({
25965
26597
  sha256: external_exports.string().regex(/^[0-9a-f]{64}$/),
25966
26598
  created_at: Timestamp2,
25967
26599
  // The asset-library fields (`canonical-spec §36.1`), all nullable or defaulted.
25968
- ...FileLibraryFieldsSchema2.shape
26600
+ ...FileLibraryFieldsSchema2.shape,
26601
+ /** The agent of `session_id`, joined at read (§36.1, ADR-0887); a writer never sets it. */
26602
+ agent_id: idOf2("agt").nullable().optional()
25969
26603
  });
25970
26604
  var ScheduleStatusSchema2 = external_exports.enum(["scheduled", "paused", "unscheduled"]);
25971
26605
  var DeploymentSchema2 = external_exports.object({
@@ -26084,7 +26718,27 @@ var InboundMessageSchema2 = external_exports.object({
26084
26718
  auth: external_exports.record(external_exports.string(), external_exports.string()),
26085
26719
  /** The session this message woke. Null until the wake seam lands (see ADR-0120). */
26086
26720
  session_id: idOf2("ses").nullable(),
26087
- received_at: Timestamp2
26721
+ received_at: Timestamp2,
26722
+ /**
26723
+ * When a person marked it read (`POST …/messages/{mid}/read`); `null` is unread. Defaulted so a
26724
+ * reply from an older control plane parses (ADR-1076).
26725
+ */
26726
+ read_at: Timestamp2.nullable().default(null)
26727
+ });
26728
+ var OutboundMessageSchema2 = external_exports.object({
26729
+ id: idOf2("out"),
26730
+ object: external_exports.literal("outbound_message"),
26731
+ channel: InboundMessageSchema2.shape.channel,
26732
+ identity_id: idOf2("idn"),
26733
+ /** The `eml_` endpoint it was sent from. */
26734
+ endpoint_id: external_exports.string(),
26735
+ from: external_exports.string(),
26736
+ to: external_exports.array(external_exports.string()),
26737
+ subject: external_exports.string().nullable(),
26738
+ text: external_exports.string(),
26739
+ sent_by_agent_id: idOf2("agt").nullable(),
26740
+ actor: PrincipalSchema2.nullable(),
26741
+ sent_at: Timestamp2
26088
26742
  });
26089
26743
  var AppTypeSchema2 = external_exports.enum(["frontend_only", "fullstack"]);
26090
26744
  var AppStatusSchema2 = external_exports.enum(["provisioning", "active", "error"]);
@@ -26159,6 +26813,11 @@ var AppDomainSchema2 = external_exports.object({
26159
26813
  status: AppDomainStatusSchema2,
26160
26814
  created_at: Timestamp2
26161
26815
  });
26816
+ var AppPermissionsSchema2 = external_exports.object({
26817
+ object: external_exports.literal("app_permissions"),
26818
+ app_id: idOf2("app"),
26819
+ scopes: external_exports.array(external_exports.string())
26820
+ });
26162
26821
  var BlueprintInstallSourceSchema2 = external_exports.enum(["studio", "cli"]);
26163
26822
  var BlueprintInstallStatusSchema2 = external_exports.enum(["pending", "applied", "failed"]);
26164
26823
  var ResourceActionSchema2 = external_exports.enum(["created", "updated", "unchanged", "deleted", "refused"]);
@@ -26255,7 +26914,10 @@ var BlueprintInstallSchema2 = external_exports.object({
26255
26914
  */
26256
26915
  report: BlueprintReportSchema2.nullable(),
26257
26916
  status: BlueprintInstallStatusSchema2,
26258
- /** Why a `failed` run threw, in one sentence; `null` on every other row. Never a stack or a key. */
26917
+ /**
26918
+ * Why a `failed` run threw, in one sentence — or, on an `applied` row, which `required` agent or
26919
+ * app the apply refused and why (§29.6). `null` otherwise. Never a stack or a key.
26920
+ */
26259
26921
  failure: external_exports.string().nullable(),
26260
26922
  /**
26261
26923
  * The `selection` the apply carried, or `null` — every row written before §31.2 and every apply
@@ -26369,6 +27031,39 @@ var SocialCommentSchema2 = external_exports.object({
26369
27031
  posted_at: Timestamp2.nullable(),
26370
27032
  data: external_exports.unknown()
26371
27033
  });
27034
+ var POST_STATUSES2 = ["pending", "scheduled", "posted", "failed"];
27035
+ var PostStatusSchema2 = external_exports.enum(POST_STATUSES2);
27036
+ var PostSchema2 = external_exports.object({
27037
+ object: external_exports.literal("post"),
27038
+ id: external_exports.string().min(1),
27039
+ status: PostStatusSchema2,
27040
+ identity_id: external_exports.string().nullable(),
27041
+ agent_id: external_exports.string().nullable(),
27042
+ session_id: external_exports.string().nullable(),
27043
+ tool_call_id: external_exports.string().nullable(),
27044
+ content: external_exports.string().nullable(),
27045
+ platforms: external_exports.array(external_exports.string()),
27046
+ file_ids: external_exports.array(external_exports.string()),
27047
+ media_urls: external_exports.array(external_exports.string()),
27048
+ visibility: SocialVisibilitySchema2.nullable(),
27049
+ scheduled_at: Timestamp2.nullable(),
27050
+ posted_at: Timestamp2.nullable(),
27051
+ url: external_exports.string().nullable(),
27052
+ error: external_exports.string().nullable(),
27053
+ /** The latest stored reading, `{metric: value}`; `null` before `social.post_metrics` read any. */
27054
+ metrics: external_exports.record(external_exports.string(), external_exports.number()).nullable(),
27055
+ measured_at: Timestamp2.nullable(),
27056
+ /** Pending only: the earlier post this call would repeat — same identity, network and file. */
27057
+ duplicate_of: external_exports.object({
27058
+ id: external_exports.string(),
27059
+ status: PostStatusSchema2,
27060
+ platform: external_exports.string(),
27061
+ at: Timestamp2.nullable(),
27062
+ agent_id: external_exports.string().nullable(),
27063
+ session_id: external_exports.string().nullable()
27064
+ }).nullable(),
27065
+ created_at: Timestamp2
27066
+ });
26372
27067
  var BlueprintScheduleSchema2 = external_exports.object({
26373
27068
  agent: external_exports.string().min(1),
26374
27069
  cron: external_exports.string().min(1),
@@ -26400,16 +27095,9 @@ var BlueprintAppSchema2 = external_exports.object({
26400
27095
  /** Whether an install may deselect it (§31.2). Optional: the rollout argument above. */
26401
27096
  required: external_exports.boolean().optional()
26402
27097
  });
26403
- var BlueprintIdentityConnectionsSchema2 = external_exports.object({
26404
- social: external_exports.object({
26405
- from: external_exports.string().min(1),
26406
- map: external_exports.record(external_exports.string().min(1), SocialPlatformSchema2)
26407
- }).optional()
26408
- });
26409
27098
  var BlueprintIdentitySchema2 = external_exports.object({
26410
27099
  name: external_exports.string().min(1),
26411
- description: external_exports.string().nullable(),
26412
- connections: BlueprintIdentityConnectionsSchema2.optional()
27100
+ description: external_exports.string().nullable()
26413
27101
  });
26414
27102
  var ContentHashSchema2 = external_exports.string().regex(/^[0-9a-f]{64}$/, "a lowercase sha-256 hex digest");
26415
27103
  var BlueprintTreeSchema2 = external_exports.object({
@@ -26427,11 +27115,18 @@ var BlueprintArtifactSchema2 = external_exports.object({
26427
27115
  /** The blueprint repository's own released version. Stored, never parsed (ADR-0401). */
26428
27116
  version: external_exports.string().min(1),
26429
27117
  /**
26430
- * The built trees, one per deployable app, ordered as the declaration orders its apps. Never
26431
- * empty: an artifact that built nothing is not an artifact, and the column behind it says so
26432
- * (migration 0040) exactly as the single `content_hash` it replaces was `not null`.
27118
+ * What a person calls the template, one line on what its crew does, and the networks it publishes
27119
+ * to — printed, never provisioned (§31.5, ADR-0921). `platforms` is decoration: where the crew
27120
+ * posts is the accounts connected to its persona. Optional for the §31.5 rollout reason.
26433
27121
  */
26434
- trees: external_exports.array(BlueprintTreeSchema2).min(1),
27122
+ title: external_exports.string().min(1).optional(),
27123
+ description: external_exports.string().min(1).optional(),
27124
+ platforms: external_exports.array(SocialPlatformSchema2).optional(),
27125
+ /**
27126
+ * The built trees, one per deployable app, ordered as the declaration orders its apps. Empty for
27127
+ * a data-only blueprint: it declares no app, builds nothing, and still ships a crew (ADR-0900).
27128
+ */
27129
+ trees: external_exports.array(BlueprintTreeSchema2),
26435
27130
  /**
26436
27131
  * The setup questions, asked by the studio **before** provisioning. `QuestionField` (§7.1) is
26437
27132
  * reused rather than restated: a setup question and a question a parked agent asks are the same
@@ -26536,6 +27231,199 @@ var ChannelPostSchema2 = external_exports.object({
26536
27231
  root_session_id: idOf2("ses"),
26537
27232
  queued: external_exports.boolean()
26538
27233
  });
27234
+ var SHOW_SOURCES2 = ["spend_by_day", "post_views", "roadmap", "schedule"];
27235
+ var ShowSourceSchema2 = external_exports.enum(SHOW_SOURCES2);
27236
+ var ShowArgsSchema2 = external_exports.object({
27237
+ source: ShowSourceSchema2.describe(
27238
+ "What to show: spend_by_day (company spend per day, a line), post_views (views per recent post, bars), roadmap (the board's work by status), schedule (routines and scheduled posts over the next 7 days)."
27239
+ ),
27240
+ days: external_exports.number().int().min(2).max(30).optional().describe("spend_by_day only: days back, today included. Default 14.")
27241
+ });
27242
+ var Day3 = external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/);
27243
+ var Count3 = external_exports.number().int().nonnegative();
27244
+ var head2 = { title: external_exports.string().min(1), as_of: Timestamp2, timezone: external_exports.string().min(1) };
27245
+ var SpendByDayViewSchema2 = external_exports.object({
27246
+ source: external_exports.literal("spend_by_day"),
27247
+ ...head2,
27248
+ days: external_exports.array(external_exports.object({ day: Day3, micro_usd: Count3 })).min(2).max(30)
27249
+ });
27250
+ var PostViewsViewSchema2 = external_exports.object({
27251
+ source: external_exports.literal("post_views"),
27252
+ ...head2,
27253
+ posts: external_exports.array(external_exports.object({ post_id: external_exports.string().min(1), label: external_exports.string(), networks: external_exports.array(external_exports.string()), posted_at: Timestamp2, views: Count3 })).max(12)
27254
+ });
27255
+ var RoadmapViewSchema2 = external_exports.object({
27256
+ source: external_exports.literal("roadmap"),
27257
+ ...head2,
27258
+ groups: external_exports.array(
27259
+ external_exports.object({
27260
+ status: BoardStatusSchema2,
27261
+ count: Count3,
27262
+ cards: external_exports.array(external_exports.object({ title: external_exports.string(), assignee: external_exports.string().nullable(), waits_on: external_exports.array(external_exports.string()) })).max(5)
27263
+ })
27264
+ )
27265
+ });
27266
+ var ScheduleViewSchema2 = external_exports.object({
27267
+ source: external_exports.literal("schedule"),
27268
+ ...head2,
27269
+ days: external_exports.array(
27270
+ external_exports.object({
27271
+ day: Day3,
27272
+ count: Count3,
27273
+ items: external_exports.array(
27274
+ external_exports.discriminatedUnion("kind", [
27275
+ external_exports.object({ kind: external_exports.literal("routine"), at: Timestamp2, agent: external_exports.string(), text: external_exports.string(), runs: external_exports.number().int().min(1).max(100) }),
27276
+ external_exports.object({ kind: external_exports.literal("post"), at: Timestamp2, networks: external_exports.array(external_exports.string()), text: external_exports.string() })
27277
+ ])
27278
+ ).max(8)
27279
+ })
27280
+ ).max(7)
27281
+ });
27282
+ var ShowViewSchema2 = external_exports.discriminatedUnion("source", [
27283
+ SpendByDayViewSchema2,
27284
+ PostViewsViewSchema2,
27285
+ RoadmapViewSchema2,
27286
+ ScheduleViewSchema2
27287
+ ]);
27288
+ var Key2 = external_exports.string().regex(/^[A-Za-z][A-Za-z0-9_-]{0,39}$/, "an element key is a short name: a letter, then letters, digits, - or _");
27289
+ var Count22 = external_exports.number().int().nonnegative();
27290
+ var DIGIT2 = "words only: a digit is refused, because every number on the card is read by code from a $source binding";
27291
+ var words2 = (max) => external_exports.string().trim().min(1).max(max).regex(/^[^0-9]*$/, DIGIT2).refine((text2) => !new RegExp("\\p{N}", "u").test(text2), DIGIT2);
27292
+ var Days2 = external_exports.number().int().min(1).max(30).default(7).describe("The window: today and the days before it, on the company's clock. Default 7.");
27293
+ function bound2(sources2, shape) {
27294
+ const example = JSON.stringify({ $source: sources2[0] });
27295
+ return external_exports.strictObject(
27296
+ { $source: external_exports.enum(sources2), ...shape },
27297
+ { error: (issue2) => issue2.code === "invalid_type" ? `must be a binding such as ${example}: a literal value is refused, code reads every number` : void 0 }
27298
+ );
27299
+ }
27300
+ var Bound2 = {
27301
+ value: bound2(["views_total", "spend_total"], { days: Days2 }).describe(
27302
+ "views_total: the latest views of the posts published in the window. spend_total: the company's spend in the window (the CEO only)."
27303
+ ),
27304
+ delta: bound2(["views_change"], {}).describe(
27305
+ "views_change: the value's views_total against the same number of days before it, as a percentage. Its window is the value's."
27306
+ ),
27307
+ series: bound2(["spend_by_day"], { days: external_exports.number().int().min(2).max(30).default(14) }).describe("spend_by_day: the company's spend per day (the CEO only)."),
27308
+ bars: bound2(["post_views"], { limit: external_exports.number().int().min(1).max(12).default(5).describe("How many posts, newest first. Default 5.") }).describe(
27309
+ "post_views: each recent post's latest views, newest first."
27310
+ ),
27311
+ progress: bound2(["posts_this_week"], {}).describe("posts_this_week: posts published since Monday against the weekly cadence from the company's setup."),
27312
+ board: bound2(["roadmap"], {}).describe("roadmap: the board's work by status."),
27313
+ week: bound2(["schedule"], {}).describe("schedule: routines and scheduled posts over the next 7 days."),
27314
+ media: external_exports.union([bound2(["latest_media"], { count: external_exports.number().int().min(1).max(4).default(1) }), external_exports.array(idOf2("fil")).min(1).max(4)]).describe('{"$source":"latest_media","count":1} for the newest posted pictures or clips, or up to 4 fil_ ids.')
27315
+ };
27316
+ var SpendDay2 = external_exports.strictObject({ day: external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/), micro_usd: Count22 });
27317
+ var Resolved2 = {
27318
+ value: external_exports.discriminatedUnion("$source", [
27319
+ external_exports.strictObject({ $source: external_exports.literal("views_total"), days: external_exports.number().int(), value: Count22, posts: Count22 }),
27320
+ external_exports.strictObject({ $source: external_exports.literal("spend_total"), days: external_exports.number().int(), value: Count22 })
27321
+ ]),
27322
+ delta: external_exports.strictObject({ $source: external_exports.literal("views_change"), days: external_exports.number().int(), current: Count22, previous: Count22 }),
27323
+ series: external_exports.strictObject({ $source: external_exports.literal("spend_by_day"), days: external_exports.number().int(), points: external_exports.array(SpendDay2).min(2).max(30) }),
27324
+ bars: external_exports.strictObject({ $source: external_exports.literal("post_views"), limit: external_exports.number().int(), posts: PostViewsViewSchema2.shape.posts }),
27325
+ progress: external_exports.strictObject({ $source: external_exports.literal("posts_this_week"), value: Count22, max: external_exports.number().int().positive(), cadence: external_exports.string() }),
27326
+ board: external_exports.strictObject({ $source: external_exports.literal("roadmap"), groups: RoadmapViewSchema2.shape.groups }),
27327
+ week: external_exports.strictObject({ $source: external_exports.literal("schedule"), days: ScheduleViewSchema2.shape.days }),
27328
+ media: external_exports.array(external_exports.strictObject({ id: idOf2("fil"), kind: external_exports.enum(["image", "video"]) })).min(1).max(4)
27329
+ };
27330
+ var box2 = { children: external_exports.array(Key2).min(1).max(12) };
27331
+ var leaf2 = { children: external_exports.array(Key2).max(0).optional() };
27332
+ var label2 = words2(40).optional();
27333
+ var element2 = (type, props, children, about) => external_exports.strictObject({ type: external_exports.literal(type), props: external_exports.strictObject(props), ...children }).describe(about);
27334
+ function catalog2(slot) {
27335
+ return {
27336
+ Card: element2("Card", { title: words2(60) }, box2, "The card, with a short title. It is the root, and only the root."),
27337
+ Stack: element2("Stack", {}, box2, "Children one under another."),
27338
+ Grid: element2("Grid", { columns: external_exports.literal([1, 2, 3]) }, box2, "Children side by side, 1 to 3 columns."),
27339
+ Metric: element2("Metric", { label: words2(40), value: slot.value, delta: slot.delta.optional() }, leaf2, "One big number with a label, and optionally its change."),
27340
+ LineChart: element2("LineChart", { label: label2, series: slot.series }, leaf2, "A line over days."),
27341
+ BarList: element2("BarList", { label: label2, bars: slot.bars }, leaf2, "One bar per post."),
27342
+ Progress: element2("Progress", { label: words2(40), progress: slot.progress }, leaf2, "A value against its goal, as a bar."),
27343
+ Roadmap: element2("Roadmap", { label: label2, board: slot.board }, leaf2, "The board grouped by status."),
27344
+ Schedule: element2("Schedule", { label: label2, week: slot.week }, leaf2, "The week ahead, day by day."),
27345
+ Media: element2("Media", { label: label2, files: slot.media }, leaf2, "Pictures or clips the company holds."),
27346
+ Text: element2("Text", { text: words2(240) }, leaf2, "A short note in words.")
27347
+ };
27348
+ }
27349
+ var unknownComponent2 = (names2) => ({
27350
+ error: (issue2) => issue2.code === "invalid_union" ? `unknown component: use one of ${names2.join(", ")}` : void 0
27351
+ });
27352
+ function tree2(rootType, max, spec22, ctx) {
27353
+ const refuse2 = (message4, path = []) => ctx.addIssue({ code: "custom", message: message4, path });
27354
+ const keys22 = Object.keys(spec22.elements);
27355
+ const has = (key2) => Object.hasOwn(spec22.elements, key2);
27356
+ if (keys22.length > max) return refuse2(`at most ${max} elements`, ["elements"]);
27357
+ const root = has(spec22.root) ? spec22.elements[spec22.root] : void 0;
27358
+ if (!root) return refuse2(`root names "${spec22.root}", which is not in elements`, ["root"]);
27359
+ if (root.type !== rootType) return refuse2(`the root must be a ${rootType}`, ["root"]);
27360
+ const parent = /* @__PURE__ */ new Map();
27361
+ for (const key2 of keys22) {
27362
+ for (const child of spec22.elements[key2].children ?? []) {
27363
+ if (!has(child)) return refuse2(`"${child}" is not in elements`, ["elements", key2, "children"]);
27364
+ if (child === spec22.root || parent.has(child)) return refuse2(`"${child}" has more than one parent`, ["elements", key2, "children"]);
27365
+ if (spec22.elements[child].type === rootType) return refuse2(`a ${rootType} is the root only; group with Stack or Grid`, ["elements", child, "type"]);
27366
+ parent.set(child, key2);
27367
+ }
27368
+ }
27369
+ const reached = /* @__PURE__ */ new Set([spec22.root]);
27370
+ for (const key2 of reached) for (const child of spec22.elements[key2].children ?? []) reached.add(child);
27371
+ const lost = keys22.find((key2) => !reached.has(key2));
27372
+ if (lost) refuse2(`"${lost}" is not under the root`, ["elements", lost]);
27373
+ }
27374
+ var spec2 = (element22, rootType, max) => external_exports.strictObject({ root: Key2, elements: external_exports.record(Key2, element22) }).superRefine((value, ctx) => tree2(rootType, max, value, ctx));
27375
+ var COMPOSE_COMPONENTS2 = ["Card", "Stack", "Grid", "Metric", "LineChart", "BarList", "Progress", "Roadmap", "Schedule", "Media", "Text"];
27376
+ var MAX_COMPOSE_ELEMENTS2 = 24;
27377
+ var BoundComponents2 = catalog2(Bound2);
27378
+ var ComposeSpecSchema2 = spec2(
27379
+ external_exports.discriminatedUnion(
27380
+ "type",
27381
+ [
27382
+ BoundComponents2.Card,
27383
+ BoundComponents2.Stack,
27384
+ BoundComponents2.Grid,
27385
+ BoundComponents2.Metric,
27386
+ BoundComponents2.LineChart,
27387
+ BoundComponents2.BarList,
27388
+ BoundComponents2.Progress,
27389
+ BoundComponents2.Roadmap,
27390
+ BoundComponents2.Schedule,
27391
+ BoundComponents2.Media,
27392
+ BoundComponents2.Text
27393
+ ],
27394
+ unknownComponent2(COMPOSE_COMPONENTS2)
27395
+ ),
27396
+ "Card",
27397
+ MAX_COMPOSE_ELEMENTS2
27398
+ );
27399
+ var ComposeArgsSchema2 = external_exports.object({
27400
+ spec: ComposeSpecSchema2.describe(
27401
+ 'A json-render spec: { "root": key, "elements": { key: { "type", "props", "children"? } } }. The root is one Card.'
27402
+ )
27403
+ });
27404
+ var ComposedComponents2 = catalog2(Resolved2);
27405
+ var ComposedSpecSchema2 = spec2(
27406
+ external_exports.discriminatedUnion(
27407
+ "type",
27408
+ [
27409
+ ComposedComponents2.Card,
27410
+ ComposedComponents2.Stack,
27411
+ ComposedComponents2.Grid,
27412
+ ComposedComponents2.Metric,
27413
+ ComposedComponents2.LineChart,
27414
+ ComposedComponents2.BarList,
27415
+ ComposedComponents2.Progress,
27416
+ ComposedComponents2.Roadmap,
27417
+ ComposedComponents2.Schedule,
27418
+ ComposedComponents2.Media,
27419
+ ComposedComponents2.Text
27420
+ ],
27421
+ unknownComponent2(COMPOSE_COMPONENTS2)
27422
+ ),
27423
+ "Card",
27424
+ MAX_COMPOSE_ELEMENTS2
27425
+ );
27426
+ var ComposedSchema2 = external_exports.object({ as_of: Timestamp2, timezone: external_exports.string().min(1), spec: ComposedSpecSchema2 });
26539
27427
  var MEDIA_MODEL_KINDS2 = ["image", "video", "stt", "tts", "s2s"];
26540
27428
  var MEDIA_JOB_KINDS2 = ["video", "clip", "transcription"];
26541
27429
  var MediaJobKindSchema2 = external_exports.enum(MEDIA_JOB_KINDS2);
@@ -26603,9 +27491,12 @@ var ImageRequestSchema2 = external_exports.object({
26603
27491
  n: external_exports.number().int().min(1).max(4).default(1)
26604
27492
  });
26605
27493
  var VideoRequestSchema2 = external_exports.object({
26606
- model: external_exports.string().min(1),
27494
+ /** Omitted: the platform's video default while the catalogue publishes it (`resolveModel`, §33.2). */
27495
+ model: external_exports.string().min(1).optional(),
26607
27496
  prompt: external_exports.string().min(1),
26608
27497
  image_urls: external_exports.array(PublicUrl2).max(1).optional(),
27498
+ /** The source clip of a video-to-video edit (ADR-0814). */
27499
+ video_url: PublicUrl2.optional(),
26609
27500
  aspect_ratio: external_exports.string().optional(),
26610
27501
  seed: external_exports.number().int().optional(),
26611
27502
  seconds: external_exports.number().int().min(1).max(60).optional()
@@ -26891,18 +27782,18 @@ var ReferralClickSchema2 = external_exports.object({
26891
27782
  creator: external_exports.object({ display_name: external_exports.string().min(1) }),
26892
27783
  expires_at: Timestamp2
26893
27784
  });
26894
- var Day2 = external_exports.iso.date();
27785
+ var Day22 = external_exports.iso.date();
26895
27786
  var CreatorAnalyticsSchema2 = external_exports.object({
26896
27787
  object: external_exports.literal("creator_analytics"),
26897
27788
  days: external_exports.number().int().min(1).max(90),
26898
- from: Day2,
26899
- to: Day2,
27789
+ from: Day22,
27790
+ to: Day22,
26900
27791
  clicks: external_exports.number().int().nonnegative(),
26901
27792
  referrals: external_exports.number().int().nonnegative(),
26902
27793
  installs: external_exports.number().int().nonnegative(),
26903
27794
  active_installs: external_exports.number().int().nonnegative(),
26904
27795
  usage_by_day: external_exports.array(
26905
- external_exports.object({ day: Day2, debit_micro_usd: MicroUsdField2.nonnegative() })
27796
+ external_exports.object({ day: Day22, debit_micro_usd: MicroUsdField2.nonnegative() })
26906
27797
  ),
26907
27798
  commission_micro_usd: external_exports.object({
26908
27799
  pending: MicroUsdField2.nonnegative(),
@@ -26917,7 +27808,7 @@ var CreatorAnalyticsSchema2 = external_exports.object({
26917
27808
  })
26918
27809
  ),
26919
27810
  /** Every install covered, newest first: the day it was created and the day its twelve months end. */
26920
- install_windows: external_exports.array(external_exports.object({ install_id: idOf2("bpi"), from: Day2, until: Day2 }))
27811
+ install_windows: external_exports.array(external_exports.object({ install_id: idOf2("bpi"), from: Day22, until: Day22 }))
26921
27812
  });
26922
27813
  var LEGAL_MEMBER_STATUSES2 = [
26923
27814
  "pending",
@@ -27348,6 +28239,151 @@ var CreateReviewSchema2 = external_exports.object({
27348
28239
  before: Fields2,
27349
28240
  after: Fields2
27350
28241
  });
28242
+ var PAGE_BLOCKS2 = [
28243
+ "Page",
28244
+ "Section",
28245
+ "Stack",
28246
+ "Grid",
28247
+ "Metric",
28248
+ "LineChart",
28249
+ "BarList",
28250
+ "Progress",
28251
+ "Roadmap",
28252
+ "Schedule",
28253
+ "Media",
28254
+ "Text",
28255
+ "Needs",
28256
+ "Activity",
28257
+ "Accounts",
28258
+ "Posts",
28259
+ "Answers",
28260
+ "MediaLibrary"
28261
+ ];
28262
+ var MAX_PAGE_ELEMENTS2 = 48;
28263
+ var MINI_APP_ICONS2 = ["grid", "list", "chart", "calendar", "play"];
28264
+ var MiniAppIconSchema2 = external_exports.enum(MINI_APP_ICONS2);
28265
+ var SLUG2 = "[a-z][a-z0-9-]{0,39}";
28266
+ var MiniAppSlugSchema2 = external_exports.string().regex(new RegExp(`^${SLUG2}$`), "a slug is lowercase letters, digits and -");
28267
+ var Place2 = external_exports.string().regex(new RegExp(`^/(board|connections|apps/${SLUG2}(\\?page=${SLUG2})?)$`), "a section links to /board, /connections or /apps/<slug>[?page=<slug>]");
28268
+ var POSTS2 = ["waiting", "scheduled", "posted"];
28269
+ var PostStatus2 = external_exports.enum(POSTS2);
28270
+ var PostLayout2 = external_exports.enum(["list", "row", "grid"]);
28271
+ var PostStatuses2 = external_exports.union([PostStatus2, external_exports.array(PostStatus2).min(1).max(3).refine((all) => new Set(all).size === all.length, "each status once")]);
28272
+ var PageBound2 = {
28273
+ ...Bound2,
28274
+ board: bound2(["roadmap"], { per_group: external_exports.number().int().min(1).max(5).default(5) }),
28275
+ media: bound2(["latest_media", "newest_media"], { count: external_exports.number().int().min(1).max(6).default(4) })
28276
+ };
28277
+ var PageResolved2 = {
28278
+ ...Resolved2,
28279
+ board: external_exports.strictObject({ $source: external_exports.literal("roadmap"), per_group: external_exports.number().int(), groups: RoadmapViewSchema2.shape.groups }),
28280
+ media: external_exports.array(external_exports.strictObject({ id: external_exports.string(), kind: external_exports.enum(["image", "video"]) })).max(6)
28281
+ };
28282
+ function pageBlocks2(slot) {
28283
+ return {
28284
+ Page: element2("Page", {}, box2, "The page itself, the root and only the root."),
28285
+ Section: element2("Section", { title: words2(40), to: Place2.optional(), hide_empty: external_exports.boolean().optional() }, box2, "A titled part of the page; hidden when every block in it is empty, if asked."),
28286
+ Needs: element2("Needs", { label: label2, needs: slot.needs }, leaf2, "What waits on a person: approvals, questions, spent caps."),
28287
+ Activity: element2("Activity", { label: label2, agents: slot.agents }, leaf2, "The agents working or waiting, and on what."),
28288
+ Accounts: element2("Accounts", { accounts: slot.accounts }, leaf2, "The template's networks: connected with a handle, or not."),
28289
+ Posts: element2(
28290
+ "Posts",
28291
+ { label: label2, layout: PostLayout2.optional(), posts: slot.posts },
28292
+ leaf2,
28293
+ "Posts waiting on a person, scheduled, or posted; several statuses make one list. Drawn as rows (list, the default), one sideways row of cards (row), or a picture grid (grid)."
28294
+ ),
28295
+ Answers: element2("Answers", { answers: slot.answers }, leaf2, "The setup's answers in one line, linking to the setup."),
28296
+ // No binding: the studio's gallery reads and pages the company's files itself (ADR-0987).
28297
+ MediaLibrary: element2("MediaLibrary", {}, leaf2, "Every picture and clip the company's agents made, with filters, sort and a viewer.")
28298
+ };
28299
+ }
28300
+ var OwnBound2 = pageBlocks2({
28301
+ needs: bound2(["needs"], {}),
28302
+ agents: bound2(["agents_activity"], {}),
28303
+ accounts: bound2(["accounts"], {}),
28304
+ posts: bound2(["posts"], { status: PostStatuses2, limit: external_exports.number().int().min(1).max(50).default(10) }),
28305
+ answers: bound2(["answers"], { keys: external_exports.array(Key2).min(1).max(TEMPLATE_QUESTIONS_MAX2) })
28306
+ });
28307
+ var Need2 = external_exports.object({
28308
+ session_id: external_exports.string(),
28309
+ agent_id: external_exports.string(),
28310
+ agent: external_exports.string(),
28311
+ since: Timestamp2,
28312
+ /** The chat's stored title, or `null`: the studio names it by when it began. */
28313
+ title: external_exports.string().nullable(),
28314
+ kind: external_exports.enum(["tool", "question", "budget"]),
28315
+ /** The call or question it is held on; `null` for a spent cap. */
28316
+ action: PendingActionSchema2.nullable()
28317
+ });
28318
+ var Working2 = external_exports.object({
28319
+ agent_id: external_exports.string(),
28320
+ agent: external_exports.string(),
28321
+ state: external_exports.enum(["working", "waiting"]),
28322
+ session_id: external_exports.string().nullable(),
28323
+ title: external_exports.string().nullable(),
28324
+ at: Timestamp2
28325
+ });
28326
+ var OwnResolved2 = pageBlocks2({
28327
+ needs: external_exports.strictObject({ $source: external_exports.literal("needs"), items: external_exports.array(Need2) }),
28328
+ agents: external_exports.strictObject({ $source: external_exports.literal("agents_activity"), agents: external_exports.array(Working2) }),
28329
+ accounts: external_exports.strictObject({
28330
+ $source: external_exports.literal("accounts"),
28331
+ accounts: external_exports.array(external_exports.object({ platform: SocialPlatformSchema2, connected: external_exports.boolean(), handle: external_exports.string().nullable() }))
28332
+ }),
28333
+ posts: external_exports.strictObject({ $source: external_exports.literal("posts"), status: external_exports.union([PostStatus2, external_exports.array(PostStatus2)]), limit: external_exports.number().int(), posts: external_exports.array(PostSchema2), more: external_exports.boolean() }),
28334
+ answers: external_exports.strictObject({
28335
+ $source: external_exports.literal("answers"),
28336
+ keys: external_exports.array(external_exports.string()),
28337
+ values: external_exports.array(external_exports.string()),
28338
+ template: external_exports.object({ blueprint: external_exports.string(), template: external_exports.string() }).nullable()
28339
+ })
28340
+ });
28341
+ var BoundBlocks2 = { ...catalog2(PageBound2), ...OwnBound2 };
28342
+ var ResolvedBlocks2 = { ...catalog2(PageResolved2), ...OwnResolved2 };
28343
+ var Unread2 = element2("Unread", { of: external_exports.string(), label: external_exports.string().nullable(), reason: external_exports.string() }, leaf2, "A block that could not be read.");
28344
+ var B2 = BoundBlocks2;
28345
+ var PageSpecSchema2 = spec2(
28346
+ external_exports.discriminatedUnion(
28347
+ "type",
28348
+ [B2.Page, B2.Section, B2.Stack, B2.Grid, B2.Metric, B2.LineChart, B2.BarList, B2.Progress, B2.Roadmap, B2.Schedule, B2.Media, B2.Text, B2.Needs, B2.Activity, B2.Accounts, B2.Posts, B2.Answers, B2.MediaLibrary],
28349
+ unknownComponent2(PAGE_BLOCKS2)
28350
+ ),
28351
+ "Page",
28352
+ MAX_PAGE_ELEMENTS2
28353
+ );
28354
+ var R2 = ResolvedBlocks2;
28355
+ var ResolvedPageElementSchema2 = external_exports.discriminatedUnion(
28356
+ "type",
28357
+ [R2.Page, R2.Section, R2.Stack, R2.Grid, R2.Metric, R2.LineChart, R2.BarList, R2.Progress, R2.Roadmap, R2.Schedule, R2.Media, R2.Text, R2.Needs, R2.Activity, R2.Accounts, R2.Posts, R2.Answers, R2.MediaLibrary, Unread2],
28358
+ unknownComponent2(PAGE_BLOCKS2)
28359
+ );
28360
+ var ResolvedPageSpecSchema2 = spec2(ResolvedPageElementSchema2, "Page", MAX_PAGE_ELEMENTS2);
28361
+ var unique2 = (items) => new Set(items.map((item) => item.slug)).size === items.length;
28362
+ var MiniAppPageSchema2 = external_exports.strictObject({ slug: MiniAppSlugSchema2, title: words2(24), spec: PageSpecSchema2 });
28363
+ var MiniAppDeclSchema2 = external_exports.strictObject({
28364
+ slug: MiniAppSlugSchema2,
28365
+ name: words2(40),
28366
+ icon: MiniAppIconSchema2,
28367
+ pages: external_exports.array(MiniAppPageSchema2).min(1).max(6).refine(unique2, "each page's slug is its own")
28368
+ });
28369
+ var MiniAppDeclsSchema2 = external_exports.array(MiniAppDeclSchema2).max(8).refine(unique2, "each mini app's slug is its own");
28370
+ var MiniAppSummarySchema2 = external_exports.object({
28371
+ object: external_exports.literal("mini_app"),
28372
+ slug: MiniAppSlugSchema2,
28373
+ name: external_exports.string(),
28374
+ icon: MiniAppIconSchema2,
28375
+ pages: external_exports.array(external_exports.object({ slug: MiniAppSlugSchema2, title: external_exports.string() })).min(1),
28376
+ /** What it reads (`miniAppReads`). Absent from an older API: the Studio then claims nothing it cannot see. */
28377
+ reads: external_exports.array(external_exports.string()).optional()
28378
+ });
28379
+ var MiniAppSchema2 = MiniAppSummarySchema2.extend({
28380
+ networks: external_exports.array(external_exports.object({ platform: SocialPlatformSchema2, connected: external_exports.boolean().nullable() })),
28381
+ page: MiniAppSlugSchema2,
28382
+ as_of: Timestamp2,
28383
+ timezone: external_exports.string().min(1),
28384
+ spec: ResolvedPageSpecSchema2
28385
+ });
28386
+ var MAX_BYTES2 = 16 * 1024;
27351
28387
  var encoder22 = new TextEncoder();
27352
28388
  var SESSION_FILE_URL_TTL_MS2 = 15 * 6e4;
27353
28389
  var MUTATING = /* @__PURE__ */ new Set(["POST", "PATCH", "PUT", "DELETE"]);
@@ -27541,6 +28577,7 @@ var orgs = (config2) => ({
27541
28577
  /** Creates a new organization and answers a working key for it, secret shown once (§20.3). */
27542
28578
  create: (body2) => request(config2, CreatedOrganizationSchema, { method: "POST", path: "/v1/organizations", body: body2 }),
27543
28579
  get: (id) => request(config2, OrganizationSchema2, { method: "GET", path: `/v1/organizations/${id}` }),
28580
+ /** A rename, a new timezone (IANA, §20.6), a logo (SVG, §20.7; `null` clears it), or any together. */
27544
28581
  update: (id, body2) => request(config2, OrganizationSchema2, { method: "PATCH", path: `/v1/organizations/${id}`, body: body2 }),
27545
28582
  members: (id, query = {}) => request(config2, page(MemberSchema2), {
27546
28583
  method: "GET",
@@ -27666,6 +28703,8 @@ var apps = (config2) => ({
27666
28703
  * thirty days of `/api/*`. Rotating is revoking, and it signs out every browser already signed
27667
28704
  * in. Hand the value to a person; never put it in a URL or a log.
27668
28705
  */
28706
+ /** What the app's own key lets it do with Naive: its scopes, never the key (§29.10, ADR-1048). */
28707
+ permissions: (id) => request(config2, AppPermissionsSchema2, { method: "GET", path: `/v1/apps/${id}/permissions` }),
27669
28708
  access: (id) => request(config2, AppAccessSchema2, { method: "GET", path: `/v1/apps/${id}/access` }),
27670
28709
  rotateAccess: (id) => request(config2, AppAccessSchema2, { method: "POST", path: `/v1/apps/${id}/access` }),
27671
28710
  /** The domain must already exist at `/v1/domains`; connecting is pointing, never registering. */
@@ -27717,9 +28756,12 @@ var apps = (config2) => ({
27717
28756
  * artifact is what is applied and the install is the record that it was. `blueprint` and
27718
28757
  * `template` narrow it, and an apply of one of these rows sends that pair in place of a
27719
28758
  * declaration it was never given.
28759
+ *
28760
+ * The page is parsed leniently (`tolerantPage`): a row this build cannot read — a data-only
28761
+ * blueprint's empty `trees` (ADR-0900) met a build that required one — is skipped, not thrown.
27720
28762
  */
27721
28763
  artifacts: {
27722
- list: (query = {}) => request(config2, page(BlueprintArtifactSchema2), {
28764
+ list: (query = {}) => request(config2, tolerantPage(BlueprintArtifactSchema2), {
27723
28765
  method: "GET",
27724
28766
  path: "/v1/blueprints/artifacts",
27725
28767
  query
@@ -27994,6 +29036,18 @@ var emails = (config2) => ({
27994
29036
  method: "GET",
27995
29037
  path: `/v1/identities/${identityId}/messages`,
27996
29038
  query
29039
+ }),
29040
+ /** Mark one arrived message read or unread; a message already read keeps its first time. */
29041
+ markRead: (identityId, messageId, read) => request(config2, InboundMessageSchema2, {
29042
+ method: "POST",
29043
+ path: `/v1/identities/${identityId}/messages/${messageId}/read`,
29044
+ body: { read }
29045
+ }),
29046
+ /** What the persona sent, newest first — through the API and through its agent alike. */
29047
+ sent: (identityId, query = {}) => request(config2, page(OutboundMessageSchema2), {
29048
+ method: "GET",
29049
+ path: `/v1/identities/${identityId}/sent`,
29050
+ query
27997
29051
  })
27998
29052
  });
27999
29053
  var phones = (config2) => ({
@@ -28227,6 +29281,8 @@ var agents = (config2) => ({
28227
29281
  rollback: (id, body2) => request(config2, AgentSchema2, { method: "POST", path: `/v1/agents/${id}/rollback`, body: body2 }),
28228
29282
  /** Metered spend for the agent's current budget period; `by: "component"` adds the breakdown. */
28229
29283
  spend: (id, query = {}) => request(config2, AgentSpendSchema, { method: "GET", path: `/v1/agents/${id}/spend`, query }),
29284
+ /** The agent's one computer (§41.8), or `null` before any session has needed one. */
29285
+ computer: (id) => request(config2, ComputerSchema2.nullable(), { method: "GET", path: `/v1/agents/${id}/computer` }),
28230
29286
  delete: (id) => request(config2, DeletedSchema, { method: "DELETE", path: `/v1/agents/${id}` })
28231
29287
  });
28232
29288
  var models = (config2) => ({
@@ -28313,7 +29369,9 @@ var sessions = (config2) => ({
28313
29369
  get: (id) => request(config2, SessionSchema2, { method: "GET", path: `/v1/sessions/${id}` }),
28314
29370
  /**
28315
29371
  * `interrupt:true` steers a running session; `queue:true` holds the message for the turn after
28316
- * this one; neither, a running session is `session_running` (§7).
29372
+ * this one; neither, a running session is `session_running` (§7). `model` runs the session on that
29373
+ * catalogue id from this message's turn on. `mode: "plan"` runs it read-only until the person
29374
+ * approves the plan; `"build"` leaves plan mode (§7.5).
28317
29375
  */
28318
29376
  send: (id, body2, opts = {}) => request(config2, SendAcceptedSchema2, {
28319
29377
  method: "POST",
@@ -28331,6 +29389,7 @@ var sessions = (config2) => ({
28331
29389
  /**
28332
29390
  * `scope: "session"` turns an `allow` into a grant: that TOOL NAME runs without a card for the
28333
29391
  * rest of this session, and nothing else does. Omitted — the default — is one call, one decision.
29392
+ * `answers` on an allow of a template install runs it with the person's own answers (ADR-1030).
28334
29393
  */
28335
29394
  confirmTool: (id, body2) => request(config2, SessionSchema2, {
28336
29395
  method: "POST",
@@ -28350,6 +29409,10 @@ var sessions = (config2) => ({
28350
29409
  path: `/v1/sessions/${id}/budget`,
28351
29410
  body: { cap_micro_usd: capMicroUsd }
28352
29411
  }),
29412
+ /** The session's living plan (§7.5): version 0 and empty until one is written. */
29413
+ plan: (id) => request(config2, PlanSchema2, { method: "GET", path: `/v1/sessions/${id}/plan` }),
29414
+ /** The owner's edit, a compare-and-set: a stale `base_version` is `version_conflict` (409). */
29415
+ writePlan: (id, body2) => request(config2, PlanSchema2, { method: "PUT", path: `/v1/sessions/${id}/plan`, body: body2 }),
28353
29416
  /**
28354
29417
  * The sessions this one delegated to (`canonical-spec §28.5`). A thread is a session, so every
28355
29418
  * method above works on one by its own id; delegated children are kept out of `list`, which is
@@ -28697,21 +29760,31 @@ var publishing = (config2) => ({
28697
29760
  path: `/v1/identities/${identity3}/social/posts`,
28698
29761
  body: body2
28699
29762
  }),
28700
- getPost: (identity3, post) => request(config2, SocialPostSchema2, {
29763
+ getPost: (identity3, post2) => request(config2, SocialPostSchema2, {
28701
29764
  method: "GET",
28702
- path: `/v1/identities/${identity3}/social/posts/${post}`
29765
+ path: `/v1/identities/${identity3}/social/posts/${post2}`
28703
29766
  }),
28704
- deletePost: (identity3, post) => request(config2, DeletedSchema, {
29767
+ deletePost: (identity3, post2) => request(config2, DeletedSchema, {
28705
29768
  method: "DELETE",
28706
- path: `/v1/identities/${identity3}/social/posts/${post}`
29769
+ path: `/v1/identities/${identity3}/social/posts/${post2}`
29770
+ }),
29771
+ postAnalytics: (identity3, post2) => request(config2, SocialAnalyticsSchema2, {
29772
+ method: "GET",
29773
+ path: `/v1/identities/${identity3}/social/posts/${post2}/analytics`
28707
29774
  }),
28708
- postAnalytics: (identity3, post) => request(config2, SocialAnalyticsSchema2, {
29775
+ /**
29776
+ * `GET /v1/posts` — every post the company files, across identities and sessions (§27.1): the
29777
+ * `social.post` calls waiting on a person (`pending`), and the ones sent, with their latest numbers.
29778
+ * `reconcile: false` lists what is stored without asking the provider about due posts first.
29779
+ */
29780
+ listPosts: ({ reconcile, ...query } = {}) => request(config2, page(PostSchema2), {
28709
29781
  method: "GET",
28710
- path: `/v1/identities/${identity3}/social/posts/${post}/analytics`
29782
+ path: "/v1/posts",
29783
+ query: { ...query, ...reconcile === void 0 ? {} : { reconcile: String(reconcile) } }
28711
29784
  }),
28712
- comments: (identity3, post, query = {}) => request(config2, page(SocialCommentSchema2), {
29785
+ comments: (identity3, post2, query = {}) => request(config2, page(SocialCommentSchema2), {
28713
29786
  method: "GET",
28714
- path: `/v1/identities/${identity3}/social/posts/${post}/comments`,
29787
+ path: `/v1/identities/${identity3}/social/posts/${post2}/comments`,
28715
29788
  query
28716
29789
  })
28717
29790
  });
@@ -28917,6 +29990,9 @@ var computers = (config2) => ({
28917
29990
  /** Paused bills storage only — the first efficiency lever (`memory/context.md`). */
28918
29991
  pause: (id) => request(config2, ComputerSchema2, { method: "POST", path: `/v1/computers/${id}/pause`, body: {} }),
28919
29992
  resume: (id) => request(config2, ComputerSchema2, { method: "POST", path: `/v1/computers/${id}/resume`, body: {} }),
29993
+ /** An agent's computer only (§41.8): a person holds it, and its sessions wait until it is handed back. */
29994
+ takeOver: (id) => request(config2, ComputerSchema2, { method: "POST", path: `/v1/computers/${id}/takeover`, body: {} }),
29995
+ handBack: (id) => request(config2, ComputerSchema2, { method: "DELETE", path: `/v1/computers/${id}/takeover` }),
28920
29996
  snapshot: (id) => request(config2, SnapshotSchema2, {
28921
29997
  method: "POST",
28922
29998
  path: `/v1/computers/${id}/snapshot`,
@@ -29025,6 +30101,11 @@ var vaults = (config2) => ({
29025
30101
  })
29026
30102
  }
29027
30103
  });
30104
+ var MiniAppList = external_exports.object({ data: external_exports.array(MiniAppSummarySchema2), has_more: external_exports.boolean(), next_cursor: external_exports.string().nullable() });
30105
+ var miniApps = (config2) => ({
30106
+ list: () => request(config2, MiniAppList, { method: "GET", path: "/v1/mini-apps" }),
30107
+ get: (slug, page2) => request(config2, MiniAppSchema2, { method: "GET", path: `/v1/mini-apps/${encodeURIComponent(slug)}`, ...page2 ? { query: { page: page2 } } : {} })
30108
+ });
29028
30109
  function withTool(tools2, name, settings) {
29029
30110
  if (!isToolName2(name)) {
29030
30111
  throw new TypeError(
@@ -29057,6 +30138,7 @@ function createClient(config2) {
29057
30138
  // core-gaps: U9-storage
29058
30139
  storage: storage(config2),
29059
30140
  vaults: vaults(config2),
30141
+ miniApps: miniApps(config2),
29060
30142
  domains: domains(config2),
29061
30143
  emails: emails(config2),
29062
30144
  phones: phones(config2),
@@ -29555,7 +30637,9 @@ var agent = {
29555
30637
  * only the persona side was, so "what can this agent send as?" had no command.
29556
30638
  */
29557
30639
  identities: async ({ client, args }) => ({ out: await client.identities.held(args.at(0, "agent-id")) }),
29558
- delete: async ({ client, args }) => ({ out: await client.agents.delete(args.at(0, "agent-id")) })
30640
+ delete: async ({ client, args }) => ({ out: await client.agents.delete(args.at(0, "agent-id")) }),
30641
+ /** The agent's one computer (§41.8), or `null` before any session has needed one. */
30642
+ computer: async ({ client, args }) => ({ out: await client.agents.computer(args.at(0, "agent-id")) })
29559
30643
  };
29560
30644
 
29561
30645
  // ../../packages/blueprints/dist/index.js
@@ -29576,9 +30660,9 @@ var ALPHABET3 = "0123456789abcdefghjkmnpqrstvwxyz";
29576
30660
  var SUFFIX_LENGTH3 = 26;
29577
30661
  var SUFFIX_PATTERN3 = new RegExp(`^[${ALPHABET3}]{${SUFFIX_LENGTH3},}$`);
29578
30662
  function isId3(prefix, value) {
29579
- const head = `${prefix}_`;
29580
- if (!value.startsWith(head)) return false;
29581
- return SUFFIX_PATTERN3.test(value.slice(head.length).toLowerCase());
30663
+ const head22 = `${prefix}_`;
30664
+ if (!value.startsWith(head22)) return false;
30665
+ return SUFFIX_PATTERN3.test(value.slice(head22.length).toLowerCase());
29582
30666
  }
29583
30667
  var CODES2 = {
29584
30668
  window_unavailable: ["invalid_request", 400],
@@ -29586,6 +30670,8 @@ var CODES2 = {
29586
30670
  unauthorized: ["authentication", 401],
29587
30671
  forbidden: ["permission", 403],
29588
30672
  not_found: ["not_found", 404],
30673
+ /** The path exists; the method does not. The response carries `Allow` (§3). */
30674
+ method_not_allowed: ["invalid_request", 405],
29589
30675
  budget_exceeded: ["quota", 402],
29590
30676
  insufficient_credits: ["quota", 402],
29591
30677
  /**
@@ -29708,6 +30794,8 @@ var AUDIT_ACTIONS_P13 = [
29708
30794
  "computer.resumed",
29709
30795
  "computer.snapshot_created",
29710
30796
  "computer.updated",
30797
+ "computer.taken_over",
30798
+ "computer.handed_back",
29711
30799
  "browser.live_view_opened",
29712
30800
  "deployment.created",
29713
30801
  "deployment.updated",
@@ -29840,7 +30928,7 @@ var JsonSchemaDocument3 = external_exports.record(external_exports.string(), ext
29840
30928
  var WindowSchema3 = external_exports.enum(["immediate", "priority", "loose"]);
29841
30929
  var TOKEN_TIERS3 = ["input", "cache_write", "cache_read", "output", "reasoning"];
29842
30930
  var TokenTierSchema3 = external_exports.enum(TOKEN_TIERS3);
29843
- var TOOL_TIERS3 = ["search", "media", "social", "browser", "storage"];
30931
+ var TOOL_TIERS3 = ["search", "media", "social", "browser", "storage", "email"];
29844
30932
  var LINE_ITEM_TIERS3 = [...TOKEN_TIERS3, "computer", ...TOOL_TIERS3];
29845
30933
  var LineItemTierSchema3 = external_exports.enum(LINE_ITEM_TIERS3);
29846
30934
  var TokenUsageSchema3 = external_exports.object({
@@ -29858,11 +30946,41 @@ var PrincipalSchema3 = external_exports.discriminatedUnion("type", [
29858
30946
  var AuditActionSchema3 = external_exports.enum(AUDIT_ACTIONS3);
29859
30947
  var HARNESS_IDS3 = ["pi", "claude_code", "vetta", "hermes"];
29860
30948
  var HarnessIdSchema3 = external_exports.enum(HARNESS_IDS3);
30949
+ var DEFAULT_ORG_TIMEZONE3 = "America/New_York";
30950
+ function canonicalZone3(name) {
30951
+ if (!name.includes("/") && name !== "UTC") return void 0;
30952
+ try {
30953
+ const zone = new Intl.DateTimeFormat("en-US", { timeZone: name }).resolvedOptions().timeZone;
30954
+ return zone === "UTC" || Intl.supportedValuesOf("timeZone").includes(zone) ? zone : void 0;
30955
+ } catch {
30956
+ return void 0;
30957
+ }
30958
+ }
30959
+ var TimezoneSchema3 = external_exports.string().transform((name, ctx) => {
30960
+ const zone = canonicalZone3(name);
30961
+ if (zone === void 0) {
30962
+ ctx.addIssue({ code: "custom", message: "not a timezone; use an IANA name such as America/Los_Angeles" });
30963
+ return external_exports.NEVER;
30964
+ }
30965
+ return zone;
30966
+ });
29861
30967
  var OrganizationSchema3 = external_exports.object({
29862
30968
  id: idOf3("org"),
29863
30969
  object: external_exports.literal("organization"),
29864
30970
  name: external_exports.string(),
29865
30971
  balance_micro_usd: MicroUsdField3,
30972
+ /**
30973
+ * The company's timezone, an IANA name (`America/New_York`, §20.6). Times the company chooses or
30974
+ * reads are in it: a new routine's zone, when a post goes out. `America/New_York` until changed.
30975
+ * Defaulted so a reply from a control plane older than 0088 (or a rolled-back Worker) still parses
30976
+ * in a newer SDK/CLI rather than throwing on every `orgs.get/list/update`.
30977
+ */
30978
+ timezone: external_exports.string().min(1).default(DEFAULT_ORG_TIMEZONE3),
30979
+ /**
30980
+ * The company's logo, an SVG a person or an agent drew (§20.7), passed by `checkLogoSvg`. `null`
30981
+ * until one is set. Defaulted so a reply from a control plane older than 0093 still parses.
30982
+ */
30983
+ logo_svg: external_exports.string().nullable().default(null),
29866
30984
  created_at: Timestamp3
29867
30985
  });
29868
30986
  var RoleSchema3 = external_exports.enum(["owner", "admin", "member"]);
@@ -30207,7 +31325,7 @@ function normaliseMultiagent2(value) {
30207
31325
  }
30208
31326
  var HandoffsField3 = external_exports.union([external_exports.boolean(), external_exports.literal("team"), external_exports.array(external_exports.string().min(1)).max(50)]);
30209
31327
  var handoffsOf = (config2) => config2.handoffs ?? true;
30210
- var handoffsEnabled = (handoffs2) => handoffs2 === true || handoffs2 === "team" || handoffs2 !== false && handoffs2.length > 0;
31328
+ var handoffsEnabled = (handoffs2) => handoffs2 !== false;
30211
31329
  var agentConfigShape3 = {
30212
31330
  model: external_exports.string(),
30213
31331
  window: WindowSchema3,
@@ -30250,6 +31368,22 @@ var SessionStatusSchema3 = external_exports.enum([
30250
31368
  "failed",
30251
31369
  "cancelled"
30252
31370
  ]);
31371
+ var SessionModeSchema3 = external_exports.enum(["plan", "build"]);
31372
+ var PLAN_MAX_CHARS3 = 2e4;
31373
+ var PlanSchema3 = external_exports.object({
31374
+ object: external_exports.literal("plan"),
31375
+ markdown: external_exports.string().max(PLAN_MAX_CHARS3),
31376
+ version: external_exports.number().int().nonnegative(),
31377
+ by: external_exports.enum(["agent", "owner"]).nullable()
31378
+ });
31379
+ var PlanWriteSchema3 = external_exports.object({
31380
+ markdown: external_exports.string().max(PLAN_MAX_CHARS3),
31381
+ base_version: external_exports.number().int().nonnegative()
31382
+ });
31383
+ var ProposePlanSchema3 = external_exports.object({
31384
+ version: external_exports.number().int().positive(),
31385
+ spends_or_publishes: external_exports.array(external_exports.string().min(1).max(200)).max(10).optional()
31386
+ });
30253
31387
  var StopReasonSchema3 = external_exports.enum([
30254
31388
  "end_turn",
30255
31389
  "awaiting_input",
@@ -30342,16 +31476,26 @@ var QuestionFieldSchema3 = external_exports.discriminatedUnion("type", [
30342
31476
  other: external_exports.boolean().default(true)
30343
31477
  })
30344
31478
  ]);
31479
+ var QUESTION_FIELDS_MAX3 = 3;
30345
31480
  var QuestionSchema3 = external_exports.object({
30346
31481
  prompt: external_exports.string().min(1).max(1e3),
30347
- fields: external_exports.array(QuestionFieldSchema3).min(1).max(3)
31482
+ fields: external_exports.array(QuestionFieldSchema3).min(1).max(QUESTION_FIELDS_MAX3, {
31483
+ message: `a question has at most ${QUESTION_FIELDS_MAX3} fields \u2014 ask the rest in a second question once these are answered`
31484
+ })
30348
31485
  });
30349
- var AnswersSchema3 = external_exports.record(
31486
+ var answersOf3 = (max, message32) => external_exports.record(
30350
31487
  external_exports.string().min(1).max(64),
30351
31488
  external_exports.union([external_exports.string().max(2e3), external_exports.array(external_exports.string().max(2e3)).min(1).max(12)])
30352
- ).refine((answers) => Object.keys(answers).length <= 3, {
30353
- message: "a question has at most 3 fields, so an answer has at most 3 keys"
30354
- });
31489
+ ).refine((answers) => Object.keys(answers).length <= max, { message: message32 });
31490
+ var AnswersSchema3 = answersOf3(
31491
+ QUESTION_FIELDS_MAX3,
31492
+ `a question has at most ${QUESTION_FIELDS_MAX3} fields, so an answer has at most ${QUESTION_FIELDS_MAX3} keys`
31493
+ );
31494
+ var TEMPLATE_QUESTIONS_MAX3 = 4;
31495
+ var InstallAnswersSchema3 = answersOf3(
31496
+ TEMPLATE_QUESTIONS_MAX3,
31497
+ `a template asks at most ${TEMPLATE_QUESTIONS_MAX3} questions, so an install has at most ${TEMPLATE_QUESTIONS_MAX3} answers`
31498
+ );
30355
31499
  var PendingActionSchema3 = external_exports.object({
30356
31500
  kind: external_exports.enum(["tool", "question"]).default("tool"),
30357
31501
  tool_call_id: external_exports.string(),
@@ -30392,6 +31536,13 @@ var SessionSchema3 = external_exports.object({
30392
31536
  parent_session_id: idOf3("ses").nullable(),
30393
31537
  root_session_id: idOf3("ses").nullable(),
30394
31538
  thread_role: ThreadRoleSchema3.nullable(),
31539
+ /**
31540
+ * The model the latest send picked (§7 `model`), or `null` when none has and the session runs its
31541
+ * pinned version's model (§10, ADR-0832). Defaulted so a reply from an older control plane parses.
31542
+ */
31543
+ model: external_exports.string().nullable().default(null),
31544
+ /** Plan mode (§7.5, §10): defaulted so a reply from an older control plane parses as `build`. */
31545
+ mode: SessionModeSchema3.default("build"),
30395
31546
  status: SessionStatusSchema3,
30396
31547
  stop_reason: StopReasonSchema3.nullable(),
30397
31548
  window: WindowSchema3,
@@ -30411,6 +31562,10 @@ var SendMessageSchema3 = external_exports.object({
30411
31562
  message: external_exports.string(),
30412
31563
  interrupt: external_exports.boolean().optional(),
30413
31564
  queue: external_exports.boolean().optional(),
31565
+ /** A catalogue id: this session runs on it from this message's turn on (§7, ADR-0832). */
31566
+ model: external_exports.string().min(1).optional(),
31567
+ /** Plan mode from this message's turn on (§7.5, ADR-0905). */
31568
+ mode: SessionModeSchema3.optional(),
30414
31569
  idempotency_key: external_exports.string().optional()
30415
31570
  }).refine((body2) => !(body2.interrupt === true && body2.queue === true), {
30416
31571
  message: "a send is either an interrupt or queued, not both",
@@ -30425,7 +31580,14 @@ var ToolConfirmationSchema3 = external_exports.object({
30425
31580
  tool_call_id: external_exports.string(),
30426
31581
  decision: external_exports.enum(["allow", "deny"]),
30427
31582
  reason: external_exports.string().optional(),
30428
- scope: external_exports.enum(["call", "session"]).default("call")
31583
+ scope: external_exports.enum(["call", "session"]).default("call"),
31584
+ /**
31585
+ * THE PERSON'S OWN ANSWERS for a template install they approve (ADR-1030): the call runs with
31586
+ * these in place of the `answers` the agent proposed, and with nothing else changed. A modifier on
31587
+ * `allow`, like `scope`: absent is the call as proposed. The route refuses it on a deny, on a session
31588
+ * grant, on any other tool, and on answers the template's questions refuse (`answerProblems`).
31589
+ */
31590
+ answers: InstallAnswersSchema3.optional()
30429
31591
  });
30430
31592
  var SessionAnswerSchema3 = external_exports.object({
30431
31593
  tool_call_id: external_exports.string(),
@@ -30433,6 +31595,11 @@ var SessionAnswerSchema3 = external_exports.object({
30433
31595
  });
30434
31596
  var EventTypeSchema3 = external_exports.enum([
30435
31597
  "message.delta",
31598
+ /**
31599
+ * The agent's answer (no `role`), or a user row `{ role: "user", content, client_message_id? }` (§8).
31600
+ * A user row the runtime wrote itself — a media job's result, a tool grant — carries
31601
+ * `from: "platform"` and is the platform's notice, not a caller's words (§8, ADR-0870).
31602
+ */
30436
31603
  "message.completed",
30437
31604
  /** A caller's message, durable in the inbox and not yet admitted to a turn (§7, §8): `{ client_message_id, content }`. */
30438
31605
  "message.accepted",
@@ -30443,19 +31610,26 @@ var EventTypeSchema3 = external_exports.enum([
30443
31610
  "tool.confirm",
30444
31611
  /** A person's decision on a parked call, stamped with the inbox write that delivers it (§8, ADR-0764). */
30445
31612
  "tool.confirm.resolved",
31613
+ /** A person's answer to a parked question, stamped the same way (§7.1, §8, ADR-1049). */
31614
+ "tool.confirm.answered",
30446
31615
  "session.running",
30447
31616
  "session.usage",
30448
31617
  "session.idle",
30449
31618
  /** A failed attempt the loop will retry (§8): `{ attempt, in_ms, code }`. */
30450
31619
  "session.retrying",
31620
+ /** The session's mode changed (§7.5): `{ mode: "plan" | "build" }`. */
31621
+ "session.mode",
31622
+ /** A write to the session's plan, by the agent or its owner (§7.5): the plan object. */
31623
+ "plan.updated",
30451
31624
  /**
30452
31625
  * The turn ran, but without something it needed (§8): `{ reason, detail? }`.
30453
31626
  *
30454
31627
  * Emitted for a turn whose sandbox could not be woken. That turn used to be indistinguishable
30455
31628
  * from a success — the model was handed the failure as a tool result, answered around it from the
30456
31629
  * transcript, and the session ended `idle`/`end_turn` with no field anywhere saying the
30457
- * filesystem had been unavailable. This is the field. `reason` is open on purpose; today the only
30458
- * value is `"sandbox_unavailable"`.
31630
+ * filesystem had been unavailable. This is the field. `reason` is open on purpose; today it is
31631
+ * `"sandbox_unavailable"`, `"vendor_resume_unavailable"`, or `"app_tools_unavailable"` — an app the
31632
+ * agent's toolset names gave no tools this turn (§29.5, `runtime-do app-mcp-tools.ts`).
30459
31633
  *
30460
31634
  * `detail` is the boot failure's own message, and it is here because `reason` alone reads the
30461
31635
  * same for a vendor outage and for a fault of ours. Staging round 3 spent its whole budget
@@ -30553,6 +31727,11 @@ var ToolConfirmResolvedDataSchema3 = external_exports.object({
30553
31727
  proposed_args: external_exports.record(external_exports.string(), external_exports.unknown()).nullable(),
30554
31728
  final_args: external_exports.record(external_exports.string(), external_exports.unknown()).nullable()
30555
31729
  });
31730
+ var ToolConfirmAnsweredDataSchema3 = external_exports.object({
31731
+ tool_call_id: external_exports.string(),
31732
+ answers: AnswersSchema3,
31733
+ answered_at: Timestamp3
31734
+ });
30556
31735
  var SessionUsageDataSchema3 = external_exports.object({
30557
31736
  token_usage: TokenUsageSchema3,
30558
31737
  consumed_micro_usd: MicroUsdField3.nonnegative(),
@@ -30645,7 +31824,10 @@ var FileSourceTypeSchema3 = external_exports.enum(FILE_SOURCE_TYPES3);
30645
31824
  var FileSourceSchema3 = external_exports.object({
30646
31825
  type: FileSourceTypeSchema3,
30647
31826
  job_id: external_exports.union([idOf3("med"), idOf3("clj")]).nullable(),
30648
- url: external_exports.string().url().nullable()
31827
+ url: external_exports.string().url().nullable(),
31828
+ /** What a generator was asked with (§36.1, ADR-0886); absent on every other writer's row. */
31829
+ model: external_exports.string().nullable().optional(),
31830
+ prompt: external_exports.string().nullable().optional()
30649
31831
  });
30650
31832
  var FileTagsSchema3 = external_exports.array(external_exports.string().min(1).max(64)).max(32);
30651
31833
  var FileLibraryFieldsSchema3 = external_exports.object({
@@ -30688,6 +31870,11 @@ var ComputerSchema3 = external_exports.object({
30688
31870
  browser: BrowserOptionsSchema3.nullable(),
30689
31871
  volume: VolumeSchema3.nullable(),
30690
31872
  snapshot_id: idOf3("snp").nullable(),
31873
+ /**
31874
+ * The agent this computer belongs to (§41.8, ADR-0849); `null` for one made by `POST /v1/computers`.
31875
+ * Defaulted so a reply from an older control plane parses.
31876
+ */
31877
+ agent_id: idOf3("agt").nullable().default(null),
30691
31878
  created_at: Timestamp3
30692
31879
  });
30693
31880
  var SnapshotSchema3 = external_exports.object({
@@ -30796,7 +31983,9 @@ var FileSchema3 = external_exports.object({
30796
31983
  sha256: external_exports.string().regex(/^[0-9a-f]{64}$/),
30797
31984
  created_at: Timestamp3,
30798
31985
  // The asset-library fields (`canonical-spec §36.1`), all nullable or defaulted.
30799
- ...FileLibraryFieldsSchema3.shape
31986
+ ...FileLibraryFieldsSchema3.shape,
31987
+ /** The agent of `session_id`, joined at read (§36.1, ADR-0887); a writer never sets it. */
31988
+ agent_id: idOf3("agt").nullable().optional()
30800
31989
  });
30801
31990
  var ScheduleStatusSchema3 = external_exports.enum(["scheduled", "paused", "unscheduled"]);
30802
31991
  var DeploymentSchema3 = external_exports.object({
@@ -30915,8 +32104,28 @@ var InboundMessageSchema3 = external_exports.object({
30915
32104
  auth: external_exports.record(external_exports.string(), external_exports.string()),
30916
32105
  /** The session this message woke. Null until the wake seam lands (see ADR-0120). */
30917
32106
  session_id: idOf3("ses").nullable(),
30918
- received_at: Timestamp3
30919
- });
32107
+ received_at: Timestamp3,
32108
+ /**
32109
+ * When a person marked it read (`POST …/messages/{mid}/read`); `null` is unread. Defaulted so a
32110
+ * reply from an older control plane parses (ADR-1076).
32111
+ */
32112
+ read_at: Timestamp3.nullable().default(null)
32113
+ });
32114
+ var OutboundMessageSchema3 = external_exports.object({
32115
+ id: idOf3("out"),
32116
+ object: external_exports.literal("outbound_message"),
32117
+ channel: InboundMessageSchema3.shape.channel,
32118
+ identity_id: idOf3("idn"),
32119
+ /** The `eml_` endpoint it was sent from. */
32120
+ endpoint_id: external_exports.string(),
32121
+ from: external_exports.string(),
32122
+ to: external_exports.array(external_exports.string()),
32123
+ subject: external_exports.string().nullable(),
32124
+ text: external_exports.string(),
32125
+ sent_by_agent_id: idOf3("agt").nullable(),
32126
+ actor: PrincipalSchema3.nullable(),
32127
+ sent_at: Timestamp3
32128
+ });
30920
32129
  var AppTypeSchema3 = external_exports.enum(["frontend_only", "fullstack"]);
30921
32130
  var AppStatusSchema3 = external_exports.enum(["provisioning", "active", "error"]);
30922
32131
  var AppMcpPathSchema3 = external_exports.string().regex(/^\/\S*$/, "must be an absolute path beginning with /").max(128);
@@ -30992,6 +32201,11 @@ var AppDomainSchema3 = external_exports.object({
30992
32201
  });
30993
32202
  var ENV_NAME = /^[A-Z_][A-Z0-9_]*$/;
30994
32203
  var APP_NAME = /^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/;
32204
+ var AppPermissionsSchema3 = external_exports.object({
32205
+ object: external_exports.literal("app_permissions"),
32206
+ app_id: idOf3("app"),
32207
+ scopes: external_exports.array(external_exports.string())
32208
+ });
30995
32209
  var BlueprintInstallSourceSchema3 = external_exports.enum(["studio", "cli"]);
30996
32210
  var BlueprintInstallStatusSchema3 = external_exports.enum(["pending", "applied", "failed"]);
30997
32211
  var ResourceActionSchema3 = external_exports.enum(["created", "updated", "unchanged", "deleted", "refused"]);
@@ -31088,7 +32302,10 @@ var BlueprintInstallSchema3 = external_exports.object({
31088
32302
  */
31089
32303
  report: BlueprintReportSchema3.nullable(),
31090
32304
  status: BlueprintInstallStatusSchema3,
31091
- /** Why a `failed` run threw, in one sentence; `null` on every other row. Never a stack or a key. */
32305
+ /**
32306
+ * Why a `failed` run threw, in one sentence — or, on an `applied` row, which `required` agent or
32307
+ * app the apply refused and why (§29.6). `null` otherwise. Never a stack or a key.
32308
+ */
31092
32309
  failure: external_exports.string().nullable(),
31093
32310
  /**
31094
32311
  * The `selection` the apply carried, or `null` — every row written before §31.2 and every apply
@@ -31202,6 +32419,39 @@ var SocialCommentSchema3 = external_exports.object({
31202
32419
  posted_at: Timestamp3.nullable(),
31203
32420
  data: external_exports.unknown()
31204
32421
  });
32422
+ var POST_STATUSES3 = ["pending", "scheduled", "posted", "failed"];
32423
+ var PostStatusSchema3 = external_exports.enum(POST_STATUSES3);
32424
+ var PostSchema3 = external_exports.object({
32425
+ object: external_exports.literal("post"),
32426
+ id: external_exports.string().min(1),
32427
+ status: PostStatusSchema3,
32428
+ identity_id: external_exports.string().nullable(),
32429
+ agent_id: external_exports.string().nullable(),
32430
+ session_id: external_exports.string().nullable(),
32431
+ tool_call_id: external_exports.string().nullable(),
32432
+ content: external_exports.string().nullable(),
32433
+ platforms: external_exports.array(external_exports.string()),
32434
+ file_ids: external_exports.array(external_exports.string()),
32435
+ media_urls: external_exports.array(external_exports.string()),
32436
+ visibility: SocialVisibilitySchema3.nullable(),
32437
+ scheduled_at: Timestamp3.nullable(),
32438
+ posted_at: Timestamp3.nullable(),
32439
+ url: external_exports.string().nullable(),
32440
+ error: external_exports.string().nullable(),
32441
+ /** The latest stored reading, `{metric: value}`; `null` before `social.post_metrics` read any. */
32442
+ metrics: external_exports.record(external_exports.string(), external_exports.number()).nullable(),
32443
+ measured_at: Timestamp3.nullable(),
32444
+ /** Pending only: the earlier post this call would repeat — same identity, network and file. */
32445
+ duplicate_of: external_exports.object({
32446
+ id: external_exports.string(),
32447
+ status: PostStatusSchema3,
32448
+ platform: external_exports.string(),
32449
+ at: Timestamp3.nullable(),
32450
+ agent_id: external_exports.string().nullable(),
32451
+ session_id: external_exports.string().nullable()
32452
+ }).nullable(),
32453
+ created_at: Timestamp3
32454
+ });
31205
32455
  var BlueprintScheduleSchema3 = external_exports.object({
31206
32456
  agent: external_exports.string().min(1),
31207
32457
  cron: external_exports.string().min(1),
@@ -31233,16 +32483,9 @@ var BlueprintAppSchema3 = external_exports.object({
31233
32483
  /** Whether an install may deselect it (§31.2). Optional: the rollout argument above. */
31234
32484
  required: external_exports.boolean().optional()
31235
32485
  });
31236
- var BlueprintIdentityConnectionsSchema3 = external_exports.object({
31237
- social: external_exports.object({
31238
- from: external_exports.string().min(1),
31239
- map: external_exports.record(external_exports.string().min(1), SocialPlatformSchema3)
31240
- }).optional()
31241
- });
31242
32486
  var BlueprintIdentitySchema3 = external_exports.object({
31243
32487
  name: external_exports.string().min(1),
31244
- description: external_exports.string().nullable(),
31245
- connections: BlueprintIdentityConnectionsSchema3.optional()
32488
+ description: external_exports.string().nullable()
31246
32489
  });
31247
32490
  var ContentHashSchema3 = external_exports.string().regex(/^[0-9a-f]{64}$/, "a lowercase sha-256 hex digest");
31248
32491
  var BlueprintTreeSchema3 = external_exports.object({
@@ -31260,11 +32503,18 @@ var BlueprintArtifactSchema3 = external_exports.object({
31260
32503
  /** The blueprint repository's own released version. Stored, never parsed (ADR-0401). */
31261
32504
  version: external_exports.string().min(1),
31262
32505
  /**
31263
- * The built trees, one per deployable app, ordered as the declaration orders its apps. Never
31264
- * empty: an artifact that built nothing is not an artifact, and the column behind it says so
31265
- * (migration 0040) exactly as the single `content_hash` it replaces was `not null`.
32506
+ * What a person calls the template, one line on what its crew does, and the networks it publishes
32507
+ * to — printed, never provisioned (§31.5, ADR-0921). `platforms` is decoration: where the crew
32508
+ * posts is the accounts connected to its persona. Optional for the §31.5 rollout reason.
32509
+ */
32510
+ title: external_exports.string().min(1).optional(),
32511
+ description: external_exports.string().min(1).optional(),
32512
+ platforms: external_exports.array(SocialPlatformSchema3).optional(),
32513
+ /**
32514
+ * The built trees, one per deployable app, ordered as the declaration orders its apps. Empty for
32515
+ * a data-only blueprint: it declares no app, builds nothing, and still ships a crew (ADR-0900).
31266
32516
  */
31267
- trees: external_exports.array(BlueprintTreeSchema3).min(1),
32517
+ trees: external_exports.array(BlueprintTreeSchema3),
31268
32518
  /**
31269
32519
  * The setup questions, asked by the studio **before** provisioning. `QuestionField` (§7.1) is
31270
32520
  * reused rather than restated: a setup question and a question a parked agent asks are the same
@@ -31369,6 +32619,199 @@ var ChannelPostSchema3 = external_exports.object({
31369
32619
  root_session_id: idOf3("ses"),
31370
32620
  queued: external_exports.boolean()
31371
32621
  });
32622
+ var SHOW_SOURCES3 = ["spend_by_day", "post_views", "roadmap", "schedule"];
32623
+ var ShowSourceSchema3 = external_exports.enum(SHOW_SOURCES3);
32624
+ var ShowArgsSchema3 = external_exports.object({
32625
+ source: ShowSourceSchema3.describe(
32626
+ "What to show: spend_by_day (company spend per day, a line), post_views (views per recent post, bars), roadmap (the board's work by status), schedule (routines and scheduled posts over the next 7 days)."
32627
+ ),
32628
+ days: external_exports.number().int().min(2).max(30).optional().describe("spend_by_day only: days back, today included. Default 14.")
32629
+ });
32630
+ var Day4 = external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/);
32631
+ var Count4 = external_exports.number().int().nonnegative();
32632
+ var head3 = { title: external_exports.string().min(1), as_of: Timestamp3, timezone: external_exports.string().min(1) };
32633
+ var SpendByDayViewSchema3 = external_exports.object({
32634
+ source: external_exports.literal("spend_by_day"),
32635
+ ...head3,
32636
+ days: external_exports.array(external_exports.object({ day: Day4, micro_usd: Count4 })).min(2).max(30)
32637
+ });
32638
+ var PostViewsViewSchema3 = external_exports.object({
32639
+ source: external_exports.literal("post_views"),
32640
+ ...head3,
32641
+ posts: external_exports.array(external_exports.object({ post_id: external_exports.string().min(1), label: external_exports.string(), networks: external_exports.array(external_exports.string()), posted_at: Timestamp3, views: Count4 })).max(12)
32642
+ });
32643
+ var RoadmapViewSchema3 = external_exports.object({
32644
+ source: external_exports.literal("roadmap"),
32645
+ ...head3,
32646
+ groups: external_exports.array(
32647
+ external_exports.object({
32648
+ status: BoardStatusSchema3,
32649
+ count: Count4,
32650
+ cards: external_exports.array(external_exports.object({ title: external_exports.string(), assignee: external_exports.string().nullable(), waits_on: external_exports.array(external_exports.string()) })).max(5)
32651
+ })
32652
+ )
32653
+ });
32654
+ var ScheduleViewSchema3 = external_exports.object({
32655
+ source: external_exports.literal("schedule"),
32656
+ ...head3,
32657
+ days: external_exports.array(
32658
+ external_exports.object({
32659
+ day: Day4,
32660
+ count: Count4,
32661
+ items: external_exports.array(
32662
+ external_exports.discriminatedUnion("kind", [
32663
+ external_exports.object({ kind: external_exports.literal("routine"), at: Timestamp3, agent: external_exports.string(), text: external_exports.string(), runs: external_exports.number().int().min(1).max(100) }),
32664
+ external_exports.object({ kind: external_exports.literal("post"), at: Timestamp3, networks: external_exports.array(external_exports.string()), text: external_exports.string() })
32665
+ ])
32666
+ ).max(8)
32667
+ })
32668
+ ).max(7)
32669
+ });
32670
+ var ShowViewSchema3 = external_exports.discriminatedUnion("source", [
32671
+ SpendByDayViewSchema3,
32672
+ PostViewsViewSchema3,
32673
+ RoadmapViewSchema3,
32674
+ ScheduleViewSchema3
32675
+ ]);
32676
+ var Key3 = external_exports.string().regex(/^[A-Za-z][A-Za-z0-9_-]{0,39}$/, "an element key is a short name: a letter, then letters, digits, - or _");
32677
+ var Count23 = external_exports.number().int().nonnegative();
32678
+ var DIGIT3 = "words only: a digit is refused, because every number on the card is read by code from a $source binding";
32679
+ var words3 = (max) => external_exports.string().trim().min(1).max(max).regex(/^[^0-9]*$/, DIGIT3).refine((text2) => !new RegExp("\\p{N}", "u").test(text2), DIGIT3);
32680
+ var Days3 = external_exports.number().int().min(1).max(30).default(7).describe("The window: today and the days before it, on the company's clock. Default 7.");
32681
+ function bound3(sources2, shape) {
32682
+ const example = JSON.stringify({ $source: sources2[0] });
32683
+ return external_exports.strictObject(
32684
+ { $source: external_exports.enum(sources2), ...shape },
32685
+ { error: (issue2) => issue2.code === "invalid_type" ? `must be a binding such as ${example}: a literal value is refused, code reads every number` : void 0 }
32686
+ );
32687
+ }
32688
+ var Bound3 = {
32689
+ value: bound3(["views_total", "spend_total"], { days: Days3 }).describe(
32690
+ "views_total: the latest views of the posts published in the window. spend_total: the company's spend in the window (the CEO only)."
32691
+ ),
32692
+ delta: bound3(["views_change"], {}).describe(
32693
+ "views_change: the value's views_total against the same number of days before it, as a percentage. Its window is the value's."
32694
+ ),
32695
+ series: bound3(["spend_by_day"], { days: external_exports.number().int().min(2).max(30).default(14) }).describe("spend_by_day: the company's spend per day (the CEO only)."),
32696
+ bars: bound3(["post_views"], { limit: external_exports.number().int().min(1).max(12).default(5).describe("How many posts, newest first. Default 5.") }).describe(
32697
+ "post_views: each recent post's latest views, newest first."
32698
+ ),
32699
+ progress: bound3(["posts_this_week"], {}).describe("posts_this_week: posts published since Monday against the weekly cadence from the company's setup."),
32700
+ board: bound3(["roadmap"], {}).describe("roadmap: the board's work by status."),
32701
+ week: bound3(["schedule"], {}).describe("schedule: routines and scheduled posts over the next 7 days."),
32702
+ media: external_exports.union([bound3(["latest_media"], { count: external_exports.number().int().min(1).max(4).default(1) }), external_exports.array(idOf3("fil")).min(1).max(4)]).describe('{"$source":"latest_media","count":1} for the newest posted pictures or clips, or up to 4 fil_ ids.')
32703
+ };
32704
+ var SpendDay3 = external_exports.strictObject({ day: external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/), micro_usd: Count23 });
32705
+ var Resolved3 = {
32706
+ value: external_exports.discriminatedUnion("$source", [
32707
+ external_exports.strictObject({ $source: external_exports.literal("views_total"), days: external_exports.number().int(), value: Count23, posts: Count23 }),
32708
+ external_exports.strictObject({ $source: external_exports.literal("spend_total"), days: external_exports.number().int(), value: Count23 })
32709
+ ]),
32710
+ delta: external_exports.strictObject({ $source: external_exports.literal("views_change"), days: external_exports.number().int(), current: Count23, previous: Count23 }),
32711
+ series: external_exports.strictObject({ $source: external_exports.literal("spend_by_day"), days: external_exports.number().int(), points: external_exports.array(SpendDay3).min(2).max(30) }),
32712
+ bars: external_exports.strictObject({ $source: external_exports.literal("post_views"), limit: external_exports.number().int(), posts: PostViewsViewSchema3.shape.posts }),
32713
+ progress: external_exports.strictObject({ $source: external_exports.literal("posts_this_week"), value: Count23, max: external_exports.number().int().positive(), cadence: external_exports.string() }),
32714
+ board: external_exports.strictObject({ $source: external_exports.literal("roadmap"), groups: RoadmapViewSchema3.shape.groups }),
32715
+ week: external_exports.strictObject({ $source: external_exports.literal("schedule"), days: ScheduleViewSchema3.shape.days }),
32716
+ media: external_exports.array(external_exports.strictObject({ id: idOf3("fil"), kind: external_exports.enum(["image", "video"]) })).min(1).max(4)
32717
+ };
32718
+ var box3 = { children: external_exports.array(Key3).min(1).max(12) };
32719
+ var leaf3 = { children: external_exports.array(Key3).max(0).optional() };
32720
+ var label3 = words3(40).optional();
32721
+ var element3 = (type, props, children, about) => external_exports.strictObject({ type: external_exports.literal(type), props: external_exports.strictObject(props), ...children }).describe(about);
32722
+ function catalog3(slot) {
32723
+ return {
32724
+ Card: element3("Card", { title: words3(60) }, box3, "The card, with a short title. It is the root, and only the root."),
32725
+ Stack: element3("Stack", {}, box3, "Children one under another."),
32726
+ Grid: element3("Grid", { columns: external_exports.literal([1, 2, 3]) }, box3, "Children side by side, 1 to 3 columns."),
32727
+ Metric: element3("Metric", { label: words3(40), value: slot.value, delta: slot.delta.optional() }, leaf3, "One big number with a label, and optionally its change."),
32728
+ LineChart: element3("LineChart", { label: label3, series: slot.series }, leaf3, "A line over days."),
32729
+ BarList: element3("BarList", { label: label3, bars: slot.bars }, leaf3, "One bar per post."),
32730
+ Progress: element3("Progress", { label: words3(40), progress: slot.progress }, leaf3, "A value against its goal, as a bar."),
32731
+ Roadmap: element3("Roadmap", { label: label3, board: slot.board }, leaf3, "The board grouped by status."),
32732
+ Schedule: element3("Schedule", { label: label3, week: slot.week }, leaf3, "The week ahead, day by day."),
32733
+ Media: element3("Media", { label: label3, files: slot.media }, leaf3, "Pictures or clips the company holds."),
32734
+ Text: element3("Text", { text: words3(240) }, leaf3, "A short note in words.")
32735
+ };
32736
+ }
32737
+ var unknownComponent3 = (names2) => ({
32738
+ error: (issue2) => issue2.code === "invalid_union" ? `unknown component: use one of ${names2.join(", ")}` : void 0
32739
+ });
32740
+ function tree3(rootType, max, spec22, ctx) {
32741
+ const refuse2 = (message32, path = []) => ctx.addIssue({ code: "custom", message: message32, path });
32742
+ const keys3 = Object.keys(spec22.elements);
32743
+ const has = (key2) => Object.hasOwn(spec22.elements, key2);
32744
+ if (keys3.length > max) return refuse2(`at most ${max} elements`, ["elements"]);
32745
+ const root = has(spec22.root) ? spec22.elements[spec22.root] : void 0;
32746
+ if (!root) return refuse2(`root names "${spec22.root}", which is not in elements`, ["root"]);
32747
+ if (root.type !== rootType) return refuse2(`the root must be a ${rootType}`, ["root"]);
32748
+ const parent = /* @__PURE__ */ new Map();
32749
+ for (const key2 of keys3) {
32750
+ for (const child of spec22.elements[key2].children ?? []) {
32751
+ if (!has(child)) return refuse2(`"${child}" is not in elements`, ["elements", key2, "children"]);
32752
+ if (child === spec22.root || parent.has(child)) return refuse2(`"${child}" has more than one parent`, ["elements", key2, "children"]);
32753
+ if (spec22.elements[child].type === rootType) return refuse2(`a ${rootType} is the root only; group with Stack or Grid`, ["elements", child, "type"]);
32754
+ parent.set(child, key2);
32755
+ }
32756
+ }
32757
+ const reached = /* @__PURE__ */ new Set([spec22.root]);
32758
+ for (const key2 of reached) for (const child of spec22.elements[key2].children ?? []) reached.add(child);
32759
+ const lost = keys3.find((key2) => !reached.has(key2));
32760
+ if (lost) refuse2(`"${lost}" is not under the root`, ["elements", lost]);
32761
+ }
32762
+ var spec3 = (element22, rootType, max) => external_exports.strictObject({ root: Key3, elements: external_exports.record(Key3, element22) }).superRefine((value, ctx) => tree3(rootType, max, value, ctx));
32763
+ var COMPOSE_COMPONENTS3 = ["Card", "Stack", "Grid", "Metric", "LineChart", "BarList", "Progress", "Roadmap", "Schedule", "Media", "Text"];
32764
+ var MAX_COMPOSE_ELEMENTS3 = 24;
32765
+ var BoundComponents3 = catalog3(Bound3);
32766
+ var ComposeSpecSchema3 = spec3(
32767
+ external_exports.discriminatedUnion(
32768
+ "type",
32769
+ [
32770
+ BoundComponents3.Card,
32771
+ BoundComponents3.Stack,
32772
+ BoundComponents3.Grid,
32773
+ BoundComponents3.Metric,
32774
+ BoundComponents3.LineChart,
32775
+ BoundComponents3.BarList,
32776
+ BoundComponents3.Progress,
32777
+ BoundComponents3.Roadmap,
32778
+ BoundComponents3.Schedule,
32779
+ BoundComponents3.Media,
32780
+ BoundComponents3.Text
32781
+ ],
32782
+ unknownComponent3(COMPOSE_COMPONENTS3)
32783
+ ),
32784
+ "Card",
32785
+ MAX_COMPOSE_ELEMENTS3
32786
+ );
32787
+ var ComposeArgsSchema3 = external_exports.object({
32788
+ spec: ComposeSpecSchema3.describe(
32789
+ 'A json-render spec: { "root": key, "elements": { key: { "type", "props", "children"? } } }. The root is one Card.'
32790
+ )
32791
+ });
32792
+ var ComposedComponents3 = catalog3(Resolved3);
32793
+ var ComposedSpecSchema3 = spec3(
32794
+ external_exports.discriminatedUnion(
32795
+ "type",
32796
+ [
32797
+ ComposedComponents3.Card,
32798
+ ComposedComponents3.Stack,
32799
+ ComposedComponents3.Grid,
32800
+ ComposedComponents3.Metric,
32801
+ ComposedComponents3.LineChart,
32802
+ ComposedComponents3.BarList,
32803
+ ComposedComponents3.Progress,
32804
+ ComposedComponents3.Roadmap,
32805
+ ComposedComponents3.Schedule,
32806
+ ComposedComponents3.Media,
32807
+ ComposedComponents3.Text
32808
+ ],
32809
+ unknownComponent3(COMPOSE_COMPONENTS3)
32810
+ ),
32811
+ "Card",
32812
+ MAX_COMPOSE_ELEMENTS3
32813
+ );
32814
+ var ComposedSchema3 = external_exports.object({ as_of: Timestamp3, timezone: external_exports.string().min(1), spec: ComposedSpecSchema3 });
31372
32815
  var MEDIA_JOB_KINDS3 = ["video", "clip", "transcription"];
31373
32816
  var MediaJobKindSchema3 = external_exports.enum(MEDIA_JOB_KINDS3);
31374
32817
  var MediaJobStatusSchema3 = external_exports.enum(["queued", "processing", "completed", "failed"]);
@@ -31435,9 +32878,12 @@ var ImageRequestSchema3 = external_exports.object({
31435
32878
  n: external_exports.number().int().min(1).max(4).default(1)
31436
32879
  });
31437
32880
  var VideoRequestSchema3 = external_exports.object({
31438
- model: external_exports.string().min(1),
32881
+ /** Omitted: the platform's video default while the catalogue publishes it (`resolveModel`, §33.2). */
32882
+ model: external_exports.string().min(1).optional(),
31439
32883
  prompt: external_exports.string().min(1),
31440
32884
  image_urls: external_exports.array(PublicUrl3).max(1).optional(),
32885
+ /** The source clip of a video-to-video edit (ADR-0814). */
32886
+ video_url: PublicUrl3.optional(),
31441
32887
  aspect_ratio: external_exports.string().optional(),
31442
32888
  seed: external_exports.number().int().optional(),
31443
32889
  seconds: external_exports.number().int().min(1).max(60).optional()
@@ -31723,18 +33169,18 @@ var ReferralClickSchema3 = external_exports.object({
31723
33169
  creator: external_exports.object({ display_name: external_exports.string().min(1) }),
31724
33170
  expires_at: Timestamp3
31725
33171
  });
31726
- var Day3 = external_exports.iso.date();
33172
+ var Day23 = external_exports.iso.date();
31727
33173
  var CreatorAnalyticsSchema3 = external_exports.object({
31728
33174
  object: external_exports.literal("creator_analytics"),
31729
33175
  days: external_exports.number().int().min(1).max(90),
31730
- from: Day3,
31731
- to: Day3,
33176
+ from: Day23,
33177
+ to: Day23,
31732
33178
  clicks: external_exports.number().int().nonnegative(),
31733
33179
  referrals: external_exports.number().int().nonnegative(),
31734
33180
  installs: external_exports.number().int().nonnegative(),
31735
33181
  active_installs: external_exports.number().int().nonnegative(),
31736
33182
  usage_by_day: external_exports.array(
31737
- external_exports.object({ day: Day3, debit_micro_usd: MicroUsdField3.nonnegative() })
33183
+ external_exports.object({ day: Day23, debit_micro_usd: MicroUsdField3.nonnegative() })
31738
33184
  ),
31739
33185
  commission_micro_usd: external_exports.object({
31740
33186
  pending: MicroUsdField3.nonnegative(),
@@ -31749,7 +33195,7 @@ var CreatorAnalyticsSchema3 = external_exports.object({
31749
33195
  })
31750
33196
  ),
31751
33197
  /** Every install covered, newest first: the day it was created and the day its twelve months end. */
31752
- install_windows: external_exports.array(external_exports.object({ install_id: idOf3("bpi"), from: Day3, until: Day3 }))
33198
+ install_windows: external_exports.array(external_exports.object({ install_id: idOf3("bpi"), from: Day23, until: Day23 }))
31753
33199
  });
31754
33200
  var LEGAL_MEMBER_STATUSES3 = [
31755
33201
  "pending",
@@ -32187,6 +33633,151 @@ var CreateReviewSchema3 = external_exports.object({
32187
33633
  before: Fields3,
32188
33634
  after: Fields3
32189
33635
  });
33636
+ var PAGE_BLOCKS3 = [
33637
+ "Page",
33638
+ "Section",
33639
+ "Stack",
33640
+ "Grid",
33641
+ "Metric",
33642
+ "LineChart",
33643
+ "BarList",
33644
+ "Progress",
33645
+ "Roadmap",
33646
+ "Schedule",
33647
+ "Media",
33648
+ "Text",
33649
+ "Needs",
33650
+ "Activity",
33651
+ "Accounts",
33652
+ "Posts",
33653
+ "Answers",
33654
+ "MediaLibrary"
33655
+ ];
33656
+ var MAX_PAGE_ELEMENTS3 = 48;
33657
+ var MINI_APP_ICONS3 = ["grid", "list", "chart", "calendar", "play"];
33658
+ var MiniAppIconSchema3 = external_exports.enum(MINI_APP_ICONS3);
33659
+ var SLUG3 = "[a-z][a-z0-9-]{0,39}";
33660
+ var MiniAppSlugSchema3 = external_exports.string().regex(new RegExp(`^${SLUG3}$`), "a slug is lowercase letters, digits and -");
33661
+ var Place3 = external_exports.string().regex(new RegExp(`^/(board|connections|apps/${SLUG3}(\\?page=${SLUG3})?)$`), "a section links to /board, /connections or /apps/<slug>[?page=<slug>]");
33662
+ var POSTS3 = ["waiting", "scheduled", "posted"];
33663
+ var PostStatus3 = external_exports.enum(POSTS3);
33664
+ var PostLayout3 = external_exports.enum(["list", "row", "grid"]);
33665
+ var PostStatuses3 = external_exports.union([PostStatus3, external_exports.array(PostStatus3).min(1).max(3).refine((all) => new Set(all).size === all.length, "each status once")]);
33666
+ var PageBound3 = {
33667
+ ...Bound3,
33668
+ board: bound3(["roadmap"], { per_group: external_exports.number().int().min(1).max(5).default(5) }),
33669
+ media: bound3(["latest_media", "newest_media"], { count: external_exports.number().int().min(1).max(6).default(4) })
33670
+ };
33671
+ var PageResolved3 = {
33672
+ ...Resolved3,
33673
+ board: external_exports.strictObject({ $source: external_exports.literal("roadmap"), per_group: external_exports.number().int(), groups: RoadmapViewSchema3.shape.groups }),
33674
+ media: external_exports.array(external_exports.strictObject({ id: external_exports.string(), kind: external_exports.enum(["image", "video"]) })).max(6)
33675
+ };
33676
+ function pageBlocks3(slot) {
33677
+ return {
33678
+ Page: element3("Page", {}, box3, "The page itself, the root and only the root."),
33679
+ Section: element3("Section", { title: words3(40), to: Place3.optional(), hide_empty: external_exports.boolean().optional() }, box3, "A titled part of the page; hidden when every block in it is empty, if asked."),
33680
+ Needs: element3("Needs", { label: label3, needs: slot.needs }, leaf3, "What waits on a person: approvals, questions, spent caps."),
33681
+ Activity: element3("Activity", { label: label3, agents: slot.agents }, leaf3, "The agents working or waiting, and on what."),
33682
+ Accounts: element3("Accounts", { accounts: slot.accounts }, leaf3, "The template's networks: connected with a handle, or not."),
33683
+ Posts: element3(
33684
+ "Posts",
33685
+ { label: label3, layout: PostLayout3.optional(), posts: slot.posts },
33686
+ leaf3,
33687
+ "Posts waiting on a person, scheduled, or posted; several statuses make one list. Drawn as rows (list, the default), one sideways row of cards (row), or a picture grid (grid)."
33688
+ ),
33689
+ Answers: element3("Answers", { answers: slot.answers }, leaf3, "The setup's answers in one line, linking to the setup."),
33690
+ // No binding: the studio's gallery reads and pages the company's files itself (ADR-0987).
33691
+ MediaLibrary: element3("MediaLibrary", {}, leaf3, "Every picture and clip the company's agents made, with filters, sort and a viewer.")
33692
+ };
33693
+ }
33694
+ var OwnBound3 = pageBlocks3({
33695
+ needs: bound3(["needs"], {}),
33696
+ agents: bound3(["agents_activity"], {}),
33697
+ accounts: bound3(["accounts"], {}),
33698
+ posts: bound3(["posts"], { status: PostStatuses3, limit: external_exports.number().int().min(1).max(50).default(10) }),
33699
+ answers: bound3(["answers"], { keys: external_exports.array(Key3).min(1).max(TEMPLATE_QUESTIONS_MAX3) })
33700
+ });
33701
+ var Need3 = external_exports.object({
33702
+ session_id: external_exports.string(),
33703
+ agent_id: external_exports.string(),
33704
+ agent: external_exports.string(),
33705
+ since: Timestamp3,
33706
+ /** The chat's stored title, or `null`: the studio names it by when it began. */
33707
+ title: external_exports.string().nullable(),
33708
+ kind: external_exports.enum(["tool", "question", "budget"]),
33709
+ /** The call or question it is held on; `null` for a spent cap. */
33710
+ action: PendingActionSchema3.nullable()
33711
+ });
33712
+ var Working3 = external_exports.object({
33713
+ agent_id: external_exports.string(),
33714
+ agent: external_exports.string(),
33715
+ state: external_exports.enum(["working", "waiting"]),
33716
+ session_id: external_exports.string().nullable(),
33717
+ title: external_exports.string().nullable(),
33718
+ at: Timestamp3
33719
+ });
33720
+ var OwnResolved3 = pageBlocks3({
33721
+ needs: external_exports.strictObject({ $source: external_exports.literal("needs"), items: external_exports.array(Need3) }),
33722
+ agents: external_exports.strictObject({ $source: external_exports.literal("agents_activity"), agents: external_exports.array(Working3) }),
33723
+ accounts: external_exports.strictObject({
33724
+ $source: external_exports.literal("accounts"),
33725
+ accounts: external_exports.array(external_exports.object({ platform: SocialPlatformSchema3, connected: external_exports.boolean(), handle: external_exports.string().nullable() }))
33726
+ }),
33727
+ posts: external_exports.strictObject({ $source: external_exports.literal("posts"), status: external_exports.union([PostStatus3, external_exports.array(PostStatus3)]), limit: external_exports.number().int(), posts: external_exports.array(PostSchema3), more: external_exports.boolean() }),
33728
+ answers: external_exports.strictObject({
33729
+ $source: external_exports.literal("answers"),
33730
+ keys: external_exports.array(external_exports.string()),
33731
+ values: external_exports.array(external_exports.string()),
33732
+ template: external_exports.object({ blueprint: external_exports.string(), template: external_exports.string() }).nullable()
33733
+ })
33734
+ });
33735
+ var BoundBlocks3 = { ...catalog3(PageBound3), ...OwnBound3 };
33736
+ var ResolvedBlocks3 = { ...catalog3(PageResolved3), ...OwnResolved3 };
33737
+ var Unread3 = element3("Unread", { of: external_exports.string(), label: external_exports.string().nullable(), reason: external_exports.string() }, leaf3, "A block that could not be read.");
33738
+ var B3 = BoundBlocks3;
33739
+ var PageSpecSchema3 = spec3(
33740
+ external_exports.discriminatedUnion(
33741
+ "type",
33742
+ [B3.Page, B3.Section, B3.Stack, B3.Grid, B3.Metric, B3.LineChart, B3.BarList, B3.Progress, B3.Roadmap, B3.Schedule, B3.Media, B3.Text, B3.Needs, B3.Activity, B3.Accounts, B3.Posts, B3.Answers, B3.MediaLibrary],
33743
+ unknownComponent3(PAGE_BLOCKS3)
33744
+ ),
33745
+ "Page",
33746
+ MAX_PAGE_ELEMENTS3
33747
+ );
33748
+ var R3 = ResolvedBlocks3;
33749
+ var ResolvedPageElementSchema3 = external_exports.discriminatedUnion(
33750
+ "type",
33751
+ [R3.Page, R3.Section, R3.Stack, R3.Grid, R3.Metric, R3.LineChart, R3.BarList, R3.Progress, R3.Roadmap, R3.Schedule, R3.Media, R3.Text, R3.Needs, R3.Activity, R3.Accounts, R3.Posts, R3.Answers, R3.MediaLibrary, Unread3],
33752
+ unknownComponent3(PAGE_BLOCKS3)
33753
+ );
33754
+ var ResolvedPageSpecSchema3 = spec3(ResolvedPageElementSchema3, "Page", MAX_PAGE_ELEMENTS3);
33755
+ var unique3 = (items) => new Set(items.map((item) => item.slug)).size === items.length;
33756
+ var MiniAppPageSchema3 = external_exports.strictObject({ slug: MiniAppSlugSchema3, title: words3(24), spec: PageSpecSchema3 });
33757
+ var MiniAppDeclSchema3 = external_exports.strictObject({
33758
+ slug: MiniAppSlugSchema3,
33759
+ name: words3(40),
33760
+ icon: MiniAppIconSchema3,
33761
+ pages: external_exports.array(MiniAppPageSchema3).min(1).max(6).refine(unique3, "each page's slug is its own")
33762
+ });
33763
+ var MiniAppDeclsSchema3 = external_exports.array(MiniAppDeclSchema3).max(8).refine(unique3, "each mini app's slug is its own");
33764
+ var MiniAppSummarySchema3 = external_exports.object({
33765
+ object: external_exports.literal("mini_app"),
33766
+ slug: MiniAppSlugSchema3,
33767
+ name: external_exports.string(),
33768
+ icon: MiniAppIconSchema3,
33769
+ pages: external_exports.array(external_exports.object({ slug: MiniAppSlugSchema3, title: external_exports.string() })).min(1),
33770
+ /** What it reads (`miniAppReads`). Absent from an older API: the Studio then claims nothing it cannot see. */
33771
+ reads: external_exports.array(external_exports.string()).optional()
33772
+ });
33773
+ var MiniAppSchema3 = MiniAppSummarySchema3.extend({
33774
+ networks: external_exports.array(external_exports.object({ platform: SocialPlatformSchema3, connected: external_exports.boolean().nullable() })),
33775
+ page: MiniAppSlugSchema3,
33776
+ as_of: Timestamp3,
33777
+ timezone: external_exports.string().min(1),
33778
+ spec: ResolvedPageSpecSchema3
33779
+ });
33780
+ var MAX_BYTES3 = 16 * 1024;
32190
33781
  var encoder23 = new TextEncoder();
32191
33782
  var SESSION_FILE_URL_TTL_MS3 = 15 * 6e4;
32192
33783
  function message(error51) {
@@ -32237,8 +33828,8 @@ var PageShape = external_exports.object({
32237
33828
  });
32238
33829
  function rowLabel(row) {
32239
33830
  const { object: object2, id } = row ?? {};
32240
- const words = [object2, id].filter((one) => typeof one === "string");
32241
- return words.length > 0 ? words.join(" ") : "a row";
33831
+ const words22 = [object2, id].filter((one) => typeof one === "string");
33832
+ return words22.length > 0 ? words22.join(" ") : "a row";
32242
33833
  }
32243
33834
  var why = (error51) => error51.issues.map((issue2) => `${issue2.path.join(".") || "(root)"}: ${issue2.message}`).join("; ");
32244
33835
  async function listAll(config2, path, item, skipped, query = {}) {
@@ -32474,7 +34065,6 @@ var WalletDeclSchema = CreateWalletSchema3.or(
32474
34065
  );
32475
34066
  var CardDeclSchema = IssueCardSchema3;
32476
34067
  var IdentityDeclSchema = IdentitySchema3.pick({ name: true, description: true }).partial({ description: true }).extend({
32477
- connections: BlueprintIdentityConnectionsSchema3.optional(),
32478
34068
  legal: external_exports.array(LegalDeclSchema).optional(),
32479
34069
  wallet: WalletDeclSchema.optional(),
32480
34070
  cards: external_exports.array(CardDeclSchema).optional()
@@ -32500,6 +34090,20 @@ var ProjectSchema = external_exports.object({
32500
34090
  blueprint: external_exports.string().min(1).optional(),
32501
34091
  /** Which of that blueprint's templates provides the crew; a blueprint with a default may omit it. */
32502
34092
  template: external_exports.string().min(1).optional(),
34093
+ /**
34094
+ * What a person calls this template, one line on what its crew does, and the networks it
34095
+ * publishes to (`canonical-spec §31.5`). Printed on the artifact and never provisioned: where the
34096
+ * crew posts is the accounts connected to its persona, not this list.
34097
+ */
34098
+ title: external_exports.string().min(1).max(80).optional(),
34099
+ description: external_exports.string().min(1).max(280).optional(),
34100
+ platforms: external_exports.array(SocialPlatformSchema3).optional(),
34101
+ /**
34102
+ * The company's mini apps (`canonical-spec §50`): each a name, an icon and pages of the platform's
34103
+ * blocks — data only, checked with the platform's catalog here and again when a page is read. The
34104
+ * studio draws every one with one general UI, under Apps.
34105
+ */
34106
+ mini_apps: MiniAppDeclsSchema3.optional(),
32503
34107
  /**
32504
34108
  * What a person is asked BEFORE the crew is provisioned (`canonical-spec §31.2`).
32505
34109
  *
@@ -32580,8 +34184,8 @@ function parseProject(input) {
32580
34184
  }
32581
34185
  const config2 = parsed.data;
32582
34186
  applyChoice(config2);
32583
- if (config2.template !== void 0 && config2.questions.length > 4) {
32584
- refuse(`template "${config2.template}" asks ${config2.questions.length} questions, but a template asks at most 4 before anything is provisioned \u2014 a fifth belongs to the crew's first conversation`);
34187
+ if (config2.template !== void 0 && config2.questions.length > TEMPLATE_QUESTIONS_MAX3) {
34188
+ refuse(`template "${config2.template}" asks ${config2.questions.length} questions, but a template asks at most ${TEMPLATE_QUESTIONS_MAX3} before anything is provisioned \u2014 a fifth belongs to the crew's first conversation`);
32585
34189
  }
32586
34190
  assertUniqueNames("app", [...config2.apps.map((a) => a.name), ...config2.removed.apps]);
32587
34191
  assertUniqueNames("agent", [...config2.agents.map((a) => a.name), ...config2.removed.agents, ...config2.kept.agents]);
@@ -32602,20 +34206,6 @@ function parseProject(input) {
32602
34206
  assertUniqueNames("bucket", (app3.buckets ?? []).map((bucket) => bucket.name));
32603
34207
  }
32604
34208
  const identityNames = new Set(config2.identities.map((i) => i.name));
32605
- const connectable = config2.identities.filter((i) => i.connections !== void 0).map((i) => i.name);
32606
- if (connectable.length > 1) {
32607
- refuse(`identities ${connectable.map((n) => `"${n}"`).join(", ")} each declare connections, but the studio's Add connections step connects one persona \u2014 declare connections on the one the crew publishes through`);
32608
- }
32609
- for (const identity3 of config2.identities) {
32610
- const social3 = identity3.connections?.social;
32611
- if (social3 === void 0) continue;
32612
- const question = config2.questions.find((q) => q.key === social3.from);
32613
- if (question === void 0) refuse(`identity "${identity3.name}": connections.social.from names "${social3.from}", but no question with that key is declared in this project`);
32614
- if (question.type !== "choice") refuse(`identity "${identity3.name}": connections.social.from names "${social3.from}", which is a ${question.type} question \u2014 the map is keyed by a choice question's options`);
32615
- for (const label of Object.keys(social3.map)) {
32616
- if (!question.options.includes(label)) refuse(`identity "${identity3.name}": connections.social.map names "${label}", which is not one of question "${social3.from}"'s options \u2014 a key no answer can equal is a row nobody can reach`);
32617
- }
32618
- }
32619
34209
  for (const vault2 of config2.vaults) {
32620
34210
  if (vault2.identity !== void 0 && !identityNames.has(vault2.identity)) {
32621
34211
  refuse(`vault "${vault2.name}": identity names "${vault2.identity}", but no identity with that name is declared in this project`);
@@ -32789,165 +34379,6 @@ function contentHash(files2) {
32789
34379
  }
32790
34380
  return hash2.digest("hex");
32791
34381
  }
32792
- var PROJECT_CONTEXT_PREAMBLE = "Before anything else, read the project context with the `project_context` tool. The answers in it are the client's own \u2014 never invent, assume or restate them from memory; what the context does not say, you ask. Use the context's own words for the company, its offer and its audience.";
32793
- function desiredMetadata(decl, of, current) {
32794
- if (of.template === void 0) return decl.metadata;
32795
- return {
32796
- ...current?.metadata,
32797
- ...decl.metadata,
32798
- project: of.project,
32799
- ...of.blueprint !== void 0 ? { blueprint: of.blueprint } : {},
32800
- template: of.template,
32801
- group: of.template
32802
- };
32803
- }
32804
- function desiredSystem(decl, of) {
32805
- if (of.template === void 0) return decl.system;
32806
- return decl.system === void 0 ? PROJECT_CONTEXT_PREAMBLE : `${PROJECT_CONTEXT_PREAMBLE}
32807
-
32808
- ${decl.system}`;
32809
- }
32810
- function desiredTools(decl, current, ids) {
32811
- const handoff = decl.handoffs !== void 0 && handoffsEnabled(decl.handoffs);
32812
- if (ids === void 0 && !handoff) return decl.tools;
32813
- const base = decl.tools ?? current?.tools ?? { default_config: { permission: "allow" }, configs: {} };
32814
- const appsTool = base.configs["apps"] ?? { enabled: true, permission: base.default_config.permission };
32815
- const allowed = { enabled: true, permission: "allow" };
32816
- return {
32817
- default_config: base.default_config,
32818
- configs: {
32819
- ...base.configs,
32820
- ...ids !== void 0 ? { apps: { ...appsTool, config: { ...appsTool.config, allowed_apps: ids } } } : {},
32821
- ...handoff ? { send_to_agent: allowed, list_agents: allowed } : {}
32822
- }
32823
- };
32824
- }
32825
- async function createAgent(client, decl, tools2, team2, identityId, system, metadata) {
32826
- const created = await client.agents.create({
32827
- name: decl.name,
32828
- model: decl.model,
32829
- budget: decl.budget,
32830
- ...decl.description !== void 0 ? { description: decl.description } : {},
32831
- ...system !== void 0 ? { system } : {},
32832
- ...decl.skills !== void 0 ? { skills: decl.skills } : {},
32833
- ...decl.mcp_servers !== void 0 ? { mcp_servers: decl.mcp_servers } : {},
32834
- ...tools2 !== void 0 ? { tools: tools2 } : {},
32835
- ...decl.window !== void 0 ? { window: decl.window } : {},
32836
- ...team2 !== void 0 ? { multiagent: team2 } : {},
32837
- ...decl.handoffs !== void 0 ? { handoffs: decl.handoffs } : {},
32838
- ...decl.output_schema !== void 0 ? { output_schema: decl.output_schema } : {},
32839
- ...decl.structured_output_required !== void 0 ? { structured_output_required: decl.structured_output_required } : {},
32840
- ...metadata !== void 0 ? { metadata } : {}
32841
- });
32842
- if (identityId !== void 0) await client.identities.attach(created.id, identityId);
32843
- return { name: decl.name, action: "created", id: created.id };
32844
- }
32845
- async function upsertAgent(client, decl, existing, ids, dryRun, scoped, of) {
32846
- const unresolved = (decl.allowed_apps ?? []).filter((name) => !ids.apps.has(name));
32847
- const identityId = decl.identity === void 0 ? void 0 : ids.identities.get(decl.identity);
32848
- const missing = unresolved.length > 0 ? `allowed_apps needs app "${unresolved[0]}"` : decl.identity !== void 0 && identityId === void 0 ? `identity needs "${decl.identity}"` : null;
32849
- if (missing !== null && !dryRun) {
32850
- return { name: decl.name, action: "refused", reason: `${missing}, which was not provisioned in this run` };
32851
- }
32852
- const appIds = decl.allowed_apps !== void 0 ? decl.allowed_apps.flatMap((name) => ids.apps.get(name) ?? []) : scoped;
32853
- const current = existing.find((agent2) => agent2.name === decl.name) ?? null;
32854
- const tools2 = desiredTools(decl, current, appIds);
32855
- const team2 = teamWithoutRoster(decl.multiagent);
32856
- const system = desiredSystem(decl, of);
32857
- const metadata = desiredMetadata(decl, of, current);
32858
- if (!current) {
32859
- return dryRun ? { name: decl.name, action: "created" } : createAgent(client, decl, tools2, team2, identityId, system, metadata);
32860
- }
32861
- const patch3 = drift(decl, current, tools2, team2, system, metadata);
32862
- const held = identityId === void 0 ? [] : (await client.identities.held(current.id)).data;
32863
- const grant = identityId === void 0 || held.some((one) => one.id === identityId) ? null : identityId;
32864
- const drifted = Object.keys(patch3).length > 0 || missing !== null || grant !== null;
32865
- if (!drifted) return { name: decl.name, action: "unchanged", id: current.id };
32866
- if (!dryRun) {
32867
- if (Object.keys(patch3).length > 0) await client.agents.update(current.id, patch3);
32868
- if (grant !== null) await client.identities.attach(current.id, grant);
32869
- }
32870
- return { name: decl.name, action: "updated", id: current.id };
32871
- }
32872
- function drift(decl, current, tools2, team2, system, metadata) {
32873
- const patch3 = {};
32874
- if (changed(decl.model, current.model)) patch3.model = decl.model;
32875
- if (changed(decl.budget, current.budget)) patch3.budget = decl.budget;
32876
- if (changed(decl.description, current.description)) patch3.description = decl.description;
32877
- if (changed(system, current.system)) patch3.system = system;
32878
- if (changed(decl.skills, current.skills)) patch3.skills = decl.skills;
32879
- if (changed(decl.mcp_servers, current.mcp_servers)) patch3.mcp_servers = decl.mcp_servers;
32880
- if (changed(tools2, current.tools)) patch3.tools = tools2;
32881
- if (changed(decl.window, current.window)) patch3.window = decl.window;
32882
- if (team2 !== void 0 && changed(normaliseMultiagent2(team2), normaliseMultiagent2(current.multiagent))) patch3.multiagent = team2;
32883
- if (changed(decl.handoffs, handoffsOf(current))) patch3.handoffs = decl.handoffs;
32884
- if (changed(decl.output_schema, current.output_schema)) patch3.output_schema = decl.output_schema;
32885
- if (changed(decl.structured_output_required, current.structured_output_required)) patch3.structured_output_required = decl.structured_output_required;
32886
- if (changed(metadata, current.metadata)) patch3.metadata = metadata;
32887
- return patch3;
32888
- }
32889
- async function openIntake(client, agent2, decl, dryRun) {
32890
- if (dryRun || agent2.id === void 0) return { name: agent2.name, action: "created" };
32891
- const started = await client.sessions.create({
32892
- agent_id: agent2.id,
32893
- message: decl.message,
32894
- ...decl.budget_micro_usd !== void 0 ? { budget_micro_usd: decl.budget_micro_usd } : {}
32895
- });
32896
- return { name: agent2.name, action: "created", id: started.id };
32897
- }
32898
- function brief(input) {
32899
- const first = input.trim().split(/(?<=[.!?])\s|\n/)[0]?.trim() ?? "";
32900
- const text2 = first.replace(/[.\s]+$/, "");
32901
- return text2.length > 72 ? `${text2.slice(0, 71).trimEnd()}\u2026` : text2;
32902
- }
32903
- async function upsertSchedule(client, agent2, decl, current, identityIds, dryRun) {
32904
- const name = `${agent2.name} @ ${decl.cron}`;
32905
- if (agent2.action === "refused") throw new Error(`agent "${agent2.name}" was not provisioned in this run`);
32906
- const identity3 = decl.identity === void 0 ? void 0 : identityIds.get(decl.identity);
32907
- const unresolved = decl.identity !== void 0 && identity3 === void 0;
32908
- if (unresolved && !dryRun) throw new Error(`identity needs "${decl.identity}", which was not provisioned in this run`);
32909
- if (!current) {
32910
- if (dryRun || agent2.id === void 0) return { name, action: "created" };
32911
- const created = await client.deployments.create({
32912
- agent_id: agent2.id,
32913
- cron: decl.cron,
32914
- input_template: decl.input,
32915
- budget_micro_usd: decl.budget_micro_usd,
32916
- ...decl.timezone !== void 0 ? { timezone: decl.timezone } : {},
32917
- ...identity3 !== void 0 ? { identity: identity3 } : {},
32918
- ...decl.enabled !== void 0 ? { enabled: decl.enabled } : {}
32919
- });
32920
- return { name, action: "created", id: created.id };
32921
- }
32922
- const patch3 = {};
32923
- if (changed(decl.timezone, current.timezone)) patch3.timezone = decl.timezone;
32924
- if (changed(decl.input, current.input_template)) patch3.input_template = decl.input;
32925
- if (changed(decl.budget_micro_usd, current.budget_micro_usd)) patch3.budget_micro_usd = decl.budget_micro_usd;
32926
- if (changed(identity3, current.identity)) patch3.identity = identity3;
32927
- if (changed(decl.enabled, current.enabled)) patch3.enabled = decl.enabled;
32928
- if (Object.keys(patch3).length === 0 && !unresolved) return { name, action: "unchanged", id: current.id };
32929
- if (!dryRun) await client.deployments.update(current.id, patch3);
32930
- return { name, action: "updated", id: current.id };
32931
- }
32932
- async function reconcileSchedules(client, agent2, declared, live, identityIds, dryRun, into) {
32933
- const rows2 = live.filter((row) => row.agent_id === agent2.id);
32934
- into.push(
32935
- ...await eachInFlight(declared, async (decl) => ({
32936
- ...await line(
32937
- `${agent2.name} @ ${decl.cron}`,
32938
- () => upsertSchedule(client, agent2, decl, rows2.find((row) => row.cron === decl.cron), identityIds, dryRun)
32939
- ),
32940
- // `<agent> @ <cron>` says WHEN a timer runs and nothing about what it does, so the dashboard's
32941
- // opening message could only ever draw a timetable from these lines. The brief's first
32942
- // sentence is what turns that timetable into a roadmap (§29.6).
32943
- summary: brief(decl.input)
32944
- }))
32945
- );
32946
- for (const row of rows2.filter((row2) => !declared.some((decl) => decl.cron === row2.cron))) {
32947
- const name = `${agent2.name} @ ${row.cron}`;
32948
- await attempt(into, name, () => tombstone(name, row, (id) => client.deployments.delete(id), dryRun));
32949
- }
32950
- }
32951
34382
  async function applyBuckets(client, appId, buckets) {
32952
34383
  const live = new Set((await client.storage.buckets.list({ app: appId })).data.map((row) => row.name));
32953
34384
  const missing = buckets.filter((bucket) => !live.has(bucket.name));
@@ -32996,10 +34427,10 @@ async function findApp(client, name, skipped) {
32996
34427
  const rows2 = await listAll(client.config, "/v1/apps", AppSchema3, skipped, { name });
32997
34428
  return rows2.find((app3) => app3.name === name) ?? null;
32998
34429
  }
32999
- function ownershipRefusal(name, project, owner) {
34430
+ function ownershipRefusal(name, project, owner, kind = "app") {
33000
34431
  const held = owner === null ? "no project (it was created outside a blueprint)" : `project "${owner}"`;
33001
34432
  const verb = owner === null ? "take" : "transfer";
33002
- return `app "${name}" is owned by ${held}; this project is "${project}". Rename the app in your config, or re-run \`naive up --adopt\` to ${verb} it.`;
34433
+ return `${kind} "${name}" is owned by ${held}; this project is "${project}". Rename the ${kind} in your config, or re-run \`naive up --adopt\` to ${verb} it.`;
33003
34434
  }
33004
34435
  var ensureApp = (client, body2) => client.apps.create(body2);
33005
34436
  var PLATFORM_ENV = {
@@ -33103,13 +34534,13 @@ function builtTree(decl, opts) {
33103
34534
  const files2 = collectFiles(hosted?.[decl.name] ?? resolve3(opts.dir, decl.deploy_dir));
33104
34535
  return { files: files2, hash: contentHash(files2) };
33105
34536
  }
33106
- async function writeApp(client, id, env, tree) {
34537
+ async function writeApp(client, id, env, tree22) {
33107
34538
  await eachInFlight(
33108
34539
  Object.entries(env),
33109
34540
  ([name, value]) => client.apps.setSecret(id, { name, value, value_hash: secretHash(name, value) })
33110
34541
  );
33111
- if (!tree) return;
33112
- await client.apps.deploy(id, tree.files, tree.hash);
34542
+ if (!tree22) return;
34543
+ await client.apps.deploy(id, tree22.files, tree22.hash);
33113
34544
  await settleDeploy(client, id);
33114
34545
  }
33115
34546
  var SETTLE_TRIES = 30;
@@ -33121,7 +34552,7 @@ async function settleDeploy(client, id) {
33121
34552
  await new Promise((resolve5) => setTimeout(resolve5, SETTLE_MS));
33122
34553
  }
33123
34554
  }
33124
- async function createApp(client, decl, env, tree, migrations, opts, appIds) {
34555
+ async function createApp(client, decl, env, tree22, migrations, opts, appIds) {
33125
34556
  const created = await ensureApp(client, {
33126
34557
  name: decl.name,
33127
34558
  type: decl.type,
@@ -33130,7 +34561,7 @@ async function createApp(client, decl, env, tree, migrations, opts, appIds) {
33130
34561
  ...decl.mcp !== void 0 ? { mcp: decl.mcp } : {}
33131
34562
  });
33132
34563
  appIds.set(decl.name, created.id);
33133
- await writeApp(client, created.id, withAppId(env, decl, opts, created.id), tree);
34564
+ await writeApp(client, created.id, withAppId(env, decl, opts, created.id), tree22);
33134
34565
  const notes = [];
33135
34566
  if (migrations.length > 0) notes.push((await applyMigrations(client, created.id, migrations)).note);
33136
34567
  if (decl.buckets !== void 0) notes.push((await applyBuckets(client, created.id, decl.buckets)).note);
@@ -33201,9 +34632,9 @@ async function upsertApp(client, decl, opts, appIds) {
33201
34632
  ...(decl.mcp ?? null) !== current.mcp ? { mcp: decl.mcp ?? null } : {}
33202
34633
  };
33203
34634
  const drifted = Object.keys(patch3).length > 0;
33204
- const tree = builtTree(decl, opts);
33205
- const newest = tree ? (await client.apps.deployments(current.id, { limit: 1 })).data[0] : void 0;
33206
- const stale = tree !== null && newest?.content_hash !== tree.hash;
34635
+ const tree22 = builtTree(decl, opts);
34636
+ const newest = tree22 ? (await client.apps.deployments(current.id, { limit: 1 })).data[0] : void 0;
34637
+ const stale = tree22 !== null && newest?.content_hash !== tree22.hash;
33207
34638
  let action = !owned || drifted || stale || staleNames.length > 0 ? "updated" : "unchanged";
33208
34639
  const plan2 = opts.dryRun ? [
33209
34640
  ...staleNames.length > 0 ? [`will set ${staleNames.join(", ")}`] : [],
@@ -33214,7 +34645,7 @@ async function upsertApp(client, decl, opts, appIds) {
33214
34645
  ] : [];
33215
34646
  if (!opts.dryRun) {
33216
34647
  if (drifted) await client.apps.update(current.id, { ...patch3, project: opts.project });
33217
- await writeApp(client, current.id, staleEnv, stale ? tree : null);
34648
+ await writeApp(client, current.id, staleEnv, stale ? tree22 : null);
33218
34649
  const migrations = declaredMigrations(decl, opts);
33219
34650
  if (migrations.length > 0) {
33220
34651
  const { fresh, note: note2 } = await applyMigrations(client, current.id, migrations);
@@ -33236,6 +34667,169 @@ async function upsertApp(client, decl, opts, appIds) {
33236
34667
  ...note([...adoption, ...plan2, ...unmanaged.length > 0 ? [`unmanaged secrets: ${unmanaged.join(", ")}`] : []])
33237
34668
  };
33238
34669
  }
34670
+ var PROJECT_CONTEXT_PREAMBLE = "Before anything else, read the project context with the `project_context` tool. The answers in it are the client's own \u2014 never invent, assume or restate them from memory; what the context does not say, you ask. Use the context's own words for the company, its offer and its audience.";
34671
+ function desiredMetadata(decl, of, current) {
34672
+ if (of.template === void 0) return decl.metadata;
34673
+ return {
34674
+ ...current?.metadata,
34675
+ ...decl.metadata,
34676
+ project: of.project,
34677
+ ...of.blueprint !== void 0 ? { blueprint: of.blueprint } : {},
34678
+ template: of.template,
34679
+ group: of.template
34680
+ };
34681
+ }
34682
+ function desiredSystem(decl, of) {
34683
+ if (of.template === void 0) return decl.system;
34684
+ return decl.system === void 0 ? PROJECT_CONTEXT_PREAMBLE : `${PROJECT_CONTEXT_PREAMBLE}
34685
+
34686
+ ${decl.system}`;
34687
+ }
34688
+ function desiredTools(decl, current, ids) {
34689
+ const handoff = decl.handoffs !== void 0 && handoffsEnabled(decl.handoffs);
34690
+ if (ids === void 0 && !handoff) return decl.tools;
34691
+ const base = decl.tools ?? current?.tools ?? { default_config: { permission: "allow" }, configs: {} };
34692
+ const appsTool = base.configs["apps"] ?? { enabled: true, permission: base.default_config.permission };
34693
+ const allowed = { enabled: true, permission: "allow" };
34694
+ return {
34695
+ default_config: base.default_config,
34696
+ configs: {
34697
+ ...base.configs,
34698
+ ...ids !== void 0 ? { apps: { ...appsTool, config: { ...appsTool.config, allowed_apps: ids } } } : {},
34699
+ ...handoff ? { send_to_agent: allowed, list_agents: allowed } : {}
34700
+ }
34701
+ };
34702
+ }
34703
+ async function createAgent(client, decl, tools2, team2, identityId, system, metadata) {
34704
+ const created = await client.agents.create({
34705
+ name: decl.name,
34706
+ model: decl.model,
34707
+ budget: decl.budget,
34708
+ ...decl.description !== void 0 ? { description: decl.description } : {},
34709
+ ...system !== void 0 ? { system } : {},
34710
+ ...decl.skills !== void 0 ? { skills: decl.skills } : {},
34711
+ ...decl.mcp_servers !== void 0 ? { mcp_servers: decl.mcp_servers } : {},
34712
+ ...tools2 !== void 0 ? { tools: tools2 } : {},
34713
+ ...decl.window !== void 0 ? { window: decl.window } : {},
34714
+ ...team2 !== void 0 ? { multiagent: team2 } : {},
34715
+ ...decl.handoffs !== void 0 ? { handoffs: decl.handoffs } : {},
34716
+ ...decl.output_schema !== void 0 ? { output_schema: decl.output_schema } : {},
34717
+ ...decl.structured_output_required !== void 0 ? { structured_output_required: decl.structured_output_required } : {},
34718
+ ...metadata !== void 0 ? { metadata } : {}
34719
+ });
34720
+ if (identityId !== void 0) await client.identities.attach(created.id, identityId);
34721
+ return { name: decl.name, action: "created", id: created.id };
34722
+ }
34723
+ async function upsertAgent(client, decl, existing, ids, dryRun, scoped, of) {
34724
+ const unresolved = (decl.allowed_apps ?? []).filter((name) => !ids.apps.has(name));
34725
+ const identityId = decl.identity === void 0 ? void 0 : ids.identities.get(decl.identity);
34726
+ const missing = unresolved.length > 0 ? `allowed_apps needs app "${unresolved[0]}"` : decl.identity !== void 0 && identityId === void 0 ? `identity needs "${decl.identity}"` : null;
34727
+ if (missing !== null && !dryRun) {
34728
+ return { name: decl.name, action: "refused", reason: `${missing}, which was not provisioned in this run` };
34729
+ }
34730
+ const appIds = decl.allowed_apps !== void 0 ? decl.allowed_apps.flatMap((name) => ids.apps.get(name) ?? []) : scoped;
34731
+ const current = existing.find((agent2) => agent2.name === decl.name) ?? null;
34732
+ const owner = typeof current?.metadata?.["project"] === "string" ? current.metadata["project"] : null;
34733
+ if (current && of.template !== void 0 && owner !== null && owner !== of.project && !of.adopt) {
34734
+ return { name: decl.name, action: "refused", id: current.id, reason: ownershipRefusal(decl.name, of.project, owner, "agent") };
34735
+ }
34736
+ const tools2 = desiredTools(decl, current, appIds);
34737
+ const team2 = teamWithoutRoster(decl.multiagent);
34738
+ const system = desiredSystem(decl, of);
34739
+ const metadata = desiredMetadata(decl, of, current);
34740
+ if (!current) {
34741
+ return dryRun ? { name: decl.name, action: "created" } : createAgent(client, decl, tools2, team2, identityId, system, metadata);
34742
+ }
34743
+ const patch3 = drift(decl, current, tools2, team2, system, metadata);
34744
+ const held = identityId === void 0 ? [] : (await client.identities.held(current.id)).data;
34745
+ const grant = identityId === void 0 || held.some((one) => one.id === identityId) ? null : identityId;
34746
+ const drifted = Object.keys(patch3).length > 0 || missing !== null || grant !== null;
34747
+ if (!drifted) return { name: decl.name, action: "unchanged", id: current.id };
34748
+ if (!dryRun) {
34749
+ if (Object.keys(patch3).length > 0) await client.agents.update(current.id, patch3);
34750
+ if (grant !== null) await client.identities.attach(current.id, grant);
34751
+ }
34752
+ return { name: decl.name, action: "updated", id: current.id };
34753
+ }
34754
+ function drift(decl, current, tools2, team2, system, metadata) {
34755
+ const patch3 = {};
34756
+ if (changed(decl.model, current.model)) patch3.model = decl.model;
34757
+ if (changed(decl.budget, current.budget)) patch3.budget = decl.budget;
34758
+ if (changed(decl.description, current.description)) patch3.description = decl.description;
34759
+ if (changed(system, current.system)) patch3.system = system;
34760
+ if (changed(decl.skills, current.skills)) patch3.skills = decl.skills;
34761
+ if (changed(decl.mcp_servers, current.mcp_servers)) patch3.mcp_servers = decl.mcp_servers;
34762
+ if (changed(tools2, current.tools)) patch3.tools = tools2;
34763
+ if (changed(decl.window, current.window)) patch3.window = decl.window;
34764
+ if (team2 !== void 0 && changed(normaliseMultiagent2(team2), normaliseMultiagent2(current.multiagent))) patch3.multiagent = team2;
34765
+ if (changed(decl.handoffs, handoffsOf(current))) patch3.handoffs = decl.handoffs;
34766
+ if (changed(decl.output_schema, current.output_schema)) patch3.output_schema = decl.output_schema;
34767
+ if (changed(decl.structured_output_required, current.structured_output_required)) patch3.structured_output_required = decl.structured_output_required;
34768
+ if (changed(metadata, current.metadata)) patch3.metadata = metadata;
34769
+ return patch3;
34770
+ }
34771
+ async function openIntake(client, agent2, decl, dryRun) {
34772
+ if (dryRun || agent2.id === void 0) return { name: agent2.name, action: "created" };
34773
+ const started = await client.sessions.create({
34774
+ agent_id: agent2.id,
34775
+ message: decl.message,
34776
+ ...decl.budget_micro_usd !== void 0 ? { budget_micro_usd: decl.budget_micro_usd } : {}
34777
+ });
34778
+ return { name: agent2.name, action: "created", id: started.id };
34779
+ }
34780
+ function brief(input) {
34781
+ const first = input.trim().split(/(?<=[.!?])\s|\n/)[0]?.trim() ?? "";
34782
+ const text2 = first.replace(/[.\s]+$/, "");
34783
+ return text2.length > 72 ? `${text2.slice(0, 71).trimEnd()}\u2026` : text2;
34784
+ }
34785
+ async function upsertSchedule(client, agent2, decl, current, identityIds, dryRun) {
34786
+ const name = `${agent2.name} @ ${decl.cron}`;
34787
+ if (agent2.action === "refused") throw new Error(`agent "${agent2.name}" was not provisioned in this run`);
34788
+ const identity3 = decl.identity === void 0 ? void 0 : identityIds.get(decl.identity);
34789
+ const unresolved = decl.identity !== void 0 && identity3 === void 0;
34790
+ if (unresolved && !dryRun) throw new Error(`identity needs "${decl.identity}", which was not provisioned in this run`);
34791
+ if (!current) {
34792
+ if (dryRun || agent2.id === void 0) return { name, action: "created" };
34793
+ const created = await client.deployments.create({
34794
+ agent_id: agent2.id,
34795
+ cron: decl.cron,
34796
+ input_template: decl.input,
34797
+ budget_micro_usd: decl.budget_micro_usd,
34798
+ ...decl.timezone !== void 0 ? { timezone: decl.timezone } : {},
34799
+ ...identity3 !== void 0 ? { identity: identity3 } : {},
34800
+ ...decl.enabled !== void 0 ? { enabled: decl.enabled } : {}
34801
+ });
34802
+ return { name, action: "created", id: created.id };
34803
+ }
34804
+ const patch3 = {};
34805
+ if (changed(decl.timezone, current.timezone)) patch3.timezone = decl.timezone;
34806
+ if (changed(decl.input, current.input_template)) patch3.input_template = decl.input;
34807
+ if (changed(decl.budget_micro_usd, current.budget_micro_usd)) patch3.budget_micro_usd = decl.budget_micro_usd;
34808
+ if (changed(identity3, current.identity)) patch3.identity = identity3;
34809
+ if (changed(decl.enabled, current.enabled)) patch3.enabled = decl.enabled;
34810
+ if (Object.keys(patch3).length === 0 && !unresolved) return { name, action: "unchanged", id: current.id };
34811
+ if (!dryRun) await client.deployments.update(current.id, patch3);
34812
+ return { name, action: "updated", id: current.id };
34813
+ }
34814
+ async function reconcileSchedules(client, agent2, declared, live, identityIds, dryRun, into) {
34815
+ const rows2 = live.filter((row) => row.agent_id === agent2.id);
34816
+ into.push(
34817
+ ...await eachInFlight(declared, async (decl) => ({
34818
+ ...await line(
34819
+ `${agent2.name} @ ${decl.cron}`,
34820
+ () => upsertSchedule(client, agent2, decl, rows2.find((row) => row.cron === decl.cron), identityIds, dryRun)
34821
+ ),
34822
+ // `<agent> @ <cron>` says WHEN a timer runs and nothing about what it does, so the dashboard's
34823
+ // opening message could only ever draw a timetable from these lines. The brief's first
34824
+ // sentence is what turns that timetable into a roadmap (§29.6).
34825
+ summary: brief(decl.input)
34826
+ }))
34827
+ );
34828
+ for (const row of rows2.filter((row2) => !declared.some((decl) => decl.cron === row2.cron))) {
34829
+ const name = `${agent2.name} @ ${row.cron}`;
34830
+ await attempt(into, name, () => tombstone(name, row, (id) => client.deployments.delete(id), dryRun));
34831
+ }
34832
+ }
33239
34833
  var LIVE = /* @__PURE__ */ new Set(["pending_payment", "issuing", "active"]);
33240
34834
  var nameOf = (identity3, decl) => `${identity3} / card ${decl.label}`;
33241
34835
  async function upsertCard(client, identityId, decl, live, dryRun, name) {
@@ -33681,7 +35275,7 @@ async function up(config2, client, opts = {}) {
33681
35275
  const deployments2 = taken.agents.some((decl) => decl.schedules !== void 0) ? await listAll(client.config, "/v1/deployments", DeploymentSchema3, report2.skipped) : [];
33682
35276
  const scoped = config2.apps.length > 0 ? [...ids.apps.values()] : void 0;
33683
35277
  const crew = await eachInFlight(taken.agents, async (decl) => {
33684
- const agent2 = await line(decl.name, () => upsertAgent(client, decl, existing, ids, dryRun, scoped, { project: opts.project ?? config2.name, ...applied(config2) }));
35278
+ const agent2 = await line(decl.name, () => upsertAgent(client, decl, existing, ids, dryRun, scoped, { project: opts.project ?? config2.name, ...applied(config2), adopt: opts.adopt ?? false }));
33685
35279
  const schedules = [];
33686
35280
  if (decl.schedules !== void 0) {
33687
35281
  await reconcileSchedules(client, agent2, decl.schedules, deployments2, ids.identities, dryRun, schedules);
@@ -33737,6 +35331,8 @@ var app2 = {
33737
35331
  /** Names and value hashes only: a secret's value is write-only and never comes back (§29.2). */
33738
35332
  secrets: async ({ client, args }) => ({ out: await client.apps.secrets(args.at(0, "app-id")) }),
33739
35333
  domains: async ({ client, args }) => ({ out: await client.apps.domains(args.at(0, "app-id")) }),
35334
+ /** What the app's own key lets it do: its scopes, never the key (ADR-1048). */
35335
+ permissions: async ({ client, args }) => ({ out: await client.apps.permissions(args.at(0, "app-id")) }),
33740
35336
  // core-gaps: U8-database
33741
35337
  /** Idempotent on the name (§29.2): creating an app that exists returns it. */
33742
35338
  create: async ({ client, args }) => {
@@ -34426,12 +36022,8 @@ var media5 = {
34426
36022
  };
34427
36023
  }
34428
36024
  if (kind !== "video") throw new UsageError("--kind must be image or video");
34429
- const { model: model2 } = body2;
34430
- if (model2 === void 0)
34431
- throw new UsageError("--model is required for a video");
34432
36025
  const queued = await client.media.videos.generate({
34433
36026
  ...body2,
34434
- model: model2,
34435
36027
  seconds: args.int("seconds")
34436
36028
  });
34437
36029
  if (!args.bool("wait")) return { out: queued };
@@ -34538,7 +36130,15 @@ var email3 = {
34538
36130
  limit: args.int("limit")
34539
36131
  })
34540
36132
  };
34541
- }
36133
+ },
36134
+ /** Mark an arrived message read, or back to unread with `--unread` (ADR-1076). */
36135
+ read: async ({ client, args }) => ({
36136
+ out: await client.emails.markRead(who(args), args.str("message") ?? args.at(1, "message-id"), !args.bool("unread"))
36137
+ }),
36138
+ /** What the persona sent, newest first — through the API and through its agent alike. */
36139
+ sent: async ({ client, args }) => ({
36140
+ out: await client.emails.sent(who(args), { limit: args.int("limit") })
36141
+ })
34542
36142
  };
34543
36143
 
34544
36144
  // src/commands/computer.ts
@@ -34806,6 +36406,13 @@ function oneOf3(args, flag, allowed) {
34806
36406
  if (allowed.includes(value)) return value;
34807
36407
  throw new UsageError(`--${flag} must be one of: ${allowed.join(", ")}`);
34808
36408
  }
36409
+ function kinds(args, flag) {
36410
+ const value = args.str(flag);
36411
+ if (value === void 0) return void 0;
36412
+ const bad = value.split(",").filter((one) => !FILE_KINDS.includes(one.trim()));
36413
+ if (bad.length > 0) throw new UsageError(`--${flag} must be one or more of: ${FILE_KINDS.join(", ")}`);
36414
+ return value;
36415
+ }
34809
36416
  var tags = (args) => args.has("tag") ? args.list("tag").flatMap((one) => one.split(",")).map((one) => one.trim()).filter(Boolean) : void 0;
34810
36417
  var file2 = {
34811
36418
  upload: async ({ client, args, readBytes }) => {
@@ -34825,10 +36432,14 @@ var file2 = {
34825
36432
  out: await client.files.list({
34826
36433
  scope: scope(args),
34827
36434
  session_id: args.str("session"),
34828
- kind: oneOf3(args, "kind", FILE_KINDS),
36435
+ kind: kinds(args, "kind"),
34829
36436
  source: oneOf3(args, "source", FILE_SOURCE_TYPES),
34830
36437
  tag: args.str("tag"),
34831
36438
  search: args.str("search"),
36439
+ exclude_kind: kinds(args, "exclude-kind"),
36440
+ agent_id: args.str("agent"),
36441
+ ids: args.str("ids"),
36442
+ order: oneOf3(args, "order", ["desc", "asc"]),
34832
36443
  limit: args.int("limit"),
34833
36444
  after: args.str("after")
34834
36445
  })
@@ -35014,6 +36625,17 @@ async function loadProject(cmd) {
35014
36625
  }
35015
36626
  return { dir, config: load.config };
35016
36627
  }
36628
+ async function recordApply(cmd, config2) {
36629
+ const [held] = (await cmd.client.apps.installs.list({ project: config2.name })).data;
36630
+ await cmd.client.apps.installs.apply({
36631
+ project: config2.name,
36632
+ declaration: { questions: config2.questions, agents: config2.agents.map(({ name, role: role2 }) => ({ name, role: role2 })) },
36633
+ blueprint: config2.blueprint ?? null,
36634
+ template: config2.template ?? null,
36635
+ answers: held?.answers ?? {},
36636
+ source: "cli"
36637
+ });
36638
+ }
35017
36639
  async function context(cmd) {
35018
36640
  const { config: config2 } = await loadProject(cmd);
35019
36641
  const cleared = new Set(cmd.args.list("clear"));
@@ -35137,14 +36759,12 @@ var naive = {
35137
36759
  up: async (cmd) => {
35138
36760
  const { dir, config: config2 } = await loadProject(cmd);
35139
36761
  const selected = select(config2, names(cmd.args.list("only")), names(cmd.args.list("without")));
36762
+ const dryRun = cmd.args.bool("dry-run");
35140
36763
  const report2 = {
35141
- ...await up(selected.config, cmd.client, {
35142
- dry_run: cmd.args.bool("dry-run"),
35143
- dir,
35144
- adopt: cmd.args.bool("adopt")
35145
- }),
36764
+ ...await up(selected.config, cmd.client, { dry_run: dryRun, dir, adopt: cmd.args.bool("adopt") }),
35146
36765
  deselected: selected.deselected
35147
36766
  };
36767
+ if (!dryRun) await recordApply(cmd, config2);
35148
36768
  const refused = [
35149
36769
  ...report2.skills,
35150
36770
  ...report2.identities,
@@ -35354,9 +36974,22 @@ var org = {
35354
36974
  return { out: { profile: cmd.config.profile, org_id: id } };
35355
36975
  },
35356
36976
  show: async (cmd) => ({ out: await cmd.client.orgs.get(orgId(cmd)) }),
35357
- update: async (cmd) => ({
35358
- out: await cmd.client.orgs.update(orgId(cmd), { name: cmd.args.need("name") })
35359
- }),
36977
+ /** `--name`, `--timezone` (IANA, §20.6), `--logo-file` (an SVG file, §20.7), or any together; one is needed. */
36978
+ update: async (cmd) => {
36979
+ const name = cmd.args.str("name");
36980
+ const timezone = cmd.args.str("timezone");
36981
+ const logoFile = cmd.args.str("logo-file");
36982
+ if (name === void 0 && timezone === void 0 && logoFile === void 0) {
36983
+ throw new UsageError("org update needs --name, --timezone or --logo-file");
36984
+ }
36985
+ return {
36986
+ out: await cmd.client.orgs.update(orgId(cmd), {
36987
+ ...name === void 0 ? {} : { name },
36988
+ ...timezone === void 0 ? {} : { timezone },
36989
+ ...logoFile === void 0 ? {} : { logo_svg: cmd.readFile(logoFile) }
36990
+ })
36991
+ };
36992
+ },
35360
36993
  members: async (cmd) => ({
35361
36994
  out: await cmd.client.orgs.members(orgId(cmd), { limit: cmd.args.int("limit") })
35362
36995
  }),
@@ -35900,13 +37533,13 @@ var social2 = {
35900
37533
  }),
35901
37534
  /** `--post` or `--account`, whichever side of the numbers is wanted. */
35902
37535
  analytics: async ({ client, args }) => {
35903
- const post = args.str("post");
37536
+ const post2 = args.str("post");
35904
37537
  const account = args.str("account");
35905
- if (post === void 0 === (account === void 0)) {
37538
+ if (post2 === void 0 === (account === void 0)) {
35906
37539
  throw new UsageError("pass exactly one of --post <id> or --account <id>");
35907
37540
  }
35908
37541
  return {
35909
- out: post === void 0 ? await client.social.accountAnalytics(ref4(args), account ?? "") : await client.social.postAnalytics(ref4(args), post)
37542
+ out: post2 === void 0 ? await client.social.accountAnalytics(ref4(args), account ?? "") : await client.social.postAnalytics(ref4(args), post2)
35910
37543
  };
35911
37544
  },
35912
37545
  comments: async ({ client, args }) => ({
@@ -35916,6 +37549,22 @@ var social2 = {
35916
37549
  })
35917
37550
  })
35918
37551
  };
37552
+ var post = {
37553
+ list: async ({ client, args }) => {
37554
+ const status3 = args.str("status");
37555
+ const identity3 = args.str("identity");
37556
+ const agent2 = args.str("agent");
37557
+ return {
37558
+ out: await client.social.listPosts({
37559
+ ...status3 === void 0 ? {} : { status: status3 },
37560
+ ...identity3 === void 0 ? {} : { identity_id: identity3 },
37561
+ ...agent2 === void 0 ? {} : { agent_id: agent2 },
37562
+ limit: args.int("limit"),
37563
+ after: args.str("after")
37564
+ })
37565
+ };
37566
+ }
37567
+ };
35919
37568
 
35920
37569
  // src/commands/storage.ts
35921
37570
  function split(path, keyRequired) {
@@ -36321,7 +37970,8 @@ var FLAGS = {
36321
37970
  tools: "tool enable disable permission allow-domain block-domain max-content-tokens model",
36322
37971
  identities: "",
36323
37972
  delete: "",
36324
- spend: "by"
37973
+ spend: "by",
37974
+ computer: ""
36325
37975
  },
36326
37976
  /**
36327
37977
  * The roster on one coordinator (§28). Every write is a read-modify-write of one agent under
@@ -36428,6 +38078,7 @@ var FLAGS = {
36428
38078
  deployments: "limit",
36429
38079
  secrets: "",
36430
38080
  domains: "",
38081
+ permissions: "",
36431
38082
  // core-gaps: U8-database
36432
38083
  create: "type",
36433
38084
  deploy: ""
@@ -36453,7 +38104,9 @@ var FLAGS = {
36453
38104
  list: "identity limit",
36454
38105
  send: "identity inbox to subject text message",
36455
38106
  rm: "identity inbox",
36456
- messages: "identity channel limit"
38107
+ messages: "identity channel limit",
38108
+ read: "identity message unread",
38109
+ sent: "identity limit"
36457
38110
  },
36458
38111
  connections: {
36459
38112
  apps: "search limit after",
@@ -36482,6 +38135,8 @@ var FLAGS = {
36482
38135
  analytics: "identity post account",
36483
38136
  comments: "identity post limit after"
36484
38137
  },
38138
+ /** The company's posts across identities (§27.1); `--identity` and `--agent` narrow it. */
38139
+ post: { list: "status identity agent limit after" },
36485
38140
  /** `legal`, `wallet`, `cards`: `vetta identity legal|wallet|card …` (canonical-spec §43–§45). */
36486
38141
  legal: {
36487
38142
  verifications: "identity limit after",
@@ -36581,7 +38236,7 @@ var FLAGS = {
36581
38236
  },
36582
38237
  file: {
36583
38238
  upload: "file name scope session title description tag",
36584
- list: "scope session kind source tag search limit after",
38239
+ list: "scope session kind source tag search exclude-kind agent ids order limit after",
36585
38240
  show: "",
36586
38241
  download: "",
36587
38242
  publish: "",
@@ -36618,7 +38273,7 @@ var FLAGS = {
36618
38273
  create: "name use",
36619
38274
  use: "",
36620
38275
  show: "",
36621
- update: "name",
38276
+ update: "name timezone logo-file",
36622
38277
  members: "limit",
36623
38278
  invite: "email role",
36624
38279
  "set-role": "role",
@@ -36655,6 +38310,7 @@ var GROUPS = {
36655
38310
  email: email3,
36656
38311
  phone,
36657
38312
  social: social2,
38313
+ post,
36658
38314
  legal: legal2,
36659
38315
  wallet: wallet2,
36660
38316
  cards: cards2,
@@ -36695,7 +38351,7 @@ var ALIASES = {
36695
38351
  };
36696
38352
 
36697
38353
  // src/cli.ts
36698
- var VERSION = true ? "0.5.0" : "0.0.0-dev";
38354
+ var VERSION = true ? "0.6.0" : "0.0.0-dev";
36699
38355
  var GLOBAL_FLAGS_HELP = "global flags: --json (default) --human --profile <name> --api-key <key> --org <org_id> --api-base-url <url>";
36700
38356
  function usage() {
36701
38357
  const groups = [...Object.keys(GROUPS), ...Object.keys(ALIASES)].sort().join(", ");