@desplega.ai/agent-swarm 1.110.0 → 1.112.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/README.md +1 -1
  2. package/dist/{actions-837ktebk.js → actions-eckb4g8r.js} +6 -6
  3. package/dist/{app-85h97pg2.js → app-b05sgm02.js} +3 -3
  4. package/dist/{assistant-yhrta0c5.js → assistant-7255sbyw.js} +9 -9
  5. package/dist/{boot-reembed-5sd1t9r4.js → boot-reembed-y1bt3ttn.js} +4 -4
  6. package/dist/{boot-reembed-8xmfv2pq.js → boot-reembed-yv7awg4y.js} +3 -3
  7. package/dist/{boot-scrub-logs-fdw8wbtq.js → boot-scrub-logs-ddyaeqar.js} +2 -2
  8. package/dist/{claude-managed-setup-yhbcx0bz.js → claude-managed-setup-cm05wtek.js} +1 -1
  9. package/dist/{cli-8ps5wsk9.js → cli-0c3n0eba.js} +1 -1
  10. package/dist/{cli-kna0r84e.js → cli-15598a4k.js} +599 -51
  11. package/dist/{cli-8s0swp2t.js → cli-30d2ct3k.js} +3 -3
  12. package/dist/{cli-2h86bsfe.js → cli-3r5y6ayj.js} +2 -2
  13. package/dist/{cli-6ttdv68b.js → cli-52tbq17n.js} +1 -1
  14. package/dist/{cli-k6ssh5dk.js → cli-56s4ehzw.js} +1 -1
  15. package/dist/{cli-m3enfr8q.js → cli-6wscj9z0.js} +4 -4
  16. package/dist/{cli-5kav4x1a.js → cli-709t753c.js} +7 -2
  17. package/dist/{cli-g44ffxk5.js → cli-76d1vtvq.js} +11 -2
  18. package/dist/{cli-gb7dqnna.js → cli-7xkwgkrs.js} +1 -1
  19. package/dist/{cli-kg9v8h1w.js → cli-8f0dwca2.js} +1 -1
  20. package/dist/{cli-zw3cmjh6.js → cli-94vzr3nq.js} +4 -4
  21. package/dist/{cli-d8vmtyyr.js → cli-951w7c79.js} +1 -1
  22. package/dist/{cli-dhph6q98.js → cli-9p0qhead.js} +1 -1
  23. package/dist/{cli-vfyhrk9k.js → cli-a5e8n5hg.js} +1 -1
  24. package/dist/{cli-w6zp4qcx.js → cli-ceewqajw.js} +37 -39
  25. package/dist/{cli-r19ttke3.js → cli-h9jx5mag.js} +4 -4
  26. package/dist/{cli-4trfcacj.js → cli-hm27prrc.js} +5 -5
  27. package/dist/{cli-gtt1f14h.js → cli-pt7c7qxz.js} +3 -3
  28. package/dist/{cli-sjm0e1pa.js → cli-r1btc895.js} +2 -2
  29. package/dist/{cli-3baz70yp.js → cli-rp8pca98.js} +1 -1
  30. package/dist/{cli-dy01kwxk.js → cli-s9pj3c7z.js} +2 -2
  31. package/dist/{cli-0pzg1f8z.js → cli-tch0ypp6.js} +71 -24
  32. package/dist/{cli-3t97r3y1.js → cli-tg0f2wmz.js} +5 -5
  33. package/dist/{cli-amncg1dq.js → cli-tk9vyqzh.js} +66 -9
  34. package/dist/{cli-cwety9qq.js → cli-tp7e60s3.js} +4 -2
  35. package/dist/cli.js +11 -11
  36. package/dist/{codex-adapter-ebs12jef.js → codex-adapter-5cmy858w.js} +3 -3
  37. package/dist/{codex-login-4sywkz6v.js → codex-login-0h18cy3e.js} +1 -1
  38. package/dist/{codex-session-runner-3bx0b1hn.js → codex-session-runner-46q8mrba.js} +3 -3
  39. package/dist/{commands-3fh75nzv.js → commands-14g7taf4.js} +2 -2
  40. package/dist/{db-kwfxkhpw.js → db-3tge4jrn.js} +2 -2
  41. package/dist/{handlers-jj8rzetb.js → handlers-sy64egg6.js} +9 -9
  42. package/dist/{hook-1b45zzz1.js → hook-rnkzw8vp.js} +3 -3
  43. package/dist/{http-71964f7a.js → http-xx9xptcs.js} +234 -37
  44. package/dist/{index-e01wmtj0.js → index-3wr6v2mm.js} +7 -7
  45. package/dist/{index-464v93y6.js → index-brma88d4.js} +9 -9
  46. package/dist/{index-c35g752k.js → index-ha8e9xn2.js} +7 -11
  47. package/dist/{index-zm0x6vmf.js → index-zfx5p959.js} +8 -8
  48. package/dist/{keepalive-2gxqjgrx.js → keepalive-rbz05zad.js} +4 -4
  49. package/dist/{lead-twm4zp8y.js → lead-s790v7r0.js} +20 -20
  50. package/dist/{maintenance-1htsnyz6.js → maintenance-420rmadb.js} +4 -4
  51. package/dist/{onboard-1y1pdzt5.js → onboard-jgqamqnw.js} +2 -2
  52. package/dist/{otel-impl-pw9tnc80.js → otel-impl-ch3n3783.js} +1 -1
  53. package/dist/{pi-mono-adapter-ayr3akk8.js → pi-mono-adapter-kxjxpfgy.js} +2 -2
  54. package/dist/{pricing-refresh-tqvvrk7a.js → pricing-refresh-rmtrby6h.js} +4 -4
  55. package/dist/{seed-pricing-f23sehzq.js → seed-pricing-1szjzfj1.js} +3 -3
  56. package/dist/{setup-jtw9rz9t.js → setup-8jfzkyzv.js} +2 -2
  57. package/dist/{worker-jxrmzwb9.js → worker-40vq0pm8.js} +20 -20
  58. package/openapi.json +1010 -2
  59. package/package.json +1 -1
  60. package/src/be/memory/constants.ts +7 -0
  61. package/src/be/memory/graph-expansion.ts +167 -0
  62. package/src/be/memory/link-resolver.ts +81 -17
  63. package/src/be/memory/links-store.ts +208 -0
  64. package/src/be/memory/providers/sqlite-store.ts +2 -2
  65. package/src/be/memory/raters/retrieval.ts +2 -1
  66. package/src/be/memory/types.ts +1 -1
  67. package/src/be/memory/usefulness-stats.ts +259 -0
  68. package/src/be/migrations/107_memory_usefulness_indexes.sql +12 -0
  69. package/src/be/scripts/typecheck.ts +2 -0
  70. package/src/be/seed-scripts/catalog/smart-recall.ts +1 -5
  71. package/src/commands/runner.ts +154 -8
  72. package/src/github/handlers.ts +128 -25
  73. package/src/github/mentions-aliases.test.ts +4 -3
  74. package/src/http/codex-oauth-keep-warm.ts +107 -0
  75. package/src/http/index.ts +2 -0
  76. package/src/http/memory.ts +73 -6
  77. package/src/providers/codex-adapter.ts +66 -2
  78. package/src/providers/codex-oauth/auth-json.ts +18 -9
  79. package/src/providers/codex-oauth/flow.ts +1 -1
  80. package/src/providers/codex-oauth/storage.ts +88 -6
  81. package/src/providers/codex-oauth/types.ts +1 -1
  82. package/src/scripts-runtime/sdk-allowlist.ts +2 -0
  83. package/src/scripts-runtime/types/swarm-sdk.d.ts +2 -0
  84. package/src/server.ts +4 -0
  85. package/src/slack/message-text.ts +25 -0
  86. package/src/tests/codex-adapter-pool-auth-revalidate.test.ts +113 -11
  87. package/src/tests/codex-adapter.test.ts +27 -0
  88. package/src/tests/codex-oauth-keep-warm.test.ts +268 -0
  89. package/src/tests/codex-oauth-refresh-lock.test.ts +4 -4
  90. package/src/tests/codex-oauth-storage.test.ts +149 -6
  91. package/src/tests/codex-oauth.test.ts +12 -0
  92. package/src/tests/create-page-tool.test.ts +7 -0
  93. package/src/tests/entrypoint-codex-oauth-seed.test.ts +124 -0
  94. package/src/tests/github-event-filter.test.ts +3 -2
  95. package/src/tests/github-handlers-inline-comments.test.ts +114 -24
  96. package/src/tests/jira-webhook-lifecycle.test.ts +7 -0
  97. package/src/tests/memory-edit.test.ts +95 -0
  98. package/src/tests/memory-get-tool.test.ts +138 -0
  99. package/src/tests/memory-graph-expansion.test.ts +421 -0
  100. package/src/tests/memory-http-recall-gating.test.ts +13 -0
  101. package/src/tests/memory-link-resolver.test.ts +228 -2
  102. package/src/tests/memory-usefulness-endpoint.test.ts +392 -0
  103. package/src/tests/runner-repo-autostash.test.ts +168 -1
  104. package/src/tests/script-workflows-runtime-e2e.test.ts +1 -0
  105. package/src/tests/slack-delete.test.ts +157 -0
  106. package/src/tests/slack-message-text.test.ts +37 -1
  107. package/src/tests/slack-update.test.ts +167 -0
  108. package/src/tests/slack-upload-file.test.ts +135 -0
  109. package/src/tests/tool-annotations.test.ts +3 -0
  110. package/src/tools/inject-learning.ts +1 -0
  111. package/src/tools/memory-edit.ts +3 -2
  112. package/src/tools/memory-get.ts +66 -1
  113. package/src/tools/memory-search.ts +13 -3
  114. package/src/tools/slack-delete.ts +102 -0
  115. package/src/tools/slack-reply.ts +11 -3
  116. package/src/tools/slack-start-thread.ts +2 -0
  117. package/src/tools/slack-update.ts +127 -0
  118. package/src/tools/slack-upload-file.ts +11 -1
  119. package/src/tools/tool-config.ts +3 -1
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  recordUnmappedIdentity
3
- } from "./cli-dhph6q98.js";
3
+ } from "./cli-9p0qhead.js";
4
4
  import {
5
5
  findOrCreateUserByEmail,
6
6
  findUserByExternalId,
7
7
  linkIdentity
8
- } from "./cli-gb7dqnna.js";
8
+ } from "./cli-7xkwgkrs.js";
9
9
  import {
10
10
  getKv,
11
11
  init_db,
12
12
  upsertKv
13
- } from "./cli-d8vmtyyr.js";
13
+ } from "./cli-951w7c79.js";
14
14
 
