@rubytech/create-sitedesk-code 0.1.544 → 0.1.546

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 (109) hide show
  1. package/package.json +1 -1
  2. package/payload/platform/lib/mcp-spawn-tee/dist/index.js +11 -0
  3. package/payload/platform/lib/mcp-spawn-tee/dist/index.js.map +1 -1
  4. package/payload/platform/lib/mcp-spawn-tee/src/__tests__/spawn-tee.test.ts +39 -0
  5. package/payload/platform/lib/mcp-spawn-tee/src/index.ts +12 -0
  6. package/payload/platform/plugins/admin/lib/mcp-spawn-tee/index.js +11 -0
  7. package/payload/platform/plugins/admin/skills/channel-instruction/SKILL.md +26 -12
  8. package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +3 -1
  9. package/payload/platform/plugins/admin/skills/whats-new/SKILL.md +9 -0
  10. package/payload/platform/plugins/aeo/lib/mcp-spawn-tee/index.js +11 -0
  11. package/payload/platform/plugins/browser/lib/mcp-spawn-tee/index.js +11 -0
  12. package/payload/platform/plugins/connector/lib/mcp-spawn-tee/index.js +11 -0
  13. package/payload/platform/plugins/contacts/lib/mcp-spawn-tee/index.js +11 -0
  14. package/payload/platform/plugins/docs/references/channel-wake-and-prompt.md +2 -0
  15. package/payload/platform/plugins/email/lib/mcp-spawn-tee/index.js +11 -0
  16. package/payload/platform/plugins/filesystem/lib/mcp-spawn-tee/index.js +11 -0
  17. package/payload/platform/plugins/google/lib/mcp-spawn-tee/index.js +11 -0
  18. package/payload/platform/plugins/graph-viewer/lib/mcp-spawn-tee/index.js +11 -0
  19. package/payload/platform/plugins/ledger/lib/mcp-spawn-tee/index.js +11 -0
  20. package/payload/platform/plugins/memory/lib/mcp-spawn-tee/index.js +11 -0
  21. package/payload/platform/plugins/outlook/lib/mcp-spawn-tee/index.js +11 -0
  22. package/payload/platform/plugins/quickbooks/lib/mcp-spawn-tee/index.js +11 -0
  23. package/payload/platform/plugins/replicate/lib/mcp-spawn-tee/index.js +11 -0
  24. package/payload/platform/plugins/scheduling/PLUGIN.md +1 -1
  25. package/payload/platform/plugins/scheduling/lib/mcp-spawn-tee/index.js +11 -0
  26. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/availability-snapshot.test.d.ts +2 -0
  27. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/availability-snapshot.test.d.ts.map +1 -0
  28. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/availability-snapshot.test.js +80 -0
  29. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/availability-snapshot.test.js.map +1 -0
  30. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/publish-availability-logging.test.d.ts +2 -0
  31. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/publish-availability-logging.test.d.ts.map +1 -0
  32. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/publish-availability-logging.test.js +32 -0
  33. package/payload/platform/plugins/scheduling/mcp/dist/lib/__tests__/publish-availability-logging.test.js.map +1 -0
  34. package/payload/platform/plugins/scheduling/mcp/dist/lib/availability-snapshot.d.ts +67 -0
  35. package/payload/platform/plugins/scheduling/mcp/dist/lib/availability-snapshot.d.ts.map +1 -0
  36. package/payload/platform/plugins/scheduling/mcp/dist/lib/availability-snapshot.js +88 -0
  37. package/payload/platform/plugins/scheduling/mcp/dist/lib/availability-snapshot.js.map +1 -0
  38. package/payload/platform/plugins/scheduling/mcp/dist/scripts/publish-availability.d.ts +2 -1
  39. package/payload/platform/plugins/scheduling/mcp/dist/scripts/publish-availability.d.ts.map +1 -1
  40. package/payload/platform/plugins/scheduling/mcp/dist/scripts/publish-availability.js +59 -54
  41. package/payload/platform/plugins/scheduling/mcp/dist/scripts/publish-availability.js.map +1 -1
  42. package/payload/platform/plugins/storage-broker/lib/mcp-spawn-tee/index.js +11 -0
  43. package/payload/platform/plugins/telegram/lib/mcp-spawn-tee/index.js +11 -0
  44. package/payload/platform/plugins/url-get/lib/mcp-spawn-tee/index.js +11 -0
  45. package/payload/platform/plugins/voice-mirror/lib/mcp-spawn-tee/index.js +11 -0
  46. package/payload/platform/plugins/whatsapp/lib/mcp-spawn-tee/index.js +11 -0
  47. package/payload/platform/plugins/work/lib/mcp-spawn-tee/index.js +11 -0
  48. package/payload/platform/plugins/workflows/lib/mcp-spawn-tee/index.js +11 -0
  49. package/payload/platform/services/claude-session-manager/dist/channel-mcp.d.ts +5 -0
  50. package/payload/platform/services/claude-session-manager/dist/channel-mcp.d.ts.map +1 -1
  51. package/payload/platform/services/claude-session-manager/dist/channel-mcp.js +16 -2
  52. package/payload/platform/services/claude-session-manager/dist/channel-mcp.js.map +1 -1
  53. package/payload/platform/services/claude-session-manager/dist/channel-spawn-tee.d.ts +34 -0
  54. package/payload/platform/services/claude-session-manager/dist/channel-spawn-tee.d.ts.map +1 -0
  55. package/payload/platform/services/claude-session-manager/dist/channel-spawn-tee.js +41 -0
  56. package/payload/platform/services/claude-session-manager/dist/channel-spawn-tee.js.map +1 -0
  57. package/payload/platform/services/claude-session-manager/dist/http-server.d.ts.map +1 -1
  58. package/payload/platform/services/claude-session-manager/dist/http-server.js +26 -1
  59. package/payload/platform/services/claude-session-manager/dist/http-server.js.map +1 -1
  60. package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts.map +1 -1
  61. package/payload/platform/services/claude-session-manager/dist/pty-spawner.js +11 -0
  62. package/payload/platform/services/claude-session-manager/dist/pty-spawner.js.map +1 -1
  63. package/payload/platform/services/claude-session-manager/dist/telegram-channel-mcp.d.ts +5 -0
  64. package/payload/platform/services/claude-session-manager/dist/telegram-channel-mcp.d.ts.map +1 -1
  65. package/payload/platform/services/claude-session-manager/dist/telegram-channel-mcp.js +16 -2
  66. package/payload/platform/services/claude-session-manager/dist/telegram-channel-mcp.js.map +1 -1
  67. package/payload/platform/services/claude-session-manager/dist/wa-channel-mcp.d.ts +6 -0
  68. package/payload/platform/services/claude-session-manager/dist/wa-channel-mcp.d.ts.map +1 -1
  69. package/payload/platform/services/claude-session-manager/dist/wa-channel-mcp.js +17 -2
  70. package/payload/platform/services/claude-session-manager/dist/wa-channel-mcp.js.map +1 -1
  71. package/payload/platform/services/claude-session-manager/dist/webchat-channel-mcp.d.ts +5 -0
  72. package/payload/platform/services/claude-session-manager/dist/webchat-channel-mcp.d.ts.map +1 -1
  73. package/payload/platform/services/claude-session-manager/dist/webchat-channel-mcp.js +16 -2
  74. package/payload/platform/services/claude-session-manager/dist/webchat-channel-mcp.js.map +1 -1
  75. package/payload/platform/services/telegram-channel/dist/instructions.d.ts +1 -0
  76. package/payload/platform/services/telegram-channel/dist/instructions.d.ts.map +1 -1
  77. package/payload/platform/services/telegram-channel/dist/instructions.js +47 -0
  78. package/payload/platform/services/telegram-channel/dist/instructions.js.map +1 -1
  79. package/payload/platform/services/telegram-channel/dist/notification.d.ts +8 -14
  80. package/payload/platform/services/telegram-channel/dist/notification.d.ts.map +1 -1
  81. package/payload/platform/services/telegram-channel/dist/notification.js +13 -19
  82. package/payload/platform/services/telegram-channel/dist/notification.js.map +1 -1
  83. package/payload/platform/services/telegram-channel/dist/server.d.ts.map +1 -1
  84. package/payload/platform/services/telegram-channel/dist/server.js +3 -10
  85. package/payload/platform/services/telegram-channel/dist/server.js.map +1 -1
  86. package/payload/platform/services/webchat-channel/dist/instructions.d.ts +1 -0
  87. package/payload/platform/services/webchat-channel/dist/instructions.d.ts.map +1 -1
  88. package/payload/platform/services/webchat-channel/dist/instructions.js +60 -0
  89. package/payload/platform/services/webchat-channel/dist/instructions.js.map +1 -1
  90. package/payload/platform/services/webchat-channel/dist/notification.d.ts +9 -14
  91. package/payload/platform/services/webchat-channel/dist/notification.d.ts.map +1 -1
  92. package/payload/platform/services/webchat-channel/dist/notification.js +13 -19
  93. package/payload/platform/services/webchat-channel/dist/notification.js.map +1 -1
  94. package/payload/platform/services/webchat-channel/dist/server.d.ts.map +1 -1
  95. package/payload/platform/services/webchat-channel/dist/server.js +5 -10
  96. package/payload/platform/services/webchat-channel/dist/server.js.map +1 -1
  97. package/payload/platform/services/whatsapp-channel/dist/notification.d.ts +91 -9
  98. package/payload/platform/services/whatsapp-channel/dist/notification.d.ts.map +1 -1
  99. package/payload/platform/services/whatsapp-channel/dist/notification.js +155 -17
  100. package/payload/platform/services/whatsapp-channel/dist/notification.js.map +1 -1
  101. package/payload/platform/services/whatsapp-channel/dist/server.d.ts.map +1 -1
  102. package/payload/platform/services/whatsapp-channel/dist/server.js +83 -19
  103. package/payload/platform/services/whatsapp-channel/dist/server.js.map +1 -1
  104. package/payload/platform/services/whatsapp-channel/dist/targets.d.ts +23 -3
  105. package/payload/platform/services/whatsapp-channel/dist/targets.d.ts.map +1 -1
  106. package/payload/platform/services/whatsapp-channel/dist/targets.js +19 -2
  107. package/payload/platform/services/whatsapp-channel/dist/targets.js.map +1 -1
  108. package/payload/premium-plugins/sitedesk/plugins/sitedesk-job/lib/mcp-spawn-tee/index.js +11 -0
  109. package/payload/server/server.js +42 -43
