nolo-cli 0.76.0-alpha.1 → 0.76.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 (134) hide show
  1. package/{_executeModel-MONX3AUM.js → _executeModel-I3XRMAJ2.js} +42 -42
  2. package/{action-D22U6CTH.js → action-7GHFPDSQ.js} +10 -10
  3. package/{addContentAction-XAPUTGL4.js → addContentAction-ZNVB2NOV.js} +8 -8
  4. package/{addDialogAgentAction-M7VLLBZM.js → addDialogAgentAction-CIDFWATM.js} +7 -7
  5. package/{agentDeleteCommand-2TYFURBN.js → agentDeleteCommand-DCTG26JW.js} +27 -26
  6. package/{agentEmailCommands-HXIX4KJE.js → agentEmailCommands-MRRHBLDQ.js} +54 -53
  7. package/{agentListCommands-IFUOWXP3.js → agentListCommands-CUE46CSP.js} +29 -28
  8. package/{agentMachineCommands-NEJEQV5S.js → agentMachineCommands-FYDEKBIO.js} +27 -26
  9. package/{agentProviderCommands-65ZC2WB4.js → agentProviderCommands-X3FA6BUM.js} +87 -0
  10. package/{agentPullCommand-N7L2CT7L.js → agentPullCommand-U73W5IBM.js} +1 -1
  11. package/{agentRecordCommands-USSLZKED.js → agentRecordCommands-P2MSNP7R.js} +52 -51
  12. package/{agentRunCommand-WZZSCEEP.js → agentRunCommand-YJOW3VB3.js} +52 -51
  13. package/{agentRuntimeLocal-PUZINLWJ.js → agentRuntimeLocal-T43UNWAY.js} +26 -25
  14. package/{agentSlice-BLCUNM5V.js → agentSlice-7GDS5Q2S.js} +9 -9
  15. package/{appDeleteCommands-U4NTEJYQ.js → appDeleteCommands-YBKY3VEI.js} +27 -26
  16. package/{appDeployCommands-FXF45Q7F.js → appDeployCommands-EBC76HO4.js} +27 -26
  17. package/{appDeployStatusCommands-KONVRM53.js → appDeployStatusCommands-WXRC5KEK.js} +27 -26
  18. package/{appGetCommands-3VOGIZ7T.js → appGetCommands-VZZQEDOV.js} +27 -26
  19. package/{appListCommands-A6ROBW7P.js → appListCommands-HYSPVQ77.js} +27 -26
  20. package/{authCommand-EVGFLAHO.js → authCommand-E4GDVKMW.js} +91 -17
  21. package/{authCommands-ILTBI6JV.js → authCommands-VOTT6XWX.js} +3 -4
  22. package/builtinSkillRegistry-5SYVTS6Z.js +33 -0
  23. package/{chatQueueReduxAdapter-ROFM5SW7.js → chatQueueReduxAdapter-CXEWIDFZ.js} +22 -22
  24. package/{chunk-NG4UT4K4.js → chunk-23RQKXP6.js} +1 -1
  25. package/{chunk-C3FZR5EC.js → chunk-2F7RJC6L.js} +1 -1
  26. package/{chunk-3QPYFHAH.js → chunk-2XEVK4BT.js} +1 -1
  27. package/{chunk-HQUORJTM.js → chunk-3BMYXEUW.js} +1 -1
  28. package/{chunk-AFIWC5NH.js → chunk-3T4PRBHV.js} +1 -1
  29. package/{chunk-ZDONXM5U.js → chunk-4FRNB4ZG.js} +7 -7
  30. package/{chunk-YFADVSZE.js → chunk-5EJZGJS2.js} +6 -6
  31. package/{chunk-UJ63UXGE.js → chunk-6H7GN3JL.js} +1064 -752
  32. package/{chunk-BGIWMGSP.js → chunk-6RCZYDDC.js} +10 -172
  33. package/{chunk-BYEJ7K2Z.js → chunk-7S4YWN7P.js} +1 -1
  34. package/{chunk-SREASRV5.js → chunk-ABQYVJBJ.js} +1 -1
  35. package/{chunk-MQ25G6VQ.js → chunk-AYT2OKNM.js} +3 -3
  36. package/{chunk-ERD7UXVL.js → chunk-BNMZ7QUV.js} +1 -1
  37. package/{chunk-PGSKWZCB.js → chunk-DS3SQTDT.js} +1 -1
  38. package/{chunk-QC5LGHYP.js → chunk-EXWOCYCR.js} +3 -3
  39. package/chunk-FMODTASJ.js +109 -0
  40. package/{chunk-SZLVDREM.js → chunk-GIG262ZG.js} +3 -3
  41. package/{chunk-FPTQQSS6.js → chunk-GRJTR4PU.js} +25 -4
  42. package/{chunk-PZM3EENV.js → chunk-GXWEF4IZ.js} +1 -1
  43. package/chunk-HJKGQPYF.js +266 -0
  44. package/{chunk-3JQ2NRYU.js → chunk-HVURBGF3.js} +4 -4
  45. package/{chunk-UPQF3C7O.js → chunk-IMDA4FW4.js} +102 -34
  46. package/{chunk-L2Y24GRM.js → chunk-IO7DYRPW.js} +3 -3
  47. package/{chunk-UZ6XXCVR.js → chunk-IZAWJCG7.js} +15 -2
  48. package/{chunk-2SFNAHL6.js → chunk-JC2WQS66.js} +34 -22
  49. package/{chunk-XWNRAIUL.js → chunk-JITSBA52.js} +6 -16
  50. package/{chunk-6XIE5ZGI.js → chunk-JPGCXHNM.js} +1 -1
  51. package/{chunk-PI4DWFYV.js → chunk-KO7QCXLL.js} +1132 -31
  52. package/{chunk-E36HZARC.js → chunk-KT6LENVP.js} +3 -3
  53. package/{chunk-N7DNNV6J.js → chunk-L2VNQQ7M.js} +78 -74
  54. package/{chunk-2R5EVB2O.js → chunk-LEYH5NOH.js} +5 -5
  55. package/{chunk-RXX4GDIH.js → chunk-LS2ZANRJ.js} +1 -1
  56. package/{chunk-4EJ5QYB5.js → chunk-LSV2BOJL.js} +1 -1
  57. package/{chunk-AFIKMMGC.js → chunk-MFW4BGJS.js} +1 -1
  58. package/{chunk-QH6NK22I.js → chunk-NVHJWYUO.js} +60 -788
  59. package/{chunk-Q6FF2MCK.js → chunk-OAJRZ35U.js} +1 -1
  60. package/{chunk-DSRXPQWA.js → chunk-OCL2YCAU.js} +7 -7
  61. package/{chunk-5J7W2VWW.js → chunk-OHUU52T3.js} +6 -265
  62. package/{chunk-V3ZKNK5D.js → chunk-OKCTLCKS.js} +9 -9
  63. package/chunk-P3AS5IPM.js +1624 -0
  64. package/{chunk-ZZCJUXUI.js → chunk-PHDKTASK.js} +2 -2
  65. package/{chunk-RILY7TKG.js → chunk-Q246OUG5.js} +9 -9
  66. package/{chunk-ZLPA7K55.js → chunk-Q4KVAB6L.js} +4 -4
  67. package/{chunk-AETZ7AD6.js → chunk-Q554LLSI.js} +1 -1
  68. package/{chunk-CGRJWXTE.js → chunk-S6STPUMG.js} +19 -15
  69. package/{chunk-K7AG465Q.js → chunk-T4F2EQGN.js} +4 -2
  70. package/{chunk-PYXL2CJL.js → chunk-TGRQUFLU.js} +1 -1
  71. package/{chunk-E6RGHPDR.js → chunk-UINEAQ2R.js} +3 -5
  72. package/{chunk-EXMHJN7C.js → chunk-UO66QKGI.js} +2 -2
  73. package/{chunk-BJCWNHVU.js → chunk-US463UAD.js} +2 -2
  74. package/{chunk-AJHEFRGJ.js → chunk-UWMQ6FPM.js} +4 -0
  75. package/{chunk-FSFQ3A7S.js → chunk-VARZWSKW.js} +9 -9
  76. package/{chunk-NHRQCXIQ.js → chunk-VMFTFOWF.js} +13 -3
  77. package/{chunk-3SPWIDHH.js → chunk-VQD6BTML.js} +3 -3
  78. package/{chunk-ZY4K4CZR.js → chunk-VW3YGKWR.js} +605 -91
  79. package/{chunk-G3O3PD6Q.js → chunk-W7PGACND.js} +14 -14
  80. package/{chunk-KIS76A2P.js → chunk-WSOMSDQB.js} +4 -4
  81. package/{chunk-CMH2SYHX.js → chunk-X77EN2BJ.js} +2 -2
  82. package/{chunk-MYU3MJCF.js → chunk-XCSSFPTB.js} +175 -7
  83. package/{chunk-QA6YKM3H.js → chunk-Y2IFJ7VM.js} +31 -3
  84. package/{chunk-UDQWGU7F.js → chunk-YZHP76TR.js} +1 -1
  85. package/{chunk-GBPZKFYK.js → chunk-ZIHJVHFH.js} +4 -4
  86. package/{chunk-DWPNOYMB.js → chunk-ZKGIAM7I.js} +1 -1
  87. package/chunk-ZSG2AQU4.js +626 -0
  88. package/{contentThunks-3BFZJFHI.js → contentThunks-Y2ACIFDB.js} +23 -23
  89. package/{createAgentAutomationAction-YCWUKLMK.js → createAgentAutomationAction-TNE3QMJR.js} +23 -23
  90. package/{createDialogAction-VULS2PKA.js → createDialogAction-BMGHBTQB.js} +26 -26
  91. package/{createPageAction-MZZLQPFE.js → createPageAction-FFNIZPIS.js} +24 -24
  92. package/{dbSlice-GKGGFNOB.js → dbSlice-4CUQE35F.js} +7 -7
  93. package/{deleteFile-LWSR674W.js → deleteFile-YG6QMJLU.js} +3 -3
  94. package/{dialogCommands-G223U5WU.js → dialogCommands-3JC3BIXC.js} +28 -27
  95. package/{dialogSlice-NQO5ZETL.js → dialogSlice-3E7Z7HZV.js} +22 -22
  96. package/{docCreateCommands-2P47IJDK.js → docCreateCommands-6LNQLCTA.js} +28 -27
  97. package/{docDeleteCommands-N3EGDOIC.js → docDeleteCommands-ZJOAPWZS.js} +29 -28
  98. package/{docReadCommands-6BFV2HI7.js → docReadCommands-LJTRSBG6.js} +28 -27
  99. package/{docStore-AEJONTM4.js → docStore-R47ABXBB.js} +8 -8
  100. package/{docUpdateCommands-ZTMPXHC5.js → docUpdateCommands-7P3QF3N2.js} +28 -27
  101. package/{fetchMessages-DRABNDPZ.js → fetchMessages-EIU7UFFK.js} +3 -4
  102. package/{getPricing-HRMSOF3E.js → getPricing-TV6ZB7ES.js} +4 -4
  103. package/{handleSendMessageAction-WIUO466V.js → handleSendMessageAction-FFYOGXAO.js} +22 -22
  104. package/index.js +61 -53
  105. package/{localDialogRead-PUQKFI73.js → localDialogRead-BTFJ4V2I.js} +2 -2
  106. package/{localRuntimeDb-P37ZTX55.js → localRuntimeDb-SYQGUF4U.js} +1 -1
  107. package/{machineCommands-FUA7HBND.js → machineCommands-FN5GGQV3.js} +52 -51
  108. package/{machineWsRunDispatch-URIG5N2V.js → machineWsRunDispatch-H47IA7ZT.js} +50 -49
  109. package/{memberThunks-KATHH3F4.js → memberThunks-N35XAOC6.js} +8 -8
  110. package/{models-GS72DVJS.js → models-CMXFDBQH.js} +2 -2
  111. package/package.json +1 -1
  112. package/providerPresetApply-D2GGHPI7.js +214 -0
  113. package/providerRegistry-MU6C4ABD.js +31 -0
  114. package/{read-LC6HVYBN.js → read-2PV4PN2E.js} +4 -3
  115. package/{readDocTool-N3ERJHHF.js → readDocTool-FGK5XGAW.js} +1 -1
  116. package/{readlineWorkspace-HVQLD7T3.js → readlineWorkspace-2RP77YDN.js} +133 -74
  117. package/{removeDialogAgentAction-F5GPTALR.js → removeDialogAgentAction-O2POGBOE.js} +10 -10
  118. package/{runAgentClientLoop-QHL2HNAI.js → runAgentClientLoop-CEBV5UPD.js} +41 -41
  119. package/{runtimeDoctorCommands-CROTMULY.js → runtimeDoctorCommands-X6WDBEQX.js} +2 -2
  120. package/{setDialogExtraReferencesAction-AY4ZCF3A.js → setDialogExtraReferencesAction-KPSVVY3C.js} +8 -8
  121. package/{setPrimaryDialogAgentAction-HPMG7V3R.js → setPrimaryDialogAgentAction-RMJETONI.js} +10 -10
  122. package/{settingSlice-OEJA4NQO.js → settingSlice-I6MTTNDX.js} +9 -9
  123. package/{spaceCommands-MRP5U3C3.js → spaceCommands-JHT4ALCQ.js} +26 -25
  124. package/{streamAgentChatTurn-CE2H23VD.js → streamAgentChatTurn-SFCZP4GY.js} +49 -50
  125. package/{switchDialogAgentAction-HMDZTZ4I.js → switchDialogAgentAction-OQSGWVQQ.js} +7 -7
  126. package/{tools-F25QG6XS.js → tools-K3YOTESV.js} +37 -35
  127. package/{tuiSummaryLlmCaller-3Z24VUWM.js → tuiSummaryLlmCaller-T2OA5ZVB.js} +14 -14
  128. package/{updateDialogTitleAction-Z333XUN4.js → updateDialogTitleAction-CSPKYQRO.js} +23 -23
  129. package/chunk-3IT2PFHL.js +0 -611
  130. package/chunk-I42VC5KR.js +0 -15
  131. package/codingSkills-E6KSDNSJ.js +0 -48
  132. package/{chunk-3RAG2NAD.js → chunk-UKWGR5SS.js} +3 -3
  133. package/{db-VQSAOWAO.js → db-WK5MDZVN.js} +1 -1
  134. package/{localRuntimeAuthority-R5UBODT3.js → localRuntimeAuthority-6IR6BBXE.js} +3 -3