15
15
  // src/slack/enrich.ts
16
16
  init_db();
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  embedScript
3
- } from "./cli-dy01kwxk.js";
3
+ } from "./cli-s9pj3c7z.js";
4
4
  import {
5
5
  computeContentHash,
6
6
  decryptSecret,
@@ -10,7 +10,7 @@ import {
10
10
  getSwarmConfigs,
11
11
  init_crypto,
12
12
  init_db
13
- } from "./cli-d8vmtyyr.js";
13
+ } from "./cli-951w7c79.js";
14
14
  import {
15
15
  init_zod
16
16
  } from "./cli-q21d49ac.js";
@@ -3,7 +3,7 @@ import {
3
3
  init_date_utils,
4
4
  init_db,
5
5
  normalizeDateRequired
6
- } from "./cli-d8vmtyyr.js";
6
+ } from "./cli-951w7c79.js";
7
7
 
8
8
  // src/be/db-queries/oauth.ts
9
9
  init_date_utils();
@@ -17,7 +17,7 @@ import {
17
17
  init_templates1 as init_templates,
18
18
  normalizeDateRequired,
19
19
  resolveTemplate
20
- } from "./cli-d8vmtyyr.js";
20
+ } from "./cli-951w7c79.js";
21
21
 
22
22
  // src/be/db-queries/tracker.ts
