@gobing-ai/knowledge-kit 0.1.17 → 0.1.20

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 (95) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/board/daily-voice/index.js +40 -7
  3. package/dist/index.js +8428 -4448
  4. package/package.json +1 -1
  5. package/plugins/generations/image-gen/README.md +31 -31
  6. package/plugins/generations/image-gen/assets/sample/provenance.json +314 -0
  7. package/plugins/generations/image-gen/config.example.yaml +3 -0
  8. package/plugins/generations/image-gen/dist/index.js +154 -14
  9. package/plugins/generations/image-gen/presets/SOURCE.md +65 -0
  10. package/plugins/generations/image-gen/scripts/eval-style-presets.ts +513 -0
  11. package/plugins/generations/image-gen/scripts/gen-samples.ts +57 -7
  12. package/plugins/generations/image-gen/src/presets.ts +6 -5
  13. package/plugins/generations/image-gen/src/providers/h3-local.ts +196 -0
  14. package/plugins/generations/image-gen/src/providers/types.ts +11 -1
  15. package/plugins/kk/config.example.yaml +7 -2
  16. package/plugins/kk/decisions/extract/ai-news.yaml +5 -2
  17. package/plugins/kk/plugin.json +1 -1
  18. package/plugins/kk/publish-presets/chinese-article.json +8 -2
  19. package/plugins/kk/publish-presets/daily-ai-voice-migration.json +1 -1
  20. package/plugins/kk/publish-presets/daily-ai-voice.json +57 -16
  21. package/plugins/kk/publish-presets/itc-main.json +36 -9
  22. package/plugins/kk/publish-presets/technical-article.json +8 -2
  23. package/plugins/kk/schedules/kk-daily-ai-voice3.cron.tmpl +8 -9
  24. package/plugins/kk/schedules/kk-daily-publish3-cn-peak.cron.tmpl +13 -19
  25. package/plugins/kk/schedules/kk-daily-publish3-overseas.cron.tmpl +11 -9
  26. package/plugins/kk/scripts/daily-stages.ts +238 -14
  27. package/plugins/kk/scripts/daily-triage-core.ts +43 -25
  28. package/plugins/kk/scripts/daily-triage.ts +1 -1
  29. package/plugins/kk/skills/image-authoring/SKILL.md +7 -3
  30. package/plugins/kk/skills/image-authoring/references/providers.md +27 -0
  31. package/plugins/kk/skills/image-authoring/references/style-extraction.md +1 -1
  32. package/plugins/kk/skills/publish/SKILL.md +15 -2
  33. package/plugins/kk/skills/web-automation/SKILL.md +31 -1
  34. package/plugins/kk/workflows/kk-article-generate.yaml +485 -0
  35. package/plugins/kk/workflows/kk-collect.yaml +8 -4
  36. package/plugins/kk/workflows/kk-daily-ai-voice.yaml +2 -1
  37. package/plugins/kk/workflows/kk-daily-ai-voice2.yaml +4 -2
  38. package/plugins/kk/workflows/kk-daily-safety.yaml +5 -7
  39. package/plugins/kk/workflows/kk-news-generate.yaml +410 -0
  40. package/plugins/kk/workflows/kk-publish.yaml +236 -0
  41. package/plugins/publishings/bilibili-pub/dist/profile-check.js +49 -10
  42. package/plugins/publishings/cnblogs-pub/dist/profile-check.js +60 -10
  43. package/plugins/publishings/csdn-pub/dist/profile-check.js +60 -10
  44. package/plugins/publishings/infoq-pub/dist/profile-check.js +60 -10
  45. package/plugins/publishings/jike-pub/dist/profile-check.js +60 -10
  46. package/plugins/publishings/juejin-pub/dist/profile-check.js +60 -10
  47. package/plugins/publishings/linkedin-pub/dist/index.js +43 -6
  48. package/plugins/publishings/linkedin-pub/dist/profile-check.js +92 -15
  49. package/plugins/publishings/linkedin-pub/src/index.ts +52 -6
  50. package/plugins/publishings/shipinhao-pub/dist/index.js +391 -32
  51. package/plugins/publishings/shipinhao-pub/dist/profile-check.js +52 -11
  52. package/plugins/publishings/shipinhao-pub/plugin.json +1 -1
  53. package/plugins/publishings/shipinhao-pub/src/audio-flow.ts +393 -0
  54. package/plugins/publishings/shipinhao-pub/src/flow.ts +243 -14
  55. package/plugins/publishings/shipinhao-pub/src/selectors.ts +13 -0
  56. package/plugins/publishings/sspai-pub/dist/profile-check.js +60 -10
  57. package/plugins/publishings/substack-pub/dist/profile-check.js +60 -10
  58. package/plugins/publishings/surfdash-pub/dist/index.js +50 -8
  59. package/plugins/publishings/surfdash-pub/src/index.ts +59 -8
  60. package/plugins/publishings/surfdash-pub/src/topic-claims.ts +34 -3
  61. package/plugins/publishings/threads-pub/dist/index.js +9196 -296
  62. package/plugins/publishings/threads-pub/dist/profile-check.js +21139 -0
  63. package/plugins/publishings/threads-pub/package.json +3 -1
  64. package/plugins/publishings/threads-pub/plugin.json +6 -1
  65. package/plugins/publishings/threads-pub/src/index.ts +8 -1
  66. package/plugins/publishings/threads-pub/src/post-rail.ts +357 -0
  67. package/plugins/publishings/threads-pub/src/profile-check.ts +17 -0
  68. package/plugins/publishings/wechatmp-pub/dist/index.js +454 -81
  69. package/plugins/publishings/wechatmp-pub/dist/profile-check.js +401 -102
  70. package/plugins/publishings/wechatmp-pub/src/flow.ts +42 -4
  71. package/plugins/publishings/wechatmp-pub/src/index.ts +142 -102
  72. package/plugins/publishings/wechatmp-pub/src/profile-check.ts +36 -58
  73. package/plugins/publishings/weibo-pub/dist/index.js +136 -22
  74. package/plugins/publishings/weibo-pub/dist/profile-check.js +61 -11
  75. package/plugins/publishings/weibo-pub/src/index.ts +208 -22
  76. package/plugins/publishings/x-pub/dist/index.js +263 -43
  77. package/plugins/publishings/x-pub/dist/profile-check.js +63 -11
  78. package/plugins/publishings/x-pub/src/index.ts +15 -1
  79. package/plugins/publishings/x-pub/src/post-rail.ts +334 -0
  80. package/plugins/publishings/xhs-pub/dist/index.js +193 -201
  81. package/plugins/publishings/xhs-pub/dist/profile-check.js +380 -85
  82. package/plugins/publishings/xhs-pub/src/automation-guard.ts +2 -3
  83. package/plugins/publishings/xhs-pub/src/flow.ts +177 -205
  84. package/plugins/publishings/xhs-pub/src/index.ts +65 -59
  85. package/plugins/publishings/xhs-pub/src/modes.ts +1 -1
  86. package/plugins/publishings/xhs-pub/src/page.ts +2 -2
  87. package/plugins/publishings/xhs-pub/src/profile-check.ts +86 -150
  88. package/plugins/publishings/xiaoyuzhou-pub/dist/profile-check.js +60 -10
  89. package/plugins/kk/scripts/daily-scheduled-run.ts +0 -581
  90. package/plugins/kk/scripts/voice3-publish-window.ts +0 -206
  91. package/plugins/kk/workflows/kk-daily-ai-voice3.yaml +0 -903
  92. package/plugins/kk/workflows/kk-daily-publish3.yaml +0 -353
  93. package/plugins/kk/workflows/kk-itc-author.yaml +0 -484
  94. package/plugins/kk/workflows/kk-itc-publish-tail.yaml +0 -112
  95. package/plugins/kk/workflows/kk-itc.yaml +0 -291