@@ -8,7 +8,10 @@ import {
8
8
  readSseFrames,
9
9
  streamSseDataValues,
10
10
  throwIfChatCompletionStreamFailed
11
- } from "./chunk-QC5LGHYP.js";
11
+ } from "./chunk-EXWOCYCR.js";
12
+ import {
13
+ DEVIN_CONNECT_URL
14
+ } from "./chunk-FMODTASJ.js";
12
15
  import {
13
16
  clipToolText,
14
17
  hasImageInRuntimeMessages,
@@ -16,7 +19,7 @@ import {
16
19
  resolveHistoricalToolContentCap,
17
20
  resolveToolOutputProfile,
18
21
  stripImagePartsFromMessages
19
- } from "./chunk-KIS76A2P.js";
22
+ } from "./chunk-WSOMSDQB.js";
20
23
  import {
21
24
  downgradeUnparsableToolCalls,
22
25
  hasParsableObjectArguments,
@@ -40,7 +43,7 @@ import {
40
43
  requiresBareImageUrl,
41
44
  resolveToolGuidedSections,
42
45
  toBareImageUrlMessages
43
- } from "./chunk-ZLPA7K55.js";
46
+ } from "./chunk-Q4KVAB6L.js";
44
47
  import {
45
48
  convertMessagesToResponsesInput,
46
49
  extractReasoningFromResponseOutput,
@@ -51,15 +54,6 @@ import {
51
54
  toOpenAiCompatibleMessages,
52
55
  toResponsesTools
53
56
  } from "./chunk-PUOC4YRO.js";
54
- import {
55
- getAntigravityUserAgent,
56
- readAntigravityProjectId,
57
- resolveAntigravityCloudCodeBaseUrl
58
- } from "./chunk-PGSKWZCB.js";
59
- import {
60
- buildProviderAuthHeaders,
61
- buildProviderExecutionPlan
62
- } from "./chunk-CMH2SYHX.js";
63
57
  import {
64
58
  BRIDGE_STREAM_MAX_CHARS,
65
59
  DEFAULT_READ_DIALOG_MAX_RESPONSE_CHARS,
@@ -73,7 +67,16 @@ import {
73
67
  parseNoloWorkspaceToolArguments,
74
68
  readTextStreamUpToChars,
75
69
  resolveNoloDialogInput
76
- } from "./chunk-V3ZKNK5D.js";
70
+ } from "./chunk-OKCTLCKS.js";
71
+ import {
72
+ getAntigravityUserAgent,
73
+ readAntigravityProjectId,
74
+ resolveAntigravityCloudCodeBaseUrl
75
+ } from "./chunk-DS3SQTDT.js";
76
+ import {
77
+ buildProviderAuthHeaders,
78
+ buildProviderExecutionPlan
79
+ } from "./chunk-X77EN2BJ.js";
77
80
  import {
78
81
  buildDialogFallbackTitleFromUserInput
79
82
  } from "./chunk-2MBTWINN.js";
@@ -87,7 +90,7 @@ import {
87
90
  resolveEmptyAssistantFallbackMessage,
88
91
  resolveEmptyAssistantOutcome,
89
92
  resolveTruncatedReasoningTailLog
90
- } from "./chunk-DSRXPQWA.js";
93
+ } from "./chunk-OCL2YCAU.js";
91
94
  import {
92
95
  COMPACTION_SUMMARY_SCHEMA_VERSION,
93
96
  COMPACTION_SUMMARY_SYSTEM_PROMPT,
@@ -106,7 +109,7 @@ import {
106
109
  resolveCompressionTriggerRatio,
107
110
  truncateToolOutputForContext,
108
111
  withProviderCallTimingFields
109
- } from "./chunk-E36HZARC.js";
112
+ } from "./chunk-KT6LENVP.js";
110
113
  import {
111
114
  estimateTokenCount
112
115
  } from "./chunk-PSCNXBYA.js";