23
23
  init_date_utils();
@@ -1,7 +1,3 @@
1
- import {
2
- getValidCodexOAuth,
3
- persistCodexOAuth
4
- } from "./cli-amncg1dq.js";
5
1
  import {
6
2
  appendAssistantMessageDiagnostic,
7
3
  cleanupSessionResources,
@@ -15,6 +11,10 @@ import {
15
11
  SummaryWithRatingsSchema,
16
12
  buildSummaryWithRatingsPrompt
17
13
  } from "./cli-dcfyyh3t.js";
14
+ import {
15
+ getValidCodexOAuth,
16
+ persistCodexOAuth
17
+ } from "./cli-tk9vyqzh.js";
18
18
  import {
19
19
  init_zod
20
20
  } from "./cli-q21d49ac.js";
@@ -6,7 +6,7 @@ import {
6
6
  getDb,
7
7
  init_db,
8
8
  isSqliteVecAvailable
9
- } from "./cli-d8vmtyyr.js";
9
+ } from "./cli-951w7c79.js";
10
10
  import {
11
11
  __esm,
12
12
  __export,
@@ -25,6 +25,10 @@ function isHybridSearchEnabled() {
25
25
  const val = process.env.MEMORY_HYBRID_SEARCH ?? "0";
26
26
  return val === "1" || val.toLowerCase() === "true";
27
27
  }
28
+ function isGraphExpansionEnabled() {
29
+ const val = process.env.MEMORY_GRAPH_EXPANSION ?? "0";
30
+ return val === "1" || val.toLowerCase() === "true";
31
+ }
28
32
  var TTL_DEFAULTS, GLOBAL_HALF_LIFE_OVERRIDE, GLOBAL_HALF_LIFE, RECENCY_DECAY_HALF_LIFE, RECENCY_DECAY_HALF_LIFE_DAYS, SOURCE_QUALITY_MULTIPLIER, MIN_SIMILARITY, ACCESS_BOOST_MAX_MULTIPLIER, ACCESS_BOOST_RECENCY_WINDOW_HOURS, CANDIDATE_SET_MULTIPLIER, EMBEDDING_DIMENSIONS, DEFAULT_EMBEDDING_MODEL = "openai/text-embedding-3-small", PROTECTED_SOURCES;
29
33
  var init_constants = __esm(() => {
30
34
  TTL_DEFAULTS = {
@@ -6599,6 +6603,7 @@ var init_reranker = __esm(() => {
6599
6603
  // src/be/memory/providers/sqlite-store.ts
6600
6604
  var exports_sqlite_store = {};
6601
6605
  __export(exports_sqlite_store, {
6606
+ rowToCandidate: () => rowToCandidate,
6602
6607
  computeRrfScore: () => computeRrfScore,
6603
6608
  applyEditMode: () => applyEditMode,
6604
6609
  SqliteMemoryStore: () => SqliteMemoryStore
@@ -7362,4 +7367,4 @@ function getMemoryStore() {
7362
7367
  return memoryStore;
7363
7368
  }
7364
7369
 
7365
- export { CANDIDATE_SET_MULTIPLIER, EMBEDDING_DIMENSIONS, init_constants, cosineSimilarity, serializeEmbedding, deserializeEmbedding, init_embedding, rerank, init_reranker, getEmbeddingProvider, getMemoryStore };
7370
+ export { CANDIDATE_SET_MULTIPLIER, isGraphExpansionEnabled, EMBEDDING_DIMENSIONS, init_constants, cosineSimilarity, serializeEmbedding, deserializeEmbedding, init_embedding, computeScore, rerank, init_reranker, rowToCandidate, init_sqlite_store, getEmbeddingProvider, getMemoryStore };
@@ -3,7 +3,7 @@ import {
3
3
  getAgentWorkingOnThread,
4
4
  getAllAgents,
5
5
  init_db
6
- } from "./cli-d8vmtyyr.js";
6
+ } from "./cli-951w7c79.js";
7
7
 
8
8
  // src/slack/router.ts
9
9
  init_db();
@@ -181,6 +181,15 @@ ${bodyText}` : topText;
181
181
  }
182
182
  return bodyText || topText;
183
183
  }
184
+ function parseSlackTs(input) {
185
+ const trimmed = input.trim();
186
+ if (/^\d{6,}\.\d{1,}$/.test(trimmed))
187
+ return trimmed;
188
+ const m = trimmed.match(/p?(\d{10})(\d{6})(?:\D|$)/);
189
+ if (m)
190
+ return `${m[1]}.${m[2]}`;
191
+ return trimmed;
192
+ }
184
193
 
185
194
  // src/tasks/additive-buffer.ts
186
195
  function createAdditiveBuffer(options) {
@@ -252,4 +261,4 @@ function createAdditiveBuffer(options) {
252
261
  };
253
262
  }
254
263
 
255
- export { hasOtherUserMention, routeMessage, extractTaskFromMessage, extractSlackMessageText, createAdditiveBuffer };
264
+ export { hasOtherUserMention, routeMessage, extractTaskFromMessage, extractSlackMessageText, parseSlackTs, createAdditiveBuffer };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getDb,
3
3
  init_db
4
- } from "./cli-d8vmtyyr.js";
4
+ } from "./cli-951w7c79.js";
5
5
 
6
6
  // src/be/users.ts
7
7
  init_db();
@@ -7,7 +7,7 @@ var package_default;
7
7
  var init_package = __esm(() => {
8
8
  package_default = {
9
9
  name: "@desplega.ai/agent-swarm",
10
- version: "1.110.0",
10
+ version: "1.112.0",
11
11
  description: "Multi-agent orchestration for Claude Code, Codex, Gemini CLI, and other AI coding assistants",
12
12
  license: "MIT",
13
13
  author: "desplega.sh <contact@desplega.sh>",
@@ -4,14 +4,14 @@ import {
4
4
  handleScheduleTrigger,
5
5
  runScript,
6
6
  startWorkflowExecution
7
- } from "./cli-3t97r3y1.js";
7
+ } from "./cli-tg0f2wmz.js";
8
8
  import {
9
9
  getScript
10
- } from "./cli-2h86bsfe.js";
10
+ } from "./cli-3r5y6ayj.js";
11
11
  import {
12
12
  createTaskWithSiblingAwareness,
13
13
  scheduleContextKey
14
- } from "./cli-8ps5wsk9.js";
14
+ } from "./cli-0c3n0eba.js";
15
15
  import {
16
16
  getDb,
17
17
  getDueScheduledTasks,
@@ -21,7 +21,7 @@ import {
21
21
  init_telemetry,
22
22
  telemetry,
23
23
  updateScheduledTask
24
- } from "./cli-d8vmtyyr.js";
24
+ } from "./cli-951w7c79.js";
25
25
  import {
26
26
  __commonJS,
27
27
  __require,
@@ -25,7 +25,7 @@ import {
25
25
  import {
26
26
  init_package,
27
27
  package_default
28
- } from "./cli-kg9v8h1w.js";
28
+ } from "./cli-8f0dwca2.js";
29
29
  import {
30
30
  init_secret_scrubber,
31
31
  scrubSecrets
@@ -3,7 +3,7 @@ import {
3
3
  incrKv,
4
4
  init_db,
5
5
  upsertKv
6
- } from "./cli-d8vmtyyr.js";
6
+ } from "./cli-951w7c79.js";
7
7
 
8
8
  // src/be/unmapped-identities.ts
9
9
  init_db();
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  init_package,
3
3
  package_default
4
- } from "./cli-kg9v8h1w.js";
4
+ } from "./cli-8f0dwca2.js";
5
5
 
6
6
  // src/commands/shared/client-config.ts
7
7
  init_package();
@@ -1,10 +1,6 @@
1
1
  import {
2
2
  summarizeSession
3
- } from "./cli-m3enfr8q.js";
4
- import {
5
- extractChatgptUserId,
6
- getValidCodexOAuth
7
- } from "./cli-amncg1dq.js";
3
+ } from "./cli-6wscj9z0.js";
8
4
  import {
9
5
  createSwarmEventHandler
10
6
  } from "./cli-07er7wrs.js";
@@ -19,6 +15,11 @@ import {
19
15
  fetchRetrievalsForTask,
20
16
  postRatings
21
17
  } from "./cli-dcfyyh3t.js";
18
+ import {
19
+ CodexOAuthRefreshError,
20
+ credentialsToAuthJson,
21
+ getValidCodexOAuth
22
+ } from "./cli-tk9vyqzh.js";
22
23
  import {
23
24
  SessionErrorTracker,
24
25
  buildOtelTraceparentEnv
@@ -687,37 +688,6 @@ function computeCodexCostUsd(model, inputTokens, cachedInputTokens, outputTokens
687
688
  return inputCost + cachedCost + outputCost;
688
689
  }
689
690
 
690
- // src/providers/codex-oauth/auth-json.ts
691
- function authJsonToCredentialSelection(auth, slot = 0, total = 1) {
692
- const userId = extractChatgptUserId(auth.tokens.access_token);
693
- const suffixSource = userId ?? auth.tokens.account_id;
694
- if (!userId) {
695
- console.warn("[codex-oauth] No chatgpt_user_id in JWT — falling back to account_id for keySuffix derivation. " + "If two slots share an account, their suffixes will collide.");
696
- }
697
- return {
698
- selected: auth.tokens.account_id,
699
- index: slot,
700
- total,
701
- keySuffix: suffixSource.slice(-5),
702
- keyType: "CODEX_OAUTH",
703
- isRateLimitFallback: false
704
- };
705
- }
706
- function credentialsToAuthJson(creds, opts = {}) {
707
- const includeRefreshToken = opts.includeRefreshToken ?? true;
708
- return {
709
- auth_mode: "chatgpt",
710
- OPENAI_API_KEY: null,
711
- tokens: {
712
- id_token: creds.access,
713
- access_token: creds.access,
714
- refresh_token: includeRefreshToken ? creds.refresh : "",
715
- account_id: creds.accountId
716
- },
717
- last_refresh: new Date(creds.expires).toISOString()
718
- };
719
- }
720
-
721
691
  // src/providers/codex-swarm-events.ts
722
692
  function createCodexSwarmEventHandler(opts) {
723
693
  return createSwarmEventHandler({
@@ -778,7 +748,23 @@ async function resolveCodexAuthMode(config, emit, deps = {}) {
778
748
  const slot = config.codexSlot ?? 0;
779
749
  const isPoolSlot = config.codexSlot !== undefined;
780
750
  if (config.apiUrl && config.apiKey && (currentMode !== "chatgpt" || isPoolSlot)) {
781
- const oauthCreds = await getValidCodexOAuth(config.apiUrl, config.apiKey, slot);
751
+ let oauthCreds = null;
752
+ try {
753
+ oauthCreds = await getValidCodexOAuth(config.apiUrl, config.apiKey, slot);
754
+ } catch (err) {
755
+ if (isPoolSlot) {
756
+ throw new Error(buildPoolRevalidationFailureReason(err, slot));
757
+ }
758
+ const message = err instanceof Error ? err.message : String(err);
759
+ emit({
760
+ type: "raw_stderr",
761
+ content: `[codex] OAuth revalidation failed (non-fatal, non-pool auth): ${message}
762
+ `
763
+ });
764
+ }
765
+ if (!oauthCreds && isPoolSlot) {
766
+ throw new Error(`[auth-error] Codex pool slot ${slot} revalidation failed: no credentials found in config store — the slot may have just been quarantined; re-run codex-login for this slot if this persists.`);
767
+ }
782
768
  if (oauthCreds) {
783
769
  try {
784
770
  const authJson = credentialsToAuthJson(oauthCreds, {
@@ -805,6 +791,16 @@ async function resolveCodexAuthMode(config, emit, deps = {}) {
805
791
  }
806
792
  return currentMode;
807
793
  }
794
+ function buildPoolRevalidationFailureReason(err, slot) {
795
+ if (err instanceof CodexOAuthRefreshError) {
796
+ if (err.reason === "lock_timeout") {
797
+ return `[auth-error] Codex pool slot ${slot} [...${err.keySuffix}] revalidation failed: timed out waiting for the refresh lock — transient, will retry on next task.`;
798
+ }
799
+ return `[auth-error] Codex pool slot ${slot} [...${err.keySuffix}] revalidation failed: refresh rejected (${err.status ?? "unknown status"} ${err.body ?? ""}) — credential likely revoked; re-run codex-login for this slot.`;
800
+ }
801
+ const message = err instanceof Error ? err.message : String(err);
802
+ return `[auth-error] Codex pool slot ${slot} revalidation failed: ${message}`;
803
+ }
808
804
  async function buildCodexConfig(config, model, emit) {
809
805
  const mcpServers = {};
810
806
  mcpServers["agent-swarm"] = {
@@ -1260,7 +1256,9 @@ class CodexSession {
1260
1256
  "invalid_api_key",
1261
1257
  "missing api key",
1262
1258
  "no api key",
1263
- "authentication failed"
1259
+ "authentication failed",
1260
+ "failed to refresh token",
1261
+ "invalid 'refresh_token'"
1264
1262
  ];
1265
1263
  if (authPatterns.some((p) => normalized.includes(p))) {
1266
1264
  return {
@@ -1697,4 +1695,4 @@ class CodexAdapter {
1697
1695
  }
1698
1696
  }
1699
1697
 
1700
- export { authJsonToCredentialSelection, credentialsToAuthJson, checkCodexCredentials, resolveCodexAuthMode, buildCodexConfig, CodexSession, createInProcessCodexSession, resolveCodexRunnerArgv, CodexAdapter };
1698
+ export { checkCodexCredentials, resolveCodexAuthMode, buildCodexConfig, CodexSession, createInProcessCodexSession, resolveCodexRunnerArgv, CodexAdapter };
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  createAdditiveBuffer,
3
3
  extractSlackMessageText
4
- } from "./cli-g44ffxk5.js";
4
+ } from "./cli-76d1vtvq.js";
5
5
  import {
6
6
  getSlackApp,
7
7
  registerTreeMessage
8
- } from "./cli-4trfcacj.js";
8
+ } from "./cli-hm27prrc.js";
9
9
  import {
10
10
  buildBufferFlushBlocks
11
11
  } from "./cli-6xd0bvf8.js";
12
12
  import {
13
13
  createTaskWithSiblingAwareness,
14
14
  slackContextKey
15
- } from "./cli-8ps5wsk9.js";
15
+ } from "./cli-0c3n0eba.js";
16
16
  import {
17
17
  getLatestActiveTaskInThread,
18
18
  getLeadAgent,
@@ -20,7 +20,7 @@ import {
20
20
  init_db,
21
21
  init_registry,
22
22
  registerTemplate
23
- } from "./cli-d8vmtyyr.js";
23
+ } from "./cli-951w7c79.js";
24
24
 
25
25
  // src/slack/event-dedup.ts
26
26
  var DEFAULT_TTL_MS = 300000;
@@ -25,7 +25,7 @@ import {
25
25
  getTaskById,
26
26
  init_db,
27
27
  setSlackMessageTracking
28
- } from "./cli-d8vmtyyr.js";
28
+ } from "./cli-951w7c79.js";
29
29
  import {
30
30
  require_receiver,
31
31
  require_sender,
@@ -54988,13 +54988,13 @@ async function initSlackApp() {
54988
54988
  socketMode: true,
54989
54989
  logLevel: import_bolt.LogLevel.DEBUG
54990
54990
  });
54991
- const { registerMessageHandler } = await import("./handlers-jj8rzetb.js");
54992
- const { registerCommandHandler } = await import("./commands-3fh75nzv.js");
54993
- const { registerActionHandlers } = await import("./actions-837ktebk.js");
54991
+ const { registerMessageHandler } = await import("./handlers-sy64egg6.js");
54992
+ const { registerCommandHandler } = await import("./commands-14g7taf4.js");
54993
+ const { registerActionHandlers } = await import("./actions-eckb4g8r.js");
54994
54994
  registerMessageHandler(app);
54995
54995
  registerCommandHandler(app);
54996
54996
  registerActionHandlers(app);
54997
- const { createAssistant } = await import("./assistant-yhrta0c5.js");
54997
+ const { createAssistant } = await import("./assistant-7255sbyw.js");
54998
54998
  app.assistant(createAssistant());
54999
54999
  return app;
55000
55000
  }
@@ -4,11 +4,11 @@ import {
4
4
  getNextResumeGeneration,
5
5
  getResumeGeneration,
6
6
  repointTrackerSyncBySwarmId
7
- } from "./cli-k6ssh5dk.js";
7
+ } from "./cli-56s4ehzw.js";
8
8
  import {
9
9
  getExecutorRegistry,
10
10
  recoverIncompleteRuns
11
- } from "./cli-3t97r3y1.js";
11
+ } from "./cli-tg0f2wmz.js";
12
12
  import {
13
13
  MAX_EMPTY_POLLS,
14
14
  assignUnassignedTaskPending,
@@ -44,7 +44,7 @@ import {
44
44
  resolveTemplate,
45
45
  supersedeTask,
46
46
  updateAgentStatus
47
- } from "./cli-d8vmtyyr.js";
47
+ } from "./cli-951w7c79.js";
48
48
 
49
49
  // src/heartbeat/heartbeat.ts
50
50
  init_db();
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  buildModelsDevSeedRows
3
- } from "./cli-3baz70yp.js";
3
+ } from "./cli-rp8pca98.js";
4
4
  import {
5
5
  createLogEntry,
6
6
  getActivePricingRow,
7
7
  getDb,
8
8
  init_db,
9
9
  insertPricingRow
10
- } from "./cli-d8vmtyyr.js";
10
+ } from "./cli-951w7c79.js";
11
11
  import {
12
12
  init_secret_scrubber,
13
13
  scrubSecrets
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getDb,
3
3
  init_db
4
- } from "./cli-d8vmtyyr.js";
4
+ } from "./cli-951w7c79.js";
5
5
 
6
6
  // src/be/seed-pricing.ts
7
7
  init_db();
@@ -4,11 +4,11 @@ import {
4
4
  getEmbeddingProvider,
5
5
  init_embedding,
6
6
  serializeEmbedding
7
- } from "./cli-5kav4x1a.js";
7
+ } from "./cli-709t753c.js";
8
8
  import {
9
9
  getDb,
10
10
  init_db
11
- } from "./cli-d8vmtyyr.js";
11
+ } from "./cli-951w7c79.js";
12
12
  import {
13
13
  init_secret_scrubber,
14
14
  scrubSecrets
@@ -1,11 +1,6 @@
1
1
  import {
2
- authJsonToCredentialSelection,
3
- checkCodexCredentials,
4
- credentialsToAuthJson
5
- } from "./cli-w6zp4qcx.js";
6
- import {
7
- loadAllCodexOAuthSlots
8
- } from "./cli-amncg1dq.js";
2
+ checkCodexCredentials
3
+ } from "./cli-ceewqajw.js";
9
4
  import {
10
5
  checkClaudeManagedCredentials
11
6
  } from "./cli-2r7s8jhp.js";
@@ -23,7 +18,12 @@ import {
23
18
  withSpan,
24
19
  withSpanContext,
25
20
  writeSkillsToFilesystem
26
- } from "./cli-kna0r84e.js";
21
+ } from "./cli-15598a4k.js";
22
+ import {
23
+ authJsonToCredentialSelection,
24
+ credentialsToAuthJson,
25
+ loadAllCodexOAuthSlots
26
+ } from "./cli-tk9vyqzh.js";
27
27
  import {
28
28
  checkClaudeCredentials
29
29
  } from "./cli-2fc97xm5.js";
@@ -40,10 +40,10 @@ import {
40
40
  import {
41
41
  ensure,
42
42
  initialize
43
- } from "./cli-zw3cmjh6.js";
43
+ } from "./cli-94vzr3nq.js";
44
44
  import {
45
45
  validateJsonSchema
46
- } from "./cli-3t97r3y1.js";
46
+ } from "./cli-tg0f2wmz.js";
47
47
  import {
48
48
  getApiKey
49
49
  } from "./cli-f14fvzag.js";
@@ -79,7 +79,7 @@ import {
79
79
  resolveTaskModelSelection,
80
80
  resolveTemplateAsync,
81
81
  telemetry
82
- } from "./cli-d8vmtyyr.js";
82
+ } from "./cli-951w7c79.js";
83
83
  import {
84
84
  init_credentials,
85
85
  resolveCredentialPools
@@ -445,11 +445,11 @@ async function createProviderAdapter(provider) {
445
445
  return new ClaudeAdapter;
446
446
  }
447
447
  case "pi": {
448
- const { PiMonoAdapter } = await import("./pi-mono-adapter-ayr3akk8.js");
448
+ const { PiMonoAdapter } = await import("./pi-mono-adapter-kxjxpfgy.js");
449
449
  return new PiMonoAdapter;
450
450
  }
451
451
  case "codex": {
452
- const { CodexAdapter } = await import("./codex-adapter-ebs12jef.js");
452
+ const { CodexAdapter } = await import("./codex-adapter-5cmy858w.js");
453
453
  return new CodexAdapter;
454
454
  }
455
455
  case "claude-managed": {
@@ -1109,7 +1109,7 @@ async function checkProviderCredentials(provider, env, opts) {
1109
1109
  case "opencode":
1110
1110
  return checkOpencodeCredentials(env, opts);
1111
1111
  case "pi": {
1112
- const { checkPiMonoCredentials } = await import("./pi-mono-adapter-ayr3akk8.js");
1112
+ const { checkPiMonoCredentials } = await import("./pi-mono-adapter-kxjxpfgy.js");
1113
1113
  return checkPiMonoCredentials(env, opts);
1114
1114
  }
1115
1115
  default:
@@ -1558,7 +1558,42 @@ async function listSwarmAutostashes(clonePath, role) {
1558
1558
  return [];
1559
1559
  }
1560
1560
  }
1561
- async function refreshExistingRepoForTask(repoConfig, role) {
1561
+ var CONTINUATION_TASK_TYPES = new Set([
1562
+ "resume",
1563
+ "follow-up",
1564
+ "reroute-decision",
1565
+ "agentmail-reply",
1566
+ "github-comment",
1567
+ "github-review",
1568
+ "gitlab-comment",
1569
+ "gitlab-ci"
1570
+ ]);
1571
+ var ACTIVE_PARENT_STATUSES = new Set(["pending", "in_progress", "offered", "paused"]);
1572
+ async function isFirstKickoffTask(task, fetchParentTaskStatus) {
1573
+ if (task?.taskType && CONTINUATION_TASK_TYPES.has(task.taskType))
1574
+ return false;
1575
+ if (task?.parentTaskId && fetchParentTaskStatus) {
1576
+ const parentStatus = await fetchParentTaskStatus(task.parentTaskId);
1577
+ if (parentStatus && ACTIVE_PARENT_STATUSES.has(parentStatus))
1578
+ return false;
1579
+ }
1580
+ return true;
1581
+ }
1582
+ async function fetchTaskStatus(apiUrl, apiKey, taskId) {
1583
+ const headers = {};
1584
+ if (apiKey)
1585
+ headers.Authorization = `Bearer ${apiKey}`;
1586
+ try {
1587
+ const response = await fetch(`${apiUrl}/api/tasks/${taskId}`, { headers });
1588
+ if (!response.ok)
1589
+ return null;
1590
+ const data = await response.json();
1591
+ return data.status ?? null;
1592
+ } catch {
1593
+ return null;
1594
+ }
1595
+ }
1596
+ async function refreshExistingRepoForTask(repoConfig, role, isFirstKickoff) {
1562
1597
  const { name, clonePath, defaultBranch } = repoConfig;
1563
1598
  const statusResult = await Bun.$`env -u GIT_DIR -u GIT_WORK_TREE -u GIT_INDEX_FILE -u GIT_PREFIX git -C ${clonePath} status --porcelain`.quiet();
1564
1599
  const statusOutput = statusResult.text().trim();
@@ -1575,13 +1610,24 @@ async function refreshExistingRepoForTask(repoConfig, role) {
1575
1610
  return `The repo "${name}" at ${clonePath} has uncommitted changes, but auto-stash failed: ${errorMsg}. A git pull was skipped to avoid losing work.`;
1576
1611
  }
1577
1612
  }
1613
+ const fetchSpec = `${defaultBranch}:refs/remotes/origin/${defaultBranch}`;
1614
+ const remoteRef = `refs/remotes/origin/${defaultBranch}`;
1578
1615
  try {
1579
- console.log(`[${role}] Refreshing ${name} from origin/${defaultBranch}...`);
1580
- const fetchSpec = `${defaultBranch}:refs/remotes/origin/${defaultBranch}`;
1581
- const remoteRef = `refs/remotes/origin/${defaultBranch}`;
1582
1616
  await Bun.$`env -u GIT_DIR -u GIT_WORK_TREE -u GIT_INDEX_FILE -u GIT_PREFIX git -C ${clonePath} fetch origin ${fetchSpec}`.quiet();
1583
- await Bun.$`env -u GIT_DIR -u GIT_WORK_TREE -u GIT_INDEX_FILE -u GIT_PREFIX git -C ${clonePath} merge --no-edit --no-stat ${remoteRef}`.quiet();
1584
- console.log(`[${role}] Refreshed ${name}`);
1617
+ if (isFirstKickoff) {
1618
+ console.log(`[${role}] First kickoff for ${name} — resetting to ${remoteRef}...`);
1619
+ try {
1620
+ await Bun.$`env -u GIT_DIR -u GIT_WORK_TREE -u GIT_INDEX_FILE -u GIT_PREFIX git -C ${clonePath} checkout ${defaultBranch}`.quiet();
1621
+ } catch {
1622
+ await Bun.$`env -u GIT_DIR -u GIT_WORK_TREE -u GIT_INDEX_FILE -u GIT_PREFIX git -C ${clonePath} checkout -B ${defaultBranch} ${remoteRef}`.quiet();
1623
+ }
1624
+ await Bun.$`env -u GIT_DIR -u GIT_WORK_TREE -u GIT_INDEX_FILE -u GIT_PREFIX git -C ${clonePath} reset --hard ${remoteRef}`.quiet();
1625
+ console.log(`[${role}] Reset ${name} to ${remoteRef}`);
1626
+ } else {
1627
+ console.log(`[${role}] Refreshing ${name} from ${remoteRef}...`);
1628
+ await Bun.$`env -u GIT_DIR -u GIT_WORK_TREE -u GIT_INDEX_FILE -u GIT_PREFIX git -C ${clonePath} merge --no-edit --no-stat ${remoteRef}`.quiet();
1629
+ console.log(`[${role}] Refreshed ${name}`);
1630
+ }
1585
1631
  return null;
1586
1632
  } catch (err) {
1587
1633
  const errorMsg = scrubSecrets(err.message);
@@ -1611,7 +1657,7 @@ async function installRepoHooksForTask(repoConfig, role) {
1611
1657
  console.warn(`[${role}] Could not install git hooks for ${repoConfig.name}: ${errorMsg}`);
1612
1658
  }
1613
1659
  }
1614
- async function ensureRepoForTask(repoConfig, role) {
1660
+ async function ensureRepoForTask(repoConfig, role, isFirstKickoff = false) {
1615
1661
  const { url, name, clonePath, defaultBranch } = repoConfig;
1616
1662
  try {
1617
1663
  const gitHeadExists = await Bun.file(`${clonePath}/.git/HEAD`).exists();
@@ -1632,7 +1678,7 @@ async function ensureRepoForTask(repoConfig, role) {
1632
1678
  console.log(`[${role}] Cloned ${name}`);
1633
1679
  } else {
1634
1680
  console.log(`[${role}] Repo ${name} already cloned at ${clonePath}`);
1635
- warning = await refreshExistingRepoForTask({ name, clonePath, defaultBranch }, role);
1681
+ warning = await refreshExistingRepoForTask({ name, clonePath, defaultBranch }, role, isFirstKickoff);
1636
1682
  }
1637
1683
  await installRepoHooksForTask(repoConfig, role);
1638
1684
  const claudeMd = await readClaudeMd(clonePath, role);
@@ -4510,7 +4556,7 @@ ${additionalSystemPrompt}` : basePrompt;
4510
4556
  clonePath: `/workspace/personal/repos/${task.vcsRepo.split("/").pop() || task.vcsRepo}`,
4511
4557
  defaultBranch: "main"
4512
4558
  };
4513
- const repoContext = await ensureRepoForTask(effectiveConfig, role);
4559
+ const repoContext = await ensureRepoForTask(effectiveConfig, role, false);
4514
4560
  if (repoContext?.clonePath) {
4515
4561
  resumeCwd = repoContext.clonePath;
4516
4562
  }
@@ -4740,7 +4786,8 @@ ${additionalSystemPrompt}` : basePrompt;
4740
4786
  clonePath: `/workspace/personal/repos/${taskVcsRepo.split("/").pop() || taskVcsRepo}`,
4741
4787
  defaultBranch: "main"
4742
4788
  };
4743
- const repoResult = await ensureRepoForTask(effectiveConfig, role);
4789
+ const isFirstKickoff = await isFirstKickoffTask(taskObj, (parentTaskId) => fetchTaskStatus(apiUrl, apiKey, parentTaskId));
4790
+ const repoResult = await ensureRepoForTask(effectiveConfig, role, isFirstKickoff);
4744
4791
  currentRepoContext = {
4745
4792
  ...repoResult,
4746
4793
  guidelines: repoConfig?.guidelines ?? null