@@ -0,0 +1,334 @@
1
+ /**
2
+ * X (Twitter) browser post rail — the `post` operation through the signed-in session.
3
+ *
4
+ * WHY this module exists (2026-11-16, operator decision): `post` shipped as the official tweets API
5
+ * only, so a `kk bot` login could never publish a promotion. The rail here drives the signed-in web
6
+ * composer, so a session is enough; the API transport stays available behind `X_POST_TRANSPORT=api`.
7
+ *
8
+ * The surface below was measured with an operator-driven headed session on 2026-11-16 (every click
9
+ * and keystroke recorded), which corrected two wrong assumptions that made earlier attempts fail:
10
+ * 1. `https://x.com/compose/post` on its own redirects to the timeline; the composer is reached by
11
+ * clicking `[data-testid="SideNav_NewTweet_Button"]` on `/home`.
12
+ * 2. The composer is the full `/compose/post` PAGE — there is no `[role="dialog"]` around it. A
13
+ * dialog-scoped lookup finds only a hidden template whose button never enables, which is exactly
14
+ * the "submit stayed disabled" timeout that hid a working publisher.
15
+ * Measured control set: editor `[data-testid="tweetTextarea_0"]` (Draft.js — needs real key events,
16
+ * `fill()` leaves Post disabled), media `button[aria-label="Add photos or video"]` then
17
+ * `input[data-testid="fileInput"]`, submit `[data-testid="tweetButton"]`.
18
+ */
19
+ import { extname, isAbsolute } from 'node:path';
20
+ import type { Result } from '@gobing-ai/kk-core';
21
+ import { ResultSchema } from '@gobing-ai/kk-core';
22
+ import { type PublishTransport, type PublishTransportPayload, trySelectors } from '@gobing-ai/publish-harness';
23
+ import {
24
+ type ChannelBrowserConfig,
25
+ checkChannelSession,
26
+ expectOutcome,
27
+ kkBrowserLauncher,
28
+ resolveChannelProfileDir,
29
+ resolveSelector,
30
+ uploadFile,
31
+ } from '@gobing-ai/publish-harness/browser';
32
+ import type { BrowserLauncher, IsAuthenticatedPredicate } from '@gobing-ai/ts-browser-automation';
33
+ import { withProfilePage } from '@gobing-ai/ts-browser-automation';
34
+ import { createNodeFileSystem, type FileSystem } from '@gobing-ai/ts-runtime';
35
+ import type { Page } from 'playwright';
36
+
37
+ const TARGET = 'x';
38
+ const LOGIN_INSTRUCTION = 'bun plugins/publishings/x-pub/src/profile-check.ts login';
39
+ const STEP_TIMEOUT_MS = 30_000;
40
+ const LOGIN_TIMEOUT_MS = 180_000;
41
+ const LOGIN_URL_RE = /\/(?:i\/flow\/login|login|account\/access)/;
42
+ const COVER_EXTS = new Set(['.png', '.jpg', '.jpeg', '.webp']);
43
+
44
+ /** Timeline that hosts the nav Post button. */
45
+ export const X_POST_URL = 'https://x.com/home';
46
+ /** The nav "Post" link that routes to the composer. */
47
+ export const X_NEW_POST_BUTTON = '[data-testid="SideNav_NewTweet_Button"]';
48
+ /** Composer page the nav button lands on. */
49
+ export const X_COMPOSE_PATH = '/compose/post';
50
+ /** Page-scoped submit (the composer is a page, not a dialog). */
51
+ export const X_POST_SUBMIT = '[data-testid="tweetButton"]';
52
+
53
+ /** Composer controls, all page-scoped (measured 2026-11-16). */
54
+ export const POST_SELECTORS = {
55
+ text: ['[data-testid="tweetTextarea_0"]'],
56
+ mediaButton: ['button[aria-label="Add photos or video"]', '[aria-label*="Add photos" i]'],
57
+ fileInput: ['input[data-testid="fileInput"]', '[data-testid="fileInput"]'],
58
+ mediaPreview: ['[data-testid="attachments"]', '[aria-label*="Media" i]'],
59
+ profileLink: ['a[data-testid="AppTabBar_Profile_Link"]'],
60
+ } as const;
61
+
62
+ /** Readiness predicate: no login redirect and the nav Post button rendered. */
63
+ export const isPostAuthenticated: IsAuthenticatedPredicate = async (page) => {
64
+ if (LOGIN_URL_RE.test(page.url())) return false;
65
+ return (await trySelectors(page, [X_NEW_POST_BUTTON], { visible: false })).found;
66
+ };
67
+
68
+ /** Session preflight config for the post rail. */
69
+ export const POST_CONFIG: ChannelBrowserConfig = {
70
+ channel: TARGET,
71
+ homeUrl: X_POST_URL,
72
+ isAuthenticated: isPostAuthenticated,
73
+ loginTimeoutMs: LOGIN_TIMEOUT_MS,
74
+ // X login-walls headless loads (same reason as the article rail): one headed pass fits kk's probe
75
+ // budget, the headless-first + headed-fallback ladder spends two deadlines and gets killed.
76
+ checkHeadedOnly: true,
77
+ };
78
+
79
+ function fail(error: string): Result {
80
+ return ResultSchema.parse({ ok: false, target: TARGET, error, effect: 'none' });
81
+ }
82
+
83
+ function needsLogin(error: unknown): boolean {
84
+ const text = error instanceof Error ? error.message : String(error);
85
+ return /login|sign in|logged out/i.test(text);
86
+ }
87
+
88
+ function errorMessage(error: unknown): string {
89
+ return error instanceof Error ? error.message : String(error);
90
+ }
91
+
92
+ /** Validates a requested cover path: absolute, existing, image extension. */
93
+ async function resolveCover(
94
+ raw: unknown,
95
+ fs: FileSystem = createNodeFileSystem(),
96
+ ): Promise<{ path: string } | { error: string } | undefined> {
97
+ if (raw === undefined) return undefined;
98
+ if (typeof raw !== 'string' || raw.trim() === '') {
99
+ return { error: `x post cover must be a non-empty local path, got '${String(raw)}'` };
100
+ }
101
+ if (!isAbsolute(raw)) return { error: `x post cover must be an absolute path, got '${raw}'` };
102
+ if (!COVER_EXTS.has(extname(raw).toLowerCase())) {
103
+ return { error: `x post cover must be .png/.jpg/.jpeg/.webp, got '${extname(raw) || '(none)'}'` };
104
+ }
105
+ // Existence via the FileSystem seam (no direct fs import); media bytes are handed to the browser.
106
+ if (!(await fs.exists(raw))) return { error: `x post cover does not exist: ${raw}` };
107
+ return { path: raw };
108
+ }
109
+
110
+ /** Browser transport for `post`. */
111
+ export class XPostBrowserTransport implements PublishTransport {
112
+ public readonly kind = 'browser';
113
+
114
+ private readonly launcher: BrowserLauncher;
115
+ private readonly stepTimeoutMs: number;
116
+
117
+ constructor(deps: { launcher?: BrowserLauncher; stepTimeoutMs?: number } = {}) {
118
+ // The harness launcher honours KK_BROWSER_CHANNEL; withProfilePage's own default is a plain
119
+ // chromium launch, and Playwright's bundled chromium-1187 dies on this machine.
120
+ this.launcher = deps.launcher ?? kkBrowserLauncher;
121
+ this.stepTimeoutMs = deps.stepTimeoutMs ?? STEP_TIMEOUT_MS;
122
+ }
123
+
124
+ public async publish(payload: PublishTransportPayload): Promise<Result> {
125
+ const requested = payload.content.metadata?.publishStatus;
126
+ if (requested === 'draft') {
127
+ return fail(
128
+ 'x post has no draft: the compose surface publishes immediately — plan this target dummy/off or launch it live',
129
+ );
130
+ }
131
+ if (requested !== undefined && requested !== 'public') {
132
+ return fail(`unknown publishStatus '${requested}' for x post: expected 'public' or absent`);
133
+ }
134
+ const text = (payload.content.body ?? payload.content.title ?? '').trim();
135
+ if (text === '') return fail('x post requires non-empty Content.body or Content.title');
136
+ const cover = await resolveCover(
137
+ payload.content.metadata?.coverPath ?? payload.options?.coverPath ?? payload.content.metadata?.coverImage,
138
+ );
139
+ if (cover !== undefined && 'error' in cover) return fail(cover.error);
140
+ const override = typeof payload.options?.profileDir === 'string' ? payload.options.profileDir : undefined;
141
+ const profileDir = resolveChannelProfileDir(POST_CONFIG.channel, override);
142
+ const session = await checkChannelSession(POST_CONFIG, {
143
+ profileDir,
144
+ launcher: this.launcher,
145
+ // X login-walls headless loads, so a headless-first ladder spends two deadlines here
146
+ // and gets killed by kk's probe budget (same as the article rail).
147
+ headedOnly: true,
148
+ timeoutMs: this.stepTimeoutMs,
149
+ });
150
+ if (session.status !== 'verified') {
151
+ return fail(`${TARGET} session preflight refused: ${session.detail} — run: ${LOGIN_INSTRUCTION}`);
152
+ }
153
+ try {
154
+ return await withProfilePage(
155
+ {
156
+ profileDir,
157
+ url: X_POST_URL,
158
+ isAuthenticated: isPostAuthenticated,
159
+ headless: payload.options?.headless === true,
160
+ launcher: this.launcher,
161
+ timeoutMs: this.stepTimeoutMs,
162
+ },
163
+ async ({ page }) =>
164
+ this.runPostFlow(
165
+ page,
166
+ text,
167
+ cover !== undefined && 'path' in cover ? cover.path : undefined,
168
+ profileDir,
169
+ ),
170
+ );
171
+ } catch (error) {
172
+ const hint = needsLogin(error) ? ` — run: ${LOGIN_INSTRUCTION}` : '';
173
+ return fail(`${errorMessage(error)}${hint}`);
174
+ }
175
+ }
176
+
177
+ /** Newest `/status/<id>` on the account's profile page (null when it carries none yet). */
178
+ private async newestStatusId(page: Page, handleHref: string): Promise<string | null> {
179
+ const target = `https://x.com${handleHref}`;
180
+ if (!page.url().startsWith(target)) {
181
+ await page.goto(target, { waitUntil: 'domcontentloaded', timeout: this.stepTimeoutMs });
182
+ } else {
183
+ await page.reload({ waitUntil: 'domcontentloaded', timeout: this.stepTimeoutMs }).catch(() => {});
184
+ }
185
+ const link = page.locator('[data-testid="tweet"] a[href*="/status/"]').first();
186
+ if ((await link.count()) === 0) return null;
187
+ const href = await link.getAttribute('href').catch(() => null);
188
+ return href === null ? null : (/\/status\/(\d+)/.exec(href)?.[1] ?? null);
189
+ }
190
+
191
+ /** Opens the composer page from /home (the direct URL redirects to the timeline). */
192
+ private async openComposer(page: Page): Promise<string | null> {
193
+ if (!page.url().includes(X_COMPOSE_PATH)) {
194
+ if (!page.url().startsWith('https://x.com/home')) {
195
+ await page.goto(X_POST_URL, { waitUntil: 'domcontentloaded', timeout: this.stepTimeoutMs });
196
+ }
197
+ const opener = await expectOutcome(
198
+ async () => ((await page.locator(X_NEW_POST_BUTTON).count()) > 0 ? 'post button rendered' : null),
199
+ { timeoutMs: this.stepTimeoutMs, label: 'x nav post button' },
200
+ );
201
+ if (!opener.ok) return `x home never rendered the Post button: ${opener.error}`;
202
+ await page.locator(X_NEW_POST_BUTTON).first().click();
203
+ }
204
+ const composer = await expectOutcome(
205
+ async () => {
206
+ if (!page.url().includes(X_COMPOSE_PATH)) return null;
207
+ return (await page.locator(POST_SELECTORS.text[0]).count()) > 0 ? 'composer open' : null;
208
+ },
209
+ { timeoutMs: this.stepTimeoutMs, label: 'x compose/post surface' },
210
+ );
211
+ return composer.ok ? null : `x composer never opened at ${X_COMPOSE_PATH}: ${composer.error}`;
212
+ }
213
+
214
+ /** Types the text and requires the Post control to enable (bounded three attempts). */
215
+ private async typeAndEnable(page: Page, text: string): Promise<string | null> {
216
+ const textBox = page.locator(POST_SELECTORS.text[0]).first();
217
+ const submit = page.locator(X_POST_SUBMIT).first();
218
+ for (let attempt = 1; attempt <= 3; attempt++) {
219
+ // X can leave a `[data-testid="mask"]` layer over the composer (it opens the compose
220
+ // surface as an overlay after an in-app navigation), which swallows pointer events. A
221
+ // forced click, and focus as the fallback, reach the editor without dismissing it.
222
+ await page.keyboard.press('Escape').catch(() => {});
223
+ await page.waitForTimeout(250);
224
+ const focused = await textBox.click({ force: true }).then(
225
+ () => true,
226
+ () =>
227
+ textBox
228
+ .focus()
229
+ .then(() => true)
230
+ .catch(() => false),
231
+ );
232
+ if (!focused) return 'x composer editor could not be focused';
233
+ await page.waitForTimeout(300);
234
+ await textBox.press('ControlOrMeta+a').catch(() => {});
235
+ await textBox.press('Backspace').catch(() => {});
236
+ await textBox.pressSequentially(text, { delay: 8 });
237
+ const enabled = await expectOutcome(
238
+ async () => ((await submit.isEnabled().catch(() => false)) ? 'post enabled' : null),
239
+ // One step, capped at 10s: a caller may shrink the step (tests), never stretch it.
240
+ { timeoutMs: Math.min(10_000, this.stepTimeoutMs), label: `x post enabled (attempt ${attempt})` },
241
+ );
242
+ if (enabled.ok) return null;
243
+ }
244
+ return 'x post submit never enabled — the editor did not accept the text in three attempts';
245
+ }
246
+
247
+ private async runPostFlow(
248
+ page: Page,
249
+ text: string,
250
+ coverPath: string | undefined,
251
+ profileDir: string,
252
+ ): Promise<Result> {
253
+ const metadata = { operation: 'post', driver: 'script', publishStatus: 'public', profileDir };
254
+ // Order matters (measured 2026-11-16): read the profile link and baseline the newest status
255
+ // FIRST, then open the composer once. Re-opening the composer after a profile visit leaves a
256
+ // mask over the editor (`[data-testid="mask"]` intercepts pointer events).
257
+ const handle = await page
258
+ .locator(POST_SELECTORS.profileLink[0])
259
+ .first()
260
+ .getAttribute('href')
261
+ .catch(() => null);
262
+ if (handle === null || handle.trim() === '') {
263
+ return fail('x post could not read the profile link, so the status id cannot be confirmed');
264
+ }
265
+ const baselineId = await this.newestStatusId(page, handle).catch(() => null);
266
+
267
+ const opened = await this.openComposer(page);
268
+ if (opened !== null) return fail(opened);
269
+
270
+ const typed = await this.typeAndEnable(page, text);
271
+ if (typed !== null) return fail(`${typed}; refusing to claim a publish`);
272
+
273
+ if (coverPath !== undefined) {
274
+ const media = await expectOutcome(
275
+ async () => {
276
+ const found = await trySelectors(page, POST_SELECTORS.mediaButton);
277
+ return found.found ? (found.selector ?? POST_SELECTORS.mediaButton[0]) : null;
278
+ },
279
+ { timeoutMs: this.stepTimeoutMs, label: 'x media button' },
280
+ );
281
+ if (!media.ok) return fail(`x media control never attached: ${media.error}`);
282
+ await page.locator(media.evidence).first().click();
283
+ const input = await resolveSelector(page, POST_SELECTORS.fileInput, {
284
+ timeoutMs: this.stepTimeoutMs,
285
+ label: 'x post media input',
286
+ });
287
+ await uploadFile(page, input, coverPath, { timeoutMs: this.stepTimeoutMs });
288
+ const attached = await expectOutcome(
289
+ async () =>
290
+ (await page.locator(POST_SELECTORS.mediaPreview[0]).count()) > 0 ? 'media attached' : null,
291
+ { timeoutMs: this.stepTimeoutMs, label: 'x post media' },
292
+ );
293
+ if (!attached.ok) return fail(`x post image was uploaded but never rendered: ${attached.error}`);
294
+ const reEnabled = await expectOutcome(
295
+ async () =>
296
+ (await page
297
+ .locator(X_POST_SUBMIT)
298
+ .first()
299
+ .isEnabled()
300
+ .catch(() => false))
301
+ ? 'post re-enabled'
302
+ : null,
303
+ // Four steps: X transcodes the image and only then re-enables Post (30s step → 120s).
304
+ { timeoutMs: this.stepTimeoutMs * 4, label: 'x post submit enabled after media' },
305
+ );
306
+ if (!reEnabled.ok) return fail(`x post submit stayed disabled after the media: ${reEnabled.error}`);
307
+ }
308
+
309
+ await page.locator(X_POST_SUBMIT).first().click();
310
+ const receipt = await expectOutcome(
311
+ async () => {
312
+ const id = await this.newestStatusId(page, handle);
313
+ if (id === null) return null;
314
+ if (baselineId !== null && id === baselineId) return null;
315
+ return `https://x.com${handle}/status/${id}`;
316
+ },
317
+ { timeoutMs: this.stepTimeoutMs, label: 'x status receipt' },
318
+ );
319
+ if (!receipt.ok) {
320
+ return fail(
321
+ `x post receipt not confirmed — Post was clicked but no new status id appeared on the profile (${receipt.error}); an unobserved submit is never reported as published`,
322
+ );
323
+ }
324
+ const id = /\/status\/(\d+)/.exec(receipt.evidence)?.[1];
325
+ return ResultSchema.parse({
326
+ ok: true,
327
+ target: TARGET,
328
+ ...(id === undefined ? {} : { id }),
329
+ url: receipt.evidence,
330
+ message: `x post published and confirmed in profile ${profileDir}`,
331
+ metadata: { ...metadata, confirmedBy: 'profile-timeline' },
332
+ });
333
+ }
334
+ }