@@ -28991,6 +28991,22 @@ function createWaChannelRoutes(deps) {
28991
28991
  deps.onReceived?.(accountId, senderId, waMessageId, { provenance, source });
28992
28992
  return c.json({ ok: true });
28993
28993
  });
28994
+ app77.post("/wa-channel/turn-observed", async (c) => {
28995
+ const body = await c.req.json().catch(() => null);
28996
+ const senderId = body?.senderId;
28997
+ const accountId = body?.accountId;
28998
+ const waMessageId = body?.waMessageId;
28999
+ if (typeof senderId !== "string" || typeof waMessageId !== "string") {
29000
+ return c.json({ error: "senderId and waMessageId required" }, 400);
29001
+ }
29002
+ if (typeof accountId !== "string") {
29003
+ console.error(`[whatsapp-native] op=channel-turn-observed-rejected senderId=${senderId} reason=no-account`);
29004
+ return c.json({ error: "accountId required" }, 400);
29005
+ }
29006
+ const observed = typeof body?.observed === "string" ? body.observed : "unset";
29007
+ deps.onTurnObserved?.(accountId, senderId, waMessageId, observed);
29008
+ return c.json({ ok: true });
29009
+ });
28994
29010
  app77.post("/wa-channel/turn-end", async (c) => {
28995
29011
  const body = await c.req.json().catch(() => null);
28996
29012
  const senderId = body?.senderId;
@@ -29200,6 +29216,16 @@ var WaGateway = class {
29200
29216
  `[whatsapp:reframe] op=compose account=${accountId} sender=${senderId} provenance=${prov} source=${meta?.source ?? "unset"}`
29201
29217
  );
29202
29218
  },
29219
+ // Task 2356 — the turn outcome for one inbound, the post-condition the ack
29220
+ // above does not verify. Printed on every value, including observed=yes: a
29221
+ // session that reports success and a session that never reports at all are
29222
+ // otherwise the same silence, which is the hole this closes. The hub is
29223
+ // untouched — the entry left its in-flight set at the ack.
29224
+ onTurnObserved: (accountId, senderId, waMessageId, observed) => {
29225
+ console.error(
29226
+ `[whatsapp-native] op=notification-outcome senderId=${senderId} accountId=${accountId} waMessageId=${waMessageId} observed=${observed}`
29227
+ );
29228
+ },
29203
29229
  onReplyDispatch: (senderId, atMs) => this.noteReplyDispatch(senderId, atMs),
29204
29230
  // Task 2312 — forwarded verbatim; the route holds the checks and this
29205
29231
  // class holds no policy of its own here. All three are optional and an
@@ -29312,8 +29338,9 @@ var WaGateway = class {
29312
29338
  console.error(
29313
29339
  `[whatsapp-native] op=doc-context senderId=${senderId} accountId=${input.accountId} maxyAccountId=${input.effectiveAccountId}`
29314
29340
  );
29341
+ const isRelay = input.source === "public-relay";
29315
29342
  let standingRules;
29316
- if (this.deps.fetchStandingRules) {
29343
+ if (this.deps.fetchStandingRules && !isRelay) {
29317
29344
  const res = await this.deps.fetchStandingRules(input.effectiveAccountId);
29318
29345
  standingRules = res.block || void 0;
29319
29346
  const injected = res.block ? (res.block.match(/^- /gm) ?? []).length : 0;
@@ -29322,12 +29349,14 @@ var WaGateway = class {
29322
29349
  `[preference-inject] op=inject channel=wa accountId=${input.effectiveAccountId} injected=${injected} owner=${owner8} source=${res.source}`
29323
29350
  );
29324
29351
  }
29352
+ const instructionKind = input.role === "public" || isRelay ? "account" : "platform";
29325
29353
  const agentDir = input.role === "public" ? input.publicAgentSlug : "admin";
29326
- const instruction = await this.deps.fetchTurnInstruction(input.effectiveAccountId, agentDir);
29354
+ const instruction = instructionKind === "account" ? await this.deps.fetchTurnInstruction(input.effectiveAccountId, agentDir) : null;
29355
+ const turnLabel = input.role === "public" ? "public" : isRelay ? "relay" : "direct";
29327
29356
  console.error(
29328
- `[whatsapp-native] op=instruction-source accountId=${input.effectiveAccountId} agentDir=${agentDir ?? "none"} source=${instruction.source} bytes=${instruction.bytes}`
29357
+ `[whatsapp-native] op=instruction-source accountId=${input.effectiveAccountId} agentDir=${instruction ? agentDir ?? "none" : "-"} turn=${turnLabel} source=${instruction ? instruction.source : "platform"} bytes=${instruction ? instruction.bytes : 0}`
29329
29358
  );
29330
- if (instruction.source === "absent") {
29359
+ if (instruction?.source === "absent") {
29331
29360
  console.error(
29332
29361
  `[whatsapp-native] op=inbound senderId=${senderId} accountId=${input.accountId} effectiveAccountId=${input.effectiveAccountId} bytes=${bytes} ${mediaField} source=${source} delivery=refused sessionId=${this.sessionIdFor(input, senderId)}`
29333
29362
  );
@@ -29345,7 +29374,8 @@ var WaGateway = class {
29345
29374
  media: input.media,
29346
29375
  source,
29347
29376
  standingRules,
29348
- turnInstruction: instruction.body,
29377
+ instructionKind,
29378
+ ...instruction ? { turnInstruction: instruction.body } : {},
29349
29379
  scheduleProvenance: input.scheduleProvenance,
29350
29380
  // Task 1897 — the quoted message rides the SSE frame to the channel
29351
29381
  // server, which renders it at the top of the reframed payload.
@@ -30400,27 +30430,12 @@ var WebchatGateway = class _WebchatGateway {
30400
30430
  );
30401
30431
  }
30402
30432
  const messageId = `wc-${++this.seq}`;
30403
- let turnInstruction;
30404
- if (input.role === "admin") {
30405
- const instruction = await this.deps.fetchTurnInstruction(input.accountId, "admin");
30406
- console.error(
30407
- `[webchat:inbound] op=instruction-source accountId=${input.accountId} channel=webchat source=${instruction.source} bytes=${instruction.bytes}`
30408
- );
30409
- if (instruction.source === "absent") {
30410
- console.error(
30411
- `[webchat:inbound] op=received key=${keyDisplay(input.key)} messageId=${messageId} role=${input.role} bytes=${bytes} delivery=refused`
30412
- );
30413
- return { spawn: null };
30414
- }
30415
- turnInstruction = instruction.body;
30416
- }
30417
30433
  this.hub.deliver(
30418
30434
  {
30419
30435
  key: input.key,
30420
30436
  text: input.text,
30421
30437
  messageId,
30422
30438
  standingRules,
30423
- ...turnInstruction !== void 0 ? { turnInstruction } : {},
30424
30439
  ...input.replyContext ? { replyContext: input.replyContext } : {}
30425
30440
  },
30426
30441
  Date.now()
@@ -31322,22 +31337,8 @@ var TelegramGateway = class {
31322
31337
  `[preference-inject] op=inject channel=tg accountId=${input.accountId} injected=${injected} owner=${owner8} source=${res.source}`
31323
31338
  );
31324
31339
  }
31325
- let turnInstruction;
31326
- if (input.role === "admin") {
31327
- const instruction = await this.deps.fetchTurnInstruction(input.accountId, "admin");
31328
- console.error(
31329
- `[telegram-native] op=instruction-source accountId=${input.accountId} channel=telegram source=${instruction.source} bytes=${instruction.bytes}`
31330
- );
31331
- if (instruction.source === "absent") {
31332
- console.error(
31333
- `[telegram-native] op=inbound key=${input.senderId} accountId=${input.accountId} botType=${input.role} bytes=${bytes} source=${source} delivery=refused sessionId=${this.sessionIdFor(input)}`
31334
- );
31335
- return;
31336
- }
31337
- turnInstruction = instruction.body;
31338
- }
31339
31340
  this.hub.deliver(
31340
- { key: input.senderId, text: input.text, messageId: `tg-${++this.seq}`, source, standingRules, turnInstruction, scheduleProvenance: input.scheduleProvenance },
31341
+ { key: input.senderId, text: input.text, messageId: `tg-${++this.seq}`, source, standingRules, scheduleProvenance: input.scheduleProvenance },
31341
31342
  Date.now()
31342
31343
  );
31343
31344
  const resolvedSessionId = this.sessionIdFor(input);
@@ -32498,10 +32499,9 @@ var webchatGateway = new WebchatGateway({
32498
32499
  if (acct) notify("webchat-pointer", acct);
32499
32500
  },
32500
32501
  fetchStandingRules: fetchAccountStandingRules,
32501
- // Task 2331the account's own `## Instruction` body, read from that
32502
- // account's admin agent files. Same resolver and same async wrapping as the
32503
- // WhatsApp gateway above; the resolver is synchronous on disk.
32504
- fetchTurnInstruction: async (accountId, agentDir) => resolveTurnInstruction(accountId, agentDir),
32502
+ // Task 2353no turn-instruction resolver on this door. See the dep comment
32503
+ // in webchat-gateway.ts: the account file governs the relay turn, which only
32504
+ // the WhatsApp door raises.
32505
32505
  gatewayUrl: webchatGatewayUrl(),
32506
32506
  serverPath: webchatServerPath(),
32507
32507
  ensureChannelSession: async ({ accountId, key, role, adminUserId, gatewayUrl, serverPath, sessionId, public: pub }) => {
@@ -32602,10 +32602,9 @@ webchatGateway.startPublicReaper();
32602
32602
  var telegramFileFollowers = /* @__PURE__ */ new Map();
32603
32603
  var telegramGateway = new TelegramGateway({
32604
32604
  fetchStandingRules: fetchAccountStandingRules,
32605
- // Task 2336the account's own `## Instruction` body, read from that
32606
- // account's admin agent files. Same resolver and same async wrapping as the
32607
- // WhatsApp and webchat gateways above; the resolver is synchronous on disk.
32608
- fetchTurnInstruction: async (accountId, agentDir) => resolveTurnInstruction(accountId, agentDir),
32605
+ // Task 2353no turn-instruction resolver on this door. See the dep comment in
32606
+ // telegram-gateway.ts: the account file governs the relay turn, which only the
32607
+ // WhatsApp door raises.
32609
32608
  resolveSessionOverride: (accountId, senderId) => resolveChannelOverride(accountId, "telegram", senderId),
32610
32609
  gatewayUrl: telegramGatewayUrl(),
32611
32610
  serverPath: telegramServerPath(),