harness-wingman 0.9.4 → 0.9.5

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.
@@ -224,7 +224,7 @@ var init_cli = __esm({
224
224
  "cli.adapterFactoryMissing": "adapter-{harness} does not export createAdapter (M1 parallel work not merged?)",
225
225
  "cli.adapterFeedbackMissing": "adapter-{harness} does not export feedbackSignals",
226
226
  "cli.fixturesUnavailable": "--fixtures requires packages/fixtures data from the repository; release packages and npx distributions do not include samples",
227
- "cli.help": "wingman \u2014 Not your copilot. Your wingman.\n\nUsage:\n wingman [--locale <tag>] <command> Interface language (e.g. zh, en)\n wingman scan --harness <cc|codex|dsh> [--json] Scan a harness and print UnifiedConfig\n wingman serve [--port 7333] [--fixtures] Start the local panel (127.0.0.1 only)\n [--panel-dist <dir>] Panel files (default: apps/panel/dist)\n wingman hook install <harness> [--port 7333] Install live hooks (backup first, idempotent)\n [--profile <p>] dsh: process only this profile\n wingman hook uninstall <harness> [--profile <p>] Remove hooks and restore configuration\n wingman protocol install|uninstall|status <harness> Manage user / project Plan protocol\n [--project <dir> | --user] [--dry-run] [--yes]\n wingman license status Show subscription status for write actions\n wingman license refresh Renew the license online\n wingman --version | -v | version Show version\n wingman help Show this help\n",
227
+ "cli.help": "wingman \u2014 Not your copilot. Your wingman.\n\nUsage:\n wingman [--locale <tag>] <command> Interface language (e.g. zh, en)\n wingman scan --harness <cc|codex|dsh> [--json] Scan a harness and print UnifiedConfig\n wingman serve [--port 7333] [--fixtures] Start the local panel (127.0.0.1 only)\n [--panel-dist <dir>] Panel files (default: apps/panel/dist)\n wingman hook install <harness> [--port 7333] Install live hooks (backup first, idempotent)\n [--profile <p>] dsh: process only this profile\n wingman hook uninstall <harness> [--profile <p>] Remove hooks and restore configuration\n wingman protocol install|uninstall|status <harness> Manage user / project Plan protocol\n [--project <dir> | --user] [--dry-run] [--yes]\n wingman license status Show license status\n wingman license refresh Renew the license online\n wingman --version | -v | version Show version\n wingman help Show this help\n",
228
228
  "cli.licenseUsage": "License usage: wingman license status|refresh",
229
229
  "cli.unknownCommand": "Unknown command: {command}",
230
230
  "cli.scanNotDetected": "wingman: {harness} was not detected; nothing to scan.\n",
@@ -278,19 +278,19 @@ var init_cli = __esm({
278
278
  "cli.protocolFixtures": "protocol does not support --fixtures",
279
279
  "cli.protocolTruncation": "Warning: Codex may truncate this block; AGENTS.md is near or above the default 32 KiB project_doc_max_bytes after installation.\n",
280
280
  "cli.confirmWrite": "Confirm write? [y/N] ",
281
- "cli.licenseMissing": "No license installed (anatomy and live views are free; write actions require a subscription)",
282
- "cli.licenseDevelopment": "Development build: no embedded public key; write actions are unlocked",
281
+ "cli.licenseMissing": "No license installed; the free tier shows one tool. A trial or subscription unlocks all three tools, the project overview and config toggles.",
282
+ "cli.licenseDevelopment": "Development build: no embedded public key; all features are available",
283
283
  "cli.licenseJson": "The license file is not valid JSON",
284
284
  "cli.licenseFields": "The license file is missing token/signature fields",
285
285
  "cli.licenseSignature": "License signature verification failed (modified content or issued for another product)",
286
286
  "cli.licenseClaimsFields": "License payload fields are incomplete",
287
287
  "cli.licenseClaimsDecode": "The license payload could not be decoded",
288
288
  "cli.licenseValidUntil": "{plan} valid until {exp}",
289
- "cli.trialExpired": "Your trial expired on {exp}; write actions are locked. Subscribe, then select Refresh license in the panel to restore access",
289
+ "cli.trialExpired": "Your trial expired on {exp}; the free tier shows one tool. A trial or subscription unlocks all three tools, the project overview and config toggles.",
290
290
  "cli.licenseGrace": "Your subscription expired on {exp} and is within the {days}-day offline grace period (connect to renew)",
291
- "cli.subscriptionExpired": "Your subscription expired on {exp} and its grace period has ended; write actions are locked",
291
+ "cli.subscriptionExpired": "Your subscription expired on {exp} and its grace period has ended; the free tier shows one tool. A trial or subscription unlocks all three tools, the project overview and config toggles.",
292
292
  "cli.licenseWriteFailed": "Could not write {path}: {message}",
293
- "cli.refreshMissing": "Could not find {path}. Subscribe, then download license.json from the activation page after payment and save it there",
293
+ "cli.refreshMissing": "Could not find {path}. Import a trial or subscription license.json first.",
294
294
  "cli.refreshNetwork": "Could not connect. Try again later; your current license is unchanged",
295
295
  "cli.refreshHttp": "The license server returned HTTP {status}",
296
296
  "cli.refreshRejected": "Renewal rejected: {detail}",
@@ -553,6 +553,7 @@ var init_panel = __esm({
553
553
  "panel.live.disconnectedReconnectingAutomatically": "Disconnected \xB7 Reconnecting automatically",
554
554
  "panel.live.connecting": "Connecting\u2026",
555
555
  "panel.taskboard.waitingForYou": "Waiting for you",
556
+ "panel.taskboard.turnEnded": "Turn ended",
556
557
  "panel.taskboard.ended": "Ended",
557
558
  "panel.taskboard.inProgress": "In progress",
558
559
  "panel.taskboard.dshHasNoObservedCommandTo": "dsh has no observed command to resume a specific session; continue in the original terminal",
@@ -622,6 +623,10 @@ var init_render = __esm({
622
623
  "panel.render.originCli": "Codex CLI",
623
624
  "panel.render.originDesktop": "Codex Desktop",
624
625
  "panel.render.originSource": "Source: session_meta.originator / source",
626
+ "panel.render.chipNoInstruction": "No instruction yet \xB7 {p0}",
627
+ "panel.render.chipDirectory": "Directory: {p0}",
628
+ "panel.render.chipTitleSource": "Title source: {p0}",
629
+ "panel.render.chipTurnEnded": "Turn ended (no events or transcript activity since Stop)",
625
630
  "panel.render.projectsPageTitle": "Project overview",
626
631
  "panel.render.projectsPageHint": "Goals, progress and decisions across your coding apps.",
627
632
  "panel.render.controlsPageHint": "Manage tools, preferences and how you return to a session.",
@@ -822,17 +827,21 @@ var init_render = __esm({
822
827
  "panel.render.commonCausesFilesChangedAfterPlanning": "Common causes: files changed after planning (close and reopen the toggle to plan again), itemId is missing, or the target format is unknown and cannot be safely written.",
823
828
  "panel.render.closeDialog": "Close dialog",
824
829
  "panel.render.dayFreeTrialUntil": "30-day free trial until {p0}",
830
+ "panel.render.dayFreeTrialEnding": "30-day free trial until {p0} \xB7 then the free tier (one tool)",
831
+ "panel.render.freeTierOneHarness": "The free tier shows one tool",
832
+ "panel.render.freeTierHarness": "Free tier tool",
833
+ "panel.render.freeTierLock": "The free tier shows one tool; a trial or subscription shows them all.",
825
834
  "panel.render.dayFreeTrialActive": "30-day free trial active",
826
- "panel.render.freeTrialEndedRefreshOrSubscribe": "Free trial ended \xB7 refresh or subscribe",
835
+ "panel.render.freeTrialEndedRefreshOrSubscribe": "Free trial ended \xB7 the free tier shows one tool \xB7 refresh or subscribe",
827
836
  "panel.render.subscriptionExpiredInGracePeriodRenew": "Subscription expired, in grace period \xB7 renew",
828
- "panel.render.subscriptionExpiredWriteActionsLocked": "Subscription expired; write actions locked",
837
+ "panel.render.subscriptionExpiredFreeTier": "Subscription expired \xB7 the free tier shows one tool \xB7 refresh or subscribe",
829
838
  "panel.render.importLicenseJsonFromTheActivation": "Import license.json from the activation page (writes ~/.wingman/license.json and backs up the old file), or drag the file into this panel",
830
839
  "panel.render.importLicense": "Import license",
831
840
  "panel.render.cancelSubscriptionsOrChangePaymentMethods": "Cancel subscriptions or change payment methods through Stripe using the links in emails sent to your subscription address.",
832
841
  "panel.render.manageSubscriptionCancelPaymentMethodInvoices": "Manage subscription (cancel / payment method / invoices)",
833
842
  "panel.render.refreshLicense": "Refresh license",
834
843
  "panel.render.afterPaymentOrWhileYourSubscription": "After payment, or while your subscription is active, refresh to restore the latest status. Only this button contacts the license service.",
835
- "panel.render.keepUsingWriteFeatures": "Keep using write features",
844
+ "panel.render.keepUsingWriteFeatures": "Unlock all three tools, the project overview and config toggles",
836
845
  "panel.render.subscribeToWingman": "Subscribe to Wingman",
837
846
  "panel.render.refreshing": "Refreshing\u2026",
838
847
  "panel.render.freeTrial": "Free trial",
@@ -882,11 +891,12 @@ var init_render = __esm({
882
891
  "panel.render.endedSessionEndOrNoEventsFor": "Ended (SessionEnd, or no events for 10 minutes after Stop)",
883
892
  "panel.render.inProgress": "In progress",
884
893
  "panel.render.waitingForYouAnOpenPermission": "Waiting for you: an open permission request or notification",
894
+ "panel.render.discoveredOnStartup": "Registered by the startup scan; no hook events yet",
885
895
  "panel.render.newActivitySinceLastViewed": "New activity since last viewed",
886
- "panel.render.newActivity": "New activity",
887
896
  "panel.render.sinceWingmanStarted": "Since Wingman started (",
888
897
  "panel.render.noHookEventsReceivedFrom": "), no hook events received from",
889
- "panel.render.sessionsAreCreatedFromEventsOnly": "; sessions are created from events only, and history is not restored after restart.",
898
+ "panel.render.sessionsAreCreatedFromEventsOnly": "; startup only registers session transcripts updated in the last 30 minutes; older sessions are not restored.",
899
+ "panel.render.sessionsAreCreatedFromEventsOnlyDsh": "; sessions are created from events only, and history is not restored after restart.",
890
900
  "panel.render.legacyHomeLevelWiringCouldNot": "Legacy home-level wiring could not be removed automatically; disconnect manually, then reconnect: ",
891
901
  "panel.render.legacyHomeLevelWiringAndEarlier": "Legacy home-level wiring (0.6.0 and earlier) was removed to prevent dsh startup failures; reconnect: ",
892
902
  "panel.render.evicted": "Evicted",
@@ -1212,6 +1222,7 @@ var init_render = __esm({
1212
1222
  "panel.render.sourceRevisionMtimeLastWriter": "Source: revision / mtime / lastWriter",
1213
1223
  "panel.render.all": "All",
1214
1224
  "panel.render.waitingForYouLabel": "Waiting for you",
1225
+ "panel.render.turnEnded": "Turn ended",
1215
1226
  "panel.render.ended": "Ended",
1216
1227
  "panel.render.status": "Status",
1217
1228
  "panel.render.dataTipSourceGETApiProjects": ' data-tip="Source: GET /api/projects request and payload validation"',
@@ -1245,7 +1256,7 @@ var init_server = __esm({
1245
1256
  "cli.server.harnessRequired": "harness must be {ids}, received {harness}",
1246
1257
  "cli.server.actionShape": 'action must have the shape {kind:"toggle", itemId, enable}',
1247
1258
  "cli.server.fixturesAction": "Fixtures mode is read-only: actions stop at the plan and no files are written",
1248
- "cli.server.subscriptionRequired": "An active subscription is required to write changes (anatomy and live activity are always free)",
1259
+ "cli.server.subscriptionRequired": "A trial or active subscription is required to write configuration changes (the free tier shows one tool).",
1249
1260
  "cli.server.planShape": "plan must be an ActionPlan object (returned by /api/action/plan)",
1250
1261
  "cli.server.fixturesProtocol": "Fixtures mode is read-only: no preview or writing of the user-level protocol",
1251
1262
  "cli.server.dshUserUnsupported": "unsupported: dsh has no user-level instruction file; install the plan protocol per project",
@@ -1267,7 +1278,8 @@ var init_server = __esm({
1267
1278
  "cli.server.settingsFormat": "Cannot parse return settings or unknown version; refusing to overwrite. Check settings.json",
1268
1279
  "cli.server.settingsWrite": "Could not back up or write return settings; settings were not overwritten. Check settings.json",
1269
1280
  "cli.server.localeInvalid": "locale must be a registered language tag",
1270
- "cli.server.settingsInvalid": "Settings require a registered locale or a valid island position and size",
1281
+ "cli.server.settingsInvalid": "Settings require a registered locale, a valid island position and size, or a known freeHarness",
1282
+ "cli.server.freeHarnessNotDetected": "This tool has not been detected and cannot be selected for the free tier.",
1271
1283
  "cli.server.fixturesSettings": "Fixtures mode is read-only: language settings are not saved",
1272
1284
  "cli.server.settingsHome": "Language settings require homeDir"
1273
1285
  };
@@ -1499,7 +1511,7 @@ var init_cli2 = __esm({
1499
1511
  "cli.adapterFactoryMissing": "adapter-{harness} \u5C1A\u672A\u5BFC\u51FA createAdapter(M1 \u5E76\u884C\u7EBF\u672A\u5408\u5E76?)",
1500
1512
  "cli.adapterFeedbackMissing": "adapter-{harness} \u5C1A\u672A\u5BFC\u51FA feedbackSignals",
1501
1513
  "cli.fixturesUnavailable": "--fixtures \u9700\u8981\u4ED3\u5E93\u5185\u7684 packages/fixtures \u6570\u636E;\u53D1\u5E03\u5B89\u88C5\u5305/npx \u4EA7\u7269\u4E0D\u5305\u542B\u6837\u4F8B",
1502
- "cli.help": "wingman \u2014 Not your copilot. Your wingman.\n\n\u7528\u6CD5:\n wingman [--locale <tag>] <command> \u754C\u9762\u8BED\u8A00(\u5982 zh\u3001en)\n wingman scan --harness <cc|codex|dsh> [--json] \u626B\u63CF\u4E00\u4E2A harness,\u8F93\u51FA UnifiedConfig\n wingman serve [--port 7333] [--fixtures] \u542F\u52A8\u672C\u5730\u9762\u677F(\u53EA\u7ED1 127.0.0.1)\n [--panel-dist <dir>] \u9762\u677F\u9759\u6001\u4EA7\u7269\u76EE\u5F55(\u9ED8\u8BA4\u4ED3\u5E93\u5E03\u5C40 apps/panel/dist)\n wingman hook install <harness> [--port 7333] \u5B9E\u51B5\u63A5\u7EBF(\u5199\u524D\u5907\u4EFD,\u5E42\u7B49)\n [--profile <p>] dsh:\u53EA\u5904\u7406\u6307\u5B9A profile\n wingman hook uninstall <harness> [--profile <p>] \u89E3\u7EBF(\u914D\u7F6E\u6062\u590D,\u5E42\u7B49)\n wingman protocol install|uninstall|status <harness> \u7BA1\u7406\u7528\u6237\u7EA7 / \u9879\u76EE\u7EA7 Plan Protocol\n [--project <dir> | --user] [--dry-run] [--yes]\n wingman license status \u67E5\u770B\u8BA2\u9605\u72B6\u6001(\u5199\u52A8\u4F5C\u7684\u95F8)\n wingman license refresh \u8054\u7F51\u5411\u7B7E\u53D1\u7AEF\u6362\u65B0 license(\u7EED\u671F)\n wingman --version | -v | version \u663E\u793A\u7248\u672C\n wingman help \u663E\u793A\u672C\u5E2E\u52A9\n",
1514
+ "cli.help": "wingman \u2014 Not your copilot. Your wingman.\n\n\u7528\u6CD5:\n wingman [--locale <tag>] <command> \u754C\u9762\u8BED\u8A00(\u5982 zh\u3001en)\n wingman scan --harness <cc|codex|dsh> [--json] \u626B\u63CF\u4E00\u4E2A harness,\u8F93\u51FA UnifiedConfig\n wingman serve [--port 7333] [--fixtures] \u542F\u52A8\u672C\u5730\u9762\u677F(\u53EA\u7ED1 127.0.0.1)\n [--panel-dist <dir>] \u9762\u677F\u9759\u6001\u4EA7\u7269\u76EE\u5F55(\u9ED8\u8BA4\u4ED3\u5E93\u5E03\u5C40 apps/panel/dist)\n wingman hook install <harness> [--port 7333] \u5B9E\u51B5\u63A5\u7EBF(\u5199\u524D\u5907\u4EFD,\u5E42\u7B49)\n [--profile <p>] dsh:\u53EA\u5904\u7406\u6307\u5B9A profile\n wingman hook uninstall <harness> [--profile <p>] \u89E3\u7EBF(\u914D\u7F6E\u6062\u590D,\u5E42\u7B49)\n wingman protocol install|uninstall|status <harness> \u7BA1\u7406\u7528\u6237\u7EA7 / \u9879\u76EE\u7EA7 Plan Protocol\n [--project <dir> | --user] [--dry-run] [--yes]\n wingman license status \u67E5\u770B\u6388\u6743\u72B6\u6001\n wingman license refresh \u8054\u7F51\u5411\u7B7E\u53D1\u7AEF\u6362\u65B0 license(\u7EED\u671F)\n wingman --version | -v | version \u663E\u793A\u7248\u672C\n wingman help \u663E\u793A\u672C\u5E2E\u52A9\n",
1503
1515
  "cli.licenseUsage": "license \u7528\u6CD5:wingman license status|refresh",
1504
1516
  "cli.unknownCommand": "\u672A\u77E5\u547D\u4EE4:{command}",
1505
1517
  "cli.scanNotDetected": "wingman:\u672A\u68C0\u6D4B\u5230 {harness},\u65E0\u4ECE\u626B\u63CF\u3002\n",
@@ -1553,19 +1565,19 @@ var init_cli2 = __esm({
1553
1565
  "cli.protocolFixtures": "protocol \u4E0D\u652F\u6301 --fixtures",
1554
1566
  "cli.protocolTruncation": "\u8B66\u544A:Codex \u53EF\u80FD\u622A\u65AD\u672C\u5757\uFF1BAGENTS.md \u88C5\u540E\u5DF2\u63A5\u8FD1\u6216\u8D85\u8FC7\u9ED8\u8BA4 32 KiB project_doc_max_bytes\u3002\n",
1555
1567
  "cli.confirmWrite": "\u786E\u8BA4\u5199\u5165? [y/N] ",
1556
- "cli.licenseMissing": "\u672A\u5B89\u88C5 license(anatomy \u4E0E\u5B9E\u51B5\u514D\u8D39\u53EF\u7528;\u5199\u52A8\u4F5C\u9700\u8BA2\u9605)",
1557
- "cli.licenseDevelopment": "\u5F00\u53D1\u6784\u5EFA:\u672A\u5D4C\u5165\u516C\u94A5,\u5199\u52A8\u4F5C\u4E0D\u52A0\u9501",
1568
+ "cli.licenseMissing": "\u672A\u5B89\u88C5 license\uFF1B\u514D\u8D39\u5C42\u53EA\u663E\u793A\u4E00\u4E2A\u5DE5\u5177\u3002\u8BD5\u7528\u6216\u8BA2\u9605\u53EF\u67E5\u770B\u5168\u90E8\u5DE5\u5177\u4E0E\u9879\u76EE\u603B\u89C8\uFF0C\u5E76\u4F7F\u7528\u914D\u7F6E\u5F00\u5173\u3002",
1569
+ "cli.licenseDevelopment": "\u5F00\u53D1\u6784\u5EFA:\u672A\u5D4C\u5165\u516C\u94A5,\u5168\u90E8\u529F\u80FD\u53EF\u7528",
1558
1570
  "cli.licenseJson": "license \u6587\u4EF6\u4E0D\u662F\u5408\u6CD5 JSON",
1559
1571
  "cli.licenseFields": "license \u6587\u4EF6\u7F3A token/signature \u5B57\u6BB5",
1560
1572
  "cli.licenseSignature": "license \u9A8C\u7B7E\u5931\u8D25(\u5185\u5BB9\u88AB\u6539\u52A8\u6216\u975E\u672C\u4EA7\u54C1\u7B7E\u53D1)",
1561
1573
  "cli.licenseClaimsFields": "license \u8F7D\u8377\u5B57\u6BB5\u4E0D\u5B8C\u6574",
1562
1574
  "cli.licenseClaimsDecode": "license \u8F7D\u8377\u65E0\u6CD5\u89E3\u7801",
1563
1575
  "cli.licenseValidUntil": "{plan}\u6709\u6548\u81F3 {exp}",
1564
- "cli.trialExpired": "\u8BD5\u7528\u5DF2\u4E8E {exp} \u5230\u671F,\u5199\u52A8\u4F5C\u5DF2\u9501;\u8BA2\u9605\u540E\u5728\u9762\u677F\u70B9\u300C\u5237\u65B0\u6388\u6743\u300D\u5373\u53EF\u6062\u590D",
1576
+ "cli.trialExpired": "\u8BD5\u7528\u5DF2\u4E8E {exp} \u5230\u671F\uFF1B\u514D\u8D39\u5C42\u53EA\u663E\u793A\u4E00\u4E2A\u5DE5\u5177\u3002\u8BD5\u7528\u6216\u8BA2\u9605\u53EF\u67E5\u770B\u5168\u90E8\u5DE5\u5177\u4E0E\u9879\u76EE\u603B\u89C8\uFF0C\u5E76\u4F7F\u7528\u914D\u7F6E\u5F00\u5173\u3002",
1565
1577
  "cli.licenseGrace": "\u8BA2\u9605\u5DF2\u4E8E {exp} \u5230\u671F,\u5904\u4E8E {days} \u5929\u79BB\u7EBF\u5BBD\u9650\u671F(\u8BF7\u8054\u7F51\u7EED\u671F)",
1566
- "cli.subscriptionExpired": "\u8BA2\u9605\u5DF2\u4E8E {exp} \u5230\u671F\u4E14\u8D85\u51FA\u5BBD\u9650\u671F,\u5199\u52A8\u4F5C\u5DF2\u9501",
1578
+ "cli.subscriptionExpired": "\u8BA2\u9605\u5DF2\u4E8E {exp} \u5230\u671F\u4E14\u8D85\u51FA\u5BBD\u9650\u671F\uFF1B\u514D\u8D39\u5C42\u53EA\u663E\u793A\u4E00\u4E2A\u5DE5\u5177\u3002\u8BD5\u7528\u6216\u8BA2\u9605\u53EF\u67E5\u770B\u5168\u90E8\u5DE5\u5177\u4E0E\u9879\u76EE\u603B\u89C8\uFF0C\u5E76\u4F7F\u7528\u914D\u7F6E\u5F00\u5173\u3002",
1567
1579
  "cli.licenseWriteFailed": "\u5199\u5165 {path} \u5931\u8D25:{message}",
1568
- "cli.refreshMissing": "\u672A\u627E\u5230 {path}\u2014\u2014\u5148\u8BA2\u9605,\u4ECE\u4ED8\u6B3E\u540E\u7684\u6FC0\u6D3B\u9875\u4E0B\u8F7D license.json \u653E\u8FDB\u53BB",
1580
+ "cli.refreshMissing": "\u672A\u627E\u5230 {path}\uFF1B\u8BF7\u5148\u5BFC\u5165\u8BD5\u7528\u6216\u8BA2\u9605\u7684 license.json\u3002",
1569
1581
  "cli.refreshNetwork": "\u8054\u7F51\u5931\u8D25,\u7A0D\u540E\u518D\u8BD5;\u5F53\u524D\u6388\u6743\u72B6\u6001\u4FDD\u6301\u4E0D\u53D8",
1570
1582
  "cli.refreshHttp": "\u7B7E\u53D1\u7AEF\u8FD4\u56DE HTTP {status}",
1571
1583
  "cli.refreshRejected": "\u7EED\u671F\u88AB\u62D2:{detail}",
@@ -1828,6 +1840,7 @@ var init_panel2 = __esm({
1828
1840
  "panel.live.disconnectedReconnectingAutomatically": "\u8FDE\u63A5\u65AD\u5F00 \xB7 \u81EA\u52A8\u91CD\u8FDE\u4E2D",
1829
1841
  "panel.live.connecting": "\u8FDE\u63A5\u4E2D\u2026",
1830
1842
  "panel.taskboard.waitingForYou": "\u7B49\u5F85",
1843
+ "panel.taskboard.turnEnded": "\u56DE\u5408\u7ED3\u675F",
1831
1844
  "panel.taskboard.ended": "\u5DF2\u7ED3\u675F",
1832
1845
  "panel.taskboard.inProgress": "\u8FDB\u884C\u4E2D",
1833
1846
  "panel.taskboard.dshHasNoObservedCommandTo": "dsh \u672A\u63D0\u4F9B\u6309\u4F1A\u8BDD\u6062\u590D\u7684\u547D\u4EE4(\u672A\u89C2\u5BDF\u5230),\u8BF7\u5728\u539F\u7EC8\u7AEF\u7EE7\u7EED",
@@ -1897,6 +1910,10 @@ var init_render2 = __esm({
1897
1910
  "panel.render.originCli": "Codex CLI",
1898
1911
  "panel.render.originDesktop": "Codex \u684C\u9762\u7248",
1899
1912
  "panel.render.originSource": "\u6765\u6E90:session_meta.originator / source",
1913
+ "panel.render.chipNoInstruction": "\u5C1A\u65E0\u6307\u4EE4 \xB7 {p0}",
1914
+ "panel.render.chipDirectory": "\u76EE\u5F55:{p0}",
1915
+ "panel.render.chipTitleSource": "\u6807\u9898\u6765\u6E90:{p0}",
1916
+ "panel.render.chipTurnEnded": "\u56DE\u5408\u7ED3\u675F(Stop \u540E\u65E0\u65B0\u4E8B\u4EF6\u6216\u8BB0\u5F55\u6D3B\u52A8)",
1900
1917
  "panel.render.projectsPageTitle": "\u9879\u76EE\u603B\u89C8",
1901
1918
  "panel.render.projectsPageHint": "\u96C6\u4E2D\u67E5\u770B\u5404\u4E2A\u7F16\u7A0B\u5DE5\u5177\u4E2D\u7684\u76EE\u6807\u3001\u8FDB\u5EA6\u548C\u5F85\u51B3\u4E8B\u9879\u3002",
1902
1919
  "panel.render.controlsPageHint": "\u7BA1\u7406\u5DE5\u5177\u3001\u504F\u597D\u8BBE\u7F6E\uFF0C\u4EE5\u53CA\u8FD4\u56DE\u4F1A\u8BDD\u7684\u65B9\u5F0F\u3002",
@@ -2097,17 +2114,21 @@ var init_render2 = __esm({
2097
2114
  "panel.render.commonCausesFilesChangedAfterPlanning": "\u5E38\u89C1\u539F\u56E0:\u6587\u4EF6\u5728 plan \u4E4B\u540E\u88AB\u5916\u90E8\u6539\u8FC7(\u5173\u95ED\u540E\u91CD\u65B0\u70B9\u5F00\u5173\u751F\u6210\u65B0 plan)\u3001itemId \u4E0D\u5B58\u5728\u3001\u6216\u76EE\u6807\u683C\u5F0F\u672A\u77E5\u88AB\u62D2\u5199(\u4E0D\u731C,\u5982\u5B9E\u62D2\u7EDD)\u3002",
2098
2115
  "panel.render.closeDialog": "\u5173\u95ED\u5F39\u7A97",
2099
2116
  "panel.render.dayFreeTrialUntil": "30 \u5929\u514D\u8D39\u8BD5\u7528\u81F3 {p0}",
2117
+ "panel.render.dayFreeTrialEnding": "30 \u5929\u514D\u8D39\u8BD5\u7528\u81F3 {p0} \xB7 \u5230\u671F\u540E\u8F6C\u4E3A\u514D\u8D39\u5C42(\u4E00\u4E2A\u5DE5\u5177)",
2118
+ "panel.render.freeTierOneHarness": "\u514D\u8D39\u5C42\u53EA\u663E\u793A\u4E00\u4E2A\u5DE5\u5177",
2119
+ "panel.render.freeTierHarness": "\u514D\u8D39\u5C42\u5DE5\u5177",
2120
+ "panel.render.freeTierLock": "\u514D\u8D39\u5C42\u53EA\u663E\u793A\u4E00\u4E2A\u5DE5\u5177;\u8BD5\u7528\u6216\u8BA2\u9605\u53EF\u770B\u5168\u90E8\u3002",
2100
2121
  "panel.render.dayFreeTrialActive": "30 \u5929\u514D\u8D39\u8BD5\u7528\u4E2D",
2101
- "panel.render.freeTrialEndedRefreshOrSubscribe": "\u514D\u8D39\u8BD5\u7528\u5DF2\u7ED3\u675F \xB7 \u5237\u65B0\u6216\u8BA2\u9605",
2122
+ "panel.render.freeTrialEndedRefreshOrSubscribe": "\u514D\u8D39\u8BD5\u7528\u5DF2\u7ED3\u675F \xB7 \u514D\u8D39\u5C42\u53EA\u663E\u793A\u4E00\u4E2A\u5DE5\u5177 \xB7 \u5237\u65B0\u6216\u8BA2\u9605",
2102
2123
  "panel.render.subscriptionExpiredInGracePeriodRenew": "\u8BA2\u9605\u5DF2\u5230\u671F,\u5BBD\u9650\u671F\u5185 \xB7 \u70B9\u6B64\u7EED\u671F",
2103
- "panel.render.subscriptionExpiredWriteActionsLocked": "\u8BA2\u9605\u5DF2\u5230\u671F,\u5199\u52A8\u4F5C\u5DF2\u9501",
2124
+ "panel.render.subscriptionExpiredFreeTier": "\u8BA2\u9605\u5DF2\u5230\u671F \xB7 \u514D\u8D39\u5C42\u53EA\u663E\u793A\u4E00\u4E2A\u5DE5\u5177 \xB7 \u5237\u65B0\u6216\u8BA2\u9605",
2104
2125
  "panel.render.importLicenseJsonFromTheActivation": "\u9009\u62E9\u6FC0\u6D3B\u9875\u4E0B\u8F7D\u7684 license.json \u5BFC\u5165(\u5199\u5165 ~/.wingman/license.json,\u65E7\u6587\u4EF6\u81EA\u52A8\u5907\u4EFD);\u4E5F\u53EF\u628A\u6587\u4EF6\u76F4\u63A5\u62D6\u8FDB\u672C\u9762\u677F",
2105
2126
  "panel.render.importLicense": "\u5BFC\u5165 license",
2106
2127
  "panel.render.cancelSubscriptionsOrChangePaymentMethods": "\u53D6\u6D88\u8BA2\u9605\u6216\u66F4\u6362\u4ED8\u6B3E\u65B9\u5F0F\u9700\u5728 Stripe \u4FA7\u64CD\u4F5C,\u5165\u53E3\u5728\u8BA2\u9605\u90AE\u7BB1\u6536\u5230\u7684 Stripe \u90AE\u4EF6\u91CC\u3002",
2107
2128
  "panel.render.manageSubscriptionCancelPaymentMethodInvoices": "\u7BA1\u7406\u8BA2\u9605(\u53D6\u6D88/\u6362\u5361/\u53D1\u7968)",
2108
2129
  "panel.render.refreshLicense": "\u5237\u65B0\u6388\u6743",
2109
2130
  "panel.render.afterPaymentOrWhileYourSubscription": "\u4ED8\u6B3E\u6210\u529F\u6216\u8BA2\u9605\u4ECD\u6709\u6548\u65F6,\u70B9\u51FB\u5237\u65B0\u5373\u53EF\u6062\u590D\u6700\u65B0\u72B6\u6001\u3002\u4EC5\u6B64\u6309\u94AE\u4F1A\u8054\u7CFB\u6388\u6743\u670D\u52A1\u3002",
2110
- "panel.render.keepUsingWriteFeatures": "\u7EE7\u7EED\u4F7F\u7528\u5199\u529F\u80FD",
2131
+ "panel.render.keepUsingWriteFeatures": "\u89E3\u9501\u4E09\u5BB6\u5DE5\u5177\u3001\u9879\u76EE\u603B\u89C8\u4E0E\u914D\u7F6E\u5F00\u5173",
2111
2132
  "panel.render.subscribeToWingman": "\u8BA2\u9605 Wingman",
2112
2133
  "panel.render.refreshing": "\u5237\u65B0\u4E2D\u2026",
2113
2134
  "panel.render.freeTrial": "\u514D\u8D39\u8BD5\u7528",
@@ -2157,11 +2178,12 @@ var init_render2 = __esm({
2157
2178
  "panel.render.endedSessionEndOrNoEventsFor": "\u5DF2\u7ED3\u675F(SessionEnd,\u6216 Stop \u540E 10 \u5206\u949F\u65E0\u4E8B\u4EF6)",
2158
2179
  "panel.render.inProgress": "\u8FDB\u884C\u4E2D",
2159
2180
  "panel.render.waitingForYouAnOpenPermission": "\u7B49\u5F85:\u6709\u672A\u51B3\u7684\u6743\u9650\u8BF7\u6C42/\u901A\u77E5",
2181
+ "panel.render.discoveredOnStartup": "\u7531\u542F\u52A8\u626B\u63CF\u767B\u8BB0,\u5C1A\u65E0 hook \u4E8B\u4EF6",
2160
2182
  "panel.render.newActivitySinceLastViewed": "\u6709\u65B0\u6D3B\u52A8(\u4E0A\u6B21\u67E5\u770B\u540E)",
2161
- "panel.render.newActivity": "\u65B0\u6D3B\u52A8",
2162
2183
  "panel.render.sinceWingmanStarted": "Wingman \u542F\u52A8(",
2163
2184
  "panel.render.noHookEventsReceivedFrom": ")\u540E\u5C1A\u672A\u6536\u5230",
2164
- "panel.render.sessionsAreCreatedFromEventsOnly": "\u7684 hook \u4E8B\u4EF6;\u4F1A\u8BDD\u53EA\u7531\u4E8B\u4EF6\u5EFA\u7ACB,\u91CD\u542F\u4E0D\u6062\u590D\u5386\u53F2\u3002",
2185
+ "panel.render.sessionsAreCreatedFromEventsOnly": "\u7684 hook \u4E8B\u4EF6;\u542F\u52A8\u65F6\u53EA\u767B\u8BB0\u6700\u8FD1 30 \u5206\u949F\u5185\u6709\u66F4\u65B0\u7684\u4F1A\u8BDD\u8BB0\u5F55,\u66F4\u65E9\u7684\u4E0D\u6062\u590D\u3002",
2186
+ "panel.render.sessionsAreCreatedFromEventsOnlyDsh": "\u7684 hook \u4E8B\u4EF6;\u4F1A\u8BDD\u53EA\u7531\u4E8B\u4EF6\u5EFA\u7ACB,\u91CD\u542F\u4E0D\u6062\u590D\u5386\u53F2\u3002",
2165
2187
  "panel.render.legacyHomeLevelWiringCouldNot": "\u65E7\u7248\u5BB6\u76EE\u5F55\u5C42\u63A5\u7EBF\u65E0\u6CD5\u81EA\u52A8\u89E3\u9664,\u8BF7\u624B\u52A8\u89E3\u7EBF\u540E\u91CD\u65B0\u63A5\u7EBF:",
2166
2188
  "panel.render.legacyHomeLevelWiringAndEarlier": "\u65E7\u7248(0.6.0 \u53CA\u66F4\u65E9)\u5BB6\u76EE\u5F55\u5C42\u63A5\u7EBF\u5DF2\u89E3\u9664,\u907F\u514D dsh \u65E0\u6CD5\u542F\u52A8;\u91CD\u65B0\u63A5\u7EBF:",
2167
2189
  "panel.render.evicted": "\u5DF2\u9A71\u9010",
@@ -2487,6 +2509,7 @@ var init_render2 = __esm({
2487
2509
  "panel.render.sourceRevisionMtimeLastWriter": "\u6765\u6E90:revision / mtime / lastWriter",
2488
2510
  "panel.render.all": "\u5168\u90E8",
2489
2511
  "panel.render.waitingForYouLabel": "\u7B49\u5F85",
2512
+ "panel.render.turnEnded": "\u56DE\u5408\u7ED3\u675F",
2490
2513
  "panel.render.ended": "\u5DF2\u7ED3\u675F",
2491
2514
  "panel.render.status": "\u72B6\u6001",
2492
2515
  "panel.render.dataTipSourceGETApiProjects": ' data-tip="\u6765\u6E90:GET /api/projects \u8BF7\u6C42\u4E0E\u8F7D\u8377\u6821\u9A8C"',
@@ -2520,7 +2543,7 @@ var init_server2 = __esm({
2520
2543
  "cli.server.harnessRequired": "harness \u9700\u8981 {ids},\u5F97\u5230 {harness}",
2521
2544
  "cli.server.actionShape": 'action \u9700\u8981 {kind:"toggle", itemId, enable} \u5F62\u72B6',
2522
2545
  "cli.server.fixturesAction": "fixtures \u6A21\u5F0F\u53EA\u8BFB:\u52A8\u4F5C\u53EA\u5230 plan \u4E3A\u6B62,\u4E0D\u5199\u4EFB\u4F55\u6587\u4EF6",
2523
- "cli.server.subscriptionRequired": "\u9700\u8981\u6709\u6548\u8BA2\u9605\u624D\u80FD\u6267\u884C\u5199\u52A8\u4F5C(anatomy \u4E0E\u5B9E\u51B5\u6C38\u4E45\u514D\u8D39)",
2546
+ "cli.server.subscriptionRequired": "\u9700\u8981\u8BD5\u7528\u6216\u6709\u6548\u8BA2\u9605\u624D\u80FD\u5199\u5165\u914D\u7F6E(\u514D\u8D39\u5C42\u53EA\u663E\u793A\u4E00\u4E2A\u5DE5\u5177)",
2524
2547
  "cli.server.planShape": "plan \u9700\u8981 ActionPlan \u5BF9\u8C61(\u7531 /api/action/plan \u4EA7\u51FA)",
2525
2548
  "cli.server.fixturesProtocol": "fixtures \u6A21\u5F0F\u53EA\u8BFB:\u4E0D\u9884\u89C8\u6216\u5199\u5165\u7528\u6237\u7EA7\u534F\u8BAE",
2526
2549
  "cli.server.dshUserUnsupported": "unsupported: dsh \u65E0\u7528\u6237\u7EA7\u6307\u4EE4\u6587\u4EF6\uFF0C\u8BF7\u6309\u9879\u76EE\u5B89\u88C5\u8BA1\u5212\u534F\u8BAE",
@@ -2542,7 +2565,8 @@ var init_server2 = __esm({
2542
2565
  "cli.server.settingsFormat": "\u56DE\u8DF3\u8BBE\u7F6E\u65E0\u6CD5\u89E3\u6790\u6216\u7248\u672C\u672A\u77E5,\u62D2\u7EDD\u8986\u76D6;\u8BF7\u4EBA\u5DE5\u68C0\u67E5 settings.json",
2543
2566
  "cli.server.settingsWrite": "\u56DE\u8DF3\u8BBE\u7F6E\u5907\u4EFD\u6216\u5199\u5165\u5931\u8D25,\u672A\u8986\u76D6\u8BBE\u7F6E;\u8BF7\u4EBA\u5DE5\u68C0\u67E5 settings.json",
2544
2567
  "cli.server.localeInvalid": "locale \u53EA\u63A5\u53D7\u5DF2\u6CE8\u518C\u8BED\u8A00\u6807\u7B7E",
2545
- "cli.server.settingsInvalid": "\u8BBE\u7F6E\u53EA\u63A5\u53D7\u5DF2\u6CE8\u518C\u7684 locale \u6216\u5408\u6CD5\u7684 island \u4F4D\u7F6E\u4E0E\u5927\u5C0F",
2568
+ "cli.server.settingsInvalid": "\u8BBE\u7F6E\u53EA\u63A5\u53D7\u5DF2\u6CE8\u518C\u7684 locale\u3001\u5408\u6CD5\u7684 island \u4F4D\u7F6E\u4E0E\u5927\u5C0F\u6216\u5DF2\u77E5\u7684 freeHarness",
2569
+ "cli.server.freeHarnessNotDetected": "\u5C1A\u672A\u63A2\u6D4B\u5230\u8FD9\u4E2A\u5DE5\u5177\uFF0C\u4E0D\u80FD\u8BBE\u4E3A\u514D\u8D39\u5DE5\u5177\u3002",
2546
2570
  "cli.server.fixturesSettings": "fixtures \u6A21\u5F0F\u53EA\u8BFB:\u4E0D\u4FDD\u5B58\u8BED\u8A00\u8BBE\u7F6E",
2547
2571
  "cli.server.settingsHome": "\u8BED\u8A00\u8BBE\u7F6E\u7F3A\u5C11 homeDir"
2548
2572
  };
@@ -12241,11 +12265,12 @@ function recordWalkError(error, stats) {
12241
12265
  if (stats && (code === void 0 || !TOLERATED_CODES.has(code)))
12242
12266
  stats.unknownErrors += 1;
12243
12267
  }
12244
- function safeReaddir(dir, stats) {
12268
+ function safeReaddir(dir, stats, onError) {
12245
12269
  try {
12246
12270
  return readdirSync(dir, { withFileTypes: true });
12247
12271
  } catch (e) {
12248
12272
  recordWalkError(e, stats);
12273
+ onError?.(e);
12249
12274
  return [];
12250
12275
  }
12251
12276
  }
@@ -13828,6 +13853,104 @@ var init_hooks2 = __esm({
13828
13853
  }
13829
13854
  });
13830
13855
 
13856
+ // packages/adapter-cc/dist/discover.js
13857
+ import { createReadStream, statSync as statSync3 } from "node:fs";
13858
+ import { join as join15 } from "node:path";
13859
+ import { createInterface } from "node:readline";
13860
+ async function readCwd(transcriptPath) {
13861
+ const input = createReadStream(transcriptPath, { encoding: "utf8", highWaterMark: 4096 });
13862
+ const lines2 = createInterface({ input, crlfDelay: Infinity });
13863
+ let count = 0;
13864
+ try {
13865
+ for await (const line of lines2) {
13866
+ count += 1;
13867
+ if (line.trim()) {
13868
+ const row = JSON.parse(line);
13869
+ if (typeof row?.cwd === "string" && row.cwd.length > 0)
13870
+ return row.cwd;
13871
+ }
13872
+ if (count >= 200)
13873
+ break;
13874
+ }
13875
+ throw new Error("Session cwd not found");
13876
+ } finally {
13877
+ lines2.close();
13878
+ input.destroy();
13879
+ }
13880
+ }
13881
+ async function discoverRecentSessions(homeDir, { now, windowMs, limit }, stats = newWalkStats()) {
13882
+ if (limit <= 0)
13883
+ return [];
13884
+ const candidates = [];
13885
+ const root = join15(homeDir, ".claude", "projects");
13886
+ let skipped = 0;
13887
+ const recordSkippedDirectory = () => {
13888
+ skipped += 1;
13889
+ };
13890
+ const rootEntries = safeReaddir(root, stats, (error) => {
13891
+ if (error.code !== "ENOENT")
13892
+ recordSkippedDirectory();
13893
+ });
13894
+ for (const entry of rootEntries) {
13895
+ if (stats.entriesLeft <= 0) {
13896
+ stats.truncated = true;
13897
+ break;
13898
+ }
13899
+ stats.entriesLeft -= 1;
13900
+ if (!entry.isDirectory())
13901
+ continue;
13902
+ const dir = join15(root, entry.name);
13903
+ for (const file of safeReaddir(dir, stats, recordSkippedDirectory)) {
13904
+ if (stats.entriesLeft <= 0) {
13905
+ stats.truncated = true;
13906
+ break;
13907
+ }
13908
+ stats.entriesLeft -= 1;
13909
+ if (!file.isFile() || !file.name.endsWith(".jsonl"))
13910
+ continue;
13911
+ const transcriptPath = join15(dir, file.name);
13912
+ try {
13913
+ const mtime = statSync3(transcriptPath).mtimeMs;
13914
+ if (mtime < now - windowMs || mtime > now)
13915
+ continue;
13916
+ const id = file.name.slice(0, -".jsonl".length);
13917
+ if (!id)
13918
+ throw new Error("Session id not found");
13919
+ candidates.push({ id, transcriptPath, mtime });
13920
+ } catch (error) {
13921
+ recordWalkError(error, stats);
13922
+ skipped += 1;
13923
+ }
13924
+ }
13925
+ if (stats.truncated)
13926
+ break;
13927
+ }
13928
+ candidates.sort((a, b) => b.mtime - a.mtime || a.transcriptPath.localeCompare(b.transcriptPath));
13929
+ const sessions = [];
13930
+ for (const candidate of candidates) {
13931
+ try {
13932
+ const cwd = await readCwd(candidate.transcriptPath);
13933
+ sessions.push({ ...candidate, cwd });
13934
+ if (sessions.length >= limit)
13935
+ break;
13936
+ } catch (error) {
13937
+ recordWalkError(error, stats);
13938
+ skipped += 1;
13939
+ }
13940
+ }
13941
+ if (skipped > 0) {
13942
+ process.stderr.write(`[wingman] cc startup discovery: skipped ${skipped} unreadable or invalid entries.
13943
+ `);
13944
+ }
13945
+ return sessions;
13946
+ }
13947
+ var init_discover = __esm({
13948
+ "packages/adapter-cc/dist/discover.js"() {
13949
+ "use strict";
13950
+ init_walk();
13951
+ }
13952
+ });
13953
+
13831
13954
  // packages/adapter-cc/dist/generic-waiting.js
13832
13955
  var GENERIC_WAITING_MESSAGES;
13833
13956
  var init_generic_waiting = __esm({
@@ -13857,7 +13980,7 @@ var init_mcp_tools = __esm({
13857
13980
  // packages/adapter-cc/dist/protocol.js
13858
13981
  import { existsSync as existsSync10, mkdirSync as mkdirSync6, readdirSync as readdirSync3, readFileSync as readFileSync10, rmdirSync, rmSync as rmSync5, writeFileSync as writeFileSync7 } from "node:fs";
13859
13982
  import { homedir as homedir10 } from "node:os";
13860
- import { basename as basename7, dirname as dirname10, join as join15, resolve as resolve6 } from "node:path";
13983
+ import { basename as basename7, dirname as dirname10, join as join16, resolve as resolve6 } from "node:path";
13861
13984
  function protocolStatusCc(options) {
13862
13985
  const paths3 = resolveOptions2(options);
13863
13986
  if (!existsSync10(paths3.targetPath)) {
@@ -13887,7 +14010,7 @@ function installProtocolCc(options) {
13887
14010
  const backupDir = nextBackupDir3(paths3.homeDir);
13888
14011
  const installedSha256 = sha256Hex(PLAN_PROTOCOL_TEXT);
13889
14012
  if (!paths3.dryRun) {
13890
- const claudeDir = join15(paths3.projectDir, ".claude");
14013
+ const claudeDir = join16(paths3.projectDir, ".claude");
13891
14014
  const rulesDir = dirname10(paths3.targetPath);
13892
14015
  const prior = readState4(paths3.statePath);
13893
14016
  backupTarget3(backupDir, paths3.targetPath, existing?.bytes);
@@ -13952,14 +14075,14 @@ function uninstallProtocolCc(options) {
13952
14075
  function resolveOptions2(options) {
13953
14076
  const homeDir = resolve6(options?.homeDir ?? homedir10());
13954
14077
  const projectDir = resolve6(options?.projectDir ?? process.cwd());
13955
- const targetPath2 = join15(projectDir, ".claude", "rules", "wingman-plan-protocol.md");
14078
+ const targetPath2 = join16(projectDir, ".claude", "rules", "wingman-plan-protocol.md");
13956
14079
  const projectHash = sha256Hex(projectDir);
13957
14080
  return {
13958
14081
  homeDir,
13959
14082
  projectDir,
13960
14083
  dryRun: options?.dryRun ?? false,
13961
14084
  targetPath: targetPath2,
13962
- statePath: join15(homeDir, ".wingman", "state", `plan-protocol-cc-${projectHash}.json`)
14085
+ statePath: join16(homeDir, ".wingman", "state", `plan-protocol-cc-${projectHash}.json`)
13963
14086
  };
13964
14087
  }
13965
14088
  function readExisting(targetPath2) {
@@ -14011,16 +14134,16 @@ function modifiedError2(targetPath2, operation) {
14011
14134
  }
14012
14135
  function nextBackupDir3(homeDir) {
14013
14136
  const stamp = (/* @__PURE__ */ new Date()).toISOString().replaceAll(":", "-");
14014
- const root = join15(homeDir, ".wingman", "backups");
14015
- let dir = join15(root, stamp);
14137
+ const root = join16(homeDir, ".wingman", "backups");
14138
+ let dir = join16(root, stamp);
14016
14139
  for (let n = 2; existsSync10(dir); n += 1)
14017
- dir = join15(root, `${stamp}-${n}`);
14140
+ dir = join16(root, `${stamp}-${n}`);
14018
14141
  return dir;
14019
14142
  }
14020
14143
  function backupTarget3(backupDir, targetPath2, bytes) {
14021
14144
  mkdirSync6(backupDir, { recursive: true });
14022
14145
  if (bytes !== void 0)
14023
- writeFileSync7(join15(backupDir, basename7(targetPath2)), bytes);
14146
+ writeFileSync7(join16(backupDir, basename7(targetPath2)), bytes);
14024
14147
  }
14025
14148
  function readState4(statePath2) {
14026
14149
  if (!existsSync10(statePath2))
@@ -14062,12 +14185,12 @@ var init_protocol2 = __esm({
14062
14185
 
14063
14186
  // packages/adapter-cc/dist/protocol-user.js
14064
14187
  import { homedir as homedir11 } from "node:os";
14065
- import { join as join16, resolve as resolve7 } from "node:path";
14188
+ import { join as join17, resolve as resolve7 } from "node:path";
14066
14189
  function paths(options) {
14067
14190
  const homeDir = resolve7(options?.homeDir ?? homedir11());
14068
14191
  return {
14069
14192
  homeDir,
14070
- targetPath: join16(homeDir, ".claude", "CLAUDE.md"),
14193
+ targetPath: join17(homeDir, ".claude", "CLAUDE.md"),
14071
14194
  dryRun: options?.dryRun ?? false
14072
14195
  };
14073
14196
  }
@@ -14093,6 +14216,7 @@ __export(dist_exports2, {
14093
14216
  GENERIC_WAITING_MESSAGES: () => GENERIC_WAITING_MESSAGES,
14094
14217
  WIRED_EVENTS: () => WIRED_EVENTS,
14095
14218
  createAdapter: () => createAdapter2,
14219
+ discoverRecentSessions: () => discoverRecentSessions,
14096
14220
  feedbackSignals: () => feedbackSignalsCc,
14097
14221
  installProtocolCc: () => installProtocolCc,
14098
14222
  installProtocolCcUser: () => installProtocolCcUser,
@@ -14120,6 +14244,7 @@ var init_dist4 = __esm({
14120
14244
  init_detect();
14121
14245
  init_hooks2();
14122
14246
  init_scan();
14247
+ init_discover();
14123
14248
  init_generic_waiting();
14124
14249
  init_hooks2();
14125
14250
  init_mcp_tools();
@@ -14839,14 +14964,14 @@ var init_dist5 = __esm({
14839
14964
 
14840
14965
  // packages/adapter-codex/dist/shared.js
14841
14966
  import { homedir as homedir12 } from "node:os";
14842
- import { join as join17 } from "node:path";
14967
+ import { join as join18 } from "node:path";
14843
14968
  function resolvePaths(options) {
14844
14969
  const homeDir = options?.homeDir ?? homedir12();
14845
14970
  const projectDir = options?.projectDir ?? process.cwd();
14846
- return { homeDir, projectDir, codexHome: join17(homeDir, ".codex") };
14971
+ return { homeDir, projectDir, codexHome: join18(homeDir, ".codex") };
14847
14972
  }
14848
14973
  function wingmanStateRoot(paths3) {
14849
- return join17(paths3.homeDir, ".wingman");
14974
+ return join18(paths3.homeDir, ".wingman");
14850
14975
  }
14851
14976
  function isTable(value) {
14852
14977
  return typeof value === "object" && value !== null && !Array.isArray(value) && !(value instanceof Date);
@@ -15155,8 +15280,8 @@ var init_toml_edit = __esm({
15155
15280
  });
15156
15281
 
15157
15282
  // packages/adapter-codex/dist/actions.js
15158
- import { existsSync as existsSync11, mkdirSync as mkdirSync7, readdirSync as readdirSync4, readFileSync as readFileSync11, statSync as statSync3, writeFileSync as writeFileSync8 } from "node:fs";
15159
- import { basename as basename8, dirname as dirname11, join as join18 } from "node:path";
15283
+ import { existsSync as existsSync11, mkdirSync as mkdirSync7, readdirSync as readdirSync4, readFileSync as readFileSync11, statSync as statSync4, writeFileSync as writeFileSync8 } from "node:fs";
15284
+ import { basename as basename8, dirname as dirname11, join as join19 } from "node:path";
15160
15285
  async function planAction(action, options) {
15161
15286
  const paths3 = resolvePaths(options);
15162
15287
  const resolved = resolveToggle(action, paths3);
@@ -15190,7 +15315,7 @@ async function applyAction(plan, options) {
15190
15315
  error: t("adapter.codex.actions.planWritesDoesNotMatchThisAdapterSFormat")
15191
15316
  };
15192
15317
  }
15193
- const backupsRoot = join18(wingmanStateRoot(paths3), "backups");
15318
+ const backupsRoot = join19(wingmanStateRoot(paths3), "backups");
15194
15319
  if (dirname11(plan.backupDir) !== backupsRoot) {
15195
15320
  return {
15196
15321
  ok: false,
@@ -15219,7 +15344,7 @@ async function applyAction(plan, options) {
15219
15344
  };
15220
15345
  }
15221
15346
  mkdirSync7(plan.backupDir, { recursive: true });
15222
- writeFileSync8(join18(plan.backupDir, basename8(write.file)), currentRaw);
15347
+ writeFileSync8(join19(plan.backupDir, basename8(write.file)), currentRaw);
15223
15348
  writeFileSync8(write.file, write.after);
15224
15349
  return { ok: true, backupDir: plan.backupDir };
15225
15350
  } catch (error) {
@@ -15228,10 +15353,10 @@ async function applyAction(plan, options) {
15228
15353
  }
15229
15354
  function nextBackupDir4(paths3) {
15230
15355
  const stamp = (/* @__PURE__ */ new Date()).toISOString().replaceAll(":", "-");
15231
- const base = join18(wingmanStateRoot(paths3), "backups");
15232
- let dir = join18(base, stamp);
15356
+ const base = join19(wingmanStateRoot(paths3), "backups");
15357
+ let dir = join19(base, stamp);
15233
15358
  for (let n = 1; existsSync11(dir); n += 1)
15234
- dir = join18(base, `${stamp}-${n}`);
15359
+ dir = join19(base, `${stamp}-${n}`);
15235
15360
  return dir;
15236
15361
  }
15237
15362
  function resolveToggle(action, paths3) {
@@ -15249,7 +15374,7 @@ function resolveToggle(action, paths3) {
15249
15374
  const slot = m[1];
15250
15375
  const source = m[2];
15251
15376
  const nativeName = m[3];
15252
- const file = source === "user" ? join18(paths3.codexHome, "config.toml") : join18(paths3.projectDir, ".codex", "config.toml");
15377
+ const file = source === "user" ? join19(paths3.codexHome, "config.toml") : join19(paths3.projectDir, ".codex", "config.toml");
15253
15378
  if (!existsSync11(file))
15254
15379
  throw new Error(t("adapter.codex.actions.itemidNotFoundConfigurationFileDoesNotExist", { p0: String(file) }));
15255
15380
  const before = readFileSync11(file, "utf8");
@@ -15527,18 +15652,18 @@ function verifyEdit(table, edit, file) {
15527
15652
  }
15528
15653
  function collectCorpus(paths3) {
15529
15654
  const candidates = [
15530
- join18(paths3.codexHome, "AGENTS.md"),
15531
- join18(paths3.projectDir, "AGENTS.md"),
15532
- join18(paths3.codexHome, "config.toml"),
15533
- join18(paths3.projectDir, ".codex", "config.toml"),
15534
- join18(paths3.codexHome, "hooks.json"),
15535
- join18(paths3.projectDir, ".codex", "hooks.json"),
15536
- ...listFilesRecursive(join18(paths3.codexHome, "prompts"))
15655
+ join19(paths3.codexHome, "AGENTS.md"),
15656
+ join19(paths3.projectDir, "AGENTS.md"),
15657
+ join19(paths3.codexHome, "config.toml"),
15658
+ join19(paths3.projectDir, ".codex", "config.toml"),
15659
+ join19(paths3.codexHome, "hooks.json"),
15660
+ join19(paths3.projectDir, ".codex", "hooks.json"),
15661
+ ...listFilesRecursive(join19(paths3.codexHome, "prompts"))
15537
15662
  ];
15538
15663
  const sources = [];
15539
15664
  for (const file of candidates) {
15540
15665
  try {
15541
- if (!statSync3(file).isFile())
15666
+ if (!statSync4(file).isFile())
15542
15667
  continue;
15543
15668
  } catch {
15544
15669
  continue;
@@ -15556,7 +15681,7 @@ function listFilesRecursive(dir) {
15556
15681
  }
15557
15682
  const files = [];
15558
15683
  for (const entry of [...entries].sort((a, b) => a.name.localeCompare(b.name))) {
15559
- const path = join18(dir, entry.name);
15684
+ const path = join19(dir, entry.name);
15560
15685
  if (entry.isDirectory())
15561
15686
  files.push(...listFilesRecursive(path));
15562
15687
  else if (entry.isFile())
@@ -15638,15 +15763,15 @@ var init_actions2 = __esm({
15638
15763
  // packages/adapter-codex/dist/hooks.js
15639
15764
  import { spawnSync } from "node:child_process";
15640
15765
  import { existsSync as existsSync12, mkdirSync as mkdirSync8, readFileSync as readFileSync12, realpathSync, rmSync as rmSync6, writeFileSync as writeFileSync9 } from "node:fs";
15641
- import { basename as basename9, dirname as dirname12, join as join19 } from "node:path";
15766
+ import { basename as basename9, dirname as dirname12, join as join20 } from "node:path";
15642
15767
  async function installHooks(port, options) {
15643
15768
  if (!Number.isInteger(port) || port <= 0 || port > 65535) {
15644
15769
  throw new Error(t("adapter.codex.hooks.invalidPort", { p0: String(port) }));
15645
15770
  }
15646
15771
  const paths3 = resolvePaths(options);
15647
15772
  const root = wingmanStateRoot(paths3);
15648
- const scriptPath = join19(root, FORWARD_SCRIPT_NAME);
15649
- const configPath = join19(paths3.codexHome, "config.toml");
15773
+ const scriptPath = join20(root, FORWARD_SCRIPT_NAME);
15774
+ const configPath = join20(paths3.codexHome, "config.toml");
15650
15775
  const raw = existsSync12(configPath) ? readFileSync12(configPath) : void 0;
15651
15776
  const text = raw?.toString("utf8") ?? "";
15652
15777
  const { before, after, remainder, block } = splitManagedBlock(text, configPath);
@@ -15710,9 +15835,9 @@ async function installHooks(port, options) {
15710
15835
  async function uninstallHooks(options) {
15711
15836
  const paths3 = resolvePaths(options);
15712
15837
  const root = wingmanStateRoot(paths3);
15713
- const scriptPath = join19(root, FORWARD_SCRIPT_NAME);
15838
+ const scriptPath = join20(root, FORWARD_SCRIPT_NAME);
15714
15839
  const statePath2 = hooksStatePath(root);
15715
- const configPath = join19(paths3.codexHome, "config.toml");
15840
+ const configPath = join20(paths3.codexHome, "config.toml");
15716
15841
  const state = readState5(statePath2);
15717
15842
  const raw = existsSync12(configPath) ? readFileSync12(configPath) : void 0;
15718
15843
  if (raw !== void 0) {
@@ -15738,25 +15863,25 @@ async function uninstallHooks(options) {
15738
15863
  rmSync6(statePath2, { force: true });
15739
15864
  }
15740
15865
  function hasManagedHooks2(paths3) {
15741
- const configPath = join19(paths3.codexHome, "config.toml");
15866
+ const configPath = join20(paths3.codexHome, "config.toml");
15742
15867
  if (!existsSync12(configPath))
15743
15868
  return false;
15744
15869
  try {
15745
15870
  const { block } = splitManagedBlock(readFileSync12(configPath, "utf8"), configPath);
15746
- return block !== void 0 && inspectManagedBlock(block, join19(wingmanStateRoot(paths3), FORWARD_SCRIPT_NAME)) !== void 0;
15871
+ return block !== void 0 && inspectManagedBlock(block, join20(wingmanStateRoot(paths3), FORWARD_SCRIPT_NAME)) !== void 0;
15747
15872
  } catch {
15748
15873
  return false;
15749
15874
  }
15750
15875
  }
15751
15876
  function feedbackSignalsCodex(options) {
15752
15877
  const paths3 = resolvePaths(options);
15753
- const configPath = join19(paths3.codexHome, "config.toml");
15878
+ const configPath = join20(paths3.codexHome, "config.toml");
15754
15879
  const wiredEvents = [];
15755
15880
  if (existsSync12(configPath)) {
15756
15881
  try {
15757
15882
  const { block } = splitManagedBlock(readFileSync12(configPath, "utf8"), configPath);
15758
15883
  if (block !== void 0) {
15759
- const knownBlock = inspectManagedBlock(block, join19(wingmanStateRoot(paths3), FORWARD_SCRIPT_NAME));
15884
+ const knownBlock = inspectManagedBlock(block, join20(wingmanStateRoot(paths3), FORWARD_SCRIPT_NAME));
15760
15885
  const hooks = knownBlock === void 0 ? void 0 : parse3(normalizeLineEndings(knownBlock.managedBlock)).hooks;
15761
15886
  if (isTable(hooks)) {
15762
15887
  for (const [event, groups] of Object.entries(hooks)) {
@@ -16013,15 +16138,15 @@ function hasHooksState(text) {
16013
16138
  }
16014
16139
  function backupFile(root, filePath, contents) {
16015
16140
  const stamp = (/* @__PURE__ */ new Date()).toISOString().replaceAll(":", "-");
16016
- let dir = join19(root, "backups", stamp);
16141
+ let dir = join20(root, "backups", stamp);
16017
16142
  for (let n = 1; existsSync12(dir); n += 1)
16018
- dir = join19(root, "backups", `${stamp}-${n}`);
16143
+ dir = join20(root, "backups", `${stamp}-${n}`);
16019
16144
  mkdirSync8(dir, { recursive: true });
16020
- writeFileSync9(join19(dir, basename9(filePath)), contents);
16145
+ writeFileSync9(join20(dir, basename9(filePath)), contents);
16021
16146
  return dir;
16022
16147
  }
16023
16148
  function hooksStatePath(root) {
16024
- return join19(root, "state", "codex-hooks.json");
16149
+ return join20(root, "state", "codex-hooks.json");
16025
16150
  }
16026
16151
  function readState5(statePath2) {
16027
16152
  if (!existsSync12(statePath2))
@@ -16191,11 +16316,11 @@ process.stdin.on('end', async () => {
16191
16316
  });
16192
16317
 
16193
16318
  // packages/adapter-codex/dist/scan.js
16194
- import { existsSync as existsSync13, readdirSync as readdirSync5, readFileSync as readFileSync13, realpathSync as realpathSync2, statSync as statSync4 } from "node:fs";
16195
- import { dirname as dirname13, isAbsolute as isAbsolute3, join as join20, resolve as resolve8 } from "node:path";
16319
+ import { existsSync as existsSync13, readdirSync as readdirSync5, readFileSync as readFileSync13, realpathSync as realpathSync2, statSync as statSync5 } from "node:fs";
16320
+ import { dirname as dirname13, isAbsolute as isAbsolute3, join as join21, resolve as resolve8 } from "node:path";
16196
16321
  function readCodexProjects(homeDir) {
16197
16322
  try {
16198
- const state = JSON.parse(readFileSync13(join20(homeDir, ".codex", ".codex-global-state.json"), "utf8"));
16323
+ const state = JSON.parse(readFileSync13(join21(homeDir, ".codex", ".codex-global-state.json"), "utf8"));
16199
16324
  if (!isTable(state))
16200
16325
  return void 0;
16201
16326
  const localProjects = state["local-projects"];
@@ -16272,8 +16397,8 @@ async function scan(options) {
16272
16397
  }
16273
16398
  function loadConfigLayers(paths3) {
16274
16399
  const candidates = [
16275
- ["user", join20(paths3.codexHome, "config.toml")],
16276
- ["project", join20(paths3.projectDir, ".codex", "config.toml")]
16400
+ ["user", join21(paths3.codexHome, "config.toml")],
16401
+ ["project", join21(paths3.projectDir, ".codex", "config.toml")]
16277
16402
  ];
16278
16403
  const layers = [];
16279
16404
  for (const [source, path] of candidates) {
@@ -16290,8 +16415,8 @@ function loadConfigLayers(paths3) {
16290
16415
  }
16291
16416
  function collectRules(out, paths3, layers) {
16292
16417
  const agentsChain = [
16293
- ["user", join20(paths3.codexHome, "AGENTS.md")],
16294
- ["project", join20(paths3.projectDir, "AGENTS.md")]
16418
+ ["user", join21(paths3.codexHome, "AGENTS.md")],
16419
+ ["project", join21(paths3.projectDir, "AGENTS.md")]
16295
16420
  ];
16296
16421
  for (const [source, file] of agentsChain) {
16297
16422
  const size = fileSize(file);
@@ -16426,7 +16551,7 @@ function collectGates(out, layer) {
16426
16551
  }
16427
16552
  }
16428
16553
  function collectHistory(out, paths3, layers) {
16429
- const historyFile = join20(paths3.codexHome, "history.jsonl");
16554
+ const historyFile = join21(paths3.codexHome, "history.jsonl");
16430
16555
  const historyBytes = fileSize(historyFile);
16431
16556
  if (historyBytes !== void 0) {
16432
16557
  out.push({
@@ -16441,7 +16566,7 @@ function collectHistory(out, paths3, layers) {
16441
16566
  });
16442
16567
  }
16443
16568
  const configured = layers.find((layer) => layer.source === "user")?.table.log_dir;
16444
- const logDir = typeof configured === "string" ? expandPath(configured, paths3) : join20(paths3.codexHome, "log");
16569
+ const logDir = typeof configured === "string" ? expandPath(configured, paths3) : join21(paths3.codexHome, "log");
16445
16570
  if (isDirectory(logDir)) {
16446
16571
  out.push({
16447
16572
  id: "codex:history:user:log_dir",
@@ -16457,7 +16582,7 @@ function collectHistory(out, paths3, layers) {
16457
16582
  }
16458
16583
  function expandPath(value, paths3) {
16459
16584
  if (value === "~" || value.startsWith("~/"))
16460
- return join20(paths3.homeDir, value.slice(2));
16585
+ return join21(paths3.homeDir, value.slice(2));
16461
16586
  return isAbsolute3(value) ? value : resolve8(paths3.codexHome, value);
16462
16587
  }
16463
16588
  function assertUniqueIds(slots) {
@@ -16473,7 +16598,7 @@ function assertUniqueIds(slots) {
16473
16598
  }
16474
16599
  function fileSize(path) {
16475
16600
  try {
16476
- const stats = statSync4(path);
16601
+ const stats = statSync5(path);
16477
16602
  return stats.isFile() ? stats.size : void 0;
16478
16603
  } catch {
16479
16604
  return void 0;
@@ -16481,7 +16606,7 @@ function fileSize(path) {
16481
16606
  }
16482
16607
  function isDirectory(path) {
16483
16608
  try {
16484
- return statSync4(path).isDirectory();
16609
+ return statSync5(path).isDirectory();
16485
16610
  } catch {
16486
16611
  return false;
16487
16612
  }
@@ -16489,11 +16614,11 @@ function isDirectory(path) {
16489
16614
  function directoryBytes(dir) {
16490
16615
  let total = 0;
16491
16616
  for (const entry of readdirSync5(dir, { withFileTypes: true })) {
16492
- const entryPath = join20(dir, entry.name);
16617
+ const entryPath = join21(dir, entry.name);
16493
16618
  if (entry.isDirectory())
16494
16619
  total += directoryBytes(entryPath);
16495
16620
  else if (entry.isFile())
16496
- total += statSync4(entryPath).size;
16621
+ total += statSync5(entryPath).size;
16497
16622
  }
16498
16623
  return total;
16499
16624
  }
@@ -16510,6 +16635,128 @@ var init_scan2 = __esm({
16510
16635
  }
16511
16636
  });
16512
16637
 
16638
+ // packages/adapter-codex/dist/discover.js
16639
+ import { createReadStream as createReadStream2, readdirSync as readdirSync6, statSync as statSync6 } from "node:fs";
16640
+ import { join as join22 } from "node:path";
16641
+ import { createInterface as createInterface2 } from "node:readline";
16642
+ function recordWalkError2(error, stats) {
16643
+ const code = error.code;
16644
+ if (code === void 0 || !TOLERATED_CODES2.has(code))
16645
+ stats.unknownErrors += 1;
16646
+ }
16647
+ function safeReaddir2(dir, stats, onError) {
16648
+ try {
16649
+ return readdirSync6(dir, { withFileTypes: true });
16650
+ } catch (error) {
16651
+ recordWalkError2(error, stats);
16652
+ onError(error);
16653
+ return [];
16654
+ }
16655
+ }
16656
+ async function readMetadata(file) {
16657
+ const stream = createReadStream2(file, { encoding: "utf8", highWaterMark: 4096 });
16658
+ const lines2 = createInterface2({ input: stream, crlfDelay: Number.POSITIVE_INFINITY });
16659
+ let lineCount = 0;
16660
+ try {
16661
+ for await (const line of lines2) {
16662
+ lineCount += 1;
16663
+ if (line.trim()) {
16664
+ const row = JSON.parse(line);
16665
+ if (isTable(row) && row.type === "session_meta") {
16666
+ const payload = row.payload;
16667
+ if (!isTable(payload) || typeof payload.id !== "string" || !payload.id) {
16668
+ throw new Error("Invalid session metadata");
16669
+ }
16670
+ if (typeof payload.parent_thread_id === "string" && payload.parent_thread_id) {
16671
+ return void 0;
16672
+ }
16673
+ const result5 = { id: payload.id };
16674
+ if (typeof payload.cwd === "string" && payload.cwd)
16675
+ result5.cwd = payload.cwd;
16676
+ return result5;
16677
+ }
16678
+ }
16679
+ if (lineCount >= MAX_META_LINES)
16680
+ break;
16681
+ }
16682
+ throw new Error("No session metadata within the line limit");
16683
+ } finally {
16684
+ lines2.close();
16685
+ stream.destroy();
16686
+ }
16687
+ }
16688
+ async function discoverRecentSessions2(homeDir, { now, windowMs, limit }, stats = {
16689
+ unknownErrors: 0,
16690
+ truncated: false,
16691
+ entriesLeft: MAX_WALK_ENTRIES2
16692
+ }) {
16693
+ if (limit <= 0)
16694
+ return [];
16695
+ const candidates = [];
16696
+ let skipped = 0;
16697
+ const visit = (dir, depth) => {
16698
+ const entries = safeReaddir2(dir, stats, (error) => {
16699
+ if (depth !== 1 || error.code !== "ENOENT")
16700
+ skipped += 1;
16701
+ });
16702
+ for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
16703
+ if (stats.entriesLeft <= 0) {
16704
+ stats.truncated = true;
16705
+ return;
16706
+ }
16707
+ stats.entriesLeft -= 1;
16708
+ const path = join22(dir, entry.name);
16709
+ if (entry.isDirectory()) {
16710
+ if (depth < MAX_WALK_DEPTH2 && !entry.name.startsWith("."))
16711
+ visit(path, depth + 1);
16712
+ if (stats.truncated)
16713
+ return;
16714
+ } else if (entry.isFile() && entry.name.startsWith("rollout-") && entry.name.endsWith(".jsonl")) {
16715
+ try {
16716
+ const mtime = statSync6(path).mtimeMs;
16717
+ if (mtime >= now - windowMs && mtime <= now) {
16718
+ candidates.push({ transcriptPath: path, mtime });
16719
+ }
16720
+ } catch (error) {
16721
+ recordWalkError2(error, stats);
16722
+ skipped += 1;
16723
+ }
16724
+ }
16725
+ }
16726
+ };
16727
+ visit(join22(homeDir, ".codex", "sessions"), 1);
16728
+ candidates.sort((a, b) => b.mtime - a.mtime);
16729
+ const sessions = [];
16730
+ for (const candidate of candidates) {
16731
+ try {
16732
+ const metadata = await readMetadata(candidate.transcriptPath);
16733
+ if (metadata)
16734
+ sessions.push({ ...metadata, ...candidate });
16735
+ } catch (error) {
16736
+ recordWalkError2(error, stats);
16737
+ skipped += 1;
16738
+ }
16739
+ if (sessions.length >= limit)
16740
+ break;
16741
+ }
16742
+ if (skipped > 0) {
16743
+ process.stderr.write(`[wingman] codex startup discovery: skipped ${skipped} unreadable or invalid entries.
16744
+ `);
16745
+ }
16746
+ return sessions;
16747
+ }
16748
+ var TOLERATED_CODES2, MAX_WALK_DEPTH2, MAX_WALK_ENTRIES2, MAX_META_LINES;
16749
+ var init_discover2 = __esm({
16750
+ "packages/adapter-codex/dist/discover.js"() {
16751
+ "use strict";
16752
+ init_shared();
16753
+ TOLERATED_CODES2 = /* @__PURE__ */ new Set(["EPERM", "EACCES", "ENOENT"]);
16754
+ MAX_WALK_DEPTH2 = 6;
16755
+ MAX_WALK_ENTRIES2 = 5e4;
16756
+ MAX_META_LINES = 200;
16757
+ }
16758
+ });
16759
+
16513
16760
  // packages/adapter-codex/dist/plugin-tools.js
16514
16761
  function recognizePluginTool(name, namespace, configuredPlugins) {
16515
16762
  const fullName = name.startsWith("mcp__") ? name : namespace?.startsWith("mcp__") ? `${namespace}__${name}` : void 0;
@@ -16545,7 +16792,7 @@ var init_plugin_tools = __esm({
16545
16792
 
16546
16793
  // packages/adapter-codex/dist/protocol.js
16547
16794
  import { existsSync as existsSync14, mkdirSync as mkdirSync9, readFileSync as readFileSync14, rmSync as rmSync7, writeFileSync as writeFileSync10 } from "node:fs";
16548
- import { basename as basename10, dirname as dirname14, join as join21, resolve as resolve9 } from "node:path";
16795
+ import { basename as basename10, dirname as dirname14, join as join23, resolve as resolve9 } from "node:path";
16549
16796
  function protocolStatusCodex(options) {
16550
16797
  const paths3 = resolveOptions3(options);
16551
16798
  if (!existsSync14(paths3.targetPath))
@@ -16641,8 +16888,8 @@ function resolveOptions3(options) {
16641
16888
  const base = resolvePaths(options);
16642
16889
  const homeDir = resolve9(base.homeDir);
16643
16890
  const projectDir = resolve9(base.projectDir);
16644
- const targetPath2 = join21(projectDir, "AGENTS.md");
16645
- const statePath2 = join21(wingmanStateRoot({ ...base, homeDir, projectDir }), "state", `plan-protocol-agents-${sha256Hex(projectDir)}.json`);
16891
+ const targetPath2 = join23(projectDir, "AGENTS.md");
16892
+ const statePath2 = join23(wingmanStateRoot({ ...base, homeDir, projectDir }), "state", `plan-protocol-agents-${sha256Hex(projectDir)}.json`);
16646
16893
  return { homeDir, projectDir, targetPath: targetPath2, statePath: statePath2, dryRun: options?.dryRun ?? false };
16647
16894
  }
16648
16895
  function readAgents2(targetPath2) {
@@ -16713,16 +16960,16 @@ function modifiedError3(targetPath2, operation) {
16713
16960
  }
16714
16961
  function nextBackupDir5(homeDir) {
16715
16962
  const stamp = (/* @__PURE__ */ new Date()).toISOString().replaceAll(":", "-");
16716
- const root = join21(homeDir, ".wingman", "backups");
16717
- let dir = join21(root, stamp);
16963
+ const root = join23(homeDir, ".wingman", "backups");
16964
+ let dir = join23(root, stamp);
16718
16965
  for (let n = 2; existsSync14(dir); n += 1)
16719
- dir = join21(root, `${stamp}-${n}`);
16966
+ dir = join23(root, `${stamp}-${n}`);
16720
16967
  return dir;
16721
16968
  }
16722
16969
  function backupTarget4(backupDir, targetPath2, bytes) {
16723
16970
  mkdirSync9(backupDir, { recursive: true });
16724
16971
  if (bytes !== void 0)
16725
- writeFileSync10(join21(backupDir, basename10(targetPath2)), bytes);
16972
+ writeFileSync10(join23(backupDir, basename10(targetPath2)), bytes);
16726
16973
  }
16727
16974
  function readState6(statePath2, targetPath2) {
16728
16975
  if (!existsSync14(statePath2))
@@ -16774,12 +17021,12 @@ var init_session_origin = __esm({
16774
17021
 
16775
17022
  // packages/adapter-codex/dist/protocol-user.js
16776
17023
  import { homedir as homedir13 } from "node:os";
16777
- import { join as join22, resolve as resolve10 } from "node:path";
17024
+ import { join as join24, resolve as resolve10 } from "node:path";
16778
17025
  function paths2(options) {
16779
17026
  const homeDir = resolve10(options?.homeDir ?? homedir13());
16780
17027
  return {
16781
17028
  homeDir,
16782
- targetPath: join22(homeDir, ".codex", "AGENTS.md"),
17029
+ targetPath: join24(homeDir, ".codex", "AGENTS.md"),
16783
17030
  dryRun: options?.dryRun ?? false
16784
17031
  };
16785
17032
  }
@@ -16805,6 +17052,7 @@ __export(dist_exports3, {
16805
17052
  HOOK_EVENTS: () => HOOK_EVENTS,
16806
17053
  createAdapter: () => createAdapter3,
16807
17054
  describeSessionOrigin: () => describeSessionOrigin,
17055
+ discoverRecentSessions: () => discoverRecentSessions2,
16808
17056
  feedbackSignals: () => feedbackSignalsCodex,
16809
17057
  installProtocolCodex: () => installProtocolCodex,
16810
17058
  installProtocolCodexUser: () => installProtocolCodexUser,
@@ -16833,6 +17081,7 @@ var init_dist6 = __esm({
16833
17081
  init_actions2();
16834
17082
  init_hooks3();
16835
17083
  init_scan2();
17084
+ init_discover2();
16836
17085
  init_hooks3();
16837
17086
  init_plugin_tools();
16838
17087
  init_protocol3();
@@ -17263,9 +17512,9 @@ init_dist6();
17263
17512
  init_dist3();
17264
17513
  init_dist2();
17265
17514
  init_dist();
17266
- import { realpathSync as realpathSync3, statSync as statSync6 } from "node:fs";
17515
+ import { realpathSync as realpathSync3, statSync as statSync8 } from "node:fs";
17267
17516
  import { readdir as readdir2 } from "node:fs/promises";
17268
- import { isAbsolute as isAbsolute6, join as join26, relative as relative4, resolve as resolve12 } from "node:path";
17517
+ import { isAbsolute as isAbsolute6, join as join28, relative as relative4, resolve as resolve12 } from "node:path";
17269
17518
 
17270
17519
  // packages/narrative/dist/attribute.js
17271
17520
  function extractSteps(lines2) {
@@ -17603,10 +17852,16 @@ function isRecord2(value) {
17603
17852
  }
17604
17853
 
17605
17854
  // packages/narrative/dist/parse.js
17855
+ var IMAGE_CAPTION_LINE = /^\s*\[Image: original \d+x\d+, displayed at \d+x\d+\.[^\]]*\]\s*$/u;
17856
+ function stripImageCaptions(body) {
17857
+ return body.split(/\r?\n/u).filter((line) => !IMAGE_CAPTION_LINE.test(line)).join("\n").trim();
17858
+ }
17606
17859
  function userRequestText(text) {
17607
17860
  let body = text.trim();
17608
17861
  if (/^<(task-notification|system-reminder)\b/u.test(body))
17609
17862
  return "";
17863
+ if (IMAGE_CAPTION_LINE.test(body.split(/\r?\n/u, 1)[0] ?? ""))
17864
+ body = stripImageCaptions(body);
17610
17865
  let browserEnvelope = false;
17611
17866
  if (/^<in-app-browser-context\b/u.test(body)) {
17612
17867
  const end = body.indexOf("</in-app-browser-context>");
@@ -17628,6 +17883,9 @@ function userRequestText(text) {
17628
17883
  function isHarnessSystemNotice(text) {
17629
17884
  if (/^\s*<in-app-browser-context\b/u.test(text))
17630
17885
  return userRequestText(text) === "";
17886
+ if (IMAGE_CAPTION_LINE.test(text.trim().split(/\r?\n/u, 1)[0] ?? "")) {
17887
+ return userRequestText(text) === "";
17888
+ }
17631
17889
  return /^\s*<(task-notification|system-reminder|in-app-browser-context)\b/u.test(text);
17632
17890
  }
17633
17891
  function parseTranscriptLine(line) {
@@ -18875,7 +19133,7 @@ function isRecord5(value) {
18875
19133
  // apps/cli/dist/project-index.js
18876
19134
  init_dist();
18877
19135
  import { lstat, readFile as readFile3, realpath, stat as stat3 } from "node:fs/promises";
18878
- import { dirname as dirname15, isAbsolute as isAbsolute4, join as join23, relative as relative3, resolve as resolve11 } from "node:path";
19136
+ import { dirname as dirname15, isAbsolute as isAbsolute4, join as join25, relative as relative3, resolve as resolve11 } from "node:path";
18879
19137
  var PROJECT_ROOT_MAX_DIRECTORIES = 8;
18880
19138
  var PROJECT_PLAN_POLL_MS = 2e3;
18881
19139
  async function resolveProjectRoot(cwd, options) {
@@ -18887,8 +19145,8 @@ async function resolveProjectRoot(cwd, options) {
18887
19145
  pathIdentity(homeDir),
18888
19146
  boundaryDir === void 0 ? void 0 : pathIdentity(boundaryDir)
18889
19147
  ]);
18890
- const wingmanHomeIdentity = await pathIdentity(join23(homeIdentity, ".wingman"));
18891
- const planPathIdentity = await pathIdentity(join23(rootIdentity, ".wingman", "plan.md"));
19148
+ const wingmanHomeIdentity = await pathIdentity(join25(homeIdentity, ".wingman"));
19149
+ const planPathIdentity = await pathIdentity(join25(rootIdentity, ".wingman", "plan.md"));
18892
19150
  if (rootIdentity === homeIdentity || rootIdentity === wingmanHomeIdentity || boundaryIdentity !== void 0 && !isWithin(boundaryIdentity, rootIdentity)) {
18893
19151
  return {
18894
19152
  root,
@@ -18909,7 +19167,7 @@ async function resolveProjectRoot(cwd, options) {
18909
19167
  break;
18910
19168
  if (boundaryIdentity !== void 0 && !isWithin(boundaryIdentity, currentIdentity))
18911
19169
  break;
18912
- const planPath = join23(current, ".wingman", "plan.md");
19170
+ const planPath = join25(current, ".wingman", "plan.md");
18913
19171
  lookedUp.push(planPath);
18914
19172
  try {
18915
19173
  await lstat(planPath);
@@ -19025,11 +19283,11 @@ function isWithin(parent, child) {
19025
19283
  // apps/cli/dist/project-roots.js
19026
19284
  init_dist();
19027
19285
  import { randomBytes as randomBytes2 } from "node:crypto";
19028
- import { closeSync, mkdirSync as mkdirSync10, openSync, readFileSync as readFileSync15, renameSync as renameSync3, rmSync as rmSync8, statSync as statSync5, writeFileSync as writeFileSync11 } from "node:fs";
19029
- import { dirname as dirname16, isAbsolute as isAbsolute5, join as join24 } from "node:path";
19286
+ import { closeSync, mkdirSync as mkdirSync10, openSync, readFileSync as readFileSync15, renameSync as renameSync3, rmSync as rmSync8, statSync as statSync7, writeFileSync as writeFileSync11 } from "node:fs";
19287
+ import { dirname as dirname16, isAbsolute as isAbsolute5, join as join26 } from "node:path";
19030
19288
  var PROJECT_ROOTS_MAX_ENTRIES = 200;
19031
19289
  function projectRootsPath(homeDir) {
19032
- return join24(homeDir, ".wingman", "state", "projects.json");
19290
+ return join26(homeDir, ".wingman", "state", "projects.json");
19033
19291
  }
19034
19292
  function readProjectRoots(homeDir) {
19035
19293
  const path = projectRootsPath(homeDir);
@@ -19089,7 +19347,7 @@ function pruneProjectRoots(homeDir) {
19089
19347
  return current;
19090
19348
  const roots = Object.fromEntries(Object.entries(current.roots).filter(([, entry]) => {
19091
19349
  try {
19092
- statSync5(join24(entry.root, ".wingman", "plan.md"));
19350
+ statSync7(join26(entry.root, ".wingman", "plan.md"));
19093
19351
  return true;
19094
19352
  } catch (error) {
19095
19353
  return !isErrno(error, "ENOENT") && !isErrno(error, "ENOTDIR");
@@ -19115,7 +19373,7 @@ function limitRoots(roots) {
19115
19373
  }
19116
19374
  function writeProjectRoots(homeDir, state) {
19117
19375
  const path = projectRootsPath(homeDir);
19118
- const tempPath = join24(dirname16(path), `.projects-${randomBytes2(8).toString("hex")}.tmp`);
19376
+ const tempPath = join26(dirname16(path), `.projects-${randomBytes2(8).toString("hex")}.tmp`);
19119
19377
  let fd;
19120
19378
  try {
19121
19379
  mkdirSync10(dirname16(path), { recursive: true, mode: 448 });
@@ -19164,9 +19422,9 @@ function isErrno(error, code) {
19164
19422
  init_dist();
19165
19423
  import { randomBytes as randomBytes3 } from "node:crypto";
19166
19424
  import { closeSync as closeSync2, copyFileSync as copyFileSync2, mkdirSync as mkdirSync11, openSync as openSync2, readFileSync as readFileSync16, renameSync as renameSync4, rmSync as rmSync9, writeFileSync as writeFileSync12 } from "node:fs";
19167
- import { dirname as dirname17, join as join25 } from "node:path";
19425
+ import { dirname as dirname17, join as join27 } from "node:path";
19168
19426
  function taskOverlayPath(homeDir) {
19169
- return join25(homeDir, ".wingman", "state", "task-overlay.json");
19427
+ return join27(homeDir, ".wingman", "state", "task-overlay.json");
19170
19428
  }
19171
19429
  function readTaskOverlay(homeDir) {
19172
19430
  const path = taskOverlayPath(homeDir);
@@ -19289,7 +19547,7 @@ function patchProjectOverlay(homeDir, root, patch, now) {
19289
19547
  }
19290
19548
  function writeTaskOverlay(homeDir, overlay) {
19291
19549
  const path = taskOverlayPath(homeDir);
19292
- const tempPath = join25(dirname17(path), `.task-overlay-${randomBytes3(8).toString("hex")}.tmp`);
19550
+ const tempPath = join27(dirname17(path), `.task-overlay-${randomBytes3(8).toString("hex")}.tmp`);
19293
19551
  let fd;
19294
19552
  try {
19295
19553
  mkdirSync11(dirname17(path), { recursive: true, mode: 448 });
@@ -19370,7 +19628,7 @@ function resolveWingmanVersion({ defined, moduleUrl = import.meta.url, readPacka
19370
19628
  return void 0;
19371
19629
  }
19372
19630
  function wingmanVersion() {
19373
- const defined = false ? void 0 : "0.9.4";
19631
+ const defined = false ? void 0 : "0.9.5";
19374
19632
  return resolveWingmanVersion({
19375
19633
  defined,
19376
19634
  readPackage: (url) => JSON.parse(readFileSync17(url, "utf8"))
@@ -19379,6 +19637,7 @@ function wingmanVersion() {
19379
19637
 
19380
19638
  // apps/cli/dist/narrative-service.js
19381
19639
  var MAX_SESSIONS = 8;
19640
+ var STARTUP_DISCOVERY_WINDOW_MS = 30 * 6e4;
19382
19641
  var ENDED_AFTER_STOP_MS = 10 * 6e4;
19383
19642
  var DETAIL_LIMIT = 80;
19384
19643
  var QUOTE_LIMIT = 160;
@@ -19429,7 +19688,7 @@ function createNarrativeService(options = {}) {
19429
19688
  return;
19430
19689
  let signature = "missing";
19431
19690
  try {
19432
- const info = statSync6(join26(options.homeDir, ".codex", ".codex-global-state.json"));
19691
+ const info = statSync8(join28(options.homeDir, ".codex", ".codex-global-state.json"));
19433
19692
  signature = `${info.mtimeMs}:${info.ctimeMs}:${info.size}:${info.mode}`;
19434
19693
  } catch {
19435
19694
  }
@@ -19584,7 +19843,7 @@ function createNarrativeService(options = {}) {
19584
19843
  function watchResolution(resolution) {
19585
19844
  if (resolution.lookedUp.length === 0)
19586
19845
  return;
19587
- const planPath = resolution.planPath ?? join26(resolution.root, ".wingman", "plan.md");
19846
+ const planPath = resolution.planPath ?? join28(resolution.root, ".wingman", "plan.md");
19588
19847
  const planPathIdentity = resolution.planPathIdentity;
19589
19848
  if (projectWatchers.has(planPathIdentity))
19590
19849
  return;
@@ -19669,13 +19928,60 @@ function createNarrativeService(options = {}) {
19669
19928
  });
19670
19929
  }
19671
19930
  }
19931
+ async function discoverStartupSessions() {
19932
+ const homeDir = options.homeDir;
19933
+ if (closed || homeDir === void 0)
19934
+ return;
19935
+ const scanAt = now().getTime();
19936
+ await Promise.all([
19937
+ ["cc", discoverRecentSessions],
19938
+ ["codex", discoverRecentSessions2]
19939
+ ].map(async ([harness, discover]) => {
19940
+ const sessions = sessionsOf(harness);
19941
+ const limit = MAX_SESSIONS - sessions.size;
19942
+ if (limit <= 0)
19943
+ return;
19944
+ try {
19945
+ const recent = await discover(homeDir, {
19946
+ now: scanAt,
19947
+ windowMs: STARTUP_DISCOVERY_WINDOW_MS,
19948
+ limit
19949
+ });
19950
+ for (const record of recent) {
19951
+ if (closed || sessions.size >= MAX_SESSIONS)
19952
+ break;
19953
+ if (sessions.has(record.id))
19954
+ continue;
19955
+ const session = sessionOf(harness, record.id);
19956
+ if (record.cwd !== void 0) {
19957
+ anchorCwd(harness, session, record.cwd);
19958
+ const base = pathBasename(record.cwd);
19959
+ if (base !== "")
19960
+ session.label = base;
19961
+ }
19962
+ session.discoveredAt = startedAt;
19963
+ session.lastActivity = new Date(record.mtime).toISOString();
19964
+ resetTranscript(session, record.transcriptPath);
19965
+ if (follow) {
19966
+ startFollowing(harness, session, record.transcriptPath);
19967
+ if (harness === "cc")
19968
+ startSubagentDiscovery(harness, session, record.transcriptPath);
19969
+ }
19970
+ notify(harness);
19971
+ }
19972
+ } catch {
19973
+ process.stderr.write(`[wingman] ${harness} startup discovery failed; skipped this harness.
19974
+ `);
19975
+ }
19976
+ }));
19977
+ }
19672
19978
  function projectChanged(planPathIdentity) {
19673
19979
  for (const [harness, sessions] of harnesses) {
19674
19980
  let changed = false;
19675
19981
  for (const session of sessions.values()) {
19676
19982
  const resolution = session.projectResolution;
19677
19983
  if (resolution?.planPathIdentity === planPathIdentity) {
19678
- const planPath = resolution.planPath ?? join26(resolution.root, ".wingman", "plan.md");
19984
+ const planPath = resolution.planPath ?? join28(resolution.root, ".wingman", "plan.md");
19679
19985
  void applyPendingPlanWrites(session, planPath, planPathIdentity).then(() => {
19680
19986
  session.dirty = true;
19681
19987
  notify(harness);
@@ -19720,7 +20026,7 @@ function createNarrativeService(options = {}) {
19720
20026
  }
19721
20027
  const resolution = session.projectResolution;
19722
20028
  if (resolution !== void 0) {
19723
- const planPath = resolution.planPath ?? join26(resolution.root, ".wingman", "plan.md");
20029
+ const planPath = resolution.planPath ?? join28(resolution.root, ".wingman", "plan.md");
19724
20030
  void applyPendingPlanWrites(session, planPath, resolution.planPathIdentity).then(() => {
19725
20031
  session.dirty = true;
19726
20032
  notify(harness);
@@ -19844,6 +20150,9 @@ function createNarrativeService(options = {}) {
19844
20150
  if (parsed.kind !== "unknown")
19845
20151
  timestamp = parsed.timestamp;
19846
20152
  }
20153
+ if (session.discoveredAt !== void 0 && path === session.transcriptPath && timestamp !== void 0) {
20154
+ session.lastActivity = timestamp;
20155
+ }
19847
20156
  const endedAt = session.endedAt ?? session.stopAt;
19848
20157
  if (timestamp !== void 0 && endedAt !== void 0 && Date.parse(timestamp) > Date.parse(endedAt)) {
19849
20158
  session.endedAt = void 0;
@@ -19858,7 +20167,7 @@ function createNarrativeService(options = {}) {
19858
20167
  const sessionDir = transcriptPath.replace(/\.jsonl$/, "");
19859
20168
  if (sessionDir === transcriptPath)
19860
20169
  return;
19861
- const subagentsDir = join26(sessionDir, "subagents");
20170
+ const subagentsDir = join28(sessionDir, "subagents");
19862
20171
  const generation = session.generation;
19863
20172
  const poll = async () => {
19864
20173
  try {
@@ -19868,7 +20177,7 @@ function createNarrativeService(options = {}) {
19868
20177
  }
19869
20178
  for (const entry of entries) {
19870
20179
  if (/^agent-.*\.jsonl$/.test(entry)) {
19871
- startFollowing(harness, session, join26(subagentsDir, entry), generation);
20180
+ startFollowing(harness, session, join28(subagentsDir, entry), generation);
19872
20181
  }
19873
20182
  }
19874
20183
  } catch {
@@ -19886,6 +20195,7 @@ function createNarrativeService(options = {}) {
19886
20195
  const sessionId = typeof payload.session_id === "string" ? payload.session_id : void 0;
19887
20196
  const key = sessionId ?? transcriptPath ?? "__nosession__";
19888
20197
  const session = sessionOf(event.harness, key);
20198
+ session.discoveredAt = void 0;
19889
20199
  session.lastActivity = event.received_at;
19890
20200
  const cwd = typeof payload.cwd === "string" ? payload.cwd : void 0;
19891
20201
  if (cwd !== void 0) {
@@ -20103,14 +20413,18 @@ function createNarrativeService(options = {}) {
20103
20413
  const user = overlayEntries[`${harness}:${session.id}`];
20104
20414
  const lastActivity = lastActivityOf(session);
20105
20415
  const state = deriveCached(harness, session, configuredPlugins, configuredMcpServers);
20416
+ const ended = isEnded(session, nowIso);
20417
+ const turnEnded = session.stopAt !== void 0 && !ended && state.waiting === null && feedbackView(harness, feedback, humanFeedbackState(harness, session)).state !== "needs_user";
20106
20418
  return {
20107
20419
  id: session.id,
20420
+ ...session.discoveredAt === void 0 ? {} : { discovered: true },
20108
20421
  ...state.origin === void 0 ? {} : { origin: state.origin },
20109
20422
  label: session.projectResolution?.isHome ? t("narrative.homeDirectory") : session.label ?? shortSessionId(session.id),
20110
20423
  ...session.cwd === void 0 ? {} : { cwd: session.cwd },
20111
20424
  lastActivity,
20112
20425
  waiting: state.waiting !== null,
20113
- ended: isEnded(session, nowIso),
20426
+ ended,
20427
+ ...turnEnded ? { turnEnded: true } : {},
20114
20428
  archived: user?.archived === true,
20115
20429
  archivedHasNewActivity: user?.archived === true && user.archivedAt !== void 0 && Date.parse(lastActivity) > Date.parse(user.archivedAt),
20116
20430
  ...feedback === void 0 ? {} : { feedback }
@@ -20302,7 +20616,7 @@ function createNarrativeService(options = {}) {
20302
20616
  continue;
20303
20617
  const resolution = group.resolution;
20304
20618
  const root = resolution?.root ?? (group.cardId === void 0 ? resolve12(members[0]?.session.cwd ?? rootIdentity) : rootIdentity);
20305
- const planPath = resolution?.planPath ?? join26(root, ".wingman", "plan.md");
20619
+ const planPath = resolution?.planPath ?? join28(root, ".wingman", "plan.md");
20306
20620
  const runtime = projectFiles.get(resolution?.planPathIdentity ?? planPath);
20307
20621
  if (runtime?.current !== void 0 && runtime.readFailureKey === void 0 && runtime.parsedLocale !== getLocale()) {
20308
20622
  runtime.parsed = parseProjectPlan(runtime.current.content, {
@@ -20331,8 +20645,10 @@ function createNarrativeService(options = {}) {
20331
20645
  return {
20332
20646
  harness,
20333
20647
  id: session.id,
20648
+ ...info?.discovered === void 0 ? {} : { discovered: true },
20334
20649
  label,
20335
20650
  ended: info?.ended ?? false,
20651
+ ...info?.turnEnded === true ? { turnEnded: true } : {},
20336
20652
  ...state?.origin === void 0 ? {} : { origin: state.origin },
20337
20653
  ...state?.skillsUsed === void 0 ? {} : { skillsUsed: state.skillsUsed },
20338
20654
  title: attachedTitle !== void 0 ? { text: attachedTitle, source: "plan.md \u6B65\u9AA4" } : planInstruction !== void 0 ? { text: truncate(planInstruction, DETAIL_LIMIT), source: "\u8BA1\u5212\u6240\u5C5E\u6307\u4EE4" } : instructionTitle !== void 0 ? { text: truncate(instructionTitle, DETAIL_LIMIT), source: "\u6700\u65B0\u6307\u4EE4" } : { text: label, source: "\u5DE5\u4F5C\u76EE\u5F55" },
@@ -20517,6 +20833,8 @@ function createNarrativeService(options = {}) {
20517
20833
  }
20518
20834
  function close() {
20519
20835
  closed = true;
20836
+ if (startupDiscovery !== void 0)
20837
+ clearImmediate(startupDiscovery);
20520
20838
  for (const sessions of harnesses.values()) {
20521
20839
  for (const session of sessions.values())
20522
20840
  closeSession(session);
@@ -20543,6 +20861,7 @@ function createNarrativeService(options = {}) {
20543
20861
  notify(changed);
20544
20862
  }
20545
20863
  loadRememberedProjectRoots();
20864
+ const startupDiscovery = options.discoverOnStart === false ? void 0 : setImmediate(() => void discoverStartupSessions());
20546
20865
  return {
20547
20866
  setCodexPluginsProvider(provider) {
20548
20867
  codexPluginsProvider = provider;
@@ -21673,7 +21992,7 @@ init_dist6();
21673
21992
  init_dist3();
21674
21993
  init_dist();
21675
21994
  import { homedir as homedir14 } from "node:os";
21676
- import { createInterface } from "node:readline/promises";
21995
+ import { createInterface as createInterface3 } from "node:readline/promises";
21677
21996
  var ProtocolUsageError = class extends Error {
21678
21997
  };
21679
21998
  async function runProtocolCli(args, options = { homeDir: homedir14() }) {
@@ -21830,7 +22149,7 @@ function lines(text) {
21830
22149
  return values;
21831
22150
  }
21832
22151
  async function confirmWrite() {
21833
- const prompt = createInterface({ input: process.stdin, output: process.stdout });
22152
+ const prompt = createInterface3({ input: process.stdin, output: process.stdout });
21834
22153
  try {
21835
22154
  const answer = await prompt.question(t("cli.confirmWrite"));
21836
22155
  return answer.trim().toLowerCase() === "y" || answer.trim().toLowerCase() === "yes";
@@ -21891,10 +22210,14 @@ async function loadHarness(harness, mode) {
21891
22210
  }
21892
22211
 
21893
22212
  // apps/cli/dist/return-target.js
22213
+ init_dist2();
21894
22214
  init_dist();
21895
22215
  import { randomBytes as randomBytes4 } from "node:crypto";
21896
- import { closeSync as closeSync3, copyFileSync as copyFileSync3, mkdirSync as mkdirSync12, openSync as openSync3, readFileSync as readFileSync18, renameSync as renameSync5, rmSync as rmSync10, statSync as statSync7, writeFileSync as writeFileSync13 } from "node:fs";
21897
- import { dirname as dirname18, join as join27, resolve as resolve13 } from "node:path";
22216
+ import { closeSync as closeSync3, copyFileSync as copyFileSync3, mkdirSync as mkdirSync12, openSync as openSync3, readFileSync as readFileSync18, renameSync as renameSync5, rmSync as rmSync10, statSync as statSync9, writeFileSync as writeFileSync13 } from "node:fs";
22217
+ import { dirname as dirname18, join as join29, resolve as resolve13 } from "node:path";
22218
+ function isHarnessId3(value) {
22219
+ return typeof value === "string" && HARNESS_IDS.includes(value);
22220
+ }
21898
22221
  function isIslandSetting(value) {
21899
22222
  return isRecord8(value) && Object.keys(value).every((key) => ["edge", "offset", "screen", "size"].includes(key)) && ["top", "bottom", "left", "right"].includes(value.edge) && typeof value.offset === "number" && Number.isFinite(value.offset) && value.offset >= 0 && value.offset <= 1 && (value.screen === void 0 || typeof value.screen === "string") && (value.size === "compact" || value.size === "standard");
21900
22223
  }
@@ -21908,13 +22231,13 @@ var BUNDLES = [
21908
22231
  ["kitty", "kitty.app"],
21909
22232
  ["VS Code", "Visual Studio Code.app"]
21910
22233
  ];
21911
- function detectReturnTargets(homeDir, roots = ["/Applications", join27(homeDir, "Applications")]) {
22234
+ function detectReturnTargets(homeDir, roots = ["/Applications", join29(homeDir, "Applications")]) {
21912
22235
  const available = [];
21913
22236
  for (const [name, bundle] of BUNDLES) {
21914
22237
  for (const root of new Set(roots.map((root2) => resolve13(root2)))) {
21915
- const bundlePath = join27(root, bundle);
22238
+ const bundlePath = join29(root, bundle);
21916
22239
  try {
21917
- if (statSync7(bundlePath).isDirectory())
22240
+ if (statSync9(bundlePath).isDirectory())
21918
22241
  available.push({ name, bundlePath });
21919
22242
  } catch {
21920
22243
  }
@@ -21923,7 +22246,7 @@ function detectReturnTargets(homeDir, roots = ["/Applications", join27(homeDir,
21923
22246
  return available;
21924
22247
  }
21925
22248
  function settingsPath(homeDir) {
21926
- return join27(homeDir, ".wingman", "state", "settings.json");
22249
+ return join29(homeDir, ".wingman", "state", "settings.json");
21927
22250
  }
21928
22251
  function readReturnTargetSettings(homeDir) {
21929
22252
  let raw;
@@ -21953,12 +22276,15 @@ function saveSettings(homeDir, patch) {
21953
22276
  if (patch.island !== void 0 && !isIslandSetting(patch.island)) {
21954
22277
  return { unavailable: t("cli.server.settingsInvalid") };
21955
22278
  }
22279
+ if (patch.freeHarness !== void 0 && !isHarnessId3(patch.freeHarness)) {
22280
+ return { unavailable: t("cli.server.settingsInvalid") };
22281
+ }
21956
22282
  const current = readReturnTargetSettings(homeDir);
21957
22283
  if ("unavailable" in current)
21958
22284
  return current;
21959
22285
  const settings = { ...current, ...patch };
21960
22286
  const path = settingsPath(homeDir);
21961
- const tempPath = join27(dirname18(path), `.settings-${randomBytes4(8).toString("hex")}.tmp`);
22287
+ const tempPath = join29(dirname18(path), `.settings-${randomBytes4(8).toString("hex")}.tmp`);
21962
22288
  let fd;
21963
22289
  try {
21964
22290
  mkdirSync12(dirname18(path), { recursive: true, mode: 448 });
@@ -21991,10 +22317,10 @@ function saveSettings(homeDir, patch) {
21991
22317
  }
21992
22318
  }
21993
22319
  function isSettings(value) {
21994
- if (!isRecord8(value) || value.version !== 1 || !Object.keys(value).every((key) => ["version", "returnTarget", "locale", "island"].includes(key))) {
22320
+ if (!isRecord8(value) || value.version !== 1 || !Object.keys(value).every((key) => ["version", "returnTarget", "locale", "island", "freeHarness"].includes(key))) {
21995
22321
  return false;
21996
22322
  }
21997
- return (value.island === void 0 || isIslandSetting(value.island)) && (value.returnTarget === void 0 || isRecord8(value.returnTarget) && Object.keys(value.returnTarget).every((key) => key === "bundlePath") && typeof value.returnTarget.bundlePath === "string" && value.returnTarget.bundlePath.startsWith("/"));
22323
+ return (value.island === void 0 || isIslandSetting(value.island)) && (value.freeHarness === void 0 || isHarnessId3(value.freeHarness)) && (value.returnTarget === void 0 || isRecord8(value.returnTarget) && Object.keys(value.returnTarget).every((key) => key === "bundlePath") && typeof value.returnTarget.bundlePath === "string" && value.returnTarget.bundlePath.startsWith("/"));
21998
22324
  }
21999
22325
  function isRecord8(value) {
22000
22326
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -22004,7 +22330,7 @@ function isRecord8(value) {
22004
22330
  import { randomBytes as randomBytes5 } from "node:crypto";
22005
22331
  import { closeSync as closeSync4, mkdirSync as mkdirSync13, openSync as openSync4, readFileSync as readFileSync19, renameSync as renameSync6, rmSync as rmSync11, writeFileSync as writeFileSync14 } from "node:fs";
22006
22332
  import { homedir as homedir16 } from "node:os";
22007
- import { dirname as dirname19, join as join28 } from "node:path";
22333
+ import { dirname as dirname19, join as join30 } from "node:path";
22008
22334
  function createHookToken() {
22009
22335
  return randomBytes5(32).toString("base64url");
22010
22336
  }
@@ -22015,8 +22341,8 @@ function writeServeRuntimeState(port, token, options = {}) {
22015
22341
  const pid = options.pid ?? process.pid;
22016
22342
  const suffix = randomBytes5(8).toString("base64url");
22017
22343
  const owner = `serve-${startedAtMs}-${pid}-${suffix}`;
22018
- const path = join28(options.homeDir ?? homedir16(), ".wingman", "state", "serve", `${owner}.json`);
22019
- const tempPath = join28(dirname19(path), `.${owner}.tmp`);
22344
+ const path = join30(options.homeDir ?? homedir16(), ".wingman", "state", "serve", `${owner}.json`);
22345
+ const tempPath = join30(dirname19(path), `.${owner}.tmp`);
22020
22346
  const contents = Buffer.from(`${JSON.stringify({ version: 2, owner, pid, port, startedAtMs, token })}
22021
22347
  `, "utf8");
22022
22348
  let fd;
@@ -22420,7 +22746,17 @@ async function handle(req, res, options, warn, runtime) {
22420
22746
  return;
22421
22747
  }
22422
22748
  if (url.pathname === "/api/license") {
22423
- sendJson2(res, 200, publicLicenseStatus(licenseStatus(options.licenseOptions)));
22749
+ const body = publicLicenseStatus(licenseStatus(options.licenseOptions));
22750
+ body.tier = checkLicense(options.licenseOptions) ? "full" : "free";
22751
+ if (body.tier === "free") {
22752
+ const cached = runtime.anatomy?.configs;
22753
+ const detected = new Set((cached ?? []).map((config) => config.harness));
22754
+ const homeDir = options.homeDir ?? options.licenseOptions?.homeDir;
22755
+ const settings = homeDir === void 0 ? void 0 : readReturnTargetSettings(homeDir);
22756
+ const selected = settings && !("unavailable" in settings) ? settings.freeHarness : void 0;
22757
+ body.freeHarness = selected !== void 0 && (cached === void 0 || detected.has(selected)) ? selected : HARNESS_IDS.find((harness) => detected.has(harness)) ?? HARNESS_IDS[0];
22758
+ }
22759
+ sendJson2(res, 200, body);
22424
22760
  return;
22425
22761
  }
22426
22762
  if (url.pathname === "/api/projects") {
@@ -22627,10 +22963,6 @@ async function handleActionApply(req, res, options, runtime) {
22627
22963
  sendJson2(res, 403, { error: t("cli.server.fixturesAction") });
22628
22964
  return;
22629
22965
  }
22630
- if (!checkLicense(options.licenseOptions)) {
22631
- sendJson2(res, 403, { error: t("cli.server.subscriptionRequired") });
22632
- return;
22633
- }
22634
22966
  const body = await readJsonBody(req);
22635
22967
  if (body === void 0) {
22636
22968
  sendJson2(res, 400, { error: t("cli.server.jsonBody") });
@@ -22640,6 +22972,10 @@ async function handleActionApply(req, res, options, runtime) {
22640
22972
  handleProtocolUserAction(body, res, options, runtime);
22641
22973
  return;
22642
22974
  }
22975
+ if (!checkLicense(options.licenseOptions)) {
22976
+ sendJson2(res, 403, { error: t("cli.server.subscriptionRequired") });
22977
+ return;
22978
+ }
22643
22979
  const { harness, plan } = body;
22644
22980
  const loaded = pickHarness(options, harness);
22645
22981
  if (!loaded) {
@@ -22733,13 +23069,18 @@ async function handleSettings(req, res, options, runtime) {
22733
23069
  }
22734
23070
  if (req.method === "POST") {
22735
23071
  const body = await readJsonBody(req);
22736
- if (!isRecord9(body) || Object.keys(body).length === 0 || Object.keys(body).some((key) => key !== "locale" && key !== "island") || body.locale !== void 0 && !locales().some(({ tag }) => tag === body.locale) || body.island !== void 0 && !isIslandSetting(body.island)) {
23072
+ if (!isRecord9(body) || Object.keys(body).length === 0 || Object.keys(body).some((key) => !["locale", "island", "freeHarness"].includes(key)) || body.locale !== void 0 && !locales().some(({ tag }) => tag === body.locale) || body.island !== void 0 && !isIslandSetting(body.island) || body.freeHarness !== void 0 && !isHarnessId4(body.freeHarness)) {
22737
23073
  sendJson2(res, 400, { error: t("cli.server.settingsInvalid") });
22738
23074
  return;
22739
23075
  }
23076
+ if (isHarnessId4(body.freeHarness) && runtime.anatomy !== null && !runtime.anatomy.configs.some((config) => config.harness === body.freeHarness)) {
23077
+ sendJson2(res, 400, { error: t("cli.server.freeHarnessNotDetected") });
23078
+ return;
23079
+ }
22740
23080
  const result5 = saveSettings(options.homeDir, {
22741
23081
  ...body.locale === void 0 ? {} : { locale: body.locale },
22742
- ...isIslandSetting(body.island) ? { island: body.island } : {}
23082
+ ...isIslandSetting(body.island) ? { island: body.island } : {},
23083
+ ...isHarnessId4(body.freeHarness) ? { freeHarness: body.freeHarness } : {}
22743
23084
  });
22744
23085
  if ("unavailable" in result5) {
22745
23086
  sendJson2(res, 409, { error: result5.unavailable });
@@ -22760,7 +23101,8 @@ async function handleSettings(req, res, options, runtime) {
22760
23101
  sendJson2(res, 200, {
22761
23102
  ...resolved,
22762
23103
  available: locales(),
22763
- ..."unavailable" in settings || settings.island === void 0 ? {} : { island: settings.island }
23104
+ ..."unavailable" in settings || settings.island === void 0 ? {} : { island: settings.island },
23105
+ ..."unavailable" in settings || settings.freeHarness === void 0 ? {} : { freeHarness: settings.freeHarness }
22764
23106
  });
22765
23107
  }
22766
23108
  async function handleReturn(req, res, options, activate) {
@@ -22861,7 +23203,7 @@ async function handleLicenseInstall(req, res, options) {
22861
23203
  sendJson2(res, 400, { error: result5.error });
22862
23204
  return;
22863
23205
  }
22864
- sendJson2(res, 200, publicLicenseStatus(result5.status));
23206
+ sendJson2(res, 200, { ...publicLicenseStatus(result5.status), tier: "full" });
22865
23207
  }
22866
23208
  async function handleLicenseRefresh(res, options) {
22867
23209
  const homeDir = options.licenseRefreshOptions?.homeDir ?? options.licenseOptions?.homeDir;
@@ -22889,6 +23231,7 @@ async function handleLicenseRefresh(res, options) {
22889
23231
  };
22890
23232
  sendJson2(res, 200, {
22891
23233
  ...publicLicenseStatus(licenseStatus(statusOptions)),
23234
+ tier: "full",
22892
23235
  message: result5.message
22893
23236
  });
22894
23237
  }
@@ -22930,7 +23273,7 @@ function isToggleRequest(value) {
22930
23273
  return o.kind === "toggle" && typeof o.itemId === "string" && typeof o.enable === "boolean";
22931
23274
  }
22932
23275
  function isTaskOverlayRequest(value) {
22933
- if (!isRecord9(value) || !isHarnessId3(value.harness))
23276
+ if (!isRecord9(value) || !isHarnessId4(value.harness))
22934
23277
  return false;
22935
23278
  if ("root" in value)
22936
23279
  return false;
@@ -22954,7 +23297,7 @@ function isProjectOverlayRequest(value) {
22954
23297
  const keys = Object.keys(value.patch);
22955
23298
  return keys.length > 0 && keys.every((key) => ["pinned", "order", "hidden", "archived"].includes(key)) && (value.patch.pinned === void 0 || typeof value.patch.pinned === "boolean") && (value.patch.hidden === void 0 || typeof value.patch.hidden === "boolean") && (value.patch.archived === void 0 || typeof value.patch.archived === "boolean") && (value.patch.order === void 0 || typeof value.patch.order === "number" && Number.isSafeInteger(value.patch.order) && value.patch.order >= 0);
22956
23299
  }
22957
- function isHarnessId3(value) {
23300
+ function isHarnessId4(value) {
22958
23301
  return typeof value === "string" && HARNESS_IDS.includes(value);
22959
23302
  }
22960
23303
  function isRecord9(value) {
@@ -23152,6 +23495,7 @@ async function runServe(args) {
23152
23495
  }
23153
23496
  const panelDistDir = panelDist === void 0 ? resolve15(dirname20(fileURLToPath2(import.meta.url)), "../../panel/dist") : resolve15(panelDist);
23154
23497
  const narrative = createNarrativeService({
23498
+ discoverOnStart: !fixtures,
23155
23499
  followTranscripts: !fixtures,
23156
23500
  homeDir,
23157
23501
  ...fixtures ? { projectBoundaryDir: fixturesRoot } : {},
@@ -23206,7 +23550,7 @@ async function runHook(args) {
23206
23550
  if (action !== "install" && action !== "uninstall" || harness === void 0) {
23207
23551
  throw new UsageError(t("cli.hookUsage"));
23208
23552
  }
23209
- if (!isHarnessId4(harness)) {
23553
+ if (!isHarnessId5(harness)) {
23210
23554
  throw new UsageError(t("cli.hookHarness", { ids: HARNESS_IDS.join("|"), harness }));
23211
23555
  }
23212
23556
  let port = 7333;
@@ -23316,7 +23660,7 @@ function parseScanArgs(args) {
23316
23660
  json = true;
23317
23661
  } else if (arg === "--harness") {
23318
23662
  const value = rest.shift();
23319
- if (value === void 0 || !isHarnessId4(value)) {
23663
+ if (value === void 0 || !isHarnessId5(value)) {
23320
23664
  throw new UsageError(t("cli.scanHarness", {
23321
23665
  ids: HARNESS_IDS.join("|"),
23322
23666
  value: value ?? t("cli.missingArgument")
@@ -23363,7 +23707,7 @@ function parseServeArgs(args) {
23363
23707
  }
23364
23708
  return { port, fixtures, panelDist, locale };
23365
23709
  }
23366
- function isHarnessId4(value) {
23710
+ function isHarnessId5(value) {
23367
23711
  return HARNESS_IDS.includes(value);
23368
23712
  }
23369
23713
  main(process.argv.slice(2)).then((code) => {