@yoonion/mimi-seed-mcp 0.25.5 → 0.25.6

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/LICENSE CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  <https://polyformproject.org/licenses/noncommercial/1.0.0>
4
4
 
5
- Required Notice: Copyright 2026 Pryzm GG (https://mimi-seed.pryzm.gg)
5
+ Required Notice: Copyright 2026 Lucas Foundation (https://mimi-seed.oddbout.com)
6
6
 
7
7
  ## Acceptance
8
8
 
@@ -150,15 +150,20 @@ the `youtube` Google profile, so pass `profile: "youtube"` to `youtube_*` tools
150
150
  arguments plus `confirm: true`.
151
151
  5. Report the per-platform `results`. The same post (same platform, account, and content) is never posted twice, so
152
152
  if something `failed`, fix it if needed (e.g. that platform's own `threads.text`) and call again: platforms that
153
- already posted are skipped. Approvals name one record by the `at` the plan showed; an approval stays valid until
154
- its action succeeds (or ends unknown), after which that record changes and the same arguments no longer match:
153
+ already posted are skipped. Approvals name one record by the `at` the plan showed for that platform's post and
154
+ account (after changing the content, preview again and use the new plan's `at`); an approval stays valid until its
155
+ action succeeds (or ends unknown), after which that record changes and the same arguments no longer match:
155
156
  - To post identical content again on purpose, get the user's go-ahead and pass
156
157
  `repost: [{ "platform": "<platform>", "at": "<at of that posted record>" }]` (TikTok needs a new plan instead).
157
158
  - If a result is `unknown_outcome`, do **not** retry on your own: that account stays blocked, even for edited
158
159
  content. Ask the user to check the platform. If the post **is** there, pass
159
160
  `markPosted: [{ "platform": "<platform>", "at": "<at the plan shows>" }]` (it is recorded as posted, nothing is
160
- sent); if it is **not**, pass `resendUnknown` with the same shape.
161
- A `posted` result with a `warning` that it could not be recorded is handled the same way (`markPosted`). A failed
161
+ sent); if it is **not**, pass `resendUnknown` with the same shape (it also resends an unknown repost). On TikTok,
162
+ which never republishes a plan, a resend needs a new plan sent with that `resendUnknown`. `markPosted` with
163
+ `confirm: true` is recorded even if the plan is blocked by something else (e.g. the rendered video was moved);
164
+ the result lists it under `marks`.
165
+ A `posted` result with a `warning` that it could not be recorded is handled the same way (`markPosted`); a
166
+ `failed` one whose error says it could not be recorded is resent with the `resendUnknown` the error names. A failed
162
167
  pre-send check (an expired token, a bad video file) means nothing was posted anywhere; "another call is publishing
163
168
  to this account" means wait and call again.
164
169
 
@@ -49,6 +49,8 @@ function pendingPath(platform, account) {
49
49
  function lockPath(platform, account) {
50
50
  return `${hashed('accounts', platform, account)}.lock`;
51
51
  }
52
+ /** An `at` must be a date: every later `at` is computed from it, and an approval names a record by it. */
53
+ const isDate = (value) => typeof value === 'string' && !Number.isNaN(Date.parse(value));
52
54
  /** Missing → null. Unreadable → throw: treating it as missing could post again what it recorded. */
53
55
  function readJsonRecord(file, valid) {
54
56
  if (!fs.existsSync(file))
@@ -65,13 +67,13 @@ function readJsonRecord(file, valid) {
65
67
  return parsed;
66
68
  }
67
69
  export function readRecord(platform, postKey) {
68
- return readJsonRecord(recordPath(platform, postKey), (r) => typeof r.state === 'string' && typeof r.at === 'string');
70
+ return readJsonRecord(recordPath(platform, postKey), (r) => typeof r.state === 'string' && isDate(r.at));
69
71
  }
70
72
  export function writeRecord(platform, postKey, record) {
71
73
  writeCredentialJson(recordPath(platform, postKey), record);
72
74
  }
73
75
  export function readPending(platform, account) {
74
- return readJsonRecord(pendingPath(platform, account), (r) => typeof r.postKey === 'string' && (r.state === 'sending' || r.state === 'unknown') && typeof r.at === 'string'
76
+ return readJsonRecord(pendingPath(platform, account), (r) => typeof r.postKey === 'string' && (r.state === 'sending' || r.state === 'unknown') && isDate(r.at)
75
77
  && (r.attempt === undefined || typeof r.attempt === 'string'));
76
78
  }
77
79
  export function writePending(platform, account, pending) {
@@ -121,9 +121,24 @@ interface DecideOptions {
121
121
  markPosted: readonly Approval[];
122
122
  }
123
123
  /** The single rule — the table at the top of this file. Same answer in the plan, under the lock, and before each send. */
124
- export declare function decide(platform: SocialTarget, record: PostRecord | null, pending: PendingRecord | null, { resendUnknown, repost }: DecideOptions): Decision;
124
+ export declare function decide(platform: SocialTarget, record: PostRecord | null, pending: PendingRecord | null, { resendUnknown, repost }: DecideOptions,
125
+ /** This post's key: a marker naming it on a `posted` record is a repost of it, which resendUnknown may resend. */
126
+ key?: string): Decision;
125
127
  /** No network: config files, the TikTok plan file, and the post and account records are all local. */
126
128
  export declare function planPublish(input: SocialPublishInput): PublishPlan;
129
+ export interface MarkOutcome {
130
+ platform: SocialTarget;
131
+ /** The pending `at` recorded as posted; absent when nothing on the account matched. */
132
+ marked?: string;
133
+ error?: string;
134
+ }
135
+ /**
136
+ * markPosted for a plan that is blocked (nothing will be sent): record the approved pending sends of each target's
137
+ * account anyway. A person confirmed they are live, and that does not depend on the content still being postable —
138
+ * e.g. the rendered video was moved after an upload whose outcome was unknown, which would otherwise leave the
139
+ * channel blocked for good.
140
+ */
141
+ export declare function recordMarksOnly(input: SocialPublishInput): MarkOutcome[];
127
142
  /**
128
143
  * Publish to every target in order. Call only with an approved plan whose `ok` is true.
129
144
  * 1. Lock every account that a post will be sent to (posts that are only skipped need no lock), then re-apply
@@ -25,9 +25,12 @@
25
25
  // none / failed | no | — | send
26
26
  // (otherwise) | | resendUnknown names the `at` | send: a person checked it is not live
27
27
  //
28
- // An approval (repost / resendUnknown) names the exact record it overrides by its `at`, shown in the plan. Once
29
- // used, that record changes (a new `at`), so the same arguments on a retry cannot repost again or resend a newer
30
- // unknown outcome nobody checked. A post that is only skipped never needs the account, its marker, or its lock.
28
+ // An approval (repost / resendUnknown / markPosted) names the exact record it overrides by its `at`, shown in the
29
+ // plan. An `at` is read against this call's post on that platform (its record) and that post's account (its marker)
30
+ // only — after changing the content, preview again and use the `at` the new plan shows. Once used, that record
31
+ // changes (a new `at`), so the same arguments on a retry cannot repost again or resend a newer unknown outcome
32
+ // nobody checked. resendUnknown naming a repost's own marker (same post, already `posted`) approves resending that
33
+ // repost. A post that is only skipped never needs the account, its marker, or its lock.
31
34
  //
32
35
  // Changing a platform's content (text, images, a re-rendered video, the title) makes a different post with its own
33
36
  // record, so it is sent — unless that account is pending. Another Page or account is another post and account.
@@ -81,6 +84,10 @@ const M = catalog({
81
84
  alreadyPostedTikTok: (at) => `이미 게시됨 (${at}) — 건너뜀. TikTok 에 다시 올리려면 tiktok_business_plan_video_post 로 새 계획을 만드세요.`,
82
85
  pendingNotCleared: (reason) => `(계정의 진행 중 표시를 지우지 못했습니다: ${reason}. 다음 호출에서 이 계정이 막히면 표시 파일을 확인하세요.)`,
83
86
  accountUnresolved: (p) => `${p} 의 대상 계정을 확인할 수 없습니다 (연결 또는 옵션을 확인하세요).`,
87
+ previousUnknownTikTok: (at) => `이전 시도(${at})의 결과를 알 수 없습니다 — 게시됐을 수 있습니다. tiktok 에서 직접 확인하세요. 올라가 있다면 markPosted: [{ "platform": "tiktok", "at": "${at}" }] 를 더해 보내세요. 없다면 TikTok 은 같은 계획을 다시 게시하지 않으니, tiktok_business_plan_video_post 로 새 계획을 만들어 그 planId 와 resendUnknown: [{ "platform": "tiktok", "at": "${at}" }] 로 보내세요.`,
88
+ accountPendingTikTok: (at) => `tiktok 계정에 결과를 알 수 없는 이전 게시(${at})가 있습니다 — 내용이 달라도 막습니다. tiktok 에서 직접 확인하세요. 올라가 있다면 markPosted: [{ "platform": "tiktok", "at": "${at}" }] 를 더해 보내세요. 없다면 TikTok 은 같은 계획을 다시 게시하지 않으니, tiktok_business_plan_video_post 로 새 계획을 만들어 그 planId 와 resendUnknown: [{ "platform": "tiktok", "at": "${at}" }] 로 보내세요.`,
89
+ failedUnrecorded: (p, at, reason) => `거부되어 게시되지 않았지만 그 결과를 기록하지 못했습니다 (${reason}). 다음 호출에서 이 계정은 "결과 알 수 없음"으로 막힙니다. 올라간 것이 없으니 resendUnknown: [{ "platform": "${p}", "at": "${at}" }] 를 더해 다시 보내세요.`,
90
+ markNeedsAccount: (p) => `markPosted 를 기록하려면 ${p} 의 대상 계정을 확인할 수 있어야 합니다 (연결 또는 옵션을 확인하세요).`,
84
91
  pendingTakenOver: '(이 호출의 잠금이 오래 멈춘 사이 다른 호출이 이 계정에 게시를 시작해 계정 표시를 바꿨습니다. 이 결과는 계정 표시에 남지 않았으니 플랫폼에서 직접 확인하세요.)',
85
92
  postedUnrecorded: (p, at, reason) => `게시됐지만 기록하지 못했습니다 (${reason}). 다음 호출에서 이 계정은 "결과 알 수 없음"으로 막힙니다. ${p} 에서 게시물을 확인한 뒤 markPosted: [{ "platform": "${p}", "at": "${at}" }] 를 넘기면 풀립니다.`,
86
93
  privacy: (p) => `공개 상태: ${p}`,
@@ -119,6 +126,10 @@ const M = catalog({
119
126
  alreadyPostedTikTok: (at) => `already posted (${at}) — skipped. To post to TikTok again, make a new plan with tiktok_business_plan_video_post.`,
120
127
  pendingNotCleared: (reason) => `(The account's pending marker could not be cleared: ${reason}. If the next call is blocked for this account, check that file.)`,
121
128
  accountUnresolved: (p) => `Cannot tell which ${p} account to post to (check its connection or options).`,
129
+ previousUnknownTikTok: (at) => `The outcome of the previous attempt (${at}) is unknown — it may have been posted. Check tiktok: if it is there, send with markPosted: [{ "platform": "tiktok", "at": "${at}" }]. If not, TikTok will not publish the same plan again: make a new plan with tiktok_business_plan_video_post and send its planId with resendUnknown: [{ "platform": "tiktok", "at": "${at}" }].`,
130
+ accountPendingTikTok: (at) => `This tiktok account has an earlier send (${at}) whose outcome is unknown — blocked even for different content. Check tiktok: if it is there, send with markPosted: [{ "platform": "tiktok", "at": "${at}" }]. If not, TikTok will not publish the same plan again: make a new plan with tiktok_business_plan_video_post and send its planId with resendUnknown: [{ "platform": "tiktok", "at": "${at}" }].`,
131
+ failedUnrecorded: (p, at, reason) => `Refused, so nothing was posted, but that could not be recorded (${reason}). The next call will find this account blocked as "outcome unknown". Nothing went out, so send again with resendUnknown: [{ "platform": "${p}", "at": "${at}" }].`,
132
+ markNeedsAccount: (p) => `To record markPosted, the ${p} account must be resolvable (check its connection or options).`,
122
133
  pendingTakenOver: '(While this call\'s lock was stalled, another call started publishing to this account and replaced its marker. This outcome is not on the marker: check the platform directly.)',
123
134
  postedUnrecorded: (p, at, reason) => `Posted, but it could not be recorded (${reason}). The next call will find this account blocked as "outcome unknown". Check the post on ${p}, then pass markPosted: [{ "platform": "${p}", "at": "${at}" }] to clear it.`,
124
135
  privacy: (p) => `privacy: ${p}`,
@@ -261,11 +272,16 @@ function settlePending(platform, account, ours, next) {
261
272
  */
262
273
  function laterThan(previous, base = Date.now()) {
263
274
  const floors = previous.map((at) => (at === undefined ? Number.NaN : Date.parse(at) + 1)).filter((ms) => !Number.isNaN(ms));
264
- return new Date(Math.max(base, ...floors)).toISOString();
275
+ // The readers reject an unparsable `at`; an unparsable base still must not throw (new Date(NaN).toISOString()).
276
+ return new Date(Math.max(Number.isNaN(base) ? Date.now() : base, ...floors)).toISOString();
265
277
  }
266
- /** The `at` a marked-posted send gets: its own, moved past an earlier `posted` record so a repost approval is used up. */
267
- function markedAt(pendingAt, itsPost) {
268
- return itsPost?.state === 'posted' ? laterThan([itsPost.at], Date.parse(pendingAt)) : pendingAt;
278
+ /**
279
+ * The `at` a marked-posted record gets: just past the `at` that was marked, and past an earlier `posted` record (a
280
+ * repost's). A mark is an outcome like any other: it must leave no record with the `at` an approval in the same call
281
+ * named — `markPosted: [P]` with `repost: [P]` would otherwise mark P and then repost it.
282
+ */
283
+ function markedAt(at, itsPost) {
284
+ return laterThan([at, itsPost?.state === 'posted' ? itsPost.at : undefined], Date.parse(at));
269
285
  }
270
286
  function errorText(error) {
271
287
  return (error instanceof Error ? error.message : String(error)).slice(0, 500);
@@ -389,23 +405,29 @@ function planTikTok(input) {
389
405
  }
390
406
  const approves = (list, platform, at) => list.some((a) => a.platform === platform && a.at === at);
391
407
  /** The single rule — the table at the top of this file. Same answer in the plan, under the lock, and before each send. */
392
- export function decide(platform, record, pending, { resendUnknown, repost }) {
408
+ export function decide(platform, record, pending, { resendUnknown, repost },
409
+ /** This post's key: a marker naming it on a `posted` record is a repost of it, which resendUnknown may resend. */
410
+ key) {
411
+ // A person checked that this post's own repost (its marker) is not live: resending it is that repost, approved.
412
+ const resendsRepost = record?.state === 'posted' && pending !== null && key !== undefined && pending.postKey === key
413
+ && approves(resendUnknown, platform, pending.at);
393
414
  // A skip sends nothing, so nothing else (another call's pending send, a lock) can stand in its way.
394
- const reposting = record?.state === 'posted' && approves(repost, platform, record.at);
415
+ const reposting = record?.state === 'posted' && (approves(repost, platform, record.at) || resendsRepost);
395
416
  if (record?.state === 'posted' && !reposting) {
396
417
  return { kind: 'skip', outcome: { platform, status: 'already_posted', id: record.id, url: record.url, at: record.at } };
397
418
  }
398
419
  if (pending && !approves(resendUnknown, platform, pending.at)) {
399
- return { kind: 'block', problem: M().accountPending(platform, pending.at) };
420
+ return { kind: 'block', problem: platform === 'tiktok' ? M().accountPendingTikTok(pending.at) : M().accountPending(platform, pending.at) };
400
421
  }
401
422
  if (reposting && record)
402
- return { kind: 'send', note: M().reposting(record.at) };
423
+ return { kind: 'send', note: resendsRepost && pending ? M().resendingUnknown(pending.at) : M().reposting(record.at) };
403
424
  if (record?.state === 'sending' || record?.state === 'unknown') {
404
425
  if (approves(resendUnknown, platform, record.at))
405
426
  return { kind: 'send', note: M().resendingUnknown(record.at) };
406
427
  // The marker for this record is already approved above; an older record without a marker needs its own approval.
407
- if (!pending || pending.at !== record.at)
408
- return { kind: 'block', problem: M().previousUnknown(platform, record.at) };
428
+ if (!pending || pending.at !== record.at) {
429
+ return { kind: 'block', problem: platform === 'tiktok' ? M().previousUnknownTikTok(record.at) : M().previousUnknown(platform, record.at) };
430
+ }
409
431
  }
410
432
  if (pending)
411
433
  return { kind: 'send', note: M().resendingUnknown(pending.at) };
@@ -431,7 +453,7 @@ function applyMarks(platform, key, record, pending, opts) {
431
453
  }
432
454
  if (view.record && (view.record.state === 'unknown' || view.record.state === 'sending') && approves(opts.markPosted, platform, view.record.at)) {
433
455
  marked = view.record.at;
434
- view = { ...view, record: { ...view.record, state: 'posted' } };
456
+ view = { ...view, record: { ...view.record, state: 'posted', at: markedAt(view.record.at, null) } };
435
457
  }
436
458
  return { ...view, marked };
437
459
  }
@@ -477,6 +499,9 @@ export function planPublish(input) {
477
499
  }
478
500
  if (markNote)
479
501
  post.action = `${post.action} — ${markNote}`;
502
+ // A mark is written under the account's lock: without the account it would be shown here but never saved.
503
+ if (resolved.view.marked && accountKey(platform, input) === null)
504
+ post.problems.push(M().markNeedsAccount(platform));
480
505
  }
481
506
  if (duplicate)
482
507
  post.problems.push(M().duplicateTarget(platform));
@@ -491,17 +516,21 @@ export function planPublish(input) {
491
516
  function resolveDecision(platform, key, record, input) {
492
517
  const opts = options(input);
493
518
  const own = applyMarks(platform, key, record, null, opts);
494
- const skipOnly = decide(platform, own.record, null, opts);
495
- if (skipOnly.kind === 'skip')
519
+ const skipOnly = decide(platform, own.record, null, opts, key);
520
+ // resendUnknown may name this post's own repost marker (decide's resendsRepost): then the account must be read.
521
+ const mayResendRepost = own.record?.state === 'posted' && opts.resendUnknown.some((a) => a.platform === platform);
522
+ if (skipOnly.kind === 'skip' && !mayResendRepost)
496
523
  return { decision: skipOnly, account: null, view: own, locked: false, unresolved: false };
497
524
  const account = accountKey(platform, input);
525
+ if (account === null && skipOnly.kind === 'skip')
526
+ return { decision: skipOnly, account: null, view: own, locked: false, unresolved: false };
498
527
  if (account === null) {
499
528
  // The platform's own plan check normally says why (no youtube options, TikTok not connected); this is the fallback.
500
529
  const decision = { kind: 'block', problem: M().accountUnresolved(platform) };
501
530
  return { decision, account, view: own, locked: false, unresolved: true };
502
531
  }
503
532
  const view = applyMarks(platform, key, record, effectivePending(platform, account), opts);
504
- return { decision: decide(platform, view.record, view.pending, opts), account, view, locked: isAccountLocked(platform, account), unresolved: false };
533
+ return { decision: decide(platform, view.record, view.pending, opts, key), account, view, locked: isAccountLocked(platform, account), unresolved: false };
505
534
  }
506
535
  /**
507
536
  * The account's pending marker, unless the send it names did finish: when that send's own outcome was recorded
@@ -515,8 +544,10 @@ function effectivePending(platform, account) {
515
544
  if (!pending)
516
545
  return null;
517
546
  const itsPost = readRecord(platform, pending.postKey);
547
+ // A marker from an earlier build has no attempt: fall back to a record strictly newer than it (marks and sends
548
+ // always write a later `at`). Ties and a stepped-back clock keep it blocking — the safe side.
518
549
  const settled = (itsPost?.state === 'posted' || itsPost?.state === 'failed')
519
- && pending.attempt !== undefined && itsPost.settledAttempt === pending.attempt;
550
+ && (pending.attempt !== undefined ? itsPost.settledAttempt === pending.attempt : itsPost.at > pending.at);
520
551
  return settled ? null : pending;
521
552
  }
522
553
  function youtubeUploadInput(input) {
@@ -609,6 +640,21 @@ async function send(platform, input, post, prepared) {
609
640
  }
610
641
  }
611
642
  }
643
+ /**
644
+ * The account half of markPosted, under the lock: the account's pending send the person found live becomes `posted`
645
+ * (a repost's record keeps its id/url and moves past its old `at`), and its marker is cleared (compare-and-set). It
646
+ * needs only the account, not this call's content, so it also works when the content can no longer be planned (a
647
+ * deleted render). Returns the `at` it marked, or null.
648
+ */
649
+ function markPendingPosted(platform, account, marks) {
650
+ const pending = readPending(platform, account);
651
+ if (!pending || !approves(marks, platform, pending.at))
652
+ return null;
653
+ const itsPost = readRecord(platform, pending.postKey);
654
+ writeRecord(platform, pending.postKey, { ...(itsPost?.state === 'posted' ? itsPost : {}), state: 'posted', at: markedAt(pending.at, itsPost), settledAttempt: pending.attempt });
655
+ replacePendingIfOurs(platform, account, pending, null);
656
+ return pending.at;
657
+ }
612
658
  /**
613
659
  * Write the person's markPosted approvals (applyMarks) to disk, each under its account's lock: the approved pending
614
660
  * send — or older unknown record — becomes `posted`, and that send's marker is cleared (compare-and-set). Nothing is
@@ -622,20 +668,13 @@ function persistMarks(input, videoFile) {
622
668
  const key = targetKey(platform, input, videoFile);
623
669
  const account = accountKey(platform, input);
624
670
  if (key === null || account === null)
625
- continue;
671
+ continue; // the plan blocks these (markNeedsAccount, or not connected)
626
672
  const lock = acquireAccountLock(platform, account);
627
673
  try {
628
- const pending = readPending(platform, account);
629
- if (pending && approves(marks, platform, pending.at)) {
630
- // Also when the post is already `posted` (the marker is a repost's): move its `at` forward, so a repost
631
- // approval naming the older `at` no longer matches (same as applyMarks).
632
- const itsPost = readRecord(platform, pending.postKey);
633
- writeRecord(platform, pending.postKey, { ...(itsPost?.state === 'posted' ? itsPost : {}), state: 'posted', at: markedAt(pending.at, itsPost), settledAttempt: pending.attempt });
634
- replacePendingIfOurs(platform, account, pending, null);
635
- }
674
+ markPendingPosted(platform, account, marks);
636
675
  const record = readRecord(platform, key);
637
676
  if (record && (record.state === 'unknown' || record.state === 'sending') && approves(marks, platform, record.at)) {
638
- writeRecord(platform, key, { ...record, state: 'posted' });
677
+ writeRecord(platform, key, { ...record, state: 'posted', at: markedAt(record.at, null) });
639
678
  }
640
679
  }
641
680
  finally {
@@ -643,6 +682,39 @@ function persistMarks(input, videoFile) {
643
682
  }
644
683
  }
645
684
  }
685
+ /**
686
+ * markPosted for a plan that is blocked (nothing will be sent): record the approved pending sends of each target's
687
+ * account anyway. A person confirmed they are live, and that does not depend on the content still being postable —
688
+ * e.g. the rendered video was moved after an upload whose outcome was unknown, which would otherwise leave the
689
+ * channel blocked for good.
690
+ */
691
+ export function recordMarksOnly(input) {
692
+ const marks = input.markPosted ?? [];
693
+ const outcomes = [];
694
+ for (const platform of new Set(marks.map((m) => m.platform))) {
695
+ if (!input.targets.includes(platform))
696
+ continue;
697
+ const account = accountKey(platform, input);
698
+ if (account === null) {
699
+ outcomes.push({ platform, error: M().markNeedsAccount(platform) });
700
+ continue;
701
+ }
702
+ try {
703
+ const lock = acquireAccountLock(platform, account);
704
+ try {
705
+ const marked = markPendingPosted(platform, account, marks);
706
+ outcomes.push(marked ? { platform, marked } : { platform });
707
+ }
708
+ finally {
709
+ lock.release();
710
+ }
711
+ }
712
+ catch (error) {
713
+ outcomes.push({ platform, error: errorText(error) });
714
+ }
715
+ }
716
+ return outcomes;
717
+ }
646
718
  /**
647
719
  * Publish to every target in order. Call only with an approved plan whose `ok` is true.
648
720
  * 1. Lock every account that a post will be sent to (posts that are only skipped need no lock), then re-apply
@@ -676,7 +748,7 @@ export async function executePublish(input, plan) {
676
748
  }
677
749
  // Re-read under the lock: a concurrent call may have changed the records since the plan was made.
678
750
  const decision = lock && account !== null
679
- ? decide(platform, readRecord(platform, key), effectivePending(platform, account), opts)
751
+ ? decide(platform, readRecord(platform, key), effectivePending(platform, account), opts, key)
680
752
  : preliminary;
681
753
  return { post, key, account: account ?? '', lock, decision };
682
754
  });
@@ -720,7 +792,7 @@ export async function executePublish(input, plan) {
720
792
  current = readRecord(platform, key);
721
793
  // The raw marker (even one effectivePending ignores) is overwritten below: the new one must not reuse its `at`.
722
794
  replacedMarkerAt = readPending(platform, account)?.at;
723
- now = decide(platform, current, effectivePending(platform, account), opts);
795
+ now = decide(platform, current, effectivePending(platform, account), opts, key);
724
796
  }
725
797
  catch (error) {
726
798
  outcomes.push({ platform, status: 'failed', error: errorText(error) });
@@ -791,6 +863,9 @@ export async function executePublish(input, plan) {
791
863
  catch (writeError) {
792
864
  // Both records stay `sending`, which decide() treats like unknown: safe, at worst it needs a manual check.
793
865
  ledgerBroken = errorText(writeError);
866
+ // A clean refusal sent nothing, but the account will read as unknown: say how to clear it.
867
+ if (!ambiguous)
868
+ reported = `${reported} ${M().failedUnrecorded(platform, startedAt, ledgerBroken)}`;
794
869
  }
795
870
  outcomes.push(ambiguous
796
871
  ? { platform, status: 'unknown_outcome', error: reported, at }
@@ -17,7 +17,7 @@ declare const _default: {
17
17
  '\uC0AC\uC6A9\uC790\uC758 \uBA85\uC2DC \uC2B9\uC778 \uD6C4 true. false \uBA74 dry-run \uACC4\uD68D\uB9CC \uBC18\uD658\uD569\uB2C8\uB2E4.': string;
18
18
  '\uC0AC\uC6A9\uC790\uAC00 \uADF8 \uD50C\uB7AB\uD3FC\uC5D0\uC11C \uAC8C\uC2DC\uB418\uC9C0 \uC54A\uC558\uC74C\uC744 \uD655\uC778\uD55C, \uACB0\uACFC\uB97C \uC54C \uC218 \uC5C6\uC5C8\uB358 \uAE30\uB85D. \uACC4\uD68D\uC5D0 \uD45C\uC2DC\uB41C \uD50C\uB7AB\uD3FC\uACFC at \uC744 \uADF8\uB300\uB85C \uB118\uAE41\uB2C8\uB2E4. \uADF8 \uAE30\uB85D\uB9CC \uB2E4\uC2DC \uBCF4\uB0B4\uBA70, \uC774\uD6C4 \uC0C8\uB85C \uC0DD\uAE34 \uACB0\uACFC \uBD88\uBA85\uC740 \uB2E4\uC2DC \uB9C9\uD799\uB2C8\uB2E4.': string;
19
19
  '\uC0AC\uC6A9\uC790\uAC00 \uC77C\uBD80\uB7EC \uB2E4\uC2DC \uAC8C\uC2DC\uD558\uB824\uB294 \uC774\uBBF8 \uAC8C\uC2DC\uB41C \uAE30\uB85D. \uACC4\uD68D\uC5D0 \uD45C\uC2DC\uB41C \uD50C\uB7AB\uD3FC\uACFC at \uC744 \uADF8\uB300\uB85C \uB118\uAE41\uB2C8\uB2E4. \uD55C \uBC88 \uB2E4\uC2DC \uAC8C\uC2DC\uB418\uBA74 \uADF8 \uC2B9\uC778\uC740 \uB354 \uC774\uC0C1 \uB9DE\uC9C0 \uC54A\uC544 \uC7AC\uC2DC\uB3C4\uB85C \uBC18\uBCF5 \uAC8C\uC2DC\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.': string;
20
- '\uACC4\uD68D\uC5D0 \uD45C\uC2DC\uB41C \uADF8 \uAE30\uB85D\uC758 at (\uC2B9\uC778 \uB300\uC0C1 \uAE30\uB85D\uC744 \uC815\uD655\uD788 \uC9C0\uBAA9)': string;
21
- '\uACB0\uACFC\uB97C \uC54C \uC218 \uC5C6\uC5C8\uB358 \uAE30\uB85D \uC911, \uC0AC\uC6A9\uC790\uAC00 \uADF8 \uD50C\uB7AB\uD3FC\uC5D0\uC11C \uC2E4\uC81C\uB85C \uC62C\uB77C\uAC00 \uC788\uC74C\uC744 \uD655\uC778\uD55C \uAC83. \uACC4\uD68D\uC5D0 \uD45C\uC2DC\uB41C \uD50C\uB7AB\uD3FC\uACFC at \uC744 \uADF8\uB300\uB85C \uB118\uAE41\uB2C8\uB2E4. \uADF8 \uAE30\uB85D\uC744 \uAC8C\uC2DC\uB428\uC73C\uB85C \uB0A8\uAE30\uACE0 \uACC4\uC815 \uCC28\uB2E8\uC744 \uD489\uB2C8\uB2E4 (\uBCF4\uB0B4\uC9C0\uB294 \uC54A\uC74C).': string;
20
+ '\uACC4\uD68D\uC5D0 \uD45C\uC2DC\uB41C \uADF8 \uAE30\uB85D\uC758 at (\uC2B9\uC778 \uB300\uC0C1 \uAE30\uB85D\uC744 \uC815\uD655\uD788 \uC9C0\uBAA9). \uC774 \uD638\uCD9C\uC758 \uADF8 \uD50C\uB7AB\uD3FC \uAC8C\uC2DC\uBB3C\uACFC \uACC4\uC815 \uAE30\uC900\uC774\uBBC0\uB85C, \uB0B4\uC6A9\uC744 \uBC14\uAFB8\uBA74 \uB2E4\uC2DC \uBBF8\uB9AC\uBCF4\uAE30\uD55C \uACC4\uD68D\uC758 at \uC744 \uC4F0\uC138\uC694.': string;
21
+ '\uACB0\uACFC\uB97C \uC54C \uC218 \uC5C6\uC5C8\uB358 \uAE30\uB85D \uC911, \uC0AC\uC6A9\uC790\uAC00 \uADF8 \uD50C\uB7AB\uD3FC\uC5D0\uC11C \uC2E4\uC81C\uB85C \uC62C\uB77C\uAC00 \uC788\uC74C\uC744 \uD655\uC778\uD55C \uAC83. \uACC4\uD68D\uC5D0 \uD45C\uC2DC\uB41C \uD50C\uB7AB\uD3FC\uACFC at \uC744 \uADF8\uB300\uB85C \uB118\uAE41\uB2C8\uB2E4. \uADF8 \uAE30\uB85D\uC744 \uAC8C\uC2DC\uB428\uC73C\uB85C \uB0A8\uAE30\uACE0 \uACC4\uC815 \uCC28\uB2E8\uC744 \uD489\uB2C8\uB2E4 (\uBCF4\uB0B4\uC9C0\uB294 \uC54A\uC74C). confirm: true \uC774\uBA74 \uACC4\uD68D\uC774 \uB2E4\uB978 \uBB38\uC81C\uB85C \uB9C9\uD600\uB3C4 \uACC4\uC815\uC758 \uC9C4\uD589 \uC911 \uAC8C\uC2DC\uB294 \uAE30\uB85D\uD569\uB2C8\uB2E4.': string;
22
22
  };
23
23
  export default _default;
@@ -17,6 +17,6 @@ export default {
17
17
  '사용자의 명시 승인 후 true. false 면 dry-run 계획만 반환합니다.': 'true after the user\'s explicit approval. When false, returns only the dry-run plan.',
18
18
  '사용자가 그 플랫폼에서 게시되지 않았음을 확인한, 결과를 알 수 없었던 기록. 계획에 표시된 플랫폼과 at 을 그대로 넘깁니다. 그 기록만 다시 보내며, 이후 새로 생긴 결과 불명은 다시 막힙니다.': 'Unknown-outcome records the user checked are not posted on that platform. Pass the platform and at exactly as the plan showed them. Only that record is sent again; a newer unknown outcome is blocked again.',
19
19
  '사용자가 일부러 다시 게시하려는 이미 게시된 기록. 계획에 표시된 플랫폼과 at 을 그대로 넘깁니다. 한 번 다시 게시되면 그 승인은 더 이상 맞지 않아 재시도로 반복 게시되지 않습니다.': 'Already-posted records the user wants to post again on purpose. Pass the platform and at exactly as the plan showed them. Once reposted, that approval no longer matches, so a retry cannot repost again.',
20
- '계획에 표시된 그 기록의 at (승인 대상 기록을 정확히 지목)': 'The at the plan showed for that record (names exactly which record is approved)',
21
- '결과를 알 수 없었던 기록 중, 사용자가 그 플랫폼에서 실제로 올라가 있음을 확인한 것. 계획에 표시된 플랫폼과 at 을 그대로 넘깁니다. 그 기록을 게시됨으로 남기고 계정 차단을 풉니다 (보내지는 않음).': 'Unknown-outcome records the user checked and found live on that platform. Pass the platform and at exactly as the plan showed them. The record is kept as posted and the account is unblocked (nothing is sent).',
20
+ '계획에 표시된 그 기록의 at (승인 대상 기록을 정확히 지목). 이 호출의 그 플랫폼 게시물과 계정 기준이므로, 내용을 바꾸면 다시 미리보기한 계획의 at 을 쓰세요.': 'The at the plan showed for that record (names exactly which record is approved). It is read against this call\'s post on that platform and its account, so after changing the content, use the at from a fresh preview.',
21
+ '결과를 알 수 없었던 기록 중, 사용자가 그 플랫폼에서 실제로 올라가 있음을 확인한 것. 계획에 표시된 플랫폼과 at 을 그대로 넘깁니다. 그 기록을 게시됨으로 남기고 계정 차단을 풉니다 (보내지는 않음). confirm: true 이면 계획이 다른 문제로 막혀도 계정의 진행 중 게시는 기록합니다.': 'Unknown-outcome records the user checked and found live on that platform. Pass the platform and at exactly as the plan showed them. The record is kept as posted and the account is unblocked (nothing is sent). With confirm: true, the account\'s pending send is recorded even when the plan is blocked by another problem.',
22
22
  };
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
  import { SOCIAL_PROFILE_ID_PATTERN } from '#core/project-manifest.js';
3
3
  import { GOOGLE_PROFILE_ID } from '../auth/google-auth.js';
4
4
  import { YOUTUBE_CHANNEL_ID } from '../auth/youtube-channel.js';
5
- import { executePublish, planPublish, SOCIAL_TARGETS } from '../crosspost/tools.js';
5
+ import { executePublish, planPublish, recordMarksOnly, SOCIAL_TARGETS } from '../crosspost/tools.js';
6
6
  import { jsonResult } from '../lib/mcp-response.js';
7
7
  import { catalog } from '#core/lang.js';
8
8
  const M = catalog({
@@ -10,6 +10,7 @@ const M = catalog({
10
10
  absoluteOnly: '절대경로만 허용합니다.',
11
11
  preview: 'dry-run — 아무것도 게시하지 않았습니다. 아래 계획을 사용자에게 보여주고 명시 승인을 받은 뒤, 같은 인자에 confirm: true 를 더해 다시 호출하세요.',
12
12
  blocked: '문제가 있는 대상이 있어 아무 곳에도 게시하지 않았습니다. problems 를 고친 뒤 다시 미리보기하세요.',
13
+ blockedMarked: '문제가 있는 대상이 있어 아무 곳에도 게시하지 않았습니다. 다만 markPosted 로 확인된 계정의 진행 중 게시는 게시됨으로 기록했습니다 (marks). problems 를 고친 뒤 다시 미리보기하세요.',
13
14
  requestIdRemoved: 'requestId 는 더 이상 받지 않습니다. 같은 게시물(플랫폼·계정·내용이 같음)은 requestId 없이도 한 번만 게시됩니다. requestId 를 빼고 다시 부르세요. 같은 내용을 일부러 다시 올리려면 repost 를 쓰세요.',
14
15
  done: '게시를 마쳤습니다. 실패한 대상은 다시 호출하면 다시 보냅니다 — 이미 게시된 곳은 건너뜁니다. 결과를 알 수 없는 대상은 그 플랫폼에서 먼저 확인하세요.',
15
16
  }, {
@@ -17,6 +18,7 @@ const M = catalog({
17
18
  absoluteOnly: 'Only absolute paths are allowed.',
18
19
  preview: 'dry-run — nothing was posted. Show the user the plan below, get their explicit approval, then call again with the same arguments plus confirm: true.',
19
20
  blocked: 'Nothing was posted because some targets have problems. Fix the problems, then preview again.',
21
+ blockedMarked: 'Nothing was posted because some targets have problems. The pending sends that markPosted confirmed live were still recorded as posted (marks). Fix the problems, then preview again.',
20
22
  requestIdRemoved: 'requestId is no longer accepted. The same post (same platform, account, and content) is posted only once without it. Call again without requestId. To post the same content again on purpose, use repost.',
21
23
  done: 'Publishing finished. Calling again resends the failed targets — platforms that already posted are skipped. Check any unknown-outcome target on its platform first.',
22
24
  });
@@ -31,7 +33,7 @@ const metaOptions = z.object({
31
33
  }).optional();
32
34
  const approval = z.object({
33
35
  platform: z.enum(SOCIAL_TARGETS),
34
- at: z.string().min(1).max(64).describe('계획에 표시된 그 기록의 at (승인 대상 기록을 정확히 지목)'),
36
+ at: z.string().min(1).max(64).describe('계획에 표시된 그 기록의 at (승인 대상 기록을 정확히 지목). 이 호출의 그 플랫폼 게시물과 계정 기준이므로, 내용을 바꾸면 다시 미리보기한 계획의 at 을 쓰세요.'),
35
37
  });
36
38
  export function registerCrosspostTools(server) {
37
39
  server.tool('social_publish', [
@@ -64,7 +66,7 @@ export function registerCrosspostTools(server) {
64
66
  }).optional(),
65
67
  resendUnknown: z.array(approval).max(SOCIAL_TARGETS.length * 2).optional().describe('사용자가 그 플랫폼에서 게시되지 않았음을 확인한, 결과를 알 수 없었던 기록. 계획에 표시된 플랫폼과 at 을 그대로 넘깁니다. 그 기록만 다시 보내며, 이후 새로 생긴 결과 불명은 다시 막힙니다.'),
66
68
  repost: z.array(approval).max(SOCIAL_TARGETS.length * 2).optional().describe('사용자가 일부러 다시 게시하려는 이미 게시된 기록. 계획에 표시된 플랫폼과 at 을 그대로 넘깁니다. 한 번 다시 게시되면 그 승인은 더 이상 맞지 않아 재시도로 반복 게시되지 않습니다.'),
67
- markPosted: z.array(approval).max(SOCIAL_TARGETS.length * 2).optional().describe('결과를 알 수 없었던 기록 중, 사용자가 그 플랫폼에서 실제로 올라가 있음을 확인한 것. 계획에 표시된 플랫폼과 at 을 그대로 넘깁니다. 그 기록을 게시됨으로 남기고 계정 차단을 풉니다 (보내지는 않음).'),
69
+ markPosted: z.array(approval).max(SOCIAL_TARGETS.length * 2).optional().describe('결과를 알 수 없었던 기록 중, 사용자가 그 플랫폼에서 실제로 올라가 있음을 확인한 것. 계획에 표시된 플랫폼과 at 을 그대로 넘깁니다. 그 기록을 게시됨으로 남기고 계정 차단을 풉니다 (보내지는 않음). confirm: true 이면 계획이 다른 문제로 막혀도 계정의 진행 중 게시는 기록합니다.'),
68
70
  // Removed: the "same post" rule replaced it. Rejected rather than silently dropped, so a caller relying on it
69
71
  // learns that it no longer chooses what counts as a retry.
70
72
  requestId: z.never({ error: () => M().requestIdRemoved }).optional().describe('지원 중단 — 넘기면 거부합니다. 같은 게시물은 자동으로 한 번만 게시됩니다.'),
@@ -73,8 +75,14 @@ export function registerCrosspostTools(server) {
73
75
  const plan = planPublish(input);
74
76
  if (!confirm)
75
77
  return jsonResult({ mode: 'dry-run', note: M().preview, ...plan });
76
- if (!plan.ok)
77
- return jsonResult({ mode: 'blocked', note: M().blocked, ...plan });
78
+ if (!plan.ok) {
79
+ // markPosted records what a person confirmed on the platform; it needs only the account, so a plan blocked by
80
+ // the content (a moved render, an expired TikTok plan) must not keep that account blocked.
81
+ const marks = input.markPosted?.length ? recordMarksOnly(input) : [];
82
+ return marks.some((m) => m.marked)
83
+ ? jsonResult({ mode: 'blocked', note: M().blockedMarked, marks, ...plan })
84
+ : jsonResult({ mode: 'blocked', note: M().blocked, ...(marks.length ? { marks } : {}), ...plan });
85
+ }
78
86
  const results = await executePublish(input, plan);
79
87
  return jsonResult({ mode: 'published', note: M().done, results });
80
88
  });
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@yoonion/mimi-seed-mcp",
3
- "version": "0.25.5",
3
+ "version": "0.25.6",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@yoonion/mimi-seed-mcp",
9
- "version": "0.25.5",
9
+ "version": "0.25.6",
10
10
  "license": "PolyForm-Noncommercial-1.0.0",
11
11
  "dependencies": {
12
12
  "@googleapis/admob": "^11.0.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yoonion/mimi-seed-mcp",
3
- "version": "0.25.5",
3
+ "version": "0.25.6",
4
4
  "description": "Mimi Seed MCP server \u2014 Firebase + AdMob + Google Play + App Store management for Claude Code / Codex / Cursor / any MCP client.",
5
5
  "type": "module",
6
6
  "imports": {