@botiverse/raft-daemon 1.0.9 → 1.0.11

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
@@ -29161,15 +29161,22 @@ var TRACE_EVENT_ROW_V2_PROJECTION_COLUMNS = [
29161
29161
  ["shadow_action", "string"],
29162
29162
  ["shadow_reason", "string"],
29163
29163
  ["shadow_direction", "string"],
29164
- ["shadow_plan_kind", "string"]
29164
+ ["shadow_plan_kind", "string"],
29165
+ ["machine_affinity_route", "string"],
29166
+ ["replay_status", "int"]
29165
29167
  ];
29168
+ var TRACE_EVENT_ROW_V2_LEGACY_PROJECTION_COLUMNS = Object.freeze(TRACE_EVENT_ROW_V2_PROJECTION_COLUMNS.slice(0, 57));
29166
29169
  var TRACE_EVENT_ROW_V2_TABLE = "raft.trace_events_v2";
29167
- var TRACE_EVENT_ROW_V2_INGEST_STATEMENT = [
29168
- "SELECT",
29169
- TRACE_EVENT_ROW_V2_PROJECTION_COLUMNS.map(([column, type]) => `$0["${column}"]::${type} AS ${column}`).join(", "),
29170
- `INSERT INTO ${TRACE_EVENT_ROW_V2_TABLE}`,
29171
- `(${TRACE_EVENT_ROW_V2_PROJECTION_COLUMNS.map(([column]) => column).join(", ")})`
29172
- ].join(" ");
29170
+ function buildTraceEventRowV2IngestStatement(columns) {
29171
+ return [
29172
+ "SELECT",
29173
+ columns.map(([column, type]) => `$0["${column}"]::${type} AS ${column}`).join(", "),
29174
+ `INSERT INTO ${TRACE_EVENT_ROW_V2_TABLE}`,
29175
+ `(${columns.map(([column]) => column).join(", ")})`
29176
+ ].join(" ");
29177
+ }
29178
+ var TRACE_EVENT_ROW_V2_INGEST_STATEMENT = buildTraceEventRowV2IngestStatement(TRACE_EVENT_ROW_V2_PROJECTION_COLUMNS);
29179
+ var TRACE_EVENT_ROW_V2_LEGACY_INGEST_STATEMENT = buildTraceEventRowV2IngestStatement(TRACE_EVENT_ROW_V2_LEGACY_PROJECTION_COLUMNS);
29173
29180
  var PROMOTED_IDENTITY_ATTRS = [
29174
29181
  "server_id",
29175
29182
  "machine_id",
@@ -29225,7 +29232,8 @@ var PROMOTED_CLOSED_ATTRS = [
29225
29232
  "shadow_action",
29226
29233
  "shadow_reason",
29227
29234
  "shadow_direction",
29228
- "shadow_plan_kind"
29235
+ "shadow_plan_kind",
29236
+ "machine_affinity_route"
29229
29237
  ];
29230
29238
  var TRACE_EVENT_ROW_PROMOTED_ATTRS = [
29231
29239
  ...PROMOTED_IDENTITY_ATTRS,
@@ -43832,6 +43840,10 @@ var agentApiIntegrationAppUpdateBodySchema = passthroughObject({
43832
43840
  scopes: optionalStringArraySchema,
43833
43841
  unsafeDemoUrlOverride: optionalBooleanSchema
43834
43842
  });
43843
+ var agentApiIntegrationAppStatusQuerySchema = passthroughObject({
43844
+ card: optionalStringSchema,
43845
+ client: optionalStringSchema
43846
+ });
43835
43847
  var agentApiActionPrepareBodySchema = passthroughObject({
43836
43848
  target: external_exports.string().trim().min(1),
43837
43849
  action: actionCardActionSchema
@@ -43986,6 +43998,23 @@ var agentApiIntegrationAppUpdateResponseSchema = passthroughObject({
43986
43998
  clientName: external_exports.string(),
43987
43999
  updatedFields: external_exports.array(external_exports.string())
43988
44000
  });
44001
+ var agentApiOwnedIntegrationAppSchema = external_exports.object({
44002
+ state: external_exports.enum(["card_pending", "committed"]),
44003
+ card: nullableStringSchema,
44004
+ name: external_exports.string(),
44005
+ clientKey: nullableStringSchema,
44006
+ createdAt: external_exports.string(),
44007
+ callbackUrl: nullableStringSchema,
44008
+ scopes: external_exports.array(external_exports.string()),
44009
+ category: nullableStringSchema,
44010
+ recoveryCommand: nullableStringSchema
44011
+ });
44012
+ var agentApiIntegrationAppListResponseSchema = external_exports.object({
44013
+ apps: external_exports.array(agentApiOwnedIntegrationAppSchema)
44014
+ });
44015
+ var agentApiIntegrationAppStatusResponseSchema = external_exports.object({
44016
+ app: agentApiOwnedIntegrationAppSchema
44017
+ });
43989
44018
  var agentApiAttachmentEnvelopeSchema = passthroughObject({
43990
44019
  id: external_exports.string(),
43991
44020
  filename: external_exports.string()
@@ -44782,6 +44811,26 @@ var agentApiContract = {
44782
44811
  request: { body: agentApiIntegrationAppUpdateBodySchema },
44783
44812
  response: { body: agentApiIntegrationAppUpdateResponseSchema }
44784
44813
  }),
44814
+ integrationAppList: route({
44815
+ key: "integrationAppList",
44816
+ method: "GET",
44817
+ path: "/integrations/app",
44818
+ client: { resource: "integrations", method: "listApps" },
44819
+ capability: "read",
44820
+ description: "List pending app registration cards requested by this agent and server-local apps this agent currently owns.",
44821
+ request: {},
44822
+ response: { body: agentApiIntegrationAppListResponseSchema }
44823
+ }),
44824
+ integrationAppStatus: route({
44825
+ key: "integrationAppStatus",
44826
+ method: "GET",
44827
+ path: "/integrations/app/status",
44828
+ client: { resource: "integrations", method: "getAppStatus" },
44829
+ capability: "read",
44830
+ description: "Get one requester-visible registration card or currently owned app without disclosing non-owned app existence.",
44831
+ request: { query: agentApiIntegrationAppStatusQuerySchema },
44832
+ response: { body: agentApiIntegrationAppStatusResponseSchema }
44833
+ }),
44785
44834
  actionPrepare: route({
44786
44835
  key: "actionPrepare",
44787
44836
  method: "POST",
@@ -46716,7 +46765,9 @@ function createAgentApiSurfaceClient(client) {
46716
46765
  prepareApp: (body) => requestClientAsApiResponse(agentApi.integrations.prepareApp(body)),
46717
46766
  rotateAppSecret: (body) => requestClientAsApiResponse(agentApi.integrations.rotateAppSecret(body)),
46718
46767
  transferAppOwner: (body) => requestClientAsApiResponse(agentApi.integrations.transferAppOwner(body)),
46719
- updateApp: (body) => requestClientAsApiResponse(agentApi.integrations.updateApp(body))
46768
+ updateApp: (body) => requestClientAsApiResponse(agentApi.integrations.updateApp(body)),
46769
+ listApps: () => requestClientAsApiResponse(agentApi.integrations.listApps()),
46770
+ getAppStatus: (query) => requestClientAsApiResponse(agentApi.integrations.getAppStatus(query))
46720
46771
  },
46721
46772
  actions: {
46722
46773
  prepare: (body) => requestClientAsApiResponse(agentApi.actions.prepare(body))
@@ -53152,7 +53203,9 @@ var attachmentUploadCommand = defineCommand(
53152
53203
  if (!res.ok) {
53153
53204
  const code = res.errorCode ?? (res.status >= 500 ? "SERVER_5XX" : "UPLOAD_FAILED");
53154
53205
  throw cliError(code, res.error ?? `HTTP ${res.status}`, {
53155
- suggestedNextAction: res.suggestedNextAction ?? void 0
53206
+ suggestedNextAction: res.suggestedNextAction ?? void 0,
53207
+ layer: res.proxy?.layer ?? void 0,
53208
+ correlationId: res.proxy?.correlationId ?? void 0
53156
53209
  });
53157
53210
  }
53158
53211
  const d = res.data;
@@ -55343,7 +55396,10 @@ function formatAppPrepare(data) {
55343
55396
  lines.push("capability: every agent can self-register an app; App Admin is not involved");
55344
55397
  if (data.mode === "register") lines.push("owner: the requesting agent (you) becomes the app owner and can rotate, update, or transfer it after commit");
55345
55398
  lines.push("next: submit the action card for server commit");
55346
- lines.push("secret: never stored in the card; the app owner generates it afterward with rotate-secret and sees it once");
55399
+ if (data.mode === "register") {
55400
+ lines.push("secret: after human commit, the requesting owner agent receives the initial secret once through a private transient notice; it is never stored in the card or chat history");
55401
+ lines.push("recovery: if that notice is missed, use `raft integration app rotate-secret --client <client-key-from-receipt>`; the new secret is shown once and invalidates the previous one");
55402
+ }
55347
55403
  return lines.join("\n");
55348
55404
  }
55349
55405
  async function prepareApp(mode, ctx, opts) {
@@ -55507,6 +55563,83 @@ var integrationAppUpdateCommand = defineCommand(
55507
55563
  },
55508
55564
  async (ctx, opts) => updateApp(ctx, opts)
55509
55565
  );
55566
+ function formatAppStatus(app) {
55567
+ const lines = [
55568
+ `state: ${app.state}`,
55569
+ `name: ${app.name}`,
55570
+ ...app.card ? [`card: ${app.card}`] : [],
55571
+ ...app.clientKey ? [`client key: ${app.clientKey}`] : [],
55572
+ `created: ${app.createdAt}`,
55573
+ `callback URL: ${app.callbackUrl ?? "-"}`,
55574
+ `scopes: ${app.scopes.length > 0 ? app.scopes.join(", ") : "-"}`,
55575
+ `category: ${app.category ?? "-"}`
55576
+ ];
55577
+ if (app.recoveryCommand) {
55578
+ lines.push(`recovery: lost the secret? Run \`${app.recoveryCommand}\`; it returns a new show-once secret and invalidates the previous one`);
55579
+ } else if (app.state === "card_pending") {
55580
+ lines.push("next: ask a human owner/admin to commit the registration card");
55581
+ }
55582
+ return lines.join("\n");
55583
+ }
55584
+ async function listApps(ctx, opts) {
55585
+ const agentContext = ctx.loadAgentContext();
55586
+ const client = ctx.createApiClient(agentContext);
55587
+ const res = await createAgentApiSurfaceClient(client).integrations.listApps();
55588
+ if (!res.ok || !res.data) {
55589
+ const code = res.status >= 500 ? "SERVER_5XX" : "INTEGRATION_APP_LIST_FAILED";
55590
+ throw cliError(code, res.error ?? `HTTP ${res.status}`);
55591
+ }
55592
+ if (opts.json) {
55593
+ writeJson(ctx.io, { ok: true, data: res.data });
55594
+ return;
55595
+ }
55596
+ if (res.data.apps.length === 0) {
55597
+ writeText(ctx.io, "No pending registration cards or currently owned apps.\n");
55598
+ return;
55599
+ }
55600
+ writeText(ctx.io, `${res.data.apps.map(formatAppStatus).join("\n\n")}
55601
+ `);
55602
+ }
55603
+ async function getAppStatus(ctx, opts) {
55604
+ const card = optionalTrimmed(opts.card);
55605
+ const clientKey = optionalTrimmed(opts.client);
55606
+ if (Boolean(card) === Boolean(clientKey)) {
55607
+ throw cliError("INVALID_ARG", "Exactly one of --card or --client is required");
55608
+ }
55609
+ const agentContext = ctx.loadAgentContext();
55610
+ const client = ctx.createApiClient(agentContext);
55611
+ const res = await createAgentApiSurfaceClient(client).integrations.getAppStatus({ card, client: clientKey });
55612
+ if (!res.ok || !res.data) {
55613
+ const code = res.status >= 500 ? "SERVER_5XX" : "INTEGRATION_APP_STATUS_FAILED";
55614
+ throw cliError(code, res.error ?? `HTTP ${res.status}`);
55615
+ }
55616
+ if (opts.json) {
55617
+ writeJson(ctx.io, { ok: true, data: res.data });
55618
+ return;
55619
+ }
55620
+ writeText(ctx.io, `${formatAppStatus(res.data.app)}
55621
+ `);
55622
+ }
55623
+ var integrationAppListCommand = defineCommand(
55624
+ {
55625
+ name: "list",
55626
+ description: "List your pending app registration cards and currently owned server-local apps",
55627
+ options: [{ flags: "--json", description: "Emit machine-readable JSON" }]
55628
+ },
55629
+ async (ctx, opts) => listApps(ctx, opts)
55630
+ );
55631
+ var integrationAppStatusCommand = defineCommand(
55632
+ {
55633
+ name: "status",
55634
+ description: "Show one registration card or currently owned app",
55635
+ options: [
55636
+ { flags: "--card <message-id>", description: "Registration card message id (full or 8-character prefix)" },
55637
+ { flags: "--client <key>", description: "App client key / OAuth client_id you own" },
55638
+ { flags: "--json", description: "Emit machine-readable JSON" }
55639
+ ]
55640
+ },
55641
+ async (ctx, opts) => getAppStatus(ctx, opts)
55642
+ );
55510
55643
  async function prepareRecoverOwner(ctx, opts) {
55511
55644
  const clientKey = requiredTrimmed(opts.client, "--client");
55512
55645
  const targetAgent = requiredTrimmed(opts.toAgent, "--to-agent");
@@ -55590,6 +55723,8 @@ function registerIntegrationAppCommands(parent, runtimeOptions = {}) {
55590
55723
  registerCliCommand(appCmd, integrationAppRotateSecretCommand, runtimeOptions);
55591
55724
  registerCliCommand(appCmd, integrationAppTransferOwnerCommand, runtimeOptions);
55592
55725
  registerCliCommand(appCmd, integrationAppUpdateCommand, runtimeOptions);
55726
+ registerCliCommand(appCmd, integrationAppListCommand, runtimeOptions);
55727
+ registerCliCommand(appCmd, integrationAppStatusCommand, runtimeOptions);
55593
55728
  }
55594
55729
 
55595
55730
  // src/commands/reminder/schedule.ts
@@ -55676,6 +55811,12 @@ function buildScheduleBody(opts, now = () => Intl.DateTimeFormat().resolvedOptio
55676
55811
  }
55677
55812
  };
55678
55813
  }
55814
+ if (opts.tz !== void 0 && opts.repeat === void 0) {
55815
+ return {
55816
+ body: {},
55817
+ error: { code: "INVALID_ARG", message: "--tz requires --repeat" }
55818
+ };
55819
+ }
55679
55820
  const body = { title: opts.title, msgId: msgId ?? null };
55680
55821
  if (opts.delaySeconds !== void 0) {
55681
55822
  const n = Number(opts.delaySeconds);
@@ -55693,7 +55834,16 @@ function buildScheduleBody(opts, now = () => Intl.DateTimeFormat().resolvedOptio
55693
55834
  if (opts.fireAt !== void 0) body.fireAt = opts.fireAt;
55694
55835
  if (opts.repeat !== void 0) {
55695
55836
  body.repeat = opts.repeat;
55696
- body.tz = now();
55837
+ const timezone = opts.tz?.trim() || now();
55838
+ try {
55839
+ new Intl.DateTimeFormat("en-US", { timeZone: timezone }).format(0);
55840
+ } catch {
55841
+ return {
55842
+ body: {},
55843
+ error: { code: "INVALID_ARG", message: `--tz must be a valid IANA timezone; got ${timezone}` }
55844
+ };
55845
+ }
55846
+ body.tz = timezone;
55697
55847
  }
55698
55848
  if (opts.channel !== void 0) body.channel = opts.channel;
55699
55849
  if (body.msgId == null) {
@@ -55716,6 +55866,7 @@ var reminderScheduleCommand = defineCommand(
55716
55866
  { flags: "--delay-seconds <n>", description: "Preferred for relative times. Fires this many seconds from now (server-computed, timezone-safe)" },
55717
55867
  { flags: "--fire-at <iso>", description: "ISO-8601 UTC timestamp, e.g. 2026-04-21T09:00:00Z. Use only for absolute calendar times" },
55718
55868
  { flags: "--repeat <rule>", description: "Recurrence rule: every:15m | every:2h | every:1d | daily@09:00 | weekly:mon,fri@09:00" },
55869
+ { flags: "--tz <iana>", description: "IANA timezone for --repeat (e.g. Asia/Shanghai). Overrides this host's timezone." },
55719
55870
  { flags: "--channel <ref>", description: "Optional channel to post a receipt message in (e.g. #general, dm:@alice)." },
55720
55871
  { flags: "--message-id <id>", description: "Message id (full or short) this reminder is anchored to. Required for agent-created reminders." },
55721
55872
  { flags: "--msg-id <id>", description: "Deprecated alias for --message-id." }
package/dist/core.js CHANGED
@@ -8,10 +8,10 @@ import {
8
8
  AGENT_MIGRATION_TRANSPORT_PUBLIC_URL_ENV,
9
9
  AgentMigrationGrantRegistry,
10
10
  AgentMigrationObjectStoreBundleTooLargeError,
11
+ AgentMigrationObjectStoreInsufficientDiskError,
11
12
  DAEMON_CLI_USAGE,
12
13
  DAEMON_CORE_TRACE_ATTR_CONTRACTS,
13
14
  DaemonCore,
14
- assertAgentMigrationObjectStoreBundleSize,
15
15
  buildAgentMigrationAdoptPlan,
16
16
  buildAgentMigrationExportManifest,
17
17
  buildAgentMigrationObjectStoreBundle,
@@ -36,7 +36,7 @@ import {
36
36
  stageAgentMigrationObjectStoreBundle,
37
37
  subscribeDaemonLogs,
38
38
  verifyAgentMigrationAdoptPlan
39
- } from "./chunk-56EVMMRV.js";
39
+ } from "./chunk-RKNTK2UF.js";
40
40
  export {
41
41
  AGENT_MIGRATION_BUNDLE_SCHEMA_VERSION,
42
42
  AGENT_MIGRATION_CONTROL_SEAM_ENV,
@@ -47,10 +47,10 @@ export {
47
47
  AGENT_MIGRATION_TRANSPORT_PUBLIC_URL_ENV,
48
48
  AgentMigrationGrantRegistry,
49
49
  AgentMigrationObjectStoreBundleTooLargeError,
50
+ AgentMigrationObjectStoreInsufficientDiskError,
50
51
  DAEMON_CLI_USAGE,
51
52
  DAEMON_CORE_TRACE_ATTR_CONTRACTS,
52
53
  DaemonCore,
53
- assertAgentMigrationObjectStoreBundleSize,
54
54
  buildAgentMigrationAdoptPlan,
55
55
  buildAgentMigrationExportManifest,
56
56
  buildAgentMigrationObjectStoreBundle,
@@ -28907,15 +28907,22 @@ var TRACE_EVENT_ROW_V2_PROJECTION_COLUMNS = [
28907
28907
  ["shadow_action", "string"],
28908
28908
  ["shadow_reason", "string"],
28909
28909
  ["shadow_direction", "string"],
28910
- ["shadow_plan_kind", "string"]
28910
+ ["shadow_plan_kind", "string"],
28911
+ ["machine_affinity_route", "string"],
28912
+ ["replay_status", "int"]
28911
28913
  ];
28914
+ var TRACE_EVENT_ROW_V2_LEGACY_PROJECTION_COLUMNS = Object.freeze(TRACE_EVENT_ROW_V2_PROJECTION_COLUMNS.slice(0, 57));
28912
28915
  var TRACE_EVENT_ROW_V2_TABLE = "raft.trace_events_v2";
28913
- var TRACE_EVENT_ROW_V2_INGEST_STATEMENT = [
28914
- "SELECT",
28915
- TRACE_EVENT_ROW_V2_PROJECTION_COLUMNS.map(([column, type]) => `$0["${column}"]::${type} AS ${column}`).join(", "),
28916
- `INSERT INTO ${TRACE_EVENT_ROW_V2_TABLE}`,
28917
- `(${TRACE_EVENT_ROW_V2_PROJECTION_COLUMNS.map(([column]) => column).join(", ")})`
28918
- ].join(" ");
28916
+ function buildTraceEventRowV2IngestStatement(columns) {
28917
+ return [
28918
+ "SELECT",
28919
+ columns.map(([column, type]) => `$0["${column}"]::${type} AS ${column}`).join(", "),
28920
+ `INSERT INTO ${TRACE_EVENT_ROW_V2_TABLE}`,
28921
+ `(${columns.map(([column]) => column).join(", ")})`
28922
+ ].join(" ");
28923
+ }
28924
+ var TRACE_EVENT_ROW_V2_INGEST_STATEMENT = buildTraceEventRowV2IngestStatement(TRACE_EVENT_ROW_V2_PROJECTION_COLUMNS);
28925
+ var TRACE_EVENT_ROW_V2_LEGACY_INGEST_STATEMENT = buildTraceEventRowV2IngestStatement(TRACE_EVENT_ROW_V2_LEGACY_PROJECTION_COLUMNS);
28919
28926
  var PROMOTED_IDENTITY_ATTRS = [
28920
28927
  "server_id",
28921
28928
  "machine_id",
@@ -28971,7 +28978,8 @@ var PROMOTED_CLOSED_ATTRS = [
28971
28978
  "shadow_action",
28972
28979
  "shadow_reason",
28973
28980
  "shadow_direction",
28974
- "shadow_plan_kind"
28981
+ "shadow_plan_kind",
28982
+ "machine_affinity_route"
28975
28983
  ];
28976
28984
  var TRACE_EVENT_ROW_PROMOTED_ATTRS = [
28977
28985
  ...PROMOTED_IDENTITY_ATTRS,
@@ -43380,6 +43388,10 @@ var agentApiIntegrationAppUpdateBodySchema = passthroughObject({
43380
43388
  scopes: optionalStringArraySchema,
43381
43389
  unsafeDemoUrlOverride: optionalBooleanSchema
43382
43390
  });
43391
+ var agentApiIntegrationAppStatusQuerySchema = passthroughObject({
43392
+ card: optionalStringSchema,
43393
+ client: optionalStringSchema
43394
+ });
43383
43395
  var agentApiActionPrepareBodySchema = passthroughObject({
43384
43396
  target: external_exports.string().trim().min(1),
43385
43397
  action: actionCardActionSchema
@@ -43534,6 +43546,23 @@ var agentApiIntegrationAppUpdateResponseSchema = passthroughObject({
43534
43546
  clientName: external_exports.string(),
43535
43547
  updatedFields: external_exports.array(external_exports.string())
43536
43548
  });
43549
+ var agentApiOwnedIntegrationAppSchema = external_exports.object({
43550
+ state: external_exports.enum(["card_pending", "committed"]),
43551
+ card: nullableStringSchema,
43552
+ name: external_exports.string(),
43553
+ clientKey: nullableStringSchema,
43554
+ createdAt: external_exports.string(),
43555
+ callbackUrl: nullableStringSchema,
43556
+ scopes: external_exports.array(external_exports.string()),
43557
+ category: nullableStringSchema,
43558
+ recoveryCommand: nullableStringSchema
43559
+ });
43560
+ var agentApiIntegrationAppListResponseSchema = external_exports.object({
43561
+ apps: external_exports.array(agentApiOwnedIntegrationAppSchema)
43562
+ });
43563
+ var agentApiIntegrationAppStatusResponseSchema = external_exports.object({
43564
+ app: agentApiOwnedIntegrationAppSchema
43565
+ });
43537
43566
  var agentApiAttachmentEnvelopeSchema = passthroughObject({
43538
43567
  id: external_exports.string(),
43539
43568
  filename: external_exports.string()
@@ -44330,6 +44359,26 @@ var agentApiContract = {
44330
44359
  request: { body: agentApiIntegrationAppUpdateBodySchema },
44331
44360
  response: { body: agentApiIntegrationAppUpdateResponseSchema }
44332
44361
  }),
44362
+ integrationAppList: route({
44363
+ key: "integrationAppList",
44364
+ method: "GET",
44365
+ path: "/integrations/app",
44366
+ client: { resource: "integrations", method: "listApps" },
44367
+ capability: "read",
44368
+ description: "List pending app registration cards requested by this agent and server-local apps this agent currently owns.",
44369
+ request: {},
44370
+ response: { body: agentApiIntegrationAppListResponseSchema }
44371
+ }),
44372
+ integrationAppStatus: route({
44373
+ key: "integrationAppStatus",
44374
+ method: "GET",
44375
+ path: "/integrations/app/status",
44376
+ client: { resource: "integrations", method: "getAppStatus" },
44377
+ capability: "read",
44378
+ description: "Get one requester-visible registration card or currently owned app without disclosing non-owned app existence.",
44379
+ request: { query: agentApiIntegrationAppStatusQuerySchema },
44380
+ response: { body: agentApiIntegrationAppStatusResponseSchema }
44381
+ }),
44333
44382
  actionPrepare: route({
44334
44383
  key: "actionPrepare",
44335
44384
  method: "POST",
@@ -46200,7 +46249,9 @@ function createAgentApiSurfaceClient(client) {
46200
46249
  prepareApp: (body) => requestClientAsApiResponse(agentApi.integrations.prepareApp(body)),
46201
46250
  rotateAppSecret: (body) => requestClientAsApiResponse(agentApi.integrations.rotateAppSecret(body)),
46202
46251
  transferAppOwner: (body) => requestClientAsApiResponse(agentApi.integrations.transferAppOwner(body)),
46203
- updateApp: (body) => requestClientAsApiResponse(agentApi.integrations.updateApp(body))
46252
+ updateApp: (body) => requestClientAsApiResponse(agentApi.integrations.updateApp(body)),
46253
+ listApps: () => requestClientAsApiResponse(agentApi.integrations.listApps()),
46254
+ getAppStatus: (query) => requestClientAsApiResponse(agentApi.integrations.getAppStatus(query))
46204
46255
  },
46205
46256
  actions: {
46206
46257
  prepare: (body) => requestClientAsApiResponse(agentApi.actions.prepare(body))
@@ -52485,7 +52536,9 @@ var attachmentUploadCommand = defineCommand(
52485
52536
  if (!res.ok) {
52486
52537
  const code = res.errorCode ?? (res.status >= 500 ? "SERVER_5XX" : "UPLOAD_FAILED");
52487
52538
  throw cliError(code, res.error ?? `HTTP ${res.status}`, {
52488
- suggestedNextAction: res.suggestedNextAction ?? void 0
52539
+ suggestedNextAction: res.suggestedNextAction ?? void 0,
52540
+ layer: res.proxy?.layer ?? void 0,
52541
+ correlationId: res.proxy?.correlationId ?? void 0
52489
52542
  });
52490
52543
  }
52491
52544
  const d = res.data;
@@ -54618,7 +54671,10 @@ function formatAppPrepare(data) {
54618
54671
  lines.push("capability: every agent can self-register an app; App Admin is not involved");
54619
54672
  if (data.mode === "register") lines.push("owner: the requesting agent (you) becomes the app owner and can rotate, update, or transfer it after commit");
54620
54673
  lines.push("next: submit the action card for server commit");
54621
- lines.push("secret: never stored in the card; the app owner generates it afterward with rotate-secret and sees it once");
54674
+ if (data.mode === "register") {
54675
+ lines.push("secret: after human commit, the requesting owner agent receives the initial secret once through a private transient notice; it is never stored in the card or chat history");
54676
+ lines.push("recovery: if that notice is missed, use `raft integration app rotate-secret --client <client-key-from-receipt>`; the new secret is shown once and invalidates the previous one");
54677
+ }
54622
54678
  return lines.join("\n");
54623
54679
  }
54624
54680
  async function prepareApp(mode, ctx, opts) {
@@ -54782,6 +54838,83 @@ var integrationAppUpdateCommand = defineCommand(
54782
54838
  },
54783
54839
  async (ctx, opts) => updateApp(ctx, opts)
54784
54840
  );
54841
+ function formatAppStatus(app) {
54842
+ const lines = [
54843
+ `state: ${app.state}`,
54844
+ `name: ${app.name}`,
54845
+ ...app.card ? [`card: ${app.card}`] : [],
54846
+ ...app.clientKey ? [`client key: ${app.clientKey}`] : [],
54847
+ `created: ${app.createdAt}`,
54848
+ `callback URL: ${app.callbackUrl ?? "-"}`,
54849
+ `scopes: ${app.scopes.length > 0 ? app.scopes.join(", ") : "-"}`,
54850
+ `category: ${app.category ?? "-"}`
54851
+ ];
54852
+ if (app.recoveryCommand) {
54853
+ lines.push(`recovery: lost the secret? Run \`${app.recoveryCommand}\`; it returns a new show-once secret and invalidates the previous one`);
54854
+ } else if (app.state === "card_pending") {
54855
+ lines.push("next: ask a human owner/admin to commit the registration card");
54856
+ }
54857
+ return lines.join("\n");
54858
+ }
54859
+ async function listApps(ctx, opts) {
54860
+ const agentContext = ctx.loadAgentContext();
54861
+ const client = ctx.createApiClient(agentContext);
54862
+ const res = await createAgentApiSurfaceClient(client).integrations.listApps();
54863
+ if (!res.ok || !res.data) {
54864
+ const code = res.status >= 500 ? "SERVER_5XX" : "INTEGRATION_APP_LIST_FAILED";
54865
+ throw cliError(code, res.error ?? `HTTP ${res.status}`);
54866
+ }
54867
+ if (opts.json) {
54868
+ writeJson(ctx.io, { ok: true, data: res.data });
54869
+ return;
54870
+ }
54871
+ if (res.data.apps.length === 0) {
54872
+ writeText(ctx.io, "No pending registration cards or currently owned apps.\n");
54873
+ return;
54874
+ }
54875
+ writeText(ctx.io, `${res.data.apps.map(formatAppStatus).join("\n\n")}
54876
+ `);
54877
+ }
54878
+ async function getAppStatus(ctx, opts) {
54879
+ const card = optionalTrimmed(opts.card);
54880
+ const clientKey = optionalTrimmed(opts.client);
54881
+ if (Boolean(card) === Boolean(clientKey)) {
54882
+ throw cliError("INVALID_ARG", "Exactly one of --card or --client is required");
54883
+ }
54884
+ const agentContext = ctx.loadAgentContext();
54885
+ const client = ctx.createApiClient(agentContext);
54886
+ const res = await createAgentApiSurfaceClient(client).integrations.getAppStatus({ card, client: clientKey });
54887
+ if (!res.ok || !res.data) {
54888
+ const code = res.status >= 500 ? "SERVER_5XX" : "INTEGRATION_APP_STATUS_FAILED";
54889
+ throw cliError(code, res.error ?? `HTTP ${res.status}`);
54890
+ }
54891
+ if (opts.json) {
54892
+ writeJson(ctx.io, { ok: true, data: res.data });
54893
+ return;
54894
+ }
54895
+ writeText(ctx.io, `${formatAppStatus(res.data.app)}
54896
+ `);
54897
+ }
54898
+ var integrationAppListCommand = defineCommand(
54899
+ {
54900
+ name: "list",
54901
+ description: "List your pending app registration cards and currently owned server-local apps",
54902
+ options: [{ flags: "--json", description: "Emit machine-readable JSON" }]
54903
+ },
54904
+ async (ctx, opts) => listApps(ctx, opts)
54905
+ );
54906
+ var integrationAppStatusCommand = defineCommand(
54907
+ {
54908
+ name: "status",
54909
+ description: "Show one registration card or currently owned app",
54910
+ options: [
54911
+ { flags: "--card <message-id>", description: "Registration card message id (full or 8-character prefix)" },
54912
+ { flags: "--client <key>", description: "App client key / OAuth client_id you own" },
54913
+ { flags: "--json", description: "Emit machine-readable JSON" }
54914
+ ]
54915
+ },
54916
+ async (ctx, opts) => getAppStatus(ctx, opts)
54917
+ );
54785
54918
  async function prepareRecoverOwner(ctx, opts) {
54786
54919
  const clientKey = requiredTrimmed(opts.client, "--client");
54787
54920
  const targetAgent = requiredTrimmed(opts.toAgent, "--to-agent");
@@ -54865,6 +54998,8 @@ function registerIntegrationAppCommands(parent, runtimeOptions = {}) {
54865
54998
  registerCliCommand(appCmd, integrationAppRotateSecretCommand, runtimeOptions);
54866
54999
  registerCliCommand(appCmd, integrationAppTransferOwnerCommand, runtimeOptions);
54867
55000
  registerCliCommand(appCmd, integrationAppUpdateCommand, runtimeOptions);
55001
+ registerCliCommand(appCmd, integrationAppListCommand, runtimeOptions);
55002
+ registerCliCommand(appCmd, integrationAppStatusCommand, runtimeOptions);
54868
55003
  }
54869
55004
  init_esm_shims();
54870
55005
  init_esm_shims();
@@ -54945,6 +55080,12 @@ function buildScheduleBody(opts, now = () => Intl.DateTimeFormat().resolvedOptio
54945
55080
  }
54946
55081
  };
54947
55082
  }
55083
+ if (opts.tz !== void 0 && opts.repeat === void 0) {
55084
+ return {
55085
+ body: {},
55086
+ error: { code: "INVALID_ARG", message: "--tz requires --repeat" }
55087
+ };
55088
+ }
54948
55089
  const body = { title: opts.title, msgId: msgId ?? null };
54949
55090
  if (opts.delaySeconds !== void 0) {
54950
55091
  const n = Number(opts.delaySeconds);
@@ -54962,7 +55103,16 @@ function buildScheduleBody(opts, now = () => Intl.DateTimeFormat().resolvedOptio
54962
55103
  if (opts.fireAt !== void 0) body.fireAt = opts.fireAt;
54963
55104
  if (opts.repeat !== void 0) {
54964
55105
  body.repeat = opts.repeat;
54965
- body.tz = now();
55106
+ const timezone = opts.tz?.trim() || now();
55107
+ try {
55108
+ new Intl.DateTimeFormat("en-US", { timeZone: timezone }).format(0);
55109
+ } catch {
55110
+ return {
55111
+ body: {},
55112
+ error: { code: "INVALID_ARG", message: `--tz must be a valid IANA timezone; got ${timezone}` }
55113
+ };
55114
+ }
55115
+ body.tz = timezone;
54966
55116
  }
54967
55117
  if (opts.channel !== void 0) body.channel = opts.channel;
54968
55118
  if (body.msgId == null) {
@@ -54985,6 +55135,7 @@ var reminderScheduleCommand = defineCommand(
54985
55135
  { flags: "--delay-seconds <n>", description: "Preferred for relative times. Fires this many seconds from now (server-computed, timezone-safe)" },
54986
55136
  { flags: "--fire-at <iso>", description: "ISO-8601 UTC timestamp, e.g. 2026-04-21T09:00:00Z. Use only for absolute calendar times" },
54987
55137
  { flags: "--repeat <rule>", description: "Recurrence rule: every:15m | every:2h | every:1d | daily@09:00 | weekly:mon,fri@09:00" },
55138
+ { flags: "--tz <iana>", description: "IANA timezone for --repeat (e.g. Asia/Shanghai). Overrides this host's timezone." },
54988
55139
  { flags: "--channel <ref>", description: "Optional channel to post a receipt message in (e.g. #general, dm:@alice)." },
54989
55140
  { flags: "--message-id <id>", description: "Message id (full or short) this reminder is anchored to. Required for agent-created reminders." },
54990
55141
  { flags: "--msg-id <id>", description: "Deprecated alias for --message-id." }
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  DAEMON_CLI_USAGE,
4
4
  DaemonCore,
5
5
  parseDaemonCliArgs
6
- } from "./chunk-56EVMMRV.js";
6
+ } from "./chunk-RKNTK2UF.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": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "raft-daemon": "dist/raft-daemon.js",