@@ -130,27 +133,25 @@ import {
130
133
  asRecordOrEmpty
131
134
  } from "./chunk-KX6YBIHG.js";
132
135
  import {
136
+ asTrimmedNonEmptyStringArray,
133
137
  dialogMessageKey,
134
138
  dialogMessageRange
135
- } from "./chunk-NHRQCXIQ.js";
139
+ } from "./chunk-VMFTFOWF.js";
136
140
  import {
137
141
  asOptionalFiniteNumber
138
142
  } from "./chunk-WWC7I6TA.js";
139
- import {
140
- asTrimmedNonEmptyStringArray
141
- } from "./chunk-I42VC5KR.js";
142
143
  import {
143
144
  asTrimmedLowercaseString
144
145
  } from "./chunk-QSJ3HFEF.js";
146
+ import {
147
+ isRecord
148
+ } from "./chunk-KUG52IAP.js";
145
149
  import {
146
150
  asTrimmedString
147
151
  } from "./chunk-3EUW3WEO.js";
148
152
  import {
149
153
  asOptionalPositiveFiniteNumber
150
154
  } from "./chunk-U6VC4MU4.js";
151
- import {
152
- isRecord
153
- } from "./chunk-KUG52IAP.js";
154
155
  import {
155
156
  normalizeServerOrigin
156
157
  } from "./chunk-CF7PE763.js";
@@ -15568,13 +15569,13 @@ var DEFAULT_LOCAL_TOOLS = /* @__PURE__ */ new Set([
15568
15569
  "execShell",
15569
15570
  "launchProcess",
15570
15571
  "listProcesses",
15571
- // ProcessTask follow-up tools (Phase 1). Same tier as listProcesses: they
15572
- // observe/stop tasks the agent itself already spawned, so their blast radius
15573
- // is strictly narrower than launchProcess (which is default-enabled).
15572
+ // ProcessTask follow-up tools. Same tier as listProcesses: they observe/stop
15573
+ // tasks the agent itself already spawned, so their blast radius is strictly
15574
+ // narrower than launchProcess (which is default-enabled). Model-facing
15575
+ // follow-ups are taskWait/taskStop only — lifecycle history (taskLogs) stays
15576
+ // runtime-internal.
15574
15577
  "taskWait",
15575
- "taskLogs",
15576
15578
  "taskStop",
15577
- "tasks",
15578
15579
  // Scheduling tools: forking/observing sub-agents is a declared capability
15579
15580
  // of capable agents, and the blast radius is strictly narrower than
15580
15581
  // execShell (already default-enabled). Requiring an env allowlist for these
@@ -16210,6 +16211,24 @@ var ProcessTaskEventLog = class {
16210
16211
  };
16211
16212
 
16212
16213
  // packages/agent-runtime/processRegistry.ts
16214
+ function toProcessTaskView(record) {
16215
+ const capsule = record.resultCapsule;
16216
+ return {
16217
+ taskId: record.taskId,
16218
+ pid: record.pid,
16219
+ pgid: record.pgid,
16220
+ command: record.command,
16221
+ label: record.label,
16222
+ startedAt: record.startedAt,
16223
+ status: record.status,
16224
+ ...record.exitCode !== void 0 ? { exitCode: record.exitCode } : {},
16225
+ persist: record.persist,
16226
+ promoted: record.promoted,
16227
+ transient: record.transient,
16228
+ ...capsule?.durationMs !== void 0 ? { durationMs: capsule.durationMs } : {},
16229
+ ...capsule?.spill ? { outputRef: capsule.spill.displayPath } : {}
16230
+ };
16231
+ }
16213
16232
  var taskIdCounter = 0;
16214
16233
  function mintTaskId(pid) {
16215
16234
  taskIdCounter += 1;
@@ -16265,7 +16284,7 @@ var ProcessRegistry = class {
16265
16284
  startedAt: Date.now(),
16266
16285
  status: "running",
16267
16286
  persist: proc.persist ?? false,
16268
- promoted: false,
16287
+ promoted: proc.promoted ?? false,
16269
16288
  transient: proc.transient ?? false,
16270
16289
  owner: proc.owner ?? null
16271
16290
  };
@@ -16362,7 +16381,8 @@ var ProcessRegistry = class {
16362
16381
  pid,
16363
16382
  label: item.label,
16364
16383
  command: item.command,
16365
- status: "stopped"
16384
+ status: "stopped",
16385
+ promoted: item.promoted
16366
16386
  });
16367
16387
  return true;
16368
16388
  }
@@ -16391,15 +16411,17 @@ var ProcessRegistry = class {
16391
16411
  pid: item.pid,
16392
16412
  label: item.label,
16393
16413
  command: item.command,
16394
- status: "stopped"
16414
+ status: "stopped",
16415
+ promoted: item.promoted
16395
16416
  });
