@botiverse/raft-daemon 0.72.8 → 1.0.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.
package/dist/cli/index.js CHANGED
@@ -28774,6 +28774,71 @@ function randomHex(length) {
28774
28774
 
28775
28775
  // ../shared/src/tracing/eventRows.ts
28776
28776
  init_esm_shims();
28777
+ var TRACE_EVENT_ROW_V2_PROJECTION_COLUMNS = [
28778
+ ["row_kind", "string"],
28779
+ ["service_name", "string"],
28780
+ ["deployment_environment", "string"],
28781
+ ["service_version", "string"],
28782
+ ["service_revision", "string"],
28783
+ ["service_instance_id", "string"],
28784
+ ["deployment_instance_source", "string"],
28785
+ ["deployment_identity_state", "string"],
28786
+ ["ecs_task_id", "string"],
28787
+ ["ecs_task_family", "string"],
28788
+ ["ecs_task_revision", "string"],
28789
+ ["trace_id", "string"],
28790
+ ["span_id", "string"],
28791
+ ["parent_span_id", "string"],
28792
+ ["span_name", "string"],
28793
+ ["span_kind", "string"],
28794
+ ["span_surface", "string"],
28795
+ ["span_status", "string"],
28796
+ ["span_start_time_ms", "int"],
28797
+ ["span_end_time_ms", "int"],
28798
+ ["event_name", "string"],
28799
+ ["event_kind", "string"],
28800
+ ["event_time", "timestamp"],
28801
+ ["event_time_ms", "int"],
28802
+ ["event_index", "int"],
28803
+ ["server_id", "string"],
28804
+ ["machine_id", "string"],
28805
+ ["agent_id", "string"],
28806
+ ["launch_id", "string"],
28807
+ ["session_id", "string"],
28808
+ ["request_id", "string"],
28809
+ ["route_pattern", "string"],
28810
+ ["caller_kind", "string"],
28811
+ ["outcome", "string"],
28812
+ ["reason", "string"],
28813
+ ["source", "string"],
28814
+ ["authority", "string"],
28815
+ ["activity_write_site", "string"],
28816
+ ["activity_source", "string"],
28817
+ ["hint_source", "string"],
28818
+ ["resolved_activity", "string"],
28819
+ ["previous_activity", "string"],
28820
+ ["next_activity", "string"],
28821
+ ["repair_kind", "string"],
28822
+ ["action", "string"],
28823
+ ["error_class", "string"],
28824
+ ["status_bucket", "string"],
28825
+ ["shadow_agent_id", "string"],
28826
+ ["shadow_signal_site", "string"],
28827
+ ["shadow_observation_class", "string"],
28828
+ ["shadow_prior_projection", "string"],
28829
+ ["shadow_projection", "string"],
28830
+ ["shadow_legacy_outcome", "string"],
28831
+ ["shadow_action", "string"],
28832
+ ["shadow_reason", "string"],
28833
+ ["shadow_direction", "string"],
28834
+ ["shadow_plan_kind", "string"]
28835
+ ];
28836
+ var TRACE_EVENT_ROW_V2_INGEST_STATEMENT = [
28837
+ "SELECT",
28838
+ TRACE_EVENT_ROW_V2_PROJECTION_COLUMNS.map(([column, type]) => `$0["${column}"]::${type} AS ${column}`).join(", "),
28839
+ "INSERT INTO raft.trace_events_v2",
28840
+ `(${TRACE_EVENT_ROW_V2_PROJECTION_COLUMNS.map(([column]) => column).join(", ")})`
28841
+ ].join(" ");
28777
28842
  var PROMOTED_IDENTITY_ATTRS = [
28778
28843
  "server_id",
28779
28844
  "machine_id",
@@ -42899,7 +42964,7 @@ var integrationAppDraftFieldsSchema = external_exports.object({
42899
42964
  var integrationRegisterAppOperationSchema = integrationAppDraftFieldsSchema.extend({
42900
42965
  type: external_exports.literal("integration:register_app"),
42901
42966
  name: external_exports.string().trim().min(1).max(120),
42902
- clientKey: external_exports.string().trim().min(1).max(120),
42967
+ clientKey: external_exports.string().trim().min(1).max(120).optional(),
42903
42968
  returnUrl: external_exports.string().trim().min(1).max(2e3),
42904
42969
  scopes: external_exports.array(external_exports.string().trim().min(1).max(120)).max(64).default([]),
42905
42970
  unsafeDemoUrlOverride: external_exports.boolean().optional(),
@@ -43343,10 +43408,8 @@ var agentApiIntegrationLoginBodySchema = passthroughObject({
43343
43408
  scopes: optionalStringArraySchema,
43344
43409
  target: optionalStringSchema
43345
43410
  });
43346
- var agentApiIntegrationAppPrepareBodySchema = passthroughObject({
43347
- mode: external_exports.enum(["register", "update"]),
43411
+ var agentApiIntegrationAppPrepareCommonBodyShape = {
43348
43412
  target: external_exports.string().trim().min(1),
43349
- clientKey: external_exports.string().trim().min(1),
43350
43413
  name: optionalStringSchema,
43351
43414
  description: optionalStringSchema,
43352
43415
  homepageUrl: optionalStringSchema,
@@ -43355,7 +43418,19 @@ var agentApiIntegrationAppPrepareBodySchema = passthroughObject({
43355
43418
  scopes: optionalStringArraySchema,
43356
43419
  unsafeDemoUrlOverride: optionalBooleanSchema,
43357
43420
  draftHint: optionalStringSchema
43358
- });
43421
+ };
43422
+ var agentApiIntegrationAppPrepareBodySchema = external_exports.discriminatedUnion("mode", [
43423
+ passthroughObject({
43424
+ mode: external_exports.literal("register"),
43425
+ ...agentApiIntegrationAppPrepareCommonBodyShape,
43426
+ clientKey: optionalStringSchema
43427
+ }),
43428
+ passthroughObject({
43429
+ mode: external_exports.literal("update"),
43430
+ ...agentApiIntegrationAppPrepareCommonBodyShape,
43431
+ clientKey: external_exports.string().trim().min(1)
43432
+ })
43433
+ ]);
43359
43434
  var agentApiIntegrationAppRotateSecretBodySchema = passthroughObject({
43360
43435
  clientKey: external_exports.string().trim().min(1)
43361
43436
  });
@@ -45404,6 +45479,9 @@ init_esm_shims();
45404
45479
  // ../shared/src/sync-core/testing.ts
45405
45480
  init_esm_shims();
45406
45481
 
45482
+ // ../shared/src/onboardingStateMachineContract.ts
45483
+ init_esm_shims();
45484
+
45407
45485
  // ../shared/src/testing/failpoints.ts
45408
45486
  init_esm_shims();
45409
45487
  var NoopFailpointRegistry = class {
@@ -45610,6 +45688,57 @@ var CANONICAL_MESSAGE_MANIFEST = Object.freeze({
45610
45688
  excludedClientOnly: EXCLUDED_CLIENT_ONLY_MESSAGE_FIELDS
45611
45689
  });
45612
45690
 
45691
+ // ../shared/src/canonicalMessageV2.ts
45692
+ init_esm_shims();
45693
+ var CANONICAL_MESSAGE_V2_SCHEMA_VERSION = 5;
45694
+ var CANONICAL_MESSAGE_V2_ENVELOPE_KIND = "normalized-message-v2";
45695
+ var CANONICAL_REACTION_PREVIEW_LIMIT = 3;
45696
+ var CANONICAL_REACTION_LIMIT = 30;
45697
+ var CANONICAL_MESSAGE_V2_MANIFEST = Object.freeze({
45698
+ schemaVersion: CANONICAL_MESSAGE_V2_SCHEMA_VERSION,
45699
+ envelopeKind: CANONICAL_MESSAGE_V2_ENVELOPE_KIND,
45700
+ legacyIngressManifestVersion: CANONICAL_MESSAGE_MANIFEST_VERSION,
45701
+ soleApplyEligible: true,
45702
+ reactions: Object.freeze({
45703
+ mergePolicy: "present-overwrite",
45704
+ maxItems: CANONICAL_REACTION_LIMIT,
45705
+ fields: Object.freeze(["count", "emoji", "previewK"]),
45706
+ previewFields: Object.freeze(["displayName", "id"]),
45707
+ previewLimit: CANONICAL_REACTION_PREVIEW_LIMIT,
45708
+ legacyCompatibilityPreviewPolicy: "empty-without-room-common-provenance",
45709
+ deterministicOrder: "emoji-code-unit/actor-id-code-unit"
45710
+ }),
45711
+ viewerOverlayFields: Object.freeze(["reactions.reactedByMe"]),
45712
+ readCacheRelations: Object.freeze(["Message.ReactionActors"]),
45713
+ forbiddenCanonicalPaths: Object.freeze([
45714
+ "reactions[].reactorIds",
45715
+ "reactions[].reactorNames"
45716
+ ])
45717
+ });
45718
+
45719
+ // ../shared/src/discussionGraph.ts
45720
+ init_esm_shims();
45721
+ var DISCUSSION_RELATION_REGISTRY = Object.freeze({
45722
+ messageReactionActors: Object.freeze({
45723
+ rootKind: "message",
45724
+ relation: "reaction-actors",
45725
+ backing: "read-cache",
45726
+ consistency: "read-page",
45727
+ provenance: Object.freeze({ count: "shared-parent-fold", previewK: "shared-parent-fold" }),
45728
+ invalidation: "parent-scope-epoch",
45729
+ allowedCommands: Object.freeze(["set-interaction"])
45730
+ }),
45731
+ messageReplies: Object.freeze({
45732
+ rootKind: "message",
45733
+ relation: "replies",
45734
+ backing: "sync-scope",
45735
+ consistency: "sync-scope-window",
45736
+ provenance: Object.freeze({ replyCount: "shared-parent-fold" }),
45737
+ invalidation: "own-scope-rebaseline",
45738
+ allowedCommands: Object.freeze(["reply"])
45739
+ })
45740
+ });
45741
+
45613
45742
  // ../shared/src/index.ts
45614
45743
  var BUILTIN_RUNTIME_PROVIDER_ENV_KEYS = PI_BUILTIN_PROVIDER_API_KEY_ENV_KEYS_GENERATED;
45615
45744
  var BUILTIN_RUNTIME_PROVIDERS = Object.entries(BUILTIN_RUNTIME_PROVIDER_ENV_KEYS).map(([id, envKey]) => ({ id, envKey }));
@@ -51474,6 +51603,7 @@ function formatPendingMentionActions(actions, opts = {}) {
51474
51603
  const lines = opts.source === "send" ? [
51475
51604
  "Undelivered mentions",
51476
51605
  "Message was sent, but these @mentions were not delivered:",
51606
+ "For a literal name rather than a recipient, wrap the @handle in inline or fenced code.",
51477
51607
  ""
51478
51608
  ] : ["Pending mention actions", ""];
51479
51609
  for (const action of actions) {
@@ -51487,7 +51617,7 @@ function formatPendingMentionActions(actions, opts = {}) {
51487
51617
  lines.push(" recovery commands:");
51488
51618
  lines.push(...commands);
51489
51619
  if (commands.some((command) => command.includes(" mention notify "))) {
51490
- lines.push(" note: notify can still report dropped; check the command result before assuming delivery.");
51620
+ lines.push(" note: notify exits nonzero unless the target queue accepts the delivery.");
51491
51621
  }
51492
51622
  }
51493
51623
  }
@@ -51866,12 +51996,19 @@ ${driveByTip}` : "";
51866
51996
  if (pendingMentionActions.length > 0) {
51867
51997
  writeUndeliveredMentionWarning(ctx.io, pendingMentionActions.length);
51868
51998
  }
51999
+ const mentionDeliveryError = pendingMentionActions.length > 0 ? cliError(
52000
+ "MENTION_DELIVERY_FAILED",
52001
+ `Message ${data.messageId} was sent, but ${pendingMentionActions.length} @mention${pendingMentionActions.length === 1 ? " was" : "s were"} not delivered.`,
52002
+ { suggestedNextAction: "Run `raft mention pending` and complete or explicitly resolve every pending mention action." }
52003
+ ) : null;
51869
52004
  if (opts.json) {
51870
52005
  writeJson(ctx.io, data);
52006
+ if (mentionDeliveryError) throw mentionDeliveryError;
51871
52007
  return;
51872
52008
  }
51873
52009
  writeText(ctx.io, `${sentStatusLine}${replyHint}${driveBySection}${mentionSection}${unreadSection}
51874
52010
  `);
52011
+ if (mentionDeliveryError) throw mentionDeliveryError;
51875
52012
  }
51876
52013
  var messageSendCommand = defineCommand(
51877
52014
  {
@@ -53071,6 +53208,17 @@ init_esm_shims();
53071
53208
 
53072
53209
  // src/commands/mention/execute.ts
53073
53210
  init_esm_shims();
53211
+ function resultSucceeded(action, status) {
53212
+ return action === "notify" ? status === "queued" : status === "delivered";
53213
+ }
53214
+ function formatFailedMentionActions(action, requestedIds, results) {
53215
+ const returnedIds = new Set(results.map((result2) => result2.resolutionId));
53216
+ const failures = results.filter((result2) => !resultSucceeded(action, result2.status)).map((result2) => `${result2.resolutionId}: ${result2.status}${result2.reason ? ` (${result2.reason})` : ""}`);
53217
+ for (const id of requestedIds) {
53218
+ if (!returnedIds.has(id)) failures.push(`${id}: missing_result`);
53219
+ }
53220
+ return failures.length > 0 ? failures.join(", ") : null;
53221
+ }
53074
53222
  function normalizeResolutionIds(rawIds) {
53075
53223
  const ids = (rawIds ?? []).map((id) => id.trim()).filter(Boolean);
53076
53224
  if (ids.length === 0) {
@@ -53098,6 +53246,13 @@ function buildMentionExecuteCommand(action) {
53098
53246
  throw cliError(res.status >= 500 ? "SERVER_5XX" : "MENTION_ACTION_FAILED", res.error ?? `HTTP ${res.status}`);
53099
53247
  }
53100
53248
  const results = normalizeMentionActionResults(res.data);
53249
+ const failure3 = formatFailedMentionActions(action, ids, results);
53250
+ if (failure3) {
53251
+ throw cliError(
53252
+ "MENTION_ACTION_FAILED",
53253
+ `Mention ${action} did not complete for every requested target: ${failure3}`
53254
+ );
53255
+ }
53101
53256
  if (opts.json) {
53102
53257
  writeJson(ctx.io, { ok: true, action, results });
53103
53258
  return;
@@ -54680,7 +54835,7 @@ function optionalTrimmed(value) {
54680
54835
  function formatAppPrepare(data) {
54681
54836
  const lines = [
54682
54837
  `Integration app ${data.mode} card prepared`,
54683
- `client key: ${data.action.clientKey}`,
54838
+ `client key: ${data.action.clientKey ?? "auto-generated on commit"}`,
54684
54839
  `card: ${data.actionCardMessageId}`,
54685
54840
  `target: ${data.target}`
54686
54841
  ];
@@ -54698,14 +54853,11 @@ function formatAppPrepare(data) {
54698
54853
  }
54699
54854
  async function prepareApp(mode, ctx, opts) {
54700
54855
  const target = requiredTrimmed(opts.target, "--target");
54701
- const clientKey = requiredTrimmed(opts.clientKey, "--client-key");
54702
54856
  const scopes = normalizeScopes3([...opts.scope ?? [], ...opts.scopes ?? []]);
54703
54857
  const agentContext = ctx.loadAgentContext();
54704
54858
  const client = ctx.createApiClient(agentContext);
54705
- const body = {
54706
- mode,
54859
+ const commonBody = {
54707
54860
  target,
54708
- clientKey,
54709
54861
  name: optionalTrimmed(opts.name),
54710
54862
  description: optionalTrimmed(opts.description),
54711
54863
  homepageUrl: optionalTrimmed(opts.homepageUrl) ?? optionalTrimmed(opts.appUrl),
@@ -54714,7 +54866,8 @@ async function prepareApp(mode, ctx, opts) {
54714
54866
  scopes,
54715
54867
  unsafeDemoUrlOverride: opts.unsafeDemoUrlOverride === true
54716
54868
  };
54717
- if (mode === "register") {
54869
+ const body = mode === "update" ? { ...commonBody, mode: "update", clientKey: requiredTrimmed(opts.clientKey, "--client-key") } : { ...commonBody, mode: "register", clientKey: optionalTrimmed(opts.clientKey) };
54870
+ if (body.mode === "register") {
54718
54871
  requiredTrimmed(body.name, "--name");
54719
54872
  requiredTrimmed(body.returnUrl, "--redirect-url");
54720
54873
  }
@@ -54893,7 +55046,7 @@ var integrationAppPrepareRecoverOwnerCommand = defineCommand(
54893
55046
  async (ctx, opts) => prepareRecoverOwner(ctx, opts)
54894
55047
  );
54895
55048
  var sharedOptions = [
54896
- { flags: "--client-key <key>", description: "Stable app client key / OAuth client_id to reserve or update" },
55049
+ { flags: "--client-key <key>", description: "Stable app client key / OAuth client_id to reserve or update; register defaults to server-generated" },
54897
55050
  { flags: "--name <name>", description: "App display name" },
54898
55051
  { flags: "--redirect-url <url>", description: "OAuth redirect/callback URL" },
54899
55052
  { flags: "--app-url <url>", description: "App homepage URL" },
package/dist/core.js CHANGED
@@ -36,7 +36,7 @@ import {
36
36
  stageAgentMigrationObjectStoreBundle,
37
37
  subscribeDaemonLogs,
38
38
  verifyAgentMigrationAdoptPlan
39
- } from "./chunk-FNFNAY5B.js";
39
+ } from "./chunk-FGXAADHM.js";
40
40
  export {
41
41
  AGENT_MIGRATION_BUNDLE_SCHEMA_VERSION,
42
42
  AGENT_MIGRATION_CONTROL_SEAM_ENV,
@@ -28522,6 +28522,71 @@ function randomHex(length) {
28522
28522
  return [...bytes].map((byte) => byte.toString(16).padStart(2, "0")).join("");
28523
28523
  }
28524
28524
  init_esm_shims();
28525
+ var TRACE_EVENT_ROW_V2_PROJECTION_COLUMNS = [
28526
+ ["row_kind", "string"],
28527
+ ["service_name", "string"],
28528
+ ["deployment_environment", "string"],
28529
+ ["service_version", "string"],
28530
+ ["service_revision", "string"],
28531
+ ["service_instance_id", "string"],
28532
+ ["deployment_instance_source", "string"],
28533
+ ["deployment_identity_state", "string"],
28534
+ ["ecs_task_id", "string"],
28535
+ ["ecs_task_family", "string"],
28536
+ ["ecs_task_revision", "string"],
28537
+ ["trace_id", "string"],
28538
+ ["span_id", "string"],
28539
+ ["parent_span_id", "string"],
28540
+ ["span_name", "string"],
28541
+ ["span_kind", "string"],
28542
+ ["span_surface", "string"],
28543
+ ["span_status", "string"],
28544
+ ["span_start_time_ms", "int"],
28545
+ ["span_end_time_ms", "int"],
28546
+ ["event_name", "string"],
28547
+ ["event_kind", "string"],
28548
+ ["event_time", "timestamp"],
28549
+ ["event_time_ms", "int"],
28550
+ ["event_index", "int"],
28551
+ ["server_id", "string"],
28552
+ ["machine_id", "string"],
28553
+ ["agent_id", "string"],
28554
+ ["launch_id", "string"],
28555
+ ["session_id", "string"],
28556
+ ["request_id", "string"],
28557
+ ["route_pattern", "string"],
28558
+ ["caller_kind", "string"],
28559
+ ["outcome", "string"],
28560
+ ["reason", "string"],
28561
+ ["source", "string"],
28562
+ ["authority", "string"],
28563
+ ["activity_write_site", "string"],
28564
+ ["activity_source", "string"],
28565
+ ["hint_source", "string"],
28566
+ ["resolved_activity", "string"],
28567
+ ["previous_activity", "string"],
28568
+ ["next_activity", "string"],
28569
+ ["repair_kind", "string"],
28570
+ ["action", "string"],
28571
+ ["error_class", "string"],
28572
+ ["status_bucket", "string"],
28573
+ ["shadow_agent_id", "string"],
28574
+ ["shadow_signal_site", "string"],
28575
+ ["shadow_observation_class", "string"],
28576
+ ["shadow_prior_projection", "string"],
28577
+ ["shadow_projection", "string"],
28578
+ ["shadow_legacy_outcome", "string"],
28579
+ ["shadow_action", "string"],
28580
+ ["shadow_reason", "string"],
28581
+ ["shadow_direction", "string"],
28582
+ ["shadow_plan_kind", "string"]
28583
+ ];
28584
+ var TRACE_EVENT_ROW_V2_INGEST_STATEMENT = [
28585
+ "SELECT",
28586
+ TRACE_EVENT_ROW_V2_PROJECTION_COLUMNS.map(([column, type]) => `$0["${column}"]::${type} AS ${column}`).join(", "),
28587
+ "INSERT INTO raft.trace_events_v2",
28588
+ `(${TRACE_EVENT_ROW_V2_PROJECTION_COLUMNS.map(([column]) => column).join(", ")})`
28589
+ ].join(" ");
28525
28590
  var PROMOTED_IDENTITY_ATTRS = [
28526
28591
  "server_id",
28527
28592
  "machine_id",
@@ -42461,7 +42526,7 @@ var integrationAppDraftFieldsSchema = external_exports.object({
42461
42526
  var integrationRegisterAppOperationSchema = integrationAppDraftFieldsSchema.extend({
42462
42527
  type: external_exports.literal("integration:register_app"),
42463
42528
  name: external_exports.string().trim().min(1).max(120),
42464
- clientKey: external_exports.string().trim().min(1).max(120),
42529
+ clientKey: external_exports.string().trim().min(1).max(120).optional(),
42465
42530
  returnUrl: external_exports.string().trim().min(1).max(2e3),
42466
42531
  scopes: external_exports.array(external_exports.string().trim().min(1).max(120)).max(64).default([]),
42467
42532
  unsafeDemoUrlOverride: external_exports.boolean().optional(),
@@ -42895,10 +42960,8 @@ var agentApiIntegrationLoginBodySchema = passthroughObject({
42895
42960
  scopes: optionalStringArraySchema,
42896
42961
  target: optionalStringSchema
42897
42962
  });
42898
- var agentApiIntegrationAppPrepareBodySchema = passthroughObject({
42899
- mode: external_exports.enum(["register", "update"]),
42963
+ var agentApiIntegrationAppPrepareCommonBodyShape = {
42900
42964
  target: external_exports.string().trim().min(1),
42901
- clientKey: external_exports.string().trim().min(1),
42902
42965
  name: optionalStringSchema,
42903
42966
  description: optionalStringSchema,
42904
42967
  homepageUrl: optionalStringSchema,
@@ -42907,7 +42970,19 @@ var agentApiIntegrationAppPrepareBodySchema = passthroughObject({
42907
42970
  scopes: optionalStringArraySchema,
42908
42971
  unsafeDemoUrlOverride: optionalBooleanSchema,
42909
42972
  draftHint: optionalStringSchema
42910
- });
42973
+ };
42974
+ var agentApiIntegrationAppPrepareBodySchema = external_exports.discriminatedUnion("mode", [
42975
+ passthroughObject({
42976
+ mode: external_exports.literal("register"),
42977
+ ...agentApiIntegrationAppPrepareCommonBodyShape,
42978
+ clientKey: optionalStringSchema
42979
+ }),
42980
+ passthroughObject({
42981
+ mode: external_exports.literal("update"),
42982
+ ...agentApiIntegrationAppPrepareCommonBodyShape,
42983
+ clientKey: external_exports.string().trim().min(1)
42984
+ })
42985
+ ]);
42911
42986
  var agentApiIntegrationAppRotateSecretBodySchema = passthroughObject({
42912
42987
  clientKey: external_exports.string().trim().min(1)
42913
42988
  });
@@ -44918,6 +44993,7 @@ init_esm_shims();
44918
44993
  init_esm_shims();
44919
44994
  init_esm_shims();
44920
44995
  init_esm_shims();
44996
+ init_esm_shims();
44921
44997
  var NoopFailpointRegistry = class {
44922
44998
  get enabled() {
44923
44999
  return false;
@@ -45111,6 +45187,53 @@ var CANONICAL_MESSAGE_MANIFEST = Object.freeze({
45111
45187
  exclusions: CANONICAL_MESSAGE_EXCLUSIONS,
45112
45188
  excludedClientOnly: EXCLUDED_CLIENT_ONLY_MESSAGE_FIELDS
45113
45189
  });
45190
+ init_esm_shims();
45191
+ var CANONICAL_MESSAGE_V2_SCHEMA_VERSION = 5;
45192
+ var CANONICAL_MESSAGE_V2_ENVELOPE_KIND = "normalized-message-v2";
45193
+ var CANONICAL_REACTION_PREVIEW_LIMIT = 3;
45194
+ var CANONICAL_REACTION_LIMIT = 30;
45195
+ var CANONICAL_MESSAGE_V2_MANIFEST = Object.freeze({
45196
+ schemaVersion: CANONICAL_MESSAGE_V2_SCHEMA_VERSION,
45197
+ envelopeKind: CANONICAL_MESSAGE_V2_ENVELOPE_KIND,
45198
+ legacyIngressManifestVersion: CANONICAL_MESSAGE_MANIFEST_VERSION,
45199
+ soleApplyEligible: true,
45200
+ reactions: Object.freeze({
45201
+ mergePolicy: "present-overwrite",
45202
+ maxItems: CANONICAL_REACTION_LIMIT,
45203
+ fields: Object.freeze(["count", "emoji", "previewK"]),
45204
+ previewFields: Object.freeze(["displayName", "id"]),
45205
+ previewLimit: CANONICAL_REACTION_PREVIEW_LIMIT,
45206
+ legacyCompatibilityPreviewPolicy: "empty-without-room-common-provenance",
45207
+ deterministicOrder: "emoji-code-unit/actor-id-code-unit"
45208
+ }),
45209
+ viewerOverlayFields: Object.freeze(["reactions.reactedByMe"]),
45210
+ readCacheRelations: Object.freeze(["Message.ReactionActors"]),
45211
+ forbiddenCanonicalPaths: Object.freeze([
45212
+ "reactions[].reactorIds",
45213
+ "reactions[].reactorNames"
45214
+ ])
45215
+ });
45216
+ init_esm_shims();
45217
+ var DISCUSSION_RELATION_REGISTRY = Object.freeze({
45218
+ messageReactionActors: Object.freeze({
45219
+ rootKind: "message",
45220
+ relation: "reaction-actors",
45221
+ backing: "read-cache",
45222
+ consistency: "read-page",
45223
+ provenance: Object.freeze({ count: "shared-parent-fold", previewK: "shared-parent-fold" }),
45224
+ invalidation: "parent-scope-epoch",
45225
+ allowedCommands: Object.freeze(["set-interaction"])
45226
+ }),
45227
+ messageReplies: Object.freeze({
45228
+ rootKind: "message",
45229
+ relation: "replies",
45230
+ backing: "sync-scope",
45231
+ consistency: "sync-scope-window",
45232
+ provenance: Object.freeze({ replyCount: "shared-parent-fold" }),
45233
+ invalidation: "own-scope-rebaseline",
45234
+ allowedCommands: Object.freeze(["reply"])
45235
+ })
45236
+ });
45114
45237
  var BUILTIN_RUNTIME_PROVIDER_ENV_KEYS = PI_BUILTIN_PROVIDER_API_KEY_ENV_KEYS_GENERATED;
45115
45238
  var BUILTIN_RUNTIME_PROVIDERS = Object.entries(BUILTIN_RUNTIME_PROVIDER_ENV_KEYS).map(([id, envKey]) => ({ id, envKey }));
45116
45239
  var PI_BUILTIN_PROVIDER_ENV_KEYS = {
@@ -50850,6 +50973,7 @@ function formatPendingMentionActions(actions, opts = {}) {
50850
50973
  const lines = opts.source === "send" ? [
50851
50974
  "Undelivered mentions",
50852
50975
  "Message was sent, but these @mentions were not delivered:",
50976
+ "For a literal name rather than a recipient, wrap the @handle in inline or fenced code.",
50853
50977
  ""
50854
50978
  ] : ["Pending mention actions", ""];
50855
50979
  for (const action of actions) {
@@ -50863,7 +50987,7 @@ function formatPendingMentionActions(actions, opts = {}) {
50863
50987
  lines.push(" recovery commands:");
50864
50988
  lines.push(...commands);
50865
50989
  if (commands.some((command) => command.includes(" mention notify "))) {
50866
- lines.push(" note: notify can still report dropped; check the command result before assuming delivery.");
50990
+ lines.push(" note: notify exits nonzero unless the target queue accepts the delivery.");
50867
50991
  }
50868
50992
  }
50869
50993
  }
@@ -51235,12 +51359,19 @@ ${driveByTip}` : "";
51235
51359
  if (pendingMentionActions.length > 0) {
51236
51360
  writeUndeliveredMentionWarning(ctx.io, pendingMentionActions.length);
51237
51361
  }
51362
+ const mentionDeliveryError = pendingMentionActions.length > 0 ? cliError(
51363
+ "MENTION_DELIVERY_FAILED",
51364
+ `Message ${data.messageId} was sent, but ${pendingMentionActions.length} @mention${pendingMentionActions.length === 1 ? " was" : "s were"} not delivered.`,
51365
+ { suggestedNextAction: "Run `raft mention pending` and complete or explicitly resolve every pending mention action." }
51366
+ ) : null;
51238
51367
  if (opts.json) {
51239
51368
  writeJson(ctx.io, data);
51369
+ if (mentionDeliveryError) throw mentionDeliveryError;
51240
51370
  return;
51241
51371
  }
51242
51372
  writeText(ctx.io, `${sentStatusLine}${replyHint}${driveBySection}${mentionSection}${unreadSection}
51243
51373
  `);
51374
+ if (mentionDeliveryError) throw mentionDeliveryError;
51244
51375
  }
51245
51376
  var messageSendCommand = defineCommand(
51246
51377
  {
@@ -52395,6 +52526,17 @@ function registerTaskUpdateCommand(parent, runtimeOptions) {
52395
52526
  }
52396
52527
  init_esm_shims();
52397
52528
  init_esm_shims();
52529
+ function resultSucceeded(action, status) {
52530
+ return action === "notify" ? status === "queued" : status === "delivered";
52531
+ }
52532
+ function formatFailedMentionActions(action, requestedIds, results) {
52533
+ const returnedIds = new Set(results.map((result2) => result2.resolutionId));
52534
+ const failures = results.filter((result2) => !resultSucceeded(action, result2.status)).map((result2) => `${result2.resolutionId}: ${result2.status}${result2.reason ? ` (${result2.reason})` : ""}`);
52535
+ for (const id of requestedIds) {
52536
+ if (!returnedIds.has(id)) failures.push(`${id}: missing_result`);
52537
+ }
52538
+ return failures.length > 0 ? failures.join(", ") : null;
52539
+ }
52398
52540
  function normalizeResolutionIds(rawIds) {
52399
52541
  const ids = (rawIds ?? []).map((id) => id.trim()).filter(Boolean);
52400
52542
  if (ids.length === 0) {
@@ -52422,6 +52564,13 @@ function buildMentionExecuteCommand(action) {
52422
52564
  throw cliError(res.status >= 500 ? "SERVER_5XX" : "MENTION_ACTION_FAILED", res.error ?? `HTTP ${res.status}`);
52423
52565
  }
52424
52566
  const results = normalizeMentionActionResults(res.data);
52567
+ const failure3 = formatFailedMentionActions(action, ids, results);
52568
+ if (failure3) {
52569
+ throw cliError(
52570
+ "MENTION_ACTION_FAILED",
52571
+ `Mention ${action} did not complete for every requested target: ${failure3}`
52572
+ );
52573
+ }
52425
52574
  if (opts.json) {
52426
52575
  writeJson(ctx.io, { ok: true, action, results });
52427
52576
  return;
@@ -53969,7 +54118,7 @@ function optionalTrimmed(value) {
53969
54118
  function formatAppPrepare(data) {
53970
54119
  const lines = [
53971
54120
  `Integration app ${data.mode} card prepared`,
53972
- `client key: ${data.action.clientKey}`,
54121
+ `client key: ${data.action.clientKey ?? "auto-generated on commit"}`,
53973
54122
  `card: ${data.actionCardMessageId}`,
53974
54123
  `target: ${data.target}`
53975
54124
  ];
@@ -53987,14 +54136,11 @@ function formatAppPrepare(data) {
53987
54136
  }
53988
54137
  async function prepareApp(mode, ctx, opts) {
53989
54138
  const target = requiredTrimmed(opts.target, "--target");
53990
- const clientKey = requiredTrimmed(opts.clientKey, "--client-key");
53991
54139
  const scopes = normalizeScopes3([...opts.scope ?? [], ...opts.scopes ?? []]);
53992
54140
  const agentContext = ctx.loadAgentContext();
53993
54141
  const client = ctx.createApiClient(agentContext);
53994
- const body = {
53995
- mode,
54142
+ const commonBody = {
53996
54143
  target,
53997
- clientKey,
53998
54144
  name: optionalTrimmed(opts.name),
53999
54145
  description: optionalTrimmed(opts.description),
54000
54146
  homepageUrl: optionalTrimmed(opts.homepageUrl) ?? optionalTrimmed(opts.appUrl),
@@ -54003,7 +54149,8 @@ async function prepareApp(mode, ctx, opts) {
54003
54149
  scopes,
54004
54150
  unsafeDemoUrlOverride: opts.unsafeDemoUrlOverride === true
54005
54151
  };
54006
- if (mode === "register") {
54152
+ const body = mode === "update" ? { ...commonBody, mode: "update", clientKey: requiredTrimmed(opts.clientKey, "--client-key") } : { ...commonBody, mode: "register", clientKey: optionalTrimmed(opts.clientKey) };
54153
+ if (body.mode === "register") {
54007
54154
  requiredTrimmed(body.name, "--name");
54008
54155
  requiredTrimmed(body.returnUrl, "--redirect-url");
54009
54156
  }
@@ -54182,7 +54329,7 @@ var integrationAppPrepareRecoverOwnerCommand = defineCommand(
54182
54329
  async (ctx, opts) => prepareRecoverOwner(ctx, opts)
54183
54330
  );
54184
54331
  var sharedOptions = [
54185
- { flags: "--client-key <key>", description: "Stable app client key / OAuth client_id to reserve or update" },
54332
+ { flags: "--client-key <key>", description: "Stable app client key / OAuth client_id to reserve or update; register defaults to server-generated" },
54186
54333
  { flags: "--name <name>", description: "App display name" },
54187
54334
  { flags: "--redirect-url <url>", description: "OAuth redirect/callback URL" },
54188
54335
  { flags: "--app-url <url>", description: "App homepage URL" },
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  DAEMON_CLI_USAGE,
4
4
  DaemonCore,
5
5
  parseDaemonCliArgs
6
- } from "./chunk-FNFNAY5B.js";
6
+ } from "./chunk-FGXAADHM.js";
7
7
 
8
8
  // src/index.ts
9
9
  var parsedArgs = parseDaemonCliArgs(process.argv.slice(2));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botiverse/raft-daemon",
3
- "version": "0.72.8",
3
+ "version": "1.0.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "raft-daemon": "dist/raft-daemon.js",