handmux 0.35.0 → 0.36.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 (77) hide show
  1. package/dist/build-meta.json +3 -3
  2. package/dist/package.json +7 -7
  3. package/dist/public/assets/{abnfDiagram-O67JEVCF-DslFDZId.js → abnfDiagram-O67JEVCF-77h2IIrd.js} +1 -1
  4. package/dist/public/assets/{arc-VHB0ANPU.js → arc-B1uiT5Hv.js} +1 -1
  5. package/dist/public/assets/{architectureDiagram-NJMV4G6O-CJcCA-5Z.js → architectureDiagram-NJMV4G6O-CIzN4Www.js} +1 -1
  6. package/dist/public/assets/{blockDiagram-BEXU5L5S-B01qZyZi.js → blockDiagram-BEXU5L5S-CFLMQR49.js} +1 -1
  7. package/dist/public/assets/{c4Diagram-YGBWAQC7-B3e2jVdt.js → c4Diagram-YGBWAQC7-De2rKPDq.js} +1 -1
  8. package/dist/public/assets/channel-DaUmhuF_.js +1 -0
  9. package/dist/public/assets/{chunk-2Q5K7J3B-CES4ihJ2.js → chunk-2Q5K7J3B-CLFF4J1f.js} +1 -1
  10. package/dist/public/assets/{chunk-3FUC2YCW-Dma2vRtQ.js → chunk-3FUC2YCW-QQVae1fu.js} +2 -2
  11. package/dist/public/assets/{chunk-5VM5RSS4-BlpNsgH-.js → chunk-5VM5RSS4-B5UjIFDk.js} +1 -1
  12. package/dist/public/assets/{chunk-GTNCS2PH-C2DhT6XM.js → chunk-GTNCS2PH-DcdDMr9j.js} +1 -1
  13. package/dist/public/assets/{chunk-GWA4HPMP-ye3iQ-a9.js → chunk-GWA4HPMP-CssmLYDR.js} +1 -1
  14. package/dist/public/assets/{chunk-JWPE2WC7-Cpju1Ogm.js → chunk-JWPE2WC7-BizFpeWo.js} +1 -1
  15. package/dist/public/assets/{chunk-NETBCI7D-oNkGN9hx.js → chunk-NETBCI7D-DWSxWS3y.js} +1 -1
  16. package/dist/public/assets/{chunk-WEXAMYUT-Bz2dLsEF.js → chunk-WEXAMYUT-BKN16NsC.js} +1 -1
  17. package/dist/public/assets/{chunk-XXDRQBXY-CfnAOHJH.js → chunk-XXDRQBXY-By-Uw-Aj.js} +1 -1
  18. package/dist/public/assets/{classDiagram-v2-NBCMYWYE-CtEVnXTP.js → classDiagram-v2-NBCMYWYE-DqoFIYb9.js} +1 -1
  19. package/dist/public/assets/{cose-bilkent-JH36ORCC-CZI_xbWv.js → cose-bilkent-JH36ORCC-HmH4VsKR.js} +1 -1
  20. package/dist/public/assets/{cynefin-OW5HDTMX-jKUkt7bh.js → cynefin-OW5HDTMX-DYD9YRjp.js} +1 -1
  21. package/dist/public/assets/{cynefinDiagram-VND7K2PF-DpOr06tv.js → cynefinDiagram-VND7K2PF-C9RjJJ0d.js} +1 -1
  22. package/dist/public/assets/{dagre-6A5THRUB-Cp42nnjs.js → dagre-6A5THRUB-COdxco8b.js} +1 -1
  23. package/dist/public/assets/{diagram-22UHCM2B-B4vh59kK.js → diagram-22UHCM2B-BV5ehlp3.js} +1 -1
  24. package/dist/public/assets/{diagram-3UASUU5V-BrySHBW5.js → diagram-3UASUU5V-CEc6OJqR.js} +1 -1
  25. package/dist/public/assets/{diagram-ATOU4E4O-CRDLRjJK.js → diagram-ATOU4E4O-DOhyTrVD.js} +1 -1
  26. package/dist/public/assets/{diagram-CDSNMT55-D_zXyS0J.js → diagram-CDSNMT55-C8NBEqvd.js} +1 -1
  27. package/dist/public/assets/{diagram-MLGK6HIB-D9Q6Ol7F.js → diagram-MLGK6HIB-CWaQF3Ld.js} +1 -1
  28. package/dist/public/assets/{diagram-MPIPVDR6-D_L7q2cj.js → diagram-MPIPVDR6-D6hkQ7gd.js} +1 -1
  29. package/dist/public/assets/{ebnfDiagram-ZINNZB2B-C9AymNC4.js → ebnfDiagram-ZINNZB2B-sLsnAmFD.js} +1 -1
  30. package/dist/public/assets/{elk-276RUBZZ-qj6gPVW5.js → elk-276RUBZZ-DVtwkYol.js} +1 -1
  31. package/dist/public/assets/{erDiagram-OPXOYQCR-DXHbm2-3.js → erDiagram-OPXOYQCR-xdeqkZd4.js} +1 -1
  32. package/dist/public/assets/{flowDiagram-KWPJA3E3-CytiY7My.js → flowDiagram-KWPJA3E3-CZl1CKuP.js} +1 -1
  33. package/dist/public/assets/{ganttDiagram-FUAMR5RP-XIXk3178.js → ganttDiagram-FUAMR5RP-DnkdTY3-.js} +1 -1
  34. package/dist/public/assets/{gitGraphDiagram-X574FWY7-2-Iaumi6.js → gitGraphDiagram-X574FWY7-DQNG42Tn.js} +1 -1
  35. package/dist/public/assets/index-BOQmZzyT.js +363 -0
  36. package/dist/public/assets/index-DPZqWW1u.css +32 -0
  37. package/dist/public/assets/{infoDiagram-VRGFBTTK-rDrzVo_U.js → infoDiagram-VRGFBTTK-BeYpU1R5.js} +1 -1
  38. package/dist/public/assets/{ishikawaDiagram-OU5B5YK6-D59KH_M6.js → ishikawaDiagram-OU5B5YK6-mEgC8PlA.js} +1 -1
  39. package/dist/public/assets/{journeyDiagram-ZHPQQLJL-15Csh4-7.js → journeyDiagram-ZHPQQLJL-C5mSuQmo.js} +1 -1
  40. package/dist/public/assets/{kanban-definition-PNTS6WVX-DJt5zKPb.js → kanban-definition-PNTS6WVX-A1k2Vl-J.js} +1 -1
  41. package/dist/public/assets/{linear-C_7B3tLp.js → linear-DSYqxhOx.js} +1 -1
  42. package/dist/public/assets/{mermaid.core-CUCURRF9.js → mermaid.core-Bl8C4fSx.js} +4 -4
  43. package/dist/public/assets/{mindmap-definition-NLK3R4M7-DgHHfDE2.js → mindmap-definition-NLK3R4M7-F2PHGXa5.js} +1 -1
  44. package/dist/public/assets/{pegDiagram-GJSIUBJH-Co8vXpQN.js → pegDiagram-GJSIUBJH-lS3dgdwe.js} +1 -1
  45. package/dist/public/assets/{pieDiagram-5QR66LMP-D2-jPmQz.js → pieDiagram-5QR66LMP-DjyOARJR.js} +1 -1
  46. package/dist/public/assets/{quadrantDiagram-O4NWA36T-C01SNg0F.js → quadrantDiagram-O4NWA36T-Drm_KOLr.js} +1 -1
  47. package/dist/public/assets/{railroadDiagram-XR7U4H2S-CpOHUJjS.js → railroadDiagram-XR7U4H2S-D7snifLU.js} +1 -1
  48. package/dist/public/assets/{requirementDiagram-PLB6GJNP-MnTTEaJ8.js → requirementDiagram-PLB6GJNP-C-7BjXZm.js} +1 -1
  49. package/dist/public/assets/{sankeyDiagram-IPEJSGJF-Drj8CpKl.js → sankeyDiagram-IPEJSGJF-DUE0QpYN.js} +1 -1
  50. package/dist/public/assets/{sequenceDiagram-PO4LG4MO-BKIZBej_.js → sequenceDiagram-PO4LG4MO--fgXhSUK.js} +1 -1
  51. package/dist/public/assets/{sizeCapture-INFHLROL-CA7QSTT6.js → sizeCapture-INFHLROL-J042wM-E.js} +1 -1
  52. package/dist/public/assets/{stateDiagram-v2-GCMORJYK-B5YaO32m.js → stateDiagram-v2-GCMORJYK-DBEgADBU.js} +1 -1
  53. package/dist/public/assets/{swimlanes-2SLR337P-Dp--9D-W.js → swimlanes-2SLR337P-n1MMMryz.js} +1 -1
  54. package/dist/public/assets/swimlanesDiagram-TC7HE7FX-BxouFZW9.js +8 -0
  55. package/dist/public/assets/{timeline-definition-EJHVYXUP-DxFkKZze.js → timeline-definition-EJHVYXUP-Ch4oAOvy.js} +1 -1
  56. package/dist/public/assets/{usecaseDiagram-POWQR4AR-wUt5OSw0.js → usecaseDiagram-POWQR4AR-DFs_6tJM.js} +1 -1
  57. package/dist/public/assets/{vennDiagram-UO4OBE2U-DrXq2XMh.js → vennDiagram-UO4OBE2U-cJ5Rpp6V.js} +1 -1
  58. package/dist/public/assets/{wardleyDiagram-VNRHLVJA-DWqL4bqf.js → wardleyDiagram-VNRHLVJA-CFe6IjhY.js} +1 -1
  59. package/dist/public/assets/{xychartDiagram-PMCCYNJV-BkZqHOc6.js → xychartDiagram-PMCCYNJV-DVqkUPUP.js} +1 -1
  60. package/dist/public/index.html +2 -2
  61. package/dist/src/agent-runtime/conversation.js +20 -1
  62. package/dist/src/agent-runtime/conversationValidation.js +8 -1
  63. package/dist/src/agent-runtime/runtime.js +105 -0
  64. package/dist/src/agent-runtime/scheduledMessages.js +549 -0
  65. package/dist/src/agents/codexConversation.js +4 -2
  66. package/dist/src/agents/codexUsageLimitRecovery.js +97 -0
  67. package/dist/src/cli/authCmd.js +1 -1
  68. package/dist/src/cli/i18n/en.js +1 -0
  69. package/dist/src/cli/i18n/zh.js +1 -0
  70. package/dist/src/codexTranscriptParse.js +3 -0
  71. package/dist/src/deviceAuth/service.js +2 -2
  72. package/dist/src/routes/agents.js +46 -0
  73. package/package.json +3 -3
  74. package/dist/public/assets/channel-YqF13omZ.js +0 -1
  75. package/dist/public/assets/index-B02FNbyq.css +0 -32
  76. package/dist/public/assets/index-BQp0V5lU.js +0 -363
  77. package/dist/public/assets/swimlanesDiagram-TC7HE7FX-Du4bBHEh.js +0 -8