16396
16417
  }
16397
16418
  }
16398
16419
  }
16399
- markExited(pid, exitCode) {
16420
+ markExited(pid, exitCode, resultCapsule) {
16400
16421
  const item = this.processes.get(pid);
16401
16422
  if (item && item.status === "running") {
16402
16423
  item.exitCode = exitCode;
16424
+ if (resultCapsule) item.resultCapsule = resultCapsule;
16403
16425
  item.status = exitCode === 0 ? "exited" : "failed";
16404
16426
  this.eventLog.append({
16405
16427
  taskId: item.taskId,
@@ -16413,7 +16435,9 @@ var ProcessRegistry = class {
16413
16435
  label: item.label,
16414
16436
  command: item.command,
16415
16437
  status: item.status,
16416
- exitCode
16438
+ exitCode,
16439
+ promoted: item.promoted,
16440
+ ...item.resultCapsule ? { resultCapsule: item.resultCapsule } : {}
16417
16441
  });
16418
16442
  }
16419
16443
  }
@@ -16476,6 +16500,62 @@ function readProcessOwner(runtimeContext) {
16476
16500
  // packages/agent-runtime/workspaceShell.ts
16477
16501
  import { resolve as resolve3 } from "node:path";
16478
16502
  import { spawn as spawnChildProcess2 } from "node:child_process";
16503
+
16504
+ // packages/agent-runtime/processTaskResult.ts
16505
+ var PROCESS_RESULT_CAPSULE_TAIL_CHARS = 4e3;
16506
+ var PROCESS_RESULT_CAPSULE_SPILL_THRESHOLD_CHARS = 2e4;
16507
+ function tailText(value, maxChars) {
16508
+ if (value.length <= maxChars) return { text: value, truncated: false };
16509
+ return { text: value.slice(-maxChars), truncated: true };
16510
+ }
16511
+ function formatCapsuleStream(name, value) {
16512
+ return value.trim() ? `${name}:
16513
+ ${value.replace(/\n+$/, "")}` : "";
16514
+ }
16515
+ function buildProcessTaskResultCapsule(args2) {
16516
+ const tailChars = args2.tailChars ?? PROCESS_RESULT_CAPSULE_TAIL_CHARS;
16517
+ const spillThresholdChars = args2.spillThresholdChars ?? PROCESS_RESULT_CAPSULE_SPILL_THRESHOLD_CHARS;
16518
+ const stdout = typeof args2.stdout === "string" ? args2.stdout : "";
16519
+ const stderr = typeof args2.stderr === "string" ? args2.stderr : "";
16520
+ const exitCode = args2.exitCode;
16521
+ const captureError = args2.captureError?.trim() || void 0;
16522
+ const durationMs = typeof args2.startedAt === "number" && Number.isFinite(args2.startedAt) ? Math.max(0, (args2.endedAt ?? Date.now()) - args2.startedAt) : void 0;
16523
+ const stdoutTail = tailText(stdout, tailChars);
16524
+ const stderrTail = tailText(stderr, tailChars);
16525
+ const inlineSize = stdout.length + stderr.length;
16526
+ const inlineTruncated = stdoutTail.truncated || stderrTail.truncated;
16527
+ const shouldSpill = inlineTruncated || inlineSize > spillThresholdChars;
16528
+ let spill;
16529
+ if (shouldSpill) {
16530
+ try {
16531
+ const result4 = spillToolOutput({
16532
+ content: [
16533
+ formatCapsuleStream("stdout", stdout),
16534
+ formatCapsuleStream("stderr", stderr)
16535
+ ].filter(Boolean).join("\n\n"),
16536
+ toolName: "execShell",
16537
+ ...args2.workspaceRoot !== void 0 ? { workspaceRoot: args2.workspaceRoot } : {}
16538
+ });
16539
+ spill = {
16540
+ displayPath: result4.displayPath,
16541
+ totalChars: result4.totalChars,
16542
+ totalLines: result4.totalLines
16543
+ };
16544
+ } catch {
16545
+ }
16546
+ }
16547
+ return {
16548
+ stdout: stdoutTail.text,
16549
+ stderr: stderrTail.text,
16550
+ exitCode,
16551
+ ...durationMs !== void 0 ? { durationMs } : {},
16552
+ ...captureError ? { captureError } : {},
16553
+ truncated: inlineTruncated || Boolean(captureError),
16554
+ ...spill ? { spill } : {}
16555
+ };
16556
+ }
16557
+
16558
+ // packages/agent-runtime/workspaceShell.ts
16479
16559
  var EXEC_SHELL_TIMEOUT_ENV = "NOLO_EXEC_SHELL_TIMEOUT_MS";
16480
16560
  var EXEC_SHELL_DETACH_ENV = "NOLO_EXEC_SHELL_DETACH_MS";
16481
16561
  var DEFAULT_EXEC_SHELL_DETACH_MS = 12e4;
@@ -16855,6 +16935,15 @@ ${stderr.trim()}`, "exitCode: 127"].filter(Boolean).join("\n\n"),
16855
16935
  )
16856
16936
  };
16857
16937
  }
16938
+ function stdoutPromiseResult(promise3) {
16939
+ return promise3.then(
16940
+ (value) => ({ value }),
16941
+ (error) => ({
16942
+ value: "",
16943
+ error: error instanceof Error ? error.message : String(error)
16944
+ })
16945
+ );
16946
+ }
16858
16947
  async function runWorkspaceCommand(args2) {
16859
16948
  const timeoutMs = asOptionalPositiveFiniteNumber(args2.timeoutMs);
16860
16949
  const detached = process.platform !== "win32";
@@ -16913,8 +17002,8 @@ async function runWorkspaceCommand(args2) {
16913
17002
  process.removeListener("SIGINT", cleanupChildOnHostSignal);
16914
17003
  };
16915
17004
  exitPromise.then(detachSignalCleanup, detachSignalCleanup);
16916
- const stdoutPromise = readNodeStream(proc.stdout);
16917
- const stderrPromise = readNodeStream(proc.stderr);
17005
+ const stdoutCapture = stdoutPromiseResult(readNodeStream(proc.stdout));
17006
+ const stderrCapture = stdoutPromiseResult(readNodeStream(proc.stderr));
16918
17007
  const killChild = (signal) => {
16919
17008
  if (detached && typeof proc.pid === "number") {
16920
17009
  try {
@@ -17007,12 +17096,36 @@ async function runWorkspaceCommand(args2) {
17007
17096
  pgid,
17008
17097
  command: args2.command.join(" "),
17009
17098
  label,
17099
+ promoted: true,
17010
17100
  owner: args2.owner ?? null
17011
17101
  });
17012
17102
  const taskId = envelope.taskId;
17013
17103
  proc.on("close", (code) => {
17014
17104
  detachSignalCleanup();
17015
- registry2.markExited(pid, code ?? 1);
17105
+ const exitCode2 = code ?? 1;
17106
+ void (async () => {
17107
+ const [stdoutResult, stderrResult] = await Promise.all([
17108
+ stdoutCapture,
17109
+ stderrCapture
17110
+ ]);
17111
+ const stdout2 = stdoutResult.value;
17112
+ const stderr2 = stderrResult.value;
17113
+ let capsule;
17114
+ try {
17115
+ capsule = buildProcessTaskResultCapsule({
17116
+ stdout: stdout2,
17117
+ stderr: stderr2,
17118
+ exitCode: exitCode2,
17119
+ // Duration is measured from the registry envelope's startedAt
17120
+ // (spawn moment), not from the detach moment.
17121
+ startedAt: registry2.get(pid)?.startedAt,
17122
+ workspaceRoot: args2.workspaceRoot,
17123
+ captureError: [stdoutResult.error, stderrResult.error].filter(Boolean).join("; ")
17124
+ });
17125
+ } catch {
17126
+ }
17127
+ registry2.markExited(pid, exitCode2, capsule);
17128
+ })();
17016
17129
  });
17017
17130
  const immediate = effectiveDetachMs === 0;
17018
17131
  const reason = immediate ? `command looks long-running; moved to background immediately (pid=${pid}, label=${label})` : `command detached to background after ${effectiveDetachMs}ms (pid=${pid}, label=${label})`;
@@ -17036,10 +17149,13 @@ Use listProcesses to inspect or stop it.`,
17036
17149
  })
17037
17150
  };
17038
17151
  }
17039
- const [stdout, rawStderr] = await Promise.all([
17040
- stdoutPromise,
17041
- stderrPromise
17152
+ const [stdoutCaptureResult, stderrCaptureResult] = await Promise.all([
17153
+ stdoutCapture,
17154
+ stderrCapture
17042
17155
  ]);
17156
+ const stdout = stdoutCaptureResult.value;
17157
+ const rawStderr = stderrCaptureResult.value;
17158
+ const streamCaptureError = [stdoutCaptureResult.error, stderrCaptureResult.error].filter(Boolean).join("; ");
17043
17159
  const exitCode = aborted ? 130 : timedOut ? 124 : Number(raceWinner);
17044
17160
  if (typeof proc.pid === "number") {
17045
17161
  registry2.completeTransient(proc.pid, exitCode);
@@ -17456,9 +17572,7 @@ var WORKSPACE_TOOL_NAMES = [
17456
17572
  "launchProcess",
17457
17573
  "listProcesses",
17458
17574
  "taskWait",
17459
- "taskLogs",
17460
17575
  "taskStop",
17461
- "tasks",
17462
17576
  "openDesktopPreview"
17463
17577
  ];
17464
17578
  var SHELL_TOOL_NAMES = [
@@ -17466,9 +17580,7 @@ var SHELL_TOOL_NAMES = [
17466
17580
  "launchProcess",
17467
17581
  "listProcesses",
17468
17582
  "taskWait",
17469
- "taskLogs",
17470
- "taskStop",
17471
- "tasks"
17583
+ "taskStop"
17472
17584
  ];
17473
17585
  var WORKSPACE_TOOL_NAME_SET = new Set(WORKSPACE_TOOL_NAMES);
17474
17586
  function buildWorkspacePathProperty() {
@@ -17717,7 +17829,7 @@ function buildTaskWaitTool() {
17717
17829
  type: "function",
17718
17830
  function: {
17719
17831
  name: "taskWait",
17720
- description: 'Block until a background task (from launchProcess, or an execShell command that detached) reaches a terminal state, or until timeoutMs elapses. Returns {outcome, status, exitCode?, cursor, events}: outcome "terminal" with status exited|failed|stopped when it finished, outcome "timeout" with status "running" when it outlived the whole budget, outcome "not-found" for an unknown taskId, or outcome "evicted" when the event trail aged out (never wait again in that case). One call already waits the maximum budget and returns the moment the task ends, so a "timeout" means the task is genuinely longer than that \u2014 go do other work and come back, rather than re-waiting in a loop (each re-wait costs a full model round-trip). For a cheap liveness peek use taskLogs (non-blocking) or pass a small timeoutMs. `cursor` is the highest event seq covered by this response \u2014 pass it to taskLogs to read only newer events.',
17832
+ description: 'Block until a background task (from launchProcess, or an execShell command that detached) reaches a terminal state, or until timeoutMs elapses. Returns {outcome, status, exitCode?, cursor, events}: outcome "terminal" with status exited|failed|stopped when it finished, outcome "timeout" with status "running" when it outlived the whole budget, outcome "not-found" for an unknown taskId, or outcome "evicted" when the event trail aged out (never wait again in that case). One call already waits the maximum budget and returns the moment the task ends, so a "timeout" means the task is genuinely longer than that \u2014 go do other work and come back, rather than re-waiting in a loop (each re-wait costs a full model round-trip). Pass a small timeoutMs for a cheap liveness peek instead of the full result. `cursor` is the highest event seq covered by this response.',
17721
17833
  parameters: {
17722
17834
  type: "object",
17723
17835
  properties: {
@@ -17736,30 +17848,6 @@ function buildTaskWaitTool() {
17736
17848
  }
17737
17849
  };
17738
17850
  }
17739
- function buildTaskLogsTool() {
17740
- return {
17741
- type: "function",
17742
- function: {
17743
- name: "taskLogs",
17744
- description: "Read a background task's lifecycle events incrementally. Returns {outcome, status, cursor, events} where events are the started|promoted|exited|killed records with seq greater than the cursor you passed, and the returned `cursor` is the new high-water mark to pass next time (omit cursor to read from the beginning; repeating the same cursor is idempotent). Oversized output is spilled to a file and reported as `logRef`, which you can open with readFile.",
17745
- parameters: {
17746
- type: "object",
17747
- properties: {
17748
- taskId: {
17749
- type: "string",
17750
- minLength: 1,
17751
- description: "Task id returned by launchProcess or by a detached execShell result."
17752
- },
17753
- cursor: {
17754
- type: "number",
17755
- description: "Last event seq you already consumed; only events with a higher seq are returned. Defaults to 0 (all retained events)."
17756
- }
17757
- },
17758
- required: ["taskId"]
17759
- }
17760
- }
17761
- };
17762
- }
17763
17851
  function buildTaskStopTool() {
17764
17852
  return {
17765
17853
  type: "function",
@@ -17780,19 +17868,6 @@ function buildTaskStopTool() {
17780
17868
  }
17781
17869
  };
17782
17870
  }
17783
- function buildTasksTool() {
17784
- return {
17785
- type: "function",
17786
- function: {
17787
- name: "tasks",
17788
- description: "List background tasks you can still wait on, read logs from, or stop. Returns {count, tasks: {taskId, pid, label, status, startedAt, persist}[]}. Use it to recover a taskId you lost track of; foreground commands still running inside execShell are not listed.",
17789
- parameters: {
17790
- type: "object",
17791
- properties: {}
17792
- }
17793
- }
17794
- };
17795
- }
17796
17871
  function buildWorkspaceToolDefinition(toolName) {
17797
17872
  if (toolName === "readFile") {
17798
17873
  return buildReadWorkspaceFileTool();
@@ -17812,9 +17887,7 @@ function buildWorkspaceToolDefinition(toolName) {
17812
17887
  if (toolName === "openDesktopPreview") return buildOpenDesktopPreviewTool();
17813
17888
  if (toolName === "listProcesses") return buildListProcessesTool();
17814
17889
  if (toolName === "taskWait") return buildTaskWaitTool();
17815
- if (toolName === "taskLogs") return buildTaskLogsTool();
17816
17890
  if (toolName === "taskStop") return buildTaskStopTool();
17817
- if (toolName === "tasks") return buildTasksTool();
17818
17891
  return null;
17819
17892
  }
17820
17893
  function filterDeclaredWorkspaceToolNames(args2) {
@@ -18923,7 +18996,7 @@ async function launchProcessTool(args2) {
18923
18996
  };
18924
18997
  }
18925
18998
  async function listProcessesTool(args2) {
18926
- const list = getProcessRegistry().list();
18999
+ const list = getProcessRegistry().list().map(toProcessTaskView);
18927
19000
  return {
18928
19001
  content: JSON.stringify(list),
18929
19002
  metadata: {
@@ -19280,15 +19353,23 @@ function buildLoadSkillExecutor(args2) {
19280
19353
  const { resolveSkillByName } = await import("./skillDiscovery-CYUCJMAG.js");
19281
19354
  const resolved = resolveSkillByName(args2.cwd, name);
19282
19355
  if (!resolved) {
19283
- const { resolveCodingBuiltinSlug, buildCodingSkillContentBySlug } = await import("./codingSkills-E6KSDNSJ.js");
19284
- const builtinSlug = resolveCodingBuiltinSlug(name);
19285
- if (builtinSlug) {
19286
- const body = buildCodingSkillContentBySlug(builtinSlug);
19356
+ const { resolveBuiltinSkillByName } = await import("./builtinSkillRegistry-5SYVTS6Z.js");
19357
+ const builtin = resolveBuiltinSkillByName(name);
19358
+ if (builtin) {
19287
19359
  return {
19288
19360
  content: `Skill "${name}" loaded inline. Follow its instructions.
19289
19361
 
19290
- ${body}`,
19291
- metadata: { loadSkill: true, resolved: true, name, requestedName: name, builtin: true }
19362
+ ${builtin.content}`,
19363
+ // toolNames 进 metadata:回退面已扩到全注册表,其中授工具型 skill
19364
+ // (search-* 等)的工具在本宿主未必接线,宿主可据此降级提示。
19365
+ metadata: {
19366
+ loadSkill: true,
19367
+ resolved: true,
19368
+ name,
19369
+ requestedName: name,
19370
+ builtin: true,
19371
+ ...builtin.config.toolNames?.length ? { toolNames: [...builtin.config.toolNames] } : {}
19372
+ }
19292
19373
  };
19293
19374
  }
19294
19375
  return {
@@ -20059,6 +20140,437 @@ async function fetchAntigravityCloudCodeCompletion(args2) {
20059
20140
  return normalized;
20060
20141
  }
20061
20142
 
20143
+ // packages/agent-runtime/devin/devinProvider.ts
20144
+ import { randomBytes, randomUUID as randomUUID2 } from "node:crypto";
20145
+ var CLIENT_NAME = "chisel";
20146
+ var CLIENT_VERSION = "2026.8.18";
20147
+ function writeVarint(fieldNum, value) {
20148
+ const tag = fieldNum << 3 | 0;
20149
+ const bytes = [];
20150
+ let t = tag;
20151
+ while (t >= 128) {
20152
+ bytes.push(t & 127 | 128);
20153
+ t >>>= 7;
20154
+ }
20155
+ bytes.push(t);
20156
+ let v = value;
20157
+ while (v >= 128) {
20158
+ bytes.push(v & 127 | 128);
20159
+ v >>>= 7;
20160
+ }
20161
+ bytes.push(v);
20162
+ return Buffer.from(bytes);
20163
+ }
20164
+ function writeLengthDelimited(fieldNum, content) {
20165
+ const tag = fieldNum << 3 | 2;
20166
+ const tagBytes = [];
20167
+ let t = tag;
20168
+ while (t >= 128) {
20169
+ tagBytes.push(t & 127 | 128);
20170
+ t >>>= 7;
20171
+ }
20172
+ tagBytes.push(t);
20173
+ const lenBytes = [];
20174
+ let len = content.length;
20175
+ while (len >= 128) {
20176
+ lenBytes.push(len & 127 | 128);
20177
+ len >>>= 7;
20178
+ }
20179
+ lenBytes.push(len);
20180
+ return Buffer.concat([Buffer.from(tagBytes), Buffer.from(lenBytes), content]);
20181
+ }
20182
+ function writeStringField(fieldNum, str) {
20183
+ return writeLengthDelimited(fieldNum, Buffer.from(str, "utf8"));
20184
+ }
20185
+ function writeMessageField(fieldNum, message) {
20186
+ return writeLengthDelimited(fieldNum, message);
20187
+ }
20188
+ function generateFingerprint() {
20189
+ return randomBytes(366).toString("hex");
20190
+ }
20191
+ function encodeDevinClientMetadata(token) {
20192
+ return Buffer.concat([
20193
+ writeStringField(1, CLIENT_NAME),
20194
+ writeStringField(2, CLIENT_VERSION),
20195
+ writeStringField(3, token),
20196
+ writeStringField(4, "en"),
20197
+ writeStringField(5, process.platform === "win32" ? "windows" : "linux"),
20198
+ writeStringField(7, CLIENT_VERSION),
20199
+ writeStringField(12, CLIENT_NAME),
20200
+ writeStringField(31, generateFingerprint())
20201
+ ]);
20202
+ }
20203
+ function encodeDevinChatMessage(msg) {
20204
+ const source = msg.role === "assistant" ? 2 : msg.role === "tool" ? 4 : 1;
20205
+ return Buffer.concat([
20206
+ writeStringField(1, randomUUID2()),
20207
+ writeVarint(2, source),
20208
+ writeStringField(3, msg.text),
20209
+ ...(msg.toolCalls ?? []).map(
20210
+ (toolCall) => writeMessageField(
20211
+ 6,
20212
+ Buffer.concat([
20213
+ writeStringField(1, toolCall.id),
20214
+ writeStringField(2, toolCall.function.name),
20215
+ writeStringField(3, toolCall.function.arguments)
20216
+ ])
20217
+ )
20218
+ ),
20219
+ ...msg.toolCallId ? [writeStringField(7, msg.toolCallId)] : []
20220
+ ]);
20221
+ }
20222
+ function encodeDevinToolDefinition(tool) {
20223
+ const fn3 = tool.function ?? {};
20224
+ const name = typeof fn3.name === "string" ? fn3.name : "";
20225
+ const description = typeof fn3.description === "string" ? fn3.description : "";
20226
+ const parameters = fn3.parameters ?? {};
20227
+ return Buffer.concat([
20228
+ writeStringField(1, name),
20229
+ writeStringField(2, description.length > 6998 ? `${description.slice(0, 6995)}...` : description),
20230
+ writeStringField(3, JSON.stringify(parameters))
20231
+ ]);
20232
+ }
20233
+ function writeFixed64Field(fieldNum, val) {
20234
+ const b = Buffer.alloc(8);
20235
+ b.writeDoubleLE(val, 0);
20236
+ const tag = fieldNum << 3 | 1;
20237
+ const tagBytes = [];
20238
+ let t = tag;
20239
+ while (t >= 128) {
20240
+ tagBytes.push(t & 127 | 128);
20241
+ t >>>= 7;
20242
+ }
20243
+ tagBytes.push(t);
20244
+ return Buffer.concat([Buffer.from(tagBytes), b]);
20245
+ }
20246
+ function buildCompletionConfig(params) {
20247
+ const maxTokens = params?.maxTokens ?? 128e3;
20248
+ const maxNewlines = params?.maxNewlines ?? 400;
20249
+ const temp = params?.temperature ?? 1;
20250
+ const topP = params?.topP ?? 0.95;
20251
+ return Buffer.concat([
20252
+ writeVarint(1, 1),
20253
+ writeVarint(2, maxTokens),
20254
+ writeVarint(3, maxNewlines),
20255
+ writeFixed64Field(5, temp),
20256
+ writeVarint(7, 40),
20257
+ writeFixed64Field(8, topP)
20258
+ ]);
20259
+ }
20260
+ function buildGetChatMessageRequest(params) {
20261
+ const { token, messages, model, tools = [], temperature } = params;
20262
+ const metadata = encodeDevinClientMetadata(token);
20263
+ let systemPrompt = "";
20264
+ const filteredMessages = [];
20265
+ for (const m of messages) {
20266
+ const text = typeof m.content === "string" ? m.content : Array.isArray(m.content) ? m.content.filter((p) => p?.type === "text").map((p) => p.text).join("\n") : "";
20267
+ if (m.role === "system") {
20268
+ systemPrompt = systemPrompt ? `${systemPrompt}
20269
+
20270
+ ${text}` : text;
20271
+ } else if (m.role === "user" || m.role === "assistant" || m.role === "tool") {
20272
+ filteredMessages.push({
20273
+ role: m.role,
20274
+ text,
20275
+ ...m.tool_call_id ? { toolCallId: m.tool_call_id } : {},
20276
+ ...m.tool_calls?.length ? { toolCalls: m.tool_calls } : {}
20277
+ });
20278
+ }
20279
+ }
20280
+ const coalesced = [];
20281
+ for (const item of filteredMessages) {
20282
+ const last = coalesced[coalesced.length - 1];
20283
+ if (last && last.role === item.role && item.role !== "tool" && !last.toolCalls?.length && !item.toolCalls?.length) {
20284
+ last.text = `${last.text}
20285
+
20286
+ ${item.text}`;
20287
+ } else {
20288
+ coalesced.push({ ...item });
20289
+ }
20290
+ }
20291
+ const chatMessageBuffers = coalesced.map((m) => encodeDevinChatMessage(m));
20292
+ const completionConfig = buildCompletionConfig({ temperature });
20293
+ const modelConfig = Buffer.concat([
20294
+ writeStringField(1, randomUUID2()),
20295
+ writeVarint(2, 1),
20296
+ writeVarint(3, 4)
20297
+ ]);
20298
+ return Buffer.concat([
20299
+ writeMessageField(1, metadata),
20300
+ writeStringField(2, systemPrompt),
20301
+ ...chatMessageBuffers.map((b) => writeMessageField(3, b)),
20302
+ writeVarint(7, 5),
20303
+ writeMessageField(8, completionConfig),
20304
+ ...tools.map((tool) => writeMessageField(10, encodeDevinToolDefinition(tool))),
20305
+ writeMessageField(15, modelConfig),
20306
+ writeStringField(16, randomUUID2()),
20307
+ writeVarint(20, 1),
20308
+ writeStringField(21, model)
20309
+ ]);
20310
+ }
20311
+ function buildDevinConnectFrame(payload, flags = 0) {
20312
+ const header = Buffer.alloc(5);
20313
+ header[0] = flags & 255;
20314
+ header.writeUInt32BE(payload.length, 1);
20315
+ return Buffer.concat([header, payload]);
20316
+ }
20317
+ function parseDevinConnectFrames(buffer3) {
20318
+ const frames = [];
20319
+ let offset = 0;
20320
+ while (offset + 5 <= buffer3.length) {
20321
+ const flags = buffer3[offset];
20322
+ const length = buffer3.readUInt32BE(offset + 1);
20323
+ if (offset + 5 + length > buffer3.length) {
20324
+ break;
20325
+ }
20326
+ const payload = buffer3.subarray(offset + 5, offset + 5 + length);
20327
+ frames.push({ flags, payload });
20328
+ offset += 5 + length;
20329
+ }
20330
+ return {
20331
+ frames,
20332
+ remainder: buffer3.subarray(offset)
20333
+ };
20334
+ }
20335
+ function parseDevinConnectTrailer(payload) {
20336
+ const text = payload.toString("utf8").trim();
20337
+ if (!text || text === "{}") return null;
20338
+ try {
20339
+ const parsed = JSON.parse(text);
20340
+ if (!parsed.error) {
20341
+ return new Error(`Devin Connect invalid terminal trailer: ${text}`);
20342
+ }
20343
+ const code = typeof parsed.error.code === "string" ? parsed.error.code : "unknown";
20344
+ const message = typeof parsed.error.message === "string" ? parsed.error.message : "Unknown error";
20345
+ return new Error(`Devin Connect upstream error ${code}: ${message}`);
20346
+ } catch {
20347
+ return new Error(`Devin Connect invalid terminal trailer: ${text}`);
20348
+ }
20349
+ }
20350
+ function decodeDevinResponsePayload(payload) {
20351
+ let offset = 0;
20352
+ let content = "";
20353
+ let reasoning = "";
20354
+ let finishReason = null;
20355
+ const events = [];
20356
+ while (offset < payload.length) {
20357
+ let tag = 0;
20358
+ let shift = 0;
20359
+ while (offset < payload.length) {
20360
+ const b = payload[offset++];
20361
+ tag |= (b & 127) << shift;
20362
+ if (!(b & 128)) break;
20363
+ shift += 7;
20364
+ }
20365
+ const fieldNum = tag >>> 3;
20366
+ const wireType = tag & 7;
20367
+ if (wireType === 0) {
20368
+ let val = 0;
20369
+ let s = 0;
20370
+ while (offset < payload.length) {
20371
+ const b = payload[offset++];
20372
+ val |= (b & 127) << s;
20373
+ if (!(b & 128)) break;
20374
+ s += 7;
20375
+ }
20376
+ if (fieldNum === 5) {
20377
+ finishReason = val === 10 ? "tool_calls" : val === 1 || val === 3 ? "length" : "stop";
20378
+ }
20379
+ } else if (wireType === 2) {
20380
+ let len = 0;
20381
+ let s = 0;
20382
+ while (offset < payload.length) {
20383
+ const b = payload[offset++];
20384
+ len |= (b & 127) << s;
20385
+ if (!(b & 128)) break;
20386
+ s += 7;
20387
+ }
20388
+ const valBytes = payload.subarray(offset, offset + len);
20389
+ offset += len;
20390
+ if (fieldNum === 3) {
20391
+ const text = valBytes.toString("utf8");
20392
+ content += text;
20393
+ events.push({ type: "content", text });
20394
+ } else if (fieldNum === 9) {
20395
+ const text = valBytes.toString("utf8");
20396
+ reasoning += text;
20397
+ events.push({ type: "reasoning", text });
20398
+ } else if (fieldNum === 6) {
20399
+ let nestedOffset = 0;
20400
+ let id;
20401
+ let name;
20402
+ let argsDelta;
20403
+ while (nestedOffset < valBytes.length) {
20404
+ let nestedTag = 0;
20405
+ let nestedShift = 0;
20406
+ while (nestedOffset < valBytes.length) {
20407
+ const b = valBytes[nestedOffset++];
20408
+ nestedTag |= (b & 127) << nestedShift;
20409
+ if (!(b & 128)) break;
20410
+ nestedShift += 7;
20411
+ }
20412
+ const nestedField = nestedTag >>> 3;
20413
+ const nestedWire = nestedTag & 7;
20414
+ if (nestedWire !== 2) break;
20415
+ let nestedLength = 0;
20416
+ let lengthShift = 0;
20417
+ while (nestedOffset < valBytes.length) {
20418
+ const b = valBytes[nestedOffset++];
20419
+ nestedLength |= (b & 127) << lengthShift;
20420
+ if (!(b & 128)) break;
20421
+ lengthShift += 7;
20422
+ }
20423
+ const nestedValue = valBytes.subarray(nestedOffset, nestedOffset + nestedLength);
20424
+ nestedOffset += nestedLength;
20425
+ const text = nestedValue.toString("utf8");
20426
+ if (nestedField === 1) id = text;
20427
+ else if (nestedField === 2) name = text;
20428
+ else if (nestedField === 3) argsDelta = (argsDelta ?? "") + text;
20429
+ }
20430
+ if (id !== void 0 && name !== void 0) {
20431
+ events.push({ type: "tool-call-start", id, name });
20432
+ }
20433
+ if (argsDelta !== void 0) {
20434
+ events.push({ type: "tool-call-args", argsDelta, ...id ? { id } : {} });
20435
+ }
20436
+ }
20437
+ } else {
20438
+ break;
20439
+ }
20440
+ }
20441
+ return { content, reasoning, finishReason, events };
20442
+ }
20443
+ function createDevinProvider(options) {
20444
+ const { token, model = "swe-2", fetchImpl = fetch, tools = [], temperature } = options;
20445
+ return {
20446
+ model,
20447
+ async complete(messages, opts) {
20448
+ const selectedModel = model;
20449
+ const requestPayload = buildGetChatMessageRequest({
20450
+ token,
20451
+ messages,
20452
+ model: selectedModel,
20453
+ tools,
20454
+ temperature
20455
+ });
20456
+ const frame = buildDevinConnectFrame(requestPayload);
20457
+ const response = await fetchImpl(DEVIN_CONNECT_URL, {
20458
+ method: "POST",
20459
+ headers: {
20460
+ "authorization": `Basic ${token}-${token}`,
20461
+ "content-type": "application/connect+proto",
20462
+ "connect-protocol-version": "1"
20463
+ },
20464
+ body: new Uint8Array(frame),
20465
+ signal: opts?.signal
20466
+ });
20467
+ if (!response.ok) {
20468
+ const errText = await response.text().catch(() => "");
20469
+ throw new Error(
20470
+ `Devin Connect upstream returned error ${response.status}: ${errText}`
20471
+ );
20472
+ }
20473
+ if (!response.body) {
20474
+ throw new Error("Devin Connect response body is null");
20475
+ }
20476
+ let text = "";
20477
+ let reasoning = "";
20478
+ let finishReason = null;
20479
+ const toolCallOrder = [];
20480
+ const toolCallById = /* @__PURE__ */ new Map();
20481
+ let currentToolCallId = null;
20482
+ let buffer3 = Buffer.alloc(0);
20483
+ let sawTrailer = false;
20484
+ const reader = response.body.getReader();
20485
+ try {
20486
+ while (true) {
20487
+ const { done: done4, value } = await reader.read();
20488
+ if (done4) break;
20489
+ buffer3 = Buffer.concat([buffer3, Buffer.from(value)]);
20490
+ const { frames, remainder } = parseDevinConnectFrames(buffer3);
20491
+ buffer3 = Buffer.from(remainder);
20492
+ for (const f of frames) {
20493
+ if (sawTrailer) {
20494
+ throw new Error("Devin Connect received a frame after the terminal trailer");
20495
+ }
20496
+ if (f.flags & 2) {
20497
+ sawTrailer = true;
20498
+ const trailerError = parseDevinConnectTrailer(f.payload);
20499
+ if (trailerError) throw trailerError;
20500
+ continue;
20501
+ }
20502
+ const delta = decodeDevinResponsePayload(f.payload);
20503
+ text += delta.content;
20504
+ reasoning += delta.reasoning;
20505
+ if (delta.finishReason) finishReason = delta.finishReason;
20506
+ for (const event of delta.events) {
20507
+ if (event.type === "reasoning") {
20508
+ opts?.onReasoningDelta?.(event.text);
20509
+ } else if (event.type === "content") {
20510
+ opts?.onTextDelta?.(event.text);
20511
+ } else if (event.type === "tool-call-start") {
20512
+ const existing = toolCallById.get(event.id);
20513
+ if (existing) {
20514
+ existing.name = event.name;
20515
+ } else {
20516
+ toolCallOrder.push(event.id);
20517
+ toolCallById.set(event.id, {
20518
+ id: event.id,
20519
+ name: event.name,
20520
+ argumentsText: ""
20521
+ });
20522
+ }
20523
+ currentToolCallId = event.id;
20524
+ } else {
20525
+ const targetId = event.id ?? currentToolCallId;
20526
+ const target = targetId ? toolCallById.get(targetId) : void 0;
20527
+ if (target) target.argumentsText += event.argsDelta;
20528
+ }
20529
+ }
20530
+ }
20531
+ }
20532
+ } finally {
20533
+ reader.releaseLock();
20534
+ }
20535
+ if (buffer3.length > 0) {
20536
+ throw new Error("Devin Connect upstream ended with an incomplete frame");
20537
+ }
20538
+ if (!sawTrailer) {
20539
+ throw new Error("Devin Connect upstream ended before the terminal trailer");
20540
+ }
20541
+ const toolCalls = toolCallOrder.map((id) => {
20542
+ const call = toolCallById.get(id);
20543
+ return {
20544
+ id: call.id,
20545
+ type: "function",
20546
+ function: {
20547
+ name: call.name,
20548
+ arguments: call.argumentsText || "{}"
20549
+ }
20550
+ };
20551
+ });
20552
+ if (!text && !reasoning && toolCalls.length === 0) {
20553
+ throw new Error("Devin Connect upstream completed without content or tool calls");
20554
+ }
20555
+ return {
20556
+ content: text,
20557
+ model: selectedModel,
20558
+ provider: "devin",
20559
+ ...reasoning ? { reasoning_content: reasoning } : {},
20560
+ ...toolCalls.length > 0 ? { tool_calls: toolCalls } : {},
20561
+ // The upstream finish event wins whenever it is present. A tool call
20562
+ // cut off by the length limit has to stay "length" instead of being
20563
+ // relabelled "tool_calls", so probes/telemetry and any downstream
20564
+ // consumer of the final finish_reason no longer see a truncated turn
20565
+ // mislabelled as a normal one. localLoop keeps its own truncation
20566
+ // gates and excludes tool-bearing turns from them.
20567
+ finish_reason: finishReason ?? (toolCalls.length > 0 ? "tool_calls" : "stop"),
20568
+ stream_complete: true
20569
+ };
20570
+ }
20571
+ };
20572
+ }
20573
+
20062
20574
  export {
20063
20575
  Option_exports,
20064
20576
  Duration_exports,
@@ -20068,6 +20580,7 @@ export {
20068
20580
  readActionGate,
20069
20581
  evaluateFileWritePolicy,
20070
20582
  summarizeToolArguments,
20583
+ formatToolOverflowMarker,
20071
20584
  LOCAL_AGENT_CONFIG_MISSING_CODE,
20072
20585
  LOCAL_TURN_ABORTED_CODE,
20073
20586
  runLocalAgentTurn,
@@ -20110,5 +20623,6 @@ export {
20110
20623
  shouldUseGeminiNativeToolRoute,
20111
20624
  buildGeminiGenerateContentRequest,
20112
20625
  resolveAntigravityFinishReason,
20113
- fetchAntigravityCloudCodeCompletion
20626
+ fetchAntigravityCloudCodeCompletion,
20627
+ createDevinProvider
20114
20628
  };