@@ -0,0 +1,97 @@
1
+ const record = (value) => value !== null && typeof value === 'object' && !Array.isArray(value) ? value : {};
2
+ const validTime = (value) => Number.isSafeInteger(value) && value > 0 && value <= 8_640_000_000_000_000;
3
+ function absoluteTime(value) {
4
+ if (typeof value === 'number') {
5
+ const at = value < 1e12 ? value * 1000 : value;
6
+ return validTime(at) ? at : undefined;
7
+ }
8
+ if (typeof value !== 'string')
9
+ return undefined;
10
+ const iso = value.trim().match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})$/i);
11
+ if (!iso)
12
+ return undefined;
13
+ const year = Number(iso[1]);
14
+ const month = Number(iso[2]);
15
+ const day = Number(iso[3]);
16
+ if (month < 1 || month > 12 || day < 1 || day > new Date(Date.UTC(year, month, 0)).getUTCDate()
17
+ || Number(iso[4]) > 23 || Number(iso[5]) > 59 || Number(iso[6] ?? 0) > 59)
18
+ return undefined;
19
+ const at = Date.parse(value);
20
+ return validTime(at) ? at : undefined;
21
+ }
22
+ /** Codex local text follows the server timezone by the user's explicit scheduling policy. */
23
+ function textResetTime(message, occurredAt) {
24
+ const source = message.replace(/\s+/g, ' ').trim();
25
+ // Official format_retry_timestamp: full date outside today, clock only on the event's local day.
26
+ // https://github.com/openai/codex/blob/c419fd01a70dd1d05356da443ac44328bda2e6f4/codex-rs/protocol/src/error.rs
27
+ const full = source.match(/\b(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\s+(\d{1,2})(?:st|nd|rd|th)?,?\s+(\d{4})\s+(\d{1,2}):(\d{2})(?:\s*(AM|PM))?([^\r\n]*)/i);
28
+ const short = full ? null : source.match(/\btry\s+again\s+at\s+(\d{1,2}):(\d{2})(?:\s*(AM|PM))?([^\r\n]*)/i);
29
+ if (!full && (!short || occurredAt === undefined || !validTime(occurredAt)))
30
+ return undefined;
31
+ const clock = full ? full.slice(4) : short.slice(1);
32
+ const hour = Number(clock[0]);
33
+ const minute = Number(clock[1]);
34
+ const meridiem = clock[2]?.toUpperCase();
35
+ if (minute > 59 || (meridiem ? hour < 1 || hour > 12 : hour > 23))
36
+ return undefined;
37
+ const hours = meridiem ? hour % 12 + (meridiem === 'PM' ? 12 : 0) : hour;
38
+ // Inspect the entire suffix before sentence punctuation. Unknown/malformed explicit zones or
39
+ // AM/PM must fail closed, rather than being reinterpreted by a second bare-clock matcher.
40
+ const zone = (clock[3] ?? '').split(/[.!?;]/, 1)[0].trim();
41
+ if (zone && !/^(?:(?:UTC|GMT)?[+-]\d{2}:?\d{2}|Z|UTC|GMT)$/i.test(zone))
42
+ return undefined;
43
+ if (!full && zone)
44
+ return undefined; // A dated, explicit-offset format is required for this path.
45
+ const event = new Date(occurredAt ?? 0);
46
+ const year = full ? Number(full[3]) : event.getFullYear();
47
+ const month = full ? ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'].indexOf(full[1].slice(0, 3).toLowerCase()) + 1 : event.getMonth() + 1;
48
+ const day = full ? Number(full[2]) : event.getDate();
49
+ if (zone) {
50
+ const offset = /^(?:Z|UTC|GMT)$/i.test(zone) ? 'Z' : zone.replace(/^(?:UTC|GMT)/i, '');
51
+ return absoluteTime(`${year}-${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}T${String(hours).padStart(2, '0')}:${String(minute).padStart(2, '0')}:00${offset}`);
52
+ }
53
+ const local = new Date(year, month - 1, day, hours, minute, 0, 0);
54
+ // Date normalizes invalid dates and spring-forward gaps; reject changed components.
55
+ if (local.getFullYear() !== year || local.getMonth() !== month - 1 || local.getDate() !== day
56
+ || local.getHours() !== hours || local.getMinutes() !== minute)
57
+ return undefined;
58
+ const at = local.getTime();
59
+ // Date chooses the earlier instant in a fold. Check the actual offset change, including
60
+ // half-hour transitions, and reject if the later instant has the same local components.
61
+ const tomorrow = new Date(year, month - 1, day + 1, hours, minute, 0, 0);
62
+ const offsetChange = tomorrow.getTimezoneOffset() - local.getTimezoneOffset();
63
+ if (offsetChange > 0) {
64
+ const later = new Date(at + offsetChange * 60000);
65
+ if (later.getFullYear() === year && later.getMonth() === month - 1 && later.getDate() === day
66
+ && later.getHours() === hours && later.getMinutes() === minute)
67
+ return undefined;
68
+ }
69
+ return validTime(at) ? at : undefined;
70
+ }
71
+ /** Only called for native provider errors, never user/assistant content. */
72
+ export function codexUsageLimitRecovery(value, occurredAt) {
73
+ const error = record(value);
74
+ const message = typeof error.message === 'string' ? error.message : '';
75
+ const info = error.codex_error_info ?? error.code ?? error.type;
76
+ const code = typeof info === 'string' ? info : Object.keys(record(info)).join(' ');
77
+ if (!/usage[_\s-]*limit[_\s-]*exceeded|rate[_\s-]*limit[_\s-]*exceeded/i.test(code)
78
+ && !/\b(?:usage[\s_-]+limit|rate[\s_-]+limit|too many requests)\b/i.test(message))
79
+ return undefined;
80
+ let retryAt = absoluteTime(error.resets_at);
81
+ if (retryAt === undefined) {
82
+ const iso = message.match(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})/i)?.[0];
83
+ retryAt = absoluteTime(iso);
84
+ }
85
+ if (retryAt === undefined)
86
+ retryAt = textResetTime(message, occurredAt);
87
+ if (retryAt === undefined && occurredAt !== undefined && validTime(occurredAt)) {
88
+ const relative = message.match(/\btry again in\s+(\d+(?:\.\d+)?)\s*(seconds?|minutes?|hours?)\b/i);
89
+ if (relative) {
90
+ const delay = Number(relative[1]) * (/^hour/i.test(relative[2]) ? 3600000 : /^minute/i.test(relative[2]) ? 60000 : 1000);
91
+ const at = occurredAt + delay;
92
+ if (validTime(at))
93
+ retryAt = at;
94
+ }
95
+ }
96
+ return { kind: 'usage_limit', ...(retryAt === undefined ? {} : { retryAt }) };
97
+ }
@@ -78,7 +78,7 @@ const controlErrorCopy = {
78
78
  CODE_INVALID: 'auth.error.codeInvalid', CLAIM_RATE_LIMIT: 'auth.error.rateLimit',
79
79
  PAIRING_NOT_FOUND: 'auth.error.pairingGone', PAIRING_INACTIVE: 'auth.error.pairingGone',
80
80
  DEVICE_NOT_FOUND: 'auth.error.deviceNotFound', DEVICE_INACTIVE: 'auth.error.deviceInactive',
81
- DEVICE_CONFLICT: 'auth.error.conflict', INVALID_EDIT: 'auth.error.invalidEdit',
81
+ DEVICE_NAME_TAKEN: 'auth.error.nameTaken', DEVICE_CONFLICT: 'auth.error.conflict', INVALID_EDIT: 'auth.error.invalidEdit',
82
82
  INVALID_VERSION: 'auth.error.invalidVersion', PAIRING_CAPACITY: 'auth.error.pairingCapacity',
83
83
  TOKEN_REQUIRED: 'auth.error.tokenRequired', DEVICE_REQUIRED: 'auth.error.deviceRequired',
84
84
  DEVICE_EXPIRY_CLI_ONLY: 'auth.error.expiryCliOnly',
@@ -32,6 +32,7 @@ export default {
32
32
  'auth.error.pairingGone': 'This authorization request no longer exists or has expired. Request a new code in the browser.',
33
33
  'auth.error.deviceNotFound': 'Device not found. Run handmux auth device list to check the device ID.',
34
34
  'auth.error.deviceInactive': 'This device has expired or been unbound. Authorize it again.',
35
+ 'auth.error.nameTaken': 'An active device already uses this name. Choose another name.',
35
36
  'auth.error.conflict': 'The device was changed by another operation. List devices again, then retry.',
36
37
  'auth.error.invalidEdit': 'Provide at least --name or --expire.',
37
38
  'auth.error.invalidVersion': 'The device was updated. List devices again, then retry.',
@@ -31,6 +31,7 @@ export default {
31
31
  'auth.error.pairingGone': '这次授权申请已不存在或已过期,请在浏览器重新申请验证码。',
32
32
  'auth.error.deviceNotFound': '找不到这个设备,请先运行 handmux auth device list 查看设备 ID。',
33
33
  'auth.error.deviceInactive': '设备已过期或解除绑定,请重新授权。',
34
+ 'auth.error.nameTaken': '已有有效设备使用此名称,请换一个名称。',
34
35
  'auth.error.conflict': '设备信息已被其他操作修改,请重新查看设备后再试。',
35
36
  'auth.error.invalidEdit': '请至少提供 --name 或 --expire。',
36
37
  'auth.error.invalidVersion': '设备信息已更新,请重新查看设备后再试。',
@@ -1,3 +1,4 @@
1
+ import { codexUsageLimitRecovery } from './agents/codexUsageLimitRecovery.js';
1
2
  import { codexPlanSnapshot } from './codexPlan.js';
2
3
  import { codexGoalMessageId, codexItemMessageId } from './codexMessageIdentity.js';
3
4
  const isRecord = (value) => (value !== null && typeof value === 'object' && !Array.isArray(value));
@@ -629,8 +630,10 @@ export function createCodexTranscriptParser() {
629
630
  const payloadError = asRecord(payload.error);
630
631
  if (payload.type === 'task_complete' && typeof payloadError.message === 'string'
631
632
  && payloadError.message.trim()) {
633
+ const recovery = codexUsageLimitRecovery(payloadError, ts ? Date.parse(ts) : undefined);
632
634
  messages.push({
633
635
  i, type: 'notice', noticeLevel: 'warning', text: payloadError.message.trim(), ts,
636
+ ...(recovery ? { recovery } : {}),
634
637
  ...(typeof payload.turn_id === 'string' && payload.turn_id ? { turnId: payload.turn_id } : {}),
635
638
  });
636
639
  }
@@ -369,7 +369,7 @@ export class DeviceAuthService {
369
369
  if (values.name === undefined && values.expire === undefined)
370
370
  throw new DeviceAuthError('INVALID_EDIT', 'Provide --name or --expire');
371
371
  const name = values.name === undefined ? undefined : validateName(values.name);
372
- if (name !== undefined && this.db.prepare('SELECT id FROM auth_devices WHERE name=? AND id<>? AND revoked_at IS NULL').get(name, id))
372
+ if (name !== undefined && this.db.prepare('SELECT id FROM auth_devices WHERE name=? AND id<>? AND revoked_at IS NULL AND (expires_at IS NULL OR expires_at>?)').get(name, id, this.now()))
373
373
  throw new DeviceAuthError('DEVICE_NAME_TAKEN', 'Device name is already in use', 409);
374
374
  const duration = values.expire === undefined ? undefined : parseExpire(values.expire);
375
375
  return this.transaction(() => {
@@ -554,7 +554,7 @@ export class DeviceAuthService {
554
554
  this.requireMode();
555
555
  const name = validateName(values.name);
556
556
  const duration = parseExpire(values.expire);
557
- if (this.db.prepare('SELECT id FROM auth_devices WHERE name=? AND revoked_at IS NULL').get(name))
557
+ if (this.db.prepare('SELECT id FROM auth_devices WHERE name=? AND revoked_at IS NULL AND (expires_at IS NULL OR expires_at>?)').get(name, this.now()))
558
558
  throw new DeviceAuthError('DEVICE_NAME_TAKEN', 'Device name is already in use', 409);
559
559
  const p = [...this.pending.values()].find(p => p.id === id && p.owner === owner);
560
560
  if (!p)
@@ -1,3 +1,4 @@
1
+ import { ScheduledError } from '../agent-runtime/scheduledMessages.js';
1
2
  import express from 'express';
2
3
  import { ConversationContractError } from '../agent-runtime/conversation.js';
3
4
  import { ConversationActivationError } from '../agent-runtime/conversationActivation.js';
@@ -429,6 +430,51 @@ export function agentRoutes({ runtime }) {
429
430
  return next(error);
430
431
  }
431
432
  });
433
+ router.post('/agents/scheduled-messages', async (req, res, next) => {
434
+ try {
435
+ if (!runtime.scheduledMessages || !runtime.scheduledTarget)
436
+ return res.status(409).json({ error: 'Scheduled messages are unavailable', code: 'unsupported' });
437
+ const ref = run(req.body?.run);
438
+ const service = runtime.scheduledMessages;
439
+ const body = record(req.body) ?? {};
440
+ if (body.action === 'preview')
441
+ return res.json(service.preview(body.request, typeof body.timeZone === 'string' ? body.timeZone : undefined));
442
+ if (!text(body.tmuxSession, 256) || !text(body.paneId, 256))
443
+ throw new ScheduledError('Choose a tmux session and pane');
444
+ const scope = { tmuxSession: body.tmuxSession, paneId: body.paneId };
445
+ if (body.action === 'snapshot')
446
+ return res.json(service.snapshot(scope));
447
+ const target = body.action === 'create' && ref ? await runtime.scheduledTarget(ref) : null;
448
+ if (body.action === 'create' && (!target || target.tmuxSession !== scope.tmuxSession || target.paneId !== scope.paneId))
449
+ throw new ScheduledError('Choose the current pane and Agent session', 'conflict');
450
+ switch (body.action) {
451
+ case 'create': return res.json(service.create(target, body.request));
452
+ case 'trigger':
453
+ case 'terminate':
454
+ case 'update':
455
+ case 'delete':
456
+ case 'exception': {
457
+ if (!text(body.id, 256) || !Number.isSafeInteger(body.revision))
458
+ throw new ScheduledError('Invalid scheduled message revision');
459
+ if (body.action === 'terminate')
460
+ return res.json(service.terminate(scope, body.id, body.revision));
461
+ if (body.action === 'trigger')
462
+ return res.json(await service.trigger(scope, body.id, body.revision));
463
+ if (body.action === 'update')
464
+ return res.json(service.update(scope, body.id, body.revision, body.request));
465
+ if (body.action === 'delete')
466
+ return res.json(service.remove(scope, body.id, body.revision));
467
+ return res.json(service.resolveException(scope, body.id, body.revision, body.request));
468
+ }
469
+ default: throw new ScheduledError('Invalid scheduled message action');
470
+ }
471
+ }
472
+ catch (error) {
473
+ if (error instanceof ScheduledError)
474
+ return res.status(error.code === 'invalid_request' ? 400 : error.code === 'not_found' ? 404 : 409).json({ error: error.message, code: error.code });
475
+ return next(error);
476
+ }
477
+ });
432
478
  router.post('/agents/conversation/discover', async (req, res, next) => {
433
479
  try {
434
480
  if (!runtime.conversation)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "handmux",
3
- "version": "0.35.0",
3
+ "version": "0.36.0",
4
4
  "description": "A mobile vibe-coding cockpit — built on tmux: drive your live session, Claude Code / Codex — anything a terminal can run — from your phone.",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0-only",
@@ -75,13 +75,13 @@
75
75
  "vitest": "^2.0.0"
76
76
  },
77
77
  "whatsNew": [
78
+ {"version":"0.36.0","date":"2026-10-22","zh":"对话定时消息 · 限额后定时继续","en":"Scheduled messages · plan a retry after usage limits"},
78
79
  {"version":"0.35.0","date":"2026-10-20","zh":"会话快捷操作 · 终端工具收放与位置记忆","en":"Session actions · collapsible terminal tools with saved positions"},
79
80
  {"version":"0.34.0","date":"2026-10-12","zh":"Codex 会话重启 · 分屏尺寸与代码复制","en":"Codex session restart, pane sizing, and code copying"},
80
81
  {"version":"0.33.4","date":"2026-10-10","zh":"修复终端实时连接、电脑键盘与 Codex 排队","en":"Fixes live terminal, desktop keys, and Codex queues"},
81
82
  {"version":"0.33.3","date":"2026-10-06","zh":"Claude 余额不足提示更明确","en":"Clearer Claude insufficient-balance errors"},
82
83
  {"version":"0.33.2","date":"2026-10-03","zh":"修复 v0.33.1 发布包的构建兼容问题","en":"Fixes build compatibility in the v0.33.1 package"},
83
84
  {"version":"0.33.1","date":"2026-10-02","zh":"对话复制和工作区操作更顺手","en":"Smoother conversation copying and workspace actions"},
84
- {"version":"0.33.0","date":"2026-09-30","zh":"终端路径高亮不再闪烁 · 服务更新提示更可靠","en":"Steady terminal paths · reliable service update prompts"},
85
- {"version":"0.32.1","date":"2026-09-28","zh":"抽屉与工作区切换更顺滑","en":"Smoother drawer and workspace switching"}
85
+ {"version":"0.33.0","date":"2026-09-30","zh":"终端路径高亮不再闪烁 · 服务更新提示更可靠","en":"Steady terminal paths · reliable service update prompts"}
86
86
  ]
87
87
  }
@@ -1 +0,0 @@
1
- import{U as o,a as n}from"./mermaid.core-CUCURRF9.js";const t=(r,a)=>o.lang.round(n.parse(r)[a]);export{t as c};